mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Polymer lighting tweaks, mostly internal.
git-svn-id: https://svn.eduke32.com/eduke32@5496 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
0075e746ba
commit
1d17d2c6f6
6 changed files with 157 additions and 148 deletions
|
@ -779,7 +779,7 @@ static void A_MoveSector(int i)
|
||||||
#define LIGHTRAD (s->yrepeat * tilesiz[s->picnum + LIGHTRAD_PICOFS].y)
|
#define LIGHTRAD (s->yrepeat * tilesiz[s->picnum + LIGHTRAD_PICOFS].y)
|
||||||
#define LIGHTRAD2 ((s->yrepeat + ((rand() % s->yrepeat)>>2)) * tilesiz[s->picnum + LIGHTRAD_PICOFS].y)
|
#define LIGHTRAD2 ((s->yrepeat + ((rand() % s->yrepeat)>>2)) * tilesiz[s->picnum + LIGHTRAD_PICOFS].y)
|
||||||
|
|
||||||
void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, int32_t range, int32_t color, int32_t priority)
|
void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, int32_t range, int32_t color, int32_t priority, int32_t smoothratio)
|
||||||
{
|
{
|
||||||
#ifdef POLYMER
|
#ifdef POLYMER
|
||||||
spritetype *s = &sprite[srcsprite];
|
spritetype *s = &sprite[srcsprite];
|
||||||
|
@ -798,6 +798,11 @@ void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, int32_t
|
||||||
mylight.x = s->x;
|
mylight.x = s->x;
|
||||||
mylight.y = s->y;
|
mylight.y = s->y;
|
||||||
mylight.z = s->z - zoffset;
|
mylight.z = s->z - zoffset;
|
||||||
|
|
||||||
|
mylight.x -= mulscale16(65536-smoothratio, s->x-actor[srcsprite].bpos.x);
|
||||||
|
mylight.y -= mulscale16(65536-smoothratio, s->y-actor[srcsprite].bpos.y);
|
||||||
|
mylight.z -= mulscale16(65536-smoothratio, s->z-actor[srcsprite].bpos.z);
|
||||||
|
|
||||||
mylight.color[0] = color & 255;
|
mylight.color[0] = color & 255;
|
||||||
mylight.color[1] = (color >> 8) & 255;
|
mylight.color[1] = (color >> 8) & 255;
|
||||||
mylight.color[2] = (color >> 16) & 255;
|
mylight.color[2] = (color >> 16) & 255;
|
||||||
|
@ -2700,9 +2705,6 @@ ACTOR_STATIC void Proj_MoveCustom(int32_t i)
|
||||||
case PROJECTILE_RPG:
|
case PROJECTILE_RPG:
|
||||||
Bmemcpy(&davect, s, sizeof(vec3_t));
|
Bmemcpy(&davect, s, sizeof(vec3_t));
|
||||||
|
|
||||||
if (proj->flashcolor)
|
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 2048, proj->flashcolor, PR_LIGHT_PRIO_LOW_GAME);
|
|
||||||
|
|
||||||
if (proj->workslike & PROJECTILE_BOUNCESOFFWALLS && s->yvel < 1)
|
if (proj->workslike & PROJECTILE_BOUNCESOFFWALLS && s->yvel < 1)
|
||||||
{
|
{
|
||||||
A_DoProjectileEffects(i, NULL, 1);
|
A_DoProjectileEffects(i, NULL, 1);
|
||||||
|
@ -7925,7 +7927,7 @@ static void G_DoEffectorLights(void) // STATNUM 14
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef POLYMER
|
#ifdef POLYMER
|
||||||
static void A_DoLight(int32_t i)
|
static void A_DoLight(int32_t i, int32_t smoothratio)
|
||||||
{
|
{
|
||||||
spritetype *const s = &sprite[i];
|
spritetype *const s = &sprite[i];
|
||||||
int32_t numsavedfires = 0;
|
int32_t numsavedfires = 0;
|
||||||
|
@ -7992,7 +7994,7 @@ static void A_DoLight(int32_t i)
|
||||||
goto POOP;
|
goto POOP;
|
||||||
|
|
||||||
G_AddGameLight(0, i, (s->yrepeat*tilesiz[s->picnum].y)<<1, 512-ii*128,
|
G_AddGameLight(0, i, (s->yrepeat*tilesiz[s->picnum].y)<<1, 512-ii*128,
|
||||||
ii==0 ? (172+(200<<8)+(104<<16)) : 216+(52<<8)+(20<<16), PR_LIGHT_PRIO_LOW);
|
ii==0 ? (172+(200<<8)+(104<<16)) : 216+(52<<8)+(20<<16), PR_LIGHT_PRIO_LOW, smoothratio);
|
||||||
|
|
||||||
POOP:
|
POOP:
|
||||||
s->x -= d.x;
|
s->x -= d.x;
|
||||||
|
@ -8005,7 +8007,7 @@ static void A_DoLight(int32_t i)
|
||||||
switch (DYNAMICTILEMAP(s->picnum))
|
switch (DYNAMICTILEMAP(s->picnum))
|
||||||
{
|
{
|
||||||
case ATOMICHEALTH__STATIC:
|
case ATOMICHEALTH__STATIC:
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD2, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD2, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME, smoothratio);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FIRE__STATIC:
|
case FIRE__STATIC:
|
||||||
|
@ -8039,7 +8041,7 @@ static void A_DoLight(int32_t i)
|
||||||
if (jj==-1 && numsavedfires<32)
|
if (jj==-1 && numsavedfires<32)
|
||||||
{
|
{
|
||||||
jj = numsavedfires;
|
jj = numsavedfires;
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD2, color, PR_LIGHT_PRIO_HIGH_GAME);
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD2, color, PR_LIGHT_PRIO_HIGH_GAME, smoothratio);
|
||||||
savedfires[jj][0] = s->sectnum;
|
savedfires[jj][0] = s->sectnum;
|
||||||
savedfires[jj][1] = s->x>>3;
|
savedfires[jj][1] = s->x>>3;
|
||||||
savedfires[jj][2] = s->y>>3;
|
savedfires[jj][2] = s->y>>3;
|
||||||
|
@ -8051,12 +8053,12 @@ static void A_DoLight(int32_t i)
|
||||||
|
|
||||||
case OOZFILTER__STATIC:
|
case OOZFILTER__STATIC:
|
||||||
if (s->xrepeat > 4)
|
if (s->xrepeat > 4)
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 4096, 176+(252<<8)+(120<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 4096, 176+(252<<8)+(120<<16),PR_LIGHT_PRIO_HIGH_GAME, smoothratio);
|
||||||
break;
|
break;
|
||||||
case FLOORFLAME__STATIC:
|
case FLOORFLAME__STATIC:
|
||||||
case FIREBARREL__STATIC:
|
case FIREBARREL__STATIC:
|
||||||
case FIREVASE__STATIC:
|
case FIREVASE__STATIC:
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<2), LIGHTRAD2>>1, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<2), LIGHTRAD2>>1, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME, smoothratio);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPLOSION2__STATIC:
|
case EXPLOSION2__STATIC:
|
||||||
|
@ -8070,7 +8072,7 @@ static void A_DoLight(int32_t i)
|
||||||
s->y -= y;
|
s->y -= y;
|
||||||
|
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD, 240+(160<<8)+(80<<16),
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD, 240+(160<<8)+(80<<16),
|
||||||
s->yrepeat > 32 ? PR_LIGHT_PRIO_HIGH_GAME : PR_LIGHT_PRIO_LOW_GAME);
|
s->yrepeat > 32 ? PR_LIGHT_PRIO_HIGH_GAME : PR_LIGHT_PRIO_LOW_GAME, smoothratio);
|
||||||
|
|
||||||
s->x += x;
|
s->x += x;
|
||||||
s->y += y;
|
s->y += y;
|
||||||
|
@ -8078,7 +8080,7 @@ static void A_DoLight(int32_t i)
|
||||||
break;
|
break;
|
||||||
case FORCERIPPLE__STATIC:
|
case FORCERIPPLE__STATIC:
|
||||||
case TRANSPORTERBEAM__STATIC:
|
case TRANSPORTERBEAM__STATIC:
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD, 80+(80<<8)+(255<<16),PR_LIGHT_PRIO_LOW_GAME);
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD, 80+(80<<8)+(255<<16),PR_LIGHT_PRIO_LOW_GAME, smoothratio);
|
||||||
break;
|
break;
|
||||||
case GROWSPARK__STATIC:
|
case GROWSPARK__STATIC:
|
||||||
{
|
{
|
||||||
|
@ -8088,7 +8090,7 @@ static void A_DoLight(int32_t i)
|
||||||
s->x -= x;
|
s->x -= x;
|
||||||
s->y -= y;
|
s->y -= y;
|
||||||
|
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 1024, 216+(52<<8)+(20<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 1024, 216+(52<<8)+(20<<16),PR_LIGHT_PRIO_HIGH_GAME, smoothratio);
|
||||||
|
|
||||||
s->x += x;
|
s->x += x;
|
||||||
s->y += y;
|
s->y += y;
|
||||||
|
@ -8102,27 +8104,27 @@ static void A_DoLight(int32_t i)
|
||||||
s->x -= x;
|
s->x -= x;
|
||||||
s->y -= y;
|
s->y -= y;
|
||||||
|
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 2048, 176+(252<<8)+(120<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 2048, 176+(252<<8)+(120<<16),PR_LIGHT_PRIO_HIGH_GAME, smoothratio);
|
||||||
|
|
||||||
s->x += x;
|
s->x += x;
|
||||||
s->y += y;
|
s->y += y;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FREEZEBLAST__STATIC:
|
case FREEZEBLAST__STATIC:
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD<<2, 72+(88<<8)+(140<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD<<2, 72+(88<<8)+(140<<16),PR_LIGHT_PRIO_HIGH_GAME, smoothratio);
|
||||||
break;
|
break;
|
||||||
case COOLEXPLOSION1__STATIC:
|
case COOLEXPLOSION1__STATIC:
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD<<2, 128+(0<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD<<2, 128+(0<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME, smoothratio);
|
||||||
break;
|
break;
|
||||||
case SHRINKSPARK__STATIC:
|
case SHRINKSPARK__STATIC:
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD, 176+(252<<8)+(120<<16),PR_LIGHT_PRIO_HIGH_GAME);
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), LIGHTRAD, 176+(252<<8)+(120<<16),PR_LIGHT_PRIO_HIGH_GAME, smoothratio);
|
||||||
break;
|
break;
|
||||||
case FIRELASER__STATIC:
|
case FIRELASER__STATIC:
|
||||||
if (s->statnum == STAT_PROJECTILE)
|
if (s->statnum == STAT_PROJECTILE)
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME);
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 64 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME, smoothratio);
|
||||||
break;
|
break;
|
||||||
case RPG__STATIC:
|
case RPG__STATIC:
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 128 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME);
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 128 * s->yrepeat, 255+(95<<8),PR_LIGHT_PRIO_LOW_GAME, smoothratio);
|
||||||
break;
|
break;
|
||||||
case SHOTSPARK1__STATIC:
|
case SHOTSPARK1__STATIC:
|
||||||
if (actor[i].t_data[2] == 0) // check for first frame of action
|
if (actor[i].t_data[2] == 0) // check for first frame of action
|
||||||
|
@ -8133,13 +8135,62 @@ static void A_DoLight(int32_t i)
|
||||||
s->x -= x;
|
s->x -= x;
|
||||||
s->y -= y;
|
s->y -= y;
|
||||||
|
|
||||||
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 8 * s->yrepeat, 240+(160<<8)+(80<<16),PR_LIGHT_PRIO_LOW_GAME);
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 8 * s->yrepeat, 240+(160<<8)+(80<<16),PR_LIGHT_PRIO_LOW_GAME, smoothratio);
|
||||||
actor[i].lightcount = 1;
|
actor[i].lightcount = 1;
|
||||||
|
|
||||||
s->x += x;
|
s->x += x;
|
||||||
s->y += y;
|
s->y += y;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case APLAYER__STATIC:
|
||||||
|
{
|
||||||
|
int const snum = sprite[i].yvel;
|
||||||
|
DukePlayer_t *p = g_player[snum].ps;
|
||||||
|
|
||||||
|
if (!(PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_NOVISIBLE) && p->kickback_pic && P_WeaponState(snum, 0))
|
||||||
|
{
|
||||||
|
spritetype *s = &sprite[p->i];
|
||||||
|
int32_t x = ((sintable[(s->ang + 512) & 2047]) >> 7), y = ((sintable[(s->ang) & 2047]) >> 7);
|
||||||
|
|
||||||
|
s->x += x;
|
||||||
|
s->y += y;
|
||||||
|
|
||||||
|
G_AddGameLight(0, p->i, PHEIGHT, 8192, PWEAPON(snum, p->curr_weapon, FlashColor), PR_LIGHT_PRIO_MAX_GAME, smoothratio);
|
||||||
|
actor[p->i].lightcount = 2;
|
||||||
|
|
||||||
|
s->x -= x;
|
||||||
|
s->y -= y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_GLOWS)
|
||||||
|
{
|
||||||
|
if (p->kickback_pic == 0)
|
||||||
|
{
|
||||||
|
spritetype *s = &sprite[p->i];
|
||||||
|
int32_t x = ((sintable[(s->ang+512)&2047])>>7), y = ((sintable[(s->ang)&2047])>>7);
|
||||||
|
int32_t r = 1024+(sintable[p->random_club_frame&2047]>>3);
|
||||||
|
|
||||||
|
s->x += x;
|
||||||
|
s->y += y;
|
||||||
|
|
||||||
|
G_AddGameLight(0, p->i, PHEIGHT, max(r, 0), PWEAPON(snum, p->curr_weapon, FlashColor), PR_LIGHT_PRIO_HIGH_GAME, smoothratio);
|
||||||
|
actor[p->i].lightcount = 2;
|
||||||
|
|
||||||
|
s->x -= x;
|
||||||
|
s->y -= y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (s->statnum == STAT_PROJECTILE)
|
||||||
|
{
|
||||||
|
projectile_t *proj = &SpriteProjectile[i];
|
||||||
|
|
||||||
|
if ((proj->workslike & PROJECTILE_TYPE_MASK) == PROJECTILE_RPG && proj->flashcolor)
|
||||||
|
G_AddGameLight(0, i, ((s->yrepeat*tilesiz[s->picnum].y)<<1), 2048, proj->flashcolor, PR_LIGHT_PRIO_LOW_GAME, smoothratio);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8258,7 +8309,7 @@ int32_t A_CheckSwitchTile(int32_t i)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_RefreshLights(void)
|
void G_RefreshLights(int32_t smoothratio)
|
||||||
{
|
{
|
||||||
#ifdef POLYMER
|
#ifdef POLYMER
|
||||||
if (Numsprites && getrendermode() == REND_POLYMER)
|
if (Numsprites && getrendermode() == REND_POLYMER)
|
||||||
|
@ -8271,7 +8322,7 @@ void G_RefreshLights(void)
|
||||||
|
|
||||||
while (i >= 0)
|
while (i >= 0)
|
||||||
{
|
{
|
||||||
A_DoLight(i);
|
A_DoLight(i, smoothratio);
|
||||||
i = nextspritestat[i];
|
i = nextspritestat[i];
|
||||||
}
|
}
|
||||||
} while (k < MAXSTATUS);
|
} while (k < MAXSTATUS);
|
||||||
|
@ -8365,7 +8416,7 @@ void G_MoveWorld(void)
|
||||||
} while (k < MAXSTATUS);
|
} while (k < MAXSTATUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_RefreshLights();
|
// G_RefreshLights();
|
||||||
G_DoSectorAnimations();
|
G_DoSectorAnimations();
|
||||||
G_MoveFX(); //ST 11
|
G_MoveFX(); //ST 11
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,11 +311,11 @@ void A_PlayAlertSound(int32_t i);
|
||||||
void A_RadiusDamage(int32_t i,int32_t r,int32_t hp1,int32_t hp2,int32_t hp3,int32_t hp4);
|
void A_RadiusDamage(int32_t i,int32_t r,int32_t hp1,int32_t hp2,int32_t hp3,int32_t hp4);
|
||||||
void A_SpawnMultiple(int32_t sp,int32_t pic,int32_t n);
|
void A_SpawnMultiple(int32_t sp,int32_t pic,int32_t n);
|
||||||
|
|
||||||
void G_AddGameLight(int32_t radius,int32_t srcsprite,int32_t zoffset,int32_t range,int32_t color,int32_t priority);
|
void G_AddGameLight(int32_t radius,int32_t srcsprite,int32_t zoffset,int32_t range,int32_t color,int32_t priority, int32_t smoothratio);
|
||||||
void G_ClearCameraView(DukePlayer_t *ps);
|
void G_ClearCameraView(DukePlayer_t *ps);
|
||||||
void G_DoInterpolations(int32_t smoothratio);
|
void G_DoInterpolations(int32_t smoothratio);
|
||||||
void G_MoveWorld(void);
|
void G_MoveWorld(void);
|
||||||
void G_RefreshLights(void);
|
void G_RefreshLights(int32_t smoothratio);
|
||||||
int32_t G_SetInterpolation(int32_t * const posptr);
|
int32_t G_SetInterpolation(int32_t * const posptr);
|
||||||
void G_StopInterpolation(int32_t * const posptr);
|
void G_StopInterpolation(int32_t * const posptr);
|
||||||
|
|
||||||
|
|
|
@ -4484,6 +4484,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
||||||
|
|
||||||
CAMERA(sect) = p->cursectnum;
|
CAMERA(sect) = p->cursectnum;
|
||||||
|
|
||||||
|
G_RefreshLights(smoothratio);
|
||||||
G_DoInterpolations(smoothratio);
|
G_DoInterpolations(smoothratio);
|
||||||
G_AnimateCamSprite(smoothratio);
|
G_AnimateCamSprite(smoothratio);
|
||||||
|
|
||||||
|
@ -5919,7 +5920,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
||||||
case EXPLOSION2__STATIC:
|
case EXPLOSION2__STATIC:
|
||||||
if (sp->yrepeat > 32)
|
if (sp->yrepeat > 32)
|
||||||
{
|
{
|
||||||
G_AddGameLight(0, i, ((sp->yrepeat*tilesiz[sp->picnum].y)<<1), 32768, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME);
|
G_AddGameLight(0, i, ((sp->yrepeat*tilesiz[sp->picnum].y)<<1), 32768, 255+(95<<8),PR_LIGHT_PRIO_MAX_GAME, 65536);
|
||||||
actor[i].lightcount = 2;
|
actor[i].lightcount = 2;
|
||||||
}
|
}
|
||||||
case EXPLOSION2BOT__STATIC:
|
case EXPLOSION2BOT__STATIC:
|
||||||
|
|
|
@ -2925,7 +2925,7 @@ static void M_MenuEntryOptionDidModify(MenuEntry_t *entry)
|
||||||
if (setgamemode(fullscreen, xdim, ydim, bpp))
|
if (setgamemode(fullscreen, xdim, ydim, bpp))
|
||||||
OSD_Printf("restartvid: Reset failed...\n");
|
OSD_Printf("restartvid: Reset failed...\n");
|
||||||
onvideomodechange(ud.config.ScreenBPP>8);
|
onvideomodechange(ud.config.ScreenBPP>8);
|
||||||
G_RefreshLights();
|
G_RefreshLights(65536);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -876,20 +876,6 @@ static int32_t A_ShootCustom(const int32_t i, const int32_t atwith, int16_t sa,
|
||||||
const int32_t p = (s->picnum == APLAYER) ? P_GetP(s) : -1;
|
const int32_t p = (s->picnum == APLAYER) ? P_GetP(s) : -1;
|
||||||
DukePlayer_t *const ps = p >= 0 ? g_player[p].ps : NULL;
|
DukePlayer_t *const ps = p >= 0 ? g_player[p].ps : NULL;
|
||||||
|
|
||||||
#ifdef POLYMER
|
|
||||||
if (getrendermode() == REND_POLYMER && proj->flashcolor)
|
|
||||||
{
|
|
||||||
int32_t x = ((sintable[(s->ang + 512) & 2047]) >> 7), y = ((sintable[(s->ang) & 2047]) >> 7);
|
|
||||||
|
|
||||||
s->x += x;
|
|
||||||
s->y += y;
|
|
||||||
G_AddGameLight(0, i, PHEIGHT, 8192, proj->flashcolor, PR_LIGHT_PRIO_MAX_GAME);
|
|
||||||
actor[i].lightcount = 2;
|
|
||||||
s->x -= x;
|
|
||||||
s->y -= y;
|
|
||||||
}
|
|
||||||
#endif // POLYMER
|
|
||||||
|
|
||||||
if (proj->offset == 0)
|
if (proj->offset == 0)
|
||||||
proj->offset = 1;
|
proj->offset = 1;
|
||||||
|
|
||||||
|
@ -1634,29 +1620,6 @@ int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel)
|
||||||
srcvect.y += (sintable[(sa+512+96)&2047]>>7);
|
srcvect.y += (sintable[(sa+512+96)&2047]>>7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef POLYMER
|
|
||||||
switch (DYNAMICTILEMAP(atwith))
|
|
||||||
{
|
|
||||||
case FIRELASER__STATIC:
|
|
||||||
case SHOTGUN__STATIC:
|
|
||||||
case SHOTSPARK1__STATIC:
|
|
||||||
case CHAINGUN__STATIC:
|
|
||||||
case RPG__STATIC:
|
|
||||||
case MORTER__STATIC:
|
|
||||||
{
|
|
||||||
int32_t x = ((sintable[(s->ang+512)&2047])>>7), y = ((sintable[(s->ang)&2047])>>7);
|
|
||||||
s->x += x;
|
|
||||||
s->y += y;
|
|
||||||
G_AddGameLight(0, i, PHEIGHT, 8192, 255+(95<<8), PR_LIGHT_PRIO_MAX_GAME);
|
|
||||||
actor[i].lightcount = 2;
|
|
||||||
s->x -= x;
|
|
||||||
s->y -= y;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif // POLYMER
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return A_CheckSpriteTileFlags(atwith, SFLAG_PROJECTILE) ?
|
return A_CheckSpriteTileFlags(atwith, SFLAG_PROJECTILE) ?
|
||||||
|
@ -1991,20 +1954,7 @@ static void P_FireWeapon(int32_t snum)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_NOVISIBLE))
|
if (!(PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_NOVISIBLE))
|
||||||
{
|
|
||||||
#ifdef POLYMER
|
|
||||||
spritetype *s = &sprite[p->i];
|
|
||||||
int32_t x = ((sintable[(s->ang + 512) & 2047]) >> 7), y = ((sintable[(s->ang) & 2047]) >> 7);
|
|
||||||
|
|
||||||
s->x += x;
|
|
||||||
s->y += y;
|
|
||||||
G_AddGameLight(0, p->i, PHEIGHT, 8192, PWEAPON(snum, p->curr_weapon, FlashColor), PR_LIGHT_PRIO_MAX_GAME);
|
|
||||||
actor[p->i].lightcount = 2;
|
|
||||||
s->x -= x;
|
|
||||||
s->y -= y;
|
|
||||||
#endif // POLYMER
|
|
||||||
p->visibility = 0;
|
p->visibility = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_DoWeaponSpawn(int32_t snum)
|
static void P_DoWeaponSpawn(int32_t snum)
|
||||||
|
@ -3844,6 +3794,59 @@ void P_FragPlayer(int32_t snum)
|
||||||
# define PIPEBOMB_CONTROL(snum) (Gv_GetVarByLabel("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, snum))
|
# define PIPEBOMB_CONTROL(snum) (Gv_GetVarByLabel("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, snum))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
WS_NOTHING,
|
||||||
|
WS_FIRE,
|
||||||
|
WS_FIRE_AND_SPAWN,
|
||||||
|
} weaponstate_t;
|
||||||
|
|
||||||
|
int32_t P_WeaponState(int32_t snum, int32_t reset)
|
||||||
|
{
|
||||||
|
int32_t kb = g_player[snum].ps->kickback_pic;
|
||||||
|
int32_t sb_snum = g_player[snum].sync->bits;
|
||||||
|
int32_t weapon = g_player[snum].ps->curr_weapon;
|
||||||
|
|
||||||
|
if ((kb) < PWEAPON(snum, weapon, TotalTime))
|
||||||
|
{
|
||||||
|
if (PWEAPON(snum, weapon, Flags) & WEAPON_AUTOMATIC)
|
||||||
|
{
|
||||||
|
if (!(PWEAPON(snum, weapon, Flags) & WEAPON_SEMIAUTO))
|
||||||
|
{
|
||||||
|
if (reset)
|
||||||
|
kb = 0;
|
||||||
|
|
||||||
|
if (PWEAPON(snum, weapon, Flags) & WEAPON_FIREEVERYTHIRD)
|
||||||
|
{
|
||||||
|
if ((kb % 3) == 0)
|
||||||
|
return WS_FIRE_AND_SPAWN;
|
||||||
|
}
|
||||||
|
else if (PWEAPON(snum, weapon, Flags) & WEAPON_FIREEVERYOTHER)
|
||||||
|
return WS_FIRE_AND_SPAWN;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (kb == PWEAPON(snum, weapon, FireDelay))
|
||||||
|
return WS_FIRE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (PWEAPON(snum, weapon, Flags) & WEAPON_FIREEVERYOTHER)
|
||||||
|
return WS_FIRE_AND_SPAWN;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (kb == PWEAPON(snum, weapon, FireDelay))
|
||||||
|
return WS_FIRE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (kb == PWEAPON(snum, weapon, FireDelay))
|
||||||
|
return WS_FIRE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return WS_NOTHING;
|
||||||
|
}
|
||||||
|
|
||||||
static void P_ProcessWeapon(int32_t snum)
|
static void P_ProcessWeapon(int32_t snum)
|
||||||
{
|
{
|
||||||
DukePlayer_t *const p = g_player[snum].ps;
|
DukePlayer_t *const p = g_player[snum].ps;
|
||||||
|
@ -3917,25 +3920,8 @@ static void P_ProcessWeapon(int32_t snum)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_GLOWS)
|
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_GLOWS)
|
||||||
{
|
|
||||||
p->random_club_frame += 64; // Glowing
|
p->random_club_frame += 64; // Glowing
|
||||||
|
|
||||||
if (p->kickback_pic == 0)
|
|
||||||
{
|
|
||||||
spritetype *s = &sprite[p->i];
|
|
||||||
int32_t x = ((sintable[(s->ang+512)&2047])>>7), y = ((sintable[(s->ang)&2047])>>7);
|
|
||||||
int32_t r = 1024+(sintable[p->random_club_frame&2047]>>3);
|
|
||||||
|
|
||||||
s->x += x;
|
|
||||||
s->y += y;
|
|
||||||
G_AddGameLight(0, p->i, PHEIGHT, max(r, 0), PWEAPON(snum, p->curr_weapon, FlashColor),PR_LIGHT_PRIO_HIGH_GAME);
|
|
||||||
actor[p->i].lightcount = 2;
|
|
||||||
s->x -= x;
|
|
||||||
s->y -= y;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is a hack for WEAPON_FIREEVERYOTHER
|
// this is a hack for WEAPON_FIREEVERYOTHER
|
||||||
if (actor[p->i].t_data[7])
|
if (actor[p->i].t_data[7])
|
||||||
{
|
{
|
||||||
|
@ -4306,63 +4292,32 @@ static void P_ProcessWeapon(int32_t snum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (*kb >= PWEAPON(snum, p->curr_weapon, FireDelay) && (*kb) < PWEAPON(snum, p->curr_weapon, TotalTime)
|
else if (*kb >= PWEAPON(snum, p->curr_weapon, FireDelay) && (*kb) < PWEAPON(snum, p->curr_weapon, TotalTime) &&
|
||||||
&& ((PWEAPON(snum, p->curr_weapon, WorksLike) == KNEE_WEAPON)?1:p->ammo_amount[p->curr_weapon] > 0))
|
((PWEAPON(snum, p->curr_weapon, WorksLike) == KNEE_WEAPON) ? 1 : p->ammo_amount[p->curr_weapon] > 0))
|
||||||
{
|
{
|
||||||
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_AUTOMATIC)
|
int const reset = (TEST_SYNC_KEY(sb_snum, SK_FIRE) == 0 && PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_RESET);
|
||||||
|
|
||||||
|
switch (P_WeaponState(snum, reset))
|
||||||
{
|
{
|
||||||
if (!(PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_SEMIAUTO))
|
case WS_FIRE_AND_SPAWN:
|
||||||
{
|
|
||||||
if (TEST_SYNC_KEY(sb_snum, SK_FIRE) == 0 && PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_RESET)
|
|
||||||
*kb = 0;
|
|
||||||
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_FIREEVERYTHIRD)
|
|
||||||
{
|
|
||||||
if (((*(kb))%3) == 0)
|
|
||||||
{
|
|
||||||
P_FireWeapon(snum);
|
|
||||||
P_DoWeaponSpawn(snum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_FIREEVERYOTHER)
|
|
||||||
{
|
|
||||||
P_FireWeapon(snum);
|
|
||||||
P_DoWeaponSpawn(snum);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (*kb == PWEAPON(snum, p->curr_weapon, FireDelay))
|
|
||||||
{
|
|
||||||
P_FireWeapon(snum);
|
|
||||||
// P_DoWeaponSpawn(snum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_RESET &&
|
|
||||||
(*kb) > PWEAPON(snum, p->curr_weapon, TotalTime)-PWEAPON(snum, p->curr_weapon, HoldDelay) &&
|
|
||||||
((PWEAPON(snum, p->curr_weapon, WorksLike) == KNEE_WEAPON) || p->ammo_amount[p->curr_weapon] > 0))
|
|
||||||
{
|
|
||||||
if (TEST_SYNC_KEY(sb_snum, SK_FIRE)) *kb = 1;
|
|
||||||
else *kb = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_FIREEVERYOTHER)
|
|
||||||
{
|
|
||||||
P_FireWeapon(snum);
|
|
||||||
P_DoWeaponSpawn(snum);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (*kb == PWEAPON(snum, p->curr_weapon, FireDelay))
|
|
||||||
{
|
|
||||||
P_FireWeapon(snum);
|
|
||||||
// P_DoWeaponSpawn(snum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (*kb == PWEAPON(snum, p->curr_weapon, FireDelay))
|
|
||||||
P_FireWeapon(snum);
|
P_FireWeapon(snum);
|
||||||
|
P_DoWeaponSpawn(snum);
|
||||||
|
|
||||||
|
if (reset) *kb = 0;
|
||||||
|
else if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_RESET &&
|
||||||
|
(*kb) > PWEAPON(snum, p->curr_weapon, TotalTime) - PWEAPON(snum, p->curr_weapon, HoldDelay))
|
||||||
|
*kb = (TEST_SYNC_KEY(sb_snum, SK_FIRE)) ? 1 : 0;
|
||||||
|
break;
|
||||||
|
case WS_FIRE:
|
||||||
|
P_FireWeapon(snum);
|
||||||
|
|
||||||
|
if (reset) *kb = 0;
|
||||||
|
else if (PWEAPON(snum, p->curr_weapon, Flags) & WEAPON_RESET &&
|
||||||
|
(*kb) > PWEAPON(snum, p->curr_weapon, TotalTime) - PWEAPON(snum, p->curr_weapon, HoldDelay))
|
||||||
|
*kb = (TEST_SYNC_KEY(sb_snum, SK_FIRE)) ? 1 : 0;
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5380,6 +5335,7 @@ HORIZONLY:
|
||||||
// RBG***
|
// RBG***
|
||||||
|
|
||||||
p->pos.z += PHEIGHT;
|
p->pos.z += PHEIGHT;
|
||||||
|
actor[p->i].bpos = *(vec3_t *)&sprite[p->i];
|
||||||
setsprite(p->i,(vec3_t *)&p->pos.x);
|
setsprite(p->i,(vec3_t *)&p->pos.x);
|
||||||
p->pos.z -= PHEIGHT;
|
p->pos.z -= PHEIGHT;
|
||||||
|
|
||||||
|
|
|
@ -396,6 +396,7 @@ void P_QuickKill(DukePlayer_t *p);
|
||||||
void P_SelectNextInvItem(DukePlayer_t *p);
|
void P_SelectNextInvItem(DukePlayer_t *p);
|
||||||
void P_UpdateScreenPal(DukePlayer_t *p);
|
void P_UpdateScreenPal(DukePlayer_t *p);
|
||||||
void P_EndLevel(void);
|
void P_EndLevel(void);
|
||||||
|
int32_t P_WeaponState(int32_t snum, int32_t reset);
|
||||||
|
|
||||||
void P_CheckWeaponI(int32_t snum);
|
void P_CheckWeaponI(int32_t snum);
|
||||||
int32_t P_GetHudPal(const DukePlayer_t *p);
|
int32_t P_GetHudPal(const DukePlayer_t *p);
|
||||||
|
|
Loading…
Reference in a new issue