This commit is contained in:
Christoph Oelckers 2020-01-08 00:34:25 +01:00
commit 8f455d8ffa
9 changed files with 94 additions and 19 deletions

View file

@ -207,7 +207,8 @@ static void getclosestpointonwall_internal(vec2_t const p, int32_t const dawall,
return; return;
} }
i = tabledivide64((i << 15), j) << 15; i = ((i << 15) / j) << 15;
//i = tabledivide64((i << 15), j) << 15;
*closest = { (int32_t)(w.x + ((d.x * i) >> 30)), (int32_t)(w.y + ((d.y * i) >> 30)) }; *closest = { (int32_t)(w.x + ((d.x * i) >> 30)), (int32_t)(w.y + ((d.y * i) >> 30)) };
} }

View file

@ -17,7 +17,10 @@ class CompositeSavegameWriter
public: public:
void Clear() void Clear()
{ {
isCompressed.Clear();
subfilenames.Clear();
subfiles.DeleteAndClear(); subfiles.DeleteAndClear();
filename = "";
} }
void SetFileName(const char* fn) void SetFileName(const char* fn)
{ {

View file

@ -887,13 +887,13 @@ void DoPassword(int nPassword)
case 2: // LOBOCOP case 2: // LOBOCOP
{ {
lLocalCodes |= 0x20; lLocalCodes |= kButtonCheatGuns;
break; break;
} }
case 3: // LOBODEITY case 3: // LOBODEITY
{ {
lLocalCodes |= 0x40; lLocalCodes |= kButtonCheatGodMode;
break; break;
} }
@ -910,7 +910,7 @@ void DoPassword(int nPassword)
case 5: case 5:
{ {
lLocalCodes |= 0x80; lLocalCodes |= kButtonCheatKeys;
break; break;
} }
@ -954,7 +954,7 @@ void DoPassword(int nPassword)
case 9: case 9:
{ {
lLocalCodes |= 0x100; // LOBOSWAG? lLocalCodes |= kButtonCheatItems; // LOBOSWAG
break; break;
} }

View file

@ -143,6 +143,7 @@ void mysetbrightness(char nBrightness);
void StartFadeIn(); void StartFadeIn();
int DoFadeIn(); int DoFadeIn();
void DoPassword(int nPassword);
void InitSpiritHead(); void InitSpiritHead();

View file

@ -669,6 +669,15 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest)
int runtimer = (int)totalclock; int runtimer = (int)totalclock;
// Trim smoke in widescreen
vec2_t mapwinxy1 = windowxy1, mapwinxy2 = windowxy2;
int32_t width = mapwinxy2.x - mapwinxy1.x + 1, height = mapwinxy2.y - mapwinxy1.y + 1;
if (3 * width > 4 * height)
{
mapwinxy1.x += (width - 4 * height / 3) / 2;
mapwinxy2.x -= (width - 4 * height / 3) / 2;
}
// User has 12 seconds to do something on the map screen before loading the current level // User has 12 seconds to do something on the map screen before loading the current level
while (nIdleSeconds < 12) while (nIdleSeconds < 12)
{ {
@ -681,8 +690,6 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest)
startTime = (int)totalclock; startTime = (int)totalclock;
} }
int moveTimer = (int)totalclock;
int tileY = curYPos; int tileY = curYPos;
// Draw the background screens // Draw the background screens
@ -711,7 +718,10 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest)
int smokeX = MapLevelFires[i].fires[j].xPos + FireTiles[nFireType][nFireFrame].xOffs; int smokeX = MapLevelFires[i].fires[j].xPos + FireTiles[nFireType][nFireFrame].xOffs;
int smokeY = MapLevelFires[i].fires[j].yPos + FireTiles[nFireType][nFireFrame].yOffs + curYPos + screenY; int smokeY = MapLevelFires[i].fires[j].yPos + FireTiles[nFireType][nFireFrame].yOffs + curYPos + screenY;
overwritesprite(smokeX, smokeY, nTile, 0, 2, kPalNormal); // Use rotatesprite to trim smoke in widescreen
rotatesprite(smokeX << 16, smokeY << 16, 65536L, 0,
nTile, 0, kPalNormal, 16 + 2, mapwinxy1.x, mapwinxy1.y, mapwinxy2.x, mapwinxy2.y);
// overwritesprite(smokeX, smokeY, nTile, 0, 2, kPalNormal);
} }
} }
@ -749,7 +759,6 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest)
{ {
bFadeDone = kTrue; bFadeDone = kTrue;
FadeIn(); FadeIn();
moveTimer = (int)totalclock;
} }
if (curYPos == destYPos) if (curYPos == destYPos)
@ -811,8 +820,6 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest)
runtimer = (int)totalclock; runtimer = (int)totalclock;
} }
//curYPos += var_2C * (((int)totalclock - moveTimer) / 2);
if (inputState.CheckAllInput()) if (inputState.CheckAllInput())
{ {
if (var_2C < 8) { if (var_2C < 8) {

View file

@ -30,11 +30,73 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS BEGIN_PS_NS
static int osdcmd_god(osdcmdptr_t UNUSED(parm))
{
UNREFERENCED_CONST_PARAMETER(parm);
if (!nNetPlayerCount && !bInDemo)
{
DoPassword(3);
}
else
OSD_Printf("god: Not in a single-player game.\n");
return OSDCMD_OK;
}
static int osdcmd_noclip(osdcmdptr_t UNUSED(parm))
{
UNREFERENCED_CONST_PARAMETER(parm);
if (!nNetPlayerCount && !bInDemo)
{
DoPassword(6);
}
else
{
OSD_Printf("noclip: Not in a single-player game.\n");
}
return OSDCMD_OK;
}
static int osdcmd_changelevel(osdcmdptr_t parm)
{
char* p;
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
int nLevel = strtol(parm->parms[0], &p, 10);
if (p[0]) return OSDCMD_SHOWHELP;
if (nLevel < 0) return OSDCMD_SHOWHELP;
int nMaxLevels;
if (!ISDEMOVER) {
nMaxLevels = 32;
}
else {
nMaxLevels = 4;
}
if (nLevel > nMaxLevels)
{
OSD_Printf("changelevel: invalid level number\n");
return OSDCMD_SHOWHELP;
}
levelnew = nLevel;
levelnum = nLevel;
return OSDCMD_OK;
}
int32_t registerosdcommands(void) int32_t registerosdcommands(void)
{ {
//if (VOLUMEONE) //if (VOLUMEONE)
// OSD_RegisterFunction("changelevel","changelevel <level>: warps to the given level", osdcmd_changelevel); OSD_RegisterFunction("changelevel","changelevel <level>: warps to the given level", osdcmd_changelevel);
//else //else
//{ //{
// OSD_RegisterFunction("changelevel","changelevel <volume> <level>: warps to the given level", osdcmd_changelevel); // OSD_RegisterFunction("changelevel","changelevel <volume> <level>: warps to the given level", osdcmd_changelevel);
@ -47,9 +109,10 @@ int32_t registerosdcommands(void)
//OSD_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", osdcmd_give); //OSD_RegisterFunction("give","give <all|health|weapons|ammo|armor|keys|inventory>: gives requested item", osdcmd_give);
//OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god); OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god);
//OSD_RegisterFunction("activatecheat","activatecheat <id>: activates a cheat code", osdcmd_activatecheat); //OSD_RegisterFunction("activatecheat","activatecheat <id>: activates a cheat code", osdcmd_activatecheat);
OSD_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip);
//OSD_RegisterFunction("restartmap", "restartmap: restarts the current map", osdcmd_restartmap); //OSD_RegisterFunction("restartmap", "restartmap: restarts the current map", osdcmd_restartmap);
//OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound); //OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound);

View file

@ -1415,7 +1415,7 @@ loc_1AB8E:
uint16_t buttons = sPlayerInput[nPlayer].buttons; uint16_t buttons = sPlayerInput[nPlayer].buttons;
if (buttons & 0x40) // LOBODEITY cheat if (buttons & kButtonCheatGodMode) // LOBODEITY cheat
{ {
char strDeity[96]; // TODO - reduce in size? char strDeity[96]; // TODO - reduce in size?
@ -1437,18 +1437,18 @@ loc_1AB8E:
sprintf(strDeity, "Deity mode %s for player", strDMode); sprintf(strDeity, "Deity mode %s for player", strDMode);
StatusMessage(150, strDeity); StatusMessage(150, strDeity);
} }
else if (buttons & 0x20) // LOBOCOP cheat else if (buttons & kButtonCheatGuns) // LOBOCOP cheat
{ {
FillWeapons(nPlayer); FillWeapons(nPlayer);
StatusMessage(150, "All weapons loaded for player"); StatusMessage(150, "All weapons loaded for player");
} }
else if (buttons & 0x80) // LOBOPICK cheat else if (buttons & kButtonCheatKeys) // LOBOPICK cheat
{ {
PlayerList[nPlayer].keys = 0xFFFF; PlayerList[nPlayer].keys = 0xFFFF;
StatusMessage(150, "All keys loaded for player"); StatusMessage(150, "All keys loaded for player");
RefreshStatus(); RefreshStatus();
} }
else if (buttons & 0x100) // LOBOSWAG cheat else if (buttons & kButtonCheatItems) // LOBOSWAG cheat
{ {
FillItems(nPlayer); FillItems(nPlayer);
StatusMessage(150, "All items loaded for player"); StatusMessage(150, "All items loaded for player");

View file

@ -5248,7 +5248,7 @@ void G_Thunder(void)
{ {
if (krand2() > 65000) if (krand2() > 65000)
{ {
g_winderTime = 256; g_winderTime = 128;
g_winderFlash = 1; g_winderFlash = 1;
S_PlaySound(351+(rand()%3)); S_PlaySound(351+(rand()%3));
} }

View file

@ -4878,7 +4878,7 @@ extern "C" {
tv->tv_nsec = t.QuadPart % 1000000 * 1000; tv->tv_nsec = t.QuadPart % 1000000 * 1000;
return (0); return (0);
} }
#elif __APPLE__ && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 #elif __APPLE__ && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 && !defined CLOCK_MONOTONIC
#define CLOCK_MONOTONIC 0 #define CLOCK_MONOTONIC 0
int clock_gettime(int X, struct timespec *ts) { int clock_gettime(int X, struct timespec *ts) {