void stressTest() { int j,i; char temp[80]; for(i =0; i < 9; i++) { j=testCount%4+1; testCount++; if(j==Top) { SpawnMine(crandom(w),maxy,0.0f, 1*crandom(1),1*crandom(1), 0.0f, j); } if(j==Bottom) { SpawnMine(crandom(w),miny,0.0f, 1*crandom(1),1*crandom(1), 0.0f,j); } if(j==Right) { SpawnMine(maxx,crandom(h),0.0f, 1*crandom(1),1*crandom(1), 0.0f, j); } if(j==Left) { SpawnMine(miny,crandom(h),0.0f, 1*crandom(1),1*crandom(1), 0.0f, j); } } sprintf(temp,"%i",testCount); NewMessage(temp,IndexColor(White)); }
void mineThink(entity *self) { Coord TempS; /*temp position*/ Coord cam; bsp *node; int i; Coord downvect; self->rotation.z+=10; UpdatePosition(self); cam.x = self->s.x; cam.y = self->s.y; cam.z = self->s.z; downvect.x = 0; downvect.y = 0; downvect.z = -1; node = checkBsp(self->s); for (i = 0; i < node->numTris; i++) { if(RayInTriangle(cam, downvect, node->triList[i]->v1, node->triList[i]->v2, node->triList[i]->v3, &TempS) == -1) { self->s.z=TempS.z+2; break; } } if(self->s.x > maxx || self->s.x < minx || self->s.y > maxy || self->s.y < miny) { if(self->state==Top) { SpawnMine(crandom(w),maxy,0.0f, 1*crandom(1),1*crandom(1), 0.0f, self->state); } if(self->state==Bottom) { SpawnMine(crandom(w),miny,0.0f, 1*crandom(1),1*crandom(1), 0.0f, self->state); } if(self->state==Right) { SpawnMine(maxx,crandom(h),0.0f, 1*crandom(1),1*crandom(1), 0.0f, self->state); } if(self->state==Left) { SpawnMine(minx,crandom(h),0.0f, 1*crandom(1),1*crandom(1), 0.0f, self->state); } freeEntity(self); return; } }
void FollowEnemy::TimeToLayMine(void) { if (m_MineTimer < pTimer->Seconds()) { ResetTimer(); SpawnMine(); } }
void MenuUpdate() { Uint8 *keys; int i,j; static float pulse=0.5f; static int flag=0; static float fadein =0.0f; keys = SDL_GetKeyState(NULL); if(inMenu == 1) { if(fadein < 1) fadein += 0.01f; if(flag == 0) { if(pulse < 1) { pulse += 0.08f; }else flag = 1; } if(flag == 1) { if(pulse > 0.5f) { pulse -= 0.08f; }else flag = 0; } if(keys[SDLK_RETURN]) { testCount = 0; inMenu=0; SpawnPlayer(0,0,0); for(i=0;i<1000;i++) { testCount = i; j=i%4+1; if(j==Top) { SpawnMine(crandom(w),maxy,0.0f, 1*crandom(1),1*crandom(1), 0.0f, j); } if(j==Bottom) { SpawnMine(crandom(w),miny,0.0f, 1*crandom(1),1*crandom(1), 0.0f,j); } if(j==Right) { SpawnMine(maxx,crandom(h),0.0f, 1*crandom(1),1*crandom(1), 0.0f, j); } if(j==Left) { SpawnMine(miny,crandom(h),0.0f, 1*crandom(1),1*crandom(1), 0.0f, j); } } } glColor4f(1,1,1,fadein); DrawSprite(title,0,0,0,1); if(fadein >= 0.6f) { glColor4f(pulse,0,0,1); DrawSprite(newGame,128,S_Data.yres - (700*0.5f),0,0.5f); } glColor4f(1,1,1,1); } }