Fix up a couple of functions to adhere better to unwritten code formatting standards. Should be zero functional changes in terms of what the functions actually do.

git-svn-id: https://svn.eduke32.com/eduke32@3983 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2013-08-06 23:51:51 +00:00
parent a97c8c1bfd
commit c34410b7ed
3 changed files with 47 additions and 57 deletions

View file

@ -4268,24 +4268,21 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, i
static void G_OROR_DupeSprites(void) static void G_OROR_DupeSprites(void)
{ {
// dupe the sprites touching the portal to the other sector // dupe the sprites touching the portal to the other sector
// viewing from bottom
if (ror_sprite != -1) int32_t k;
{
spritetype *sp = &sprite[ror_sprite]; spritetype *sp = &sprite[ror_sprite];
// viewing from bottom if ((unsigned) ror_sprite >= MAXSPRITES || drawing_ror != 1)
if (drawing_ror == 1) return;
{
int32_t k;
for (k=headspritesect[sp->sectnum]; k != -1; k=nextspritesect[k]) for (k = headspritesect[sp->sectnum]; k != -1; k = nextspritesect[k])
{ {
if (sprite[k].picnum != SECTOREFFECTOR && (sprite[k].z >= sp->z)) if (sprite[k].picnum != SECTOREFFECTOR && (sprite[k].z >= sp->z))
{ {
Bmemcpy(&tsprite[spritesortcnt], &sprite[k], sizeof(spritetype)); Bmemcpy(&tsprite[spritesortcnt], &sprite[k], sizeof(spritetype));
tsprite[spritesortcnt].x += (sprite[sp->yvel].x-sp->x); tsprite[spritesortcnt].x += (sprite[sp->yvel].x - sp->x);
tsprite[spritesortcnt].y += (sprite[sp->yvel].y-sp->y); tsprite[spritesortcnt].y += (sprite[sp->yvel].y - sp->y);
tsprite[spritesortcnt].z = tsprite[spritesortcnt].z - sp->z + actor[sp->yvel].ceilingz; tsprite[spritesortcnt].z = tsprite[spritesortcnt].z - sp->z + actor[sp->yvel].ceilingz;
tsprite[spritesortcnt].sectnum = sprite[sp->yvel].sectnum; tsprite[spritesortcnt].sectnum = sprite[sp->yvel].sectnum;
tsprite[spritesortcnt].owner = k; tsprite[spritesortcnt].owner = k;
@ -4294,8 +4291,6 @@ static void G_OROR_DupeSprites(void)
spritesortcnt++; spritesortcnt++;
} }
} }
}
}
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL
@ -4303,10 +4298,8 @@ static void G_ReadGLFrame(void)
{ {
// Save OpenGL screenshot with Duke3D palette // Save OpenGL screenshot with Duke3D palette
// NOTE: maybe need to move this to the engine... // NOTE: maybe need to move this to the engine...
begindrawing(); palette_t *const frame = (palette_t *const) Bcalloc(xdim * ydim, sizeof(palette_t));
{ char *const pic = (char *) waloff[TILE_SAVESHOT];
palette_t *const frame = (palette_t *const)Bcalloc(xdim*ydim, 4);
char *const pic = (char *)waloff[TILE_SAVESHOT];
int32_t x, y; int32_t x, y;
const int32_t xf = divscale16(xdim, 320); // (xdim<<16)/320 const int32_t xf = divscale16(xdim, 320); // (xdim<<16)/320
@ -4314,27 +4307,26 @@ static void G_ReadGLFrame(void)
if (!frame) if (!frame)
{ {
Bmemset(pic, 0, 320*200); Bmemset(pic, 0, 320 * 200);
return;
} }
else
{
bglReadPixels(0,0,xdim,ydim,GL_RGBA,GL_UNSIGNED_BYTE,frame);
for (y=0; y<200; y++) begindrawing();
{ bglReadPixels(0, 0, xdim, ydim, GL_RGBA, GL_UNSIGNED_BYTE, frame);
const int32_t base = mulscale16(200-y-1, yf)*xdim; enddrawing();
for (x=0; x<320; x++) for (y = 0; y < 200; y++)
{
const int32_t base = mulscale16(200 - y - 1, yf)*xdim;
for (x = 0; x < 320; x++)
{ {
const palette_t *pix = &frame[base + mulscale16(x, xf)]; const palette_t *pix = &frame[base + mulscale16(x, xf)];
pic[320*y + x] = getclosestcol(pix->r>>2, pix->g>>2, pix->b>>2); pic[320 * y + x] = getclosestcol(pix->r >> 2, pix->g >> 2, pix->b >> 2);
} }
} }
Bfree(frame); Bfree(frame);
}
}
enddrawing();
} }
#endif #endif

View file

@ -105,14 +105,14 @@ void VM_ScriptInfo(void)
static void VM_KillIt(int32_t iActor, int32_t iPlayer) static void VM_KillIt(int32_t iActor, int32_t iPlayer)
{ {
if (iActor >= 0) if ((unsigned) iActor >= MAXSPRITES)
{ return;
// if player was set to squish, first stop that... // if player was set to squish, first stop that...
if (iPlayer >= 0 && g_player[iPlayer].ps->actorsqu == iActor) if (iPlayer >= 0 && g_player[iPlayer].ps->actorsqu == iActor)
g_player[iPlayer].ps->actorsqu = -1; g_player[iPlayer].ps->actorsqu = -1;
A_DeleteSprite(iActor); A_DeleteSprite(iActor);
}
} }
// May recurse, e.g. through EVENT_XXX -> ... -> EVENT_KILLIT // May recurse, e.g. through EVENT_XXX -> ... -> EVENT_KILLIT

View file

@ -4230,9 +4230,7 @@ void P_UpdatePosWhenViewingCam(DukePlayer_t *p)
{ {
int32_t i = p->newowner; int32_t i = p->newowner;
p->pos.x = SX; Bmemcpy(&p->pos.x, &sprite[i].x, sizeof(vec3_t));
p->pos.y = SY;
p->pos.z = SZ;
p->ang = SA; p->ang = SA;
p->vel.x = p->vel.y = sprite[p->i].xvel = 0; p->vel.x = p->vel.y = sprite[p->i].xvel = 0;
p->look_ang = 0; p->look_ang = 0;