- reverted the frags array to its original form, moved InitRRRASkies to zz_common.cpp and deleted zz_premap.cpp.

This commit is contained in:
Christoph Oelckers 2020-07-14 21:42:46 +02:00
parent d5689d3926
commit 4598cf13d7
11 changed files with 58 additions and 92 deletions

View File

@ -48,7 +48,6 @@ set( PCH_SOURCES
src/zz_game.cpp
src/zz_global.cpp
src/zz_player.cpp
src/zz_premap.cpp
src/zz_savegame.cpp
)

View File

@ -715,7 +715,7 @@ public:
for (int y = 0; y < playerswhenstarted; y++)
{
int frag = g_player[i].frags[y];// frags[i][y]);
int frag = frags[i][y];
if (i == y)
{
mysnprintf(tempbuf, 32, "%-4ld", ps[y].fraggedself);
@ -750,7 +750,7 @@ public:
{
if (i == y)
yfragtotal += ps[i].fraggedself;
int frag = g_player[i].frags[y];// frags[i][y]);
int frag = frags[i][y];
yfragtotal += frag;
}
mysnprintf(tempbuf, 32, "%-4ld", yfragtotal);

View File

@ -298,7 +298,7 @@ public:
for (int y = 0; y < playerswhenstarted; y++)
{
int frag = g_player[i].frags[y];// frags[i][y]);
int frag = frags[i][y];
if (i == y)
{
mysnprintf(tempbuf, 32, "%-4ld", ps[y].fraggedself);
@ -333,7 +333,7 @@ public:
{
if (i == y)
yfragtotal += ps[i].fraggedself;
int frag = g_player[i].frags[y];// frags[i][y]);
int frag = frags[i][y];
yfragtotal += frag;
}
mysnprintf(tempbuf, 32, "%-4ld", yfragtotal);

View File

@ -21,7 +21,7 @@ extern int TILE_APLAYERTOP;
extern int TILE_CAMCORNER;
extern int TILE_CAMLIGHT;
extern int TILE_STATIC;
extern int TILE_BOTTOMSTATUSBAR;;
extern int TILE_BOTTOMSTATUSBAR;
extern int TILE_SPINNINGNUKEICON;
extern int TILE_THREEDEE;
extern int TILE_INGAMEDUKETHREEDEE;

View File

@ -500,9 +500,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
if (p->frag_ps != snum)
{
ps[p->frag_ps].frag++;
//frags[p->frag_ps][snum]++;
g_player[p->frag_ps].frags[snum]++; // TRANSITIONAL
g_player[snum].frags[snum]++; // deaths
frags[p->frag_ps][snum]++;
auto pname = &g_player[p->frag_ps].user_name[0]; // TRANSITIONAL
//&ud.user_name[p->frag_ps][0]);

View File

@ -57,13 +57,14 @@ typedef struct
int32_t pcolor, pteam;
// NOTE: wchoice[HANDREMOTE_WEAPON .. MAX_WEAPONS-1] unused
uint8_t frags[MAXPLAYERS];
char user_name[32];
double lastInputTicks;
} playerdata_t;
extern uint16_t frags[MAXPLAYERS][MAXPLAYERS];
# define PWEAPON(Player, Weapon, Wmember) (aplWeapon ## Wmember [Weapon][Player])

View File

@ -913,6 +913,21 @@ static int LoadTheMap(MapRecord *mi, struct player_struct *p, int gamemode)
//
//---------------------------------------------------------------------------
static void clearfrags(void)
{
for (int i = 0; i < ud.multimode; i++)
{
ps[i].frag = ps[i].fraggedself = 0;
}
memset(frags, 0, sizeof(frags));
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int enterlevel(MapRecord *mi, int gamemode)
{
// flushpackets();

View File

@ -12,6 +12,7 @@
#include "rts.h"
#include "gamecontrol.h"
#include "palettecontainer.h"
#include "names.h"
#include "common.h"
@ -98,5 +99,35 @@ void G_SetupGlobalPsky(void)
g_pskyidx = skyIdx;
}
void G_InitRRRASkies(void)
{
if (!isRRRA())
return;
for (int i = 0; i < MAXSECTORS; i++)
{
if (sector[i].ceilingpicnum != TILE_LA && sector[i].ceilingpicnum != TILE_MOONSKY1 && sector[i].ceilingpicnum != TILE_BIGORBIT1)
{
int const picnum = sector[i].ceilingpicnum;
if (tileWidth(picnum) == 512)
{
psky_t *sky = tileSetupSky(picnum);
sky->horizfrac = 32768;
sky->lognumtiles = 1;
sky->tileofs[0] = 0;
sky->tileofs[1] = 0;
}
else if (tileWidth(picnum) == 1024)
{
psky_t *sky = tileSetupSky(picnum);
sky->horizfrac = 32768;
sky->lognumtiles = 0;
sky->tileofs[0] = 0;
}
}
}
}
END_DUKE_NS

View File

@ -53,8 +53,11 @@ int32_t g_spriteGravity = 176;
int32_t g_timerTicsPerSecond = TICRATE;
int32_t g_tripbombRadius = 3880;
uint16_t frags[MAXPLAYERS][MAXPLAYERS];
int16_t weaponsandammosprites[15];
TileInfo tileinfo[MAXTILES]; // This is not from EDuke32.
END_DUKE_NS

View File

@ -1,79 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2016 EDuke32 developers and contributors
This file is part of EDuke32.
EDuke32 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
//-------------------------------------------------------------------------
#include "ns.h" // Must come before everything else!
#include "duke3d.h"
#include "savegame.h"
#include "statistics.h"
#include "menu/menu.h"
#include "mapinfo.h"
#include "cmdlib.h"
#include "v_2ddrawer.h"
#include "secrets.h"
#include "sbar.h"
#include "glbackend/glbackend.h"
BEGIN_DUKE_NS
void G_InitRRRASkies(void)
{
if (!isRRRA())
return;
for (int i = 0; i < MAXSECTORS; i++)
{
if (sector[i].ceilingpicnum != TILE_LA && sector[i].ceilingpicnum != TILE_MOONSKY1 && sector[i].ceilingpicnum != TILE_BIGORBIT1)
{
int const picnum = sector[i].ceilingpicnum;
if (tileWidth(picnum) == 512)
{
psky_t *sky = tileSetupSky(picnum);
sky->horizfrac = 32768;
sky->lognumtiles = 1;
sky->tileofs[0] = 0;
sky->tileofs[1] = 0;
}
else if (tileWidth(picnum) == 1024)
{
psky_t *sky = tileSetupSky(picnum);
sky->horizfrac = 32768;
sky->lognumtiles = 0;
sky->tileofs[0] = 0;
}
}
}
}
void resetpspritevars(int gameMode);
void clearfrags(void)
{
for (int i = 0; i < ud.multimode; i++)
{
playerdata_t *const pPlayerData = &g_player[i];
ps[i].frag = ps[i].fraggedself = 0;
memset(pPlayerData->frags, 0, sizeof(pPlayerData->frags));
}
}
END_DUKE_NS

View File

@ -538,7 +538,7 @@ static void sv_rrrafog();
#define SVARDATALEN \
((sizeof(g_player[0].user_name)+sizeof(g_player[0].pcolor)+sizeof(g_player[0].pteam) \
+sizeof(g_player[0].frags)+sizeof(struct player_struct))*MAXPLAYERS)
+sizeof(struct player_struct))*MAXPLAYERS)
static uint8_t savegame_restdata[SVARDATALEN];
@ -943,7 +943,6 @@ static void sv_restsave()
CPDAT(g_player[i].user_name, 32);
CPDAT(&g_player[i].pcolor, sizeof(g_player[0].pcolor));
CPDAT(&g_player[i].pteam, sizeof(g_player[0].pteam));
CPDAT(&g_player[i].frags[0], sizeof(g_player[0].frags));
CPDAT(g_player[i].ps ? g_player[i].ps : &dummy_ps, sizeof(struct player_struct));
}
@ -961,7 +960,6 @@ static void sv_restload()
CPDAT(g_player[i].user_name, 32);
CPDAT(&g_player[i].pcolor, sizeof(g_player[0].pcolor));
CPDAT(&g_player[i].pteam, sizeof(g_player[0].pteam));
CPDAT(&g_player[i].frags[0], sizeof(g_player[0].frags));
CPDAT(g_player[i].ps ? g_player[i].ps : &dummy_ps, sizeof(struct player_struct));
}
#undef CPDAT