void dodGame::Restart() { Uint32 ticks1, ticks2; object.Reset(); creature.Reset(); parser.Reset(); player.Reset(); scheduler.Reset(); viewer.Reset(); hasWon = false; dungeon.VFTPTR = 0; scheduler.SYSTCB(); object.CreateAll(); player.HBEATF = 0; player.setInitialObjects(false); viewer.displayPrepare(); viewer.displayCopyright(); viewer.display_mode = Viewer::MODE_TITLE; viewer.draw_game(); // Delay with "PREPARE!" on screen ticks1 = SDL_GetTicks(); do { oslink.process_events(); ticks2 = SDL_GetTicks(); } while (ticks2 < ticks1 + 2500); creature.NEWLVL(); INIVU(); viewer.PROMPT(); }
// Game initialization void dodGame::COMINI() { Uint32 ticks1, ticks2; scheduler.SYSTCB(); object.CreateAll(); player.HBEATF = 0; viewer.clearArea(&viewer.TXTSTS); viewer.clearArea(&viewer.TXTPRI); viewer.VXSCAL = 0x80; viewer.VYSCAL = 0x80; viewer.VXSCALf = 128.0f; viewer.VYSCALf = 128.0f; AUTFLG = viewer.ShowFade(Viewer::FADE_BEGIN); //AUTFLG = scheduler.fadeLoop(); //AUTFLG = false; // TAKE THIS LINE OUT !!!!!!!!!! [Prevents demo from starting] player.setInitialObjects(AUTFLG); viewer.displayPrepare(); viewer.display_mode = Viewer::MODE_TITLE; viewer.draw_game(); // Delay with "PREPARE!" on screen ticks1 = SDL_GetTicks(); do { oslink.process_events(); ticks2 = SDL_GetTicks(); } while (ticks2 < ticks1 + viewer.prepPause); creature.NEWLVL(); if (AUTFLG) { // do map viewer.display_mode = Viewer::MODE_TITLE; viewer.showSeerMap = true; --viewer.UPDATE; viewer.draw_game(); // wait 3 seconds ticks1 = SDL_GetTicks(); do { oslink.process_events(); ticks2 = SDL_GetTicks(); } while (ticks2 < ticks1 + 3000); } INIVU(); viewer.PROMPT(); }
// This routine creates a new dungeon level, // filling it with objects and creatures. It // should probably be moved to the Dungeon class. void Creature::NEWLVL() { dodBYTE a, b; int u, idx, tmp; CMXPTR = game.LEVEL * CTYPES; dungeon.CalcVFI(); for (tmp = 0; tmp < 32; ++tmp) { CCBLND[tmp].clear(); } scheduler.SYSTCB(); dungeon.DGNGEN(); u = CMXPTR; a = CTYPES - 1; do { b = CMXLND[u + a]; if (b != 0) { do { CBIRTH(a); --b; } while (b != 0); } --a; } while (a != 0xFF); u = -1; object.OFINDF = 0; do { idx = object.FNDOBJ(); if (idx == -1) { break; } if (object.OCBLND[idx].P_OCOWN == 0xFF) { do { ++u; if (u == 32) { u = 0; } if (CCBLND[u].P_CCUSE != 0) { tmp = CCBLND[u].P_CCOBJ; CCBLND[u].P_CCOBJ = idx; object.OCBLND[idx].P_OCPTR = tmp; break; } } while (true); } } while (true); // Determine video invert Setting viewer.setVidInv((game.LEVEL % 2) ?true: false); }