From: dresk Date: Tue, 24 Jul 2007 03:50:38 +0000 (+0000) Subject: Added the map name (ie. "The Grisly Grotto") to the world.message field string in... X-Git-Tag: xonotic-v0.1.0preview~2971 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c26da8b8c9d29251ebbff484ed9af3392e651e69;p=xonotic%2Fdarkplaces.git Added the map name (ie. "The Grisly Grotto") to the world.message field string in CSQC (you will have to define .string message somewhere in your QC code to access it) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7494 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/csprogs.c b/csprogs.c index 26aa822a..6ef012e7 100644 --- a/csprogs.c +++ b/csprogs.c @@ -539,6 +539,7 @@ void CL_VM_Init (void) fs_offset_t csprogsdatasize; int csprogsdatacrc, requiredcrc; int requiredsize; + prvm_eval_t *val; // reset csqc_progcrc after reading it, so that changing servers doesn't // expect csqc on the next server @@ -636,6 +637,11 @@ void CL_VM_Init (void) prog->globals.client->mapname = PRVM_SetEngineString(cl.worldmodel->name); prog->globals.client->player_localentnum = cl.playerentity; + // set map description (use world entity 0) + val = PRVM_EDICTFIELDVALUE(prog->edicts, prog->fieldoffsets.message); + if(val) + val->string = PRVM_SetEngineString(cl.levelname); + // call the prog init PRVM_ExecuteProgram(prog->funcoffsets.CSQC_Init, "QC function CSQC_Init is missing"); diff --git a/progsvm.h b/progsvm.h index f2fe16bc..226a6120 100644 --- a/progsvm.h +++ b/progsvm.h @@ -185,6 +185,7 @@ typedef struct prvm_prog_fieldoffsets_s int items2; // ssqc int lerpfrac; // csqc int light_lev; // ssqc + int message; // csqc int modelflags; // ssqc int movement; // ssqc int nextthink; // common - used by OP_STATE diff --git a/prvm_edict.c b/prvm_edict.c index bec4765f..22bf8846 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -1378,6 +1378,7 @@ void PRVM_FindOffsets(void) prog->fieldoffsets.items2 = PRVM_ED_FindFieldOffset("items2"); prog->fieldoffsets.lerpfrac = PRVM_ED_FindFieldOffset("lerpfrac"); prog->fieldoffsets.light_lev = PRVM_ED_FindFieldOffset("light_lev"); + prog->fieldoffsets.message = PRVM_ED_FindFieldOffset("message"); prog->fieldoffsets.modelflags = PRVM_ED_FindFieldOffset("modelflags"); prog->fieldoffsets.movement = PRVM_ED_FindFieldOffset("movement"); prog->fieldoffsets.netaddress = PRVM_ED_FindFieldOffset("netaddress");