std::ostream & operator<<(std::ostream & cout, const Person & p) { cout << "<Person, " << Thing(p) << ", fname:" << p.get_fname() << ", " << "lname:" << p.get_lname() << ", " << "pos:" << p.get_pos() << ", " << "energy:" << p.get_energy() << ">"; return cout; }
void Thing::reproduce()// TODO (argonnia#1#): Reproduction phase from update { if(this->mature) { int litter = (int)rand()%8+1; for(int i=1;i<litter;i++) { this->vector_ptr->push_back(Thing(this->screen_ref,this->vector_ptr,this->posX,this->posY)); } //this->mature=false; this->kill(); } };
/* * Name: main * Purpose: demonstrate the parallel between primitive variable declaration * and object construction. */ int main() { // // // Primitive types // Class types // // //declaration //default constructor int a; Thing thing1; //init. from constant //value constructor int b(1); Thing thing2(5); //constructor notation int c = 2; Thing thing3 = Thing(10); //assignment notation //init. from variable //copy constructor int d(c); Thing thing4(thing3); //constructor notation int e = d; Thing thing5 = thing4; //assignment notation //assignment //assignment int f = 0; Thing thing6; f = e; thing6 = thing5; //variable assignment f = 5; thing6 = Thing(15); //"constant" assignment }
void ofApp::setup() { shader.load("blob"); for (int i = 0; i < 20; things.push_back(Thing()), i++); tex.allocate(512, 1, GL_RGB32F); mesh = ofMesh::plane(ofGetWidth(), ofGetHeight()); ofxUniformGui::get()->setShowKey('s'); }
Thing Thing::create_object( int id = -1 ) { int chance = random_range(100); if ( chance < GROT_CHANCE ) { return Grot(); } else { int chance = random_range(NUM_THING_OBJS); switch ( chance ) { case 1: return GarageDoorOpener(); default: return Grot(); } } return Thing(); }
int main() { function(Thing()); }
void DMEngine::fuseSequnce() { int16 L1424_i_Multiple; #define AL1424_B_RemoveFluxcagesFromLoadChaosSquare L1424_i_Multiple #define AL1424_i_Attack L1424_i_Multiple #define AL1424_i_CreatureTypeSwitchCount L1424_i_Multiple #define AL1424_i_MapX L1424_i_Multiple #define AL1424_i_TextStringThingCount L1424_i_Multiple int16 L1425_i_Multiple; #define AL1425_i_FluxcageMapX L1425_i_Multiple #define AL1425_i_MapY L1425_i_Multiple #define AL1425_i_CycleCount L1425_i_Multiple #define AL1425_i_TextStringThingIndex L1425_i_Multiple int16 L1426_i_Multiple; #define AL1426_i_FluxcageMapY L1426_i_Multiple #define AL1426_i_FuseSequenceUpdateCount L1426_i_Multiple #define AL1426_i_TextStringThingCount L1426_i_Multiple Thing L1427_T_Thing; Group* L1428_ps_Group; Explosion* L1429_ps_Explosion; Thing L1430_T_NextThing; int16 L1431_i_LordChaosMapX; int16 L1432_i_LordChaosMapY; Thing L1433_T_LordChaosThing; char L1434_c_TextFirstCharacter; Thing L1435_aT_TextStringThings[8]; char L1436_ac_String[200]; _gameWon = true; if (_inventoryMan->_inventoryChampionOrdinal) { _inventoryMan->toggleInventory(k4_ChampionCloseInventory); } _eventMan->highlightBoxDisable(); _championMan->_party._magicalLightAmount = 200; _inventoryMan->setDungeonViewPalette(); _championMan->_party._fireShieldDefense = _championMan->_party._spellShieldDefense = _championMan->_party._shieldDefense = 100; _timeline->refreshAllChampionStatusBoxes(); fuseSequenceUpdate(); L1431_i_LordChaosMapX = _dungeonMan->_partyMapX; L1432_i_LordChaosMapY = _dungeonMan->_partyMapY; L1431_i_LordChaosMapX += _dirIntoStepCountEast[_dungeonMan->_partyDir], L1432_i_LordChaosMapY += _dirIntoStepCountNorth[_dungeonMan->_partyDir]; L1428_ps_Group = (Group*)_dungeonMan->getThingData(L1433_T_LordChaosThing = _groupMan->groupGetThing(L1431_i_LordChaosMapX, L1432_i_LordChaosMapY)); L1428_ps_Group->_health[0] = 10000; _dungeonMan->setGroupCells(L1428_ps_Group, k255_CreatureTypeSingleCenteredCreature, _dungeonMan->_partyMapIndex); _dungeonMan->setGroupDirections(L1428_ps_Group, returnOppositeDir(_dungeonMan->_partyDir), _dungeonMan->_partyMapIndex); AL1424_B_RemoveFluxcagesFromLoadChaosSquare = true; AL1425_i_FluxcageMapX = _dungeonMan->_partyMapX; AL1426_i_FluxcageMapY = _dungeonMan->_partyMapY; T0446002: L1427_T_Thing = _dungeonMan->getSquareFirstObject(AL1425_i_FluxcageMapX, AL1426_i_FluxcageMapY); while (L1427_T_Thing != Thing::_endOfList) { if (L1427_T_Thing.getType() == k15_ExplosionThingType) { L1429_ps_Explosion = (Explosion*)_dungeonMan->getThingData(L1427_T_Thing); if (L1429_ps_Explosion->getType() == k50_ExplosionType_Fluxcage) { _dungeonMan->unlinkThingFromList(L1427_T_Thing, Thing(0), AL1425_i_FluxcageMapX, AL1426_i_FluxcageMapY); L1429_ps_Explosion->setNextThing(Thing::_none); goto T0446002; } } L1427_T_Thing = _dungeonMan->getNextThing(L1427_T_Thing); } if (AL1424_B_RemoveFluxcagesFromLoadChaosSquare) { AL1424_B_RemoveFluxcagesFromLoadChaosSquare = false; AL1425_i_FluxcageMapX = L1431_i_LordChaosMapX; AL1426_i_FluxcageMapY = L1432_i_LordChaosMapY; goto T0446002; } fuseSequenceUpdate(); for (AL1424_i_Attack = 55; AL1424_i_Attack <= 255; AL1424_i_Attack += 40) { _projexpl->createExplosion(Thing::_explFireBall, AL1424_i_Attack, L1431_i_LordChaosMapX, L1432_i_LordChaosMapY, k255_CreatureTypeSingleCenteredCreature); fuseSequenceUpdate(); } _sound->requestPlay(k17_soundBUZZ, L1431_i_LordChaosMapX, L1432_i_LordChaosMapY, k1_soundModePlayIfPrioritized); L1428_ps_Group->_type = k25_CreatureTypeLordOrder; fuseSequenceUpdate(); for (AL1424_i_Attack = 55; AL1424_i_Attack <= 255; AL1424_i_Attack += 40) { _projexpl->createExplosion(Thing::_explHarmNonMaterial, AL1424_i_Attack, L1431_i_LordChaosMapX, L1432_i_LordChaosMapY, k255_CreatureTypeSingleCenteredCreature); fuseSequenceUpdate(); } for (AL1425_i_CycleCount = 4; --AL1425_i_CycleCount; ) { for (AL1424_i_CreatureTypeSwitchCount = 5; --AL1424_i_CreatureTypeSwitchCount; ) { _sound->requestPlay(k17_soundBUZZ, L1431_i_LordChaosMapX, L1432_i_LordChaosMapY, k1_soundModePlayIfPrioritized); L1428_ps_Group->_type = (AL1424_i_CreatureTypeSwitchCount & 0x0001) ? k25_CreatureTypeLordOrder : k23_CreatureTypeLordChaos; for (AL1426_i_FuseSequenceUpdateCount = AL1425_i_CycleCount; AL1426_i_FuseSequenceUpdateCount--; fuseSequenceUpdate()); } } _projexpl->createExplosion(Thing::_explFireBall, 255, L1431_i_LordChaosMapX, L1432_i_LordChaosMapY, k255_CreatureTypeSingleCenteredCreature); _projexpl->createExplosion(Thing::_explHarmNonMaterial, 255, L1431_i_LordChaosMapX, L1432_i_LordChaosMapY, k255_CreatureTypeSingleCenteredCreature); fuseSequenceUpdate(); L1428_ps_Group->_type = k26_CreatureTypeGreyLord; fuseSequenceUpdate(); _displayMan->_doNotDrawFluxcagesDuringEndgame = true; fuseSequenceUpdate(); for (AL1424_i_MapX = 0; AL1424_i_MapX < _dungeonMan->_currMapWidth; AL1424_i_MapX++) { for (AL1425_i_MapY = 0; AL1425_i_MapY < _dungeonMan->_currMapHeight; AL1425_i_MapY++) { if (((L1427_T_Thing = _groupMan->groupGetThing(AL1424_i_MapX, AL1425_i_MapY)) != Thing::_endOfList) && ((AL1424_i_MapX != L1431_i_LordChaosMapX) || (AL1425_i_MapY != L1432_i_LordChaosMapY))) { _groupMan->groupDelete(AL1424_i_MapX, AL1425_i_MapY); } } } fuseSequenceUpdate(); /* Count and get list of text things located at 0, 0 in the current map. Their text is then printed as messages in the order specified by their first letter (which is not printed) */ L1427_T_Thing = _dungeonMan->getSquareFirstThing(0, 0); AL1424_i_TextStringThingCount = 0; while (L1427_T_Thing != Thing::_endOfList) { if (L1427_T_Thing.getType() == k2_TextstringType) { L1435_aT_TextStringThings[AL1424_i_TextStringThingCount++] = L1427_T_Thing; } L1427_T_Thing = _dungeonMan->getNextThing(L1427_T_Thing); } L1434_c_TextFirstCharacter = 'A'; AL1426_i_TextStringThingCount = AL1424_i_TextStringThingCount; while (AL1424_i_TextStringThingCount--) { for (AL1425_i_TextStringThingIndex = 0; AL1425_i_TextStringThingIndex < AL1426_i_TextStringThingCount; AL1425_i_TextStringThingIndex++) { _dungeonMan->decodeText(L1436_ac_String, L1435_aT_TextStringThings[AL1425_i_TextStringThingIndex], (TextType)(k1_TextTypeMessage | k0x8000_DecodeEvenIfInvisible)); if (L1436_ac_String[1] == L1434_c_TextFirstCharacter) { _textMan->clearAllRows(); L1436_ac_String[1] = '\n'; /* New line */ _textMan->printMessage(k15_ColorWhite, &L1436_ac_String[1]); fuseSequenceUpdate(); delay(780); L1434_c_TextFirstCharacter++; break; } } } for (AL1424_i_Attack = 55; AL1424_i_Attack <= 255; AL1424_i_Attack += 40) { _projexpl->createExplosion(Thing::_explHarmNonMaterial, AL1424_i_Attack, L1431_i_LordChaosMapX, L1432_i_LordChaosMapY, k255_CreatureTypeSingleCenteredCreature); fuseSequenceUpdate(); } delay(600); _restartGameAllowed = false; endGame(true); }
Thing thingWithNewCell(Thing thing, int16 cell) { return Thing(((thing.toUint16()) & 0x3FFF) | ((cell) << 14)); }
Thing foo(const Thing* p) { return Thing(Move(*p)); }
LoadgameResult DMEngine::loadgame(int16 slot) { if (slot == -1 && _newGameFl == k0_modeLoadSavedGame) return kDMLoadgameFailure; bool fadePalette = true; Common::String fileName; Common::SaveFileManager *saveFileManager = nullptr; Common::InSaveFile *file = nullptr; struct { SaveTarget _saveTarget; int32 _saveVersion; OriginalSaveFormat _saveFormat; OriginalSavePlatform _savePlatform; uint16 _dungeonId; } dmSaveHeader; if (_newGameFl) { //L1366_B_FadePalette = !F0428_DIALOG_RequireGameDiskInDrive_NoDialogDrawn(C0_DO_NOT_FORCE_DIALOG_DM_CSB, true); _restartGameAllowed = false; _championMan->_partyChampionCount = 0; _championMan->_leaderHandObject = Thing::_none; } else { fileName = getSavefileName(slot); saveFileManager = _system->getSavefileManager(); file = saveFileManager->openForLoading(fileName); SaveGameHeader header; readSaveGameHeader(file, &header); warning("MISSING CODE: missing check for matching format and platform in save in f435_loadgame"); dmSaveHeader._saveTarget = (SaveTarget)file->readSint32BE(); dmSaveHeader._saveVersion = file->readSint32BE(); dmSaveHeader._saveFormat = (OriginalSaveFormat)file->readSint32BE(); dmSaveHeader._savePlatform = (OriginalSavePlatform)file->readSint32BE(); // Skip _gameId, which was useless file->readSint32BE(); dmSaveHeader._dungeonId = file->readUint16BE(); _gameTime = file->readSint32BE(); // G0349_ul_LastRandomNumber = L1371_s_GlobalData.LastRandomNumber; _championMan->_partyChampionCount = file->readUint16BE(); _dungeonMan->_partyMapX = file->readSint16BE(); _dungeonMan->_partyMapY = file->readSint16BE(); _dungeonMan->_partyDir = (Direction)file->readUint16BE(); _dungeonMan->_partyMapIndex = file->readByte(); _championMan->_leaderIndex = (ChampionIndex)file->readSint16BE(); _championMan->_magicCasterChampionIndex = (ChampionIndex)file->readSint16BE(); _timeline->_eventCount = file->readUint16BE(); _timeline->_firstUnusedEventIndex = file->readUint16BE(); _timeline->_eventMaxCount = file->readUint16BE(); _groupMan->_currActiveGroupCount = file->readUint16BE(); _projexpl->_lastCreatureAttackTime = file->readSint32BE(); _projexpl->_lastPartyMovementTime = file->readSint32BE(); _disabledMovementTicks = file->readSint16BE(); _projectileDisableMovementTicks = file->readSint16BE(); _lastProjectileDisabledMovementDirection = file->readSint16BE(); _championMan->_leaderHandObject = Thing(file->readUint16BE()); _groupMan->_maxActiveGroupCount = file->readUint16BE(); if (!_restartGameRequest) { _timeline->initTimeline(); _groupMan->initActiveGroups(); } _groupMan->loadActiveGroupPart(file); _championMan->loadPartyPart2(file); _timeline->loadEventsPart(file); _timeline->loadTimelinePart(file); // read sentinel uint32 sentinel = file->readUint32BE(); assert(sentinel == 0x6f85e3d3); _dungeonId = dmSaveHeader._dungeonId; } _dungeonMan->loadDungeonFile(file); delete file; if (_newGameFl) { _timeline->initTimeline(); _groupMan->initActiveGroups(); if (fadePalette) { _displayMan->startEndFadeToPalette(_displayMan->_blankBuffer); delay(1); _displayMan->fillScreen(kDMColorBlack); _displayMan->startEndFadeToPalette(_displayMan->_paletteTopAndBottomScreen); } } else { _restartGameAllowed = true; switch (getGameLanguage()) { // localized case Common::DE_DEU: _dialog->dialogDraw(nullptr, "SPIEL WIRD GELADEN . . .", nullptr, nullptr, nullptr, nullptr, true, true, true); break; case Common::FR_FRA: _dialog->dialogDraw(nullptr, "CHARGEMENT DU JEU . . .", nullptr, nullptr, nullptr, nullptr, true, true, true); break; default: _dialog->dialogDraw(nullptr, "LOADING GAME . . .", nullptr, nullptr, nullptr, nullptr, true, true, true); break; } } _championMan->_partyDead = false; return kDMLoadgameSuccess; }