mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-17 22:50:51 +00:00
remove all references to OFS_* from the C code. only the macros in progs.h
use them now
This commit is contained in:
parent
a21054fdfc
commit
e732cf591d
25 changed files with 185 additions and 176 deletions
|
@ -310,6 +310,7 @@ typedef union pr_type_u {
|
|||
int entity_var;
|
||||
float vector_var[1]; // really 3, but this structure must be 32 bits
|
||||
int integer_var;
|
||||
pointer_t pointer_var;
|
||||
unsigned int uinteger_var;
|
||||
} pr_type_t;
|
||||
|
||||
|
|
|
@ -123,36 +123,46 @@ qboolean PR_EdictValid (progs_t *pr, int e);
|
|||
#define G_FLOAT(p,o) G_var (p, o, float)
|
||||
#define G_INT(p,o) G_var (p, o, integer)
|
||||
#define G_UINT(p,o) G_var (p, o, uinteger)
|
||||
#define G_VECTOR(p,o) G_var (p, o, vector)
|
||||
#define G_STRING(p,o) G_var (p, o, string)
|
||||
#define G_FUNCTION(p,o) G_var (p, o, func)
|
||||
#define G_POINTER(p,o) G_var (p, o, pointer)
|
||||
|
||||
#define G_EDICT(p,o) ((edict_t *)(PR_edicts (p) + G_INT (p, o)))
|
||||
#define G_EDICTNUM(p,o) NUM_FOR_EDICT(p, G_EDICT (p, o))
|
||||
#define G_VECTOR(p,o) G_var (p, o, vector)
|
||||
#define G_STRING(p,o) PR_GetString (p, G_var (p, o, string))
|
||||
#define G_FUNCTION(p,o) G_var (p, o, func)
|
||||
#define G_POINTER(p,o) PR_Pointer (p, o)
|
||||
#define G_STRUCT(p,t,o) (*(t *)G_POINTER (p, o))
|
||||
#define G_GSTRING(p,o) PR_GetString (p, G_STRING (p, o))
|
||||
#define G_GPOINTER(p,o) PR_GetPointer (p, o)
|
||||
#define G_STRUCT(p,t,o) (*(t *)G_GPOINTER (p, o))
|
||||
|
||||
#define P_var(p,n,t) G_var (p, (OFS_PARM0 + (n) * 3), t)
|
||||
|
||||
#define P_var(p,n,t) G_var (p, OFS_PARM##n, t)
|
||||
#define P_FLOAT(p,n) P_var (p, n, float)
|
||||
#define P_INT(p,n) P_var (p, n, integer)
|
||||
#define P_UINT(p,n) P_var (p, n, uinteger)
|
||||
#define P_VECTOR(p,n) P_var (p, n, vector)
|
||||
#define P_STRING(p,n) P_var (p, n, string)
|
||||
#define P_FUNCTION(p,n) P_var (p, n, func)
|
||||
#define P_POINTER(p,n) P_var (p, n, pointer)
|
||||
|
||||
#define P_EDICT(p,n) ((edict_t *)(PR_edicts (p) + P_INT (p, n)))
|
||||
#define P_EDICTNUM(p,n) NUM_FOR_EDICT (p, P_EDICT (p, n))
|
||||
#define P_VECTOR(p,n) P_var (p, n, vector)
|
||||
#define P_STRING(p,n) PR_GetString (p, P_var (p, n, string))
|
||||
#define P_FUNCTION(p,n) P_var (p, n, func)
|
||||
#define P_POINTER(p,n) G_POINTER (p, P_INT (p, n))
|
||||
#define P_STRUCT(p,t,n) (*(t *)P_POINTER (p, n))
|
||||
#define P_GSTRING(p,n) PR_GetString (p, P_STRING (p, n))
|
||||
#define P_GPOINTER(p,n) PR_GetPointer (p, P_POINTER (p, n))
|
||||
#define P_STRUCT(p,t,n) (*(t *)P_GPOINTER (p, n))
|
||||
|
||||
#define R_var(p,t) G_var (p, OFS_RETURN, t)
|
||||
|
||||
#define R_FLOAT(p) R_var (p, float)
|
||||
#define R_INT(p) R_var (p, integer)
|
||||
#define R_UINT(p) R_var (p, uinteger)
|
||||
#define R_VECTOR(p) R_var (p, vector)
|
||||
#define R_STRING(p) R_var (p, string)
|
||||
#define R_FUNCTION(p) R_var (p, func)
|
||||
#define R_POINTER(p) R_var (p, pointer)
|
||||
|
||||
#define RETURN_STRING(p, s) (R_INT (p) = PR_SetString((p), s))
|
||||
#define RETURN_EDICT(p, e) (R_INT (p) = EDICT_TO_PROG(p, e))
|
||||
#define RETURN_POINTER(pr,p) (R_INT (pr) = POINTER_TO_PROG (pr, p))
|
||||
#define RETURN_STRING(p, s) (R_STRING (p) = PR_SetString((p), s))
|
||||
#define RETURN_EDICT(p, e) (R_STRING (p) = EDICT_TO_PROG(p, e))
|
||||
#define RETURN_POINTER(pr,p) (R_POINTER (pr) = POINTER_TO_PROG (pr, p))
|
||||
#define RETURN_VECTOR(p, v) (VectorCopy (v, R_VECTOR (p)))
|
||||
|
||||
#define E_var(e,o,t) ((e)->v[o].t##_var)
|
||||
|
@ -161,7 +171,11 @@ qboolean PR_EdictValid (progs_t *pr, int e);
|
|||
#define E_INT(e,o) E_var (e, o, integer)
|
||||
#define E_UINT(e,o) E_var (e, o, uinteger)
|
||||
#define E_VECTOR(e,o) E_var (e, o, vector)
|
||||
#define E_STRING(p,e,o) (PR_GetString (p, E_var (e, o, string)))
|
||||
#define E_STRING(e,o) E_var (e, o, string)
|
||||
#define E_FUNCTION(p) E_var (p, o, func)
|
||||
#define E_POINTER(p) E_var (p, o, pointer)
|
||||
|
||||
#define E_GSTRING(p,e,o) (PR_GetString (p, E_STRING (e, o)))
|
||||
|
||||
typedef void (*builtin_proc) (progs_t *pr);
|
||||
typedef struct {
|
||||
|
@ -376,7 +390,7 @@ struct progs_s {
|
|||
};
|
||||
|
||||
static inline pr_type_t *
|
||||
PR_Pointer (progs_t *pr, int o)
|
||||
PR_GetPointer (progs_t *pr, int o)
|
||||
{
|
||||
return o ? pr->pr_globals + o : 0;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ bi_Menu_Begin (progs_t *pr)
|
|||
{
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *text = P_STRING (pr, 2);
|
||||
const char *text = P_GSTRING (pr, 2);
|
||||
menu_item_t *m = calloc (sizeof (menu_item_t), 1);
|
||||
|
||||
m->x = x;
|
||||
|
@ -216,7 +216,7 @@ bi_Menu_Pic (progs_t *pr)
|
|||
{
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *name = P_STRING (pr, 2);
|
||||
const char *name = P_GSTRING (pr, 2);
|
||||
|
||||
menu_pic (x, y, name, 0, 0, -1, -1);
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ bi_Menu_SubPic (progs_t *pr)
|
|||
{
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *name = P_STRING (pr, 2);
|
||||
const char *name = P_GSTRING (pr, 2);
|
||||
int srcx = P_INT (pr, 3);
|
||||
int srcy = P_INT (pr, 4);
|
||||
int width = P_INT (pr, 5);
|
||||
|
@ -240,7 +240,7 @@ bi_Menu_CenterPic (progs_t *pr)
|
|||
{
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *name = P_STRING (pr, 2);
|
||||
const char *name = P_GSTRING (pr, 2);
|
||||
qpic_t *qpic = Draw_CachePic (name, 1);
|
||||
|
||||
if (!qpic)
|
||||
|
@ -254,7 +254,7 @@ bi_Menu_CenterSubPic (progs_t *pr)
|
|||
{
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *name = P_STRING (pr, 2);
|
||||
const char *name = P_GSTRING (pr, 2);
|
||||
qpic_t *qpic = Draw_CachePic (name, 1);
|
||||
int srcx = P_INT (pr, 3);
|
||||
int srcy = P_INT (pr, 4);
|
||||
|
@ -272,7 +272,7 @@ bi_Menu_Item (progs_t *pr)
|
|||
{
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *text = P_STRING (pr, 2);
|
||||
const char *text = P_GSTRING (pr, 2);
|
||||
func_t func = P_FUNCTION (pr, 3);
|
||||
int allkeys = P_INT (pr, 4);
|
||||
menu_item_t *mi = calloc (sizeof (menu_item_t), 1);
|
||||
|
@ -311,7 +311,7 @@ bi_Menu_End (progs_t *pr)
|
|||
static void
|
||||
bi_Menu_TopMenu (progs_t *pr)
|
||||
{
|
||||
const char *name = P_STRING (pr, 0);
|
||||
const char *name = P_GSTRING (pr, 0);
|
||||
|
||||
if (top_menu)
|
||||
free ((char*)top_menu);
|
||||
|
@ -321,7 +321,7 @@ bi_Menu_TopMenu (progs_t *pr)
|
|||
static void
|
||||
bi_Menu_SelectMenu (progs_t *pr)
|
||||
{
|
||||
const char *name = P_STRING (pr, 0);
|
||||
const char *name = P_GSTRING (pr, 0);
|
||||
|
||||
menu = 0;
|
||||
if (name && *name)
|
||||
|
@ -385,7 +385,7 @@ quit_f (void)
|
|||
{
|
||||
if (confirm_quit->int_val && menu_quit) {
|
||||
PR_ExecuteProgram (&menu_pr_state, menu_quit);
|
||||
if (!G_INT (&menu_pr_state, OFS_RETURN))
|
||||
if (!R_INT (&menu_pr_state))
|
||||
return;
|
||||
}
|
||||
bi_Menu_Quit (&menu_pr_state);
|
||||
|
@ -520,7 +520,7 @@ Menu_Draw (void)
|
|||
|
||||
if (menu->draw) {
|
||||
PR_ExecuteProgram (&menu_pr_state, menu->draw);
|
||||
if (G_INT (&menu_pr_state, OFS_RETURN))
|
||||
if (R_INT (&menu_pr_state))
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -545,8 +545,8 @@ Menu_Draw (void)
|
|||
return;
|
||||
item = menu->items[menu->cur_item];
|
||||
if (menu->cursor) {
|
||||
G_INT (&menu_pr_state, OFS_PARM0) = item->x;
|
||||
G_INT (&menu_pr_state, OFS_PARM1) = item->y;
|
||||
P_INT (&menu_pr_state, 0) = item->x;
|
||||
P_INT (&menu_pr_state, 1) = item->y;
|
||||
PR_ExecuteProgram (&menu_pr_state, menu->cursor);
|
||||
} else {
|
||||
Draw_Character (item->x, item->y,
|
||||
|
@ -562,23 +562,23 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down)
|
|||
if (!menu)
|
||||
return;
|
||||
if (menu->keyevent) {
|
||||
G_INT (&menu_pr_state, OFS_PARM0) = key;
|
||||
G_INT (&menu_pr_state, OFS_PARM1) = unicode;
|
||||
G_INT (&menu_pr_state, OFS_PARM2) = down;
|
||||
P_INT (&menu_pr_state, 0) = key;
|
||||
P_INT (&menu_pr_state, 1) = unicode;
|
||||
P_INT (&menu_pr_state, 2) = down;
|
||||
PR_ExecuteProgram (&menu_pr_state, menu->keyevent);
|
||||
if (G_INT (&menu_pr_state, OFS_RETURN))
|
||||
if (R_INT (&menu_pr_state))
|
||||
return;
|
||||
} else if (menu->items && menu->items[menu->cur_item]->func
|
||||
&& menu->items[menu->cur_item]->allkeys) {
|
||||
item = menu->items[menu->cur_item];
|
||||
if (item->text)
|
||||
G_INT (&menu_pr_state, OFS_PARM0) =
|
||||
P_INT (&menu_pr_state, 0) =
|
||||
PR_SetString (&menu_pr_state, item->text);
|
||||
else
|
||||
G_INT (&menu_pr_state, OFS_PARM0) = 0;
|
||||
G_INT (&menu_pr_state, OFS_PARM1) = key;
|
||||
P_INT (&menu_pr_state, 0) = 0;
|
||||
P_INT (&menu_pr_state, 1) = key;
|
||||
PR_ExecuteProgram (&menu_pr_state, item->func);
|
||||
if (G_INT (&menu_pr_state, OFS_RETURN))
|
||||
if (R_INT (&menu_pr_state))
|
||||
return;
|
||||
}
|
||||
if (!menu || !menu->items)
|
||||
|
@ -600,11 +600,11 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down)
|
|||
item = menu->items[menu->cur_item];
|
||||
if (item->func) {
|
||||
if (item->text)
|
||||
G_INT (&menu_pr_state, OFS_PARM0) =
|
||||
P_INT (&menu_pr_state, 0) =
|
||||
PR_SetString (&menu_pr_state, item->text);
|
||||
else
|
||||
G_INT (&menu_pr_state, OFS_PARM0) = 0;
|
||||
G_INT (&menu_pr_state, OFS_PARM1) = key;
|
||||
P_INT (&menu_pr_state, 0) = 0;
|
||||
P_INT (&menu_pr_state, 1) = key;
|
||||
PR_ExecuteProgram (&menu_pr_state, item->func);
|
||||
} else {
|
||||
menu = item;
|
||||
|
|
|
@ -70,7 +70,7 @@ get_cbuf (progs_t *pr, int arg, const char *func)
|
|||
static void
|
||||
bi_Cbuf_AddText (progs_t *pr)
|
||||
{
|
||||
const char *text = P_STRING (pr, 0);
|
||||
const char *text = P_GSTRING (pr, 0);
|
||||
cbuf_t *cbuf = get_cbuf (pr, 0, __FUNCTION__);
|
||||
Cbuf_AddText (cbuf, text);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ bi_Cbuf_AddText (progs_t *pr)
|
|||
static void
|
||||
bi_Cbuf_InsertText (progs_t *pr)
|
||||
{
|
||||
const char *text = P_STRING (pr, 0);
|
||||
const char *text = P_GSTRING (pr, 0);
|
||||
cbuf_t *cbuf = get_cbuf (pr, 0, __FUNCTION__);
|
||||
Cbuf_InsertText (cbuf, text);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ bi_Cmd_AddCommand (progs_t *pr)
|
|||
{
|
||||
cmd_resources_t *res = PR_Resources_Find (pr, "Cmd");
|
||||
bi_cmd_t *cmd = malloc (sizeof (bi_cmd_t));
|
||||
char *name = strdup (P_STRING (pr, 0));
|
||||
char *name = strdup (P_GSTRING (pr, 0));
|
||||
func_t func = P_FUNCTION (pr, 1);
|
||||
|
||||
if (!cmd || !name || !Cmd_AddCommand (name, (void(*)(void))bi_cmd_f, "CSQC command")) {
|
||||
|
|
|
@ -51,7 +51,7 @@ static __attribute__ ((unused)) const char rcsid[] =
|
|||
static void
|
||||
bi_Cvar_GetCvarString (progs_t *pr)
|
||||
{
|
||||
const char *varname = P_STRING (pr, 0);
|
||||
const char *varname = P_GSTRING (pr, 0);
|
||||
|
||||
RETURN_STRING (pr, Cvar_VariableString (varname));
|
||||
}
|
||||
|
|
|
@ -119,8 +119,8 @@ bi_File_Open (progs_t *pr)
|
|||
{
|
||||
qfile_resources_t *res = PR_Resources_Find (pr, "QFile");
|
||||
QFile **file = QFile_AllocHandle (pr, res);
|
||||
const char *pth = P_STRING (pr, 0);
|
||||
const char *mode = P_STRING (pr, 1);
|
||||
const char *pth = P_GSTRING (pr, 0);
|
||||
const char *mode = P_GSTRING (pr, 1);
|
||||
char *path;
|
||||
char *p;
|
||||
int do_write = 0;
|
||||
|
@ -148,7 +148,7 @@ bi_File_Open (progs_t *pr)
|
|||
}
|
||||
|
||||
path = QFS_CompressPath (pth);
|
||||
//printf ("'%s' '%s'\n", P_STRING (pr, 0), path);
|
||||
//printf ("'%s' '%s'\n", P_GSTRING (pr, 0), path);
|
||||
if (!path[0])
|
||||
goto error;
|
||||
if (path[0] == '.' && path[1] == '.' && (path[2] == '/' || path [2] == 0))
|
||||
|
|
|
@ -114,7 +114,7 @@ bi_GIB_Builtin_Add (progs_t *pr)
|
|||
{
|
||||
bi_gib_resources_t *res = PR_Resources_Find (pr, "GIB");
|
||||
bi_gib_builtin_t *builtin;
|
||||
char *name = P_STRING (pr, 0);
|
||||
char *name = P_GSTRING (pr, 0);
|
||||
func_t func = P_FUNCTION (pr, 1);
|
||||
|
||||
if (GIB_Builtin_Exists (name)) {
|
||||
|
@ -138,7 +138,7 @@ bi_GIB_Builtin_Add (progs_t *pr)
|
|||
static void
|
||||
bi_GIB_Return (progs_t *pr)
|
||||
{
|
||||
char *str = P_STRING(pr, 0);
|
||||
char *str = P_GSTRING(pr, 0);
|
||||
|
||||
if (str)
|
||||
GIB_Return (str);
|
||||
|
|
|
@ -69,7 +69,7 @@ bi_get_key (void *key, void *_ht)
|
|||
P_INT (ht->pr, 0) = (long) (key);
|
||||
P_INT (ht->pr, 1) = ht->ud;
|
||||
PR_ExecuteProgram (ht->pr, ht->gk);
|
||||
return G_STRING (ht->pr, OFS_RETURN);
|
||||
return PR_GetString (ht->pr, R_STRING (ht->pr));
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
|
@ -181,7 +181,7 @@ bi_Hash_Find (progs_t *pr)
|
|||
{
|
||||
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
|
||||
|
||||
R_INT (pr) = (long) Hash_Find (ht->tab, P_STRING (pr, 1));
|
||||
R_INT (pr) = (long) Hash_Find (ht->tab, P_GSTRING (pr, 1));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -201,7 +201,7 @@ bi_Hash_FindList (progs_t *pr)
|
|||
pr_type_t *pr_list;
|
||||
int count;
|
||||
|
||||
list = Hash_FindList (ht->tab, P_STRING (pr, 1));
|
||||
list = Hash_FindList (ht->tab, P_GSTRING (pr, 1));
|
||||
for (count = 1, l = list; *l; l++)
|
||||
count++;
|
||||
pr_list = PR_Zone_Malloc (pr, count * sizeof (pr_type_t));
|
||||
|
@ -234,7 +234,7 @@ bi_Hash_Del (progs_t *pr)
|
|||
{
|
||||
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
|
||||
|
||||
R_INT (pr) = (long) Hash_Del (ht->tab, P_STRING (pr, 1));
|
||||
R_INT (pr) = (long) Hash_Del (ht->tab, P_GSTRING (pr, 1));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -257,13 +257,13 @@ bi_Hash_Free (progs_t *pr)
|
|||
static void
|
||||
bi_Hash_String (progs_t *pr)
|
||||
{
|
||||
R_INT (pr) = Hash_String (P_STRING (pr, 0));
|
||||
R_INT (pr) = Hash_String (P_GSTRING (pr, 0));
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Hash_Buffer (progs_t *pr)
|
||||
{
|
||||
R_INT (pr) = Hash_Buffer (P_POINTER (pr, 0), P_INT (pr, 1));
|
||||
R_INT (pr) = Hash_Buffer (P_GPOINTER (pr, 0), P_INT (pr, 1));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -112,7 +112,7 @@ bi_InputLine_SetUserData (progs_t *pr)
|
|||
{
|
||||
inputline_t *line = get_inputline (pr, P_INT (pr, 0),
|
||||
"InputLine_SetWidth");
|
||||
pr_type_t *data = P_POINTER (pr, 1);
|
||||
pr_type_t *data = P_GPOINTER (pr, 1);
|
||||
|
||||
line->user_data = data;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ static void
|
|||
bi_InputLine_SetText (progs_t *pr)
|
||||
{
|
||||
inputline_t *il = get_inputline (pr, P_INT (pr, 0), "InputLine_SetText");
|
||||
const char *str = P_STRING (pr, 1);
|
||||
const char *str = P_GSTRING (pr, 1);
|
||||
|
||||
/* this was segfault trap:
|
||||
il->lines[il->edit_line][0] is promt character
|
||||
|
|
|
@ -54,15 +54,14 @@ typedef struct {
|
|||
static inline void
|
||||
return_plitem (progs_t *pr, plitem_t *plitem)
|
||||
{
|
||||
memcpy (pr->pr_globals + OFS_RETURN, &plitem, sizeof (plitem));
|
||||
memcpy (&R_INT (pr), &plitem, sizeof (plitem));
|
||||
}
|
||||
|
||||
static inline plitem_t *
|
||||
p_plitem (progs_t *pr, int n)
|
||||
{
|
||||
plitem_t *plitem;
|
||||
memcpy (&plitem, pr->pr_globals + OFS_PARM0 + n * sizeof (pr_type_t),
|
||||
sizeof (plitem));
|
||||
memcpy (&plitem, &P_INT (pr, n), sizeof (plitem));
|
||||
return plitem;
|
||||
}
|
||||
|
||||
|
@ -87,7 +86,7 @@ remove_plitem (progs_t *pr, plitem_t *plitem)
|
|||
static void
|
||||
bi_PL_GetPropertyList (progs_t *pr)
|
||||
{
|
||||
plitem_t *plitem = PL_GetPropertyList (P_STRING (pr, 0));
|
||||
plitem_t *plitem = PL_GetPropertyList (P_GSTRING (pr, 0));
|
||||
|
||||
return_plitem (pr, record_plitem (pr, plitem));
|
||||
}
|
||||
|
@ -95,7 +94,7 @@ bi_PL_GetPropertyList (progs_t *pr)
|
|||
static void
|
||||
bi_PL_ObjectForKey (progs_t *pr)
|
||||
{
|
||||
return_plitem (pr, PL_ObjectForKey (p_plitem (pr, 0), P_STRING (pr, 1)));
|
||||
return_plitem (pr, PL_ObjectForKey (p_plitem (pr, 0), P_GSTRING (pr, 1)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -147,7 +146,7 @@ bi_PL_NewData (progs_t *pr)
|
|||
static void
|
||||
bi_PL_NewString (progs_t *pr)
|
||||
{
|
||||
return_plitem (pr, record_plitem (pr, PL_NewString (P_STRING (pr, 0))));
|
||||
return_plitem (pr, record_plitem (pr, PL_NewString (P_GSTRING (pr, 0))));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -96,8 +96,8 @@ secured (progs_t *pr)
|
|||
static void
|
||||
bi_Qrename (progs_t *pr)
|
||||
{
|
||||
const char *old = P_STRING (pr, 0);
|
||||
const char *new = P_STRING (pr, 1);
|
||||
const char *old = P_GSTRING (pr, 0);
|
||||
const char *new = P_GSTRING (pr, 1);
|
||||
|
||||
R_INT (pr) = Qrename (old, new);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ bi_Qrename (progs_t *pr)
|
|||
static void
|
||||
bi_Qremove (progs_t *pr)
|
||||
{
|
||||
const char *path = P_STRING (pr, 0);
|
||||
const char *path = P_GSTRING (pr, 0);
|
||||
|
||||
R_INT (pr) = Qremove (path);
|
||||
}
|
||||
|
@ -114,8 +114,8 @@ static void
|
|||
bi_Qopen (progs_t *pr)
|
||||
{
|
||||
qfile_resources_t *res = PR_Resources_Find (pr, "QFile");
|
||||
const char *path = P_STRING (pr, 0);
|
||||
const char *mode = P_STRING (pr, 1);
|
||||
const char *path = P_GSTRING (pr, 0);
|
||||
const char *mode = P_GSTRING (pr, 1);
|
||||
QFile **h = QFile_AllocHandle (pr, res);
|
||||
|
||||
if (!h) {
|
||||
|
@ -172,7 +172,7 @@ bi_Qread (progs_t *pr)
|
|||
{
|
||||
int handle = P_INT (pr, 0);
|
||||
QFile **h = get_qfile (pr, handle, "Qread");
|
||||
pr_type_t *buf = P_POINTER (pr, 1);
|
||||
pr_type_t *buf = P_GPOINTER (pr, 1);
|
||||
int count = P_INT (pr, 2);
|
||||
|
||||
check_buffer (pr, buf, count, "Qread");
|
||||
|
@ -184,7 +184,7 @@ bi_Qwrite (progs_t *pr)
|
|||
{
|
||||
int handle = P_INT (pr, 0);
|
||||
QFile **h = get_qfile (pr, handle, "Qwrite");
|
||||
pr_type_t *buf = P_POINTER (pr, 1);
|
||||
pr_type_t *buf = P_GPOINTER (pr, 1);
|
||||
int count = P_INT (pr, 2);
|
||||
|
||||
check_buffer (pr, buf, count, "Qwrite");
|
||||
|
@ -196,7 +196,7 @@ bi_Qputs (progs_t *pr)
|
|||
{
|
||||
int handle = P_INT (pr, 0);
|
||||
QFile **h = get_qfile (pr, handle, "Qputs");
|
||||
const char *str = P_STRING (pr, 1);
|
||||
const char *str = P_GSTRING (pr, 1);
|
||||
|
||||
R_INT (pr) = Qputs (*h, str);
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ bi_Qgets (progs_t *pr)
|
|||
{
|
||||
int handle = P_INT (pr, 0);
|
||||
QFile **h = get_qfile (pr, handle, "Qgets");
|
||||
pr_type_t *buf = P_POINTER (pr, 1);
|
||||
pr_type_t *buf = P_GPOINTER (pr, 1);
|
||||
int count = P_INT (pr, 2);
|
||||
|
||||
check_buffer (pr, buf, count, "Qgets");
|
||||
|
|
|
@ -73,8 +73,8 @@ check_buffer (progs_t *pr, pr_type_t *buf, int count, const char *name)
|
|||
static void
|
||||
bi_QFS_Rename (progs_t *pr)
|
||||
{
|
||||
const char *old = P_STRING (pr, 0);
|
||||
const char *new = P_STRING (pr, 1);
|
||||
const char *old = P_GSTRING (pr, 0);
|
||||
const char *new = P_GSTRING (pr, 1);
|
||||
|
||||
R_INT (pr) = QFS_Rename (old, new);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ bi_QFS_Rename (progs_t *pr)
|
|||
static void
|
||||
bi_QFS_LoadFile (progs_t *pr)
|
||||
{
|
||||
const char *filename = P_STRING (pr, 0);
|
||||
const char *filename = P_GSTRING (pr, 0);
|
||||
QFile *file;
|
||||
int size;
|
||||
void *buffer;
|
||||
|
@ -109,7 +109,7 @@ bi_QFS_OpenFile (progs_t *pr)
|
|||
{
|
||||
qfile_resources_t *res = PR_Resources_Find (pr, "QFile");
|
||||
QFile **file = QFile_AllocHandle (pr, res);
|
||||
const char *filename = P_STRING (pr, 0);
|
||||
const char *filename = P_GSTRING (pr, 0);
|
||||
|
||||
QFS_FOpenFile (filename, file);
|
||||
if (!*file) {
|
||||
|
@ -122,8 +122,8 @@ bi_QFS_OpenFile (progs_t *pr)
|
|||
static void
|
||||
bi_QFS_WriteFile (progs_t *pr)
|
||||
{
|
||||
const char *filename = P_STRING (pr, 0);
|
||||
pr_type_t *buf = P_POINTER (pr, 1);
|
||||
const char *filename = P_GSTRING (pr, 0);
|
||||
pr_type_t *buf = P_GPOINTER (pr, 1);
|
||||
int count = P_INT (pr, 2);
|
||||
|
||||
check_buffer (pr, buf, count, "QFS_WriteFile");
|
||||
|
|
|
@ -69,11 +69,11 @@ PF_VarString (progs_t *pr, int first)
|
|||
int len, i;
|
||||
|
||||
for (len = 0, i = first; i < pr->pr_argc; i++)
|
||||
len += strlen (G_STRING (pr, (OFS_PARM0 + i * 3)));
|
||||
len += strlen (P_GSTRING (pr, i));
|
||||
out = Hunk_TempAlloc (len + 1);
|
||||
out[0] = 0;
|
||||
for (i = first; i < pr->pr_argc; i++)
|
||||
strcat (out, G_STRING (pr, (OFS_PARM0 + i * 3)));
|
||||
strcat (out, P_GSTRING (pr, i));
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ PF_localcmd (progs_t *pr)
|
|||
{
|
||||
const char *str;
|
||||
|
||||
str = P_STRING (pr, 0);
|
||||
str = P_GSTRING (pr, 0);
|
||||
Cbuf_AddText (str);
|
||||
}
|
||||
#endif
|
||||
|
@ -245,7 +245,7 @@ PF_cvar (progs_t *pr)
|
|||
{
|
||||
const char *str;
|
||||
|
||||
str = P_STRING (pr, 0);
|
||||
str = P_GSTRING (pr, 0);
|
||||
|
||||
R_FLOAT (pr) = Cvar_VariableValue (str);
|
||||
}
|
||||
|
@ -261,8 +261,8 @@ PF_cvar_set (progs_t *pr)
|
|||
const char *var_name, *val;
|
||||
cvar_t *var;
|
||||
|
||||
var_name = P_STRING (pr, 0);
|
||||
val = P_STRING (pr, 1);
|
||||
var_name = P_GSTRING (pr, 0);
|
||||
val = P_GSTRING (pr, 1);
|
||||
var = Cvar_FindVar (var_name);
|
||||
if (!var)
|
||||
var = Cvar_FindAlias (var_name);
|
||||
|
@ -302,7 +302,7 @@ PF_Find (progs_t *pr)
|
|||
type = field_def->type & ~DEF_SAVEGLOBAL;
|
||||
|
||||
if (type == ev_string) {
|
||||
s = P_STRING (pr, 2);
|
||||
s = P_GSTRING (pr, 2);
|
||||
if (!s)
|
||||
PR_RunError (pr, "PF_Find: bad search string");
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ PF_Find (progs_t *pr)
|
|||
continue;
|
||||
switch (type) {
|
||||
case ev_string:
|
||||
t = E_STRING (pr, ed, f);
|
||||
t = E_GSTRING (pr, ed, f);
|
||||
if (!t)
|
||||
continue;
|
||||
if (strcmp (t, s))
|
||||
|
@ -503,7 +503,7 @@ PF_itos (progs_t *pr)
|
|||
static void
|
||||
PF_stof (progs_t *pr)
|
||||
{
|
||||
R_FLOAT (pr) = atof (P_STRING (pr, 0));
|
||||
R_FLOAT (pr) = atof (P_GSTRING (pr, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -514,7 +514,7 @@ PF_stof (progs_t *pr)
|
|||
static void
|
||||
PF_stoi (progs_t *pr)
|
||||
{
|
||||
R_INT (pr) = atoi (P_STRING (pr, 0));
|
||||
R_INT (pr) = atoi (P_GSTRING (pr, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -527,7 +527,7 @@ PF_stov (progs_t *pr)
|
|||
{
|
||||
float v[3] = {0, 0, 0};
|
||||
|
||||
sscanf (P_STRING (pr, 0), "'%f %f %f'", v, v + 1, v + 2);
|
||||
sscanf (P_GSTRING (pr, 0), "'%f %f %f'", v, v + 1, v + 2);
|
||||
|
||||
RETURN_VECTOR (pr, v);
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ PF_strlen (progs_t *pr)
|
|||
{
|
||||
const char *s;
|
||||
|
||||
s = P_STRING (pr, 0);
|
||||
s = P_GSTRING (pr, 0);
|
||||
R_FLOAT (pr) = strlen(s);
|
||||
}
|
||||
|
||||
|
@ -576,14 +576,14 @@ PF_charcount (progs_t *pr)
|
|||
const char *s;
|
||||
int count;
|
||||
|
||||
goal = (P_STRING (pr, 0))[0];
|
||||
goal = (P_GSTRING (pr, 0))[0];
|
||||
if (goal == '\0') {
|
||||
R_FLOAT (pr) = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
s = P_STRING (pr, 1);
|
||||
s = P_GSTRING (pr, 1);
|
||||
while (*s) {
|
||||
if (*s == goal)
|
||||
count++;
|
||||
|
@ -613,7 +613,7 @@ PF_sprintf (progs_t *pr)
|
|||
size_t new_format_i;
|
||||
int curarg = 3, out_max = 32, out_size = 0;
|
||||
|
||||
format = P_STRING (pr, 0);
|
||||
format = P_GSTRING (pr, 0);
|
||||
c = format;
|
||||
|
||||
out = malloc (out_max);
|
||||
|
@ -779,7 +779,7 @@ PF_sprintf (progs_t *pr)
|
|||
char *s;
|
||||
if (curarg > MAX_ARG)
|
||||
goto maxargs;
|
||||
s = P_STRING (pr, 0 + curarg);
|
||||
s = P_GSTRING (pr, 0 + curarg);
|
||||
while ((ret = snprintf (&out[out_size], out_max - out_size, "%s",
|
||||
s))
|
||||
>= out_max - out_size) {
|
||||
|
|
|
@ -448,7 +448,8 @@ ED_PrintEdicts (progs_t *pr, const char *fieldval)
|
|||
if (fieldval && fieldval[0] && def) {
|
||||
count = 0;
|
||||
for (i = 0; i < *(pr)->num_edicts; i++)
|
||||
if (strequal(fieldval, E_STRING (pr, EDICT_NUM(pr, i), def->ofs))) {
|
||||
if (strequal(fieldval,
|
||||
E_GSTRING (pr, EDICT_NUM(pr, i), def->ofs))) {
|
||||
ED_PrintNum (pr, i);
|
||||
count++;
|
||||
}
|
||||
|
|
|
@ -112,8 +112,7 @@ PR_EnterFunction (progs_t * pr, dfunction_t *f)
|
|||
if (f->numparms >= 0) {
|
||||
for (i = 0; i < f->numparms; i++) {
|
||||
for (j = 0; j < f->parm_size[i]; j++) {
|
||||
memcpy (&pr->pr_globals[o],
|
||||
&pr->pr_globals[OFS_PARM0 + i * 3 + j],
|
||||
memcpy (&pr->pr_globals[o], &P_INT (pr, i) + j,
|
||||
sizeof (pr_type_t));
|
||||
o++;
|
||||
}
|
||||
|
@ -123,8 +122,7 @@ PR_EnterFunction (progs_t * pr, dfunction_t *f)
|
|||
pr_type_t *argv = &pr->pr_globals[o++];
|
||||
for (i = 0; i < -f->numparms - 1; i++) {
|
||||
for (j = 0; j < f->parm_size[i]; j++) {
|
||||
memcpy (&pr->pr_globals[o],
|
||||
&pr->pr_globals[OFS_PARM0 + i * 3 + j],
|
||||
memcpy (&pr->pr_globals[o], &P_INT (pr, i) + j,
|
||||
sizeof (pr_type_t));
|
||||
o++;
|
||||
}
|
||||
|
@ -132,9 +130,7 @@ PR_EnterFunction (progs_t * pr, dfunction_t *f)
|
|||
argc->integer_var = pr->pr_argc - i;
|
||||
argv->integer_var = o;
|
||||
while (i < MAX_PARMS) {
|
||||
memcpy (&pr->pr_globals[o],
|
||||
&pr->pr_globals[OFS_PARM0 + i * 3],
|
||||
3);
|
||||
memcpy (&pr->pr_globals[o], &P_INT (pr, i), 3);
|
||||
o += 3;
|
||||
i++;
|
||||
}
|
||||
|
@ -683,7 +679,7 @@ PR_ExecuteProgram (progs_t * pr, func_t fnum)
|
|||
break;
|
||||
case OP_DONE:
|
||||
case OP_RETURN:
|
||||
memcpy (&pr->pr_globals[OFS_RETURN], &OPA, 3 * sizeof (OPA));
|
||||
memcpy (&R_INT (pr), &OPA, 3 * sizeof (OPA));
|
||||
PR_LeaveFunction (pr);
|
||||
st = pr->pr_statements + pr->pr_xstatement;
|
||||
if (pr->pr_depth == exitdepth) {
|
||||
|
|
|
@ -303,7 +303,7 @@ pr_obj_error (progs_t *pr)
|
|||
{
|
||||
//pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
|
||||
//int code = P_INT (pr, 1);
|
||||
//const char *fmt = P_STRING (pr, 2);
|
||||
//const char *fmt = P_GSTRING (pr, 2);
|
||||
//...
|
||||
//XXX
|
||||
PR_RunError (pr, "%s, not implemented", __FUNCTION__);
|
||||
|
@ -314,7 +314,7 @@ pr_obj_verror (progs_t *pr)
|
|||
{
|
||||
//pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
|
||||
//int code = P_INT (pr, 1);
|
||||
//const char *fmt = P_STRING (pr, 2);
|
||||
//const char *fmt = P_GSTRING (pr, 2);
|
||||
//XXX
|
||||
PR_RunError (pr, "%s, not implemented", __FUNCTION__);
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ pr_obj_msg_sendv (progs_t *pr)
|
|||
{
|
||||
pr_id_t *receiver = &P_STRUCT (pr, pr_id_t, 0);
|
||||
pr_sel_t *op = &P_STRUCT (pr, pr_sel_t, 1);
|
||||
pr_va_list_t args = G_STRUCT (pr, pr_va_list_t, OFS_PARM2);
|
||||
pr_va_list_t args = P_STRUCT (pr, pr_va_list_t, 2);
|
||||
func_t imp = obj_msg_lookup (pr, receiver, op);
|
||||
|
||||
if (!imp)
|
||||
|
@ -358,7 +358,7 @@ pr_obj_msg_sendv (progs_t *pr)
|
|||
PR_GetString (pr, op->sel_id));
|
||||
if (args.count > 6)
|
||||
args.count = 6;
|
||||
memcpy (G_POINTER (pr, OFS_PARM2), G_POINTER (pr, args.list),
|
||||
memcpy (P_GPOINTER (pr, 2), G_GPOINTER (pr, args.list),
|
||||
args.count * 4 * 3);
|
||||
call_function (pr, imp);
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ pr_obj_valloc (progs_t *pr)
|
|||
static void
|
||||
pr_obj_realloc (progs_t *pr)
|
||||
{
|
||||
void *mem = (void*)P_POINTER (pr, 0);
|
||||
void *mem = (void*)P_GPOINTER (pr, 0);
|
||||
int size = P_INT (pr, 1) * sizeof (pr_type_t);
|
||||
|
||||
mem = PR_Zone_Realloc (pr, mem, size);
|
||||
|
@ -413,7 +413,7 @@ pr_obj_calloc (progs_t *pr)
|
|||
static void
|
||||
pr_obj_free (progs_t *pr)
|
||||
{
|
||||
void *mem = (void*)P_POINTER (pr, 0);
|
||||
void *mem = (void*)P_GPOINTER (pr, 0);
|
||||
|
||||
PR_Zone_Free (pr, mem);
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ pr_obj_msgSend_super (progs_t *pr)
|
|||
static void
|
||||
pr_obj_get_class (progs_t *pr)
|
||||
{
|
||||
const char *name = P_STRING (pr, 0);
|
||||
const char *name = P_GSTRING (pr, 0);
|
||||
pr_class_t *class;
|
||||
|
||||
class = Hash_Find (pr->classes, name);
|
||||
|
@ -483,7 +483,7 @@ pr_obj_get_class (progs_t *pr)
|
|||
static void
|
||||
pr_obj_lookup_class (progs_t *pr)
|
||||
{
|
||||
const char *name = P_STRING (pr, 0);
|
||||
const char *name = P_GSTRING (pr, 0);
|
||||
pr_class_t *class;
|
||||
|
||||
class = Hash_Find (pr->classes, name);
|
||||
|
@ -516,7 +516,7 @@ pr_sel_get_type (progs_t *pr)
|
|||
static void
|
||||
pr_sel_get_uid (progs_t *pr)
|
||||
{
|
||||
//const char *name = P_STRING (pr, 0);
|
||||
//const char *name = P_GSTRING (pr, 0);
|
||||
//XXX
|
||||
PR_RunError (pr, "%s, not implemented", __FUNCTION__);
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ pr_sel_get_uid (progs_t *pr)
|
|||
static void
|
||||
pr_sel_get_any_uid (progs_t *pr)
|
||||
{
|
||||
//const char *name = P_STRING (pr, 0);
|
||||
//const char *name = P_GSTRING (pr, 0);
|
||||
//XXX
|
||||
PR_RunError (pr, "%s, not implemented", __FUNCTION__);
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ pr_sel_get_any_uid (progs_t *pr)
|
|||
static void
|
||||
pr_sel_get_any_typed_uid (progs_t *pr)
|
||||
{
|
||||
//const char *name = P_STRING (pr, 0);
|
||||
//const char *name = P_GSTRING (pr, 0);
|
||||
//XXX
|
||||
PR_RunError (pr, "%s, not implemented", __FUNCTION__);
|
||||
}
|
||||
|
@ -540,8 +540,8 @@ pr_sel_get_any_typed_uid (progs_t *pr)
|
|||
static void
|
||||
pr_sel_get_typed_uid (progs_t *pr)
|
||||
{
|
||||
//const char *name = P_STRING (pr, 0);
|
||||
//const char *type = P_STRING (pr, 1);
|
||||
//const char *name = P_GSTRING (pr, 0);
|
||||
//const char *type = P_GSTRING (pr, 1);
|
||||
//XXX
|
||||
PR_RunError (pr, "%s, not implemented", __FUNCTION__);
|
||||
}
|
||||
|
@ -549,7 +549,7 @@ pr_sel_get_typed_uid (progs_t *pr)
|
|||
static void
|
||||
pr_sel_register_name (progs_t *pr)
|
||||
{
|
||||
//const char *name = P_STRING (pr, 0);
|
||||
//const char *name = P_GSTRING (pr, 0);
|
||||
//XXX
|
||||
PR_RunError (pr, "%s, not implemented", __FUNCTION__);
|
||||
}
|
||||
|
@ -557,8 +557,8 @@ pr_sel_register_name (progs_t *pr)
|
|||
static void
|
||||
pr_sel_register_typed_name (progs_t *pr)
|
||||
{
|
||||
//const char *name = P_STRING (pr, 0);
|
||||
//const char *type = P_STRING (pr, 1);
|
||||
//const char *name = P_GSTRING (pr, 0);
|
||||
//const char *type = P_GSTRING (pr, 1);
|
||||
//XXX
|
||||
PR_RunError (pr, "%s, not implemented", __FUNCTION__);
|
||||
}
|
||||
|
@ -690,7 +690,7 @@ static void
|
|||
pr_class_ivar_set_gcinvisible (progs_t *pr)
|
||||
{
|
||||
//pr_class_t *imposter = &P_STRUCT (pr, pr_class_t, 0);
|
||||
//const char *ivarname = P_STRING (pr, 1);
|
||||
//const char *ivarname = P_GSTRING (pr, 1);
|
||||
//int gcInvisible = P_INT (pr, 2);
|
||||
//XXX
|
||||
PR_RunError (pr, "%s, not implemented", __FUNCTION__);
|
||||
|
@ -888,7 +888,7 @@ static void
|
|||
pr__i_Object__error (progs_t *pr)
|
||||
{
|
||||
//pr_id_t *object = &P_STRUCT (pr, pr_id_t, 0);
|
||||
//const char *fmt = P_STRING (pr, 2);
|
||||
//const char *fmt = P_GSTRING (pr, 2);
|
||||
//...
|
||||
//XXX
|
||||
PR_RunError (pr, "%s, not implemented", __FUNCTION__);
|
||||
|
|
|
@ -165,7 +165,7 @@ PR_GarbageCollect (progs_t *pr)
|
|||
for (i = 0; i < pr->progs->numglobaldefs; i++) {
|
||||
def = &pr->pr_globaldefs[i];
|
||||
if ((def->type & ~DEF_SAVEGLOBAL) == ev_string) {
|
||||
str = G_STRING (pr, def->ofs);
|
||||
str = G_GSTRING (pr, def->ofs);
|
||||
if (str) {
|
||||
sr = Hash_Find (pr->strref_hash, str);
|
||||
if (sr)
|
||||
|
@ -177,7 +177,7 @@ PR_GarbageCollect (progs_t *pr)
|
|||
def = &pr->pr_fielddefs[i];
|
||||
if ((def->type & ~DEF_SAVEGLOBAL) == ev_string) {
|
||||
for (j = 0; j < *pr->num_edicts; j++) {
|
||||
str = E_STRING (pr, EDICT_NUM (pr, j), def->ofs);
|
||||
str = E_GSTRING (pr, EDICT_NUM (pr, j), def->ofs);
|
||||
if (str) {
|
||||
sr = Hash_Find (pr->strref_hash, str);
|
||||
if (sr)
|
||||
|
|
|
@ -77,7 +77,7 @@ static void
|
|||
bi_Draw_CachePic (progs_t *pr)
|
||||
{
|
||||
draw_resources_t *res = PR_Resources_Find (pr, "Draw");
|
||||
const char *path = P_STRING (pr, 0);
|
||||
const char *path = P_GSTRING (pr, 0);
|
||||
int alpha = P_INT (pr, 1);
|
||||
qpic_t *pic = Draw_CachePic (path, alpha);
|
||||
bi_qpic_t *qpic;
|
||||
|
@ -154,7 +154,7 @@ bi_Draw_String (progs_t *pr)
|
|||
{
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *text = P_STRING (pr, 2);
|
||||
const char *text = P_GSTRING (pr, 2);
|
||||
|
||||
Draw_String (x, y, text);
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ bi_Draw_nString (progs_t *pr)
|
|||
{
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *text = P_STRING (pr, 2);
|
||||
const char *text = P_GSTRING (pr, 2);
|
||||
int n = P_INT (pr, 3);
|
||||
|
||||
Draw_nString (x, y, text, n);
|
||||
|
@ -175,7 +175,7 @@ bi_Draw_AltString (progs_t *pr)
|
|||
{
|
||||
int x = P_INT (pr, 0);
|
||||
int y = P_INT (pr, 1);
|
||||
const char *text = P_STRING (pr, 2);
|
||||
const char *text = P_GSTRING (pr, 2);
|
||||
|
||||
Draw_AltString (x, y, text);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ bi_Key_SetBinding (progs_t *pr)
|
|||
{
|
||||
int target = P_INT (pr, 0);
|
||||
int keynum = P_INT (pr, 1);
|
||||
const char *binding = P_STRING (pr, 2);
|
||||
const char *binding = P_GSTRING (pr, 2);
|
||||
|
||||
if(strlen(binding) == 0 || binding[0] == '\0') {
|
||||
binding = NULL; /* unbind a binding */
|
||||
|
@ -72,7 +72,7 @@ bi_Key_LookupBinding (progs_t *pr)
|
|||
{
|
||||
int target = P_INT (pr, 0);
|
||||
int bindnum = P_INT (pr, 1);
|
||||
const char *binding = P_STRING (pr, 2);
|
||||
const char *binding = P_GSTRING (pr, 2);
|
||||
int i;
|
||||
knum_t keynum = -1;
|
||||
const char *keybind = NULL;
|
||||
|
@ -101,7 +101,7 @@ static void
|
|||
bi_Key_CountBinding (progs_t *pr)
|
||||
{
|
||||
int target = P_INT (pr, 0);
|
||||
const char *binding = P_STRING (pr, 1);
|
||||
const char *binding = P_GSTRING (pr, 1);
|
||||
int i, res = 0;
|
||||
const char *keybind = NULL;
|
||||
|
||||
|
|
|
@ -242,7 +242,7 @@ PF_setmodel (progs_t *pr)
|
|||
int i;
|
||||
|
||||
e = P_EDICT (pr, 0);
|
||||
m = P_STRING (pr, 1);
|
||||
m = P_GSTRING (pr, 1);
|
||||
|
||||
// check to see if model was properly precached
|
||||
for (i = 0, check = sv.model_precache; *check; i++, check++)
|
||||
|
@ -365,7 +365,7 @@ PF_ambientsound (progs_t *pr)
|
|||
int soundnum;
|
||||
|
||||
pos = P_VECTOR (pr, 0);
|
||||
samp = P_STRING (pr, 1);
|
||||
samp = P_GSTRING (pr, 1);
|
||||
vol = P_FLOAT (pr, 2);
|
||||
attenuation = P_FLOAT (pr, 3);
|
||||
|
||||
|
@ -410,7 +410,7 @@ PF_sound (progs_t *pr)
|
|||
|
||||
entity = P_EDICT (pr, 0);
|
||||
channel = P_FLOAT (pr, 1);
|
||||
sample = P_STRING (pr, 2);
|
||||
sample = P_GSTRING (pr, 2);
|
||||
volume = P_FLOAT (pr, 3) * 255;
|
||||
attenuation = P_FLOAT (pr, 4);
|
||||
|
||||
|
@ -598,7 +598,7 @@ PF_stuffcmd (progs_t *pr)
|
|||
entnum = P_EDICTNUM (pr, 0);
|
||||
if (entnum < 1 || entnum > svs.maxclients)
|
||||
PR_RunError (pr, "Parm 0 not a client");
|
||||
str = P_STRING (pr, 1);
|
||||
str = P_GSTRING (pr, 1);
|
||||
|
||||
old = host_client;
|
||||
host_client = &svs.clients[entnum - 1];
|
||||
|
@ -618,7 +618,7 @@ PF_localcmd (progs_t *pr)
|
|||
{
|
||||
const char *str;
|
||||
|
||||
str = P_STRING (pr, 0);
|
||||
str = P_GSTRING (pr, 0);
|
||||
Cbuf_AddText (host_cbuf, str);
|
||||
}
|
||||
|
||||
|
@ -705,7 +705,7 @@ PF_precache_sound (progs_t *pr)
|
|||
PR_RunError (pr, "PF_Precache_*: Precache can only be done in spawn "
|
||||
"functions");
|
||||
|
||||
s = P_STRING (pr, 0);
|
||||
s = P_GSTRING (pr, 0);
|
||||
R_INT (pr) = P_INT (pr, 0);
|
||||
PR_CheckEmptyString (pr, s);
|
||||
|
||||
|
@ -730,7 +730,7 @@ PF_precache_model (progs_t *pr)
|
|||
PR_RunError (pr, "PF_Precache_*: Precache can only be done in spawn "
|
||||
"functions");
|
||||
|
||||
s = P_STRING (pr, 0);
|
||||
s = P_GSTRING (pr, 0);
|
||||
R_INT (pr) = P_INT (pr, 0);
|
||||
PR_CheckEmptyString (pr, s);
|
||||
|
||||
|
@ -833,7 +833,7 @@ PF_lightstyle (progs_t *pr)
|
|||
int j;
|
||||
|
||||
style = P_FLOAT (pr, 0);
|
||||
val = P_STRING (pr, 1);
|
||||
val = P_GSTRING (pr, 1);
|
||||
|
||||
// change the string in sv
|
||||
sv.lightstyles[style] = val;
|
||||
|
@ -1062,7 +1062,7 @@ PF_WriteCoord (progs_t *pr)
|
|||
void
|
||||
PF_WriteString (progs_t *pr)
|
||||
{
|
||||
MSG_WriteString (WriteDest (pr), P_STRING (pr, 1));
|
||||
MSG_WriteString (WriteDest (pr), P_GSTRING (pr, 1));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1131,7 +1131,7 @@ PF_changelevel (progs_t *pr)
|
|||
return;
|
||||
svs.changelevel_issued = true;
|
||||
|
||||
s = P_STRING (pr, 0);
|
||||
s = P_GSTRING (pr, 0);
|
||||
Cbuf_AddText (host_cbuf, va ("changelevel %s\n", s));
|
||||
}
|
||||
|
||||
|
@ -1311,7 +1311,7 @@ PF_Fixme (progs_t *pr)
|
|||
static void
|
||||
PF_checkextension (progs_t *pr)
|
||||
{
|
||||
G_FLOAT (pr, OFS_RETURN) = 0; // FIXME: make this function actually useful
|
||||
R_FLOAT (pr) = 0; // FIXME: make this function actually useful
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -179,7 +179,7 @@ PF_setmodel (progs_t *pr)
|
|||
model_t *mod;
|
||||
|
||||
e = P_EDICT (pr, 0);
|
||||
m = P_STRING (pr, 1);
|
||||
m = P_GSTRING (pr, 1);
|
||||
|
||||
// check to see if model was properly precached
|
||||
for (i = 0, check = sv.model_precache; *check; i++, check++)
|
||||
|
@ -304,7 +304,7 @@ PF_ambientsound (progs_t *pr)
|
|||
int soundnum;
|
||||
|
||||
pos = P_VECTOR (pr, 0);
|
||||
samp = P_STRING (pr, 1);
|
||||
samp = P_GSTRING (pr, 1);
|
||||
vol = P_FLOAT (pr, 2);
|
||||
attenuation = P_FLOAT (pr, 3);
|
||||
|
||||
|
@ -351,7 +351,7 @@ PF_sound (progs_t *pr)
|
|||
|
||||
entity = P_EDICT (pr, 0);
|
||||
channel = P_FLOAT (pr, 1);
|
||||
sample = P_STRING (pr, 2);
|
||||
sample = P_GSTRING (pr, 2);
|
||||
volume = P_FLOAT (pr, 3) * 255;
|
||||
attenuation = P_FLOAT (pr, 4);
|
||||
|
||||
|
@ -569,7 +569,7 @@ PF_stuffcmd (progs_t *pr)
|
|||
if (cl->state == cs_server)
|
||||
return;
|
||||
|
||||
str = P_STRING (pr, 1);
|
||||
str = P_GSTRING (pr, 1);
|
||||
|
||||
buf = cl->stufftext_buf;
|
||||
if (strlen (buf) + strlen (str) >= MAX_STUFFTEXT)
|
||||
|
@ -612,7 +612,7 @@ PF_localcmd (progs_t *pr)
|
|||
{
|
||||
const char *str;
|
||||
|
||||
str = P_STRING (pr, 0);
|
||||
str = P_GSTRING (pr, 0);
|
||||
Cbuf_AddText (sv_cbuf, str);
|
||||
}
|
||||
|
||||
|
@ -739,7 +739,7 @@ PF_precache_file (progs_t *pr)
|
|||
void
|
||||
PF_precache_sound (progs_t *pr)
|
||||
{
|
||||
do_precache (pr, sv.sound_precache, MAX_SOUNDS, P_STRING (pr, 0),
|
||||
do_precache (pr, sv.sound_precache, MAX_SOUNDS, P_GSTRING (pr, 0),
|
||||
"precache_sound");
|
||||
R_INT (pr) = P_INT (pr, 0);
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ PF_precache_model (progs_t *pr)
|
|||
{
|
||||
R_INT (pr) = P_INT (pr, 0);
|
||||
|
||||
do_precache (pr, sv.model_precache, MAX_MODELS, P_STRING (pr, 0),
|
||||
do_precache (pr, sv.model_precache, MAX_MODELS, P_GSTRING (pr, 0),
|
||||
"precache_model");
|
||||
}
|
||||
|
||||
|
@ -837,7 +837,7 @@ PF_lightstyle (progs_t *pr)
|
|||
int style, j;
|
||||
|
||||
style = P_FLOAT (pr, 0);
|
||||
val = P_STRING (pr, 1);
|
||||
val = P_GSTRING (pr, 1);
|
||||
|
||||
// change the string in sv
|
||||
sv.lightstyles[style] = val;
|
||||
|
@ -1088,7 +1088,7 @@ PF_WriteBytes (progs_t *pr)
|
|||
if (sv.demorecording)
|
||||
DemoWrite_Begin (dem_single, cl - svs.clients, pr->pr_argc);
|
||||
for (i = 1; i < pr->pr_argc; i++) {
|
||||
p = G_FLOAT (pr, OFS_PARM0 + i * (OFS_PARM1 - OFS_PARM0));
|
||||
p = P_FLOAT (pr, i);
|
||||
if (cl->state != cs_server)
|
||||
ClientReliableWrite_Byte (cl, p);
|
||||
if (sv.demorecording)
|
||||
|
@ -1097,7 +1097,7 @@ PF_WriteBytes (progs_t *pr)
|
|||
} else {
|
||||
sizebuf_t *msg = WriteDest (pr);
|
||||
for (i = 1; i < pr->pr_argc; i++) {
|
||||
p = G_FLOAT (pr, OFS_PARM0 + i * (OFS_PARM1 - OFS_PARM0));
|
||||
p = P_FLOAT (pr, i);
|
||||
MSG_WriteByte (msg, p);
|
||||
}
|
||||
}
|
||||
|
@ -1258,16 +1258,16 @@ PF_WriteString (progs_t *pr)
|
|||
client_t *cl = Write_GetClient (pr);
|
||||
|
||||
if (cl->state != cs_server) {
|
||||
ClientReliableCheckBlock (cl, 1 + strlen (P_STRING (pr, 1)));
|
||||
ClientReliableWrite_String (cl, P_STRING (pr, 1));
|
||||
ClientReliableCheckBlock (cl, 1 + strlen (P_GSTRING (pr, 1)));
|
||||
ClientReliableWrite_String (cl, P_GSTRING (pr, 1));
|
||||
}
|
||||
if (sv.demorecording) {
|
||||
DemoWrite_Begin (dem_single, cl - svs.clients,
|
||||
1 + strlen (P_STRING (pr, 1)));
|
||||
MSG_WriteString (&demo.dbuf->sz, P_STRING (pr, 1));
|
||||
1 + strlen (P_GSTRING (pr, 1)));
|
||||
MSG_WriteString (&demo.dbuf->sz, P_GSTRING (pr, 1));
|
||||
}
|
||||
} else
|
||||
MSG_WriteString (WriteDest (pr), P_STRING (pr, 1));
|
||||
MSG_WriteString (WriteDest (pr), P_GSTRING (pr, 1));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1348,7 +1348,7 @@ PF_changelevel (progs_t *pr)
|
|||
return;
|
||||
last_spawncount = svs.spawncount;
|
||||
|
||||
s = P_STRING (pr, 0);
|
||||
s = P_GSTRING (pr, 0);
|
||||
Cbuf_AddText (sv_cbuf, va ("map %s\n", s));
|
||||
}
|
||||
|
||||
|
@ -1398,7 +1398,7 @@ PF_infokey (progs_t *pr)
|
|||
|
||||
e = P_EDICT (pr, 0);
|
||||
e1 = NUM_FOR_EDICT (pr, e);
|
||||
key = P_STRING (pr, 1);
|
||||
key = P_GSTRING (pr, 1);
|
||||
|
||||
if (sv_hide_version_info->int_val
|
||||
&& (strequal (key, "*qf_version")
|
||||
|
@ -1455,8 +1455,8 @@ PF_multicast (progs_t *pr)
|
|||
static void
|
||||
PF_cfopen (progs_t *pr)
|
||||
{
|
||||
R_FLOAT (pr) = CF_Open (P_STRING (pr, 0),
|
||||
P_STRING (pr, 1));
|
||||
R_FLOAT (pr) = CF_Open (P_GSTRING (pr, 0),
|
||||
P_GSTRING (pr, 1));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1489,7 +1489,7 @@ PF_cfread (progs_t *pr)
|
|||
static void
|
||||
PF_cfwrite (progs_t *pr)
|
||||
{
|
||||
R_FLOAT (pr) = CF_Write ((int) P_FLOAT (pr, 0), P_STRING (pr, 1));
|
||||
R_FLOAT (pr) = CF_Write ((int) P_FLOAT (pr, 0), P_GSTRING (pr, 1));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1519,8 +1519,8 @@ PF_setinfokey (progs_t *pr)
|
|||
{
|
||||
edict_t *edict = P_EDICT (pr, 0);
|
||||
int e1 = NUM_FOR_EDICT (pr, edict);
|
||||
const char *key = P_STRING (pr, 1);
|
||||
const char *value = P_STRING (pr, 2);
|
||||
const char *key = P_GSTRING (pr, 1);
|
||||
const char *value = P_GSTRING (pr, 2);
|
||||
|
||||
if (e1 == 0) {
|
||||
if (*value)
|
||||
|
@ -1739,7 +1739,7 @@ PF_sv_cvar (progs_t *pr)
|
|||
{
|
||||
const char *str;
|
||||
|
||||
str = P_STRING (pr, 0);
|
||||
str = P_GSTRING (pr, 0);
|
||||
|
||||
if (sv_hide_version_info->int_val
|
||||
&& strequal (str, "sv_hide_version_info")) {
|
||||
|
@ -1791,7 +1791,7 @@ PF_SV_SetUserinfo (progs_t *pr)
|
|||
{
|
||||
int entnum = P_EDICTNUM (pr, 0);
|
||||
client_t *cl = svs.clients + entnum - 1;
|
||||
const char *str = P_STRING (pr, 1);
|
||||
const char *str = P_GSTRING (pr, 1);
|
||||
|
||||
if (entnum < 1 || entnum > MAX_CLIENTS || cl->state != cs_server)
|
||||
PR_RunError (pr, "not a server client");
|
||||
|
|
|
@ -1113,10 +1113,8 @@ SV_SetInfo_f (ucmd_t *cmd)
|
|||
|
||||
if (UserInfoCallback) {
|
||||
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, sv_player);
|
||||
G_var (&sv_pr_state, OFS_PARM0, string) = PR_SetString (&sv_pr_state,
|
||||
Cmd_Argv (1));
|
||||
G_var (&sv_pr_state, OFS_PARM1, string) = PR_SetString (&sv_pr_state,
|
||||
Cmd_Argv (2));
|
||||
P_STRING (&sv_pr_state, 0) = PR_SetString (&sv_pr_state, Cmd_Argv (1));
|
||||
P_STRING (&sv_pr_state, 1) = PR_SetString (&sv_pr_state, Cmd_Argv (2));
|
||||
PR_ExecuteProgram (&sv_pr_state, UserInfoCallback);
|
||||
return;
|
||||
} else {
|
||||
|
@ -1227,7 +1225,7 @@ ucmds_free (void *_c, void *unused)
|
|||
static void
|
||||
SV_AddUserCommand (progs_t *pr)
|
||||
{
|
||||
const char *name = P_STRING (pr, 0);
|
||||
const char *name = P_GSTRING (pr, 0);
|
||||
ucmd_t *cmd;
|
||||
|
||||
cmd = Hash_Find (ucmd_table, name);
|
||||
|
|
|
@ -51,7 +51,7 @@ bi_print (progs_t *pr)
|
|||
{
|
||||
char *str;
|
||||
|
||||
str = G_STRING (pr, (OFS_PARM0));
|
||||
str = P_GSTRING (pr, 0);
|
||||
fprintf (stdout, "%s", str);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ bi_strerror (progs_t *pr)
|
|||
static void
|
||||
bi_open (progs_t *pr)
|
||||
{
|
||||
char *path = P_STRING (pr, 0);
|
||||
char *path = P_GSTRING (pr, 0);
|
||||
int flags = P_INT (pr, 1);
|
||||
int mode = P_INT (pr, 2);
|
||||
R_INT (pr) = open (path, flags, mode);
|
||||
|
@ -95,7 +95,7 @@ bi_read (progs_t *pr)
|
|||
{
|
||||
int handle = P_INT (pr, 0);
|
||||
int count = P_INT (pr, 1);
|
||||
int *read_result = (int *)P_POINTER (pr, 2);
|
||||
int *read_result = (int *)P_GPOINTER (pr, 2);
|
||||
int res;
|
||||
char *buffer;
|
||||
|
||||
|
@ -112,7 +112,7 @@ static void
|
|||
bi_write (progs_t *pr)
|
||||
{
|
||||
int handle = P_INT (pr, 0);
|
||||
char *buffer = P_STRING (pr, 1);
|
||||
char *buffer = P_GSTRING (pr, 1);
|
||||
int count = P_INT (pr, 2);
|
||||
|
||||
R_INT (pr) = write (handle, buffer, count);
|
||||
|
@ -143,7 +143,7 @@ bi_traceoff (progs_t *pr)
|
|||
static void
|
||||
bi_printf (progs_t *pr)
|
||||
{
|
||||
const char *fmt = P_STRING (pr, 0);
|
||||
const char *fmt = P_GSTRING (pr, 0);
|
||||
char c;
|
||||
int count = 0;
|
||||
float *v;
|
||||
|
@ -158,7 +158,7 @@ bi_printf (progs_t *pr)
|
|||
fprintf (stdout, "%f", P_FLOAT (pr, 1 + count++ * 3));
|
||||
break;
|
||||
case 's':
|
||||
fputs (P_STRING (pr, 1 + count++ * 3), stdout);
|
||||
fputs (P_GSTRING (pr, 1 + count++ * 3), stdout);
|
||||
break;
|
||||
case 'v':
|
||||
v = P_VECTOR (pr, 1 + count++ * 3);
|
||||
|
|
|
@ -178,5 +178,5 @@ main (int argc, char **argv)
|
|||
P_INT (&pr, 0) = pr_argc;
|
||||
P_INT (&pr, 1) = POINTER_TO_PROG (&pr, pr_argv);
|
||||
PR_ExecuteProgram (&pr, main_func);
|
||||
return G_INT (&pr, OFS_RETURN);
|
||||
return R_INT (&pr);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue