void CItems::OnRender() { if(Client()->State() < IClient::STATE_ONLINE) return; int Num = Client()->SnapNumItems(IClient::SNAP_CURRENT); for(int i = 0; i < Num; i++) { IClient::CSnapItem Item; const void *pData = Client()->SnapGetItem(IClient::SNAP_CURRENT, i, &Item); if(Item.m_Type == NETOBJTYPE_PROJECTILE) { RenderProjectile((const CNetObj_Projectile *)pData, Item.m_ID); } else if(Item.m_Type == NETOBJTYPE_PICKUP) { const void *pPrev = Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_ID); if(pPrev) RenderPickup((const CNetObj_Pickup *)pPrev, (const CNetObj_Pickup *)pData); } else if(Item.m_Type == NETOBJTYPE_LASER) { RenderLaser((const CNetObj_Laser *)pData); } } // render flag for(int i = 0; i < Num; i++) { IClient::CSnapItem Item; const void *pData = Client()->SnapGetItem(IClient::SNAP_CURRENT, i, &Item); if(Item.m_Type == NETOBJTYPE_FLAG) { const void *pPrev = Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_ID); if (pPrev) { const void *pPrevGameData = Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_GAMEDATA, m_pClient->m_Snap.m_GameDataSnapID); RenderFlag(static_cast<const CNetObj_Flag *>(pPrev), static_cast<const CNetObj_Flag *>(pData), static_cast<const CNetObj_GameData *>(pPrevGameData), m_pClient->m_Snap.m_pGameDataObj); } } } // render extra projectiles for(int i = 0; i < m_NumExtraProjectiles; i++) { if(m_aExtraProjectiles[i].m_StartTick < Client()->GameTick()) { m_aExtraProjectiles[i] = m_aExtraProjectiles[m_NumExtraProjectiles-1]; m_NumExtraProjectiles--; } else RenderProjectile(&m_aExtraProjectiles[i], 0); } }
static int RenderLaser (CObject* objP, int bForce) { if (gameStates.render.bQueryCoronas && (gameStates.render.nType != 1)) return 0; if (gameStates.render.nShadowPass != 2) { RenderLaser (objP); if (objP->info.nType == OBJ_WEAPON) RenderLightTrail (objP); } return 1; }
void CItems::OnRender() { int Num = Client()->SnapNumItems(IClient::SNAP_CURRENT); for(int i = 0; i < Num; i++) { IClient::CSnapItem Item; const void *pData = Client()->SnapGetItem(IClient::SNAP_CURRENT, i, &Item); if(Item.m_Type == NETOBJTYPE_PROJECTILE) { RenderProjectile((const CNetObj_Projectile *)pData, Item.m_Id); } else if(Item.m_Type == NETOBJTYPE_PICKUP) { const void *pPrev = Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_Id); if(pPrev) RenderPickup((const CNetObj_Pickup *)pPrev, (const CNetObj_Pickup *)pData); } else if(Item.m_Type == NETOBJTYPE_LASER) { RenderLaser((const CNetObj_Laser *)pData); } } // render flag for(int i = 0; i < Num; i++) { IClient::CSnapItem Item; const void *pData = Client()->SnapGetItem(IClient::SNAP_CURRENT, i, &Item); if(Item.m_Type == NETOBJTYPE_FLAG) { const void *pPrev = Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_Id); if (pPrev) RenderFlag((const CNetObj_Flag *)pPrev, (const CNetObj_Flag *)pData); } } // render extra projectiles /* for(int i = 0; i < extraproj_num; i++) { if(extraproj_projectiles[i].start_tick < Client()->GameTick()) { extraproj_projectiles[i] = extraproj_projectiles[extraproj_num-1]; extraproj_num--; } else render_projectile(&extraproj_projectiles[i], 0); }*/ }
int RenderObject (CObject *objP, int nWindow, int bForce) { short nObject = objP->Index (); int bSpectate = 0, bDepthSort = RENDERPATH || (gameOpts->render.bDepthSort > 0); int nType = objP->info.nType; if (nType == 255) { objP->Die (); return 0; } int bEmissive = (objP->info.nType == OBJ_WEAPON) && gameData.objs.bIsWeapon [objP->info.nId] && !gameData.objs.bIsMissile [objP->info.nId]; if (bEmissive && gameStates.render.bQueryCoronas) return 0; if ((gameStates.render.nShadowPass != 2) && (objP == gameData.objs.guidedMissile [gameData.multiplayer.nLocalPlayer].objP) && (objP->info.nSignature == gameData.objs.guidedMissile [gameData.multiplayer.nLocalPlayer].nSignature)) { return 0; } #if DBG if (nObject == nDbgObj) nDbgObj = nDbgObj; #endif if (nObject != LOCALPLAYER.nObject) { if (objP == gameData.objs.viewerP) return 0; } else if ((gameData.objs.viewerP == gameData.objs.consoleP) && !automap.m_bDisplay) { if ((bSpectate = (gameStates.render.bFreeCam && !nWindow))) ; #if DBG else if ((gameStates.render.nShadowPass != 2) && !gameStates.app.bPlayerIsDead && (nWindow || (!gameStates.render.bChaseCam && (gameStates.app.bEndLevelSequence < EL_LOOKBACK)))) { //don't render ship model if neither external view nor main view #else else if ((gameStates.render.nShadowPass != 2) && !gameStates.app.bPlayerIsDead && (nWindow || ((IsMultiGame && !IsCoopGame && !EGI_FLAG (bEnableCheats, 0, 0, 0)) || (!gameStates.render.bChaseCam && (gameStates.app.bEndLevelSequence < EL_LOOKBACK))))) { #endif #if 0 if (gameOpts->render.particles.bPlayers) { SEM_ENTER (SEM_SMOKE) DoPlayerSmoke (objP, -1); SEM_LEAVE (SEM_SMOKE) } #endif return 0; } } if ((nType == OBJ_NONE)/* || (nType==OBJ_CAMBOT)*/){ #if TRACE console.printf (1, "ERROR!!!Bogus obj %d in seg %d is rendering!\n", nObject, objP->info.nSegment); #endif return 0; } int mldSave = gameStates.render.detail.nMaxLinearDepth; gameStates.render.nState = 1; gameData.objs.color.index = 0; gameStates.render.detail.nMaxLinearDepth = gameStates.render.detail.nMaxLinearDepthObjects; switch (objP->info.renderType) { case RT_NONE: if (gameStates.render.nType != 1) return 0; break; case RT_POLYOBJ: if (nType == OBJ_EFFECT) { objP->info.renderType = (objP->info.nId == SMOKE_ID) ? RT_SMOKE : RT_LIGHTNING; return 0; } if (gameStates.render.nType != 1) return 0; if (nType == OBJ_PLAYER) { if (!RenderPlayerModel (objP, bDepthSort, bSpectate)) return 0; } else if (nType == OBJ_ROBOT) { if (!RenderRobotModel (objP, bDepthSort, bSpectate)) return 0; } else if (nType == OBJ_WEAPON) { if (!RenderWeaponModel (objP, bDepthSort, bSpectate)) return 0; } else if (nType == OBJ_REACTOR) { if (!RenderReactorModel (objP, bDepthSort, bSpectate)) return 0; } else if (nType == OBJ_POWERUP) { if (!RenderPowerupModel (objP, bDepthSort, bSpectate)) return 0; } else if (nType == OBJ_HOSTAGE) { if (!RenderHostageModel (objP, bDepthSort, bSpectate)) return 0; } else { if (!RenderPolyModel (objP, bDepthSort, bSpectate)) return 0; } break; case RT_MORPH: if (gameStates.render.nType != 1) return 0; if (gameStates.render.nShadowPass != 2) objP->MorphDraw (); break; case RT_THRUSTER: if (gameStates.render.bQueryCoronas || (gameStates.render.nType != 1)) return 0; if (nWindow && (objP->mType.physInfo.flags & PF_WIGGLE)) break; case RT_FIREBALL: if (!RenderFireball (objP, bForce)) return 0; break; case RT_EXPLBLAST: if (!RenderExplBlast (objP, bForce)) return 0; break; case RT_SHRAPNELS: if (!RenderShrapnel (objP, bForce)) return 0; break; case RT_WEAPON_VCLIP: if (!RenderWeapon (objP, bForce)) return 0; break; case RT_HOSTAGE: if (!RenderHostage (objP, bDepthSort, bForce)) return 0; break; case RT_POWERUP: if (!RenderPowerup (objP, bDepthSort, bForce)) return 0; break; case RT_LASER: if (!RenderLaser (objP, bForce)) return 0; break; case RT_SMOKE: case RT_LIGHTNING: break; default: PrintLog ("Unknown renderType <%d>\n", objP->info.renderType); } #ifdef NEWDEMO if (objP->info.renderType != RT_NONE) if (gameData.demo.nState == ND_STATE_RECORDING) { if (!gameData.demo.bWasRecorded [nObject]) { NDRecordRenderObject (objP); gameData.demo.bWasRecorded [nObject] = 1; } } #endif gameStates.render.detail.nMaxLinearDepth = mldSave; gameData.render.nTotalObjects++; ogl.ClearError (0); return 1; }
void CItems::OnRender() { if(Client()->State() < IClient::STATE_ONLINE) return; int Num = Client()->SnapNumItems(IClient::SNAP_CURRENT); for(int i = 0; i < Num; i++) { IClient::CSnapItem Item; const void *pData = Client()->SnapGetItem(IClient::SNAP_CURRENT, i, &Item); if(Item.m_Type == NETOBJTYPE_PROJECTILE) { RenderProjectile((const CNetObj_Projectile *)pData, Item.m_ID); } else if(Item.m_Type == NETOBJTYPE_PICKUP) { const void *pPrev = Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_ID); if(pPrev) RenderPickup((const CNetObj_Pickup *)pPrev, (const CNetObj_Pickup *)pData); } else if(Item.m_Type == NETOBJTYPE_LASER) { RenderLaser((const CNetObj_Laser *)pData); } //ModAPI else if(Item.m_Type == NETOBJTYPE_MODAPI_SPRITE) { const void *pPrev = Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_ID); if(pPrev) RenderModAPISprite((const CNetObj_ModAPI_Sprite *)pPrev, (const CNetObj_ModAPI_Sprite *)pData); } else if(Item.m_Type == NETOBJTYPE_MODAPI_SPRITECHARACTER) { const void *pPrev = Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_ID); if(pPrev) RenderModAPISpriteCharacter((const CNetObj_ModAPI_SpriteCharacter *)pPrev, (const CNetObj_ModAPI_SpriteCharacter *)pData); } else if(Item.m_Type == NETOBJTYPE_MODAPI_LINE) { RenderModAPILine((const CNetObj_ModAPI_Line *)pData); } } // render flag for(int i = 0; i < Num; i++) { IClient::CSnapItem Item; const void *pData = Client()->SnapGetItem(IClient::SNAP_CURRENT, i, &Item); if(Item.m_Type == NETOBJTYPE_FLAG) { const void *pPrev = Client()->SnapFindItem(IClient::SNAP_PREV, Item.m_Type, Item.m_ID); if (pPrev) { const void *pPrevGameDataFlag = Client()->SnapFindItem(IClient::SNAP_PREV, NETOBJTYPE_GAMEDATAFLAG, m_pClient->m_Snap.m_GameDataFlagSnapID); RenderFlag(static_cast<const CNetObj_Flag *>(pPrev), static_cast<const CNetObj_Flag *>(pData), static_cast<const CNetObj_GameDataFlag *>(pPrevGameDataFlag), m_pClient->m_Snap.m_pGameDataFlag); } } } }