From 4b5ec2aabb899dfc3ae85bc46b65fbe956549cce Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 27 Oct 2019 08:14:58 +0100 Subject: [PATCH] - transitioned the combat macros to the new config and made them independent for all games, so that everything can use the original text. (But considering that they are a multiplayer feature I'm not sure how much that is worth.) - sort the config output alphabetically. - do not use [=] as key names for the bindings. --- source/blood/src/blood.cpp | 2 +- source/blood/src/config.cpp | 21 -------------- source/blood/src/config.h | 3 -- source/blood/src/messages.cpp | 2 +- source/build/include/osd.h | 2 -- source/build/src/baselayer.cpp | 7 ----- source/build/src/osd.cpp | 46 ------------------------------- source/build/src/sdlayer.cpp | 3 +- source/common/console/c_cvars.cpp | 25 ++++++++++++----- source/common/console/c_cvars.h | 2 +- source/common/gameconfigfile.cpp | 4 ++- source/common/gamecontrol.cpp | 41 +++++++++++++++++++++------ source/common/gamecontrol.h | 8 ++++++ source/duke3d/src/config.cpp | 22 --------------- source/duke3d/src/game.cpp | 6 ++-- source/duke3d/src/game.h | 3 -- source/duke3d/src/gameexec.cpp | 2 +- source/duke3d/src/menus.cpp | 5 +++- source/mact/include/keyboard.h | 4 +-- source/rr/src/config.cpp | 35 ----------------------- source/rr/src/game.cpp | 6 ++-- source/rr/src/game.h | 3 -- source/rr/src/menus.cpp | 7 +++-- source/sw/src/config.cpp | 15 ---------- source/sw/src/config.h | 1 - source/sw/src/game.cpp | 6 ++-- source/sw/src/swconfig.cpp | 34 ----------------------- 27 files changed, 86 insertions(+), 229 deletions(-) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 8f4684f61..1e8d6c180 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -876,7 +876,7 @@ void LocalKeys(void) } else { - gPlayerMsg.Set(CommbatMacro[fk]); + gPlayerMsg.Set(*CombatMacros[fk]); gPlayerMsg.Send(); } keyFlushScans(); diff --git a/source/blood/src/config.cpp b/source/blood/src/config.cpp index ec2e348ee..edcdc0dd2 100644 --- a/source/blood/src/config.cpp +++ b/source/blood/src/config.cpp @@ -61,7 +61,6 @@ int32_t mus_restartonload; int32_t configversion; int32_t CheckForUpdates; int32_t LastUpdateCheck; -char CommbatMacro[MAXRIDECULE][MAXRIDECULELENGTH]; char szPlayerName[MAXPLAYERNAME]; int32_t gTurnSpeed; int32_t gDetail; @@ -189,18 +188,6 @@ void CONFIG_SetDefaults(void) cl_weaponswitch = 1; Bstrcpy(szPlayerName, "Player"); - - Bstrcpy(CommbatMacro[0], "I love the smell of napalm..."); - Bstrcpy(CommbatMacro[1], "Is that gasoline I smell?"); - Bstrcpy(CommbatMacro[2], "Ta da!"); - Bstrcpy(CommbatMacro[3], "Who wants some, huh? Who's next?"); - Bstrcpy(CommbatMacro[4], "I have something for you."); - Bstrcpy(CommbatMacro[5], "You just gonna stand there..."); - Bstrcpy(CommbatMacro[6], "That'll teach ya!"); - Bstrcpy(CommbatMacro[7], "Ooh, that wasn't a bit nice."); - Bstrcpy(CommbatMacro[8], "Amateurs!"); - Bstrcpy(CommbatMacro[9], "Fool! You are already dead."); - } @@ -244,14 +231,6 @@ int CONFIG_ReadSetup(void) SCRIPT_GetNumber(scripthandle, "Game Options", "WeaponsV10x", &gWeaponsV10x); /////// - char commmacro[] = "CommbatMacro# "; - - for (int i = 0; i < MAXRIDECULE; i++) - { - commmacro[13] = i+'0'; - SCRIPT_GetString(scripthandle, "Comm Setup",commmacro,&CommbatMacro[i][0]); - } - Bmemset(tempbuf, 0, sizeof(tempbuf)); SCRIPT_GetString(scripthandle, "Comm Setup","PlayerName",&tempbuf[0]); diff --git a/source/blood/src/config.h b/source/blood/src/config.h index 4876ced45..2bee41d86 100644 --- a/source/blood/src/config.h +++ b/source/blood/src/config.h @@ -34,8 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -#define MAXRIDECULE 10 -#define MAXRIDECULELENGTH 40 #define MAXPLAYERNAME 16 extern int32_t scripthandle; @@ -43,7 +41,6 @@ extern int32_t setupread; extern int32_t configversion; extern int32_t CheckForUpdates; extern int32_t LastUpdateCheck; -extern char CommbatMacro[MAXRIDECULE][MAXRIDECULELENGTH]; extern char szPlayerName[MAXPLAYERNAME]; extern int32_t gTurnSpeed; extern int32_t gDetail; diff --git a/source/blood/src/messages.cpp b/source/blood/src/messages.cpp index aa895dbe3..355bf1f29 100644 --- a/source/blood/src/messages.cpp +++ b/source/blood/src/messages.cpp @@ -614,7 +614,7 @@ void CPlayerMsg::ProcessKeys(void) case sc_F9: case sc_F10: CONTROL_ClearButton(gamefunc_See_Chase_View); - Set(CommbatMacro[key-sc_F1]); + Set(*CombatMacros[key-sc_F1]); Send(); keystatus[key] = 0; break; diff --git a/source/build/include/osd.h b/source/build/include/osd.h index 67191ea4e..e6aee331e 100644 --- a/source/build/include/osd.h +++ b/source/build/include/osd.h @@ -41,7 +41,6 @@ enum cvartype_t CVAR_DOUBLE = 0x00000020, CVAR_READONLY = 0x00000040, CVAR_MULTI = 0x00000080, - CVAR_NOSAVE = 0x00000100, CVAR_FUNCPTR = 0x00000200, CVAR_RESTARTVID = 0x00000400, CVAR_INVALIDATEALL = 0x00000800, @@ -291,7 +290,6 @@ int OSD_RegisterFunction(const char *pszName, const char *pszDesc, int (*func)(o int osdcmd_cvar_set(osdcmdptr_t parm); void OSD_RegisterCvar(osdcvardata_t * cvar, int (*func)(osdcmdptr_t)); void OSD_WriteAliases(buildvfs_FILE fp); -void OSD_WriteCvars(buildvfs_FILE fp); static inline void OSD_SetHistory(int idx, const char *src) { diff --git a/source/build/src/baselayer.cpp b/source/build/src/baselayer.cpp index 1fe23fa2b..570ca19f8 100644 --- a/source/build/src/baselayer.cpp +++ b/source/build/src/baselayer.cpp @@ -252,13 +252,6 @@ int osdcmd_glinfo(osdcmdptr_t UNUSED(parm)) int32_t baselayer_init(void) { -#ifdef _WIN32 -// on Windows, don't save the "r_screenaspect" cvar because the physical screen size is -// determined at startup -# define SCREENASPECT_CVAR_TYPE (CVAR_UINT|CVAR_NOSAVE) -#else -# define SCREENASPECT_CVAR_TYPE (CVAR_UINT) -#endif #ifdef USE_OPENGL diff --git a/source/build/src/osd.cpp b/source/build/src/osd.cpp index 30d3029e7..b032a67cb 100644 --- a/source/build/src/osd.cpp +++ b/source/build/src/osd.cpp @@ -2212,49 +2212,3 @@ int osdcmd_cvar_set(osdcmdptr_t parm) } -void OSD_WriteCvars(buildvfs_FILE fp) -{ - Bassert(fp); - - char buf[64]; - - for (int i = 0; i < osd->numcvars; i++) - { - osdcvardata_t const &pData = *osd->cvars[i].pData; - - if (!(pData.flags & CVAR_NOSAVE)) - { - switch (pData.flags & CVAR_TYPEMASK) - { - case CVAR_FLOAT: - buildvfs_fputstrptr(fp, pData.name); - snprintf(buf, sizeof(buf), " \"%f\"\n", *pData.f); - buildvfs_fputstrptr(fp, buf); - break; - case CVAR_DOUBLE: - buildvfs_fputstrptr(fp, pData.name); - snprintf(buf, sizeof(buf), " \"%f\"\n", *pData.d); - buildvfs_fputstrptr(fp, buf); - break; - case CVAR_INT: - case CVAR_BOOL: - buildvfs_fputstrptr(fp, pData.name); - snprintf(buf, sizeof(buf), " \"%d\"\n", *pData.i32); - buildvfs_fputstrptr(fp, buf); - break; - case CVAR_UINT: - buildvfs_fputstrptr(fp, pData.name); - snprintf(buf, sizeof(buf), " \"%u\"\n", *pData.u32); - buildvfs_fputstrptr(fp, buf); - break; - case CVAR_STRING: - buildvfs_fputstrptr(fp, pData.name); - buildvfs_fputstr(fp, " \""); - buildvfs_fputstrptr(fp, pData.string); - buildvfs_fputstr(fp, "\"\n"); - break; - default: EDUKE32_UNREACHABLE_SECTION(break); - } - } - } -} diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index cf8382be5..2d5d6dc5a 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -145,7 +145,7 @@ void I_Error(const char *error, ...) char errortext[MAX_ERRORTEXT]; va_start(argptr, error); - snprintf(errortext, MAX_ERRORTEXT, error, argptr); + vsnprintf(errortext, MAX_ERRORTEXT, error, argptr); va_end(argptr); #ifdef _WIN32 OutputDebugStringA(errortext); @@ -611,6 +611,7 @@ int main(int argc, char *argv[]) FString logpath = M_GetDocumentsPath() + "demolition.log"; OSD_SetLogFile(logpath); + CONFIG_ReadCombatMacros(); // Startup dialog must be presented here so that everything can be set up before reading the keybinds. G_LoadConfig(currentGame); diff --git a/source/common/console/c_cvars.cpp b/source/common/console/c_cvars.cpp index 92abb0199..803abf413 100644 --- a/source/common/console/c_cvars.cpp +++ b/source/common/console/c_cvars.cpp @@ -51,8 +51,6 @@ //#include "menu/menu.h" //#include "vm.h" -#define CVAR_NOSAVE 0x100 // duplicate name, put in header later - struct FLatchedValue { FBaseCVar *Variable; @@ -1387,23 +1385,36 @@ void C_SetCVarsToDefaults (void) } } +static int cvarcmp(const void* a, const void* b) +{ + FBaseCVar** A = (FBaseCVar**)a; + FBaseCVar** B = (FBaseCVar**)b; + return strcmp((*A)->GetName(), (*B)->GetName()); +} + void C_ArchiveCVars (FConfigFile *f, uint32_t filter) { FBaseCVar *cvar = CVars; + TArray cvarlist; while (cvar) { if ((cvar->Flags & - (CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_AUTO|CVAR_SERVERINFO|CVAR_NOSAVE)) + (CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_AUTO|CVAR_SERVERINFO|CVAR_USERINFO|CVAR_NOSAVE)) == filter) { - const char *const value = (cvar->Flags & CVAR_ISDEFAULT) - ? cvar->GetGenericRep(CVAR_String).String - : cvar->SafeValue.GetChars(); - f->SetValueForKey(cvar->GetName(), value); + cvarlist.Push(cvar); } cvar = cvar->m_Next; } + qsort(cvarlist.Data(), cvarlist.Size(), sizeof(FBaseCVar*), cvarcmp); + for (auto cvar : cvarlist) + { + const char* const value = (cvar->Flags & CVAR_ISDEFAULT) + ? cvar->GetGenericRep(CVAR_String).String + : cvar->SafeValue.GetChars(); + f->SetValueForKey(cvar->GetName(), value); + } } #if 0 diff --git a/source/common/console/c_cvars.h b/source/common/console/c_cvars.h index b78b939ad..a71caa483 100644 --- a/source/common/console/c_cvars.h +++ b/source/common/console/c_cvars.h @@ -55,7 +55,7 @@ enum CVAR_UNSETTABLE = 32, // can unset this var from console CVAR_DEMOSAVE = 64, // save the value of this cvar in a demo CVAR_ISDEFAULT = 128, // is cvar unchanged since creation? - //CVAR_NOSAVE = 256, // when used with CVAR_SERVERINFO, do not save var to savegame + CVAR_NOSAVE = 256, // when used with CVAR_SERVERINFO, do not save var to savegame CVAR_NOINITCALL = 512, // don't call callback at game start CVAR_GLOBALCONFIG = 1024, // cvar is saved to global config section CVAR_VIDEOCONFIG = 2048, // cvar is saved to video config section (not implemented) diff --git a/source/common/gameconfigfile.cpp b/source/common/gameconfigfile.cpp index 71af66338..8bc88366c 100644 --- a/source/common/gameconfigfile.cpp +++ b/source/common/gameconfigfile.cpp @@ -239,6 +239,7 @@ void FGameConfigFile::DoGlobalSetup () } } + void FGameConfigFile::DoGameSetup (const char *gamename) { const char *key; @@ -297,7 +298,6 @@ void FGameConfigFile::DoKeySetup(const char *gamename) { NULL, NULL } }; */ - const char *key, *value; sublen = countof(section) - 1 - snprintf(section, countof(section), "%s.", gamename); subsection = section + countof(section) - sublen - 1; @@ -306,6 +306,7 @@ void FGameConfigFile::DoKeySetup(const char *gamename) //C_SetDefaultBindings (); #if 0 + const char* key, * value; for (int i = 0; binders[i].label != NULL; ++i) { strncpy(subsection, binders[i].label, sublen); @@ -533,6 +534,7 @@ static FString GameName; void G_LoadConfig(const char* game) { + OSD_Init(); GameConfig = new FGameConfigFile(); GameConfig->DoGlobalSetup(); GameConfig->DoGameSetup(game); diff --git a/source/common/gamecontrol.cpp b/source/common/gamecontrol.cpp index af84d97dd..fea6ef997 100644 --- a/source/common/gamecontrol.cpp +++ b/source/common/gamecontrol.cpp @@ -111,6 +111,7 @@ static FString stringStore[2 * NUMGAMEFUNCTIONS]; // toss all persistent strings CVAR(Int, cl_defaultconfiguration, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) + static int osdcmd_button(osdcmdptr_t parm) { static char const s_gamefunc_[] = "gamefunc_"; @@ -339,6 +340,35 @@ void CONFIG_SetDefaultKeys(const char *defbinds, bool lazy/*=false*/) } } +//========================================================================== +// +// +// +//========================================================================== + +CVAR(String, combatmacro0, "", CVAR_ARCHIVE | CVAR_USERINFO) +CVAR(String, combatmacro1, "", CVAR_ARCHIVE | CVAR_USERINFO) +CVAR(String, combatmacro2, "", CVAR_ARCHIVE | CVAR_USERINFO) +CVAR(String, combatmacro3, "", CVAR_ARCHIVE | CVAR_USERINFO) +CVAR(String, combatmacro4, "", CVAR_ARCHIVE | CVAR_USERINFO) +CVAR(String, combatmacro5, "", CVAR_ARCHIVE | CVAR_USERINFO) +CVAR(String, combatmacro6, "", CVAR_ARCHIVE | CVAR_USERINFO) +CVAR(String, combatmacro7, "", CVAR_ARCHIVE | CVAR_USERINFO) +CVAR(String, combatmacro8, "", CVAR_ARCHIVE | CVAR_USERINFO) +CVAR(String, combatmacro9, "", CVAR_ARCHIVE | CVAR_USERINFO) +FStringCVar* const CombatMacros[] = { &combatmacro0, &combatmacro1, &combatmacro2, &combatmacro3, &combatmacro4, &combatmacro5, &combatmacro6, &combatmacro7, &combatmacro8, &combatmacro9}; + +void CONFIG_ReadCombatMacros() +{ + FScanner sc; + sc.Open("demolition/combatmacros.txt"); + for (auto s : CombatMacros) + { + sc.MustGetToken(TK_StringConst); + if (strlen(*s) == 0) + *s = sc.String; + } +} //========================================================================== // @@ -1093,14 +1123,6 @@ void CONFIG_WriteControllerSettings() GameConfig->SetValueForKey("Comm Setup", "RTSName", &ud.rtsname[0]); - char commmacro[] = "CommbatMacro# "; - - for (int dummy = 0; dummy < MAXRIDECULE; dummy++) - { - commmacro[13] = dummy + '0'; - GameConfig->SetValueForKey("Comm Setup", commmacro, &ud.ridecule[dummy][0]); - } - SCRIPT_Save(g_setupFileName); if ((flags & 2) == 0) @@ -1110,4 +1132,5 @@ void CONFIG_WriteControllerSettings() CONFIG_WriteSettings(); Bfflush(NULL); -#endif \ No newline at end of file +#endif + diff --git a/source/common/gamecontrol.h b/source/common/gamecontrol.h index 51f912081..5322d9cac 100644 --- a/source/common/gamecontrol.h +++ b/source/common/gamecontrol.h @@ -3,6 +3,10 @@ #include "keyboard.h" #include "control.h" #include "_control.h" +#include "c_cvars.h" +#include "zstring.h" + +extern FString currentGame; // Order is that of EDuke32 by necessity because it exposes the key binds to scripting by index instead of by name. enum GameFunction_t @@ -146,3 +150,7 @@ void CONFIG_SetGameControllerDefaultsPro(); void CONFIG_SetGameControllerDefaultsClear(); char const* CONFIG_GetGameFuncOnJoystick(int gameFunc); char const* CONFIG_GetGameFuncOnKeyboard(int gameFunc); + + +extern FStringCVar* const CombatMacros[]; +void CONFIG_ReadCombatMacros(); diff --git a/source/duke3d/src/config.cpp b/source/duke3d/src/config.cpp index 0e4c9cf96..6dccbbbe2 100644 --- a/source/duke3d/src/config.cpp +++ b/source/duke3d/src/config.cpp @@ -118,20 +118,6 @@ void CONFIG_SetDefaults(void) Bstrcpy(szPlayerName, "Player"); -#ifndef EDUKE32_STANDALONE - Bstrcpy(ud.ridecule[0], "An inspiration for birth control."); - Bstrcpy(ud.ridecule[1], "You're gonna die for that!"); - Bstrcpy(ud.ridecule[2], "It hurts to be you."); - Bstrcpy(ud.ridecule[3], "Lucky son of a bitch."); - Bstrcpy(ud.ridecule[4], "Hmmm... payback time."); - Bstrcpy(ud.ridecule[5], "You bottom dwelling scum sucker."); - Bstrcpy(ud.ridecule[6], "Damn, you're ugly."); - Bstrcpy(ud.ridecule[7], "Ha ha ha... wasted!"); - Bstrcpy(ud.ridecule[8], "You suck!"); - Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!"); -#endif - - VM_OnEvent(EVENT_SETDEFAULTS, g_player[myconnectindex].ps->i, myconnectindex); } @@ -169,14 +155,6 @@ int CONFIG_ReadSetup(void) if (ud.config.scripthandle < 0) return -1; - char commmacro[] = "CommbatMacro# "; - - for (int i = 0; i < MAXRIDECULE; i++) - { - commmacro[13] = i+'0'; - SCRIPT_GetString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[i][0]); - } - Bmemset(tempbuf, 0, sizeof(tempbuf)); SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]); diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index e38b56458..edf1e6843 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -4754,15 +4754,15 @@ void G_HandleLocalKeys(void) return; } - G_AddUserQuote(ud.ridecule[ridiculeNum-1]); + G_AddUserQuote(*CombatMacros[ridiculeNum-1]); #ifndef NETCODE_DISABLE tempbuf[0] = PACKET_MESSAGE; tempbuf[1] = 255; tempbuf[2] = 0; - Bstrcat(tempbuf+2,ud.ridecule[ridiculeNum-1]); + Bstrcat(tempbuf+2,*CombatMacros[ridiculeNum-1]); - ridiculeNum = 2+strlen(ud.ridecule[ridiculeNum-1]); + ridiculeNum = 2+ strlen(*CombatMacros[ridiculeNum-1]); tempbuf[ridiculeNum++] = myconnectindex; diff --git a/source/duke3d/src/game.h b/source/duke3d/src/game.h index 4536d5087..b481e42a7 100644 --- a/source/duke3d/src/game.h +++ b/source/duke3d/src/game.h @@ -148,8 +148,6 @@ extern camera_t g_camera; #endif -#define MAXRIDECULE 10 -#define MAXRIDECULELENGTH 40 #define MAXSAVEGAMENAMESTRUCT 32 #define MAXSAVEGAMENAME (MAXSAVEGAMENAMESTRUCT-1) #define MAXPWLOCKOUT 128 @@ -245,7 +243,6 @@ typedef struct { char overhead_on,last_overhead,showweapons; char god,warp_on,cashman,eog,showallmap; char show_help,scrollmode,noclip; - char ridecule[MAXRIDECULE][MAXRIDECULELENGTH]; char pwlockout[MAXPWLOCKOUT],rtsname[MAXRTSNAME]; char display_bonus_screen; char show_level_text; diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 34a835948..fbda9053a 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "savegame.h" #include "scriplib.h" #include "gamecvars.h" +#include "gamecontrol.h" #include "gameconfigfile.h" #include "vfs.h" @@ -4259,7 +4260,6 @@ badindex: insptr++; dispatch(); } - extern FString currentGame; FString section = currentGame + ".Gamevars"; GameConfig->SetSection(section); switch (VM_DECODE_INST(tw)) diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index 6d70dd396..42c5b0ea1 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -1269,9 +1269,12 @@ static MenuEntry_t *MEL_PLAYER[] = { #endif }; +#define MAXRIDECULE 10 +#define MAXRIDECULELENGTH 40 static MenuString_t MEO_MACROS_TEMPLATE = MAKE_MENUSTRING( NULL, &MF_Bluefont, MAXRIDECULELENGTH, 0 ); static MenuString_t MEO_MACROS[10]; static MenuEntry_t ME_MACROS_TEMPLATE = MAKE_MENUENTRY( NULL, &MF_Bluefont, &MEF_Macros, &MEO_MACROS_TEMPLATE, String ); +static char sink[50]; static MenuEntry_t ME_MACROS[MAXRIDECULE]; static MenuEntry_t *MEL_MACROS[MAXRIDECULE]; @@ -1840,7 +1843,7 @@ void Menu_Init(void) ME_MACROS[i].entry = &MEO_MACROS[i]; MEO_MACROS[i] = MEO_MACROS_TEMPLATE; - MEO_MACROS[i].variable = ud.ridecule[i]; + MEO_MACROS[i].variable = sink;// ud.ridecule[i]; temporarily disabled } // prepare input diff --git a/source/mact/include/keyboard.h b/source/mact/include/keyboard.h index ca27cfb4e..6305046fc 100644 --- a/source/mact/include/keyboard.h +++ b/source/mact/include/keyboard.h @@ -42,9 +42,9 @@ static struct kb_scancode sc; } CONSTEXPR sctokeylut[] = { { "Escape", 0x1 }, { "1", 0x2 }, { "2", 0x3 }, { "3", 0x4 }, { "4", 0x5 }, { "5", 0x6 }, { "6", 0x7 }, - { "7", 0x8 }, { "8", 0x9 }, { "9", 0xa }, { "0", 0xb }, { "-", 0xc }, { "=", 0xd }, { "BakSpc", 0xe }, + { "7", 0x8 }, { "8", 0x9 }, { "9", 0xa }, { "0", 0xb }, { "-", 0xc }, { "Equal", 0xd }, { "BakSpc", 0xe }, { "Tab", 0xf }, { "Q", 0x10 }, { "W", 0x11 }, { "E", 0x12 }, { "R", 0x13 }, { "T", 0x14 }, { "Y", 0x15 }, - { "U", 0x16 }, { "I", 0x17 }, { "O", 0x18 }, { "P", 0x19 }, { "[", 0x1a }, { "]", 0x1b }, { "Enter", 0x1c }, + { "U", 0x16 }, { "I", 0x17 }, { "O", 0x18 }, { "P", 0x19 }, { "LeftBrk", 0x1a }, { "RightBrk", 0x1b }, { "Enter", 0x1c }, { "LCtrl", 0x1d }, { "A", 0x1e }, { "S", 0x1f }, { "D", 0x20 }, { "F", 0x21 }, { "G", 0x22 }, { "H", 0x23 }, { "J", 0x24 }, { "K", 0x25 }, { "L", 0x26 }, { ";", 0x27 }, { "'", 0x28 }, { "`", 0x29 }, { "LShift", 0x2a }, { "Backslash", 0x2b }, { "Z", 0x2c }, { "X", 0x2d }, { "C", 0x2e }, { "V", 0x2f }, { "B", 0x30 }, { "N", 0x31 }, diff --git a/source/rr/src/config.cpp b/source/rr/src/config.cpp index 7d2707757..411dbe611 100644 --- a/source/rr/src/config.cpp +++ b/source/rr/src/config.cpp @@ -120,41 +120,12 @@ void CONFIG_SetDefaults(void) Bstrcpy(ud.rtsname, G_DefaultRtsFile()); Bstrcpy(szPlayerName, "Player"); - - //if (RR) - //{ - // Bstrcpy(ud.ridecule[0], "Yer as ugly as a mud fence!"); - // Bstrcpy(ud.ridecule[1], "Duck you pecker-head!"); - // Bstrcpy(ud.ridecule[2], "You like that boy?"); - // Bstrcpy(ud.ridecule[3], "Yer lower than catfish crap!"); - // Bstrcpy(ud.ridecule[4], "Eat lead, you shit monkey!"); - // Bstrcpy(ud.ridecule[5], "You dumb-ass!"); - // Bstrcpy(ud.ridecule[6], "Yer slower'n a three legged dog!"); - // Bstrcpy(ud.ridecule[7], "Come on...Squeal like a pig!"); - // Bstrcpy(ud.ridecule[8], "Haw, haw, haw!"); - // Bstrcpy(ud.ridecule[9], "Now you gone and done it!"); - //} - //else - //{ - Bstrcpy(ud.ridecule[0], "An inspiration for birth control."); - Bstrcpy(ud.ridecule[1], "You're gonna die for that!"); - Bstrcpy(ud.ridecule[2], "It hurts to be you."); - Bstrcpy(ud.ridecule[3], "Lucky son of a bitch."); - Bstrcpy(ud.ridecule[4], "Hmmm... payback time."); - Bstrcpy(ud.ridecule[5], "You bottom dwelling scum sucker."); - Bstrcpy(ud.ridecule[6], "Damn, you're ugly."); - Bstrcpy(ud.ridecule[7], "Ha ha ha... wasted!"); - Bstrcpy(ud.ridecule[8], "You suck!"); - Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!"); - //} - } int32_t CONFIG_ReadSetup(void) { int32_t dummy; - char commmacro[] = "CommbatMacro# "; char tempbuf[1024]; CONFIG_SetDefaults(); @@ -189,12 +160,6 @@ int32_t CONFIG_ReadSetup(void) if (ud.config.scripthandle < 0) return -1; - for (dummy = 0; dummy < MAXRIDECULE; dummy++) - { - commmacro[13] = dummy+'0'; - SCRIPT_GetString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]); - } - Bmemset(tempbuf, 0, sizeof(tempbuf)); SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]); diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 533e5969a..42ddedcdb 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -6260,15 +6260,15 @@ void G_HandleLocalKeys(void) return; } - G_AddUserQuote(ud.ridecule[ridiculeNum-1]); + G_AddUserQuote(*CombatMacros[ridiculeNum-1]); #ifndef NETCODE_DISABLE tempbuf[0] = PACKET_MESSAGE; tempbuf[1] = 255; tempbuf[2] = 0; - Bstrcat(tempbuf+2,ud.ridecule[ridiculeNum-1]); + Bstrcat(tempbuf+2,*CombatMacros[ridiculeNum-1]); - ridiculeNum = 2+strlen(ud.ridecule[ridiculeNum-1]); + ridiculeNum = 2 + strlen(*CombatMacros[ridiculeNum - 1]); tempbuf[ridiculeNum++] = myconnectindex; diff --git a/source/rr/src/game.h b/source/rr/src/game.h index 7bcb810c9..d005481bc 100644 --- a/source/rr/src/game.h +++ b/source/rr/src/game.h @@ -128,8 +128,6 @@ void A_DeleteSprite(int spriteNum); #endif -#define MAXRIDECULE 10 -#define MAXRIDECULELENGTH 40 #define MAXSAVEGAMENAMESTRUCT 32 #define MAXSAVEGAMENAME (MAXSAVEGAMENAMESTRUCT-1) #define MAXPWLOCKOUT 128 @@ -206,7 +204,6 @@ typedef struct { char overhead_on,last_overhead,showweapons; char god,warp_on,cashman,eog,showallmap; char show_help,scrollmode,noclip; - char ridecule[MAXRIDECULE][MAXRIDECULELENGTH]; char pwlockout[MAXPWLOCKOUT],rtsname[MAXRTSNAME]; char display_bonus_screen; char show_level_text; diff --git a/source/rr/src/menus.cpp b/source/rr/src/menus.cpp index 63cc926ea..b66f5a697 100644 --- a/source/rr/src/menus.cpp +++ b/source/rr/src/menus.cpp @@ -1218,8 +1218,11 @@ static MenuEntry_t *MEL_PLAYER[] = { #endif }; +#define MAXRIDECULE 10 +#define MAXRIDECULELENGTH 40 static MenuString_t MEO_MACROS_TEMPLATE = MAKE_MENUSTRING( NULL, &MF_Bluefont, MAXRIDECULELENGTH, 0 ); static MenuString_t MEO_MACROS[10]; +static char sink[50]; static MenuEntry_t ME_MACROS_TEMPLATE = MAKE_MENUENTRY( NULL, &MF_Bluefont, &MEF_Macros, &MEO_MACROS_TEMPLATE, String ); static MenuEntry_t ME_MACROS[MAXRIDECULE]; static MenuEntry_t *MEL_MACROS[MAXRIDECULE]; @@ -1735,8 +1738,8 @@ void Menu_Init(void) ME_MACROS[i].entry = &MEO_MACROS[i]; MEO_MACROS[i] = MEO_MACROS_TEMPLATE; - MEO_MACROS[i].variable = ud.ridecule[i]; - } + MEO_MACROS[i].variable = sink;// ud.ridecule[i]; temporarily disabled + } // prepare input for (i = 0; i < NUMGAMEFUNCTIONS; ++i) diff --git a/source/sw/src/config.cpp b/source/sw/src/config.cpp index 2df525f98..2a2868965 100644 --- a/source/sw/src/config.cpp +++ b/source/sw/src/config.cpp @@ -81,7 +81,6 @@ int32_t ScreenHeight = 480; int32_t ScreenBPP = 8; int32_t ForceSetup = 1; -extern char WangBangMacro[10][64]; char RTSName[MAXRTSNAMELENGTH]; static int32_t scripthandle = -1; @@ -129,20 +128,6 @@ void CONFIG_SetDefaults(void) Bstrcpy(RTSName, DEFAULTRTSFILE); Bstrcpy(CommPlayerName, DEFAULTPLAYERNAME); - - Bstrcpy(WangBangMacro[0], MACRO1); - Bstrcpy(WangBangMacro[1], MACRO2); - Bstrcpy(WangBangMacro[2], MACRO3); - Bstrcpy(WangBangMacro[3], MACRO4); - Bstrcpy(WangBangMacro[4], MACRO5); - Bstrcpy(WangBangMacro[5], MACRO6); - Bstrcpy(WangBangMacro[6], MACRO7); - Bstrcpy(WangBangMacro[7], MACRO8); - Bstrcpy(WangBangMacro[8], MACRO9); - Bstrcpy(WangBangMacro[9], MACRO10); - - //SetMouseDefaults(0); - } diff --git a/source/sw/src/config.h b/source/sw/src/config.h index 384e79905..60e60ab88 100644 --- a/source/sw/src/config.h +++ b/source/sw/src/config.h @@ -61,7 +61,6 @@ extern char InitString[MAXMODEMSTRING]; extern char HangupString[MAXMODEMSTRING]; extern char DialoutString[MAXMODEMSTRING]; extern int32_t SocketNumber; -extern char CommbatMacro[MAXMACROS][MAXMACROLENGTH]; extern char PhoneNames[MAXPHONEENTRIES][PHONENAMELENGTH]; extern char PhoneNumbers[MAXPHONEENTRIES][PHONENUMBERLENGTH]; extern char PhoneNumber[PHONENUMBERLENGTH]; diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index f3e3b91dc..8124a6c93 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -4423,8 +4423,6 @@ ConKey(void) #endif } -char WangBangMacro[10][64]; - void FunctionKeys(PLAYERp pp) { @@ -4481,14 +4479,14 @@ FunctionKeys(PLAYERp pp) { short pnum; - sprintf(ds,"SENT: %s",WangBangMacro[fn_key-1]); + sprintf(ds,"SENT: %s",**CombatMacros[fn_key-1]); adduserquote(ds); TRAVERSE_CONNECT(pnum) { if (pnum != myconnectindex) { - sprintf(ds,"%s: %s",pp->PlayerName, WangBangMacro[fn_key-1]); + sprintf(ds,"%s: %s",pp->PlayerName, **CombatMacros[fn_key - 1]); SW_SendMessage(pnum, ds); } } diff --git a/source/sw/src/swconfig.cpp b/source/sw/src/swconfig.cpp index 56c93ef6a..b9124bb3f 100644 --- a/source/sw/src/swconfig.cpp +++ b/source/sw/src/swconfig.cpp @@ -112,13 +112,6 @@ void ReadGameSetup(int32_t scripthandle) { int dummy; int ret; - extern char WangBangMacro[10][64]; - - for (dummy = 0; dummy < 10; dummy++) - { - sprintf(ds,"CommbatMacro#%d",dummy); - SCRIPT_GetString(scripthandle, "Comm Setup",ds,WangBangMacro[dummy]); - } SCRIPT_GetString(scripthandle, "Options","Rooster",gs.Password); DecodePassword(gs.Password); @@ -164,22 +157,6 @@ void ReadGameSetup(int32_t scripthandle) SCRIPT_GetNumber(scripthandle, "Options", "Messages",&dummy); if (dummy != -1) gs.Messages = dummy; - dummy = -1; - SCRIPT_GetNumber(scripthandle, "Options", "Talking",&dummy); - if (dummy != -1) snd_speech = dummy; - - dummy = -1; - SCRIPT_GetNumber(scripthandle, "Options", "Ambient",&dummy); - if (dummy != -1) snd_ambience = dummy; - - dummy = -1; - SCRIPT_GetNumber(scripthandle, "Options", "FxOn",&dummy); - if (dummy != -1) snd_enabled = dummy; - - dummy = -1; - SCRIPT_GetNumber(scripthandle, "Options", "MusicOn",&dummy); - if (dummy != -1) mus_enabled = dummy; - dummy = -1; SCRIPT_GetNumber(scripthandle, "Controls", "MouseAiming",&dummy); if (dummy != -1) gs.MouseAimingType = dummy; @@ -292,22 +269,11 @@ void WriteGameSetup(int32_t scripthandle) SCRIPT_PutNumber(scripthandle, "Options", "AutoRun",dummy,FALSE,FALSE); dummy = gs.Crosshair; SCRIPT_PutNumber(scripthandle, "Options", "Crosshair",dummy,FALSE,FALSE); - dummy = cl_autoaim; - SCRIPT_PutNumber(scripthandle, "Options", "AutoAim",dummy,FALSE,FALSE); dummy = gs.Messages; SCRIPT_PutNumber(scripthandle, "Options", "Messages",dummy,FALSE,FALSE); - dummy = snd_speech; - SCRIPT_PutNumber(scripthandle, "Options", "Talking",dummy,FALSE,FALSE); - dummy = snd_ambience; - SCRIPT_PutNumber(scripthandle, "Options", "Ambient",dummy,FALSE,FALSE); - dummy = snd_enabled; - SCRIPT_PutNumber(scripthandle, "Options", "FxOn",dummy,FALSE,FALSE); dummy = gs.MouseAimingType; SCRIPT_PutNumber(scripthandle, "Controls", "MouseAiming",dummy,FALSE,FALSE); - dummy = mus_enabled; - SCRIPT_PutNumber(scripthandle, "Options", "MusicOn",dummy,FALSE,FALSE); - dummy = gs.NetGameType; SCRIPT_PutNumber(scripthandle, "Options", "NetGameType",dummy,FALSE,FALSE); dummy = gs.NetLevel;