diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index 26d3da91a..2dfd90dd7 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -15,7 +15,7 @@ ALROOT = AL # Engine options SUPERBUILD = 1 POLYMOST = 1 -POLYMER = 0 +POLYMER = 1 USE_OPENGL = 1 NOASM = 0 LINKED_GTK = 0 diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index daaf58159..f4bf1d382 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -149,7 +149,7 @@ typedef struct s_prprogrambit { } _prprogrambit; // LIGHTS -#define PR_MAXLIGHTS 128 +#define PR_MAXLIGHTS 256 #define SHADOW_DEPTH_OFFSET 30 #define PR_MAXLIGHTPRIORITY 3 diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 5f6b05234..8d4c7e0a1 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -2132,12 +2132,13 @@ CLEAR_THE_BOLT: } goto BOLT; - case EXPLODINGBARREL__STATIC: - case WOODENHORSE__STATIC: - case HORSEONSIDE__STATIC: case FLOORFLAME__STATIC: case FIREBARREL__STATIC: case FIREVASE__STATIC: + G_AddGameLight(0, s->sectnum, s->x, s->y, s->z, 4096, 255+(80<<8),0); + case EXPLODINGBARREL__STATIC: + case WOODENHORSE__STATIC: + case HORSEONSIDE__STATIC: case NUKEBARREL__STATIC: case NUKEBARRELDENTED__STATIC: case NUKEBARRELLEAKED__STATIC: @@ -2236,6 +2237,9 @@ static void G_MoveWeapons(void) // if( g_sounds[WIERDSHOT_FLY].num == 0 ) // A_PlaySound(WIERDSHOT_FLY,i); + if (ActorExtra[i].projectile.flashcolor) + G_AddGameLight(0, s->sectnum, s->x, s->y, s->z, 2048, ActorExtra[i].projectile.flashcolor,0); + if (ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFWALLS) { /* if(s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0) @@ -2681,84 +2685,20 @@ static void G_MoveWeapons(void) switch (DynamicTileMap[s->picnum]) { case FREEZEBLAST__STATIC: - gamelights[gamelightcount].radius = 0; - gamelights[gamelightcount].sector = s->sectnum; - - gamelights[gamelightcount].x = s->x; - gamelights[gamelightcount].y = s->y; - gamelights[gamelightcount].z = s->z; - - gamelights[gamelightcount].range = 2048; - gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); - - gamelights[gamelightcount].color[0] = 128; - gamelights[gamelightcount].color[1] = 128; - gamelights[gamelightcount].color[2] = 255; - - gamelights[gamelightcount].priority = 0; - - gamelightcount++; + G_AddGameLight(0, s->sectnum, s->x, s->y, s->z, 2048, 128+(128<<8)+(255<<16),0); break; case COOLEXPLOSION1__STATIC: - gamelights[gamelightcount].radius = 0; - gamelights[gamelightcount].sector = s->sectnum; - - gamelights[gamelightcount].x = s->x; - gamelights[gamelightcount].y = s->y; - gamelights[gamelightcount].z = s->z; - - gamelights[gamelightcount].range = 3072; - gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); - - gamelights[gamelightcount].color[0] = 128; - gamelights[gamelightcount].color[1] = 0; - gamelights[gamelightcount].color[2] = 255; - - gamelights[gamelightcount].priority = 0; - - gamelightcount++; + G_AddGameLight(0, s->sectnum, s->x, s->y, s->z, 3072, 128+(0<<8)+(255<<16),0); break; case SHRINKSPARK__STATIC: - gamelights[gamelightcount].radius = 0; - gamelights[gamelightcount].sector = s->sectnum; - - gamelights[gamelightcount].x = s->x; - gamelights[gamelightcount].y = s->y; - gamelights[gamelightcount].z = s->z; - - gamelights[gamelightcount].range = tilesizx[s->picnum]*tilesizy[s->picnum]; - gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); - - gamelights[gamelightcount].color[0] = 128; - gamelights[gamelightcount].color[1] = 255; - gamelights[gamelightcount].color[2] = 128; - - gamelights[gamelightcount].priority = 0; - - gamelightcount++; + G_AddGameLight(0, s->sectnum, s->x, s->y, s->z, 2048, 128+(255<<8)+(128<<16),0); break; case RPG__STATIC: case FIRELASER__STATIC: - gamelights[gamelightcount].radius = 0; - gamelights[gamelightcount].sector = s->sectnum; - - gamelights[gamelightcount].x = s->x; - gamelights[gamelightcount].y = s->y; - gamelights[gamelightcount].z = s->z; - - gamelights[gamelightcount].range = tilesizx[s->picnum]*tilesizy[s->picnum]; - gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); - - gamelights[gamelightcount].color[0] = 255; - gamelights[gamelightcount].color[1] = 80; - gamelights[gamelightcount].color[2] = 0; - - gamelights[gamelightcount].priority = 0; - - gamelightcount++; + G_AddGameLight(0, s->sectnum, s->x, s->y, s->z, 1024, 255+(80<<8),0); if (DynamicTileMap[s->picnum] == RPG__STATIC && ActorExtra[i].picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) @@ -3404,44 +3344,14 @@ static void G_MoveActors(void) switch (DynamicTileMap[switchpicnum]) { case ATOMICHEALTH__STATIC: - gamelights[gamelightcount].radius = 0; - gamelights[gamelightcount].sector = s->sectnum; - - gamelights[gamelightcount].x = s->x; - gamelights[gamelightcount].y = s->y; - gamelights[gamelightcount].z = s->z; - - gamelights[gamelightcount].range = 2048; - gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); - - gamelights[gamelightcount].color[0] = 128; - gamelights[gamelightcount].color[1] = 128; - gamelights[gamelightcount].color[2] = 255; - - gamelights[gamelightcount].priority = 0; - - gamelightcount++; + G_AddGameLight(0, s->sectnum, s->x, s->y, s->z, 2048, 128+(128<<8)+(255<<16),0); break; case FIRE__STATIC: case FIRE2__STATIC: - gamelights[gamelightcount].radius = 0; - gamelights[gamelightcount].sector = s->sectnum; - - gamelights[gamelightcount].x = s->x; - gamelights[gamelightcount].y = s->y; - gamelights[gamelightcount].z = s->z; - - gamelights[gamelightcount].range = tilesizx[s->picnum]*tilesizy[s->picnum]; - gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); - - gamelights[gamelightcount].color[0] = 255; - gamelights[gamelightcount].color[1] = 80; - gamelights[gamelightcount].color[2] = 0; - - gamelights[gamelightcount].priority = 0; - - gamelightcount++; + if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break; + if (s->z > ActorExtra[i].floorz+2048) break; + G_AddGameLight(0, s->sectnum, s->x, s->y, s->z, 64 * s->xrepeat, 255+(80<<8),0); break; case DUCK__STATIC: @@ -3689,24 +3599,25 @@ static void G_MoveActors(void) if (s->z < sector[sect].ceilingz+(32<<8)) s->z = sector[sect].ceilingz+(32<<8); - gamelights[gamelightcount].sector = s->sectnum; - gamelights[gamelightcount].x = s->x; - gamelights[gamelightcount].y = s->y; - gamelights[gamelightcount].z = s->z + 10248; - gamelights[gamelightcount].range = 8192; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].sector = s->sectnum; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].x = s->x; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].y = s->y; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].z = s->z + 10248; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].range = 8192; - gamelights[gamelightcount].angle = s->ang; - gamelights[gamelightcount].horiz = 100; - gamelights[gamelightcount].radius = 256; - gamelights[gamelightcount].faderadius = 200; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].angle = s->ang; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].horiz = 100; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].radius = 256; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].faderadius = 200; - gamelights[gamelightcount].color[0] = 255; - gamelights[gamelightcount].color[1] = 255; - gamelights[gamelightcount].color[2] = 255; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[0] = 255; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[1] = 255; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[2] = 255; - gamelights[gamelightcount].priority = 0; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].priority = 0; - gamelightcount++; + if (gamelightcount < PR_MAXLIGHTS) + gamelightcount++; if (ud.multimode < 2) { @@ -5189,64 +5100,21 @@ static void G_MoveMisc(void) // STATNUM 5 { case BURNING__STATIC: case BURNING2__STATIC: + if (ActorExtra[i].floorz - ActorExtra[i].ceilingz < 128) break; + if (s->z > ActorExtra[i].floorz + 2048) break; + G_AddGameLight(0, s->sectnum, s->x, s->y, s->z, 64 * s->xrepeat, 255+(80<<8),0); + break; + case EXPLOSION2__STATIC: - gamelights[gamelightcount].radius = 0; - gamelights[gamelightcount].sector = s->sectnum; - - gamelights[gamelightcount].x = s->x; - gamelights[gamelightcount].y = s->y; - gamelights[gamelightcount].z = s->z; - - gamelights[gamelightcount].range = tilesizx[s->picnum]*tilesizy[s->picnum]; - gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); - - gamelights[gamelightcount].color[0] = 255; - gamelights[gamelightcount].color[1] = 80; - gamelights[gamelightcount].color[2] = 0; - - gamelights[gamelightcount].priority = 0; - - gamelightcount++; + G_AddGameLight(0, s->sectnum, s->x, s->y, s->z, 4096, 255+(80<<8),0); break; case FORCERIPPLE__STATIC: - case TRANSPORTERSTAR__STATIC: +// case TRANSPORTERSTAR__STATIC: case TRANSPORTERBEAM__STATIC: - gamelights[gamelightcount].radius = 0; - gamelights[gamelightcount].sector = s->sectnum; - - gamelights[gamelightcount].x = s->x; - gamelights[gamelightcount].y = s->y; - gamelights[gamelightcount].z = s->z; - - gamelights[gamelightcount].range = tilesizx[s->picnum]*tilesizy[s->picnum]; - gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); - - gamelights[gamelightcount].color[0] = 80; - gamelights[gamelightcount].color[1] = 80; - gamelights[gamelightcount].color[2] = 255; - - gamelights[gamelightcount].priority = 0; - - gamelightcount++; + G_AddGameLight(0, s->sectnum, s->x, s->y, s->z, 2048, 80+(80<<8)+(255<<16),0); break; case SHRINKEREXPLOSION__STATIC: - gamelights[gamelightcount].radius = 0; - gamelights[gamelightcount].sector = s->sectnum; - - gamelights[gamelightcount].x = s->x; - gamelights[gamelightcount].y = s->y; - gamelights[gamelightcount].z = s->z; - - gamelights[gamelightcount].range = tilesizx[s->picnum]*tilesizy[s->picnum]; - gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); - - gamelights[gamelightcount].color[0] = 128; - gamelights[gamelightcount].color[1] = 255; - gamelights[gamelightcount].color[2] = 128; - - gamelights[gamelightcount].priority = 0; - - gamelightcount++; + G_AddGameLight(0, s->sectnum, s->x, s->y, s->z, 2048, 128+(255<<8)+(128<<16),0); break; } if (!actorscrptr[sprite[i].picnum]) diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 2250640aa..fd994d9b9 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -517,7 +517,7 @@ extern char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH]; extern int16_t camsprite; typedef struct { - int32_t workslike, extra, cstat, extra_rand, hitradius, range; + int32_t workslike, extra, cstat, extra_rand, hitradius, range, flashcolor; int16_t spawns, sound, isound, vel, decal, trail, tnum, drop, clipdist, offset, bounces, bsound, toffset; int8_t sxrepeat, syrepeat, txrepeat, tyrepeat, shade, xrepeat, yrepeat, pal, velmult; } projectile_t; @@ -889,6 +889,7 @@ extern intptr_t *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound extern intptr_t *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of magazine being removed extern intptr_t *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted extern intptr_t *aplWeaponSelectSound[MAX_WEAPONS]; // Sound for weapon selection +extern intptr_t *aplWeaponFlashColor[MAX_WEAPONS]; // Color for polymer muzzle flash extern int32_t g_timerTicsPerSecond; diff --git a/polymer/eduke32/source/funct.h b/polymer/eduke32/source/funct.h index 6a05d0db9..1ff52b798 100644 --- a/polymer/eduke32/source/funct.h +++ b/polymer/eduke32/source/funct.h @@ -276,6 +276,28 @@ static inline int32_t G_GetTeamPalette(int32_t team) return 0; } +static inline void G_AddGameLight(int32_t radius, int32_t sector, int32_t x, int32_t y, int32_t z, int32_t range, int32_t color, int32_t priority) +{ + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].radius = radius; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].sector = sector; + + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].x = x; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].y = y; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].z = z; + + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].range = range; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].range -= rand()%((gamelights[gamelightcount&(PR_MAXLIGHTS-1)].range>>3)+1); + + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[0] = color&255; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[1] = (color>>8)&255; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[2] = (color>>16)&255; + + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].priority = priority; + + if (gamelightcount < PR_MAXLIGHTS) + gamelightcount++; +} + extern void se40code(int32_t x,int32_t y,int32_t z,int32_t a,int32_t h, int32_t smoothratio); extern void G_FreeMapState(int32_t mapnum); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 0c1fef5a8..1955db0f4 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -4606,6 +4606,7 @@ static void G_DumpDebugInfo(void) OSD_Printf("WEAPON%d_RELOADSOUND1 %" PRIdPTR "\n",i,aplWeaponReloadSound1[i][j]); OSD_Printf("WEAPON%d_RELOADSOUND2 %" PRIdPTR "\n",i,aplWeaponReloadSound2[i][j]); OSD_Printf("WEAPON%d_SELECTSOUND %" PRIdPTR "\n",i,aplWeaponSelectSound[i][j]); + OSD_Printf("WEAPON%d_FLASHCOLOR %" PRIdPTR "\n",i,aplWeaponFlashColor[i][j]); } OSD_Printf("\n"); } @@ -7349,8 +7350,81 @@ PALONLY: } } + switch (DynamicTileMap[s->picnum-1]) + { + case DIPSWITCH__STATIC: + case DIPSWITCH2__STATIC: + case DIPSWITCH3__STATIC: + case PULLSWITCH__STATIC: + case HANDSWITCH__STATIC: + case SLOTDOOR__STATIC: + case LIGHTSWITCH__STATIC: + case SPACELIGHTSWITCH__STATIC: + case SPACEDOORSWITCH__STATIC: + case FRANKENSTINESWITCH__STATIC: + case LIGHTSWITCH2__STATIC: + case POWERSWITCH1__STATIC: + case LOCKSWITCH1__STATIC: + case POWERSWITCH2__STATIC: + case TECHSWITCH__STATIC: + framelights[framelightcount & (PR_MAXLIGHTS-1)].radius = 0; + framelights[framelightcount & (PR_MAXLIGHTS-1)].sector = t->sectnum; + + framelights[framelightcount & (PR_MAXLIGHTS-1)].x = t->x+((sintable[(t->ang+512)&2047])>>7); + framelights[framelightcount & (PR_MAXLIGHTS-1)].y = t->y+((sintable[(t->ang)&2047])>>7); + framelights[framelightcount & (PR_MAXLIGHTS-1)].z = t->z-1024; + + framelights[framelightcount & (PR_MAXLIGHTS-1)].range = 1024; + + framelights[framelightcount & (PR_MAXLIGHTS-1)].color[0] = 48; + framelights[framelightcount & (PR_MAXLIGHTS-1)].color[1] = 255; + framelights[framelightcount & (PR_MAXLIGHTS-1)].color[2] = 48; + + framelights[framelightcount & (PR_MAXLIGHTS-1)].priority = 2; + + if (framelightcount < PR_MAXLIGHTS) + framelightcount++; + + break; + } + switch (DynamicTileMap[s->picnum]) { + case DIPSWITCH__STATIC: + case DIPSWITCH2__STATIC: + case DIPSWITCH3__STATIC: + case PULLSWITCH__STATIC: + case HANDSWITCH__STATIC: + case SLOTDOOR__STATIC: + case LIGHTSWITCH__STATIC: + case SPACELIGHTSWITCH__STATIC: + case SPACEDOORSWITCH__STATIC: + case FRANKENSTINESWITCH__STATIC: + case LIGHTSWITCH2__STATIC: + case POWERSWITCH1__STATIC: + case LOCKSWITCH1__STATIC: + case POWERSWITCH2__STATIC: + case TECHSWITCH__STATIC: + framelights[framelightcount & (PR_MAXLIGHTS-1)].radius = 0; + framelights[framelightcount & (PR_MAXLIGHTS-1)].sector = t->sectnum; + + framelights[framelightcount & (PR_MAXLIGHTS-1)].x = t->x+((sintable[(t->ang+512)&2047])>>7); + framelights[framelightcount & (PR_MAXLIGHTS-1)].y = t->y+((sintable[(t->ang)&2047])>>7); + framelights[framelightcount & (PR_MAXLIGHTS-1)].z = t->z-1024; + + framelights[framelightcount & (PR_MAXLIGHTS-1)].range = 1024; + + framelights[framelightcount & (PR_MAXLIGHTS-1)].color[0] = 255; + framelights[framelightcount & (PR_MAXLIGHTS-1)].color[1] = 48; + framelights[framelightcount & (PR_MAXLIGHTS-1)].color[2] = 48; + + framelights[framelightcount & (PR_MAXLIGHTS-1)].priority = 2; + + if (framelightcount < PR_MAXLIGHTS) + framelightcount++; + + break; + case LASERLINE__STATIC: if (sector[t->sectnum].lotag == 2) t->pal = 8; t->z = sprite[s->owner].z-(3<<8); @@ -7367,43 +7441,6 @@ PALONLY: case SHRINKEREXPLOSION__STATIC: case RPG__STATIC: case FLOORFLAME__STATIC: - -#ifdef POLYMER -/* - framelights[framelightcount].radius = 0; - framelights[framelightcount].sector = t->sectnum; - - framelights[framelightcount].x = t->x; - framelights[framelightcount].y = t->y; - framelights[framelightcount].z = t->z; - - framelights[framelightcount].range = tilesizx[t->picnum]*tilesizy[t->picnum]; - framelights[framelightcount].range -= rand()%((framelights[framelightcount].range>>3)+1); - - framelights[framelightcount].color[0] = 255; - framelights[framelightcount].color[1] = 80; - framelights[framelightcount].color[2] = 0; - - framelights[framelightcount].priority = 0; - - if ((DynamicTileMap[s->picnum] == ATOMICHEALTH__STATIC) || - (DynamicTileMap[s->picnum] == FREEZEBLAST__STATIC)) - { - framelights[framelightcount].color[0] = 0; - framelights[framelightcount].color[1] = 0; - framelights[framelightcount].color[2] = 255; - } - if ((DynamicTileMap[s->picnum] == SHRINKSPARK__STATIC) || - (DynamicTileMap[s->picnum] == SHRINKEREXPLOSION__STATIC)) - { - framelights[framelightcount].color[0] = 0; - framelights[framelightcount].color[1] = 255; - framelights[framelightcount].color[2] = 0; - } - - framelightcount++; -*/ -#endif if (t->picnum == EXPLOSION2) { g_player[screenpeek].ps->visibility = -127; @@ -7419,52 +7456,10 @@ PALONLY: if (sprite[s->owner].picnum != TREE1 && sprite[s->owner].picnum != TREE2) t->z = sector[t->sectnum].floorz; t->shade = -127; -#ifdef POLYMER -/* - framelights[framelightcount].radius = 0; - framelights[framelightcount].sector = t->sectnum; - - framelights[framelightcount].x = t->x; - framelights[framelightcount].y = t->y; - framelights[framelightcount].z = t->z; - - framelights[framelightcount].range = tilesizx[t->picnum]*tilesizy[t->picnum]; - framelights[framelightcount].range -= rand()%((framelights[framelightcount].range>>3)+1); - - framelights[framelightcount].color[0] = 255; - framelights[framelightcount].color[1] = 80; - framelights[framelightcount].color[2] = 0; - - framelights[framelightcount].priority = 0; - - framelightcount++; -*/ -#endif break; case COOLEXPLOSION1__STATIC: t->shade = -127; t->picnum += (s->shade>>1); -#ifdef POLYMER -/* - framelights[framelightcount].radius = 0; - framelights[framelightcount].sector = t->sectnum; - - framelights[framelightcount].x = t->x; - framelights[framelightcount].y = t->y; - framelights[framelightcount].z = t->z; - - framelights[framelightcount].range = tilesizx[t->picnum]*tilesizy[t->picnum]; - framelights[framelightcount].range -= rand()%((framelights[framelightcount].range>>3)+1); - - framelights[framelightcount].color[0] = 128; - framelights[framelightcount].color[1] = 0; - framelights[framelightcount].color[2] = 255; - - framelights[framelightcount].priority = 0; - - framelightcount++; -*/ -#endif break; case PLAYERONWATER__STATIC: #if defined(POLYMOST) && defined(USE_OPENGL) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 843df6ec5..6164a16ce 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -67,6 +67,7 @@ intptr_t *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID intptr_t *aplWeaponReloadSound1[MAX_WEAPONS]; // Sound of magazine being removed intptr_t *aplWeaponReloadSound2[MAX_WEAPONS]; // Sound of magazine being inserted intptr_t *aplWeaponSelectSound[MAX_WEAPONS]; // Sound of weapon being selected +intptr_t *aplWeaponFlashColor[MAX_WEAPONS]; // Muzzle flash color int32_t g_iReturnVarID=-1; // var ID of "RETURN" int32_t g_iWeaponVarID=-1; // var ID of "WEAPON" @@ -821,6 +822,7 @@ const memberlabel_t ProjectileLabels[]= { "bounces", PROJ_BOUNCES, 0, 0 }, { "bsound", PROJ_BSOUND, 0, 0 }, { "range", PROJ_RANGE, 0, 0 }, + { "flashcolor", PROJ_FLASH_COLOR, 0, 0 }, { "", -1, 0, 0 } // END OF LIST }; @@ -5818,12 +5820,12 @@ static void C_InitProjectiles(void) int32_t i; struct { - int32_t workslike, extra, cstat, extra_rand, hitradius, range; + int32_t workslike, extra, cstat, extra_rand, hitradius, range, flashcolor; int16_t spawns, sound, isound, vel, decal, trail, tnum, drop, clipdist, offset, bounces, bsound, toffset; int8_t sxrepeat, syrepeat, txrepeat, tyrepeat, shade, xrepeat, yrepeat, pal, velmult; } DefaultProjectile = { - 1, 100, -1, -1, 2048, 0, + 1, 100, -1, -1, 2048, 0, 0, SMALLSMOKE, -1, -1, 600, BULLETHOLE, -1, 0, 0, 32, 448, g_numFreezeBounces, PIPEBOMB_BOUNCE, 1, -1, -1, -1, -1, -96, 18, 18, 0, 1 }; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 3319b6a3b..4e42ea4fc 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -549,7 +549,8 @@ enum ProjectileLabel_t PROJ_OFFSET, PROJ_BOUNCES, PROJ_BSOUND, - PROJ_RANGE, // 28 + PROJ_RANGE, + PROJ_FLASH_COLOR, // 29 PROJ_END }; diff --git a/polymer/eduke32/source/gamestructures.c b/polymer/eduke32/source/gamestructures.c index c22a9cc5a..4428065eb 100644 --- a/polymer/eduke32/source/gamestructures.c +++ b/polymer/eduke32/source/gamestructures.c @@ -1185,6 +1185,15 @@ static inline void X_AccessActiveProjectile(int32_t iSet, int32_t lVar1, int32_t Gv_SetVar(lVar2, ActorExtra[proj].projectile.range, vm.g_i, vm.g_p); return; + case PROJ_FLASH_COLOR: + if (iSet) + { + ActorExtra[proj].projectile.flashcolor=lValue; + return; + } + Gv_SetVar(lVar2, ActorExtra[proj].projectile.flashcolor, vm.g_i, vm.g_p); + return; + default: return; } diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 5473c3836..9985936e5 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -984,6 +984,8 @@ void Gv_ResetSystemDefaults(void) aplWeaponReloadSound2[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",i); aplWeaponSelectSound[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",i); + aplWeaponFlashColor[i][j]=Gv_GetVarByLabel(aszBuf,0, -1, j); } } @@ -1052,6 +1054,9 @@ static void Gv_AddSystemVars(void) Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",KNEE_WEAPON); Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",KNEE_WEAPON); + Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + ///////////////////////////// Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",PISTOL_WEAPON); @@ -1090,6 +1095,8 @@ static void Gv_AddSystemVars(void) Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",PISTOL_WEAPON); Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",PISTOL_WEAPON); + Gv_NewVar(aszBuf, 255+(80<<8), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); ///////////////////////////// Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",SHOTGUN_WEAPON); @@ -1128,6 +1135,8 @@ static void Gv_AddSystemVars(void) Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",SHOTGUN_WEAPON); Gv_NewVar(aszBuf, SHOTGUN_COCK, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",SHOTGUN_WEAPON); + Gv_NewVar(aszBuf, 255+(80<<8), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); ///////////////////////////// Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",CHAINGUN_WEAPON); @@ -1166,6 +1175,8 @@ static void Gv_AddSystemVars(void) Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",CHAINGUN_WEAPON); Gv_NewVar(aszBuf, SELECT_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",CHAINGUN_WEAPON); + Gv_NewVar(aszBuf, 255+(80<<8), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); ///////////////////////////// Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",RPG_WEAPON); @@ -1204,6 +1215,8 @@ static void Gv_AddSystemVars(void) Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",RPG_WEAPON); Gv_NewVar(aszBuf, SELECT_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",RPG_WEAPON); + Gv_NewVar(aszBuf, 255+(80<<8), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); ///////////////////////////// Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",HANDBOMB_WEAPON); @@ -1242,6 +1255,8 @@ static void Gv_AddSystemVars(void) Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",HANDBOMB_WEAPON); Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",HANDBOMB_WEAPON); + Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); ///////////////////////////// Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",SHRINKER_WEAPON); @@ -1280,6 +1295,8 @@ static void Gv_AddSystemVars(void) Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",SHRINKER_WEAPON); Gv_NewVar(aszBuf, SELECT_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",SHRINKER_WEAPON); + Gv_NewVar(aszBuf, 128+(255<<8)+(128<<16), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); ///////////////////////////// Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",DEVISTATOR_WEAPON); @@ -1318,6 +1335,8 @@ static void Gv_AddSystemVars(void) Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",DEVISTATOR_WEAPON); Gv_NewVar(aszBuf, SELECT_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",DEVISTATOR_WEAPON); + Gv_NewVar(aszBuf, 255+(80<<8), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); ///////////////////////////// Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",TRIPBOMB_WEAPON); @@ -1333,7 +1352,7 @@ static void Gv_AddSystemVars(void) Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",TRIPBOMB_WEAPON); Gv_NewVar(aszBuf, 7, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_FLAGS",TRIPBOMB_WEAPON); - Gv_NewVar(aszBuf, WEAPON_STANDSTILL | WEAPON_CHECKATRELOAD, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + Gv_NewVar(aszBuf, WEAPON_NOVISIBLE | WEAPON_STANDSTILL | WEAPON_CHECKATRELOAD, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SHOOTS",TRIPBOMB_WEAPON); Gv_NewVar(aszBuf, HANDHOLDINGLASER, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SPAWNTIME",TRIPBOMB_WEAPON); @@ -1356,6 +1375,8 @@ static void Gv_AddSystemVars(void) Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",TRIPBOMB_WEAPON); Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",TRIPBOMB_WEAPON); + Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); ///////////////////////////// Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",FREEZE_WEAPON); @@ -1394,6 +1415,8 @@ static void Gv_AddSystemVars(void) Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",FREEZE_WEAPON); Gv_NewVar(aszBuf, SELECT_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",FREEZE_WEAPON); + Gv_NewVar(aszBuf, 128+(128<<8)+(255<<16), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); ///////////////////////////// Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",HANDREMOTE_WEAPON); @@ -1432,6 +1455,8 @@ static void Gv_AddSystemVars(void) Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",HANDREMOTE_WEAPON); Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",HANDREMOTE_WEAPON); + Gv_NewVar(aszBuf, 0, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); /////////////////////////////////////////////////////// Bsprintf(aszBuf,"WEAPON%d_WORKSLIKE",GROW_WEAPON); @@ -1470,6 +1495,8 @@ static void Gv_AddSystemVars(void) Gv_NewVar(aszBuf, INSERT_CLIP, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",GROW_WEAPON); Gv_NewVar(aszBuf, SELECT_WEAPON, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",GROW_WEAPON); + Gv_NewVar(aszBuf, 255+(80<<8), GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Gv_NewVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); Gv_NewVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM); @@ -1646,6 +1673,8 @@ void Gv_InitWeaponPointers(void) aplWeaponReloadSound2[i]=Gv_GetVarDataPtr(aszBuf); Bsprintf(aszBuf,"WEAPON%d_SELECTSOUND",i); aplWeaponSelectSound[i]=Gv_GetVarDataPtr(aszBuf); + Bsprintf(aszBuf,"WEAPON%d_FLASHCOLOR",i); + aplWeaponFlashColor[i]=Gv_GetVarDataPtr(aszBuf); } } diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 8a8b33aac..2b931fcef 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -344,6 +344,30 @@ int32_t A_Shoot(int32_t i,int32_t atwith) srcvect.y += (sintable[(sa+512+96)&2047]>>7); } } + + G_AddGameLight(0, s->sectnum, s->x+((sintable[(s->ang+512)&2047])>>7), + s->y+((sintable[(s->ang)&2047])>>7), s->z-PHEIGHT, 4096, 255+(80<<8),0); + + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].sector = s->sectnum; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].x = s->x+((sintable[(s->ang+512)&2047])>>7); + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].y = s->y+((sintable[(s->ang)&2047])>>7); + + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].z = s->z-PHEIGHT; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].range = 8192; + + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].angle = (s->ang+1024)&2047; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].horiz = 100; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].radius = 256; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].faderadius = 200; + + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[0] = 255; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[1] = 80; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[2] = 0; + + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].priority = 1; + + if (gamelightcount < PR_MAXLIGHTS) + gamelightcount++; } if (A_CheckSpriteTileFlags(atwith,SPRITE_PROJECTILE)) @@ -2045,7 +2069,7 @@ static int32_t P_DisplayKneeAnim(int32_t gs,int32_t snum) static int32_t P_DisplayKnuckleAnim(int32_t gs,int32_t snum) { - static char knuckle_frames[] = {0,1,2,2,3,3,3,2,2,1,0}; + static int8_t knuckle_frames[] = {0,1,2,2,3,3,3,2,2,1,0}; int32_t looking_arc, pal = 0; if (g_player[snum].ps->knuckle_incs == 0 || sprite[g_player[snum].ps->i].extra <= 0) return 0; @@ -2116,45 +2140,29 @@ void P_FireWeapon(DukePlayer_t *p) lastvisinc = totalclock+32; p->visibility = 0; - gamelights[gamelightcount].radius = 0; - gamelights[gamelightcount].sector = s->sectnum; + G_AddGameLight(0, s->sectnum, s->x+((sintable[(p->ang+512)&2047])>>7), s->y+((sintable[(p->ang)&2047])>>7), + s->z-PHEIGHT, 4096, aplWeaponFlashColor[p->curr_weapon][snum],0); - gamelights[gamelightcount].x = s->x; - gamelights[gamelightcount].y = s->y; - gamelights[gamelightcount].z = s->z-PHEIGHT; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].sector = s->sectnum; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].x = s->x+((sintable[(p->ang+512)&2047])>>7); + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].y = s->y+((sintable[(p->ang)&2047])>>7); - gamelights[gamelightcount].range = 4096; - gamelights[gamelightcount].range -= rand()%((gamelights[gamelightcount].range>>3)+1); + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].z = s->z-PHEIGHT; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].range = 8192; - gamelights[gamelightcount].color[0] = 255; - gamelights[gamelightcount].color[1] = 80; - gamelights[gamelightcount].color[2] = 0; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].angle = (s->ang+1024)&2047; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].horiz = 100; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].radius = 256; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].faderadius = 200; - gamelights[gamelightcount].priority = 0; - - gamelightcount++; - - gamelights[gamelightcount].sector = s->sectnum; - gamelights[gamelightcount].x = s->x+((sintable[(p->ang+512)&2047])>>5); - gamelights[gamelightcount].y = s->y+((sintable[(p->ang)&2047])>>5); - - gamelights[gamelightcount].z = s->z-PHEIGHT; - gamelights[gamelightcount].range = 8192; - - gamelights[gamelightcount].angle = (s->ang+1024)&2047; - gamelights[gamelightcount].horiz = 100; - gamelights[gamelightcount].radius = 256; - gamelights[gamelightcount].faderadius = 200; - - gamelights[gamelightcount].color[0] = 255; - gamelights[gamelightcount].color[1] = 80; - gamelights[gamelightcount].color[2] = 0; - - gamelights[gamelightcount].priority = 0; - - gamelightcount++; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[0] = aplWeaponFlashColor[p->curr_weapon][snum]&255; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[1] = (aplWeaponFlashColor[p->curr_weapon][snum]>>8)&255; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].color[2] = (aplWeaponFlashColor[p->curr_weapon][snum]>>16)&255;; + gamelights[gamelightcount&(PR_MAXLIGHTS-1)].priority = 2; + if (gamelightcount < PR_MAXLIGHTS) + gamelightcount++; } /* if( //!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_CHECKATRELOAD) &&