rendered paste bodyIndex: src/game/g_client.c===================================================================--- src/game/g_client.c (Revision 8155)+++ src/game/g_client.c (Arbeitskopie)@@ -1107,7 +1107,7 @@ if (team) vis_mask = 1 << team; else- vis_mask = 0xFFFFFFFF;+ vis_mask = ~0x0; for (i = 0, ent = g_edicts; i < globals.num_edicts; i++, ent++) { if (!ent->inuse)Index: src/game/g_local.h===================================================================--- src/game/g_local.h (Revision 8155)+++ src/game/g_local.h (Arbeitskopie)@@ -45,7 +45,7 @@ #define MAX_SPOT_DIST 4096 /* 768 */ #define P_MASK(p) (p->num < game.maxplayers ? 1<<(p->num) : 0)-#define PM_ALL 0xFFFFFFFF+#define PM_ALL ~0x0 /* server is running at 10 fps */ #define FRAMETIME 0.1Index: src/game/g_svcmds.c===================================================================--- src/game/g_svcmds.c (Revision 8155)+++ src/game/g_svcmds.c (Arbeitskopie)@@ -160,7 +160,7 @@ } for (i = 0; i < numipfilters; i++)- if (ipfilters[i].compare == 0xffffffff)+ if (ipfilters[i].compare == ~0x0) break; /* free spot */ if (i == numipfilters) { if (numipfilters == MAX_IPFILTERS) {@@ -171,7 +171,7 @@ } if (!StringToFilter(gi.argv(2), &ipfilters[i]))- ipfilters[i].compare = 0xffffffff;+ ipfilters[i].compare = ~0x0; } /**Index: src/client/cl_menu.c===================================================================--- src/client/cl_menu.c (Revision 8155)+++ src/client/cl_menu.c (Arbeitskopie)@@ -230,9 +230,6 @@ static int numMenuModels; static int numTutorials;-static byte *adata, *curadata;-static int adataize = 0;- static menu_t *menuStack[MAX_MENUSTACK]; static int menuStackPos = -1;@@ -697,7 +694,6 @@ extern void MN_ExecuteActions (const menu_t* const menu, menuAction_t* const first) { menuAction_t *action;- byte *data; for (action = first; action; action = action->next) switch (action->type) {@@ -717,13 +713,7 @@ /* set a property */ if (action->data) { menuNode_t *node;- int np;- data = action->data;- data += strlen(action->data) + 1;- np = *((int *) data);- data += sizeof(int);- /* search the node */ node = MN_GetNode(menu, (char *) action->data);@@ -735,10 +725,10 @@ } /* 0, -1, -2, -3, -4, -5 fills the data array in menuNode_t */- if ((nps[np].ofs > 0) && (nps[np].ofs < (size_t)-5))- Com_SetValue(node, (char *) data, nps[np].type, nps[np].ofs, nps[np].size);+ if ((nps[action->id].ofs > 0) && (nps[action->id].ofs < (size_t)-5))+ Com_SetValue(node, (char *)action->value, nps[action->id].type, nps[action->id].ofs, nps[action->id].size); else- node->data[-((int)nps[np].ofs)] = data;+ node->data[-((int)nps[action->id].ofs)] = action->value; } break; default:@@ -753,31 +743,40 @@ */ static void MN_Command_f (void) {- menuNode_t *node;+ menuNode_t *node = NULL; char *name; int i; name = Cmd_Argv(0); /* first search all menus on the stack */- for (i = 0; i < menuStackPos; i++)- for (node = menuStack[i]->firstNode; node; node = node->next)+ for (i = 0; i < menuStackPos; i++) {+ Com_Printf("menu '%s'\n", menuStack[i]->name);+ for (node = menuStack[i]->firstNode; node; node = node->next) {+ Com_Printf("... node '%s'\n", node->name); if (node->type == MN_CONFUNC && !Q_strncmp(node->name, name, sizeof(node->name))) { /* found the node */ Com_DPrintf("MN_Command_f: menu '%s'\n", menuStack[i]->name); MN_ExecuteActions(menuStack[i], node->click); return; }+ }+ }+ Com_Printf("not found %i\n", numMenus); /* not found - now query all in the menu definitions */- for (i = 0; i < numMenus; i++)- for (node = menus[i].firstNode; node; node = node->next)+ for (i = 0; i < numMenus; i++) {+ Com_Printf("menu '%s' (%i)\n", menus[i].name, i);+ for (node = menus[i].firstNode; node; node = node->next) {+ Com_Printf("... node '%s'\n", node->name); if (node->type == MN_CONFUNC && !Q_strncmp(node->name, name, sizeof(node->name))) { /* found the node */ Com_DPrintf("MN_Command_f: menu '%s'\n", menus[i].name); MN_ExecuteActions(&menus[i], node->click); return; }+ }+ } Com_Printf("MN_Command_f: confunc '%s' was not found in any menu\n", name); }@@ -816,7 +815,7 @@ node->size[0] = C_UNIT * (i + 1) + 0.01; for (i = 15; i >= 0; i--)- if (id->shape[i] & 0xFFFFFFFF)+ if (id->shape[i] & (~0x0)) break; node->size[1] = C_UNIT * (i + 1) + 0.01; }@@ -2444,11 +2443,10 @@ node->data[4] = NULL; } if (!node->data[4]) {- /* model has changed but mem is already reserved in curadata */+ /* model has changed but mem is already reserved in client hunk */ if (!oldAnimState) { /* new anim state */- as = (animState_t *) curadata;- curadata += sizeof(animState_t);+ as = (animState_t *) CL_ClientHunkUse(NULL, sizeof(animState_t)); } else { as = oldAnimState; oldAnimState = NULL;@@ -3052,6 +3050,7 @@ /** * @brief Callback function that reloads the menus from file+ * @note Don't use this! will flood the client hunk */ static void MN_ReloadMenus_f (void) {@@ -3061,8 +3060,6 @@ if (menuStackPos <= 0) return;- assert(adataize);- /* pre-stage parsing */ FS_BuildFileList( "ufos/*.ufo" ); FS_NextScriptHeader(NULL, NULL, NULL);@@ -3074,11 +3071,6 @@ numMenus = 0; numMenuModels = 0;- /* get action data memory */- memset(adata, 0, adataize);-- curadata = adata;- while ((type = FS_NextScriptHeader( "ufos/*.ufo", &name, &text)) != 0 ) if (!Q_strncmp(type, "menu", 4)) MN_ParseMenu(name, &text);@@ -3221,16 +3213,6 @@ Cmd_AddCommand("mn_editnode", MN_EditMenuNode_f, "This function is for inline editing of nodes - dangerous!!"); Cmd_AddCommand("hidehud", MN_PushNoHud_f, _("Hide the HUD (press ESC to reactivate HUD)")); Cmd_AddCommand("mn_debugreload", MN_ReloadMenus_f, "Reloads the menus to show updates without the need to restart");- /* get action data memory */- if (adataize)- /* @todo: should not be needed - this function is only called once - check this */- memset(adata, 0, adataize);- else {- /* 256kb */- adata = malloc(0x40000);- adataize = 0x40000;- }- curadata = adata; /* reset menu texts */ for (i = 0; i < MAX_MENUTEXTS; i++)@@ -3260,10 +3242,6 @@ */ void MN_Shutdown (void) {- if (adataize)- free(adata);- adata = NULL;- adataize = 0; MN_ShutdownChatMessageSystem(); MN_ShutdownMessageSystem(); }@@ -3280,14 +3258,12 @@ qboolean MN_ParseAction (menuNode_t * menuNode, menuAction_t * action, char **text, char **token) { const char *errhead = "MN_ParseAction: unexpected end of file (in event)";- menuAction_t *lastAction;+ menuAction_t *lastAction = NULL; menuNode_t *node; qboolean found; const value_t *val; int i;- lastAction = NULL;- do { /* get new token */ *token = COM_EParse(text, errhead, NULL);@@ -3301,7 +3277,7 @@ /* standard function execution */ for (i = 0; i < EA_CALL; i++) if (!Q_stricmp(*token, ea_strings[i])) {-/* Com_Printf( " %s", *token ); */+/* Com_Printf(" %s", *token); */ /* add the action */ if (lastAction) {@@ -3317,14 +3293,15 @@ if (!*text) return qfalse;-/* Com_Printf( " %s", *token ); */+/* Com_Printf(" %s", *token); */- /* get the value */- action->data = curadata;- curadata += Com_ParseValue(curadata, *token, ea_values[i], 0, 0);+ /* get the hunk pointer */+ action->data = CL_ClientHunkUse(NULL, 0);+ /* set the hunk position and parse the value */+ CL_ClientHunkUse(NULL, Com_ParseValue(action->data, *token, ea_values[i], 0, 0)); }-/* Com_Printf( "\n" ); */+/* Com_Printf("\n"); */ /* get next token */ *token = COM_EParse(text, errhead, NULL);@@ -3338,7 +3315,7 @@ /* node property setting */ if (**token == '*') {-/* Com_Printf( " %s", *token ); */+/* Com_Printf(" %s", *token); */ /* add the action */ if (lastAction) {@@ -3349,27 +3326,23 @@ action->type = EA_NODE; /* get the node name */- action->data = curadata;+ action->data = CL_ClientHunkUse(&(*token)[1], strlen(*token) + 1);- strcpy((char *) curadata, &(*token)[1]);- curadata += ALIGN(strlen((char *) curadata) + 1);- /* get the node property */ *token = COM_EParse(text, errhead, NULL); if (!*text) return qfalse;-/* Com_Printf( " %s", *token ); */+/* Com_Printf(" %s", *token); */ for (val = nps, i = 0; val->type; val++, i++) if (!Q_stricmp(*token, val->string)) {- *(int *) curadata = i;+ action->id = i; break; } if (!val->type) { Com_Printf("MN_ParseAction: token \"%s\" isn't a node property (in event)\n", *token);- curadata = action->data; if (lastAction) { lastAction->next = NULL; numActions--;@@ -3382,10 +3355,13 @@ if (!*text) return qfalse;-/* Com_Printf( " %s\n", *token ); */+/* Com_Printf(" %s\n", *token); */- curadata += sizeof(int);- curadata += Com_ParseValue(curadata, *token, val->type, 0, val->size);+ /* get the hunk pointer */+ action->value = CL_ClientHunkUse(NULL, 0);+ /* increase the hunk size */+ CL_ClientHunkUse(NULL, Com_ParseValue(action->value, *token, val->type, 0, val->size));+/* Com_Printf(" token: '%s', type: %i, %s\n", *token, val->type, (char*)action->value); */ /* get next token */ *token = COM_EParse(text, errhead, NULL);@@ -3400,7 +3376,7 @@ for (node = menus[numMenus - 1].firstNode; node; node = node->next) if ((node->type == MN_FUNC || node->type == MN_CONFUNC || node->type == MN_CVARFUNC) && !Q_strncmp(node->name, *token, sizeof(node->name))) {-/* Com_Printf( " %s\n", node->name ); */+/* Com_Printf(" %s\n", node->name); */ /* add the action */ if (lastAction) {@@ -3410,9 +3386,7 @@ } action->type = EA_CALL;- action->data = curadata;- *(menuAction_t ***) curadata = &node->click;- curadata += sizeof(menuAction_t *);+ action->data = CL_ClientHunkUse(&node->click, sizeof(menuAction_t *)); /* get next token */ *token = COM_EParse(text, errhead, NULL);@@ -3492,7 +3466,7 @@ for (val = nps; val->type; val++) if (!Q_strcmp(*token, val->string)) {-/* Com_Printf( " %s", *token ); */+/* Com_Printf(" %s", *token); */ if (val->type != V_NULL) { /* get parameter values */@@ -3500,7 +3474,7 @@ if (!*text) return qfalse;-/* Com_Printf( " %s", *token ); */+/* Com_Printf(" %s", *token); */ /* get the value */ /* 0, -1, -2, -3, -4, -5 fills the data array in menuNode_t */@@ -3509,16 +3483,17 @@ Com_Printf("MN_ParseNodeBody: Wrong size for value %s\n", val->string); } else { /* a reference to data is handled like this */-/* Com_Printf( "%i %s\n", val->ofs, *token ); */- node->data[-((int)val->ofs)] = curadata;+/* Com_Printf("%i %s\n", val->ofs, *token); */+ /* get hunk pointer */+ node->data[-((int)val->ofs)] = CL_ClientHunkUse(NULL, 0); if (**token == '*')- curadata += Com_ParseValue(curadata, *token, V_STRING, 0, 0);+ CL_ClientHunkUse(NULL, Com_ParseValue(node->data[-((int)val->ofs)], *token, V_STRING, 0, 0)); else- curadata += Com_ParseValue(curadata, *token, val->type, 0, val->size);+ CL_ClientHunkUse(NULL, Com_ParseValue(node->data[-((int)val->ofs)], *token, val->type, 0, val->size)); } }-/* Com_Printf( "\n" ); */+/* Com_Printf("\n"); */ /* get next token */ *token = COM_EParse(text, errhead, node->name);@@ -3670,7 +3645,7 @@ Sys_Error("MAX_MENUNODES exceeded\n"); node = &menuNodes[numNodes++]; memset(node, 0, sizeof(menuNode_t));- Q_strncpyz(node->name, token, MAX_VAR);+ Q_strncpyz(node->name, token, sizeof(node->name)); /* link it in */ if (lastNode)@@ -4210,6 +4185,7 @@ /** * @brief Displays a chat on the hud and add it to the chat buffer * @sa MN_ShutdownChatMessageSystem+ * @sa Irc_AppendToBuffer */ void MN_AddChatMessage (const char *text) {Index: src/client/client.h===================================================================--- src/client/client.h (Revision 8155)+++ src/client/client.h (Arbeitskopie)@@ -880,6 +880,8 @@ typedef struct menuAction_s { int type; void *data;+ void *value;+ int id; struct menuAction_s *next; } menuAction_t;