void NetworkCountPowerupsInMine (void) { int i; memset (gameData.multiplayer.powerupsInMine, 0, sizeof (gameData.multiplayer.powerupsInMine)); for (i = 0; i <= gameData.objs.nLastObject; i++) { if (gameData.objs.objects [i].nType == OBJ_POWERUP) { gameData.multiplayer.powerupsInMine [gameData.objs.objects [i].id]++; if (MultiPowerupIs4Pack (gameData.objs.objects [i].id)) gameData.multiplayer.powerupsInMine [gameData.objs.objects [i].id-1]+=4; } } }
int CreatePowerup (ubyte nId, short nCreator, short nSegment, const CFixVector& vPos, int bIgnoreLimits, bool bForce) { if (!bIgnoreLimits && TooManyPowerups ((int) nId)) { #if 0 //DBG HUDInitMessage ("%c%c%c%cDiscarding excess %s!", 1, 127 + 128, 64 + 128, 128, pszPowerup [nId]); TooManyPowerups (nId); #endif return -2; } if (gameStates.gameplay.bMineMineCheat && !bForce && (gameData.objs.bIsEquipment [nId] < 2)) return -1; short nObject = CreateObject (OBJ_POWERUP, nId, nCreator, nSegment, vPos, CFixMatrix::IDENTITY, gameData.objs.pwrUp.info [nId].size, CT_POWERUP, MT_PHYSICS, RT_POWERUP); if ((nObject >= 0) && IsMultiGame && PowerupClass (nId)) { gameData.multiplayer.powerupsInMine [(int) nId]++; if (MultiPowerupIs4Pack (nId)) gameData.multiplayer.powerupsInMine [(int) nId - 1] += 4; } return nObject; }
void VerifyObject (CObject * objP) { objP->info.xLifeLeft = IMMORTAL_TIME; //all loaded CObject are immortal, for now if (objP->info.nType == OBJ_ROBOT) { nGameSaveOrgRobots++; // Make sure valid id... if (objP->info.nId >= gameData.bots.nTypes [gameStates.app.bD1Data]) objP->info.nId %= gameData.bots.nTypes [0]; // Make sure model number & size are correct... if (objP->info.renderType == RT_POLYOBJ) { Assert(ROBOTINFO (objP->info.nId).nModel != -1); //if you fail this assert, it means that a robot in this level //hasn't been loaded, possibly because he's marked as //non-shareware. To see what robot number, print objP->info.nId. Assert(ROBOTINFO (objP->info.nId).always_0xabcd == 0xabcd); //if you fail this assert, it means that the robot_ai for //a robot in this level hasn't been loaded, possibly because //it's marked as non-shareware. To see what robot number, //print objP->info.nId. objP->rType.polyObjInfo.nModel = ROBOTINFO (objP->info.nId).nModel; objP->info.xSize = gameData.models.polyModels [0][objP->rType.polyObjInfo.nModel].Rad (); } if (objP->info.nId == 65) //special "reactor" robots objP->info.movementType = MT_NONE; if (objP->info.movementType == MT_PHYSICS) { objP->mType.physInfo.mass = ROBOTINFO (objP->info.nId).mass; objP->mType.physInfo.drag = ROBOTINFO (objP->info.nId).drag; } } else if (objP->info.nType == OBJ_EFFECT) { gameData.objs.nEffects++; } else { //Robots taken care of above if (objP->info.renderType == RT_POLYOBJ) { char *name = szSavePOFNames [objP->rType.polyObjInfo.nModel]; for (int i = 0; i < gameData.models.nPolyModels; i++) if (!stricmp (pofNames [i], name)) { //found it! objP->rType.polyObjInfo.nModel = i; break; } } } if (objP->info.nType == OBJ_POWERUP) { if (objP->info.nId >= gameData.objs.pwrUp.nTypes + POWERUP_ADDON_COUNT) { objP->info.nId = 0; Assert(objP->info.renderType != RT_POLYOBJ); } objP->info.controlType = CT_POWERUP; if (objP->info.nId >= MAX_POWERUP_TYPES_D2) InitAddonPowerup (objP); else { objP->info.xSize = gameData.objs.pwrUp.info [objP->info.nId].size; objP->cType.powerupInfo.xCreationTime = 0; if (gameData.app.nGameMode & GM_NETWORK) { if (MultiPowerupIs4Pack (objP->info.nId)) { gameData.multiplayer.powerupsInMine [objP->info.nId-1] += 4; gameData.multiplayer.maxPowerupsAllowed [objP->info.nId-1] += 4; } gameData.multiplayer.powerupsInMine [objP->info.nId]++; gameData.multiplayer.maxPowerupsAllowed [objP->info.nId]++; #if TRACE console.printf (CON_DBG, "PowerupLimiter: ID=%d\n", objP->info.nId); if (objP->info.nId > MAX_POWERUP_TYPES) console.printf (1,"POWERUP: Overwriting array bounds!\n"); #endif } } } else if (objP->info.nType == OBJ_WEAPON) { if (objP->info.nId >= gameData.weapons.nTypes [0]) { objP->info.nId = 0; Assert(objP->info.renderType != RT_POLYOBJ); } if (objP->info.nId == SMALLMINE_ID) { //make sure pmines have correct values objP->mType.physInfo.mass = gameData.weapons.info [objP->info.nId].mass; objP->mType.physInfo.drag = gameData.weapons.info [objP->info.nId].drag; objP->mType.physInfo.flags |= PF_FREE_SPINNING; // Make sure model number & size are correct... Assert(objP->info.renderType == RT_POLYOBJ); objP->rType.polyObjInfo.nModel = gameData.weapons.info [objP->info.nId].nModel; objP->info.xSize = gameData.models.polyModels [0][objP->rType.polyObjInfo.nModel].Rad (); } } else if (objP->info.nType == OBJ_REACTOR) { objP->info.renderType = RT_POLYOBJ; objP->info.controlType = CT_CNTRLCEN; if (gameData.segs.nLevelVersion <= 1) { // descent 1 reactor objP->info.nId = 0; // used to be only one kind of reactor objP->rType.polyObjInfo.nModel = gameData.reactor.props [0].nModel;// descent 1 reactor } } else if (objP->info.nType == OBJ_PLAYER) { if (objP == gameData.objs.consoleP) InitPlayerObject (); else if (objP->info.renderType == RT_POLYOBJ) //recover from Matt's pof file matchup bug objP->rType.polyObjInfo.nModel = gameData.pig.ship.player->nModel; //Make sure orient matrix is orthogonal gameOpts->render.nMathFormat = 0; objP->info.position.mOrient.CheckAndFix(); gameOpts->render.nMathFormat = gameOpts->render.nDefMathFormat; objP->info.nId = nGameSavePlayers++; } else if (objP->info.nType == OBJ_HOSTAGE) { objP->info.renderType = RT_HOSTAGE; objP->info.controlType = CT_POWERUP; } objP->Link (); }