Tidy up progs dump output, and do some whitespace.

This commit is contained in:
Jeff Teunissen 2002-10-08 19:46:42 +00:00
parent bca275944c
commit 575689296a

View file

@ -219,7 +219,7 @@ ED_Free (progs_t * pr, edict_t *ed)
/*
PR_ValueString
Returns a string describing *data in a type specific manner
Returns a string describing *data in a type-specific manner
*/
char *
PR_ValueString (progs_t *pr, etype_t type, pr_type_t *val)
@ -259,18 +259,18 @@ PR_ValueString (progs_t * pr, etype_t type, pr_type_t *val)
strcpy (line, "void");
break;
case ev_float:
snprintf (line, sizeof (line), "%5.1f", val->float_var);
snprintf (line, sizeof (line), "%g", val->float_var);
break;
case ev_vector:
snprintf (line, sizeof (line), "'%5.1f %5.1f %5.1f'",
snprintf (line, sizeof (line), "'%g %g %g'",
val->vector_var[0], val->vector_var[1],
val->vector_var[2]);
break;
case ev_pointer:
snprintf (line, sizeof (line), "[%d]", val->integer_var);
snprintf (line, sizeof (line), "[$%x]", val->integer_var);
break;
case ev_quaternion:
snprintf (line, sizeof (line), "'%5.1f %5.1f %5.1f %5.1f'",
snprintf (line, sizeof (line), "'%g %g %g %g'",
val->vector_var[0], val->vector_var[1],
val->vector_var[2], val->vector_var[3]);
break;
@ -278,7 +278,7 @@ PR_ValueString (progs_t * pr, etype_t type, pr_type_t *val)
snprintf (line, sizeof (line), "%d", val->integer_var);
break;
case ev_uinteger:
snprintf (line, sizeof (line), "%u", val->uinteger_var);
snprintf (line, sizeof (line), "$%08x", val->uinteger_var);
break;
default:
snprintf (line, sizeof (line), "bad type %i", type);
@ -364,7 +364,7 @@ PR_GlobalString (progs_t * pr, int ofs, etype_t type)
if (!def)
def = ED_GlobalAtOfs (pr, ofs);
if (!def && type == ev_void)
dsprintf (line, "[%04x]", ofs);
dsprintf (line, "[$%x]", ofs);
else {
char *name = "?";
char *oi = "";
@ -387,7 +387,7 @@ PR_GlobalString (progs_t * pr, int ofs, etype_t type)
else
dsprintf (line, "%s", s);
} else if (strequal(name, "?"))
dsprintf (line, "[%04x]", ofs);
dsprintf (line, "[$%x]", ofs);
else {
if (type == ev_func)
dsprintf (line, "%s%s", name, oi);
@ -417,7 +417,7 @@ PR_GlobalStringNoContents (progs_t * pr, int ofs, etype_t type)
if (!def)
def = ED_GlobalAtOfs (pr, ofs);
if (!def)
dsprintf (line, "[%x]", ofs);
dsprintf (line, "[$%x]", ofs);
else
dsprintf (line, "%s", PR_GetString (pr, def->s_name));
@ -434,11 +434,11 @@ void
ED_Print (progs_t *pr, edict_t *ed)
{
int l;
ddef_t *d;
pr_type_t *v;
int i;
char *name;
int type;
ddef_t *d;
pr_type_t *v;
if (ed->free) {
Sys_Printf ("FREE\n");
@ -498,11 +498,11 @@ ED_Print (progs_t * pr, edict_t *ed)
void
ED_Write (progs_t *pr, QFile *f, edict_t *ed)
{
int i, j;
int type;
char *name;
ddef_t *d;
pr_type_t *v;
int i, j;
char *name;
int type;
Qprintf (f, "{\n");
@ -578,10 +578,10 @@ void
ED_Count (progs_t *pr)
{
int i;
edict_t *ent;
int active, models, solid, step, zombie;
ddef_t *solid_def;
ddef_t *model_def;
edict_t *ent;
solid_def = ED_FindField (pr, "solid");
model_def = ED_FindField (pr, "model");
@ -792,19 +792,16 @@ ED_ParseEdict (progs_t * pr, const char *data, edict_t *ent)
{
ddef_t *key;
qboolean anglehack;
qboolean init;
qboolean init = false;
char keyname[256];
const char *token;
int n;
init = false;
// clear it
if (ent != *(pr)->edicts) // hack
memset (&ent->v, 0, pr->progs->entityfields * 4);
// go through all the dictionary pairs
while (1) {
while (1) { // go through all the dictionary pairs
// parse key
data = COM_Parse (data);
if (com_token[0] == '}')
@ -890,19 +887,15 @@ ED_ParseEdict (progs_t * pr, const char *data, edict_t *ent)
void
ED_LoadFromFile (progs_t *pr, const char *data)
{
edict_t *ent;
int inhibit;
edict_t *ent = NULL;
int inhibit = 0;
dfunction_t *func;
pr_type_t *classname;
ddef_t *def;
ent = NULL;
inhibit = 0;
*pr->globals.time = *(pr)->time;
// parse ents
while (1) {
while (1) { // parse ents
// parse the opening brace
data = COM_Parse (data);
if (!data)
@ -922,6 +915,7 @@ ED_LoadFromFile (progs_t * pr, const char *data)
inhibit++;
continue;
}
//
// immediately call spawn function
//
@ -933,9 +927,9 @@ ED_LoadFromFile (progs_t * pr, const char *data)
continue;
}
classname = &ent->v[def->ofs];
// look for the spawn function
func = ED_FindFunction (pr, PR_GetString (pr, classname->string_var));
if (!func) {
Sys_Printf ("No spawn function for:\n");
ED_Print (pr, ent);
@ -958,9 +952,11 @@ PR_InitEdicts (progs_t *pr, int num_edicts)
edict_t *edicts;
edict_t *e;
int i, j;
pr->pr_edictareasize = pr->pr_edict_size * num_edicts;
edicts = Hunk_AllocName (pr->pr_edictareasize, "edicts");
(*pr->edicts) = edicts;
if (pr_deadbeef_ents->int_val) {
memset (edicts, 0, *pr->reserved_edicts * pr->pr_edict_size);
for (j = *pr->reserved_edicts; j < num_edicts; j++) {