ref: 8ba444e5efd62f011218a2121084576ee1bf84fb
parent: 5de507694b0ca43739033d75cf20fcf7ea31a2dd
author: James Haley <haleyjd@hotmail.com>
date: Sat Sep 18 14:36:36 EDT 2010
More use of DEH_String and DEH_snprintf, especially in the dialog engine. Also more use of new GiveVoiceObjective macro. Subversion-branch: /branches/strife-branch Subversion-revision: 2111
--- a/src/strife/f_finale.c
+++ b/src/strife/f_finale.c
@@ -305,13 +305,13 @@
case SLIDE_SIGIL1: // state #5
slideshow_panel = DEH_String("SS3F1");
- I_StartVoice("MAC16");
+ I_StartVoice(DEH_String("MAC16"));
slideshow_state = SLIDE_SIGIL2;
slideshow_tics = 350;
break;
case SLIDE_SIGIL2: // state #6
slideshow_panel = DEH_String("SS3F2");
- I_StartVoice("MAC17");
+ I_StartVoice(DEH_String("MAC17"));
slideshow_state = SLIDE_SIGIL3;
slideshow_tics = 420;
break;
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -1248,7 +1248,6 @@
// villsa [STRIFE]
strncpy(mission_objective, "Find help", OBJECTIVE_LEN);
-
}
//
--- a/src/strife/p_dialog.c
+++ b/src/strife/p_dialog.c
@@ -165,7 +165,7 @@
{
const char *type_name;
int nummessages;
- const char *messages[MAXRNDMESSAGES];
+ char *messages[MAXRNDMESSAGES];
} rndmessage_t;
static rndmessage_t rndMessages[] =
@@ -585,7 +585,7 @@
static const char *P_DialogGetMsg(const char *message)
{
// if the message starts with "RANDOM"...
- if(!strncasecmp(message, "RANDOM", 6))
+ if(!strncasecmp(message, DEH_String("RANDOM"), 6))
{
int i;
const char *nameloc = message + 7;
@@ -599,7 +599,7 @@
// found a match, so return a random message
int rnd = M_Random();
int nummessages = rndMessages[i].nummessages;
- return rndMessages[i].messages[rnd % nummessages];
+ return DEH_String(rndMessages[i].messages[rnd % nummessages]);
}
}
}
@@ -812,57 +812,57 @@
// check for sprites if no specific type is found
switch(sprnum)
{
- // bullets
+ // bullets
case SPR_BLIT:
ok = P_GiveAmmo(player, am_bullets, 1);
- break;
+ break;
- // box of bullets
+ // box of bullets
case SPR_BBOX:
ok = P_GiveAmmo(player, am_bullets, 5);
- break;
+ break;
- // missile
+ // missile
case SPR_MSSL:
ok = P_GiveAmmo(player, am_missiles, 1);
- break;
+ break;
- // box of missiles
+ // box of missiles
case SPR_ROKT:
ok = P_GiveAmmo(player, am_missiles, 5);
- break;
+ break;
- // battery
+ // battery
case SPR_BRY1:
ok = P_GiveAmmo(player, am_cell, 1);
- break;
+ break;
- // cell pack
+ // cell pack
case SPR_CPAC:
ok = P_GiveAmmo(player, am_cell, 5);
- break;
+ break;
- // poison bolts
+ // poison bolts
case SPR_PQRL:
ok = P_GiveAmmo(player, am_poisonbolts, 5);
- break;
+ break;
- // electric bolts
+ // electric bolts
case SPR_XQRL:
ok = P_GiveAmmo(player, am_elecbolts, 5);
- break;
+ break;
- // he grenades
+ // he grenades
case SPR_GRN1:
ok = P_GiveAmmo(player, am_hegrenades, 1);
- break;
+ break;
- // wp grenades
+ // wp grenades
case SPR_GRN2:
ok = P_GiveAmmo(player, am_wpgrenades, 1);
- break;
+ break;
- // backpack
+ // backpack
case SPR_BKPK:
if(!player->backpack)
{
@@ -872,33 +872,33 @@
player->backpack = true;
}
for(i = 0; i < NUMAMMO; i++)
- P_GiveAmmo(player, i, 1);
- break;
+ P_GiveAmmo(player, i, 1);
+ break;
- // coin
+ // coin
case SPR_COIN:
P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
- break;
+ break;
- // gold 10
+ // gold 10
case SPR_CRED:
for(i = 0; i < 10; i++)
P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
- break;
+ break;
- // gold 25
+ // gold 25
case SPR_SACK:
for(i = 0; i < 25; i++)
P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
- break;
+ break;
- // gold 50
+ // gold 50
case SPR_CHST:
for(i = 0; i < 50; i++)
P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
- break;
+ break;
- // ???
+ // ???
case SPR_HELT:
P_GiveInventoryItem(player, SPR_HELT, MT_TOKEN_TOUGHNESS);
P_GiveInventoryItem(player, SPR_GUNT, MT_TOKEN_ACCURACY);
@@ -906,33 +906,33 @@
// [STRIFE] TODO - verify
for(i = 0; i < 5 * player->numinventory + 300; i++)
P_GiveInventoryItem(player, SPR_COIN, MT_MONY_1);
- break;
+ break;
- // metal armor
+ // metal armor
case SPR_ARM1:
- if(!P_GiveArmor(player, -2))
- P_GiveInventoryItem(player, sprnum, type);
- break;
+ if(!P_GiveArmor(player, -2))
+ P_GiveInventoryItem(player, sprnum, type);
+ break;
- // leather armor
+ // leather armor
case SPR_ARM2:
if(!P_GiveArmor(player, -1))
P_GiveInventoryItem(player, sprnum, type);
- break;
+ break;
- // communicator
+ // communicator
case SPR_COMM:
if(!P_GivePower(player, pw_communicator))
return false;
- break;
+ break;
- // map
+ // map
case SPR_PMAP:
if(!P_GivePower(player, pw_allmap))
return false;
- break;
+ break;
- // rifle
+ // rifle
case SPR_RIFL:
if(player->weaponowned[wp_rifle])
return false;
@@ -939,9 +939,9 @@
if(!P_GiveWeapon(player, wp_rifle, false))
return false;
- break;
+ break;
- // flame thrower
+ // flame thrower
case SPR_FLAM:
if(player->weaponowned[wp_flame])
return false;
@@ -948,9 +948,9 @@
if(!P_GiveWeapon(player, wp_flame, false))
return false;
- break;
+ break;
- // missile launcher
+ // missile launcher
case SPR_MMSL:
if(player->weaponowned[wp_missile])
return false;
@@ -957,9 +957,9 @@
if(!P_GiveWeapon(player, wp_missile, false))
return false;
- break;
+ break;
- // mauler
+ // mauler
case SPR_TRPD:
if(player->weaponowned[wp_mauler])
return false;
@@ -966,9 +966,9 @@
if(!P_GiveWeapon(player, wp_mauler, false))
return false;
- break;
+ break;
- // crossbow
+ // crossbow
case SPR_CBOW:
if(player->weaponowned[wp_elecbow])
return false;
@@ -975,13 +975,13 @@
if(!P_GiveWeapon(player, wp_elecbow, false))
return false;
- break;
+ break;
- // misc item
+ // misc item
default:
if(!P_GiveInventoryItem(player, sprnum, type))
return false;
- break;
+ break;
}
break;
}
@@ -1118,7 +1118,7 @@
finaly = 199 - height; // height it will bump down to if necessary.
// draw divider
- M_WriteText(42, finaly - 6, "______________________________");
+ M_WriteText(42, finaly - 6, DEH_String("______________________________"));
dialogmenu.y = finaly + 6;
y = 0;
@@ -1126,9 +1126,17 @@
// draw the menu items
for(i = 0; i < dialogmenu.numitems - 1; i++)
{
- sprintf(choicetext, "%d) %s", i + 1, currentdialog->choices[i].text);
+ DEH_snprintf(choicetext, sizeof(choicetext),
+ "%d) %s", i + 1, currentdialog->choices[i].text);
+
+ // alternate text for items that need money
if(currentdialog->choices[i].needamounts[0] > 0)
- sprintf(choicetext, "%s for %d", choicetext, currentdialog->choices[i].needamounts[0]);
+ {
+ DEH_snprintf(choicetext, sizeof(choicetext),
+ "%s for %d",
+ choicetext,
+ currentdialog->choices[i].needamounts[0]);
+ }
M_WriteText(dialogmenu.x, dialogmenu.y + 3 + y, choicetext);
y += 19;
@@ -1195,7 +1203,7 @@
}
}
else
- message = "You seem to have enough!";
+ message = DEH_String("You seem to have enough!");
// store next dialog into the talking actor
nextdialog = currentchoice->next;
@@ -1217,7 +1225,7 @@
if((objective = currentchoice->objective))
{
- sprintf(mission_objective, "log%i", objective);
+ DEH_snprintf(mission_objective, OBJECTIVE_LEN, "log%i", objective);
objlump = W_CacheLumpName(mission_objective, PU_CACHE);
strncpy(mission_objective, objlump, OBJECTIVE_LEN);
}
@@ -1346,9 +1354,9 @@
{
// use a fallback:
if(mobjinfo[linetarget->type].name)
- dialogname = mobjinfo[linetarget->type].name; // mobjtype name
+ dialogname = DEH_String(mobjinfo[linetarget->type].name); // mobjtype name
else
- dialogname = "Person"; // default name
+ dialogname = DEH_String("Person"); // default name - like Joe in Doom 3 :P
}
// setup number of choices to choose from
@@ -1388,16 +1396,17 @@
switch(rnd)
{
case 2:
- byetext = "BYE!";
+ byetext = DEH_String("BYE!");
break;
case 1:
- byetext = "Thanks, Bye!";
+ byetext = DEH_String("Thanks, Bye!");
break;
case 0:
- byetext = "See you later!";
+ byetext = DEH_String("See you later!");
break;
}
- sprintf(dialoglastmsgbuffer, "%d) %s", i + 1, byetext);
+ DEH_snprintf(dialoglastmsgbuffer, sizeof(dialoglastmsgbuffer),
+ "%d) %s", i + 1, byetext);
}
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -3087,11 +3087,8 @@
for(i = 0; i < MAXPLAYERS; i++)
P_GiveItemToPlayer(&players[i], SPR_TOKN, MT_TOKEN_QUEST7);
- // play voice
- I_StartVoice(DEH_String("VOC14"));
-
- // give objective
- GiveObjective("LOG14", 0);
+ // play voice, give objective
+ GiveVoiceObjective("VOC14", "LOG14", 0);
}
}
}
--- a/src/strife/p_inter.c
+++ b/src/strife/p_inter.c
@@ -848,8 +848,7 @@
junk.tag = 44;
EV_DoFloor(&junk, lowerFloor);
- I_StartVoice(DEH_String("VOC13"));
- GiveObjective("LOG13", 0);
+ GiveVoiceObjective("VOC13", "LOG13", 0);
item = MT_COUPLING_BROKEN;
players[0].questflags |= (1 << (mobjinfo[MT_COUPLING].speed - 1));