This is an automated email from the git hooks/post-receive script.

jmtd pushed a commit to annotated tag chocolate-doom-0.1.0
in repository chocolate-doom.

commit 4dfffeb54db996c6ea0e52e1707633b80a581f2e
Author: Simon Howard <[email protected]>
Date:   Mon Oct 3 21:39:39 2005 +0000

    Dehacked text substitutions
    
    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 160
---
 src/am_map.c   |  22 ++++++--
 src/deh_main.h |  11 +++-
 src/deh_text.c | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/f_finale.c |  14 ++++-
 src/g_game.c   |  11 +++-
 src/hu_stuff.c |  26 ++++++---
 src/m_menu.c   |  46 +++++++++-------
 src/p_doors.c  |  20 ++++---
 src/p_inter.c  |  82 +++++++++++++++-------------
 src/st_stuff.c |  34 +++++++-----
 10 files changed, 330 insertions(+), 106 deletions(-)

diff --git a/src/am_map.c b/src/am_map.c
index 7ccd7cc..9e6b1ab 100644
--- a/src/am_map.c
+++ b/src/am_map.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: am_map.c 71 2005-09-04 18:44:23Z fraggle $
+// $Id: am_map.c 160 2005-10-03 21:39:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -23,6 +23,9 @@
 //
 //
 // $Log$
+// Revision 1.6  2005/10/03 21:39:39  fraggle
+// Dehacked text substitutions
+//
 // Revision 1.5  2005/09/04 18:44:22  fraggle
 // shut up compiler warnings
 //
@@ -43,10 +46,11 @@
 //
 //-----------------------------------------------------------------------------
 
-static const char rcsid[] = "$Id: am_map.c 71 2005-09-04 18:44:23Z fraggle $";
+static const char rcsid[] = "$Id: am_map.c 160 2005-10-03 21:39:39Z fraggle $";
 
 #include <stdio.h>
 
+#include "deh_main.h"
 
 #include "z_zone.h"
 #include "doomdef.h"
@@ -701,20 +705,26 @@ AM_Responder
          case AM_FOLLOWKEY:
            followplayer = !followplayer;
            f_oldloc.x = INT_MAX;
-           plr->message = followplayer ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF;
+            if (followplayer)
+                plr->message = DEH_String(AMSTR_FOLLOWON);
+            else
+                plr->message = DEH_String(AMSTR_FOLLOWOFF);
            break;
          case AM_GRIDKEY:
            grid = !grid;
-           plr->message = grid ? AMSTR_GRIDON : AMSTR_GRIDOFF;
+            if (grid)
+                plr->message = DEH_String(AMSTR_GRIDON);
+            else
+                plr->message = DEH_String(AMSTR_GRIDOFF);
            break;
          case AM_MARKKEY:
-           sprintf(buffer, "%s %d", AMSTR_MARKEDSPOT, markpointnum);
+           sprintf(buffer, "%s %d", DEH_String(AMSTR_MARKEDSPOT), 
markpointnum);
            plr->message = buffer;
            AM_addMark();
            break;
          case AM_CLEARMARKKEY:
            AM_clearMarks();
-           plr->message = AMSTR_MARKSCLEARED;
+           plr->message = DEH_String(AMSTR_MARKSCLEARED);
            break;
          default:
            cheatstate=0;
diff --git a/src/deh_main.h b/src/deh_main.h
index 10604b1..8a2b372 100644
--- a/src/deh_main.h
+++ b/src/deh_main.h
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: deh_main.h 153 2005-10-02 23:49:01Z fraggle $
+// $Id: deh_main.h 160 2005-10-03 21:39:39Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.2  2005/10/03 21:39:39  fraggle
+// Dehacked text substitutions
+//
 // Revision 1.1  2005/10/02 23:49:01  fraggle
 // The beginnings of dehacked support
 //
@@ -40,5 +43,11 @@ void DEH_CheckCommandLine(void);
 
 boolean DEH_ParseAssignment(char *line, char **variable_name, char **value);
 
+// deh_text.c:
+//
+// Used to do dehacked text substitutions throughout the program
+
+char *DEH_String(char *s);
+
 #endif /* #ifndef DEH_MAIN_H */
 
diff --git a/src/deh_text.c b/src/deh_text.c
index 45b1d83..e2c8666 100644
--- a/src/deh_text.c
+++ b/src/deh_text.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: deh_text.c 157 2005-10-03 11:08:16Z fraggle $
+// $Id: deh_text.c 160 2005-10-03 21:39:39Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.3  2005/10/03 21:39:39  fraggle
+// Dehacked text substitutions
+//
 // Revision 1.2  2005/10/03 11:08:16  fraggle
 // Replace end of section functions with NULLs as they arent currently being
 // used for anything.
@@ -37,21 +40,184 @@
 
 #include "doomdef.h"
 #include "doomtype.h"
+
+#include "z_zone.h"
+
 #include "deh_defs.h"
+#include "deh_io.h"
+
+typedef struct 
+{
+    char *from_text;
+    char *to_text;
+} deh_substitution_t;
+
+static deh_substitution_t **hash_table;
+static int hash_table_entries;
+static int hash_table_length;
+
+// This is the algorithm used by glib
+
+static unsigned int strhash(char *s)
+{
+    char *p = s;
+    unsigned int h = *p;
+  
+    if (h)
+    {
+        for (p += 1; *p; p++)
+            h = (h << 5) - h + *p;
+    }
+
+    return h;
+}
+
+// Look up a string to see if it has been replaced with something else
+// This will be used throughout the program to substitute text
+
+char *DEH_String(char *s)
+{
+    int entry;
+
+    entry = strhash(s) % hash_table_length;
+
+    while (hash_table[entry] != NULL)
+    {
+        if (!strcmp(hash_table[entry]->from_text, s))
+        {
+            // substitution found!
+
+            return hash_table[entry]->to_text;
+        }
+
+        entry = (entry + 1) % hash_table_length;
+    }
+
+    // no substitution found
+
+    return s;
+}
+
+static void DEH_AddToHashtable(deh_substitution_t *sub);
+
+static void IncreaseHashtable(void)
+{
+    deh_substitution_t **old_table;
+    int old_table_length;
+    int i;
+    
+    // save the old table
+
+    old_table = hash_table;
+    old_table_length = hash_table_length;
+    
+    // double the size 
+
+    hash_table_length *= 2;
+    hash_table = Z_Malloc(sizeof(deh_substitution_t *) * hash_table_length,
+                          PU_STATIC, NULL);
+    memset(hash_table, 0, sizeof(deh_substitution_t *) * hash_table_length);
+
+    // go through the old table and insert all the old entries
+
+    for (i=0; i<old_table_length; ++i)
+    {
+        if (old_table[i] != NULL)
+        {
+            DEH_AddToHashtable(old_table[i]);
+        }
+    }
+
+    // free the old table
+
+    Z_Free(old_table);
+}
+
+static void DEH_AddToHashtable(deh_substitution_t *sub)
+{
+    int entry;
+
+    // if the hash table is more than 60% full, increase its size
+
+    if ((hash_table_entries * 10) / hash_table_length > 6)
+    {
+        IncreaseHashtable();
+    }
+    
+    // find where to insert it
+    
+    entry = strhash(sub->from_text) % hash_table_length;
+
+    while (hash_table[entry] != NULL)
+    {
+        entry = (entry + 1) % hash_table_length;
+    }
+
+    hash_table[entry] = sub;
+    ++hash_table_entries;
+}
+
+static void DEH_TextInit(void)
+{
+    // init hash table
+    
+    hash_table_entries = 0;
+    hash_table_length = 16;
+    hash_table = Z_Malloc(sizeof(deh_substitution_t *) * hash_table_length,
+                          PU_STATIC, NULL);
+    memset(hash_table, 0, sizeof(deh_substitution_t *) * hash_table_length);
+}
 
 static void *DEH_TextStart(deh_context_t *context, char *line)
 {
+    deh_substitution_t *sub;
+    int fromlen, tolen;
+    int i;
+    
+    sscanf(line, "Text %i %i", &fromlen, &tolen);
+
+    sub = Z_Malloc(sizeof(deh_substitution_t), PU_STATIC, NULL);
+    sub->from_text = Z_Malloc(fromlen + 1, PU_STATIC, NULL);
+    sub->to_text = Z_Malloc(tolen + 1, PU_STATIC, NULL);
+
+    // read in the "from" text
+
+    for (i=0; i<fromlen; ++i)
+    {
+        int c;
+
+        c = DEH_GetChar(context);
+            
+        sub->from_text[i] = c;
+    }
+    sub->from_text[fromlen] = '\0';
+
+    // read in the "to" text
+
+    for (i=0; i<tolen; ++i)
+    {
+        int c;
+
+        c = DEH_GetChar(context);
+            
+        sub->to_text[i] = c;
+    }
+    sub->to_text[tolen] = '\0';
+
+    DEH_AddToHashtable(sub);
+    
     return NULL;
 }
 
 static void DEH_TextParseLine(deh_context_t *context, char *line, void *tag)
 {
+    // not used
 }
 
 deh_section_t deh_section_text =
 {
     "Text",
-    NULL,
+    DEH_TextInit,
     DEH_TextStart,
     DEH_TextParseLine,
     NULL,
diff --git a/src/f_finale.c b/src/f_finale.c
index f72f6c5..631578e 100644
--- a/src/f_finale.c
+++ b/src/f_finale.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: f_finale.c 149 2005-10-02 04:16:47Z fraggle $
+// $Id: f_finale.c 160 2005-10-03 21:39:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.4  2005/10/03 21:39:39  fraggle
+// Dehacked text substitutions
+//
 // Revision 1.3  2005/10/02 04:16:47  fraggle
 // Fixes for Final Doom
 //
@@ -39,11 +42,12 @@
 
 
 static const char
-rcsid[] = "$Id: f_finale.c 149 2005-10-02 04:16:47Z fraggle $";
+rcsid[] = "$Id: f_finale.c 160 2005-10-03 21:39:39Z fraggle $";
 
 #include <ctype.h>
 
 // Functions.
+#include "deh_main.h"
 #include "i_system.h"
 #include "m_swap.h"
 #include "z_zone.h"
@@ -152,6 +156,10 @@ void F_StartFinale (void)
             finaleflat = screen->background;
         }
     }
+
+    // Do dehacked substitutions of strings
+  
+    finaletext = DEH_String(finaletext);
     
     finalestage = 0;
     finalecount = 0;
@@ -555,7 +563,7 @@ void F_CastDrawer (void)
     // erase the entire screen to a background
     V_DrawPatch (0,0,0, W_CacheLumpName ("BOSSBACK", PU_CACHE));
 
-    F_CastPrint (castorder[castnum].name);
+    F_CastPrint (DEH_String(castorder[castnum].name));
     
     // draw the current frame in the middle of the screen
     sprdef = &sprites[caststate->sprite];
diff --git a/src/g_game.c b/src/g_game.c
index 6dccdfc..d643043 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: g_game.c 120 2005-09-22 13:13:47Z fraggle $
+// $Id: g_game.c 160 2005-10-03 21:39:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.12  2005/10/03 21:39:39  fraggle
+// Dehacked text substitutions
+//
 // Revision 1.11  2005/09/22 13:13:47  fraggle
 // Remove external statistics driver support (-statcopy):
 // nonfunctional on modern systems and never used.
@@ -71,7 +74,7 @@
 
 
 static const char
-rcsid[] = "$Id: g_game.c 120 2005-09-22 13:13:47Z fraggle $";
+rcsid[] = "$Id: g_game.c 160 2005-10-03 21:39:39Z fraggle $";
 
 #include <string.h>
 #include <stdlib.h>
@@ -79,6 +82,8 @@ rcsid[] = "$Id: g_game.c 120 2005-09-22 13:13:47Z fraggle $";
 #include "doomdef.h" 
 #include "doomstat.h"
 
+#include "deh_main.h"
+
 #include "z_zone.h"
 #include "f_finale.h"
 #include "m_argv.h"
@@ -1382,7 +1387,7 @@ void G_DoSaveGame (void)
     gameaction = ga_nothing; 
     savedescription[0] = 0;             
         
-    players[consoleplayer].message = GGSAVED; 
+    players[consoleplayer].message = DEH_String(GGSAVED);
 
     // draw the pattern into the back screen
     R_FillBackScreen ();       
diff --git a/src/hu_stuff.c b/src/hu_stuff.c
index 95b536d..b6503e8 100644
--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: hu_stuff.c 150 2005-10-02 04:22:06Z fraggle $
+// $Id: hu_stuff.c 160 2005-10-03 21:39:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.5  2005/10/03 21:39:39  fraggle
+// Dehacked text substitutions
+//
 // Revision 1.4  2005/10/02 04:22:06  fraggle
 // Fix Final Doom automap level name display
 //
@@ -40,7 +43,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: hu_stuff.c 150 2005-10-02 04:22:06Z fraggle $";
+rcsid[] = "$Id: hu_stuff.c 160 2005-10-03 21:39:39Z fraggle $";
 
 #include <ctype.h>
 
@@ -48,6 +51,7 @@ rcsid[] = "$Id: hu_stuff.c 150 2005-10-02 04:22:06Z fraggle 
$";
 
 #include "z_zone.h"
 
+#include "deh_main.h"
 #include "m_swap.h"
 
 #include "hu_stuff.h"
@@ -370,6 +374,10 @@ void HU_Start(void)
          break;
     }
     
+    // dehacked substitution to get modified level name
+
+    s = DEH_String(s);
+    
     while (*s)
        HUlib_addCharToTextLine(&w_title, *(s++));
 
@@ -458,7 +466,7 @@ void HU_Ticker(void)
                                || chat_dest[i] == HU_BROADCAST))
                        {
                            HUlib_addMessageToSText(&w_message,
-                                                   player_names[i],
+                                                   DEH_String(player_names[i]),
                                                    w_inputbuffer[i].l.l);
                            
                            message_nottobefuckedwith = true;
@@ -490,7 +498,7 @@ void HU_queueChatChar(char c)
 {
     if (((head + 1) & (QUEUESIZE-1)) == tail)
     {
-       plr->message = HUSTR_MSGU;
+       plr->message = DEH_String(HUSTR_MSGU);
     }
     else
     {
@@ -587,15 +595,15 @@ boolean HU_Responder(event_t *ev)
                    {
                        num_nobrainers++;
                        if (num_nobrainers < 3)
-                           plr->message = HUSTR_TALKTOSELF1;
+                           plr->message = DEH_String(HUSTR_TALKTOSELF1);
                        else if (num_nobrainers < 6)
-                           plr->message = HUSTR_TALKTOSELF2;
+                           plr->message = DEH_String(HUSTR_TALKTOSELF2);
                        else if (num_nobrainers < 9)
-                           plr->message = HUSTR_TALKTOSELF3;
+                           plr->message = DEH_String(HUSTR_TALKTOSELF3);
                        else if (num_nobrainers < 32)
-                           plr->message = HUSTR_TALKTOSELF4;
+                           plr->message = DEH_String(HUSTR_TALKTOSELF4);
                        else
-                           plr->message = HUSTR_TALKTOSELF5;
+                           plr->message = DEH_String(HUSTR_TALKTOSELF5);
                    }
                }
            }
diff --git a/src/m_menu.c b/src/m_menu.c
index 196c1ca..2f429c3 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: m_menu.c 110 2005-09-17 20:25:56Z fraggle $
+// $Id: m_menu.c 160 2005-10-03 21:39:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.8  2005/10/03 21:39:39  fraggle
+// Dehacked text substitutions
+//
 // Revision 1.7  2005/09/17 20:25:56  fraggle
 // Set the default values for variables in their initialisers.  Remove the
 // "defaultvalue" parameter and associated code from the configuration
@@ -54,7 +57,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: m_menu.c 110 2005-09-17 20:25:56Z fraggle $";
+rcsid[] = "$Id: m_menu.c 160 2005-10-03 21:39:39Z fraggle $";
 
 #include <stdlib.h>
 #include <ctype.h>
@@ -64,6 +67,7 @@ rcsid[] = "$Id: m_menu.c 110 2005-09-17 20:25:56Z fraggle $";
 #include "dstrings.h"
 
 #include "d_main.h"
+#include "deh_main.h"
 
 #include "i_system.h"
 #include "i_video.h"
@@ -623,7 +627,7 @@ void M_LoadGame (int choice)
 {
     if (netgame)
     {
-       M_StartMessage(LOADNET,NULL,false);
+       M_StartMessage(DEH_String(LOADNET),NULL,false);
        return;
     }
        
@@ -688,7 +692,7 @@ void M_SaveGame (int choice)
 {
     if (!usergame)
     {
-       M_StartMessage(SAVEDEAD,NULL,false);
+       M_StartMessage(DEH_String(SAVEDEAD),NULL,false);
        return;
     }
        
@@ -734,7 +738,7 @@ void M_QuickSave(void)
        quickSaveSlot = -2;     // means to pick a slot now
        return;
     }
-    sprintf(tempstring,QSPROMPT,savegamestrings[quickSaveSlot]);
+    sprintf(tempstring,DEH_String(QSPROMPT),savegamestrings[quickSaveSlot]);
     M_StartMessage(tempstring,M_QuickSaveResponse,true);
 }
 
@@ -757,16 +761,16 @@ void M_QuickLoad(void)
 {
     if (netgame)
     {
-       M_StartMessage(QLOADNET,NULL,false);
+       M_StartMessage(DEH_String(QLOADNET),NULL,false);
        return;
     }
        
     if (quickSaveSlot < 0)
     {
-       M_StartMessage(QSAVESPOT,NULL,false);
+       M_StartMessage(DEH_String(QSAVESPOT),NULL,false);
        return;
     }
-    sprintf(tempstring,QLPROMPT,savegamestrings[quickSaveSlot]);
+    sprintf(tempstring,DEH_String(QLPROMPT),savegamestrings[quickSaveSlot]);
     M_StartMessage(tempstring,M_QuickLoadResponse,true);
 }
 
@@ -902,7 +906,7 @@ void M_NewGame(int choice)
 {
     if (netgame && !demoplayback)
     {
-       M_StartMessage(NEWGAME,NULL,false);
+       M_StartMessage(DEH_String(NEWGAME),NULL,false);
        return;
     }
        
@@ -936,7 +940,7 @@ void M_ChooseSkill(int choice)
 {
     if (choice == nightmare)
     {
-       M_StartMessage(NIGHTMARE,M_VerifyNightmare,true);
+       M_StartMessage(DEH_String(NIGHTMARE),M_VerifyNightmare,true);
        return;
     }
        
@@ -949,7 +953,7 @@ void M_Episode(int choice)
     if ( (gamemode == shareware)
         && choice)
     {
-       M_StartMessage(SWSTRING,NULL,false);
+       M_StartMessage(DEH_String(SWSTRING),NULL,false);
        M_SetupNextMenu(&ReadDef1);
        return;
     }
@@ -1010,9 +1014,9 @@ void M_ChangeMessages(int choice)
     showMessages = 1 - showMessages;
        
     if (!showMessages)
-       players[consoleplayer].message = MSGOFF;
+       players[consoleplayer].message = DEH_String(MSGOFF);
     else
-       players[consoleplayer].message = MSGON ;
+       players[consoleplayer].message = DEH_String(MSGON);
 
     message_dontfuckwithme = true;
 }
@@ -1042,11 +1046,11 @@ void M_EndGame(int choice)
        
     if (netgame)
     {
-       M_StartMessage(NETEND,NULL,false);
+       M_StartMessage(DEH_String(NETEND),NULL,false);
        return;
     }
        
-    M_StartMessage(ENDGAME,M_EndGameResponse,true);
+    M_StartMessage(DEH_String(ENDGAME),M_EndGameResponse,true);
 }
 
 
@@ -1144,7 +1148,9 @@ static char *M_SelectEndMessage(void)
 
 void M_QuitDOOM(int choice)
 {
-    sprintf(endstring, "%s\n\n" DOSY, M_SelectEndMessage());
+    sprintf(endstring, "%s\n\n%s",
+            DEH_String(M_SelectEndMessage()),
+            DEH_String(DOSY));
   
     M_StartMessage(endstring,M_QuitResponse,true);
 }
@@ -1178,9 +1184,9 @@ void M_ChangeDetail(int choice)
     R_SetViewSize (screenblocks, detailLevel);
 
     if (!detailLevel)
-       players[consoleplayer].message = DETAILHI;
+       players[consoleplayer].message = DEH_String(DETAILHI);
     else
-       players[consoleplayer].message = DETAILLO;
+       players[consoleplayer].message = DEH_String(DETAILLO);
 }
 
 
@@ -1635,8 +1641,8 @@ boolean M_Responder (event_t* ev)
            usegamma++;
            if (usegamma > 4)
                usegamma = 0;
-           players[consoleplayer].message = gammamsg[usegamma];
-           I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE));
+           players[consoleplayer].message = DEH_String(gammamsg[usegamma]);
+            I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE));
            return true;
                                
        }
diff --git a/src/p_doors.c b/src/p_doors.c
index faa24c6..6b11dba 100644
--- a/src/p_doors.c
+++ b/src/p_doors.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: p_doors.c 8 2005-07-23 16:44:57Z fraggle $
+// $Id: p_doors.c 160 2005-10-03 21:39:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.3  2005/10/03 21:39:39  fraggle
+// Dehacked text substitutions
+//
 // Revision 1.2  2005/07/23 16:44:56  fraggle
 // Update copyright to GNU GPL
 //
@@ -34,11 +37,12 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: p_doors.c 8 2005-07-23 16:44:57Z fraggle $";
+rcsid[] = "$Id: p_doors.c 160 2005-10-03 21:39:39Z fraggle $";
 
 
 #include "z_zone.h"
 #include "doomdef.h"
+#include "deh_main.h"
 #include "p_local.h"
 
 #include "s_sound.h"
@@ -237,7 +241,7 @@ EV_DoLockedDoor
            return 0;
        if (!p->cards[it_bluecard] && !p->cards[it_blueskull])
        {
-           p->message = PD_BLUEO;
+           p->message = DEH_String(PD_BLUEO);
            S_StartSound(NULL,sfx_oof);
            return 0;
        }
@@ -249,7 +253,7 @@ EV_DoLockedDoor
            return 0;
        if (!p->cards[it_redcard] && !p->cards[it_redskull])
        {
-           p->message = PD_REDO;
+           p->message = DEH_String(PD_REDO);
            S_StartSound(NULL,sfx_oof);
            return 0;
        }
@@ -262,7 +266,7 @@ EV_DoLockedDoor
        if (!p->cards[it_yellowcard] &&
            !p->cards[it_yellowskull])
        {
-           p->message = PD_YELLOWO;
+           p->message = DEH_String(PD_YELLOWO);
            S_StartSound(NULL,sfx_oof);
            return 0;
        }
@@ -388,7 +392,7 @@ EV_VerticalDoor
        
        if (!player->cards[it_bluecard] && !player->cards[it_blueskull])
        {
-           player->message = PD_BLUEK;
+           player->message = DEH_String(PD_BLUEK);
            S_StartSound(NULL,sfx_oof);
            return;
        }
@@ -402,7 +406,7 @@ EV_VerticalDoor
        if (!player->cards[it_yellowcard] &&
            !player->cards[it_yellowskull])
        {
-           player->message = PD_YELLOWK;
+           player->message = DEH_String(PD_YELLOWK);
            S_StartSound(NULL,sfx_oof);
            return;
        }
@@ -415,7 +419,7 @@ EV_VerticalDoor
        
        if (!player->cards[it_redcard] && !player->cards[it_redskull])
        {
-           player->message = PD_REDK;
+           player->message = DEH_String(PD_REDK);
            S_StartSound(NULL,sfx_oof);
            return;
        }
diff --git a/src/p_inter.c b/src/p_inter.c
index bc69cd8..f581f0e 100644
--- a/src/p_inter.c
+++ b/src/p_inter.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: p_inter.c 18 2005-07-23 18:56:07Z fraggle $
+// $Id: p_inter.c 160 2005-10-03 21:39:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.4  2005/10/03 21:39:39  fraggle
+// Dehacked text substitutions
+//
 // Revision 1.3  2005/07/23 18:56:07  fraggle
 // Remove unneccessary pragmas
 //
@@ -39,7 +42,7 @@
 
 
 static const char
-rcsid[] = "$Id: p_inter.c 18 2005-07-23 18:56:07Z fraggle $";
+rcsid[] = "$Id: p_inter.c 160 2005-10-03 21:39:39Z fraggle $";
 
 
 // Data.
@@ -47,6 +50,7 @@ rcsid[] = "$Id: p_inter.c 18 2005-07-23 18:56:07Z fraggle $";
 #include "dstrings.h"
 #include "sounds.h"
 
+#include "deh_main.h"
 #include "doomstat.h"
 
 #include "m_random.h"
@@ -383,13 +387,13 @@ P_TouchSpecialThing
       case SPR_ARM1:
        if (!P_GiveArmor (player, 1))
            return;
-       player->message = GOTARMOR;
+       player->message = DEH_String(GOTARMOR);
        break;
                
       case SPR_ARM2:
        if (!P_GiveArmor (player, 2))
            return;
-       player->message = GOTMEGA;
+       player->message = DEH_String(GOTMEGA);
        break;
        
        // bonus items
@@ -398,7 +402,7 @@ P_TouchSpecialThing
        if (player->health > 200)
            player->health = 200;
        player->mo->health = player->health;
-       player->message = GOTHTHBONUS;
+       player->message = DEH_String(GOTHTHBONUS);
        break;
        
       case SPR_BON2:
@@ -407,7 +411,7 @@ P_TouchSpecialThing
            player->armorpoints = 200;
        if (!player->armortype)
            player->armortype = 1;
-       player->message = GOTARMBONUS;
+       player->message = DEH_String(GOTARMBONUS);
        break;
        
       case SPR_SOUL:
@@ -415,7 +419,7 @@ P_TouchSpecialThing
        if (player->health > 200)
            player->health = 200;
        player->mo->health = player->health;
-       player->message = GOTSUPER;
+       player->message = DEH_String(GOTSUPER);
        sound = sfx_getpow;
        break;
        
@@ -425,7 +429,7 @@ P_TouchSpecialThing
        player->health = 200;
        player->mo->health = player->health;
        P_GiveArmor (player,2);
-       player->message = GOTMSPHERE;
+       player->message = DEH_String(GOTMSPHERE);
        sound = sfx_getpow;
        break;
        
@@ -433,7 +437,7 @@ P_TouchSpecialThing
        // leave cards for everyone
       case SPR_BKEY:
        if (!player->cards[it_bluecard])
-           player->message = GOTBLUECARD;
+           player->message = DEH_String(GOTBLUECARD);
        P_GiveCard (player, it_bluecard);
        if (!netgame)
            break;
@@ -441,7 +445,7 @@ P_TouchSpecialThing
        
       case SPR_YKEY:
        if (!player->cards[it_yellowcard])
-           player->message = GOTYELWCARD;
+           player->message = DEH_String(GOTYELWCARD);
        P_GiveCard (player, it_yellowcard);
        if (!netgame)
            break;
@@ -449,7 +453,7 @@ P_TouchSpecialThing
        
       case SPR_RKEY:
        if (!player->cards[it_redcard])
-           player->message = GOTREDCARD;
+           player->message = DEH_String(GOTREDCARD);
        P_GiveCard (player, it_redcard);
        if (!netgame)
            break;
@@ -457,7 +461,7 @@ P_TouchSpecialThing
        
       case SPR_BSKU:
        if (!player->cards[it_blueskull])
-           player->message = GOTBLUESKUL;
+           player->message = DEH_String(GOTBLUESKUL);
        P_GiveCard (player, it_blueskull);
        if (!netgame)
            break;
@@ -465,7 +469,7 @@ P_TouchSpecialThing
        
       case SPR_YSKU:
        if (!player->cards[it_yellowskull])
-           player->message = GOTYELWSKUL;
+           player->message = DEH_String(GOTYELWSKUL);
        P_GiveCard (player, it_yellowskull);
        if (!netgame)
            break;
@@ -473,7 +477,7 @@ P_TouchSpecialThing
        
       case SPR_RSKU:
        if (!player->cards[it_redskull])
-           player->message = GOTREDSKULL;
+           player->message = DEH_String(GOTREDSKULL);
        P_GiveCard (player, it_redskull);
        if (!netgame)
            break;
@@ -483,7 +487,7 @@ P_TouchSpecialThing
       case SPR_STIM:
        if (!P_GiveBody (player, 10))
            return;
-       player->message = GOTSTIM;
+       player->message = DEH_String(GOTSTIM);
        break;
        
       case SPR_MEDI:
@@ -491,9 +495,9 @@ P_TouchSpecialThing
            return;
 
        if (player->health < 25)
-           player->message = GOTMEDINEED;
+           player->message = DEH_String(GOTMEDINEED);
        else
-           player->message = GOTMEDIKIT;
+           player->message = DEH_String(GOTMEDIKIT);
        break;
 
        
@@ -501,14 +505,14 @@ P_TouchSpecialThing
       case SPR_PINV:
        if (!P_GivePower (player, pw_invulnerability))
            return;
-       player->message = GOTINVUL;
+       player->message = DEH_String(GOTINVUL);
        sound = sfx_getpow;
        break;
        
       case SPR_PSTR:
        if (!P_GivePower (player, pw_strength))
            return;
-       player->message = GOTBERSERK;
+       player->message = DEH_String(GOTBERSERK);
        if (player->readyweapon != wp_fist)
            player->pendingweapon = wp_fist;
        sound = sfx_getpow;
@@ -517,28 +521,28 @@ P_TouchSpecialThing
       case SPR_PINS:
        if (!P_GivePower (player, pw_invisibility))
            return;
-       player->message = GOTINVIS;
+       player->message = DEH_String(GOTINVIS);
        sound = sfx_getpow;
        break;
        
       case SPR_SUIT:
        if (!P_GivePower (player, pw_ironfeet))
            return;
-       player->message = GOTSUIT;
+       player->message = DEH_String(GOTSUIT);
        sound = sfx_getpow;
        break;
        
       case SPR_PMAP:
        if (!P_GivePower (player, pw_allmap))
            return;
-       player->message = GOTMAP;
+       player->message = DEH_String(GOTMAP);
        sound = sfx_getpow;
        break;
        
       case SPR_PVIS:
        if (!P_GivePower (player, pw_infrared))
            return;
-       player->message = GOTVISOR;
+       player->message = DEH_String(GOTVISOR);
        sound = sfx_getpow;
        break;
        
@@ -554,49 +558,49 @@ P_TouchSpecialThing
            if (!P_GiveAmmo (player,am_clip,1))
                return;
        }
-       player->message = GOTCLIP;
+       player->message = DEH_String(GOTCLIP);
        break;
        
       case SPR_AMMO:
        if (!P_GiveAmmo (player, am_clip,5))
            return;
-       player->message = GOTCLIPBOX;
+       player->message = DEH_String(GOTCLIPBOX);
        break;
        
       case SPR_ROCK:
        if (!P_GiveAmmo (player, am_misl,1))
            return;
-       player->message = GOTROCKET;
+       player->message = DEH_String(GOTROCKET);
        break;
        
       case SPR_BROK:
        if (!P_GiveAmmo (player, am_misl,5))
            return;
-       player->message = GOTROCKBOX;
+       player->message = DEH_String(GOTROCKBOX);
        break;
        
       case SPR_CELL:
        if (!P_GiveAmmo (player, am_cell,1))
            return;
-       player->message = GOTCELL;
+       player->message = DEH_String(GOTCELL);
        break;
        
       case SPR_CELP:
        if (!P_GiveAmmo (player, am_cell,5))
            return;
-       player->message = GOTCELLBOX;
+       player->message = DEH_String(GOTCELLBOX);
        break;
        
       case SPR_SHEL:
        if (!P_GiveAmmo (player, am_shell,1))
            return;
-       player->message = GOTSHELLS;
+       player->message = DEH_String(GOTSHELLS);
        break;
        
       case SPR_SBOX:
        if (!P_GiveAmmo (player, am_shell,5))
            return;
-       player->message = GOTSHELLBOX;
+       player->message = DEH_String(GOTSHELLBOX);
        break;
        
       case SPR_BPAK:
@@ -608,56 +612,56 @@ P_TouchSpecialThing
        }
        for (i=0 ; i<NUMAMMO ; i++)
            P_GiveAmmo (player, i, 1);
-       player->message = GOTBACKPACK;
+       player->message = DEH_String(GOTBACKPACK);
        break;
        
        // weapons
       case SPR_BFUG:
        if (!P_GiveWeapon (player, wp_bfg, false) )
            return;
-       player->message = GOTBFG9000;
+       player->message = DEH_String(GOTBFG9000);
        sound = sfx_wpnup;      
        break;
        
       case SPR_MGUN:
        if (!P_GiveWeapon (player, wp_chaingun, special->flags&MF_DROPPED) )
            return;
-       player->message = GOTCHAINGUN;
+       player->message = DEH_String(GOTCHAINGUN);
        sound = sfx_wpnup;      
        break;
        
       case SPR_CSAW:
        if (!P_GiveWeapon (player, wp_chainsaw, false) )
            return;
-       player->message = GOTCHAINSAW;
+       player->message = DEH_String(GOTCHAINSAW);
        sound = sfx_wpnup;      
        break;
        
       case SPR_LAUN:
        if (!P_GiveWeapon (player, wp_missile, false) )
            return;
-       player->message = GOTLAUNCHER;
+       player->message = DEH_String(GOTLAUNCHER);
        sound = sfx_wpnup;      
        break;
        
       case SPR_PLAS:
        if (!P_GiveWeapon (player, wp_plasma, false) )
            return;
-       player->message = GOTPLASMA;
+       player->message = DEH_String(GOTPLASMA);
        sound = sfx_wpnup;      
        break;
        
       case SPR_SHOT:
        if (!P_GiveWeapon (player, wp_shotgun, special->flags&MF_DROPPED ) )
            return;
-       player->message = GOTSHOTGUN;
+       player->message = DEH_String(GOTSHOTGUN);
        sound = sfx_wpnup;      
        break;
                
       case SPR_SGN2:
        if (!P_GiveWeapon (player, wp_supershotgun, special->flags&MF_DROPPED ) 
)
            return;
-       player->message = GOTSHOTGUN2;
+       player->message = DEH_String(GOTSHOTGUN2);
        sound = sfx_wpnup;      
        break;
                
diff --git a/src/st_stuff.c b/src/st_stuff.c
index 1b61953..27b9cd7 100644
--- a/src/st_stuff.c
+++ b/src/st_stuff.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: st_stuff.c 67 2005-09-04 14:55:53Z fraggle $
+// $Id: st_stuff.c 160 2005-10-03 21:39:39Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.5  2005/10/03 21:39:39  fraggle
+// Dehacked text substitutions
+//
 // Revision 1.4  2005/09/04 14:55:53  fraggle
 // Doom v1.9 doesnt allow cheats in nightmare mode!
 //
@@ -43,7 +46,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: st_stuff.c 67 2005-09-04 14:55:53Z fraggle $";
+rcsid[] = "$Id: st_stuff.c 160 2005-10-03 21:39:39Z fraggle $";
 
 
 #include <stdio.h>
@@ -54,6 +57,7 @@ rcsid[] = "$Id: st_stuff.c 67 2005-09-04 14:55:53Z fraggle $";
 #include "m_random.h"
 #include "w_wad.h"
 
+#include "deh_main.h"
 #include "doomdef.h"
 
 #include "g_game.h"
@@ -571,10 +575,10 @@ ST_Responder (event_t* ev)
            plyr->mo->health = 100;
          
          plyr->health = 100;
-         plyr->message = STSTR_DQDON;
+         plyr->message = DEH_String(STSTR_DQDON);
        }
        else 
-         plyr->message = STSTR_DQDOFF;
+         plyr->message = DEH_String(STSTR_DQDOFF);
       }
       // 'fa' cheat for killer fucking arsenal
       else if (cht_CheckCheat(&cheat_ammonokey, ev->data1))
@@ -588,7 +592,7 @@ ST_Responder (event_t* ev)
        for (i=0;i<NUMAMMO;i++)
          plyr->ammo[i] = plyr->maxammo[i];
        
-       plyr->message = STSTR_FAADDED;
+       plyr->message = DEH_String(STSTR_FAADDED);
       }
       // 'kfa' cheat for key full ammo
       else if (cht_CheckCheat(&cheat_ammo, ev->data1))
@@ -605,7 +609,7 @@ ST_Responder (event_t* ev)
        for (i=0;i<NUMCARDS;i++)
          plyr->cards[i] = true;
        
-       plyr->message = STSTR_KFAADDED;
+       plyr->message = DEH_String(STSTR_KFAADDED);
       }
       // 'mus' cheat for changing music
       else if (cht_CheckCheat(&cheat_mus, ev->data1))
@@ -614,7 +618,7 @@ ST_Responder (event_t* ev)
        char    buf[3];
        int             musnum;
        
-       plyr->message = STSTR_MUS;
+       plyr->message = DEH_String(STSTR_MUS);
        cht_GetParam(&cheat_mus, buf);
        
        if (gamemode == commercial)
@@ -622,7 +626,7 @@ ST_Responder (event_t* ev)
          musnum = mus_runnin + (buf[0]-'0')*10 + buf[1]-'0' - 1;
          
          if (((buf[0]-'0')*10 + buf[1]-'0') > 35)
-           plyr->message = STSTR_NOMUS;
+           plyr->message = DEH_String(STSTR_NOMUS);
          else
            S_ChangeMusic(musnum, 1);
        }
@@ -631,7 +635,7 @@ ST_Responder (event_t* ev)
          musnum = mus_e1m1 + (buf[0]-'1')*9 + (buf[1]-'1');
          
          if (((buf[0]-'1')*9 + buf[1]-'1') > 31)
-           plyr->message = STSTR_NOMUS;
+           plyr->message = DEH_String(STSTR_NOMUS);
          else
            S_ChangeMusic(musnum, 1);
        }
@@ -644,9 +648,9 @@ ST_Responder (event_t* ev)
        plyr->cheats ^= CF_NOCLIP;
        
        if (plyr->cheats & CF_NOCLIP)
-         plyr->message = STSTR_NCON;
+         plyr->message = DEH_String(STSTR_NCON);
        else
-         plyr->message = STSTR_NCOFF;
+         plyr->message = DEH_String(STSTR_NCOFF);
       }
       // 'behold?' power-up cheats
       for (i=0;i<6;i++)
@@ -660,21 +664,21 @@ ST_Responder (event_t* ev)
          else
            plyr->powers[i] = 0;
          
-         plyr->message = STSTR_BEHOLDX;
+         plyr->message = DEH_String(STSTR_BEHOLDX);
        }
       }
       
       // 'behold' power-up menu
       if (cht_CheckCheat(&cheat_powerup[6], ev->data1))
       {
-       plyr->message = STSTR_BEHOLD;
+       plyr->message = DEH_String(STSTR_BEHOLD);
       }
       // 'choppers' invulnerability & chainsaw
       else if (cht_CheckCheat(&cheat_choppers, ev->data1))
       {
        plyr->weaponowned[wp_chainsaw] = true;
        plyr->powers[pw_invulnerability] = true;
-       plyr->message = STSTR_CHOPPERS;
+       plyr->message = DEH_String(STSTR_CHOPPERS);
       }
       // 'mypos' for player position
       else if (cht_CheckCheat(&cheat_mypos, ev->data1))
@@ -733,7 +737,7 @@ ST_Responder (event_t* ev)
        return false;
 
       // So be it.
-      plyr->message = STSTR_CLEV;
+      plyr->message = DEH_String(STSTR_CLEV);
       G_DeferedInitNew(gameskill, epsd, map);
     }    
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-games/chocolate-doom.git

_______________________________________________
Pkg-games-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

Reply via email to