mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-02-21 19:20:55 +00:00
fix time changing issue in runstandardplayerphysics.
fix doom-sprites, although their angles still seem to be biased. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5129 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
776b8f6565
commit
d66db9930d
7 changed files with 124 additions and 105 deletions
|
@ -3190,6 +3190,7 @@ static void QCBUILTIN PF_cs_getinputstate (pubprogfuncs_t *prinst, struct global
|
|||
static void QCBUILTIN PF_cs_runplayerphysics (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
unsigned int msecs;
|
||||
float oldtime = *csqcg.simtime;
|
||||
|
||||
csqcedict_t *ent = (void*)G_EDICT(prinst, OFS_PARM0);
|
||||
int mt = ent->v->movetype;
|
||||
|
@ -3274,6 +3275,8 @@ static void QCBUILTIN PF_cs_runplayerphysics (pubprogfuncs_t *prinst, struct glo
|
|||
|
||||
//fixme: touch triggers?
|
||||
World_LinkEdict (&csqc_world, (wedict_t*)ent, true);
|
||||
|
||||
*csqcg.simtime = oldtime;
|
||||
}
|
||||
|
||||
static void QCBUILTIN PF_cs_getentitytoken (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
|
|
|
@ -2454,10 +2454,20 @@ static void R_Sprite_GenerateTrisoup(entity_t *e, int bemode)
|
|||
Vector4Copy(rgba[0], rgba[2]);
|
||||
Vector4Copy(rgba[0], rgba[3]);
|
||||
|
||||
Vector2Set(st[0], 0, 1);
|
||||
Vector2Set(st[1], 0, 0);
|
||||
Vector2Set(st[2], 1, 0);
|
||||
Vector2Set(st[3], 1, 1);
|
||||
if (frame->xmirror)
|
||||
{
|
||||
Vector2Set(st[0], 1, 1);
|
||||
Vector2Set(st[1], 1, 0);
|
||||
Vector2Set(st[2], 0, 0);
|
||||
Vector2Set(st[3], 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2Set(st[0], 0, 1);
|
||||
Vector2Set(st[1], 0, 0);
|
||||
Vector2Set(st[2], 1, 0);
|
||||
Vector2Set(st[3], 1, 1);
|
||||
}
|
||||
|
||||
VectorMA (sprorigin, frame->down, spraxis[2], point);
|
||||
VectorMA (point, frame->left, spraxis[1], xyz[0]);
|
||||
|
|
|
@ -5434,6 +5434,7 @@ static void * Mod_LoadSpriteFrame (model_t *mod, void *pin, void *pend, mspritef
|
|||
pspriteframe->down = origin[1] - height;
|
||||
pspriteframe->left = origin[0];
|
||||
pspriteframe->right = width + origin[0];
|
||||
pspriteframe->xmirror = false;
|
||||
|
||||
dataptr = (pinframe + 1);
|
||||
|
||||
|
@ -5754,6 +5755,7 @@ qboolean QDECL Mod_LoadSprite2Model (model_t *mod, void *buffer, size_t fsize)
|
|||
frame->up = h - origin[1];
|
||||
frame->left = -origin[0];
|
||||
frame->right = w - origin[0];
|
||||
frame->xmirror = false;
|
||||
|
||||
pframetype++;
|
||||
}
|
||||
|
@ -5772,7 +5774,7 @@ typedef struct {
|
|||
short xpos;
|
||||
short ypos;
|
||||
} doomimage_t;
|
||||
static int QDECL FindDoomSprites(const char *name, qofs_t size, void *param, searchpathfuncs_t *spath)
|
||||
static int QDECL FindDoomSprites(const char *name, qofs_t size, time_t mtime, void *param, searchpathfuncs_t *spath)
|
||||
{
|
||||
if (*(int *)param + strlen(name)+1 > 16000)
|
||||
Sys_Error("Too many doom sprites\n");
|
||||
|
@ -5784,18 +5786,8 @@ static int QDECL FindDoomSprites(const char *name, qofs_t size, void *param, sea
|
|||
}
|
||||
|
||||
|
||||
static void LoadDoomSpriteFrame(model_t *mod, char *imagename, mspriteframedesc_t *pdesc, int anglenum, qboolean xmirrored)
|
||||
static void LoadDoomSpriteFrame(model_t *mod, mspriteframe_t frame, mspriteframedesc_t *pdesc, int anglenum)
|
||||
{
|
||||
int c;
|
||||
int fr;
|
||||
int rc;
|
||||
unsigned int *colpointers;
|
||||
qbyte *data;
|
||||
doomimage_t *header;
|
||||
|
||||
qbyte image[256*256];
|
||||
qbyte *palette;
|
||||
qbyte *coldata;
|
||||
mspriteframe_t *pframe;
|
||||
|
||||
if (!anglenum)
|
||||
|
@ -5821,61 +5813,7 @@ static void LoadDoomSpriteFrame(model_t *mod, char *imagename, mspriteframedesc_
|
|||
group->frames[anglenum-1] = pframe;
|
||||
}
|
||||
|
||||
palette = COM_LoadTempFile("wad/playpal");
|
||||
header = (doomimage_t *)COM_LoadTempMoreFile(imagename);
|
||||
data = (qbyte *)header;
|
||||
pframe->up = +header->ypos;
|
||||
pframe->down = -header->height + header->ypos;
|
||||
|
||||
if (xmirrored)
|
||||
{
|
||||
pframe->right = -header->xpos;
|
||||
pframe->left = header->width - header->xpos;
|
||||
}
|
||||
else
|
||||
{
|
||||
pframe->left = -header->xpos;
|
||||
pframe->right = header->width - header->xpos;
|
||||
}
|
||||
|
||||
if (header->width*header->height > sizeof(image))
|
||||
return;
|
||||
|
||||
memset(image, 255, header->width*header->height);
|
||||
colpointers = (unsigned int*)(data+sizeof(doomimage_t));
|
||||
for (c = 0; c < header->width; c++)
|
||||
{
|
||||
if (colpointers[c] >= com_filesize)
|
||||
break;
|
||||
coldata = data + colpointers[c];
|
||||
while(1)
|
||||
{
|
||||
fr = *coldata++;
|
||||
if (fr == 255)
|
||||
break;
|
||||
|
||||
rc = *coldata++;
|
||||
|
||||
coldata++;
|
||||
|
||||
if ((fr+rc) > header->height)
|
||||
break;
|
||||
|
||||
while(rc)
|
||||
{
|
||||
image[c + fr*header->width] = *coldata++;
|
||||
fr++;
|
||||
rc--;
|
||||
}
|
||||
|
||||
coldata++;
|
||||
}
|
||||
}
|
||||
|
||||
pframe->shader = R_RegisterShader(imagename, SUF_NONE,
|
||||
"{\n{\nmap $diffuse\nblendfunc blend\n}\n}\n");
|
||||
pframe->shader->defaulttextures.base = R_LoadTexture8Pal24(imagename, header->width, header->height, image, palette, IF_CLAMP);
|
||||
R_BuildDefaultTexnums(NULL, pframe->shader);
|
||||
*pframe = frame;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5901,6 +5839,16 @@ void Mod_LoadDoomSprite (model_t *mod)
|
|||
int anglenum;
|
||||
|
||||
msprite_t *psprite;
|
||||
unsigned int image[256*256];
|
||||
size_t fsize;
|
||||
qbyte palette[256*4];
|
||||
doomimage_t *header;
|
||||
qbyte *coldata, fr, rc;
|
||||
mspriteframe_t frame;
|
||||
size_t c;
|
||||
unsigned int *colpointers;
|
||||
|
||||
mod->type = mod_dummy;
|
||||
|
||||
|
||||
COM_StripExtension(mod->name, basename, sizeof(basename));
|
||||
|
@ -5938,38 +5886,93 @@ void Mod_LoadDoomSprite (model_t *mod)
|
|||
}
|
||||
}
|
||||
if (elements != numframes*8)
|
||||
Host_Error("Doom sprite has wrong componant count");
|
||||
if (!numframes)
|
||||
Host_Error("Doom sprite componant has no frames");
|
||||
|
||||
size = sizeof (msprite_t) + (elements - 1) * sizeof (psprite->frames);
|
||||
psprite = ZG_Malloc(&mod->memgroup, size);
|
||||
|
||||
psprite->numframes = numframes;
|
||||
|
||||
//do the actual loading.
|
||||
for (ofs = 4; ofs < *(int*)files; ofs+=strlen(files+ofs)+1)
|
||||
Con_Printf("Doom sprite %s has wrong componant count", mod->name);
|
||||
else if (numframes)
|
||||
{
|
||||
name = files+ofs;
|
||||
framenum = name[baselen+0] - 'a';
|
||||
anglenum = name[baselen+1] - '0';
|
||||
size = sizeof (msprite_t) + (elements - 1) * sizeof (psprite->frames);
|
||||
psprite = ZG_Malloc(&mod->memgroup, size);
|
||||
|
||||
LoadDoomSpriteFrame(mod, name, &psprite->frames[framenum], anglenum, false);
|
||||
psprite->numframes = numframes;
|
||||
|
||||
if (name[baselen+2]) //is there a second element?
|
||||
{
|
||||
framenum = name[baselen+2] - 'a';
|
||||
anglenum = name[baselen+3] - '0';
|
||||
|
||||
LoadDoomSpriteFrame(mod, name, &psprite->frames[framenum], anglenum, true);
|
||||
memset(&frame, 0, sizeof(frame));
|
||||
coldata = FS_LoadMallocFile("wad/playpal", &fsize);
|
||||
if (coldata && fsize >= 256*3)
|
||||
{ //expand to 32bit.
|
||||
for (ofs = 0; ofs < 256; ofs++)
|
||||
{
|
||||
palette[ofs*4+0] = coldata[ofs*3+0];
|
||||
palette[ofs*4+1] = coldata[ofs*3+1];
|
||||
palette[ofs*4+2] = coldata[ofs*3+2];
|
||||
palette[ofs*4+3] = 255;
|
||||
}
|
||||
}
|
||||
Z_Free(coldata);
|
||||
|
||||
//do the actual loading.
|
||||
for (ofs = 4; ofs < *(int*)files; ofs+=strlen(files+ofs)+1)
|
||||
{
|
||||
name = files+ofs;
|
||||
|
||||
header = (doomimage_t *)FS_LoadMallocFile(name, &fsize);
|
||||
|
||||
frame.up = +header->ypos;
|
||||
frame.down = -header->height + header->ypos;
|
||||
frame.left = -header->xpos;
|
||||
frame.right = header->width - header->xpos;
|
||||
|
||||
|
||||
if (header->width*header->height <= sizeof(image))
|
||||
{
|
||||
//anything not written will be transparent.
|
||||
memset(image, 0, header->width*header->height*4);
|
||||
colpointers = (unsigned int*)(header+1);
|
||||
for (c = 0; c < header->width; c++)
|
||||
{
|
||||
coldata = (qbyte *)header + colpointers[c];
|
||||
while(1)
|
||||
{
|
||||
fr = *coldata++;
|
||||
if (fr == 255)
|
||||
break;
|
||||
rc = *coldata++;
|
||||
coldata++;
|
||||
if ((fr+rc) > header->height)
|
||||
break;
|
||||
while(rc)
|
||||
{
|
||||
image[c + fr*header->width] = ((unsigned int*)palette)[*coldata++];
|
||||
fr++;
|
||||
rc--;
|
||||
}
|
||||
coldata++;
|
||||
}
|
||||
}
|
||||
frame.image = Image_GetTexture(name, NULL, IF_CLAMP|IF_NOREPLACE, image, palette, header->width, header->height, TF_RGBA32);
|
||||
Z_Free(header);
|
||||
}
|
||||
|
||||
|
||||
framenum = name[baselen+0] - 'a';
|
||||
anglenum = name[baselen+1] - '0';
|
||||
frame.xmirror = false;
|
||||
LoadDoomSpriteFrame(mod, frame, &psprite->frames[framenum], anglenum);
|
||||
|
||||
if (name[baselen+2]) //is there a second element?
|
||||
{
|
||||
framenum = name[baselen+2] - 'a';
|
||||
anglenum = name[baselen+3] - '0';
|
||||
frame.xmirror = true;
|
||||
LoadDoomSpriteFrame(mod, frame, &psprite->frames[framenum], anglenum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
psprite->type = SPR_FACING_UPRIGHT;
|
||||
mod->numframes = numframes;
|
||||
mod->type = mod_sprite;
|
||||
|
||||
mod->meshinfo = psprite;
|
||||
}
|
||||
|
||||
|
||||
psprite->type = SPR_FACING_UPRIGHT;
|
||||
mod->type = mod_sprite;
|
||||
|
||||
mod->meshinfo = psprite;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -554,6 +554,7 @@ SPRITE MODELS
|
|||
typedef struct mspriteframe_s
|
||||
{
|
||||
float up, down, left, right;
|
||||
qboolean xmirror;
|
||||
shader_t *shader;
|
||||
image_t *image;
|
||||
} mspriteframe_t;
|
||||
|
|
|
@ -1159,8 +1159,10 @@ static void R_RecursiveDoomNode(doommap_t *dm, unsigned int node)
|
|||
R_RecursiveDoomNode(dm, dm->node[node].node2);
|
||||
}
|
||||
|
||||
void R_DoomWorld(doommap_t *dm)
|
||||
void R_DoomWorld(void)
|
||||
{
|
||||
model_t *mod = cl.worldmodel;
|
||||
doommap_t *dm = mod->meshinfo;
|
||||
int texnum;
|
||||
doomtexture_t *t;
|
||||
if (!dm->node || !dm->numnodes)
|
||||
|
@ -1175,14 +1177,14 @@ void R_DoomWorld(doommap_t *dm)
|
|||
r_visframecount++;
|
||||
R_RecursiveDoomNode(dm, dm->numnodes-1);
|
||||
|
||||
memset(cl.worldmodel->batches, 0, sizeof(cl.worldmodel->batches));
|
||||
memset(mod->batches, 0, sizeof(mod->batches));
|
||||
for (texnum = 0; texnum < dm->numtextures; texnum++) //a hash table might be a good plan.
|
||||
{
|
||||
t = &dm->textures[texnum];
|
||||
if (t->mesh.numindexes && t->shader)
|
||||
{
|
||||
t->batch.next = cl.worldmodel->batches[t->shader->sort];
|
||||
cl.worldmodel->batches[t->shader->sort] = &t->batch;
|
||||
t->batch.next = mod->batches[t->shader->sort];
|
||||
mod->batches[t->shader->sort] = &t->batch;
|
||||
|
||||
BE_DrawMesh_Single(t->shader, &t->mesh, NULL, 0);
|
||||
}
|
||||
|
|
|
@ -10440,7 +10440,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
|||
{"particleeffectnum",PF_sv_particleeffectnum,0,0,0, 335, D("float(string effectname)", "Precaches the named particle effect. If your effect name is of the form 'foo.bar' then particles/foo.cfg will be loaded by the client if foo.bar was not already defined.\nDifferent engines will have different particle systems, this specifies the QC API only.")},// (EXT_CSQC)
|
||||
{"trailparticles", PF_sv_trailparticles,0,0, 0, 336, D("void(float effectnum, entity ent, vector start, vector end)", "Draws the given effect between the two named points. If ent is not world, distances will be cached in the entity in order to avoid framerate dependancies. The entity is not otherwise used.")},// (EXT_CSQC),
|
||||
// {"trailparticles_dp",PF_sv_trailparticles,0,0, 0, 336, D("void(entity ent, float effectnum, vector start, vector end)", "DarkPlaces got the argument order wrong, and failed to fix it due to apathy.")},// (EXT_CSQC),
|
||||
{"pointparticles", PF_sv_pointparticles,0,0, 0, 337, D("void(float effectnum, vector origin, optional vector dir, optional float count)", "Spawn a load of particles from the given effect at the given point traveling or aiming along the direction specified. The number of particles are scaled by the count argument.")},// (EXT_CSQC)
|
||||
{"pointparticles", PF_sv_pointparticles,0,0, 0, 337, D("void(float effectnum, vector origin, optional vector dir, optional float count)", "Spawn a load of particles from the given effect at the given point traveling or aiming along the direction specified. The number of particles are scaled by the count argument.\nFor regular particles, the dir vector is multiplied by the 'veladd' property (while orgadd will push the particles along it). Decals will use it as a hint to align to the correct surface. In both cases, it should normally be a unit vector, but other lengths will still work. If it has length 0 then FTE will assume downwards.")},// (EXT_CSQC)
|
||||
|
||||
{"cprint", PF_Fixme, 0, 0, 0, 338, D("void(string s, ...)", "Print into the center of the screen just as ssqc's centerprint would appear.")},//(EXT_CSQC)
|
||||
{"print", PF_print, 0, 0, 0, 339, D("void(string s, ...)", "Unconditionally print on the local system's console, even in ssqc (doesn't care about the value of the developer cvar).")},//(EXT_CSQC)
|
||||
|
|
|
@ -153,7 +153,7 @@ void(vector pos, float value, float threshhold) Hud_DrawLargeValue =
|
|||
{
|
||||
len-=1;
|
||||
c = str2chr(s, len);
|
||||
drawpic(pos+len * '24 0 0', sprintf("anum_%g, c-'0'), '24 24 0', '1 1 1', 1, 0);
|
||||
drawpic(pos+len * '24 0 0', sprintf("anum_%g", c-'0'), '24 24 0', '1 1 1', 1, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -163,7 +163,7 @@ void(vector pos, float value, float threshhold) Hud_DrawLargeValue =
|
|||
{
|
||||
len-=1;
|
||||
c = str2chr(s, len);
|
||||
drawpic(pos+len * '24 0 0', sprintf("num_%g, c-'0'), '24 24 0', '1 1 1', 1, 0);
|
||||
drawpic(pos+len * '24 0 0', sprintf("num_%g", c-'0'), '24 24 0', '1 1 1', 1, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue