void drawScene(camera_s* c, portal_s* p, int depth, u8 stencil) { if(!c)return; gsMatrixMode(GS_MODELVIEW); gsPushMatrix(); gsLoadIdentity(); useCamera(c); drawRoom(&testRoom); drawCubeDispensers(); drawEnergyDevices(); drawEnergyBalls(); drawPlatforms(); drawBigButtons(); drawTimedButtons(); drawWallDoors(); drawDoors(); drawOBBs(); if(p && depth)drawPlayer(&testPlayer); drawSludge(&testRoom); drawEmancipators(); drawEmancipationGrids(); if(p == &portals[0])drawPortals((portal_s*[]){&portals[0]}, 1, drawScene, c, depth, stencil);
static inline void render2(void) { if(!(orangeSeen||blueSeen)){previousPortal=NULL;return;} if((orangeSeen&&blueSeen)/*||(!orangeSeen&&!blueSeen)*/) { if(switchPortal)currentPortal=&portal1; else currentPortal=&portal2; }else if(orangeSeen)currentPortal=&portal1; else if(blueSeen)currentPortal=&portal2; previousPortal=currentPortal; switchPortal^=1; glClearColor(0,0,0,31); updatePortalCamera(currentPortal, NULL); projectCamera(¤tPortal->camera); glPushMatrix(); glScalef32(SCALEFACT,SCALEFACT,SCALEFACT); renderGun(NULL); transformCamera(¤tPortal->camera); // drawRoomsGame(0); drawPortalRoom(currentPortal); drawPlayer(NULL); drawOBBs(); drawBigButtons(); drawTimedButtons(); drawEnergyDevices(); drawEnergyBalls(); drawPlatforms(); drawCubeDispensers(); drawTurretsStuff(); drawEmancipators(); drawEmancipationGrids(); drawDoors(); drawWallDoors(currentPortal); drawSludge(&gameRoom); glPopMatrix(1); glFlush(0); }
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); }