void BotBotCollisionGrid::Setup(Vector3i Dimensions) { assert(Dimensions.x() > 0 && "Attempting to create a world grid with zero x dimensions"); assert(Dimensions.y() > 0 && "Attempting to create a world grid with zero y dimensions"); SetupLevel(Grid1, Dimensions, 64); SetupLevel(Grid2, Dimensions, 128); SetupLevel(Grid3, Dimensions, 256); SetupLevel(Grid4, Dimensions, 512); MasterGrid.clear(); }
void FGLRenderer::Initialize() { // Only needed for the core profile, because someone decided it was a good idea to remove the default VAO. if (gl.version >= 4.0) { glGenVertexArrays(1, &mVAOID); glBindVertexArray(mVAOID); } else mVAOID = 0; gllight = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/gllight.png"), FTexture::TEX_MiscPatch); glpart2 = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/glpart2.png"), FTexture::TEX_MiscPatch); glpart = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/glpart.png"), FTexture::TEX_MiscPatch); mirrortexture = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/mirror.png"), FTexture::TEX_MiscPatch); mVBO = new FFlatVertexBuffer; mSkyVBO = new FSkyVertexBuffer; if (gl.lightmethod != LM_SOFTWARE) mLights = new FLightBuffer(); else mLights = NULL; gl_RenderState.SetVertexBuffer(mVBO); mFBID = 0; mOldFBID = 0; SetupLevel(); mShaderManager = new FShaderManager; mSamplerManager = new FSamplerManager; gl_LoadModels(); }
void main() { Level = (STARTLEV-1); SetupLevel(); /* Display the first level */ /* Loop keyhandler till you finished the game */ while (CheckNotFinished()) Gamekeys(); }
void FGLRenderer::Initialize() { glpart2 = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/glpart2.png"), FTexture::TEX_MiscPatch); glpart = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/glpart.png"), FTexture::TEX_MiscPatch); mirrortexture = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/mirror.png"), FTexture::TEX_MiscPatch); gllight = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/gllight.png"), FTexture::TEX_MiscPatch); mVBO = new FVertexBuffer; mFBID = 0; SetupLevel(); mShaderManager = new FShaderManager; }
void Gamekeys(void) { char *charptr; /* Set up a pointer to the variable we want to change * (either the box or the ball) */ charptr = PieceIsBall ? &BoxOffset : &BallOffset; switch(getk()) { case K_DOWN: MovePiece(charptr,0,+1); break; case K_UP: MovePiece(charptr,0,-1); break; case K_RIGHT: MovePiece(charptr,+1,0); break; case K_LEFT: MovePiece(charptr,-1,0); break; case K_SWITCH: PieceIsBall^=1; /* Toggle ball/box */ break; case K_EXIT: exit(0); case K_NEXTLEV: /* Okay this IS cheating... */ if(++Level==MAXLEVEL) { --Level; break; } SetupLevel(); break; case K_PREVLEV: if(--Level==-1) { ++Level; break; } /* fall thrue */ case K_CLEAR: SetupLevel(); } }
void main() { OpenWindow(); /* Open a window (if needed) */ Level = (STARTLEV-1); SetupLevel(); /* Display the first level */ /* Loop keyhandler till you finished the game */ while (CheckNotFinished()) Gamekeys(); MyExit(); /* Close the window (if needed) */ }
/* Check if a Level is (not) finished: * There are 144 squares in each Level * * Note the use of != instead of < or <= * - this is faster to execute on the Z80! */ char CheckNotFinished(void) { char *ptr; int i; ptr = Board; for(i=1 ; i!=144 ; i++) { if(*ptr++ == BUBB) return(TRUE); /* Are there any bubbles? */ } if(++Level == MAXLEVEL) return(FALSE); /* All levels done? */ SetupLevel(); /* If not => Next Level! */ return(TRUE); /* And keep scanning keys */ }
void FGLRenderer::Initialize() { glpart2 = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/glpart2.png"), FTexture::TEX_MiscPatch); glpart = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/glpart.png"), FTexture::TEX_MiscPatch); mirrortexture = FTexture::CreateTexture(Wads.GetNumForFullName("glstuff/mirror.png"), FTexture::TEX_MiscPatch); mVBO = new FFlatVertexBuffer; mSkyVBO = new FSkyVertexBuffer; mLights = new FLightBuffer(); gl_RenderState.SetVertexBuffer(mVBO); mFBID = 0; SetupLevel(); mShaderManager = new FShaderManager; mSamplerManager = new FSamplerManager; gl_LoadModels(); }
void G_DoLoadLevel(void) { Word Sky; if (players.playerstate == PST_DEAD) { players.playerstate = PST_REBORN; /* Force rebirth */ } /* Set the sky map for the episode */ if (gamemap < 9 || gamemap==24) { /* First 9 levels? */ Sky = rSKY1; } else if (gamemap < 18) { Sky = rSKY2; } else { Sky = rSKY3; } SkyTexture = &TextureInfo[Sky-FirstTexture]; /* Set pointer to sky texture record */ SkyTexture->data = LoadAResourceHandle(Sky); /* Preload the sky texture */ SetupLevel(gamemap); /* Load the level into memory */ gameaction = ga_nothing; /* Game in progress */ }
/* Check if a Level is (not) finished: * There are 144 squares in each Level * * Note the use of != instead of < or <= * - this is faster to execute on the Z80! */ char CheckNotFinished(void) { char *ptr; int i; ptr = Board; #ifdef __ZX80__ gen_tv_field(); #endif for(i=1 ; i!=144 ; i++) { if(*ptr++ == BUBB) return(TRUE); /* Are there any bubbles? */ #ifdef __ZX80__ if ((i%9)==8) gen_tv_field(); #endif } if(++Level == MAXLEVEL) return(FALSE); /* All levels done? */ SetupLevel(); /* If not => Next Level! */ return(TRUE); /* And keep scanning keys */ }
void Gamekeys(void) { char *charptr; /* Set up a pointer to the variable we want to change * (either the box or the ball) */ charptr = PieceIsBall ? &BoxOffset : &BallOffset; switch(fgetc_cons()) { #ifndef DKTRONICS #ifndef __ZX80__ case '0': #asm ld a,$1e ld i,a #endasm break; case '1': #asm ld a,$2e ld i,a #endasm break; case '2': #asm ld a,$84 ld i,a #endasm break; case '3': #asm ld a,$8e ld i,a #endasm break; case '4': #asm ld a,$9e ld i,a #endasm break; case '5': #asm ld a,$30 ld i,a #endasm break; case '6': #asm ld a,$32 ld i,a #endasm break; #endif #endif case K_DOWN: MovePiece(charptr,0,+1); break; case K_UP: MovePiece(charptr,0,-1); break; case K_RIGHT: MovePiece(charptr,+1,0); break; case K_LEFT: MovePiece(charptr,-1,0); break; case K_SWITCH: PieceIsBall^=1; /* Toggle ball/box */ #ifdef SOUND bit_fx4 (5); #endif //while (getk() == K_SWITCH) {} #ifdef __ZX80__ // make the display 'hop' to notify that we're switching gen_tv_field(); #endif break; case K_EXIT: exit(0); case K_NEXTLEV: /* Okay this IS cheating... */ if(++Level==MAXLEVEL) { --Level; break; } SetupLevel(); break; case K_PREVLEV: if(--Level==-1) { ++Level; break; } /* fall thrue */ case K_CLEAR: #ifdef SOUND bit_fx4 (3); #endif SetupLevel(); break; } }