void drawTurretStuff(turret_struct* t) { if(!t || !t->used || t->dead)return; drawLaser(t->laserOrigin,t->laserDestination); if(t->laserThroughPortal)drawLaser(t->laserOrigin2,t->laserDestination2); //TEMP TEST BILLBOARD vect3D u1=vect(t->OBB->transformationMatrix[0],t->OBB->transformationMatrix[3],t->OBB->transformationMatrix[6]); vect3D u2=vect(t->OBB->transformationMatrix[1],t->OBB->transformationMatrix[4],t->OBB->transformationMatrix[7]); vect3D u3=vect(t->OBB->transformationMatrix[2],t->OBB->transformationMatrix[5],t->OBB->transformationMatrix[8]); glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK | POLY_ID(63)); GFX_COLOR=RGB15(31,31,31); applyMTL(turretShotTexture); if(t->drawShot[0]) { glPushMatrix(); glTranslatef32(t->laserOrigin.x, t->laserOrigin.y, t->laserOrigin.z); glTranslatef32(u3.x/128, u3.y/128, u3.z/128); glTranslatef32(u1.x/32, u1.y/32, u1.z/32); glScalef32(inttof32(1)/16,inttof32(1)/16,inttof32(1)/16); glRotatef32i(t->shotAngle[0],u3.x,u3.y,u3.z); glBegin(GL_QUADS); GFX_TEX_COORD = TEXTURE_PACK(inttot16(0), inttot16(0)); glVertex3v16(-u1.x/2-u2.x, -u1.y/2-u2.y, -u1.z/2-u2.z); GFX_TEX_COORD = TEXTURE_PACK(inttot16(32), inttot16(0)); glVertex3v16(+u1.x/2-u2.x, +u1.y/2-u2.y, +u1.z/2-u2.z); GFX_TEX_COORD = TEXTURE_PACK(inttot16(32), inttot16(64)); glVertex3v16(+u1.x/2+u2.x, +u1.y/2+u2.y, +u1.z/2+u2.z); GFX_TEX_COORD = TEXTURE_PACK(inttot16(0), inttot16(64)); glVertex3v16(-u1.x/2+u2.x, -u1.y/2+u2.y, -u1.z/2+u2.z); glPopMatrix(1); } if(t->drawShot[1]) { glPushMatrix(); glTranslatef32(t->laserOrigin.x, t->laserOrigin.y, t->laserOrigin.z); glTranslatef32(u3.x/128, u3.y/128, u3.z/128); glTranslatef32(-u1.x/32, -u1.y/32, -u1.z/32); glScalef32(inttof32(1)/16,inttof32(1)/16,inttof32(1)/16); glRotatef32i(t->shotAngle[1],u3.x,u3.y,u3.z); glBegin(GL_QUADS); GFX_TEX_COORD = TEXTURE_PACK(inttot16(0), inttot16(0)); glVertex3v16(-u1.x/2-u2.x, -u1.y/2-u2.y, -u1.z/2-u2.z); GFX_TEX_COORD = TEXTURE_PACK(inttot16(32), inttot16(0)); glVertex3v16(+u1.x/2-u2.x, +u1.y/2-u2.y, +u1.z/2-u2.z); GFX_TEX_COORD = TEXTURE_PACK(inttot16(32), inttot16(64)); glVertex3v16(+u1.x/2+u2.x, +u1.y/2+u2.y, +u1.z/2+u2.z); GFX_TEX_COORD = TEXTURE_PACK(inttot16(0), inttot16(64)); glVertex3v16(-u1.x/2+u2.x, -u1.y/2+u2.y, -u1.z/2+u2.z); glPopMatrix(1); } }
void drawLogo(void) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrthof32(inttof32(0), inttof32(255), inttof32(191), inttof32(0), -inttof32(1), inttof32(1)); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glPushMatrix(); glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE); applyMTL(logoMain); glScalef32(inttof32(256),inttof32(128),inttof32(1)); glBegin(GL_QUADS); GFX_TEX_COORD = TEXTURE_PACK(inttot16(0), inttot16(0)); glVertex3v16(inttof32(0), inttof32(0), inttof32(0)); GFX_TEX_COORD = TEXTURE_PACK(inttot16(256), inttot16(0)); glVertex3v16(inttof32(1), inttof32(0), inttof32(0)); GFX_TEX_COORD = TEXTURE_PACK(inttot16(256), inttot16(128)); glVertex3v16(inttof32(1), inttof32(1), inttof32(0)); GFX_TEX_COORD = TEXTURE_PACK(inttot16(0), inttot16(128)); glVertex3v16(inttof32(0), inttof32(1), inttof32(0)); glPopMatrix(1); glPushMatrix(); glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE); applyMTL(logoRotate); glTranslate3f32(inttof32(90+32),inttof32(28+32),-inttof32(1)/16); glRotateZi(logoAngle+=32); glTranslate3f32(-inttof32(32),-inttof32(32),0); glScalef32(inttof32(64),inttof32(64),inttof32(1)); glBegin(GL_QUADS); GFX_TEX_COORD = TEXTURE_PACK(inttot16(0), inttot16(0)); glVertex3v16(inttof32(0), inttof32(0), inttof32(0)); GFX_TEX_COORD = TEXTURE_PACK(inttot16(64), inttot16(0)); glVertex3v16(inttof32(1), inttof32(0), inttof32(0)); GFX_TEX_COORD = TEXTURE_PACK(inttot16(64), inttot16(64)); glVertex3v16(inttof32(1), inttof32(1), inttof32(0)); GFX_TEX_COORD = TEXTURE_PACK(inttot16(0), inttot16(64)); glVertex3v16(inttof32(0), inttof32(1), inttof32(0)); glPopMatrix(1); }
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); }
void Map2D::DrawBG( int PlayerX, int PlayerY, s32 z, const glImage *BGTiles ) { glPushMatrix(); glScalef32( 12 << 12, 12 << 12, 5 << 12); for( int y = -2; y < 3; y++ ) { for( int x = -2; x < 4; x++ ) { glQuad3D( x * TILE_SIZE_3D, y * TILE_SIZE_3D, z, floattov16(1), floattov16(1), GL_FLIP_NONE, &BGTiles[0] ); } } glPopMatrix(1); }
void drawRoomEditor(void) { projectCamera(&editorCamera); glLoadIdentity(); glPushMatrix(); glScalef32(editorScale,editorScale,editorScale); transformCamera(&editorCamera); drawEditorRoom(&editorRoom); drawEntities(); drawSelection(NULL); glPopMatrix(1); drawContextButtons(); 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); }