/** * Initialize weapon info. */ void P_InitWeaponInfo(void) { #define WPINF "Weapon Info|" int i; int pclass = PCLASS_PLAYER; ammotype_t k; char buf[80]; char* data; for(i = 0; i < NUM_WEAPON_TYPES; ++i) { //// \todo Only allows for one type of ammo per weapon. sprintf(buf, WPINF "%i|Type", i); if(Def_Get(DD_DEF_VALUE, buf, &data)) { // Set the right types of ammo. if(!stricmp(data, "noammo")) { for(k = 0; k < NUM_AMMO_TYPES; ++k) { weaponInfo[i][pclass].mode[0].ammoType[k] = false; weaponInfo[i][pclass].mode[0].perShot[k] = 0; } } else { for(k = 0; k < NUM_AMMO_TYPES; ++k) { if(!stricmp(data, ammoTypeNames[k])) { weaponInfo[i][pclass].mode[0].ammoType[k] = true; sprintf(buf, WPINF "%i|Per shot", i); GetDefInt(buf, &weaponInfo[i][pclass].mode[0].perShot[k]); break; } } } } // end todo sprintf(buf, WPINF "%i|Up", i); GetDefState(buf, &weaponInfo[i][pclass].mode[0].upState); sprintf(buf, WPINF "%i|Down", i); GetDefState(buf, &weaponInfo[i][pclass].mode[0].downState); sprintf(buf, WPINF "%i|Ready", i); GetDefState(buf, &weaponInfo[i][pclass].mode[0].readyState); sprintf(buf, WPINF "%i|Atk", i); GetDefState(buf, &weaponInfo[i][pclass].mode[0].attackState); sprintf(buf, WPINF "%i|Flash", i); GetDefState(buf, &weaponInfo[i][pclass].mode[0].flashState); sprintf(buf, WPINF "%i|Static", i); weaponInfo[i][pclass].mode[0].staticSwitch = GetDefInt(buf, 0); } #undef WPINF }
// Initialize weapon info, maxammo and clipammo. void P_InitWeaponInfo() { #define PLMAX "Player|Max ammo|" #define PLCLP "Player|Clip ammo|" #define WPINF "Weapon Info|" int i, k; char buf[80]; char *data; char *ammotypes[] = { "clip", "shell", "cell", "misl", "-", "noammo", 0 }; // Max ammo. GetDefInt(PLMAX "Clip", &maxammo[am_clip]); GetDefInt(PLMAX "Shell", &maxammo[am_shell]); GetDefInt(PLMAX "Cell", &maxammo[am_cell]); GetDefInt(PLMAX "Misl", &maxammo[am_misl]); // Clip ammo. GetDefInt(PLCLP "Clip", &clipammo[am_clip]); GetDefInt(PLCLP "Shell", &clipammo[am_shell]); GetDefInt(PLCLP "Cell", &clipammo[am_cell]); GetDefInt(PLCLP "Misl", &clipammo[am_misl]); for(i = 0; i < NUMWEAPONS; i++) { sprintf(buf, WPINF "%i|Type", i); if(Def_Get(DD_DEF_VALUE, buf, &data)) { // Set the right type of ammo. for(k = 0; ammotypes[k]; k++) if(!stricmp(data, ammotypes[k])) { weaponinfo[i].ammo = k; break; } } sprintf(buf, WPINF "%i|Per shot", i); GetDefInt(buf, &weaponinfo[i].pershot); sprintf(buf, WPINF "%i|Up", i); GetDefState(buf, &weaponinfo[i].upstate); sprintf(buf, WPINF "%i|Down", i); GetDefState(buf, &weaponinfo[i].downstate); sprintf(buf, WPINF "%i|Ready", i); GetDefState(buf, &weaponinfo[i].readystate); sprintf(buf, WPINF "%i|Atk", i); GetDefState(buf, &weaponinfo[i].atkstate); sprintf(buf, WPINF "%i|Flash", i); GetDefState(buf, &weaponinfo[i].flashstate); sprintf(buf, WPINF "%i|Static", i); weaponinfo[i].static_switch = GetDefInt(buf, 0); } }
/** * Initialize ammo info. */ void P_InitAmmoInfo(void) { uint i; char buf[40]; for(i = 0; i < NUM_AMMO_TYPES; ++i) { // Max ammo. sprintf(buf, "Player|Max ammo|%s", ammoTypeNames[i]); GetDefInt(buf, &maxAmmo[i]); // Clip ammo. sprintf(buf, "Player|Clip ammo|%s", ammoTypeNames[i]); GetDefInt(buf, &clipAmmo[i]); } }
void P_InitPlayerValues(player_t *p) { int i; char buf[40]; GetDefInt("Player|Health", &p->health); GetDefInt("Player|Weapon", (int *) &p->readyWeapon); p->pendingWeapon = p->readyWeapon; for(i = 0; i < NUM_WEAPON_TYPES; ++i) { sprintf(buf, "Weapon Info|%i|Owned", i); GetDefInt(buf, (int *) &p->weapons[i].owned); } for(i = 0; i < NUM_AMMO_TYPES; ++i) { sprintf(buf, "Player|Init ammo|%s", ammoTypeNames[i]); GetDefInt(buf, &p->ammo[i].owned); } }
//************************************************************************** // Call BEFORE ANY OTHER CTHM OPERATION!!!. //************************************************************************** void CTHMInitCache(void) //************************************************************************** { // only allow 1 initialization iInitCount++; if (iInitCount != 1) return; GetDefInt(cthmMaxCache, 25); cthmNumCache = 0; lpCThmFirst = NULL; lpCThmLast = NULL; bCache = cthmMaxCache ? TRUE:FALSE; }
void P_InitPlayerValues(player_t *p) { #define PLINA "Player|Init ammo|" int i; char buf[20]; GetDefInt("Player|Health", &p->health); GetDefInt("Player|Weapon", (int *) &p->readyweapon); p->pendingweapon = p->readyweapon; for(i = 0; i < NUMWEAPONS; i++) { sprintf(buf, "Weapon Info|%i|Owned", i); GetDefInt(buf, (int *) &p->weaponowned[i]); } GetDefInt(PLINA "Clip", &p->ammo[am_clip]); GetDefInt(PLINA "Shell", &p->ammo[am_shell]); GetDefInt(PLINA "Cell", &p->ammo[am_cell]); GetDefInt(PLINA "Misl", &p->ammo[am_misl]); }
/** * Post Engine Initialization routine. * All game-specific actions that should take place at this time go here. */ void G_PostInit(void) { int p; char file[256]; char mapStr[6]; // Common post init routine G_CommonPostInit(); // Initialize ammo info. P_InitAmmoInfo(); // Initialize weapon info. P_InitWeaponInfo(); // Print a game mode banner with rulers. Con_FPrintf(CBLF_RULER | CBLF_WHITE | CBLF_CENTER, gamemode == retail ? "The Ultimate DOOM Startup\n" : gamemode == shareware ? "DOOM Shareware Startup\n" : gamemode == registered ? "DOOM Registered Startup\n" : gamemode == commercial ? (gamemission == GM_PLUT ? "Final DOOM: The Plutonia Experiment\n" : gamemission == GM_TNT ? "Final DOOM: TNT: Evilution\n" : "DOOM 2: Hell on Earth\n") : "Public DOOM\n"); Con_FPrintf(CBLF_RULER, ""); // Game parameters. monsterinfight = GetDefInt("AI|Infight", 0); // get skill / episode / map from parms gameskill = startskill = SM_NOITEMS; startepisode = 1; startmap = 1; autostart = false; // Game mode specific settings // Plutonia and TNT automatically turn on the full sky. if(gamemode == commercial && (gamemission == GM_PLUT || gamemission == GM_TNT)) { Con_SetInteger("rend-sky-full", 1, true); } // Command line options nomonsters = ArgCheck("-nomonsters"); respawnparm = ArgCheck("-respawn"); fastparm = ArgCheck("-fast"); devparm = ArgCheck("-devparm"); if(ArgCheck("-altdeath")) cfg.netDeathmatch = 2; else if(ArgCheck("-deathmatch")) cfg.netDeathmatch = 1; p = ArgCheck("-skill"); if(p && p < myargc - 1) { startskill = Argv(p + 1)[0] - '1'; autostart = true; } p = ArgCheck("-episode"); if(p && p < myargc - 1) { startepisode = Argv(p + 1)[0] - '0'; startmap = 1; autostart = true; } p = ArgCheck("-timer"); if(p && p < myargc - 1 && deathmatch) { int time; time = atoi(Argv(p + 1)); Con_Message("Levels will end after %d minute", time); if(time > 1) Con_Message("s"); Con_Message(".\n"); } p = ArgCheck("-warp"); if(p && p < myargc - 1) { if(gamemode == commercial) { startmap = atoi(Argv(p + 1)); autostart = true; } else if(p < myargc - 2) { startepisode = Argv(p + 1)[0] - '0'; startmap = Argv(p + 2)[0] - '0'; autostart = true; } } // turbo option p = ArgCheck("-turbo"); turboMul = 1.0f; if(p) { int scale = 200; turboparm = true; if(p < myargc - 1) scale = atoi(Argv(p + 1)); if(scale < 10) scale = 10; if(scale > 400) scale = 400; Con_Message("turbo scale: %i%%\n", scale); turboMul = scale / 100.f; } // Are we autostarting? if(autostart) { if(gamemode == commercial) Con_Message("Warp to Map %d, Skill %d\n", startmap, startskill + 1); else Con_Message("Warp to Episode %d, Map %d, Skill %d\n", startepisode, startmap, startskill + 1); } // Load a saved game? p = ArgCheck("-loadgame"); if(p && p < myargc - 1) { SV_GetSaveGameFileName(Argv(p + 1)[0] - '0', file); G_LoadGame(file); } // Check valid episode and map if((autostart || IS_NETGAME)) { if(gamemode == commercial) sprintf(mapStr,"MAP%2.2d", startmap); else sprintf(mapStr,"E%d%d",startepisode, startmap); if(!W_CheckNumForName(mapStr)) { startepisode = 1; startmap = 1; } } // Print a string showing the state of the game parameters Con_Message("Game state parameters:%s%s%s%s%s\n", nomonsters? " nomonsters" : "", respawnparm? " respawn" : "", fastparm? " fast" : "", turboparm? " turbo" : "", (cfg.netDeathmatch ==1)? " deathmatch" : (cfg.netDeathmatch ==2)? " altdeath" : ""); if(G_GetGameAction() != GA_LOADGAME) { if(autostart || IS_NETGAME) { G_DeferedInitNew(startskill, startepisode, startmap); } else { G_StartTitle(); // start up intro loop } } }
/** * Post Game Initialization routine. * All game-specific actions that should take place at this time go here. */ void D_PostInit(void) { AutoStr* path; Uri* uri; int p; /// @todo Kludge: Border background is different in DOOM2. /// @todo Do this properly! if(gameModeBits & GM_ANY_DOOM2) borderGraphics[0] = "Flats:GRNROCK"; else borderGraphics[0] = "Flats:FLOOR7_2"; // Common post init routine G_CommonPostInit(); // Initialize ammo info. P_InitAmmoInfo(); // Initialize weapon info. P_InitWeaponInfo(); // Game parameters. monsterInfight = GetDefInt("AI|Infight", 0); // Get skill / episode / map from parms. gameSkill = startSkill = SM_NOITEMS; startEpisode = 0; startMap = 0; autoStart = false; // Command line options. noMonstersParm = CommandLine_Check("-nomonsters")? true : false; respawnParm = CommandLine_Check("-respawn")? true : false; fastParm = CommandLine_Check("-fast")? true : false; devParm = CommandLine_Check("-devparm")? true : false; if(CommandLine_Check("-altdeath")) cfg.netDeathmatch = 2; else if(CommandLine_Check("-deathmatch")) cfg.netDeathmatch = 1; p = CommandLine_Check("-timer"); if(p && p < myargc - 1 && deathmatch) { int time = atoi(CommandLine_At(p + 1)); Con_Message("Maps will end after %d %s", time, time == 1? "minute" : "minutes"); } // Turbo option. p = CommandLine_Check("-turbo"); turboMul = 1.0f; if(p) { int scale = 200; turboParm = true; if(p < myargc - 1) scale = atoi(CommandLine_At(p + 1)); if(scale < 10) scale = 10; if(scale > 400) scale = 400; Con_Message("turbo scale: %i%%", scale); turboMul = scale / 100.f; } // Load a saved game? p = CommandLine_Check("-loadgame"); if(p && p < myargc - 1) { const int saveSlot = SV_ParseSlotIdentifier(CommandLine_At(p + 1)); if(SV_IsUserWritableSlot(saveSlot) && G_LoadGame(saveSlot)) { // No further initialization is to be done. return; } } p = CommandLine_Check("-skill"); if(p && p < myargc - 1) { startSkill = CommandLine_At(p + 1)[0] - '1'; autoStart = true; } p = CommandLine_Check("-episode"); if(p && p < myargc - 1) { startEpisode = CommandLine_At(p + 1)[0] - '1'; startMap = 0; autoStart = true; } p = CommandLine_Check("-warp"); if(p && p < myargc - 1) { if(gameModeBits & (GM_ANY_DOOM2|GM_DOOM_CHEX)) { startMap = atoi(CommandLine_At(p + 1)) - 1; autoStart = true; } else if(p < myargc - 2) { startEpisode = CommandLine_At(p + 1)[0] - '1'; startMap = CommandLine_At(p + 2)[0] - '1'; autoStart = true; } } // Are we autostarting? if(autoStart) { if(gameModeBits & (GM_ANY_DOOM2|GM_DOOM_CHEX)) Con_Message("Warp to Map %d, Skill %d", startMap+1, startSkill + 1); else Con_Message("Warp to Episode %d, Map %d, Skill %d", startEpisode+1, startMap+1, startSkill + 1); } // Validate episode and map. uri = G_ComposeMapUri((gameModeBits & (GM_DOOM|GM_DOOM_SHAREWARE|GM_DOOM_ULTIMATE))? startEpisode : 0, startMap); path = Uri_Compose(uri); if((autoStart || IS_NETGAME) && !P_MapExists(Str_Text(path))) { startEpisode = 0; startMap = 0; } Uri_Delete(uri); if(autoStart || IS_NETGAME) { G_DeferredNewGame(startSkill, startEpisode, startMap, 0/*default*/); } else { G_StartTitle(); // Start up intro loop. } }
void LoadAllPreferences(BOOL fMemOnly) /************************************************************************/ { LPSTR lp; int i, English, Didot; STRING tmp; if (fMemOnly) // memory related info only { // Memory Group Preferences GetDefStr( Control.RamDisk, Control.ProgHome ); FixPath( Lowercase( Control.RamDisk ) ); GetDefInt( Control.MainMemMin, 1024 ); GetDefInt( Control.MainMemFactor, 100 ); if ( Control.MainMemFactor < 10 ) Control.MainMemFactor = 10; if ( Control.MainMemFactor > 100 ) Control.MainMemFactor = 100; GetDefInt( Control.LineArtAsGray, NO ); FrameSettings( Control.RamDisk, Control.MainMemMin, Control.MainMemFactor); // Get Gamma settings GetDefFix( BltSettings.RGamma, 1 ); GetDefFix( BltSettings.GGamma, 1 ); GetDefFix( BltSettings.BGamma, 1 ); return; } AstralCursor( IDC_WAIT ); if ( !szPreferenceFile[0] ) { if ( !AstralStr( IDS_INIFILE, &lp ) ) lp = PRIVATE_INI; lstrcpy( szPreferenceFile, lp ); GetIniPath( szPreferenceFile ); } // Recall List Control.RecallCount = 0; for ( i=0; i<MAX_RECALL; i++ ) { GetDefaultString( itoa(i,tmp,10), "", Control.RecallImage[i], sizeof(Control.RecallImage[i]) ); if ( *Control.RecallImage[i] ) Control.RecallCount++; } // Undo Group Preferences GetDefInt( Control.NoUndo, FALSE ); GetDefInt( Control.UseApply, NO ); GetDefInt( Control.UndoObjects, NO ); GetDefInt( Control.UndoMasks, NO ); // Miscellaneous Group Preferences #ifdef _MAC lstrcpy(Control.PouchPath, ":files:"); #else GetDefStr( Control.PouchPath, Control.ProgHome ); if ( Control.PouchPath[1] != ':' ) { lstrcpy( tmp, Control.ProgHome ); lstrcat( tmp, Control.PouchPath ); lstrcpy( Control.PouchPath, tmp ); } FixPath( Lowercase( Control.PouchPath ) ); #endif // _MAC GetDefInt( Control.UseWacom, 0 ); GetDefInt( Control.MaskTint, 0 ); // Red GetDefInt( Control.IndependentSettings, YES ); GetDefInt( Control.bNoTheme, NO ); #ifdef USEWAVEMIX GetDefInt( Control.bUseWaveMix, YES ); #endif // USEWAVEMIX GetPrivateProfileString( "Drivers", "Wave", "none", tmp, sizeof(STRING), "system.ini"); // if they have no wave driver or the speaker.drv installed, disable // using the wavemix.dll #ifdef USEWAVEMIX if ( (! lstrcmpi( tmp, "none")) || (! lstrcmpi( tmp, "Speaker.drv")) || (! lstrcmpi( tmp, "")) ) Control.bUseWaveMix = NO; #endif // USEWAVEMIX GetDefInt( Control.iAdventBrush, BRUSH_SIZE_MEDIUM ); GetDefInt( Control.iMaxAnimations, 10 ); GetDefInt( Control.iScrnSaverTime, 2 ); IntermissionSetTimeout ((DWORD)Control.iScrnSaverTime * 60000); // Units Group Preferences English = GetProfileInt( "intl", "iMeasure", 1 ); // 1 = English if ( GetDefInt( Didot, -1 ) >= 0 ) // If Didot is overridden... Control.Points = ( !Didot ? 723 : 676 ); else Control.Points = ( English ? 723 : 676 ); GetDefInt( Control.Units, !English ); Control.Units += IDC_PREF_UNITINCHES; GetDefFix( Control.ScreenWidth, 9 ); GetDefInt( View.UseRulers, NO ); GetDefInt( Control.DisplayPixelValue, NO ); // Object Group Preferences GetDefInt( Control.MultipleObjects, YES ); GetDefInt( Control.UseMaskAndObjects, YES ); // New Dialog GetDefInt( Control.NewDepth, 3 ); GetDefInt( Control.NewWidth, 480 ); GetDefInt( Control.NewHeight, 360 ); GetDefInt( Control.NewResolution, 50 ); // Monitor Gamma Dialog GetDefInt( Control.GammaLock, NO ); // Save file options GetDefInt( Save.bSaveMask, NO ); GetDefInt( Save.OKtoSavePath, NO ); GetDefInt( Save.Compressed, YES ); // Clipboard settings GetDefInt( Control.DoPicture, NO ); GetDefInt( Control.DoBitmap, YES ); // Miscellaneous GetDefInt( Control.ScreenColor, NO ); GetDefRGB( Control.rgbBackground, "0,0,0" ); GetDefInt( Control.xImage, 4 ); GetDefInt( Control.yImage, 4 ); GetDefInt( Control.Hints, YES ); GetDefInt( Control.Save24BitWallpaper, FALSE); GetDefInt( Control.UseObjectMarquee, NO ); // Extended Names GetDefStr( Names.ColorMap, "" ); GetDefStr( Names.Special, "" ); GetDefStr( Names.Mask, "" ); GetDefStr( Names.Printer, "" ); GetDefStr( Names.PrintStyle, "" ); GetDefStr( Names.Clipboard, "" ); GetDefStr( Names.CustomBrush, "" ); // Print Style LoadPrintStyle( Names.PrintStyle ); // Print Dialog GetDefInt( Page.Type, 1 ); Page.Type += IDC_PRINTER_IS_MONO; GetDefInt( Page.PrintNumeric, NO ); GetDefInt( Page.OutputType, 0 ); Page.OutputType += IDC_PRINT_GRAY; GetDefInt( Page.ScatterPrint, NO ); GetDefInt( Page.Centered, YES ); GetDefFix( Page.OffsetX, 0 ); GetDefFix( Page.OffsetY, 0 ); GetDefInt( Page.SepFlags, 0 ); GetDefInt( Page.TrimMarks, NO ); GetDefInt( Page.RegMarks, NO ); GetDefInt( Page.Labels, NO ); GetDefInt( Page.StepScale, NO ); GetDefInt( Page.Negative, NO ); GetDefInt( Page.EmulsionDown, NO ); GetDefInt( Page.BinaryPS, NO ); // Binary Postscript GetDefInt( Page.BinaryEPS, NO ); // Binary Encapsulated Postscript GetDefInt( Page.UsePrinterScreening, YES ); // Size Dialog GetDefInt( Edit.SmartSize, NO ); // Convert settings GetDefInt( Convert.MiniType, 0); Convert.MiniType += IDC_MINI256; GetDefInt( Convert.fOptimize, YES ); GetDefInt( Convert.fScatter, NO ); GetDefInt( Convert.fDither, NO ); // Selector Tool // Mask Transformer Tool GetDefInt( Mask.TransformImage, 1 ); Mask.TransformImage = Mask.TransformImage + IDC_COPYIMAGE; // Object Transformer Tool GetDefInt( Mask.iTransformModes, SHAPE_DEFAULT ); GetDefInt( Mask.PasteQuality, NO ); GetDefInt( Mask.TransMode, 0 ); Mask.TransMode += IDC_TRANSMODEFIRST; GetDefInt( Mask.TransformOpacity, 255 ); Mask.TransformOpacity = bound( Mask.TransformOpacity, 0, 255 ); GetDefMergeMode( Mask.TransformMergeMode, (int)MM_NORMAL ); // Paint Tools HandleBrushSettings( IDC_PAINT, NO ); HandleBrushSettings( IDC_CRAYON, NO ); HandleBrushSettings( IDC_MARKER, NO ); HandleBrushSettings( IDC_LINES, NO ); HandleBrushSettings( IDC_SHAPES, NO ); HandleBrushSettings( IDC_ERASER, NO ); // Gradient Tool GetDefInt( Vignette.Gradient, 0 ); Vignette.Gradient += IDC_VIGLINEAR; GetDefInt( Vignette.RepeatCount, 1 ); GetDefInt( Vignette.SoftTransition, YES ); GetDefInt( Vignette.VigColorModel, 0); GetDefInt( Vignette.VigOpacity, 255 ); GetDefMergeMode( Vignette.VigMergeMode, (int)MM_NORMAL ); GetDefInt( Vignette.Midpoint, 128 ); // Texture Fill Tool GetDefStr( Texture.TextureName, "" ); GetDefInt( Texture.fHorzFlip, NO ); GetDefInt( Texture.fVertFlip, NO ); GetDefInt( Texture.TextureOpacity, 255 ); GetDefMergeMode( Texture.TextureMergeMode, (int)MM_NORMAL ); // Tint Fill Tool GetDefInt( Fill.FillOpacity, 255 ); GetDefMergeMode( Fill.FillMergeMode, (int)MM_NORMAL ); // Magic Fill Tool GetDefInt( Fill.FloodRange, 2 ); GetDefInt( Fill.idFillColorModel, 0); GetDefInt( Fill.FloodOpacity, 255 ); GetDefMergeMode( Fill.FloodMergeMode, (int)MM_NORMAL ); // Custom View Tool GetDefInt( View.ZoomOut, NO ); GetDefInt( View.ZoomWindow, NO ); GetDefInt( View.ZoomDefaultSize, 0x6000); GetDefInt( View.FullScreen, NO ); // Text Tool GetDefInt( Text.nFont, 0 ); GetDefInt( Text.Size, 48 ); GetDefInt( Text.Italic, NO ); GetDefInt( Text.Underline, NO ); GetDefInt( Text.Strikeout, NO ); GetDefInt( Text.Weight, NO ); GetDefInt( Text.AntiAlias, NO ); GetDefInt( Text.AutoFill, YES ); GetDefMergeMode( Text.TextMergeMode, (int)MM_NORMAL ); GetDefInt( Text.TextOpacity, 255 ); // Load Common Tool Settings GetDefInt( Common.Opacity, 255 ); GetDefMergeMode( Common.MergeMode, (int)MM_NORMAL ); GetDefInt( Common.BrushSize, 15 ); SetCommonSettings(); Shields( ON ); LoadFileLocations(); AstralCursor( NULL ); }