toweringinferno::WorldEvents toweringinferno::World::update( const TCOD_key_t& command ) { if (isMovementKey(command.vk) == false && isActionKey(command) == false && isDoorToggleKey(command) == false && isAxeKey(command) == false && command.vk != TCODK_SPACE) { return eEvent_InvalidInput; } if (m_player.isDead()) { return eEvent_PlayerDied; } if ((updateDoors(command) == eAction_Failed && updateSprinklerControl(command) == eAction_Failed && updateHoseRelease(command) == eAction_Failed) || updateAxe(command) == eAction_Failed ) { // the player may have hit it by mistake, ignore it return eEvent_InvalidInput; } if (calculateNewPlayerPos(command.vk, m_player.getPos()) == eAction_Failed) { return eEvent_InvalidInput; } m_player.update(*this); updateDynamics(); return getType(m_player.getPos()) == eStairsDown ? eEvent_NextFloorDown : eEvent_None; }
static inline void render1(void) { scanKeys(); // cpuEndSlice(); playerControls(NULL); updateControls(); // iprintf("controls : %d \n",cpuEndSlice()); updatePlayer(NULL); // iprintf("player : %d \n",cpuEndSlice()); updatePortals(); updateTurrets(); updateBigButtons(); updateTimedButtons(); updateEnergyDevices(); updateEnergyBalls(); updatePlatforms(); updateCubeDispensers(); updateEmancipators(); updateEmancipationGrids(); updateDoors(); updateWallDoors(); // iprintf("updates : %d \n",cpuEndSlice()); // if(currentPortal)GFX_CLEAR_COLOR=currentPortal->color|(31<<16); // else GFX_CLEAR_COLOR=0; u16 color=getCurrentPortalColor(getPlayer()->object->position); // NOGBA("col %d",color); // GFX_CLEAR_COLOR=color|(31<<16); GFX_CLEAR_COLOR=RGB15(0,0,0)|(31<<16); #ifdef DEBUG_GAME if(fifoCheckValue32(FIFO_USER_08))iprintf("\x1b[0J"); while(fifoCheckValue32(FIFO_USER_08)){int32 cnt=fifoGetValue32(FIFO_USER_08);iprintf("ALERT %d \n",cnt);NOGBA("ALERT %d \n",cnt);} #else while(fifoCheckValue32(FIFO_USER_08)){int32 cnt=fifoGetValue32(FIFO_USER_08);NOGBA("ALERT %d \n",cnt);} #endif projectCamera(NULL); glPushMatrix(); glScalef32(SCALEFACT,SCALEFACT,SCALEFACT); renderGun(NULL); transformCamera(NULL); cpuEndSlice(); // drawRoomsGame(128, color); drawRoomsGame(0, color); // drawCell(getCurrentCell(getPlayer()->currentRoom,getPlayerCamera()->position)); // iprintf("room : %d \n",cpuEndSlice()); updateParticles(); drawParticles(); // iprintf("particles : %d \n",cpuEndSlice()); drawOBBs(); // iprintf("OBBs : %d \n",cpuEndSlice()); drawBigButtons(); drawTimedButtons(); drawEnergyDevices(); drawEnergyBalls(); drawPlatforms(); drawCubeDispensers(); drawTurretsStuff(); drawEmancipators(); drawEmancipationGrids(); drawDoors(); drawWallDoors(NULL); drawSludge(&gameRoom); // iprintf("stuff : %d \n",cpuEndSlice()); drawPortal(&portal1); drawPortal(&portal2); glPopMatrix(1); //HUD TEST if(levelInfoCounter>0 && (levelTitle || levelAuthor)) { levelInfoCounter--; glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrthof32(inttof32(0), inttof32(255), inttof32(191), inttof32(0), -inttof32(1), inttof32(1)); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); if(levelTitle)drawCenteredString(levelTitle, inttof32(17)/10, (82)); if(levelAuthor)drawCenteredString(levelAuthor, inttof32(1), (100)); glPopMatrix(1); glMatrixMode(GL_PROJECTION); glPopMatrix(1); } glFlush(0); }