diff options
author | Simon Howard | 2010-05-03 17:21:16 +0000 |
---|---|---|
committer | Simon Howard | 2010-05-03 17:21:16 +0000 |
commit | e9c6289014661d06275e8d378dbcecfb16b15fa8 (patch) | |
tree | 1fbcf8435b48e6887f834d9c667b3bbf67b75fb5 | |
parent | 4767ddccafca1a1c50bc097284df1328d478882a (diff) | |
download | chocolate-doom-e9c6289014661d06275e8d378dbcecfb16b15fa8.tar.gz chocolate-doom-e9c6289014661d06275e8d378dbcecfb16b15fa8.tar.bz2 chocolate-doom-e9c6289014661d06275e8d378dbcecfb16b15fa8.zip |
Use dehacked printf functions in Heretic code where appropriate.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1932
-rw-r--r-- | src/heretic/ct_chat.c | 4 | ||||
-rw-r--r-- | src/heretic/d_main.c | 19 | ||||
-rw-r--r-- | src/heretic/g_game.c | 14 |
3 files changed, 23 insertions, 14 deletions
diff --git a/src/heretic/ct_chat.c b/src/heretic/ct_chat.c index 958d1fff..8059b74d 100644 --- a/src/heretic/ct_chat.c +++ b/src/heretic/ct_chat.c @@ -301,7 +301,9 @@ void CT_Ticker(void) CT_AddChar(i, 0); // set the end of message character if (numplayers > 2) { - strcpy(plr_lastmsg[i], DEH_String(CT_FromPlrText[i])); + strncpy(plr_lastmsg[i], DEH_String(CT_FromPlrText[i]), + MESSAGESIZE + 9); + plr_lastmsg[i][MESSAGESIZE + 8] = '\0'; strcat(plr_lastmsg[i], chat_msg[i]); } else diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index 6b589d02..901d763d 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -700,7 +700,7 @@ void tprintf(char *msg, int initflag) // haleyjd: moved up, removed WATCOMC code void CleanExit(void) { - printf(DEH_String("Exited from HERETIC.\n")); + DEH_printf("Exited from HERETIC.\n"); exit(1); } @@ -849,7 +849,7 @@ void D_DoomMain(void) // // init subsystems // - printf(DEH_String("V_Init: allocate screens.\n")); + DEH_printf("V_Init: allocate screens.\n"); V_Init(); // Check for -CDROM @@ -882,14 +882,14 @@ void D_DoomMain(void) } // Load defaults before initing other systems - printf(DEH_String("M_LoadDefaults: Load system defaults.\n")); + DEH_printf("M_LoadDefaults: Load system defaults.\n"); D_BindVariables(); M_SetConfigFilenames("heretic.cfg", PROGRAM_PREFIX "heretic.cfg"); M_LoadDefaults(); I_AtExit(M_SaveDefaults, false); - printf(DEH_String("Z_Init: Init zone memory allocation daemon.\n")); + DEH_printf("Z_Init: Init zone memory allocation daemon.\n"); Z_Init(); #ifdef FEATURE_DEHACKED @@ -897,7 +897,7 @@ void D_DoomMain(void) DEH_Init(); #endif - printf(DEH_String("W_Init: Init WADfiles.\n")); + DEH_printf("W_Init: Init WADfiles.\n"); iwadfile = D_FindIWAD(IWAD_MASK_HERETIC, &gamemission); @@ -917,9 +917,9 @@ void D_DoomMain(void) } if (p && p < myargc - 1) { - sprintf(file, DEH_String("%s.lmp"), myargv[p + 1]); + DEH_snprintf(file, sizeof(file), "%s.lmp", myargv[p + 1]); D_AddFile(file); - printf(DEH_String("Playing demo %s.lmp.\n"), myargv[p + 1]); + DEH_printf("Playing demo %s.lmp.\n", myargv[p + 1]); } if (W_CheckNumForName(DEH_String("E2M1")) == -1) @@ -958,8 +958,9 @@ void D_DoomMain(void) if (autostart) { char temp[64]; - sprintf(temp, DEH_String("Warp to Episode %d, Map %d, Skill %d "), - startepisode, startmap, startskill + 1); + DEH_snprintf(temp, sizeof(temp), + "Warp to Episode %d, Map %d, Skill %d ", + startepisode, startmap, startskill + 1); status(temp); } wadprintf(); // print the added wadfiles diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c index 211d0b67..b37f95e0 100644 --- a/src/heretic/g_game.c +++ b/src/heretic/g_game.c @@ -863,12 +863,16 @@ void G_Ticker(void) { if (netgame) { - strcpy(savedescription, DEH_String("NET GAME")); + strncpy(savedescription, DEH_String("NET GAME"), + sizeof(savedescription)); } else { - strcpy(savedescription, DEH_String("SAVE GAME")); + strncpy(savedescription, DEH_String("SAVE GAME"), + sizeof(savedescription)); } + + savedescription[sizeof(savedescription) - 1] = '\0'; } savegameslot = (players[i].cmd. @@ -1321,7 +1325,9 @@ void G_DoLoadGame(void) save_p = savebuffer + SAVESTRINGSIZE; // Skip the description field memset(vcheck, 0, sizeof(vcheck)); - sprintf(vcheck, DEH_String("version %i"), HERETIC_VERSION); + + DEH_snprintf(vcheck, VERSIONSIZE, "version %i", HERETIC_VERSION); + if (strcmp((char *) save_p, vcheck) != 0) { // Bad version return; @@ -1695,7 +1701,7 @@ void G_DoSaveGame(void) SV_Open(name); SV_Write(description, SAVESTRINGSIZE); memset(verString, 0, sizeof(verString)); - sprintf(verString, DEH_String("version %i"), HERETIC_VERSION); + DEH_snprintf(verString, VERSIONSIZE, "version %i", HERETIC_VERSION); SV_Write(verString, VERSIONSIZE); SV_WriteByte(gameskill); SV_WriteByte(gameepisode); |