mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Remove reference to ddef_t from progs.h
This cleans up some horrible names and redundant fields that were a result of the transition to pr_def_t
This commit is contained in:
parent
81083698a8
commit
806af85447
3 changed files with 26 additions and 24 deletions
|
@ -1616,8 +1616,6 @@ struct progs_s {
|
|||
bfunction_t *function_table;
|
||||
char *pr_strings;
|
||||
int pr_stringsize;
|
||||
ddef_t *pr_globalddefs;
|
||||
ddef_t *pr_fieldddefs;
|
||||
pr_def_t *pr_globaldefs;
|
||||
pr_def_t *pr_fielddefs;
|
||||
dstatement_t *pr_statements;
|
||||
|
|
|
@ -120,7 +120,8 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size)
|
|||
byte *base;
|
||||
byte *heap;
|
||||
pr_def_t *xdefs_def = 0;
|
||||
|
||||
ddef_t *global_ddefs;
|
||||
ddef_t *field_ddefs;
|
||||
|
||||
if (!pr->file_error)
|
||||
pr->file_error = file_error;
|
||||
|
@ -222,8 +223,8 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size)
|
|||
(dfunction_t *) (base + pr->progs->ofs_functions);
|
||||
pr->pr_strings = (char *) base + pr->progs->ofs_strings;
|
||||
pr->pr_stringsize = (char *) heap + pr->zone_size - (char *) base;
|
||||
pr->pr_globalddefs = (ddef_t *) (base + pr->progs->ofs_globaldefs);
|
||||
pr->pr_fieldddefs = (ddef_t *) (base + pr->progs->ofs_fielddefs);
|
||||
global_ddefs = (ddef_t *) (base + pr->progs->ofs_globaldefs);
|
||||
field_ddefs = (ddef_t *) (base + pr->progs->ofs_fielddefs);
|
||||
pr->pr_statements = (dstatement_t *) (base + pr->progs->ofs_statements);
|
||||
|
||||
pr->pr_globals = (pr_type_t *) (base + pr->progs->ofs_globals);
|
||||
|
@ -280,13 +281,13 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size)
|
|||
pr->pr_globaldefs = calloc (pr->progs->numglobaldefs, sizeof (pr_def_t));
|
||||
|
||||
for (i = 0; i < pr->progs->numglobaldefs; i++) {
|
||||
pr->pr_globalddefs[i].type = LittleShort (pr->pr_globalddefs[i].type);
|
||||
pr->pr_globalddefs[i].ofs = LittleShort (pr->pr_globalddefs[i].ofs);
|
||||
pr->pr_globalddefs[i].s_name = LittleLong (pr->pr_globalddefs[i].s_name);
|
||||
global_ddefs[i].type = LittleShort (global_ddefs[i].type);
|
||||
global_ddefs[i].ofs = LittleShort (global_ddefs[i].ofs);
|
||||
global_ddefs[i].s_name = LittleLong (global_ddefs[i].s_name);
|
||||
|
||||
pr->pr_globaldefs[i].type = pr->pr_globalddefs[i].type;
|
||||
pr->pr_globaldefs[i].ofs = pr->pr_globalddefs[i].ofs;
|
||||
pr->pr_globaldefs[i].name = pr->pr_globalddefs[i].s_name;
|
||||
pr->pr_globaldefs[i].type = global_ddefs[i].type;
|
||||
pr->pr_globaldefs[i].ofs = global_ddefs[i].ofs;
|
||||
pr->pr_globaldefs[i].name = global_ddefs[i].s_name;
|
||||
Hash_Add (pr->global_hash, &pr->pr_globaldefs[i]);
|
||||
}
|
||||
|
||||
|
@ -295,15 +296,15 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size)
|
|||
}
|
||||
pr->pr_fielddefs = calloc (pr->progs->numfielddefs, sizeof (pr_def_t));
|
||||
for (i = 0; i < pr->progs->numfielddefs; i++) {
|
||||
pr->pr_fieldddefs[i].type = LittleShort (pr->pr_fieldddefs[i].type);
|
||||
if (pr->pr_fielddefs[i].type & DEF_SAVEGLOBAL)
|
||||
PR_Error (pr, "PR_LoadProgs: pr_fielddefs[i].type & DEF_SAVEGLOBAL");
|
||||
pr->pr_fieldddefs[i].ofs = LittleShort (pr->pr_fieldddefs[i].ofs);
|
||||
pr->pr_fieldddefs[i].s_name = LittleLong (pr->pr_fieldddefs[i].s_name);
|
||||
field_ddefs[i].type = LittleShort (field_ddefs[i].type);
|
||||
if (field_ddefs[i].type & DEF_SAVEGLOBAL)
|
||||
PR_Error (pr, "PR_LoadProgs: DEF_SAVEGLOBAL on field def %zd", i);
|
||||
field_ddefs[i].ofs = LittleShort (field_ddefs[i].ofs);
|
||||
field_ddefs[i].s_name = LittleLong (field_ddefs[i].s_name);
|
||||
|
||||
pr->pr_fielddefs[i].type = pr->pr_fieldddefs[i].type;
|
||||
pr->pr_fielddefs[i].ofs = pr->pr_fieldddefs[i].ofs;
|
||||
pr->pr_fielddefs[i].name = pr->pr_fieldddefs[i].s_name;
|
||||
pr->pr_fielddefs[i].type = field_ddefs[i].type;
|
||||
pr->pr_fielddefs[i].ofs = field_ddefs[i].ofs;
|
||||
pr->pr_fielddefs[i].name = field_ddefs[i].s_name;
|
||||
Hash_Add (pr->field_hash, &pr->pr_fielddefs[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -259,6 +259,8 @@ convert_qfo (void)
|
|||
xdef_t *xdef = 0;
|
||||
pr_xdefs_t *xdefs = 0;
|
||||
ddef_t *xdefs_def = 0;
|
||||
ddef_t *global_ddefs;
|
||||
ddef_t *field_ddefs;
|
||||
|
||||
pr.progs = qfo_to_progs (qfo, &size);
|
||||
|
||||
|
@ -267,8 +269,8 @@ convert_qfo (void)
|
|||
pr.pr_strings = P (char, ofs_strings);
|
||||
pr.pr_stringsize = pr.progs->numstrings;
|
||||
pr.pr_functions = P (dfunction_t, ofs_functions);
|
||||
pr.pr_globalddefs = P (ddef_t, ofs_globaldefs);
|
||||
pr.pr_fieldddefs = P (ddef_t, ofs_fielddefs);
|
||||
global_ddefs = P (ddef_t, ofs_globaldefs);
|
||||
field_ddefs = P (ddef_t, ofs_fielddefs);
|
||||
pr.pr_globals = P (pr_type_t, ofs_globals);
|
||||
pr.globals_size = pr.progs->numglobals;
|
||||
pr.pr_edict_size = max (1, pr.progs->entityfields) * 4;
|
||||
|
@ -278,9 +280,10 @@ convert_qfo (void)
|
|||
pr.pr_globaldefs = malloc ((pr.progs->numglobaldefs
|
||||
+ pr.progs->numfielddefs)
|
||||
* sizeof (pr_def_t));
|
||||
pr.pr_fielddefs = pr.pr_globaldefs + pr.progs->numglobaldefs;
|
||||
// can't use PR_FindGlobal yet as pr_globaldefs is still uninitialized
|
||||
for (i = 0; i < (int) pr.progs->numglobaldefs; i++) {
|
||||
ddef_t *ddef = pr.pr_globalddefs + i;
|
||||
ddef_t *ddef = global_ddefs + i;
|
||||
if (!strcmp (PR_GetString (&pr, ddef->s_name), ".xdefs")) {
|
||||
xdefs_def = ddef;
|
||||
break;
|
||||
|
@ -291,7 +294,7 @@ convert_qfo (void)
|
|||
xdef = &G_STRUCT (&pr, xdef_t, xdefs->xdefs);
|
||||
}
|
||||
for (i = 0; i < (int) pr.progs->numglobaldefs; i++, xdef++) {
|
||||
ddef_t *ddef = pr.pr_globalddefs + i;
|
||||
ddef_t *ddef = global_ddefs + i;
|
||||
pr_def_t *def = pr.pr_globaldefs + i;
|
||||
def->type = ddef->type;
|
||||
def->ofs = xdefs ? xdef->ofs : ddef->ofs;
|
||||
|
@ -299,7 +302,7 @@ convert_qfo (void)
|
|||
def->type_encoding = xdefs ? xdef->type : 0;
|
||||
}
|
||||
for (i = 0; i < (int) pr.progs->numfielddefs; i++, xdef++) {
|
||||
ddef_t *ddef = pr.pr_fieldddefs + i;
|
||||
ddef_t *ddef = field_ddefs + i;
|
||||
pr_def_t *def = pr.pr_fielddefs + i;
|
||||
def->type = ddef->type;
|
||||
def->ofs = xdefs ? xdef->ofs : ddef->ofs;
|
||||
|
|
Loading…
Reference in a new issue