mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- Exhumed: moved the input code out of the main loop
This commit is contained in:
parent
fccd054381
commit
3a3ba43985
10 changed files with 114 additions and 169 deletions
|
@ -139,7 +139,7 @@ void DrawAbs(int tile, double x, double y, int shade = 0)
|
|||
DrawTexture(twod, tileGetTexture(tile), x, y, DTA_FullscreenScale, FSMode_ScaleToFit43, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_TopLeft, true, DTA_Color, shadeToLight(shade), TAG_DONE);
|
||||
}
|
||||
|
||||
void DrawRel(int tile, double x, double y, int shade = 0)
|
||||
void DrawRel(int tile, double x, double y, int shade)
|
||||
{
|
||||
// This is slightly different than what the backend does here, but critical for some graphics.
|
||||
int offx = (tileWidth(tile) >> 1) + tileLeftOffset(tile);
|
||||
|
|
|
@ -36,8 +36,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_PS_NS
|
||||
|
||||
void DrawRel(int tile, double x, double y, int shade = 0);
|
||||
|
||||
int handle1;
|
||||
|
||||
|
||||
|
|
|
@ -92,7 +92,6 @@ void LoadObjects();
|
|||
// light
|
||||
|
||||
int LoadPaletteLookups();
|
||||
void WaitVBL();
|
||||
void SetGreenPal();
|
||||
void RestoreGreenPal();
|
||||
void FixPalette();
|
||||
|
|
|
@ -599,8 +599,6 @@ static const char* actions[] =
|
|||
"Alt_Weapon",
|
||||
"Third_Person_View",
|
||||
"Toggle_Crouch", // This is the last one used by EDuke32.
|
||||
"Zoom_In", // Map controls should not pollute the global button namespace.
|
||||
"Zoom_Out",
|
||||
};
|
||||
|
||||
|
||||
|
@ -642,21 +640,6 @@ void InitGame()
|
|||
nTotalPlayers += nNetPlayerCount;
|
||||
}
|
||||
|
||||
// loc_116A5:
|
||||
|
||||
#if 0
|
||||
if (nNetPlayerCount)
|
||||
{
|
||||
InitInput();
|
||||
forcelevel = nStartLevel;
|
||||
nNetTime = 1800 * nTimeLimit;
|
||||
|
||||
if (nNetTime == 0) {
|
||||
nNetTime = -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// temp - moving InstallEngine(); before FadeOut as we use nextpage() in FadeOut
|
||||
InstallEngine();
|
||||
|
||||
|
|
|
@ -89,8 +89,6 @@ enum GameFunction_t
|
|||
gamefunc_Alt_Weapon,
|
||||
gamefunc_Third_Person_View,
|
||||
gamefunc_Toggle_Crouch, // This is the last one used by EDuke32.
|
||||
gamefunc_Zoom_In, // Map controls should not pollute the global button namespace.
|
||||
gamefunc_Zoom_Out,
|
||||
NUM_ACTIONS,
|
||||
|
||||
};
|
||||
|
@ -271,6 +269,7 @@ extern char g_modDir[BMAX_PATH];
|
|||
|
||||
void G_LoadGroupsInDir(const char* dirname);
|
||||
void G_DoAutoload(const char* dirname);
|
||||
void DrawRel(int tile, double x, double y, int shade = 0);
|
||||
|
||||
// savegame.
|
||||
|
||||
|
|
|
@ -73,66 +73,8 @@ int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk);
|
|||
int SyncScreenJob();
|
||||
void DoTitle(CompletionFunc completion);
|
||||
void ResetEngine();
|
||||
|
||||
|
||||
void CheckKeys()
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_Enlarge_Screen);
|
||||
if (!nMapMode)
|
||||
{
|
||||
if (!SHIFTS_IS_PRESSED)
|
||||
{
|
||||
G_ChangeHudLayout(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
hud_scale = hud_scale + 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_Shrink_Screen);
|
||||
if (!nMapMode)
|
||||
{
|
||||
if (!SHIFTS_IS_PRESSED)
|
||||
{
|
||||
G_ChangeHudLayout(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
hud_scale = hud_scale - 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// go to 3rd person view?
|
||||
if (buttonMap.ButtonDown(gamefunc_Third_Person_View))
|
||||
{
|
||||
if (!nFreeze)
|
||||
{
|
||||
if (bCamera) {
|
||||
bCamera = false;
|
||||
}
|
||||
else {
|
||||
bCamera = true;
|
||||
}
|
||||
|
||||
if (bCamera)
|
||||
GrabPalette();
|
||||
}
|
||||
buttonMap.ClearButton(gamefunc_Third_Person_View);
|
||||
return;
|
||||
}
|
||||
|
||||
if (paused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
void CheckKeys();
|
||||
void CheckKeys2();
|
||||
|
||||
void FinishLevel()
|
||||
{
|
||||
|
@ -153,7 +95,6 @@ void FinishLevel()
|
|||
PlayLocalSound(StaticSound[59], 0, true, CHANF_UI);
|
||||
videoNextPage();
|
||||
//WaitTicks(12);
|
||||
WaitVBL();
|
||||
DrawView(65536);
|
||||
videoNextPage();
|
||||
}
|
||||
|
@ -357,13 +298,6 @@ STARTGAME2:
|
|||
}
|
||||
|
||||
InitPlayerInventory(nPlayer);
|
||||
|
||||
if (i == 0) {
|
||||
PlayerList[nPlayer].someNetVal = -3;
|
||||
}
|
||||
else {
|
||||
PlayerList[nPlayer].someNetVal = -4;
|
||||
}
|
||||
}
|
||||
|
||||
nNetMoves = 0;
|
||||
|
@ -588,50 +522,7 @@ GAMELOOP:
|
|||
bInMove = false;
|
||||
RefreshStatus();
|
||||
}
|
||||
else if (buttonMap.ButtonDown(gamefunc_Map)) // e.g. TAB (to show 2D map)
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_Map);
|
||||
|
||||
if (!nFreeze) {
|
||||
nMapMode = (nMapMode+1)%3;
|
||||
}
|
||||
}
|
||||
|
||||
if (nMapMode != 0)
|
||||
{
|
||||
int const timerOffset = ((int) totalclock - nonsharedtimer);
|
||||
nonsharedtimer += timerOffset;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Zoom_In))
|
||||
lMapZoom += mulscale6(timerOffset, max<int>(lMapZoom, 256));
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Zoom_Out))
|
||||
lMapZoom -= mulscale6(timerOffset, max<int>(lMapZoom, 256));
|
||||
|
||||
lMapZoom = clamp(lMapZoom, 48, 2048);
|
||||
}
|
||||
|
||||
if (PlayerList[nLocalPlayer].nHealth > 0)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Inventory_Left))
|
||||
{
|
||||
SetPrevItem(nLocalPlayer);
|
||||
buttonMap.ClearButton(gamefunc_Inventory_Left);
|
||||
}
|
||||
if (buttonMap.ButtonDown(gamefunc_Inventory_Right))
|
||||
{
|
||||
SetNextItem(nLocalPlayer);
|
||||
buttonMap.ClearButton(gamefunc_Inventory_Right);
|
||||
}
|
||||
if (buttonMap.ButtonDown(gamefunc_Inventory))
|
||||
{
|
||||
UseCurItem(nLocalPlayer);
|
||||
buttonMap.ClearButton(gamefunc_Inventory);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SetAirFrame();
|
||||
}
|
||||
CheckKeys2();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -20,6 +20,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "engine.h"
|
||||
#include "exhumed.h"
|
||||
#include "player.h"
|
||||
#include "aistuff.h"
|
||||
#include "status.h"
|
||||
#include "view.h"
|
||||
#include <string.h>
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
@ -106,28 +109,6 @@ void SendInput()
|
|||
|
||||
}
|
||||
|
||||
void LogoffPlayer(int nPlayer)
|
||||
{
|
||||
if (nPlayer == nLocalPlayer)
|
||||
return;
|
||||
|
||||
if (PlayerList[nPlayer].someNetVal == -1)
|
||||
return;
|
||||
|
||||
memset(&sPlayerInput[nPlayer], 0, sizeof(sPlayerInput));
|
||||
|
||||
sprite[nDoppleSprite[nPlayer]].cstat = 0x8000u;
|
||||
sprite[nPlayerFloorSprite[nPlayer]].cstat = 0x8000u;
|
||||
sprite[PlayerList[nPlayer].nSprite].cstat = 0x8000u;
|
||||
|
||||
PlayerList[nPlayer].someNetVal = -1;
|
||||
|
||||
StatusMessage(150, "Player %d has left the game", nPlayer);
|
||||
|
||||
// TODO ClearPlayerInput(&sPlayerInput[nPlayer]);
|
||||
nNetPlayerCount--;
|
||||
}
|
||||
|
||||
short nNetMoveFrames = 0;
|
||||
|
||||
void UpdateInputs()
|
||||
|
@ -146,4 +127,110 @@ void UpdateInputs()
|
|||
}
|
||||
}
|
||||
|
||||
void CheckKeys()
|
||||
{
|
||||
if (!nMapMode)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_Enlarge_Screen);
|
||||
if (!SHIFTS_IS_PRESSED)
|
||||
{
|
||||
G_ChangeHudLayout(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
hud_scale = hud_scale + 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_Shrink_Screen);
|
||||
if (!SHIFTS_IS_PRESSED)
|
||||
{
|
||||
G_ChangeHudLayout(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
hud_scale = hud_scale - 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// go to 3rd person view?
|
||||
if (buttonMap.ButtonDown(gamefunc_Third_Person_View))
|
||||
{
|
||||
if (!nFreeze)
|
||||
{
|
||||
if (bCamera) {
|
||||
bCamera = false;
|
||||
}
|
||||
else {
|
||||
bCamera = true;
|
||||
}
|
||||
|
||||
if (bCamera)
|
||||
GrabPalette();
|
||||
}
|
||||
buttonMap.ClearButton(gamefunc_Third_Person_View);
|
||||
return;
|
||||
}
|
||||
|
||||
if (paused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t nonsharedtimer;
|
||||
|
||||
void CheckKeys2()
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Map)) // e.g. TAB (to show 2D map)
|
||||
{
|
||||
buttonMap.ClearButton(gamefunc_Map);
|
||||
|
||||
if (!nFreeze) {
|
||||
nMapMode = (nMapMode + 1) % 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (nMapMode != 0)
|
||||
{
|
||||
int const timerOffset = ((int)totalclock - nonsharedtimer);
|
||||
nonsharedtimer += timerOffset;
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen))
|
||||
lMapZoom += mulscale6(timerOffset, max<int>(lMapZoom, 256));
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Shrink_Screen))
|
||||
lMapZoom -= mulscale6(timerOffset, max<int>(lMapZoom, 256));
|
||||
|
||||
lMapZoom = clamp(lMapZoom, 48, 2048);
|
||||
}
|
||||
|
||||
if (PlayerList[nLocalPlayer].nHealth > 0)
|
||||
{
|
||||
if (buttonMap.ButtonDown(gamefunc_Inventory_Left))
|
||||
{
|
||||
SetPrevItem(nLocalPlayer);
|
||||
buttonMap.ClearButton(gamefunc_Inventory_Left);
|
||||
}
|
||||
if (buttonMap.ButtonDown(gamefunc_Inventory_Right))
|
||||
{
|
||||
SetNextItem(nLocalPlayer);
|
||||
buttonMap.ClearButton(gamefunc_Inventory_Right);
|
||||
}
|
||||
if (buttonMap.ButtonDown(gamefunc_Inventory))
|
||||
{
|
||||
UseCurItem(nLocalPlayer);
|
||||
buttonMap.ClearButton(gamefunc_Inventory);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SetAirFrame();
|
||||
}
|
||||
}
|
||||
|
||||
END_PS_NS
|
||||
|
|
|
@ -135,14 +135,6 @@ uint8_t RemapPLU(uint8_t pal)
|
|||
return pal;
|
||||
}
|
||||
|
||||
void WaitVBL()
|
||||
{
|
||||
#ifdef __WATCOMC__
|
||||
while (!(inp(0x3da) & 8));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void GrabPalette()
|
||||
{
|
||||
nPalDiff = 0;
|
||||
|
|
|
@ -928,9 +928,6 @@ void FuncPlayer(int a, int nDamage, int nRun)
|
|||
short nPlayer = RunData[nRun].nVal;
|
||||
assert(nPlayer >= 0 && nPlayer < kMaxPlayers);
|
||||
|
||||
if (PlayerList[nPlayer].someNetVal == -1)
|
||||
return;
|
||||
|
||||
short nPlayerSprite = PlayerList[nPlayer].nSprite;
|
||||
|
||||
short nDopple = nDoppleSprite[nPlayer];
|
||||
|
|
|
@ -53,7 +53,6 @@ struct Player
|
|||
short nAction;
|
||||
short nSprite;
|
||||
short bIsMummified;
|
||||
short someNetVal;
|
||||
short invincibility;
|
||||
short nAir;
|
||||
short nSeq;
|
||||
|
|
Loading…
Reference in a new issue