mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-18 10:31:42 +00:00
Merge branch 'control-selector' into tutorial-time
This commit is contained in:
commit
1e00381075
33 changed files with 854 additions and 238 deletions
|
@ -13,8 +13,6 @@
|
||||||
- libupnp (Linux/OS X only)
|
- libupnp (Linux/OS X only)
|
||||||
- libgme (Linux/OS X only)
|
- libgme (Linux/OS X only)
|
||||||
|
|
||||||
Warning: 64-bit builds are not netgame compatible with 32-bit builds. Use at your own risk.
|
|
||||||
|
|
||||||
## Compiling
|
## Compiling
|
||||||
|
|
||||||
See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling)
|
See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling)
|
||||||
|
|
|
@ -2353,7 +2353,7 @@ void CL_ClearPlayer(INT32 playernum)
|
||||||
//
|
//
|
||||||
// Removes a player from the current game
|
// Removes a player from the current game
|
||||||
//
|
//
|
||||||
static void CL_RemovePlayer(INT32 playernum)
|
static void CL_RemovePlayer(INT32 playernum, INT32 reason)
|
||||||
{
|
{
|
||||||
// Sanity check: exceptional cases (i.e. c-fails) can cause multiple
|
// Sanity check: exceptional cases (i.e. c-fails) can cause multiple
|
||||||
// kick commands to be issued for the same player.
|
// kick commands to be issued for the same player.
|
||||||
|
@ -2408,6 +2408,10 @@ static void CL_RemovePlayer(INT32 playernum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting
|
||||||
|
#endif
|
||||||
|
|
||||||
// Reset player data
|
// Reset player data
|
||||||
CL_ClearPlayer(playernum);
|
CL_ClearPlayer(playernum);
|
||||||
|
|
||||||
|
@ -2683,6 +2687,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||||
INT32 pnum, msg;
|
INT32 pnum, msg;
|
||||||
char buf[3 + MAX_REASONLENGTH];
|
char buf[3 + MAX_REASONLENGTH];
|
||||||
char *reason = buf;
|
char *reason = buf;
|
||||||
|
kickreason_t kickreason = KR_KICK;
|
||||||
|
|
||||||
pnum = READUINT8(*p);
|
pnum = READUINT8(*p);
|
||||||
msg = READUINT8(*p);
|
msg = READUINT8(*p);
|
||||||
|
@ -2765,14 +2770,17 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||||
{
|
{
|
||||||
case KICK_MSG_GO_AWAY:
|
case KICK_MSG_GO_AWAY:
|
||||||
CONS_Printf(M_GetText("has been kicked (Go away)\n"));
|
CONS_Printf(M_GetText("has been kicked (Go away)\n"));
|
||||||
|
kickreason = KR_KICK;
|
||||||
break;
|
break;
|
||||||
#ifdef NEWPING
|
#ifdef NEWPING
|
||||||
case KICK_MSG_PING_HIGH:
|
case KICK_MSG_PING_HIGH:
|
||||||
CONS_Printf(M_GetText("left the game (Broke ping limit)\n"));
|
CONS_Printf(M_GetText("left the game (Broke ping limit)\n"));
|
||||||
|
kickreason = KR_PINGLIMIT;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case KICK_MSG_CON_FAIL:
|
case KICK_MSG_CON_FAIL:
|
||||||
CONS_Printf(M_GetText("left the game (Synch failure)\n"));
|
CONS_Printf(M_GetText("left the game (Synch failure)\n"));
|
||||||
|
kickreason = KR_SYNCH;
|
||||||
|
|
||||||
if (M_CheckParm("-consisdump")) // Helps debugging some problems
|
if (M_CheckParm("-consisdump")) // Helps debugging some problems
|
||||||
{
|
{
|
||||||
|
@ -2809,21 +2817,26 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||||
break;
|
break;
|
||||||
case KICK_MSG_TIMEOUT:
|
case KICK_MSG_TIMEOUT:
|
||||||
CONS_Printf(M_GetText("left the game (Connection timeout)\n"));
|
CONS_Printf(M_GetText("left the game (Connection timeout)\n"));
|
||||||
|
kickreason = KR_TIMEOUT;
|
||||||
break;
|
break;
|
||||||
case KICK_MSG_PLAYER_QUIT:
|
case KICK_MSG_PLAYER_QUIT:
|
||||||
if (netgame) // not splitscreen/bots
|
if (netgame) // not splitscreen/bots
|
||||||
CONS_Printf(M_GetText("left the game\n"));
|
CONS_Printf(M_GetText("left the game\n"));
|
||||||
|
kickreason = KR_LEAVE;
|
||||||
break;
|
break;
|
||||||
case KICK_MSG_BANNED:
|
case KICK_MSG_BANNED:
|
||||||
CONS_Printf(M_GetText("has been banned (Don't come back)\n"));
|
CONS_Printf(M_GetText("has been banned (Don't come back)\n"));
|
||||||
|
kickreason = KR_BAN;
|
||||||
break;
|
break;
|
||||||
case KICK_MSG_CUSTOM_KICK:
|
case KICK_MSG_CUSTOM_KICK:
|
||||||
READSTRINGN(*p, reason, MAX_REASONLENGTH+1);
|
READSTRINGN(*p, reason, MAX_REASONLENGTH+1);
|
||||||
CONS_Printf(M_GetText("has been kicked (%s)\n"), reason);
|
CONS_Printf(M_GetText("has been kicked (%s)\n"), reason);
|
||||||
|
kickreason = KR_KICK;
|
||||||
break;
|
break;
|
||||||
case KICK_MSG_CUSTOM_BAN:
|
case KICK_MSG_CUSTOM_BAN:
|
||||||
READSTRINGN(*p, reason, MAX_REASONLENGTH+1);
|
READSTRINGN(*p, reason, MAX_REASONLENGTH+1);
|
||||||
CONS_Printf(M_GetText("has been banned (%s)\n"), reason);
|
CONS_Printf(M_GetText("has been banned (%s)\n"), reason);
|
||||||
|
kickreason = KR_BAN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2851,7 +2864,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
||||||
M_StartMessage(M_GetText("You have been kicked by the server\n\nPress ESC\n"), NULL, MM_NOTHING);
|
M_StartMessage(M_GetText("You have been kicked by the server\n\nPress ESC\n"), NULL, MM_NOTHING);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CL_RemovePlayer(pnum);
|
CL_RemovePlayer(pnum, kickreason);
|
||||||
}
|
}
|
||||||
|
|
||||||
consvar_t cv_allownewplayer = {"allowjoin", "On", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
|
consvar_t cv_allownewplayer = {"allowjoin", "On", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL };
|
||||||
|
|
|
@ -454,6 +454,17 @@ extern consvar_t cv_playbackspeed;
|
||||||
#define KICK_MSG_CUSTOM_KICK 7
|
#define KICK_MSG_CUSTOM_KICK 7
|
||||||
#define KICK_MSG_CUSTOM_BAN 8
|
#define KICK_MSG_CUSTOM_BAN 8
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
KR_KICK = 1, //Kicked by server
|
||||||
|
KR_PINGLIMIT = 2, //Broke Ping Limit
|
||||||
|
KR_SYNCH = 3, //Synch Failure
|
||||||
|
KR_TIMEOUT = 4, //Connection Timeout
|
||||||
|
KR_BAN = 5, //Banned by server
|
||||||
|
KR_LEAVE = 6, //Quit the game
|
||||||
|
|
||||||
|
} kickreason_t;
|
||||||
|
|
||||||
extern boolean server;
|
extern boolean server;
|
||||||
#define client (!server)
|
#define client (!server)
|
||||||
extern boolean dedicated; // For dedicated server
|
extern boolean dedicated; // For dedicated server
|
||||||
|
|
|
@ -126,8 +126,6 @@ FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void);
|
||||||
static void Command_Playintro_f(void);
|
static void Command_Playintro_f(void);
|
||||||
|
|
||||||
static void Command_Displayplayer_f(void);
|
static void Command_Displayplayer_f(void);
|
||||||
static void Command_Tunes_f(void);
|
|
||||||
static void Command_RestartAudio_f(void);
|
|
||||||
|
|
||||||
static void Command_ExitLevel_f(void);
|
static void Command_ExitLevel_f(void);
|
||||||
static void Command_Showmap_f(void);
|
static void Command_Showmap_f(void);
|
||||||
|
@ -315,8 +313,6 @@ consvar_t cv_timetic = {"timerres", "Classic", CV_SAVE, timetic_cons_t, NULL, 0,
|
||||||
static CV_PossibleValue_t powerupdisplay_cons_t[] = {{0, "Never"}, {1, "First-person only"}, {2, "Always"}, {0, NULL}};
|
static CV_PossibleValue_t powerupdisplay_cons_t[] = {{0, "Never"}, {1, "First-person only"}, {2, "Always"}, {0, NULL}};
|
||||||
consvar_t cv_powerupdisplay = {"powerupdisplay", "First-person only", CV_SAVE, powerupdisplay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_powerupdisplay = {"powerupdisplay", "First-person only", CV_SAVE, powerupdisplay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
|
|
||||||
static CV_PossibleValue_t pointlimit_cons_t[] = {{0, "MIN"}, {999999990, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t pointlimit_cons_t[] = {{0, "MIN"}, {999999990, "MAX"}, {0, NULL}};
|
||||||
consvar_t cv_pointlimit = {"pointlimit", "0", CV_NETVAR|CV_CALL|CV_NOINIT, pointlimit_cons_t,
|
consvar_t cv_pointlimit = {"pointlimit", "0", CV_NETVAR|CV_CALL|CV_NOINIT, pointlimit_cons_t,
|
||||||
PointLimit_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
PointLimit_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
@ -685,9 +681,6 @@ void D_RegisterClientCommands(void)
|
||||||
CV_RegisterVar(&cv_ghost_guest);
|
CV_RegisterVar(&cv_ghost_guest);
|
||||||
|
|
||||||
COM_AddCommand("displayplayer", Command_Displayplayer_f);
|
COM_AddCommand("displayplayer", Command_Displayplayer_f);
|
||||||
COM_AddCommand("tunes", Command_Tunes_f);
|
|
||||||
COM_AddCommand("restartaudio", Command_RestartAudio_f);
|
|
||||||
CV_RegisterVar(&cv_resetmusic);
|
|
||||||
|
|
||||||
// FIXME: not to be here.. but needs be done for config loading
|
// FIXME: not to be here.. but needs be done for config loading
|
||||||
CV_RegisterVar(&cv_globalgamma);
|
CV_RegisterVar(&cv_globalgamma);
|
||||||
|
@ -3989,94 +3982,6 @@ static void Command_Displayplayer_f(void)
|
||||||
CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayer);
|
CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Command_Tunes_f(void)
|
|
||||||
{
|
|
||||||
const char *tunearg;
|
|
||||||
UINT16 tunenum, track = 0;
|
|
||||||
const size_t argc = COM_Argc();
|
|
||||||
|
|
||||||
if (argc < 2) //tunes slot ...
|
|
||||||
{
|
|
||||||
CONS_Printf("tunes <name/num> [track] [speed] / <-show> / <-default> / <-none>:\n");
|
|
||||||
CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n"));
|
|
||||||
CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n"));
|
|
||||||
CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n"));
|
|
||||||
CONS_Printf(M_GetText("* With \"-default\", returns to the default music for the map.\n"));
|
|
||||||
CONS_Printf(M_GetText("* With \"-none\", any music playing will be stopped.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
tunearg = COM_Argv(1);
|
|
||||||
tunenum = (UINT16)atoi(tunearg);
|
|
||||||
track = 0;
|
|
||||||
|
|
||||||
if (!strcasecmp(tunearg, "-show"))
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"),
|
|
||||||
mapmusname, (mapmusflags & MUSIC_TRACKMASK));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!strcasecmp(tunearg, "-none"))
|
|
||||||
{
|
|
||||||
S_StopMusic();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (!strcasecmp(tunearg, "-default"))
|
|
||||||
{
|
|
||||||
tunearg = mapheaderinfo[gamemap-1]->musname;
|
|
||||||
track = mapheaderinfo[gamemap-1]->mustrack;
|
|
||||||
}
|
|
||||||
else if (!tunearg[2] && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z')
|
|
||||||
tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]);
|
|
||||||
|
|
||||||
if (tunenum && tunenum >= 1036)
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case
|
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n"));
|
|
||||||
|
|
||||||
if (argc > 2)
|
|
||||||
track = (UINT16)atoi(COM_Argv(2))-1;
|
|
||||||
|
|
||||||
if (tunenum)
|
|
||||||
snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum));
|
|
||||||
else
|
|
||||||
strncpy(mapmusname, tunearg, 7);
|
|
||||||
mapmusname[6] = 0;
|
|
||||||
mapmusflags = (track & MUSIC_TRACKMASK);
|
|
||||||
|
|
||||||
S_ChangeMusic(mapmusname, mapmusflags, true);
|
|
||||||
|
|
||||||
if (argc > 3)
|
|
||||||
{
|
|
||||||
float speed = (float)atof(COM_Argv(3));
|
|
||||||
if (speed > 0.0f)
|
|
||||||
S_SpeedMusic(speed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Command_RestartAudio_f(void)
|
|
||||||
{
|
|
||||||
if (dedicated) // No point in doing anything if game is a dedicated server.
|
|
||||||
return;
|
|
||||||
|
|
||||||
S_StopMusic();
|
|
||||||
S_StopSounds();
|
|
||||||
I_ShutdownMusic();
|
|
||||||
I_ShutdownSound();
|
|
||||||
I_StartupSound();
|
|
||||||
I_InitMusic();
|
|
||||||
|
|
||||||
// These must be called or no sound and music until manually set.
|
|
||||||
|
|
||||||
I_SetSfxVolume(cv_soundvolume.value);
|
|
||||||
S_SetMusicVolume(cv_digmusicvolume.value, cv_midimusicvolume.value);
|
|
||||||
if (Playing()) // Gotta make sure the player is in a level
|
|
||||||
P_RestoreMusic(&players[consoleplayer]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Quits a game and returns to the title screen.
|
/** Quits a game and returns to the title screen.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -103,8 +103,6 @@ extern consvar_t cv_startinglives;
|
||||||
// for F_finale.c
|
// for F_finale.c
|
||||||
extern consvar_t cv_rollingdemos;
|
extern consvar_t cv_rollingdemos;
|
||||||
|
|
||||||
extern consvar_t cv_resetmusic;
|
|
||||||
|
|
||||||
extern consvar_t cv_ringslinger, cv_soundtest;
|
extern consvar_t cv_ringslinger, cv_soundtest;
|
||||||
|
|
||||||
extern consvar_t cv_specialrings, cv_powerstones, cv_matchboxes, cv_competitionboxes;
|
extern consvar_t cv_specialrings, cv_powerstones, cv_matchboxes, cv_competitionboxes;
|
||||||
|
@ -203,5 +201,3 @@ void D_SetPassword(const char *pw);
|
||||||
UINT8 CanChangeSkin(INT32 playernum);
|
UINT8 CanChangeSkin(INT32 playernum);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "fastcmp.h"
|
#include "fastcmp.h"
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
#include "lua_hook.h"
|
#include "lua_hook.h"
|
||||||
|
#include "d_clisrv.h"
|
||||||
|
|
||||||
#include "m_cond.h"
|
#include "m_cond.h"
|
||||||
|
|
||||||
|
@ -914,7 +915,10 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
||||||
|
|
||||||
// Get the part before the " = "
|
// Get the part before the " = "
|
||||||
tmp = strchr(s, '=');
|
tmp = strchr(s, '=');
|
||||||
|
if (tmp)
|
||||||
*(tmp-1) = '\0';
|
*(tmp-1) = '\0';
|
||||||
|
else
|
||||||
|
break;
|
||||||
strupr(word);
|
strupr(word);
|
||||||
|
|
||||||
// Now get the part after
|
// Now get the part after
|
||||||
|
@ -1573,7 +1577,10 @@ static void readhuditem(MYFILE *f, INT32 num)
|
||||||
|
|
||||||
// Get the part before the " = "
|
// Get the part before the " = "
|
||||||
tmp = strchr(s, '=');
|
tmp = strchr(s, '=');
|
||||||
|
if (tmp)
|
||||||
*(tmp-1) = '\0';
|
*(tmp-1) = '\0';
|
||||||
|
else
|
||||||
|
break;
|
||||||
strupr(word);
|
strupr(word);
|
||||||
|
|
||||||
// Now get the part after
|
// Now get the part after
|
||||||
|
@ -2079,7 +2086,10 @@ static void reademblemdata(MYFILE *f, INT32 num)
|
||||||
|
|
||||||
// Get the part before the " = "
|
// Get the part before the " = "
|
||||||
tmp = strchr(s, '=');
|
tmp = strchr(s, '=');
|
||||||
|
if (tmp)
|
||||||
*(tmp-1) = '\0';
|
*(tmp-1) = '\0';
|
||||||
|
else
|
||||||
|
break;
|
||||||
strupr(word);
|
strupr(word);
|
||||||
|
|
||||||
// Now get the part after
|
// Now get the part after
|
||||||
|
@ -2214,7 +2224,10 @@ static void readextraemblemdata(MYFILE *f, INT32 num)
|
||||||
|
|
||||||
// Get the part before the " = "
|
// Get the part before the " = "
|
||||||
tmp = strchr(s, '=');
|
tmp = strchr(s, '=');
|
||||||
|
if (tmp)
|
||||||
*(tmp-1) = '\0';
|
*(tmp-1) = '\0';
|
||||||
|
else
|
||||||
|
break;
|
||||||
strupr(word);
|
strupr(word);
|
||||||
|
|
||||||
// Now get the part after
|
// Now get the part after
|
||||||
|
@ -2289,7 +2302,10 @@ static void readunlockable(MYFILE *f, INT32 num)
|
||||||
|
|
||||||
// Get the part before the " = "
|
// Get the part before the " = "
|
||||||
tmp = strchr(s, '=');
|
tmp = strchr(s, '=');
|
||||||
|
if (tmp)
|
||||||
*(tmp-1) = '\0';
|
*(tmp-1) = '\0';
|
||||||
|
else
|
||||||
|
break;
|
||||||
strupr(word);
|
strupr(word);
|
||||||
|
|
||||||
// Now get the part after
|
// Now get the part after
|
||||||
|
@ -2576,7 +2592,10 @@ static void readconditionset(MYFILE *f, UINT8 setnum)
|
||||||
|
|
||||||
// Get the part before the " = "
|
// Get the part before the " = "
|
||||||
tmp = strchr(s, '=');
|
tmp = strchr(s, '=');
|
||||||
|
if (tmp)
|
||||||
*(tmp-1) = '\0';
|
*(tmp-1) = '\0';
|
||||||
|
else
|
||||||
|
break;
|
||||||
strupr(word);
|
strupr(word);
|
||||||
|
|
||||||
// Now get the part after
|
// Now get the part after
|
||||||
|
@ -2637,7 +2656,10 @@ static void readmaincfg(MYFILE *f)
|
||||||
|
|
||||||
// Get the part before the " = "
|
// Get the part before the " = "
|
||||||
tmp = strchr(s, '=');
|
tmp = strchr(s, '=');
|
||||||
|
if (tmp)
|
||||||
*(tmp-1) = '\0';
|
*(tmp-1) = '\0';
|
||||||
|
else
|
||||||
|
break;
|
||||||
strupr(word);
|
strupr(word);
|
||||||
|
|
||||||
// Now get the part after
|
// Now get the part after
|
||||||
|
@ -2921,7 +2943,10 @@ static void readwipes(MYFILE *f)
|
||||||
|
|
||||||
// Get the part before the " = "
|
// Get the part before the " = "
|
||||||
tmp = strchr(s, '=');
|
tmp = strchr(s, '=');
|
||||||
|
if (tmp)
|
||||||
*(tmp-1) = '\0';
|
*(tmp-1) = '\0';
|
||||||
|
else
|
||||||
|
break;
|
||||||
strupr(word);
|
strupr(word);
|
||||||
|
|
||||||
// Now get the part after
|
// Now get the part after
|
||||||
|
@ -7760,6 +7785,13 @@ struct {
|
||||||
// Node flags
|
// Node flags
|
||||||
{"NF_SUBSECTOR",NF_SUBSECTOR}, // Indicate a leaf.
|
{"NF_SUBSECTOR",NF_SUBSECTOR}, // Indicate a leaf.
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ESLOPE
|
||||||
|
// Slope flags
|
||||||
|
{"SL_NOPHYSICS",SL_NOPHYSICS}, // Don't do momentum adjustment with this slope
|
||||||
|
{"SL_NODYNAMIC",SL_NODYNAMIC}, // Slope will never need to move during the level, so don't fuss with recalculating it
|
||||||
|
{"SL_ANCHORVERTEX",SL_ANCHORVERTEX},// Slope is using a Slope Vertex Thing to anchor its position
|
||||||
|
{"SL_VERTEXSLOPE",SL_VERTEXSLOPE}, // Slope is built from three Slope Vertex Things
|
||||||
|
#endif
|
||||||
|
|
||||||
// Angles
|
// Angles
|
||||||
{"ANG1",ANG1},
|
{"ANG1",ANG1},
|
||||||
|
@ -7892,6 +7924,14 @@ struct {
|
||||||
|
|
||||||
{"V_CHARCOLORSHIFT",V_CHARCOLORSHIFT},
|
{"V_CHARCOLORSHIFT",V_CHARCOLORSHIFT},
|
||||||
{"V_ALPHASHIFT",V_ALPHASHIFT},
|
{"V_ALPHASHIFT",V_ALPHASHIFT},
|
||||||
|
|
||||||
|
//Kick Reasons
|
||||||
|
{"KR_KICK",KR_KICK},
|
||||||
|
{"KR_PINGLIMIT",KR_PINGLIMIT},
|
||||||
|
{"KR_SYNCH",KR_SYNCH},
|
||||||
|
{"KR_TIMEOUT",KR_TIMEOUT},
|
||||||
|
{"KR_BAN",KR_BAN},
|
||||||
|
{"KR_LEAVE",KR_LEAVE},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{NULL,0}
|
{NULL,0}
|
||||||
|
@ -8756,6 +8796,9 @@ static inline int lib_getenum(lua_State *L)
|
||||||
} else if (fastcmp(word,"maptol")) {
|
} else if (fastcmp(word,"maptol")) {
|
||||||
lua_pushinteger(L, maptol);
|
lua_pushinteger(L, maptol);
|
||||||
return 1;
|
return 1;
|
||||||
|
} else if (fastcmp(word,"ultimatemode")) {
|
||||||
|
lua_pushboolean(L, ultimatemode != 0);
|
||||||
|
return 1;
|
||||||
} else if (fastcmp(word,"mariomode")) {
|
} else if (fastcmp(word,"mariomode")) {
|
||||||
lua_pushboolean(L, mariomode != 0);
|
lua_pushboolean(L, mariomode != 0);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
149
src/g_input.c
149
src/g_input.c
|
@ -45,6 +45,7 @@ UINT8 gamekeydown[NUMINPUTS];
|
||||||
// two key codes (or virtual key) per game control
|
// two key codes (or virtual key) per game control
|
||||||
INT32 gamecontrol[num_gamecontrols][2];
|
INT32 gamecontrol[num_gamecontrols][2];
|
||||||
INT32 gamecontrolbis[num_gamecontrols][2]; // secondary splitscreen player
|
INT32 gamecontrolbis[num_gamecontrols][2]; // secondary splitscreen player
|
||||||
|
INT32 gamecontroldefault[num_gamecontrolschemes][num_gamecontrols][2]; // default control storage, use 0 (gcs_custom) for memory retention
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -611,55 +612,119 @@ INT32 G_KeyStringtoNum(const char *keystr)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_Controldefault(void)
|
void G_DefineDefaultControls(void)
|
||||||
{
|
{
|
||||||
gamecontrol[gc_forward ][0] = 'w';
|
INT32 i;
|
||||||
gamecontrol[gc_backward ][0] = 's';
|
|
||||||
gamecontrol[gc_strafeleft ][0] = 'a';
|
// FPS game controls (WASD)
|
||||||
gamecontrol[gc_straferight][0] = 'd';
|
gamecontroldefault[gcs_fps][gc_forward ][0] = 'w';
|
||||||
gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW;
|
gamecontroldefault[gcs_fps][gc_backward ][0] = 's';
|
||||||
gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW;
|
gamecontroldefault[gcs_fps][gc_strafeleft ][0] = 'a';
|
||||||
gamecontrol[gc_weaponnext ][0] = 'e';
|
gamecontroldefault[gcs_fps][gc_straferight][0] = 'd';
|
||||||
gamecontrol[gc_weaponprev ][0] = 'q';
|
gamecontroldefault[gcs_fps][gc_lookup ][0] = KEY_UPARROW;
|
||||||
gamecontrol[gc_wepslot1 ][0] = '1';
|
gamecontroldefault[gcs_fps][gc_lookdown ][0] = KEY_DOWNARROW;
|
||||||
gamecontrol[gc_wepslot2 ][0] = '2';
|
gamecontroldefault[gcs_fps][gc_turnleft ][0] = KEY_LEFTARROW;
|
||||||
gamecontrol[gc_wepslot3 ][0] = '3';
|
gamecontroldefault[gcs_fps][gc_turnright ][0] = KEY_RIGHTARROW;
|
||||||
gamecontrol[gc_wepslot4 ][0] = '4';
|
gamecontroldefault[gcs_fps][gc_centerview ][0] = KEY_END;
|
||||||
gamecontrol[gc_wepslot5 ][0] = '5';
|
gamecontroldefault[gcs_fps][gc_jump ][0] = KEY_SPACE;
|
||||||
gamecontrol[gc_wepslot6 ][0] = '6';
|
gamecontroldefault[gcs_fps][gc_use ][0] = KEY_LSHIFT;
|
||||||
gamecontrol[gc_wepslot7 ][0] = '7';
|
gamecontroldefault[gcs_fps][gc_fire ][0] = KEY_RCTRL;
|
||||||
gamecontrol[gc_wepslot8 ][0] = '8';
|
gamecontroldefault[gcs_fps][gc_fire ][1] = KEY_MOUSE1+0;
|
||||||
gamecontrol[gc_wepslot9 ][0] = '9';
|
gamecontroldefault[gcs_fps][gc_firenormal ][0] = 'c';
|
||||||
gamecontrol[gc_wepslot10 ][0] = '0';
|
|
||||||
gamecontrol[gc_fire ][0] = KEY_RCTRL;
|
// Platform game controls (arrow keys)
|
||||||
gamecontrol[gc_fire ][1] = KEY_MOUSE1+0;
|
// gamecontroldefault[gcs_platform][gc_forward ][0] = KEY_UPARROW;
|
||||||
gamecontrol[gc_firenormal ][0] = 'c';
|
// gamecontroldefault[gcs_platform][gc_backward ][0] = KEY_DOWNARROW;
|
||||||
gamecontrol[gc_tossflag ][0] = '\'';
|
// gamecontroldefault[gcs_platform][gc_strafeleft ][0] = 'a';
|
||||||
gamecontrol[gc_use ][0] = KEY_LSHIFT;
|
// gamecontroldefault[gcs_platform][gc_straferight][0] = 'd';
|
||||||
gamecontrol[gc_camtoggle ][0] = 'v';
|
// gamecontroldefault[gcs_platform][gc_lookup ][0] = KEY_PGUP;
|
||||||
gamecontrol[gc_camreset ][0] = 'r';
|
// gamecontroldefault[gcs_platform][gc_lookdown ][0] = KEY_PGDN;
|
||||||
gamecontrol[gc_lookup ][0] = KEY_UPARROW;
|
// gamecontroldefault[gcs_platform][gc_turnleft ][0] = KEY_LEFTARROW;
|
||||||
gamecontrol[gc_lookdown ][0] = KEY_DOWNARROW;
|
// gamecontroldefault[gcs_platform][gc_turnright ][0] = KEY_RIGHTARROW;
|
||||||
gamecontrol[gc_centerview ][0] = KEY_END;
|
// gamecontroldefault[gcs_platform][gc_centerview ][0] = KEY_END;
|
||||||
gamecontrol[gc_talkkey ][0] = 't';
|
// gamecontroldefault[gcs_platform][gc_jump ][0] = KEY_SPACE;
|
||||||
gamecontrol[gc_teamkey ][0] = 'y';
|
// gamecontroldefault[gcs_platform][gc_use ][0] = KEY_LSHIFT;
|
||||||
gamecontrol[gc_scores ][0] = KEY_TAB;
|
// gamecontroldefault[gcs_platform][gc_fire ][0] = 's';
|
||||||
gamecontrol[gc_jump ][0] = KEY_SPACE;
|
// gamecontroldefault[gcs_platform][gc_fire ][1] = KEY_MOUSE1+0;
|
||||||
gamecontrol[gc_console ][0] = KEY_CONSOLE;
|
// gamecontroldefault[gcs_platform][gc_firenormal ][0] = 'w';
|
||||||
gamecontrol[gc_pause ][0] = KEY_PAUSE;
|
|
||||||
|
for (i = 1; i < num_gamecontrolschemes; i++) // skip gcs_custom (0)
|
||||||
|
{
|
||||||
|
gamecontroldefault[i][gc_weaponnext ][0] = 'e';
|
||||||
|
gamecontroldefault[i][gc_weaponprev ][0] = 'q';
|
||||||
|
gamecontroldefault[i][gc_wepslot1 ][0] = '1';
|
||||||
|
gamecontroldefault[i][gc_wepslot2 ][0] = '2';
|
||||||
|
gamecontroldefault[i][gc_wepslot3 ][0] = '3';
|
||||||
|
gamecontroldefault[i][gc_wepslot4 ][0] = '4';
|
||||||
|
gamecontroldefault[i][gc_wepslot5 ][0] = '5';
|
||||||
|
gamecontroldefault[i][gc_wepslot6 ][0] = '6';
|
||||||
|
gamecontroldefault[i][gc_wepslot7 ][0] = '7';
|
||||||
|
gamecontroldefault[i][gc_wepslot8 ][0] = '8';
|
||||||
|
gamecontroldefault[i][gc_wepslot9 ][0] = '9';
|
||||||
|
gamecontroldefault[i][gc_wepslot10 ][0] = '0';
|
||||||
|
gamecontroldefault[i][gc_tossflag ][0] = '\'';
|
||||||
|
gamecontroldefault[i][gc_camtoggle ][0] = 'v';
|
||||||
|
gamecontroldefault[i][gc_camreset ][0] = 'r';
|
||||||
|
gamecontroldefault[i][gc_talkkey ][0] = 't';
|
||||||
|
gamecontroldefault[i][gc_teamkey ][0] = 'y';
|
||||||
|
gamecontroldefault[i][gc_scores ][0] = KEY_TAB;
|
||||||
|
gamecontroldefault[i][gc_console ][0] = KEY_CONSOLE;
|
||||||
|
gamecontroldefault[i][gc_pause ][0] = KEY_PAUSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_SaveKeySetting(FILE *f)
|
INT32 G_GetControlScheme(INT32 (*fromcontrols)[2], boolean movementonly)
|
||||||
|
{
|
||||||
|
INT32 i, j, gc;
|
||||||
|
boolean skipscheme;
|
||||||
|
|
||||||
|
gamecontrols_e movement[] = {
|
||||||
|
gc_forward, gc_backward, gc_strafeleft, gc_straferight,
|
||||||
|
gc_lookup, gc_lookdown, gc_turnleft, gc_turnright, gc_centerview,
|
||||||
|
gc_jump, gc_use
|
||||||
|
// , gc_fire, gc_firenormal
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 1; i < num_gamecontrolschemes; i++) // skip gcs_custom (0)
|
||||||
|
{
|
||||||
|
skipscheme = false;
|
||||||
|
for (j = 0; j < (movementonly ? sizeof(movement) : num_gamecontrols); j++)
|
||||||
|
{
|
||||||
|
gc = (movementonly) ? movement[j] : j;
|
||||||
|
if (fromcontrols[gc][0] != gamecontroldefault[i][gc][0] && fromcontrols[gc][1] != gamecontroldefault[i][gc][1])
|
||||||
|
{
|
||||||
|
skipscheme = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!skipscheme)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return gcs_custom;
|
||||||
|
}
|
||||||
|
|
||||||
|
void G_CopyControls(INT32 (*setupcontrols)[2], INT32 (*fromcontrols)[2])
|
||||||
|
{
|
||||||
|
INT32 i;
|
||||||
|
for (i = 0; i < num_gamecontrols; i++)
|
||||||
|
{
|
||||||
|
setupcontrols[i][0] = fromcontrols[i][0];
|
||||||
|
setupcontrols[i][1] = fromcontrols[i][1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2], INT32 (*fromcontrolsbis)[2])
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
for (i = 1; i < num_gamecontrols; i++)
|
for (i = 1; i < num_gamecontrols; i++)
|
||||||
{
|
{
|
||||||
fprintf(f, "setcontrol \"%s\" \"%s\"", gamecontrolname[i],
|
fprintf(f, "setcontrol \"%s\" \"%s\"", gamecontrolname[i],
|
||||||
G_KeynumToString(gamecontrol[i][0]));
|
G_KeynumToString(fromcontrols[i][0]));
|
||||||
|
|
||||||
if (gamecontrol[i][1])
|
if (fromcontrols[i][1])
|
||||||
fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrol[i][1]));
|
fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrols[i][1]));
|
||||||
else
|
else
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
}
|
}
|
||||||
|
@ -667,10 +732,10 @@ void G_SaveKeySetting(FILE *f)
|
||||||
for (i = 1; i < num_gamecontrols; i++)
|
for (i = 1; i < num_gamecontrols; i++)
|
||||||
{
|
{
|
||||||
fprintf(f, "setcontrol2 \"%s\" \"%s\"", gamecontrolname[i],
|
fprintf(f, "setcontrol2 \"%s\" \"%s\"", gamecontrolname[i],
|
||||||
G_KeynumToString(gamecontrolbis[i][0]));
|
G_KeynumToString(fromcontrolsbis[i][0]));
|
||||||
|
|
||||||
if (gamecontrolbis[i][1])
|
if (fromcontrolsbis[i][1])
|
||||||
fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrolbis[i][1]));
|
fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrolsbis[i][1]));
|
||||||
else
|
else
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,14 @@ typedef enum
|
||||||
num_gamecontrols
|
num_gamecontrols
|
||||||
} gamecontrols_e;
|
} gamecontrols_e;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
gcs_custom,
|
||||||
|
gcs_fps,
|
||||||
|
//gcs_platform,
|
||||||
|
num_gamecontrolschemes
|
||||||
|
} gamecontrolschemes_e;
|
||||||
|
|
||||||
// mouse values are used once
|
// mouse values are used once
|
||||||
extern consvar_t cv_mousesens, cv_mouseysens;
|
extern consvar_t cv_mousesens, cv_mouseysens;
|
||||||
extern consvar_t cv_mousesens2, cv_mouseysens2;
|
extern consvar_t cv_mousesens2, cv_mouseysens2;
|
||||||
|
@ -116,6 +124,7 @@ extern UINT8 gamekeydown[NUMINPUTS];
|
||||||
// two key codes (or virtual key) per game control
|
// two key codes (or virtual key) per game control
|
||||||
extern INT32 gamecontrol[num_gamecontrols][2];
|
extern INT32 gamecontrol[num_gamecontrols][2];
|
||||||
extern INT32 gamecontrolbis[num_gamecontrols][2]; // secondary splitscreen player
|
extern INT32 gamecontrolbis[num_gamecontrols][2]; // secondary splitscreen player
|
||||||
|
extern INT32 gamecontroldefault[num_gamecontrolschemes][num_gamecontrols][2]; // default control storage, use 0 (gcs_custom) for memory retention
|
||||||
#define PLAYER1INPUTDOWN(gc) (gamekeydown[gamecontrol[gc][0]] || gamekeydown[gamecontrol[gc][1]])
|
#define PLAYER1INPUTDOWN(gc) (gamekeydown[gamecontrol[gc][0]] || gamekeydown[gamecontrol[gc][1]])
|
||||||
#define PLAYER2INPUTDOWN(gc) (gamekeydown[gamecontrolbis[gc][0]] || gamekeydown[gamecontrolbis[gc][1]])
|
#define PLAYER2INPUTDOWN(gc) (gamekeydown[gamecontrolbis[gc][0]] || gamekeydown[gamecontrolbis[gc][1]])
|
||||||
|
|
||||||
|
@ -133,8 +142,10 @@ INT32 G_KeyStringtoNum(const char *keystr);
|
||||||
void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control);
|
void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control);
|
||||||
void Command_Setcontrol_f(void);
|
void Command_Setcontrol_f(void);
|
||||||
void Command_Setcontrol2_f(void);
|
void Command_Setcontrol2_f(void);
|
||||||
void G_Controldefault(void);
|
void G_DefineDefaultControls(void);
|
||||||
void G_SaveKeySetting(FILE *f);
|
INT32 G_GetControlScheme(INT32 (*fromcontrols)[2], boolean movementonly);
|
||||||
|
void G_CopyControls(INT32 (*setupcontrols)[2], INT32 (*fromcontrols)[2]);
|
||||||
|
void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2], INT32 (*fromcontrolsbis)[2]);
|
||||||
void G_CheckDoubleUsage(INT32 keynum);
|
void G_CheckDoubleUsage(INT32 keynum);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,10 +26,6 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (VID_X11) && !defined (HAVE_SDL)
|
|
||||||
#include <GL/glx.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../doomdef.h"
|
#include "../doomdef.h"
|
||||||
//THIS MUST DISAPPEAR!!!
|
//THIS MUST DISAPPEAR!!!
|
||||||
#include "hw_glide.h"
|
#include "hw_glide.h"
|
||||||
|
|
|
@ -114,10 +114,10 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
||||||
if (option & V_NOSCALESTART)
|
if (option & V_NOSCALESTART)
|
||||||
sdupx = sdupy = 2.0f;
|
sdupx = sdupy = 2.0f;
|
||||||
|
|
||||||
v[0].x = v[3].x = (x*sdupx-gpatch->leftoffset*pdupx)/vid.width - 1;
|
v[0].x = v[3].x = (x*sdupx-SHORT(gpatch->leftoffset)*pdupx)/vid.width - 1;
|
||||||
v[2].x = v[1].x = (x*sdupx+(gpatch->width-gpatch->leftoffset)*pdupx)/vid.width - 1;
|
v[2].x = v[1].x = (x*sdupx+(SHORT(gpatch->width)-SHORT(gpatch->leftoffset))*pdupx)/vid.width - 1;
|
||||||
v[0].y = v[1].y = 1-(y*sdupy-gpatch->topoffset*pdupy)/vid.height;
|
v[0].y = v[1].y = 1-(y*sdupy-SHORT(gpatch->topoffset)*pdupy)/vid.height;
|
||||||
v[2].y = v[3].y = 1-(y*sdupy+(gpatch->height-gpatch->topoffset)*pdupy)/vid.height;
|
v[2].y = v[3].y = 1-(y*sdupy+(SHORT(gpatch->height)-SHORT(gpatch->topoffset))*pdupy)/vid.height;
|
||||||
|
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||||
|
|
||||||
|
@ -183,18 +183,29 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
||||||
dupx = dupy = (dupx < dupy ? dupx : dupy);
|
dupx = dupy = (dupx < dupy ? dupx : dupy);
|
||||||
fscalew = fscaleh = FIXED_TO_FLOAT(pscale);
|
fscalew = fscaleh = FIXED_TO_FLOAT(pscale);
|
||||||
|
|
||||||
if (option & V_OFFSET)
|
// See my comments in v_video.c's V_DrawFixedPatch
|
||||||
|
// -- Monster Iestyn 29/10/18
|
||||||
{
|
{
|
||||||
cx -= (float)gpatch->leftoffset * dupx * fscalew;
|
float offsetx = 0.0f, offsety = 0.0f;
|
||||||
cy -= (float)gpatch->topoffset * dupy * fscaleh;
|
|
||||||
}
|
// left offset
|
||||||
else
|
|
||||||
{
|
|
||||||
cy -= (float)gpatch->topoffset * fscaleh;
|
|
||||||
if (option & V_FLIP)
|
if (option & V_FLIP)
|
||||||
cx -= ((float)gpatch->width - (float)gpatch->leftoffset) * fscalew;
|
offsetx = (float)(SHORT(gpatch->width) - SHORT(gpatch->leftoffset)) * fscalew;
|
||||||
else
|
else
|
||||||
cx -= (float)gpatch->leftoffset * fscalew;
|
offsetx = (float)SHORT(gpatch->leftoffset) * fscalew;
|
||||||
|
|
||||||
|
// top offset
|
||||||
|
// TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!?
|
||||||
|
offsety = (float)SHORT(gpatch->topoffset) * fscaleh;
|
||||||
|
|
||||||
|
if ((option & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs
|
||||||
|
{
|
||||||
|
offsetx *= dupx;
|
||||||
|
offsety *= dupy;
|
||||||
|
}
|
||||||
|
|
||||||
|
cx -= offsetx;
|
||||||
|
cy -= offsety;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (splitscreen && (option & V_PERPLAYER))
|
if (splitscreen && (option & V_PERPLAYER))
|
||||||
|
@ -312,13 +323,13 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
||||||
|
|
||||||
if (pscale != FRACUNIT || (splitscreen && option & V_PERPLAYER))
|
if (pscale != FRACUNIT || (splitscreen && option & V_PERPLAYER))
|
||||||
{
|
{
|
||||||
fwidth = (float)gpatch->width * fscalew * dupx;
|
fwidth = (float)SHORT(gpatch->width) * fscalew * dupx;
|
||||||
fheight = (float)gpatch->height * fscaleh * dupy;
|
fheight = (float)SHORT(gpatch->height) * fscaleh * dupy;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fwidth = (float)gpatch->width * dupx;
|
fwidth = (float)SHORT(gpatch->width) * dupx;
|
||||||
fheight = (float)gpatch->height * dupy;
|
fheight = (float)SHORT(gpatch->height) * dupy;
|
||||||
}
|
}
|
||||||
|
|
||||||
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
|
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
|
||||||
|
@ -418,8 +429,8 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||||
|
|
||||||
// fuck it, no GL support for croppedpatch v_perplayer right now. it's not like it's accessible to Lua or anything, and we only use it for menus...
|
// fuck it, no GL support for croppedpatch v_perplayer right now. it's not like it's accessible to Lua or anything, and we only use it for menus...
|
||||||
|
|
||||||
cy -= (float)gpatch->topoffset * fscale;
|
cy -= (float)SHORT(gpatch->topoffset) * fscale;
|
||||||
cx -= (float)gpatch->leftoffset * fscale;
|
cx -= (float)SHORT(gpatch->leftoffset) * fscale;
|
||||||
|
|
||||||
if (!(option & V_NOSCALESTART))
|
if (!(option & V_NOSCALESTART))
|
||||||
{
|
{
|
||||||
|
@ -461,11 +472,11 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||||
fwidth = w;
|
fwidth = w;
|
||||||
fheight = h;
|
fheight = h;
|
||||||
|
|
||||||
if (fwidth > gpatch->width)
|
if (fwidth > SHORT(gpatch->width))
|
||||||
fwidth = gpatch->width;
|
fwidth = SHORT(gpatch->width);
|
||||||
|
|
||||||
if (fheight > gpatch->height)
|
if (fheight > SHORT(gpatch->height))
|
||||||
fheight = gpatch->height;
|
fheight = SHORT(gpatch->height);
|
||||||
|
|
||||||
if (pscale != FRACUNIT)
|
if (pscale != FRACUNIT)
|
||||||
{
|
{
|
||||||
|
@ -495,17 +506,17 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||||
|
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||||
|
|
||||||
v[0].sow = v[3].sow = ((sx )/(float)gpatch->width )*gpatch->max_s;
|
v[0].sow = v[3].sow = ((sx )/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||||
if (sx + w > gpatch->width)
|
if (sx + w > SHORT(gpatch->width))
|
||||||
v[2].sow = v[1].sow = gpatch->max_s;
|
v[2].sow = v[1].sow = gpatch->max_s;
|
||||||
else
|
else
|
||||||
v[2].sow = v[1].sow = ((sx+w)/(float)gpatch->width )*gpatch->max_s;
|
v[2].sow = v[1].sow = ((sx+w)/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||||
|
|
||||||
v[0].tow = v[1].tow = ((sy )/(float)gpatch->height)*gpatch->max_t;
|
v[0].tow = v[1].tow = ((sy )/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||||
if (sy + h > gpatch->height)
|
if (sy + h > SHORT(gpatch->height))
|
||||||
v[2].tow = v[3].tow = gpatch->max_t;
|
v[2].tow = v[3].tow = gpatch->max_t;
|
||||||
else
|
else
|
||||||
v[2].tow = v[3].tow = ((sy+h)/(float)gpatch->height)*gpatch->max_t;
|
v[2].tow = v[3].tow = ((sy+h)/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||||
|
|
||||||
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;
|
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,6 @@
|
||||||
// STANDARD DLL EXPORTS
|
// STANDARD DLL EXPORTS
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
#ifdef HAVE_SDL
|
|
||||||
#undef VID_X11
|
|
||||||
#endif
|
|
||||||
|
|
||||||
EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction);
|
EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction);
|
||||||
#ifndef HAVE_SDL
|
#ifndef HAVE_SDL
|
||||||
EXPORT void HWRAPI(Shutdown) (void);
|
EXPORT void HWRAPI(Shutdown) (void);
|
||||||
|
@ -43,9 +39,6 @@ EXPORT void HWRAPI(Shutdown) (void);
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
EXPORT void HWRAPI(GetModeList) (vmode_t **pvidmodes, INT32 *numvidmodes);
|
EXPORT void HWRAPI(GetModeList) (vmode_t **pvidmodes, INT32 *numvidmodes);
|
||||||
#endif
|
#endif
|
||||||
#ifdef VID_X11
|
|
||||||
EXPORT Window HWRAPI(HookXwin) (Display *, INT32, INT32, boolean);
|
|
||||||
#endif
|
|
||||||
#if defined (PURESDL) || defined (macintosh)
|
#if defined (PURESDL) || defined (macintosh)
|
||||||
EXPORT void HWRAPI(SetPalette) (INT32 *, RGBA_t *gamma);
|
EXPORT void HWRAPI(SetPalette) (INT32 *, RGBA_t *gamma);
|
||||||
#else
|
#else
|
||||||
|
@ -71,10 +64,6 @@ EXPORT void HWRAPI(SetTransform) (FTransform *ptransform);
|
||||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
||||||
EXPORT INT32 HWRAPI(GetRenderVersion) (void);
|
EXPORT INT32 HWRAPI(GetRenderVersion) (void);
|
||||||
|
|
||||||
#ifdef VID_X11 // ifdef to be removed as soon as windoze supports that as well
|
|
||||||
// metzgermeister: added for Voodoo detection
|
|
||||||
EXPORT char *HWRAPI(GetRenderer) (void);
|
|
||||||
#endif
|
|
||||||
#ifdef SHUFFLE
|
#ifdef SHUFFLE
|
||||||
#define SCREENVERTS 10
|
#define SCREENVERTS 10
|
||||||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||||
|
@ -115,10 +104,6 @@ struct hwdriver_s
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
GetModeList pfnGetModeList;
|
GetModeList pfnGetModeList;
|
||||||
#endif
|
#endif
|
||||||
#ifdef VID_X11
|
|
||||||
HookXwin pfnHookXwin;
|
|
||||||
GetRenderer pfnGetRenderer;
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_SDL
|
#ifndef HAVE_SDL
|
||||||
Shutdown pfnShutdown;
|
Shutdown pfnShutdown;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,6 +29,11 @@
|
||||||
// model version
|
// model version
|
||||||
#define MD2_VERSION 8
|
#define MD2_VERSION 8
|
||||||
|
|
||||||
|
// magic number "IDP2" or 844121161
|
||||||
|
#define MD2_IDENT (INT32)(('2' << 24) + ('P' << 16) + ('D' << 8) + 'I')
|
||||||
|
// model version
|
||||||
|
#define MD2_VERSION 8
|
||||||
|
|
||||||
#define MD2_MAX_TRIANGLES 8192
|
#define MD2_MAX_TRIANGLES 8192
|
||||||
#define MD2_MAX_VERTICES 4096
|
#define MD2_MAX_VERTICES 4096
|
||||||
#define MD2_MAX_TEXCOORDS 4096
|
#define MD2_MAX_TEXCOORDS 4096
|
||||||
|
|
35
src/i_tcp.c
35
src/i_tcp.c
|
@ -225,6 +225,33 @@ static void wattcp_outch(char s)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_WINSOCK
|
||||||
|
// stupid microsoft makes things complicated
|
||||||
|
static char *get_WSAErrorStr(int e)
|
||||||
|
{
|
||||||
|
static char buf[256]; // allow up to 255 bytes
|
||||||
|
|
||||||
|
buf[0] = '\0';
|
||||||
|
|
||||||
|
FormatMessageA(
|
||||||
|
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||||
|
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
|
NULL,
|
||||||
|
(DWORD)e,
|
||||||
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
|
(LPTSTR)buf,
|
||||||
|
sizeof (buf),
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (!buf[0]) // provide a fallback error message if no message is available for some reason
|
||||||
|
sprintf(buf, "Unknown error");
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
#undef strerror
|
||||||
|
#define strerror get_WSAErrorStr
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_WINSOCK2
|
#ifdef USE_WINSOCK2
|
||||||
#define inet_ntop inet_ntopA
|
#define inet_ntop inet_ntopA
|
||||||
#define HAVE_NTOP
|
#define HAVE_NTOP
|
||||||
|
@ -703,9 +730,13 @@ static void SOCK_Send(void)
|
||||||
c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]);
|
c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == ERRSOCKET && errno != ECONNREFUSED && errno != EWOULDBLOCK)
|
if (c == ERRSOCKET)
|
||||||
|
{
|
||||||
|
int e = errno; // save error code so it can't be modified later
|
||||||
|
if (e != ECONNREFUSED && e != EWOULDBLOCK)
|
||||||
I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode,
|
I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode,
|
||||||
SOCK_GetNodeAddress(doomcom->remotenode), errno, strerror(errno));
|
SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "p_setup.h" // So we can have P_SetupLevelSky
|
#include "p_setup.h" // So we can have P_SetupLevelSky
|
||||||
|
#ifdef ESLOPE
|
||||||
|
#include "p_slopes.h" // P_GetZAt
|
||||||
|
#endif
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "r_main.h"
|
#include "r_main.h"
|
||||||
#include "r_things.h"
|
#include "r_things.h"
|
||||||
|
@ -2008,6 +2011,24 @@ static int lib_evStartCrumble(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
// P_SLOPES
|
||||||
|
////////////
|
||||||
|
|
||||||
|
static int lib_pGetZAt(lua_State *L)
|
||||||
|
{
|
||||||
|
pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE));
|
||||||
|
fixed_t x = luaL_checkfixed(L, 2);
|
||||||
|
fixed_t y = luaL_checkfixed(L, 3);
|
||||||
|
//HUDSAFE
|
||||||
|
if (!slope)
|
||||||
|
return LUA_ErrInvalid(L, "pslope_t");
|
||||||
|
|
||||||
|
lua_pushfixed(L, P_GetZAt(slope, x, y));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// R_DEFS
|
// R_DEFS
|
||||||
////////////
|
////////////
|
||||||
|
|
||||||
|
@ -2631,6 +2652,11 @@ static luaL_Reg lib[] = {
|
||||||
{"EV_CrumbleChain",lib_evCrumbleChain},
|
{"EV_CrumbleChain",lib_evCrumbleChain},
|
||||||
{"EV_StartCrumble",lib_evStartCrumble},
|
{"EV_StartCrumble",lib_evStartCrumble},
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
// p_slopes
|
||||||
|
{"P_GetZAt",lib_pGetZAt},
|
||||||
|
#endif
|
||||||
|
|
||||||
// r_defs
|
// r_defs
|
||||||
{"R_PointToAngle",lib_rPointToAngle},
|
{"R_PointToAngle",lib_rPointToAngle},
|
||||||
{"R_PointToAngle2",lib_rPointToAngle2},
|
{"R_PointToAngle2",lib_rPointToAngle2},
|
||||||
|
|
|
@ -48,6 +48,7 @@ enum hook {
|
||||||
hook_MobjMoveBlocked,
|
hook_MobjMoveBlocked,
|
||||||
hook_MapThingSpawn,
|
hook_MapThingSpawn,
|
||||||
hook_FollowMobj,
|
hook_FollowMobj,
|
||||||
|
hook_PlayerQuit,
|
||||||
|
|
||||||
hook_MAX // last hook
|
hook_MAX // last hook
|
||||||
};
|
};
|
||||||
|
@ -87,5 +88,6 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8
|
||||||
#define LUAh_MobjMoveBlocked(mo) LUAh_MobjHook(mo, hook_MobjMoveBlocked) // Hook for P_XYMovement (when movement is blocked)
|
#define LUAh_MobjMoveBlocked(mo) LUAh_MobjHook(mo, hook_MobjMoveBlocked) // Hook for P_XYMovement (when movement is blocked)
|
||||||
boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing); // Hook for P_SpawnMapThing by mobj type
|
boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing); // Hook for P_SpawnMapThing by mobj type
|
||||||
boolean LUAh_FollowMobj(player_t *player, mobj_t *mo); // Hook for P_PlayerAfterThink Smiles mobj-following
|
boolean LUAh_FollowMobj(player_t *player, mobj_t *mo); // Hook for P_PlayerAfterThink Smiles mobj-following
|
||||||
|
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -59,6 +59,7 @@ const char *const hookNames[hook_MAX+1] = {
|
||||||
"MobjMoveBlocked",
|
"MobjMoveBlocked",
|
||||||
"MapThingSpawn",
|
"MapThingSpawn",
|
||||||
"FollowMobj",
|
"FollowMobj",
|
||||||
|
"PlayerQuit",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1192,4 +1193,30 @@ boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj)
|
||||||
return hooked;
|
return hooked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LUAh_PlayerQuit(player_t *plr, int reason)
|
||||||
|
{
|
||||||
|
hook_p hookp;
|
||||||
|
if (!gL || !(hooksAvailable[hook_PlayerQuit/8] & (1<<(hook_PlayerQuit%8))))
|
||||||
|
return;
|
||||||
|
|
||||||
|
lua_settop(gL, 0);
|
||||||
|
|
||||||
|
for (hookp = roothook; hookp; hookp = hookp->next)
|
||||||
|
if (hookp->type == hook_PlayerQuit)
|
||||||
|
{
|
||||||
|
if (lua_gettop(gL) == 0)
|
||||||
|
{
|
||||||
|
LUA_PushUserdata(gL, plr, META_PLAYER); // Player that quit
|
||||||
|
lua_pushinteger(gL, reason); // Reason for quitting
|
||||||
|
}
|
||||||
|
lua_pushfstring(gL, FMT_HOOKID, hookp->id);
|
||||||
|
lua_gettable(gL, LUA_REGISTRYINDEX);
|
||||||
|
lua_pushvalue(gL, -3);
|
||||||
|
lua_pushvalue(gL, -3);
|
||||||
|
LUA_Call(gL, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
lua_settop(gL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -814,6 +814,15 @@ static int libd_RandomChance(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 30/10/18 Lat': Get cv_translucenthud's value for HUD rendering as a normal V_xxTRANS int
|
||||||
|
// Could as well be thrown in global vars for ease of access but I guess it makes sense for it to be a HUD fn
|
||||||
|
static int libd_getlocaltransflag(lua_State *L)
|
||||||
|
{
|
||||||
|
HUDONLY
|
||||||
|
lua_pushinteger(L, (10-cv_translucenthud.value)*V_10TRANS); // A bit weird that it's called "translucenthud" yet 10 is fully opaque :V
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static luaL_Reg lib_draw[] = {
|
static luaL_Reg lib_draw[] = {
|
||||||
// cache
|
// cache
|
||||||
{"patchExists", libd_patchExists},
|
{"patchExists", libd_patchExists},
|
||||||
|
@ -844,6 +853,7 @@ static luaL_Reg lib_draw[] = {
|
||||||
{"dupx", libd_dupx},
|
{"dupx", libd_dupx},
|
||||||
{"dupy", libd_dupy},
|
{"dupy", libd_dupy},
|
||||||
{"renderer", libd_renderer},
|
{"renderer", libd_renderer},
|
||||||
|
{"localTransFlag", libd_getlocaltransflag},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -867,6 +877,19 @@ static int lib_huddisable(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 30/10/18: Lat': How come this wasn't here before?
|
||||||
|
static int lib_hudenabled(lua_State *L)
|
||||||
|
{
|
||||||
|
enum hud option = luaL_checkoption(L, 1, NULL, hud_disable_options);
|
||||||
|
if (hud_enabled[option/8] & (1<<(option%8)))
|
||||||
|
lua_pushboolean(L, true);
|
||||||
|
else
|
||||||
|
lua_pushboolean(L, false);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// add a HUD element for rendering
|
// add a HUD element for rendering
|
||||||
static int lib_hudadd(lua_State *L)
|
static int lib_hudadd(lua_State *L)
|
||||||
{
|
{
|
||||||
|
@ -894,6 +917,7 @@ static int lib_hudadd(lua_State *L)
|
||||||
static luaL_Reg lib_hud[] = {
|
static luaL_Reg lib_hud[] = {
|
||||||
{"enable", lib_hudenable},
|
{"enable", lib_hudenable},
|
||||||
{"disable", lib_huddisable},
|
{"disable", lib_huddisable},
|
||||||
|
{"enabled", lib_hudenabled},
|
||||||
{"add", lib_hudadd},
|
{"add", lib_hudadd},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
|
@ -42,6 +42,11 @@ extern lua_State *gL;
|
||||||
#define META_SEG "SEG_T*"
|
#define META_SEG "SEG_T*"
|
||||||
#define META_NODE "NODE_T*"
|
#define META_NODE "NODE_T*"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ESLOPE
|
||||||
|
#define META_SLOPE "PSLOPE_T*"
|
||||||
|
#define META_VECTOR2 "VECTOR2_T"
|
||||||
|
#define META_VECTOR3 "VECTOR3_T"
|
||||||
|
#endif
|
||||||
#define META_MAPHEADER "MAPHEADER_T*"
|
#define META_MAPHEADER "MAPHEADER_T*"
|
||||||
|
|
||||||
#define META_CVAR "CONSVAR_T*"
|
#define META_CVAR "CONSVAR_T*"
|
||||||
|
|
290
src/lua_maplib.c
290
src/lua_maplib.c
|
@ -16,6 +16,10 @@
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
|
#ifdef ESLOPE
|
||||||
|
#include "p_slopes.h"
|
||||||
|
#endif
|
||||||
|
#include "r_main.h"
|
||||||
|
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
#include "lua_libs.h"
|
#include "lua_libs.h"
|
||||||
|
@ -38,7 +42,13 @@ enum sector_e {
|
||||||
sector_heightsec,
|
sector_heightsec,
|
||||||
sector_camsec,
|
sector_camsec,
|
||||||
sector_lines,
|
sector_lines,
|
||||||
|
#ifdef ESLOPE
|
||||||
|
sector_ffloors,
|
||||||
|
sector_fslope,
|
||||||
|
sector_cslope
|
||||||
|
#else
|
||||||
sector_ffloors
|
sector_ffloors
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const sector_opt[] = {
|
static const char *const sector_opt[] = {
|
||||||
|
@ -55,6 +65,10 @@ static const char *const sector_opt[] = {
|
||||||
"camsec",
|
"camsec",
|
||||||
"lines",
|
"lines",
|
||||||
"ffloors",
|
"ffloors",
|
||||||
|
#ifdef ESLOPE
|
||||||
|
"f_slope",
|
||||||
|
"c_slope",
|
||||||
|
#endif
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
enum subsector_e {
|
enum subsector_e {
|
||||||
|
@ -160,6 +174,10 @@ enum ffloor_e {
|
||||||
ffloor_toplightlevel,
|
ffloor_toplightlevel,
|
||||||
ffloor_bottomheight,
|
ffloor_bottomheight,
|
||||||
ffloor_bottompic,
|
ffloor_bottompic,
|
||||||
|
#ifdef ESLOPE
|
||||||
|
ffloor_tslope,
|
||||||
|
ffloor_bslope,
|
||||||
|
#endif
|
||||||
ffloor_sector,
|
ffloor_sector,
|
||||||
ffloor_flags,
|
ffloor_flags,
|
||||||
ffloor_master,
|
ffloor_master,
|
||||||
|
@ -176,6 +194,10 @@ static const char *const ffloor_opt[] = {
|
||||||
"toplightlevel",
|
"toplightlevel",
|
||||||
"bottomheight",
|
"bottomheight",
|
||||||
"bottompic",
|
"bottompic",
|
||||||
|
#ifdef ESLOPE
|
||||||
|
"t_slope",
|
||||||
|
"b_slope",
|
||||||
|
#endif
|
||||||
"sector", // secnum pushed as control sector userdata
|
"sector", // secnum pushed as control sector userdata
|
||||||
"flags",
|
"flags",
|
||||||
"master", // control linedef
|
"master", // control linedef
|
||||||
|
@ -261,6 +283,47 @@ static const char *const bbox_opt[] = {
|
||||||
"right",
|
"right",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
enum slope_e {
|
||||||
|
slope_valid = 0,
|
||||||
|
slope_o,
|
||||||
|
slope_d,
|
||||||
|
slope_zdelta,
|
||||||
|
slope_normal,
|
||||||
|
slope_zangle,
|
||||||
|
slope_xydirection,
|
||||||
|
slope_sourceline,
|
||||||
|
slope_refpos,
|
||||||
|
slope_flags
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *const slope_opt[] = {
|
||||||
|
"valid",
|
||||||
|
"o",
|
||||||
|
"d",
|
||||||
|
"zdelta",
|
||||||
|
"normal",
|
||||||
|
"zangle",
|
||||||
|
"xydirection",
|
||||||
|
"sourceline",
|
||||||
|
"refpos",
|
||||||
|
"flags",
|
||||||
|
NULL};
|
||||||
|
|
||||||
|
// shared by both vector2_t and vector3_t
|
||||||
|
enum vector_e {
|
||||||
|
vector_x = 0,
|
||||||
|
vector_y,
|
||||||
|
vector_z
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *const vector_opt[] = {
|
||||||
|
"x",
|
||||||
|
"y",
|
||||||
|
"z",
|
||||||
|
NULL};
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *const array_opt[] ={"iterate",NULL};
|
static const char *const array_opt[] ={"iterate",NULL};
|
||||||
static const char *const valid_opt[] ={"valid",NULL};
|
static const char *const valid_opt[] ={"valid",NULL};
|
||||||
|
|
||||||
|
@ -493,6 +556,14 @@ static int sector_get(lua_State *L)
|
||||||
LUA_PushUserdata(L, sector->ffloors, META_FFLOOR);
|
LUA_PushUserdata(L, sector->ffloors, META_FFLOOR);
|
||||||
lua_pushcclosure(L, sector_iterate, 2); // push lib_iterateFFloors and sector->ffloors as upvalues for the function
|
lua_pushcclosure(L, sector_iterate, 2); // push lib_iterateFFloors and sector->ffloors as upvalues for the function
|
||||||
return 1;
|
return 1;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
case sector_fslope: // f_slope
|
||||||
|
LUA_PushUserdata(L, sector->f_slope, META_SLOPE);
|
||||||
|
return 1;
|
||||||
|
case sector_cslope: // c_slope
|
||||||
|
LUA_PushUserdata(L, sector->c_slope, META_SLOPE);
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -515,6 +586,10 @@ static int sector_set(lua_State *L)
|
||||||
case sector_heightsec: // heightsec
|
case sector_heightsec: // heightsec
|
||||||
case sector_camsec: // camsec
|
case sector_camsec: // camsec
|
||||||
case sector_ffloors: // ffloors
|
case sector_ffloors: // ffloors
|
||||||
|
#ifdef ESLOPE
|
||||||
|
case sector_fslope: // f_slope
|
||||||
|
case sector_cslope: // c_slope
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
|
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
|
||||||
case sector_floorheight: { // floorheight
|
case sector_floorheight: { // floorheight
|
||||||
|
@ -1602,6 +1677,14 @@ static int ffloor_get(lua_State *L)
|
||||||
lua_pushlstring(L, levelflat->name, 8);
|
lua_pushlstring(L, levelflat->name, 8);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#ifdef ESLOPE
|
||||||
|
case ffloor_tslope:
|
||||||
|
LUA_PushUserdata(L, *ffloor->t_slope, META_SLOPE);
|
||||||
|
return 1;
|
||||||
|
case ffloor_bslope:
|
||||||
|
LUA_PushUserdata(L, *ffloor->b_slope, META_SLOPE);
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
case ffloor_sector:
|
case ffloor_sector:
|
||||||
LUA_PushUserdata(L, §ors[ffloor->secnum], META_SECTOR);
|
LUA_PushUserdata(L, §ors[ffloor->secnum], META_SECTOR);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1641,6 +1724,10 @@ static int ffloor_set(lua_State *L)
|
||||||
switch(field)
|
switch(field)
|
||||||
{
|
{
|
||||||
case ffloor_valid: // valid
|
case ffloor_valid: // valid
|
||||||
|
#ifdef ESLOPE
|
||||||
|
case ffloor_tslope: // t_slope
|
||||||
|
case ffloor_bslope: // b_slope
|
||||||
|
#endif
|
||||||
case ffloor_sector: // sector
|
case ffloor_sector: // sector
|
||||||
case ffloor_master: // master
|
case ffloor_master: // master
|
||||||
case ffloor_target: // target
|
case ffloor_target: // target
|
||||||
|
@ -1701,6 +1788,189 @@ static int ffloor_set(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
//////////////
|
||||||
|
// pslope_t //
|
||||||
|
//////////////
|
||||||
|
|
||||||
|
static int slope_get(lua_State *L)
|
||||||
|
{
|
||||||
|
pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE));
|
||||||
|
enum slope_e field = luaL_checkoption(L, 2, slope_opt[0], slope_opt);
|
||||||
|
|
||||||
|
if (!slope)
|
||||||
|
{
|
||||||
|
if (field == slope_valid) {
|
||||||
|
lua_pushboolean(L, 0);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return luaL_error(L, "accessed pslope_t doesn't exist anymore.");
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(field)
|
||||||
|
{
|
||||||
|
case slope_valid: // valid
|
||||||
|
lua_pushboolean(L, 1);
|
||||||
|
return 1;
|
||||||
|
case slope_o: // o
|
||||||
|
LUA_PushUserdata(L, &slope->o, META_VECTOR3);
|
||||||
|
return 1;
|
||||||
|
case slope_d: // d
|
||||||
|
LUA_PushUserdata(L, &slope->d, META_VECTOR2);
|
||||||
|
return 1;
|
||||||
|
case slope_zdelta: // zdelta
|
||||||
|
lua_pushfixed(L, slope->zdelta);
|
||||||
|
return 1;
|
||||||
|
case slope_normal: // normal
|
||||||
|
LUA_PushUserdata(L, &slope->normal, META_VECTOR3);
|
||||||
|
return 1;
|
||||||
|
case slope_zangle: // zangle
|
||||||
|
lua_pushangle(L, slope->zangle);
|
||||||
|
return 1;
|
||||||
|
case slope_xydirection: // xydirection
|
||||||
|
lua_pushangle(L, slope->xydirection);
|
||||||
|
return 1;
|
||||||
|
case slope_sourceline: // source linedef
|
||||||
|
LUA_PushUserdata(L, slope->sourceline, META_LINE);
|
||||||
|
return 1;
|
||||||
|
case slope_refpos: // refpos
|
||||||
|
lua_pushinteger(L, slope->refpos);
|
||||||
|
return 1;
|
||||||
|
case slope_flags: // flags
|
||||||
|
lua_pushinteger(L, slope->flags);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int slope_set(lua_State *L)
|
||||||
|
{
|
||||||
|
pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE));
|
||||||
|
enum slope_e field = luaL_checkoption(L, 2, slope_opt[0], slope_opt);
|
||||||
|
|
||||||
|
if (!slope)
|
||||||
|
return luaL_error(L, "accessed pslope_t doesn't exist anymore.");
|
||||||
|
|
||||||
|
if (hud_running)
|
||||||
|
return luaL_error(L, "Do not alter pslope_t in HUD rendering code!");
|
||||||
|
|
||||||
|
switch(field) // todo: reorganize this shit
|
||||||
|
{
|
||||||
|
case slope_valid: // valid
|
||||||
|
case slope_sourceline: // sourceline
|
||||||
|
case slope_d: // d
|
||||||
|
case slope_flags: // flags
|
||||||
|
case slope_normal: // normal
|
||||||
|
case slope_refpos: // refpos
|
||||||
|
default:
|
||||||
|
return luaL_error(L, "pslope_t field " LUA_QS " cannot be set.", slope_opt[field]);
|
||||||
|
case slope_o: { // o
|
||||||
|
luaL_checktype(L, 3, LUA_TTABLE);
|
||||||
|
|
||||||
|
lua_getfield(L, 3, "x");
|
||||||
|
if (lua_isnil(L, -1))
|
||||||
|
{
|
||||||
|
lua_pop(L, 1);
|
||||||
|
lua_rawgeti(L, 3, 1);
|
||||||
|
}
|
||||||
|
if (!lua_isnil(L, -1))
|
||||||
|
slope->o.x = luaL_checkfixed(L, -1);
|
||||||
|
else
|
||||||
|
slope->o.x = 0;
|
||||||
|
lua_pop(L, 1);
|
||||||
|
|
||||||
|
lua_getfield(L, 3, "y");
|
||||||
|
if (lua_isnil(L, -1))
|
||||||
|
{
|
||||||
|
lua_pop(L, 1);
|
||||||
|
lua_rawgeti(L, 3, 2);
|
||||||
|
}
|
||||||
|
if (!lua_isnil(L, -1))
|
||||||
|
slope->o.y = luaL_checkfixed(L, -1);
|
||||||
|
else
|
||||||
|
slope->o.y = 0;
|
||||||
|
lua_pop(L, 1);
|
||||||
|
|
||||||
|
lua_getfield(L, 3, "z");
|
||||||
|
if (lua_isnil(L, -1))
|
||||||
|
{
|
||||||
|
lua_pop(L, 1);
|
||||||
|
lua_rawgeti(L, 3, 3);
|
||||||
|
}
|
||||||
|
if (!lua_isnil(L, -1))
|
||||||
|
slope->o.z = luaL_checkfixed(L, -1);
|
||||||
|
else
|
||||||
|
slope->o.z = 0;
|
||||||
|
lua_pop(L, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case slope_zdelta: { // zdelta, this is temp until i figure out wtf to do
|
||||||
|
slope->zdelta = luaL_checkfixed(L, 3);
|
||||||
|
slope->zangle = R_PointToAngle2(0, 0, FRACUNIT, -slope->zdelta);
|
||||||
|
P_CalculateSlopeNormal(slope);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case slope_zangle: { // zangle
|
||||||
|
angle_t zangle = luaL_checkangle(L, 3);
|
||||||
|
if (zangle == ANGLE_90 || zangle == ANGLE_270)
|
||||||
|
return luaL_error(L, "invalid zangle for slope!");
|
||||||
|
slope->zangle = zangle;
|
||||||
|
slope->zdelta = -FINETANGENT(((slope->zangle+ANGLE_90)>>ANGLETOFINESHIFT) & 4095);
|
||||||
|
P_CalculateSlopeNormal(slope);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case slope_xydirection: // xydirection
|
||||||
|
slope->xydirection = luaL_checkangle(L, 3);
|
||||||
|
slope->d.x = -FINECOSINE((slope->xydirection>>ANGLETOFINESHIFT) & FINEMASK);
|
||||||
|
slope->d.y = -FINESINE((slope->xydirection>>ANGLETOFINESHIFT) & FINEMASK);
|
||||||
|
P_CalculateSlopeNormal(slope);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////
|
||||||
|
// vector*_t //
|
||||||
|
///////////////
|
||||||
|
|
||||||
|
static int vector2_get(lua_State *L)
|
||||||
|
{
|
||||||
|
vector2_t *vec = *((vector2_t **)luaL_checkudata(L, 1, META_VECTOR2));
|
||||||
|
enum vector_e field = luaL_checkoption(L, 2, vector_opt[0], vector_opt);
|
||||||
|
|
||||||
|
if (!vec)
|
||||||
|
return luaL_error(L, "accessed vector2_t doesn't exist anymore.");
|
||||||
|
|
||||||
|
switch(field)
|
||||||
|
{
|
||||||
|
case vector_x: lua_pushfixed(L, vec->x); return 1;
|
||||||
|
case vector_y: lua_pushfixed(L, vec->y); return 1;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int vector3_get(lua_State *L)
|
||||||
|
{
|
||||||
|
vector3_t *vec = *((vector3_t **)luaL_checkudata(L, 1, META_VECTOR3));
|
||||||
|
enum vector_e field = luaL_checkoption(L, 2, vector_opt[0], vector_opt);
|
||||||
|
|
||||||
|
if (!vec)
|
||||||
|
return luaL_error(L, "accessed vector3_t doesn't exist anymore.");
|
||||||
|
|
||||||
|
switch(field)
|
||||||
|
{
|
||||||
|
case vector_x: lua_pushfixed(L, vec->x); return 1;
|
||||||
|
case vector_y: lua_pushfixed(L, vec->y); return 1;
|
||||||
|
case vector_z: lua_pushfixed(L, vec->z); return 1;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// mapheaderinfo[] //
|
// mapheaderinfo[] //
|
||||||
/////////////////////
|
/////////////////////
|
||||||
|
@ -1922,6 +2192,26 @@ int LUA_MapLib(lua_State *L)
|
||||||
lua_setfield(L, -2, "__index");
|
lua_setfield(L, -2, "__index");
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
luaL_newmetatable(L, META_SLOPE);
|
||||||
|
lua_pushcfunction(L, slope_get);
|
||||||
|
lua_setfield(L, -2, "__index");
|
||||||
|
|
||||||
|
lua_pushcfunction(L, slope_set);
|
||||||
|
lua_setfield(L, -2, "__newindex");
|
||||||
|
lua_pop(L, 1);
|
||||||
|
|
||||||
|
luaL_newmetatable(L, META_VECTOR2);
|
||||||
|
lua_pushcfunction(L, vector2_get);
|
||||||
|
lua_setfield(L, -2, "__index");
|
||||||
|
lua_pop(L, 1);
|
||||||
|
|
||||||
|
luaL_newmetatable(L, META_VECTOR3);
|
||||||
|
lua_pushcfunction(L, vector3_get);
|
||||||
|
lua_setfield(L, -2, "__index");
|
||||||
|
lua_pop(L, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
luaL_newmetatable(L, META_MAPHEADER);
|
luaL_newmetatable(L, META_MAPHEADER);
|
||||||
lua_pushcfunction(L, mapheaderinfo_get);
|
lua_pushcfunction(L, mapheaderinfo_get);
|
||||||
lua_setfield(L, -2, "__index");
|
lua_setfield(L, -2, "__index");
|
||||||
|
|
|
@ -83,7 +83,12 @@ enum mobj_e {
|
||||||
mobj_extravalue1,
|
mobj_extravalue1,
|
||||||
mobj_extravalue2,
|
mobj_extravalue2,
|
||||||
mobj_cusval,
|
mobj_cusval,
|
||||||
|
#ifdef ESLOPE
|
||||||
|
mobj_cvmem,
|
||||||
|
mobj_standingslope
|
||||||
|
#else
|
||||||
mobj_cvmem
|
mobj_cvmem
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *const mobj_opt[] = {
|
static const char *const mobj_opt[] = {
|
||||||
|
@ -146,6 +151,9 @@ static const char *const mobj_opt[] = {
|
||||||
"extravalue2",
|
"extravalue2",
|
||||||
"cusval",
|
"cusval",
|
||||||
"cvmem",
|
"cvmem",
|
||||||
|
#ifdef ESLOPE
|
||||||
|
"standingslope",
|
||||||
|
#endif
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
#define UNIMPLEMENTED luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", mobj_opt[field])
|
#define UNIMPLEMENTED luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", mobj_opt[field])
|
||||||
|
@ -358,6 +366,11 @@ static int mobj_get(lua_State *L)
|
||||||
case mobj_cvmem:
|
case mobj_cvmem:
|
||||||
lua_pushinteger(L, mo->cvmem);
|
lua_pushinteger(L, mo->cvmem);
|
||||||
break;
|
break;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
case mobj_standingslope:
|
||||||
|
LUA_PushUserdata(L, mo->standingslope, META_SLOPE);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default: // extra custom variables in Lua memory
|
default: // extra custom variables in Lua memory
|
||||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||||
I_Assert(lua_istable(L, -1));
|
I_Assert(lua_istable(L, -1));
|
||||||
|
@ -675,6 +688,10 @@ static int mobj_set(lua_State *L)
|
||||||
case mobj_cvmem:
|
case mobj_cvmem:
|
||||||
mo->cvmem = luaL_checkinteger(L, 3);
|
mo->cvmem = luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
|
#ifdef ESLOPE
|
||||||
|
case mobj_standingslope:
|
||||||
|
return NOSET;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
|
||||||
I_Assert(lua_istable(L, -1));
|
I_Assert(lua_istable(L, -1));
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
#include "byteptr.h"
|
#include "byteptr.h"
|
||||||
#include "p_saveg.h"
|
#include "p_saveg.h"
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
|
#ifdef ESLOPE
|
||||||
|
#include "p_slopes.h" // for P_SlopeById
|
||||||
|
#endif
|
||||||
#ifdef LUA_ALLOW_BYTECODE
|
#ifdef LUA_ALLOW_BYTECODE
|
||||||
#include "d_netfil.h" // for LUA_DumpFile
|
#include "d_netfil.h" // for LUA_DumpFile
|
||||||
#endif
|
#endif
|
||||||
|
@ -498,6 +501,9 @@ enum
|
||||||
ARCH_NODE,
|
ARCH_NODE,
|
||||||
#endif
|
#endif
|
||||||
ARCH_FFLOOR,
|
ARCH_FFLOOR,
|
||||||
|
#ifdef ESLOPE
|
||||||
|
ARCH_SLOPE,
|
||||||
|
#endif
|
||||||
ARCH_MAPHEADER,
|
ARCH_MAPHEADER,
|
||||||
|
|
||||||
ARCH_TEND=0xFF,
|
ARCH_TEND=0xFF,
|
||||||
|
@ -522,6 +528,9 @@ static const struct {
|
||||||
{META_NODE, ARCH_NODE},
|
{META_NODE, ARCH_NODE},
|
||||||
#endif
|
#endif
|
||||||
{META_FFLOOR, ARCH_FFLOOR},
|
{META_FFLOOR, ARCH_FFLOOR},
|
||||||
|
#ifdef ESLOPE
|
||||||
|
{META_SLOPE, ARCH_SLOPE},
|
||||||
|
#endif
|
||||||
{META_MAPHEADER, ARCH_MAPHEADER},
|
{META_MAPHEADER, ARCH_MAPHEADER},
|
||||||
{NULL, ARCH_NULL}
|
{NULL, ARCH_NULL}
|
||||||
};
|
};
|
||||||
|
@ -776,6 +785,19 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef ESLOPE
|
||||||
|
case ARCH_SLOPE:
|
||||||
|
{
|
||||||
|
pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex));
|
||||||
|
if (!slope)
|
||||||
|
WRITEUINT8(save_p, ARCH_NULL);
|
||||||
|
else {
|
||||||
|
WRITEUINT8(save_p, ARCH_SLOPE);
|
||||||
|
WRITEUINT16(save_p, slope->id);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
case ARCH_MAPHEADER:
|
case ARCH_MAPHEADER:
|
||||||
{
|
{
|
||||||
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
|
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
|
||||||
|
@ -997,8 +1019,13 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
|
||||||
LUA_PushUserdata(gL, rover, META_FFLOOR);
|
LUA_PushUserdata(gL, rover, META_FFLOOR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef ESLOPE
|
||||||
|
case ARCH_SLOPE:
|
||||||
|
LUA_PushUserdata(gL, P_SlopeById(READUINT16(save_p)), META_SLOPE);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case ARCH_MAPHEADER:
|
case ARCH_MAPHEADER:
|
||||||
LUA_PushUserdata(gL, §ors[READUINT16(save_p)], META_MAPHEADER);
|
LUA_PushUserdata(gL, mapheaderinfo[READUINT16(save_p)], META_MAPHEADER);
|
||||||
break;
|
break;
|
||||||
case ARCH_TEND:
|
case ARCH_TEND:
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -475,7 +475,8 @@ void M_FirstLoadConfig(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// load default control
|
// load default control
|
||||||
G_Controldefault();
|
G_DefineDefaultControls();
|
||||||
|
G_CopyControls(gamecontrol, gamecontroldefault[gcs_fps]);
|
||||||
|
|
||||||
// load config, make sure those commands doesnt require the screen...
|
// load config, make sure those commands doesnt require the screen...
|
||||||
COM_BufInsertText(va("exec \"%s\"\n", configfile));
|
COM_BufInsertText(va("exec \"%s\"\n", configfile));
|
||||||
|
@ -539,7 +540,7 @@ void M_SaveConfig(const char *filename)
|
||||||
// FIXME: save key aliases if ever implemented..
|
// FIXME: save key aliases if ever implemented..
|
||||||
|
|
||||||
CV_SaveVariables(f);
|
CV_SaveVariables(f);
|
||||||
if (!dedicated) G_SaveKeySetting(f);
|
if (!dedicated) G_SaveKeySetting(f, gamecontrol, gamecontrolbis);
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3729,14 +3729,15 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||||
|
|
||||||
if (player->pflags & PF_FLIPCAM && !(player->powers[pw_carry] == CR_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP)
|
if (player->pflags & PF_FLIPCAM && !(player->powers[pw_carry] == CR_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
postimg = postimg_flip;
|
postimg = postimg_flip;
|
||||||
else if (player->awayviewtics)
|
else if (player->awayviewtics && player->awayviewmobj != NULL) // Camera must obviously exist
|
||||||
{
|
{
|
||||||
camera_t dummycam;
|
camera_t dummycam;
|
||||||
dummycam.subsector = player->awayviewmobj->subsector;
|
dummycam.subsector = player->awayviewmobj->subsector;
|
||||||
dummycam.x = player->awayviewmobj->x;
|
dummycam.x = player->awayviewmobj->x;
|
||||||
dummycam.y = player->awayviewmobj->y;
|
dummycam.y = player->awayviewmobj->y;
|
||||||
dummycam.z = player->awayviewmobj->z;
|
dummycam.z = player->awayviewmobj->z;
|
||||||
dummycam.height = 40*FRACUNIT; // alt view height is 20*FRACUNIT
|
//dummycam.height = 40*FRACUNIT; // alt view height is 20*FRACUNIT
|
||||||
|
dummycam.height = 0; // Why? Remote viewpoint cameras have no height.
|
||||||
// Are we in water?
|
// Are we in water?
|
||||||
if (P_CameraCheckWater(&dummycam))
|
if (P_CameraCheckWater(&dummycam))
|
||||||
postimg = postimg_water;
|
postimg = postimg_water;
|
||||||
|
|
|
@ -29,7 +29,7 @@ static pslope_t *slopelist = NULL;
|
||||||
static UINT16 slopecount = 0;
|
static UINT16 slopecount = 0;
|
||||||
|
|
||||||
// Calculate line normal
|
// Calculate line normal
|
||||||
static void P_CalculateSlopeNormal(pslope_t *slope) {
|
void P_CalculateSlopeNormal(pslope_t *slope) {
|
||||||
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
|
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
|
||||||
slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.x);
|
slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.x);
|
||||||
slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y);
|
slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#define P_SLOPES_H__
|
#define P_SLOPES_H__
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
|
void P_CalculateSlopeNormal(pslope_t *slope);
|
||||||
void P_ResetDynamicSlopes(void);
|
void P_ResetDynamicSlopes(void);
|
||||||
void P_RunDynamicSlopes(void);
|
void P_RunDynamicSlopes(void);
|
||||||
// P_SpawnSlope_Line
|
// P_SpawnSlope_Line
|
||||||
|
|
18
src/p_user.c
18
src/p_user.c
|
@ -9289,16 +9289,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
||||||
// Make player translucent if camera is too close (only in single player).
|
// Make player translucent if camera is too close (only in single player).
|
||||||
if (!(multiplayer || netgame) && !splitscreen)
|
if (!(multiplayer || netgame) && !splitscreen)
|
||||||
{
|
{
|
||||||
fixed_t vx = 0, vy = 0;
|
fixed_t vx = thiscam->x, vy = thiscam->y;
|
||||||
if (player->awayviewtics) {
|
if (player->awayviewtics && player->awayviewmobj != NULL) // Camera must obviously exist
|
||||||
|
{
|
||||||
vx = player->awayviewmobj->x;
|
vx = player->awayviewmobj->x;
|
||||||
vy = player->awayviewmobj->y;
|
vy = player->awayviewmobj->y;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
vx = thiscam->x;
|
|
||||||
vy = thiscam->y;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (P_AproxDistance(vx - mo->x, vy - mo->y) < FixedMul(48*FRACUNIT, mo->scale))
|
if (P_AproxDistance(vx - mo->x, vy - mo->y) < FixedMul(48*FRACUNIT, mo->scale))
|
||||||
mo->flags2 |= MF2_SHADOW;
|
mo->flags2 |= MF2_SHADOW;
|
||||||
|
@ -9621,8 +9617,9 @@ void P_PlayerThink(player_t *player)
|
||||||
if (player->flashcount)
|
if (player->flashcount)
|
||||||
player->flashcount--;
|
player->flashcount--;
|
||||||
|
|
||||||
if (player->awayviewtics)
|
// By the time P_MoveChaseCamera is called, this might be zero. Do not do it here.
|
||||||
player->awayviewtics--;
|
//if (player->awayviewtics)
|
||||||
|
// player->awayviewtics--;
|
||||||
|
|
||||||
/// \note do this in the cheat code
|
/// \note do this in the cheat code
|
||||||
if (player->pflags & PF_NOCLIP)
|
if (player->pflags & PF_NOCLIP)
|
||||||
|
@ -10595,6 +10592,9 @@ void P_PlayerAfterThink(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player->awayviewtics)
|
||||||
|
player->awayviewtics--;
|
||||||
|
|
||||||
// spectator invisibility and nogravity.
|
// spectator invisibility and nogravity.
|
||||||
if ((netgame || multiplayer) && player->spectator)
|
if ((netgame || multiplayer) && player->spectator)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,7 @@ extern INT32 msg_id;
|
||||||
#include "r_sky.h" // skyflatnum
|
#include "r_sky.h" // skyflatnum
|
||||||
#include "p_local.h" // camera info
|
#include "p_local.h" // camera info
|
||||||
#include "fastcmp.h"
|
#include "fastcmp.h"
|
||||||
|
#include "m_misc.h" // for tunes command
|
||||||
|
|
||||||
#ifdef HW3SOUND
|
#ifdef HW3SOUND
|
||||||
// 3D Sound Interface
|
// 3D Sound Interface
|
||||||
|
@ -47,6 +48,8 @@ static INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, I
|
||||||
|
|
||||||
CV_PossibleValue_t soundvolume_cons_t[] = {{0, "MIN"}, {31, "MAX"}, {0, NULL}};
|
CV_PossibleValue_t soundvolume_cons_t[] = {{0, "MIN"}, {31, "MAX"}, {0, NULL}};
|
||||||
static void SetChannelsNum(void);
|
static void SetChannelsNum(void);
|
||||||
|
static void Command_Tunes_f(void);
|
||||||
|
static void Command_RestartAudio_f(void);
|
||||||
|
|
||||||
// commands for music and sound servers
|
// commands for music and sound servers
|
||||||
#ifdef MUSSERV
|
#ifdef MUSSERV
|
||||||
|
@ -92,6 +95,7 @@ consvar_t cv_closedcaptioning = {"closedcaptioning", "Off", CV_SAVE|CV_CALL, CV_
|
||||||
consvar_t cv_numChannels = {"snd_channels", "32", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_numChannels = {"snd_channels", "32", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
static consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
static consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
#define S_MAX_VOLUME 127
|
#define S_MAX_VOLUME 127
|
||||||
|
|
||||||
|
@ -247,6 +251,11 @@ void S_RegisterSoundStuff(void)
|
||||||
#endif
|
#endif
|
||||||
CV_RegisterVar(&surround);
|
CV_RegisterVar(&surround);
|
||||||
CV_RegisterVar(&cv_samplerate);
|
CV_RegisterVar(&cv_samplerate);
|
||||||
|
CV_RegisterVar(&cv_resetmusic);
|
||||||
|
|
||||||
|
COM_AddCommand("tunes", Command_Tunes_f);
|
||||||
|
COM_AddCommand("restartaudio", Command_RestartAudio_f);
|
||||||
|
|
||||||
|
|
||||||
#if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff
|
#if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff
|
||||||
{
|
{
|
||||||
|
@ -1637,3 +1646,88 @@ void S_Start(void)
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
S_ChangeMusic(mapmusname, mapmusflags, true);
|
S_ChangeMusic(mapmusname, mapmusflags, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Command_Tunes_f(void)
|
||||||
|
{
|
||||||
|
const char *tunearg;
|
||||||
|
UINT16 tunenum, track = 0;
|
||||||
|
const size_t argc = COM_Argc();
|
||||||
|
|
||||||
|
if (argc < 2) //tunes slot ...
|
||||||
|
{
|
||||||
|
CONS_Printf("tunes <name/num> [track] [speed] / <-show> / <-default> / <-none>:\n");
|
||||||
|
CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n"));
|
||||||
|
CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n"));
|
||||||
|
CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n"));
|
||||||
|
CONS_Printf(M_GetText("* With \"-default\", returns to the default music for the map.\n"));
|
||||||
|
CONS_Printf(M_GetText("* With \"-none\", any music playing will be stopped.\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tunearg = COM_Argv(1);
|
||||||
|
tunenum = (UINT16)atoi(tunearg);
|
||||||
|
track = 0;
|
||||||
|
|
||||||
|
if (!strcasecmp(tunearg, "-show"))
|
||||||
|
{
|
||||||
|
CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"),
|
||||||
|
mapmusname, (mapmusflags & MUSIC_TRACKMASK));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!strcasecmp(tunearg, "-none"))
|
||||||
|
{
|
||||||
|
S_StopMusic();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (!strcasecmp(tunearg, "-default"))
|
||||||
|
{
|
||||||
|
tunearg = mapheaderinfo[gamemap-1]->musname;
|
||||||
|
track = mapheaderinfo[gamemap-1]->mustrack;
|
||||||
|
}
|
||||||
|
else if (!tunearg[2] && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z')
|
||||||
|
tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]);
|
||||||
|
|
||||||
|
if (tunenum && tunenum >= 1036)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case
|
||||||
|
CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n"));
|
||||||
|
|
||||||
|
if (argc > 2)
|
||||||
|
track = (UINT16)atoi(COM_Argv(2))-1;
|
||||||
|
|
||||||
|
if (tunenum)
|
||||||
|
snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum));
|
||||||
|
else
|
||||||
|
strncpy(mapmusname, tunearg, 7);
|
||||||
|
mapmusname[6] = 0;
|
||||||
|
mapmusflags = (track & MUSIC_TRACKMASK);
|
||||||
|
|
||||||
|
S_ChangeMusic(mapmusname, mapmusflags, true);
|
||||||
|
|
||||||
|
if (argc > 3)
|
||||||
|
{
|
||||||
|
float speed = (float)atof(COM_Argv(3));
|
||||||
|
if (speed > 0.0f)
|
||||||
|
S_SpeedMusic(speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Command_RestartAudio_f(void)
|
||||||
|
{
|
||||||
|
S_StopMusic();
|
||||||
|
S_StopSounds();
|
||||||
|
I_ShutdownMusic();
|
||||||
|
I_ShutdownSound();
|
||||||
|
I_StartupSound();
|
||||||
|
I_InitMusic();
|
||||||
|
|
||||||
|
// These must be called or no sound and music until manually set.
|
||||||
|
|
||||||
|
I_SetSfxVolume(cv_soundvolume.value);
|
||||||
|
S_SetMusicVolume(cv_digmusicvolume.value, cv_midimusicvolume.value);
|
||||||
|
if (Playing()) // Gotta make sure the player is in a level
|
||||||
|
P_RestoreMusic(&players[consoleplayer]);
|
||||||
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
extern consvar_t stereoreverse;
|
extern consvar_t stereoreverse;
|
||||||
extern consvar_t cv_soundvolume, cv_closedcaptioning, cv_digmusicvolume, cv_midimusicvolume;
|
extern consvar_t cv_soundvolume, cv_closedcaptioning, cv_digmusicvolume, cv_midimusicvolume;
|
||||||
extern consvar_t cv_numChannels;
|
extern consvar_t cv_numChannels;
|
||||||
|
extern consvar_t cv_resetmusic;
|
||||||
|
|
||||||
#ifdef SNDSERV
|
#ifdef SNDSERV
|
||||||
extern consvar_t sndserver_cmd, sndserver_arg;
|
extern consvar_t sndserver_cmd, sndserver_arg;
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
// Emacs style mode select -*- C++ -*-
|
||||||
|
//
|
||||||
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 2014-2018 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
// modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
// Emacs style mode select -*- C++ -*-
|
||||||
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 2014-2018 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
// modify it under the terms of the GNU General Public License
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// SONIC ROBO BLAST 2
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2014-2018 by Sonic Team Junior.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief SDL Mixer interface for sound
|
/// \brief SDL Mixer interface for sound
|
||||||
|
|
||||||
|
|
|
@ -532,7 +532,6 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
||||||
{
|
{
|
||||||
UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t);
|
UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t);
|
||||||
UINT32 alphalevel = 0;
|
UINT32 alphalevel = 0;
|
||||||
boolean flip = false;
|
|
||||||
|
|
||||||
fixed_t col, ofs, colfrac, rowfrac, fdup;
|
fixed_t col, ofs, colfrac, rowfrac, fdup;
|
||||||
INT32 dupx, dupy;
|
INT32 dupx, dupy;
|
||||||
|
@ -610,22 +609,32 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
||||||
colfrac = FixedDiv(FRACUNIT, fdup);
|
colfrac = FixedDiv(FRACUNIT, fdup);
|
||||||
rowfrac = FixedDiv(FRACUNIT, fdup);
|
rowfrac = FixedDiv(FRACUNIT, fdup);
|
||||||
|
|
||||||
if (scrn & V_OFFSET) // Crosshair shit
|
// So it turns out offsets aren't scaled in V_NOSCALESTART unless V_OFFSET is applied ...poo, that's terrible
|
||||||
|
// For now let's just at least give V_OFFSET the ability to support V_FLIP
|
||||||
|
// I'll probably make a better fix for 2.2 where I don't have to worry about breaking existing support for stuff
|
||||||
|
// -- Monster Iestyn 29/10/18
|
||||||
{
|
{
|
||||||
y -= FixedMul((SHORT(patch->topoffset)*dupy)<<FRACBITS, pscale);
|
fixed_t offsetx = 0, offsety = 0;
|
||||||
x -= FixedMul((SHORT(patch->leftoffset)*dupx)<<FRACBITS, pscale);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
y -= FixedMul(SHORT(patch->topoffset)<<FRACBITS, pscale);
|
|
||||||
|
|
||||||
|
// left offset
|
||||||
if (scrn & V_FLIP)
|
if (scrn & V_FLIP)
|
||||||
{
|
offsetx = FixedMul((SHORT(patch->width) - SHORT(patch->leftoffset))<<FRACBITS, pscale) + 1;
|
||||||
flip = true;
|
|
||||||
x -= FixedMul((SHORT(patch->width) - SHORT(patch->leftoffset))<<FRACBITS, pscale) + 1;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
x -= FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale);
|
offsetx = FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale);
|
||||||
|
|
||||||
|
// top offset
|
||||||
|
// TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!?
|
||||||
|
offsety = FixedMul(SHORT(patch->topoffset)<<FRACBITS, pscale);
|
||||||
|
|
||||||
|
if ((scrn & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs
|
||||||
|
{
|
||||||
|
offsetx = FixedMul(offsetx, dupx<<FRACBITS);
|
||||||
|
offsety = FixedMul(offsety, dupy<<FRACBITS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Subtract the offsets from x/y positions
|
||||||
|
x -= offsetx;
|
||||||
|
y -= offsety;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (splitscreen && (scrn & V_PERPLAYER))
|
if (splitscreen && (scrn & V_PERPLAYER))
|
||||||
|
@ -774,7 +783,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
||||||
for (col = 0; (col>>FRACBITS) < SHORT(patch->width); col += colfrac, ++offx, desttop++)
|
for (col = 0; (col>>FRACBITS) < SHORT(patch->width); col += colfrac, ++offx, desttop++)
|
||||||
{
|
{
|
||||||
INT32 topdelta, prevdelta = -1;
|
INT32 topdelta, prevdelta = -1;
|
||||||
if (flip) // offx is measured from right edge instead of left
|
if (scrn & V_FLIP) // offx is measured from right edge instead of left
|
||||||
{
|
{
|
||||||
if (x+pwidth-offx < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
if (x+pwidth-offx < 0) // don't draw off the left of the screen (WRAP PREVENTION)
|
||||||
break;
|
break;
|
||||||
|
@ -798,7 +807,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
||||||
prevdelta = topdelta;
|
prevdelta = topdelta;
|
||||||
source = (const UINT8 *)(column) + 3;
|
source = (const UINT8 *)(column) + 3;
|
||||||
dest = desttop;
|
dest = desttop;
|
||||||
if (flip)
|
if (scrn & V_FLIP)
|
||||||
dest = deststart + (destend - desttop);
|
dest = deststart + (destend - desttop);
|
||||||
dest += FixedInt(FixedMul(topdelta<<FRACBITS,fdup))*vid.width;
|
dest += FixedInt(FixedMul(topdelta<<FRACBITS,fdup))*vid.width;
|
||||||
|
|
||||||
|
|
|
@ -389,6 +389,8 @@ UINT16 W_InitFile(const char *filename)
|
||||||
if (!memcmp(wadfiles[i]->md5sum, md5sum, 16))
|
if (!memcmp(wadfiles[i]->md5sum, md5sum, 16))
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename);
|
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename);
|
||||||
|
if (handle)
|
||||||
|
fclose(handle);
|
||||||
return INT16_MAX;
|
return INT16_MAX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -634,6 +636,8 @@ UINT16 W_InitFile(const char *filename)
|
||||||
if (fread(&header, 1, sizeof header, handle) < sizeof header)
|
if (fread(&header, 1, sizeof header, handle) < sizeof header)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, M_GetText("Can't read wad header from %s because %s\n"), filename, strerror(ferror(handle)));
|
CONS_Alert(CONS_ERROR, M_GetText("Can't read wad header from %s because %s\n"), filename, strerror(ferror(handle)));
|
||||||
|
if (handle)
|
||||||
|
fclose(handle);
|
||||||
return INT16_MAX;
|
return INT16_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,6 +648,8 @@ UINT16 W_InitFile(const char *filename)
|
||||||
&& memcmp(header.identification, "SDLL", 4) != 0)
|
&& memcmp(header.identification, "SDLL", 4) != 0)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, M_GetText("%s does not have a valid WAD header\n"), filename);
|
CONS_Alert(CONS_ERROR, M_GetText("%s does not have a valid WAD header\n"), filename);
|
||||||
|
if (handle)
|
||||||
|
fclose(handle);
|
||||||
return INT16_MAX;
|
return INT16_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,6 +664,8 @@ UINT16 W_InitFile(const char *filename)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, M_GetText("Wadfile directory in %s is corrupted (%s)\n"), filename, strerror(ferror(handle)));
|
CONS_Alert(CONS_ERROR, M_GetText("Wadfile directory in %s is corrupted (%s)\n"), filename, strerror(ferror(handle)));
|
||||||
free(fileinfov);
|
free(fileinfov);
|
||||||
|
if (handle)
|
||||||
|
fclose(handle);
|
||||||
return INT16_MAX;
|
return INT16_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue