Merge branch 'master' into TEXTURES-additions

This commit is contained in:
Monster Iestyn 2016-11-27 19:49:56 +00:00
commit cc2612c2d8
58 changed files with 1687 additions and 1820 deletions

View File

@ -258,6 +258,18 @@ INT32 I_PutEnv(char *variable)
return -1; return -1;
} }
INT32 I_ClipboardCopy(const char *data, size_t size)
{
(void)data;
(void)size;
return -1;
}
char *I_ClipboardPaste(void)
{
return NULL;
}
void I_RegisterSysCommands(void) {} void I_RegisterSysCommands(void) {}
#include "../sdl/dosstr.c" #include "../sdl/dosstr.c"

View File

@ -84,19 +84,23 @@ UINT32 con_scalefactor; // text size scale factor
// hold 32 last lines of input for history // hold 32 last lines of input for history
#define CON_MAXPROMPTCHARS 256 #define CON_MAXPROMPTCHARS 256
#define CON_PROMPTCHAR '>' #define CON_PROMPTCHAR '$'
static char inputlines[32][CON_MAXPROMPTCHARS]; // hold last 32 prompt lines static char inputlines[32][CON_MAXPROMPTCHARS]; // hold last 32 prompt lines
static INT32 inputline; // current input line number static INT32 inputline; // current input line number
static INT32 inputhist; // line number of history input line to restore static INT32 inputhist; // line number of history input line to restore
static size_t input_cx; // position in current input line static size_t input_cur; // position of cursor in line
static size_t input_sel; // position of selection marker (I.E.: anything between this and input_cur is "selected")
static size_t input_len; // length of current line, used to bound cursor and such
// notice: input does NOT include the "$" at the start of the line. - 11/3/16
// protos. // protos.
static void CON_InputInit(void); static void CON_InputInit(void);
static void CON_RecalcSize(void); static void CON_RecalcSize(void);
static void CONS_hudlines_Change(void); static void CONS_hudlines_Change(void);
static void CONS_backcolor_Change(void);
static void CON_DrawBackpic(patch_t *pic, INT32 startx, INT32 destwidth); static void CON_DrawBackpic(patch_t *pic, INT32 startx, INT32 destwidth);
//static void CON_DrawBackpic2(pic_t *pic, INT32 startx, INT32 destwidth); //static void CON_DrawBackpic2(pic_t *pic, INT32 startx, INT32 destwidth);
@ -129,10 +133,12 @@ static CV_PossibleValue_t backpic_cons_t[] = {{0, "translucent"}, {1, "picture"}
// whether to use console background picture, or translucent mode // whether to use console background picture, or translucent mode
static consvar_t cons_backpic = {"con_backpic", "translucent", CV_SAVE, backpic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cons_backpic = {"con_backpic", "translucent", CV_SAVE, backpic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Orange"}, static CV_PossibleValue_t backcolor_cons_t[] = {{0, "White"}, {1, "Gray"}, {2, "Brown"},
{2, "Blue"}, {3, "Green"}, {4, "Gray"}, {3, "Red"}, {4, "Orange"}, {5, "Yellow"},
{5, "Red"}, {0, NULL}}; {6, "Green"}, {7, "Blue"}, {8, "Purple"},
consvar_t cons_backcolor = {"con_backcolor", "3", CV_SAVE, backcolor_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; {9, "Magenta"}, {10, "Aqua"},
{0, NULL}};
consvar_t cons_backcolor = {"con_backcolor", "Green", CV_CALL|CV_SAVE, backcolor_cons_t, CONS_backcolor_Change, 0, NULL, NULL, 0, 0, NULL};
static void CON_Print(char *msg); static void CON_Print(char *msg);
@ -219,8 +225,9 @@ static void CONS_Bind_f(void)
// CONSOLE SETUP // CONSOLE SETUP
//====================================================================== //======================================================================
// Prepare a colormap for GREEN ONLY translucency over background // Font colormap colors
// // TODO: This could probably be improved somehow...
// These colormaps are 99% identical, with just a few changed bytes
UINT8 *yellowmap; UINT8 *yellowmap;
UINT8 *purplemap; UINT8 *purplemap;
UINT8 *lgreenmap; UINT8 *lgreenmap;
@ -229,44 +236,52 @@ UINT8 *graymap;
UINT8 *redmap; UINT8 *redmap;
UINT8 *orangemap; UINT8 *orangemap;
// Console BG colors // Console BG color
UINT8 *cwhitemap; UINT8 *consolebgmap = NULL;
UINT8 *corangemap;
UINT8 *cbluemap;
UINT8 *cgreenmap;
UINT8 *cgraymap;
UINT8 *credmap;
void CON_ReSetupBackColormap(UINT16 num) void CON_SetupBackColormap(void)
{ {
UINT16 i, j; UINT16 i, palsum;
UINT8 k; UINT8 j, palindex, shift;
UINT8 *pal = W_CacheLumpName(R_GetPalname(num), PU_CACHE); UINT8 *pal = W_CacheLumpName(GetPalette(), PU_CACHE);
// setup the green translucent background colormaps if (!consolebgmap)
for (i = 0, k = 0; i < 768; i += 3, k++) consolebgmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL);
shift = 6; // 12 colors -- shift of 7 means 6 colors
switch (cons_backcolor.value)
{ {
j = pal[i] + pal[i+1] + pal[i+2]; case 0: palindex = 15; break; // White
cwhitemap[k] = (UINT8)(15 - (j>>6)); case 1: palindex = 31; break; // Gray
corangemap[k] = (UINT8)(63 - (j>>6)); case 2: palindex = 239; break; // Brown
cbluemap[k] = (UINT8)(159 - (j>>6)); case 3: palindex = 47; break; // Red
cgreenmap[k] = (UINT8)(111 - (j>>6)); case 4: palindex = 63; break; // Orange
cgraymap[k] = (UINT8)(31 - (j>>6)); case 5: palindex = 79; shift = 7; break; // Yellow
credmap[k] = (UINT8)(47 - (j>>6)); case 6: palindex = 111; break; // Green
case 7: palindex = 159; break; // Blue
case 8: palindex = 199; shift = 7; break; // Purple
case 9: palindex = 187; break; // Magenta
case 10: palindex = 139; break; // Aqua
// Default green
default: palindex = 175; break;
}
// setup background colormap
for (i = 0, j = 0; i < 768; i += 3, j++)
{
palsum = (pal[i] + pal[i+1] + pal[i+2]) >> shift;
consolebgmap[j] = (UINT8)(palindex - palsum);
} }
} }
static void CON_SetupBackColormap(void) static void CONS_backcolor_Change(void)
{ {
INT32 i, j, k; CON_SetupBackColormap();
UINT8 *pal; }
cwhitemap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); static void CON_SetupColormaps(void)
corangemap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); {
cbluemap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); INT32 i;
cgreenmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL);
cgraymap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL);
credmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL);
yellowmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); yellowmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL);
graymap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); graymap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL);
@ -276,20 +291,6 @@ static void CON_SetupBackColormap(void)
redmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); redmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL);
orangemap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); orangemap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL);
pal = W_CacheLumpName("PLAYPAL", PU_CACHE);
// setup the green translucent background colormaps
for (i = 0, k = 0; i < 768; i += 3, k++)
{
j = pal[i] + pal[i+1] + pal[i+2];
cwhitemap[k] = (UINT8)(15 - (j>>6));
corangemap[k] = (UINT8)(63 - (j>>6));
cbluemap[k] = (UINT8)(159 - (j>>6));
cgreenmap[k] = (UINT8)(111 - (j>>6));
cgraymap[k] = (UINT8)(31 - (j>>6));
credmap[k] = (UINT8)(47 - (j>>6));
}
// setup the other colormaps, for console text // setup the other colormaps, for console text
// these don't need to be aligned, unless you convert the // these don't need to be aligned, unless you convert the
@ -320,6 +321,9 @@ static void CON_SetupBackColormap(void)
redmap[9] = (UINT8)32; redmap[9] = (UINT8)32;
orangemap[3] = (UINT8)52; orangemap[3] = (UINT8)52;
orangemap[9] = (UINT8)57; orangemap[9] = (UINT8)57;
// Init back colormap
CON_SetupBackColormap();
} }
// Setup the console text buffer // Setup the console text buffer
@ -343,7 +347,7 @@ void CON_Init(void)
con_width = 0; con_width = 0;
CON_RecalcSize(); CON_RecalcSize();
CON_SetupBackColormap(); CON_SetupColormaps();
//note: CON_Ticker should always execute at least once before D_Display() //note: CON_Ticker should always execute at least once before D_Display()
con_clipviewtop = -1; // -1 does not clip con_clipviewtop = -1; // -1 does not clip
@ -386,14 +390,10 @@ void CON_Init(void)
// //
static void CON_InputInit(void) static void CON_InputInit(void)
{ {
INT32 i;
// prepare the first prompt line // prepare the first prompt line
memset(inputlines, 0, sizeof (inputlines)); memset(inputlines, 0, sizeof (inputlines));
for (i = 0; i < 32; i++)
inputlines[i][0] = CON_PROMPTCHAR;
inputline = 0; inputline = 0;
input_cx = 1; input_cur = input_sel = input_len = 0;
} }
//====================================================================== //======================================================================
@ -618,13 +618,91 @@ void CON_Ticker(void)
} }
} }
//
// ----
//
// Shortcuts for adding and deleting characters, strings, and sections
// Necessary due to moving cursor
//
static void CON_InputClear(void)
{
memset(inputlines[inputline], 0, CON_MAXPROMPTCHARS);
input_cur = input_sel = input_len = 0;
}
static void CON_InputSetString(const char *c)
{
memset(inputlines[inputline], 0, CON_MAXPROMPTCHARS);
strcpy(inputlines[inputline], c);
input_cur = input_sel = input_len = strlen(c);
}
static void CON_InputAddString(const char *c)
{
size_t csize = strlen(c);
if (input_len + csize > CON_MAXPROMPTCHARS-1)
return;
if (input_cur != input_len)
memmove(&inputlines[inputline][input_cur+csize], &inputlines[inputline][input_cur], input_len-input_cur);
memcpy(&inputlines[inputline][input_cur], c, csize);
input_len += csize;
input_sel = (input_cur += csize);
}
static void CON_InputDelSelection(void)
{
size_t start, end, len;
if (input_cur > input_sel)
{
start = input_sel;
end = input_cur;
}
else
{
start = input_cur;
end = input_sel;
}
len = (end - start);
if (end != input_len)
memmove(&inputlines[inputline][start], &inputlines[inputline][end], input_len-end);
memset(&inputlines[inputline][input_len - len], 0, len);
input_len -= len;
input_sel = input_cur = start;
}
static void CON_InputAddChar(char c)
{
if (input_len >= CON_MAXPROMPTCHARS-1)
return;
if (input_cur != input_len)
memmove(&inputlines[inputline][input_cur+1], &inputlines[inputline][input_cur], input_len-input_cur);
inputlines[inputline][input_cur++] = c;
inputlines[inputline][++input_len] = 0;
input_sel = input_cur;
}
static void CON_InputDelChar(void)
{
if (!input_cur)
return;
if (input_cur != input_len)
memmove(&inputlines[inputline][input_cur-1], &inputlines[inputline][input_cur], input_len-input_cur);
inputlines[inputline][--input_len] = 0;
input_sel = --input_cur;
}
//
// ----
//
// Handles console key input // Handles console key input
// //
boolean CON_Responder(event_t *ev) boolean CON_Responder(event_t *ev)
{ {
static boolean consdown; static UINT8 consdown = false; // console is treated differently due to rare usage
static boolean shiftdown;
static boolean ctrldown;
// sequential completions a la 4dos // sequential completions a la 4dos
static char completion[80]; static char completion[80];
@ -639,13 +717,8 @@ boolean CON_Responder(event_t *ev)
// let go keyup events, don't eat them // let go keyup events, don't eat them
if (ev->type != ev_keydown && ev->type != ev_console) if (ev->type != ev_keydown && ev->type != ev_console)
{ {
if (ev->data1 == KEY_LSHIFT || ev->data1 == KEY_RSHIFT) if (ev->data1 == gamecontrol[gc_console][0] || ev->data1 == gamecontrol[gc_console][1])
shiftdown = false;
else if (ev->data1 == KEY_LCTRL || ev->data1 == KEY_RCTRL)
ctrldown = false;
else if (ev->data1 == gamecontrol[gc_console][0] || ev->data1 == gamecontrol[gc_console][1])
consdown = false; consdown = false;
return false; return false;
} }
@ -684,94 +757,110 @@ boolean CON_Responder(event_t *ev)
consoletoggle = true; consoletoggle = true;
return true; return true;
} }
} }
// eat shift only if console active // Always eat ctrl/shift/alt if console open, so the menu doesn't get ideas
if (key == KEY_LSHIFT || key == KEY_RSHIFT) if (key == KEY_LSHIFT || key == KEY_RSHIFT
{ || key == KEY_LCTRL || key == KEY_RCTRL
shiftdown = true; || key == KEY_LALT || key == KEY_RALT)
return true; return true;
}
// same for ctrl // ctrl modifier -- changes behavior, adds shortcuts
if (key == KEY_LCTRL || key == KEY_RCTRL) if (ctrldown)
{ {
ctrldown = true; // show all cvars/commands that match what we have inputted
return true; if (key == KEY_TAB)
{
size_t i, len;
if (!completion[0])
{
if (!input_len || input_len >= 40 || strchr(inputlines[inputline], ' '))
return true;
strcpy(completion, inputlines[inputline]);
comskips = varskips = 0;
}
len = strlen(completion);
//first check commands
CONS_Printf("\nCommands:\n");
for (i = 0, cmd = COM_CompleteCommand(completion, i); cmd; cmd = COM_CompleteCommand(completion, ++i))
CONS_Printf(" \x83" "%s" "\x80" "%s\n", completion, cmd+len);
if (i == 0) CONS_Printf(" (none)\n");
//now we move on to CVARs
CONS_Printf("Variables:\n");
for (i = 0, cmd = CV_CompleteVar(completion, i); cmd; cmd = CV_CompleteVar(completion, ++i))
CONS_Printf(" \x83" "%s" "\x80" "%s\n", completion, cmd+len);
if (i == 0) CONS_Printf(" (none)\n");
return true;
}
// ---
if (key == KEY_HOME) // oldest text in buffer
{
con_scrollup = (con_totallines-((con_curlines-16)>>3));
return true;
}
else if (key == KEY_END) // most recent text in buffer
{
con_scrollup = 0;
return true;
}
if (key == 'x' || key == 'X')
{
if (input_sel > input_cur)
I_ClipboardCopy(&inputlines[inputline][input_cur], input_sel-input_cur);
else
I_ClipboardCopy(&inputlines[inputline][input_sel], input_cur-input_sel);
CON_InputDelSelection();
completion[0] = 0;
return true;
}
else if (key == 'c' || key == 'C')
{
if (input_sel > input_cur)
I_ClipboardCopy(&inputlines[inputline][input_cur], input_sel-input_cur);
else
I_ClipboardCopy(&inputlines[inputline][input_sel], input_cur-input_sel);
return true;
}
else if (key == 'v' || key == 'V')
{
const char *paste = I_ClipboardPaste();
if (input_sel != input_cur)
CON_InputDelSelection();
if (paste != NULL)
CON_InputAddString(paste);
completion[0] = 0;
return true;
}
// Select all
if (key == 'a' || key == 'A')
{
input_sel = 0;
input_cur = input_len;
return true;
}
// don't eat the key
return false;
} }
// command completion forward (tab) and backward (shift-tab) // command completion forward (tab) and backward (shift-tab)
if (key == KEY_TAB) if (key == KEY_TAB)
{ {
// show all cvars/commands that match what we have inputted
if (ctrldown)
{
UINT32 i;
size_t stop = input_cx - 1;
char nameremainder[255];
if (input_cx < 2 || strlen(inputlines[inputline]+1) >= 80)
return true;
strcpy(completion, inputlines[inputline]+1);
// trimming: stop at the first newline
for (i = 0; i < input_cx - 1; ++i)
{
if (completion[i] == ' ')
{
completion[i] = '\0';
stop = i;
break;
}
}
i = 0;
//first check commands
CONS_Printf("\nCommands:\n");
for (cmd = COM_CompleteCommand(completion, i); cmd; cmd = COM_CompleteCommand(completion, i))
{
strncpy(nameremainder, cmd+(stop), strlen(cmd)-(stop));
nameremainder[strlen(cmd)-(stop)] = '\0';
CONS_Printf(" \x83" "%s" "\x80" "%s\n", completion, nameremainder);
++i;
}
if (i == 0)
CONS_Printf(" (none)\n");
i = 0;
//now we move on to CVARs
CONS_Printf("Variables:\n");
for (cmd = CV_CompleteVar(completion, i); cmd; cmd = CV_CompleteVar(completion, i))
{
strncpy(nameremainder, cmd+(stop), strlen(cmd)-(stop));
nameremainder[strlen(cmd)-(stop)] = '\0';
CONS_Printf(" \x83" "%s" "\x80" "%s\n", completion, nameremainder);
++i;
}
if (i == 0)
CONS_Printf(" (none)\n");
return true;
}
// sequential command completion forward and backward // sequential command completion forward and backward
// remember typing for several completions (a-la-4dos) // remember typing for several completions (a-la-4dos)
if (inputlines[inputline][input_cx-1] != ' ') if (!completion[0])
{ {
if (strlen(inputlines[inputline]+1) < 80) if (!input_len || input_len >= 40 || strchr(inputlines[inputline], ' '))
strcpy(completion, inputlines[inputline]+1); return true;
else strcpy(completion, inputlines[inputline]);
completion[0] = 0;
comskips = varskips = 0; comskips = varskips = 0;
} }
else else
@ -783,37 +872,26 @@ boolean CON_Responder(event_t *ev)
if (--varskips < 0) if (--varskips < 0)
comskips = -comskips - 2; comskips = -comskips - 2;
} }
else if (comskips > 0) else if (comskips > 0) comskips--;
comskips--;
} }
else else
{ {
if (comskips < 0) if (comskips < 0) varskips++;
varskips++; else comskips++;
else
comskips++;
} }
} }
if (comskips >= 0) if (comskips >= 0)
{ {
cmd = COM_CompleteCommand(completion, comskips); cmd = COM_CompleteCommand(completion, comskips);
if (!cmd) if (!cmd) // dirty: make sure if comskips is zero, to have a neg value
// dirty: make sure if comskips is zero, to have a neg value
comskips = -comskips - 1; comskips = -comskips - 1;
} }
if (comskips < 0) if (comskips < 0)
cmd = CV_CompleteVar(completion, varskips); cmd = CV_CompleteVar(completion, varskips);
if (cmd) if (cmd)
{ CON_InputSetString(va("%s ", cmd));
memset(inputlines[inputline]+1, 0, CON_MAXPROMPTCHARS-1);
strcpy(inputlines[inputline]+1, cmd);
input_cx = strlen(cmd) + 1;
inputlines[inputline][input_cx] = ' ';
input_cx++;
inputlines[inputline][input_cx] = 0;
}
else else
{ {
if (comskips > 0) if (comskips > 0)
@ -839,47 +917,80 @@ boolean CON_Responder(event_t *ev)
return true; return true;
} }
if (key == KEY_HOME) // oldest text in buffer if (key == KEY_LEFTARROW)
{ {
con_scrollup = (con_totallines-((con_curlines-16)>>3)); if (input_cur != 0)
--input_cur;
if (!shiftdown)
input_sel = input_cur;
return true; return true;
} }
else if (key == KEY_END) // most recent text in buffer else if (key == KEY_RIGHTARROW)
{ {
con_scrollup = 0; if (input_cur < input_len)
++input_cur;
if (!shiftdown)
input_sel = input_cur;
return true; return true;
} }
else if (key == KEY_HOME)
{
input_cur = 0;
if (!shiftdown)
input_sel = input_cur;
return true;
}
else if (key == KEY_END)
{
input_cur = input_len;
if (!shiftdown)
input_sel = input_cur;
return true;
}
// At this point we're messing with input
// Clear completion
completion[0] = 0;
// command enter // command enter
if (key == KEY_ENTER) if (key == KEY_ENTER)
{ {
if (input_cx < 2) if (!input_len)
return true; return true;
// push the command // push the command
COM_BufAddText(inputlines[inputline]+1); COM_BufAddText(inputlines[inputline]);
COM_BufAddText("\n"); COM_BufAddText("\n");
CONS_Printf("%s\n", inputlines[inputline]); CONS_Printf("\x86""%c""\x80""%s\n", CON_PROMPTCHAR, inputlines[inputline]);
inputline = (inputline+1) & 31; inputline = (inputline+1) & 31;
inputhist = inputline; inputhist = inputline;
CON_InputClear();
memset(inputlines[inputline], 0, CON_MAXPROMPTCHARS);
inputlines[inputline][0] = CON_PROMPTCHAR;
input_cx = 1;
return true; return true;
} }
// backspace command prompt // backspace and delete command prompt
if (key == KEY_BACKSPACE) if (input_sel != input_cur)
{ {
if (input_cx > 1) if (key == KEY_BACKSPACE || key == KEY_DEL)
{ {
input_cx--; CON_InputDelSelection();
inputlines[inputline][input_cx] = 0; return true;
} }
}
else if (key == KEY_BACKSPACE)
{
CON_InputDelChar();
return true;
}
else if (key == KEY_DEL)
{
if (input_cur == input_len)
return true;
++input_cur;
CON_InputDelChar();
return true; return true;
} }
@ -888,18 +999,15 @@ boolean CON_Responder(event_t *ev)
{ {
// copy one of the previous inputlines to the current // copy one of the previous inputlines to the current
do do
{
inputhist = (inputhist - 1) & 31; // cycle back inputhist = (inputhist - 1) & 31; // cycle back
} while (inputhist != inputline && !inputlines[inputhist][1]); while (inputhist != inputline && !inputlines[inputhist][0]);
// stop at the last history input line, which is the // stop at the last history input line, which is the
// current line + 1 because we cycle through the 32 input lines // current line + 1 because we cycle through the 32 input lines
if (inputhist == inputline) if (inputhist == inputline)
inputhist = (inputline + 1) & 31; inputhist = (inputline + 1) & 31;
M_Memcpy(inputlines[inputline], inputlines[inputhist], CON_MAXPROMPTCHARS); CON_InputSetString(inputlines[inputhist]);
input_cx = strlen(inputlines[inputline]);
return true; return true;
} }
@ -909,23 +1017,14 @@ boolean CON_Responder(event_t *ev)
if (inputhist == inputline) if (inputhist == inputline)
return true; return true;
do do
{
inputhist = (inputhist + 1) & 31; inputhist = (inputhist + 1) & 31;
} while (inputhist != inputline && !inputlines[inputhist][1]); while (inputhist != inputline && !inputlines[inputhist][0]);
memset(inputlines[inputline], 0, CON_MAXPROMPTCHARS);
// back to currentline // back to currentline
if (inputhist == inputline) if (inputhist == inputline)
{ CON_InputClear();
inputlines[inputline][0] = CON_PROMPTCHAR;
input_cx = 1;
}
else else
{ CON_InputSetString(inputlines[inputhist]);
strcpy(inputlines[inputline], inputlines[inputhist]);
input_cx = strlen(inputlines[inputline]);
}
return true; return true;
} }
@ -950,15 +1049,12 @@ boolean CON_Responder(event_t *ev)
return false; return false;
// add key to cmd line here // add key to cmd line here
if (input_cx < CON_MAXPROMPTCHARS) if (key >= 'A' && key <= 'Z' && !shiftdown) //this is only really necessary for dedicated servers
{ key = key + 'a' - 'A';
if (key >= 'A' && key <= 'Z' && !shiftdown) //this is only really necessary for dedicated servers
key = key + 'a' - 'A';
inputlines[inputline][input_cx] = (char)key; if (input_sel != input_cur)
inputlines[inputline][input_cx + 1] = 0; CON_InputDelSelection();
input_cx++; CON_InputAddChar(key);
}
return true; return true;
} }
@ -1242,26 +1338,89 @@ void CONS_Error(const char *msg)
// //
static void CON_DrawInput(void) static void CON_DrawInput(void)
{ {
char *p;
size_t c;
INT32 x, y;
INT32 charwidth = (INT32)con_scalefactor << 3; INT32 charwidth = (INT32)con_scalefactor << 3;
const char *p = inputlines[inputline];
// input line scrolls left if it gets too long size_t c, clen, cend;
p = inputlines[inputline]; UINT8 lellip = 0, rellip = 0;
if (input_cx >= con_width-11) INT32 x, y, i;
p += input_cx - (con_width-11) + 1;
y = con_curlines - 12 * con_scalefactor; y = con_curlines - 12 * con_scalefactor;
x = charwidth*2;
for (c = 0, x = charwidth; c < con_width-11; c++, x += charwidth) clen = con_width-13;
V_DrawCharacter(x, y, p[c] | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
// draw the blinking cursor if (input_len <= clen)
// {
x = ((input_cx >= con_width-11) ? (INT32)(con_width-11) : (INT32)((input_cx + 1)) * charwidth); c = 0;
if (con_tick < 4) clen = input_len;
V_DrawCharacter(x, y, '_' | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value); }
else // input line scrolls left if it gets too long
{
clen -= 2; // There will always be some extra truncation -- but where is what we'll find out
if (input_cur <= clen/2)
{
// Close enough to right edge to show all
c = 0;
// Always will truncate right side from this position, so always draw right ellipsis
rellip = 1;
}
else
{
// Cursor in the middle (or right side) of input
// Move over for the ellipsis
c = input_cur - (clen/2) + 2;
x += charwidth*2;
lellip = 1;
if (c + clen >= input_len)
{
// Cursor in the right side of input
// We were too far over, so move back
c = input_len - clen;
}
else
{
// Cursor in the middle -- ellipses on both sides
clen -= 2;
rellip = 1;
}
}
}
if (lellip)
{
x -= charwidth*3;
if (input_sel < c)
V_DrawFill(x, y, charwidth*3, (10 * con_scalefactor), 77 | V_NOSCALESTART);
for (i = 0; i < 3; ++i, x += charwidth)
V_DrawCharacter(x, y, '.' | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, !cv_allcaps.value);
}
else
V_DrawCharacter(x-charwidth, y, CON_PROMPTCHAR | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, !cv_allcaps.value);
for (cend = c + clen; c < cend; ++c, x += charwidth)
{
if ((input_sel > c && input_cur <= c) || (input_sel <= c && input_cur > c))
{
V_DrawFill(x, y, charwidth, (10 * con_scalefactor), 77 | V_NOSCALESTART);
V_DrawCharacter(x, y, p[c] | cv_constextsize.value | V_YELLOWMAP | V_NOSCALESTART, !cv_allcaps.value);
}
else
V_DrawCharacter(x, y, p[c] | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
if (c == input_cur && con_tick >= 4)
V_DrawCharacter(x, y + (con_scalefactor*2), '_' | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
}
if (cend == input_cur && con_tick >= 4)
V_DrawCharacter(x, y + (con_scalefactor*2), '_' | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
if (rellip)
{
if (input_sel > cend)
V_DrawFill(x, y, charwidth*3, (10 * con_scalefactor), 77 | V_NOSCALESTART);
for (i = 0; i < 3; ++i, x += charwidth)
V_DrawCharacter(x, y, '.' | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, !cv_allcaps.value);
}
} }
// draw the last lines of console text to the top of the screen // draw the last lines of console text to the top of the screen
@ -1417,7 +1576,7 @@ static void CON_DrawConsole(void)
{ {
// inu: no more width (was always 0 and vid.width) // inu: no more width (was always 0 and vid.width)
if (rendermode != render_none) if (rendermode != render_none)
V_DrawFadeConsBack(con_curlines, cons_backcolor.value); // translucent background V_DrawFadeConsBack(con_curlines); // translucent background
} }
// draw console text lines from top to bottom // draw console text lines from top to bottom

View File

@ -40,11 +40,10 @@ extern consvar_t cons_backcolor;
extern UINT8 *yellowmap, *purplemap, *lgreenmap, *bluemap, *graymap, *redmap, *orangemap; extern UINT8 *yellowmap, *purplemap, *lgreenmap, *bluemap, *graymap, *redmap, *orangemap;
// Console bg colors: // Console bg color (auto updated to match)
extern UINT8 *cwhitemap, *corangemap, *cbluemap, *cgreenmap, *cgraymap, extern UINT8 *consolebgmap;
*credmap;
void CON_ReSetupBackColormap(UINT16 num); void CON_SetupBackColormap(void);
void CON_ClearHUD(void); // clear heads up messages void CON_ClearHUD(void); // clear heads up messages
void CON_Ticker(void); void CON_Ticker(void);

View File

@ -495,7 +495,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
rsp->powers[j] = (UINT16)SHORT(players[i].powers[j]); rsp->powers[j] = (UINT16)SHORT(players[i].powers[j]);
// Score is resynched in the rspfirm resync packet // Score is resynched in the rspfirm resync packet
rsp->health = 0; // resynched with mo health rsp->rings = LONG(players[i].rings);
rsp->lives = players[i].lives; rsp->lives = players[i].lives;
rsp->continues = players[i].continues; rsp->continues = players[i].continues;
rsp->scoreadd = players[i].scoreadd; rsp->scoreadd = players[i].scoreadd;
@ -582,7 +582,6 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
rsp->hasmo = true; rsp->hasmo = true;
rsp->health = LONG(players[i].mo->health); rsp->health = LONG(players[i].mo->health);
rsp->angle = (angle_t)LONG(players[i].mo->angle); rsp->angle = (angle_t)LONG(players[i].mo->angle);
rsp->x = LONG(players[i].mo->x); rsp->x = LONG(players[i].mo->x);
rsp->y = LONG(players[i].mo->y); rsp->y = LONG(players[i].mo->y);
@ -625,7 +624,7 @@ static void resynch_read_player(resynch_pak *rsp)
players[i].powers[j] = (UINT16)SHORT(rsp->powers[j]); players[i].powers[j] = (UINT16)SHORT(rsp->powers[j]);
// Score is resynched in the rspfirm resync packet // Score is resynched in the rspfirm resync packet
players[i].health = rsp->health; players[i].rings = LONG(rsp->rings);
players[i].lives = rsp->lives; players[i].lives = rsp->lives;
players[i].continues = rsp->continues; players[i].continues = rsp->continues;
players[i].scoreadd = rsp->scoreadd; players[i].scoreadd = rsp->scoreadd;
@ -2254,7 +2253,7 @@ static void CL_RemovePlayer(INT32 playernum)
} }
count--; count--;
rings = players[playernum].health - 1; rings = players[playernum].rings;
increment = rings/count; increment = rings/count;
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)

View File

@ -155,7 +155,7 @@ typedef struct
UINT16 powers[NUMPOWERS]; UINT16 powers[NUMPOWERS];
// Score is resynched in the confirm resync packet // Score is resynched in the confirm resync packet
INT32 health; INT32 rings;
SINT8 lives; SINT8 lives;
SINT8 continues; SINT8 continues;
UINT8 scoreadd; UINT8 scoreadd;
@ -236,6 +236,7 @@ typedef struct
//player->mo stuff //player->mo stuff
UINT8 hasmo; //boolean UINT8 hasmo; //boolean
INT32 health;
angle_t angle; angle_t angle;
fixed_t x; fixed_t x;
fixed_t y; fixed_t y;

View File

@ -73,6 +73,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#include "dehacked.h" // Dehacked list test #include "dehacked.h" // Dehacked list test
#include "m_cond.h" // condition initialization #include "m_cond.h" // condition initialization
#include "fastcmp.h" #include "fastcmp.h"
#include "keys.h"
#ifdef CMAKECONFIG #ifdef CMAKECONFIG
#include "config.h" #include "config.h"
@ -176,6 +177,38 @@ void D_PostEvent(const event_t *ev)
void D_PostEvent_end(void) {}; void D_PostEvent_end(void) {};
#endif #endif
// modifier keys
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
UINT8 altdown = 0; // 0x1 left, 0x2 right
//
// D_ModifierKeyResponder
// Sets global shift/ctrl/alt variables, never actually eats events
//
static inline void D_ModifierKeyResponder(event_t *ev)
{
if (ev->type == ev_keydown) switch (ev->data1)
{
case KEY_LSHIFT: shiftdown |= 0x1; return;
case KEY_RSHIFT: shiftdown |= 0x2; return;
case KEY_LCTRL: ctrldown |= 0x1; return;
case KEY_RCTRL: ctrldown |= 0x2; return;
case KEY_LALT: altdown |= 0x1; return;
case KEY_RALT: altdown |= 0x2; return;
default: return;
}
else if (ev->type == ev_keyup) switch (ev->data1)
{
case KEY_LSHIFT: shiftdown &= ~0x1; return;
case KEY_RSHIFT: shiftdown &= ~0x2; return;
case KEY_LCTRL: ctrldown &= ~0x1; return;
case KEY_RCTRL: ctrldown &= ~0x2; return;
case KEY_LALT: altdown &= ~0x1; return;
case KEY_RALT: altdown &= ~0x2; return;
default: return;
}
}
// //
// D_ProcessEvents // D_ProcessEvents
// Send all the events of the given timestamp down the responder chain // Send all the events of the given timestamp down the responder chain
@ -188,6 +221,9 @@ void D_ProcessEvents(void)
{ {
ev = &events[eventtail]; ev = &events[eventtail];
// Set global shift/ctrl/alt down variables
D_ModifierKeyResponder(ev); // never eats events
// Screenshots over everything so that they can be taken anywhere. // Screenshots over everything so that they can be taken anywhere.
if (M_ScreenshotResponder(ev)) if (M_ScreenshotResponder(ev))
continue; // ate the event continue; // ate the event
@ -837,6 +873,18 @@ static void IdentifyVersion(void)
I_Error("File %s has been modified with non-music lumps",musicfile); I_Error("File %s has been modified with non-music lumps",musicfile);
} }
#endif #endif
#if 1 // This section can be deleted when music_new is merged with music.dta
{
const char *musicfile = "music_new.dta";
const char *musicpath = va(pandf,srb2waddir,musicfile);
int ms = W_VerifyNMUSlumps(musicpath); // Don't forget the music!
if (ms == 1)
D_AddFile(musicpath);
else if (ms == 0)
I_Error("File %s has been modified with non-music lumps",musicfile);
}
#endif
} }
/* ======================================================================== */ /* ======================================================================== */

View File

@ -2574,7 +2574,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
if (players[playernum].spectator) if (players[playernum].spectator)
{ {
players[playernum].score = 0; players[playernum].score = 0;
players[playernum].health = 1; players[playernum].rings = 0;
if (players[playernum].mo) if (players[playernum].mo)
players[playernum].mo->health = 1; players[playernum].mo->health = 1;
} }

View File

@ -297,10 +297,8 @@ typedef struct player_s
// It is updated with cmd->aiming. // It is updated with cmd->aiming.
angle_t aiming; angle_t aiming;
// This is only used between levels, // player's ring count
// mo->health is used during levels. INT32 rings;
/// \todo Remove this. We don't need a second health definition for players.
INT32 health;
SINT8 pity; // i pity the fool. SINT8 pity; // i pity the fool.
INT32 currentweapon; // current weapon selected. INT32 currentweapon; // current weapon selected.

View File

@ -5993,70 +5993,6 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_ROCKCRUMBLEO", "S_ROCKCRUMBLEO",
"S_ROCKCRUMBLEP", "S_ROCKCRUMBLEP",
"S_SRB1_CRAWLA1",
"S_SRB1_CRAWLA2",
"S_SRB1_CRAWLA3",
"S_SRB1_CRAWLA4",
"S_SRB1_BAT1",
"S_SRB1_BAT2",
"S_SRB1_BAT3",
"S_SRB1_BAT4",
"S_SRB1_ROBOFISH1",
"S_SRB1_ROBOFISH2",
"S_SRB1_ROBOFISH3",
"S_SRB1_VOLCANOGUY1",
"S_SRB1_VOLCANOGUY2",
"S_SRB1_HOPPY1",
"S_SRB1_HOPPY2",
"S_SRB1_HOPPYWATER1",
"S_SRB1_HOPPYWATER2",
"S_SRB1_HOPPYSKYLAB1",
"S_SRB1_MMZFLYING1",
"S_SRB1_MMZFLYING2",
"S_SRB1_MMZFLYING3",
"S_SRB1_MMZFLYING4",
"S_SRB1_MMZFLYING5",
"S_SRB1_UFO1",
"S_SRB1_UFO2",
"S_SRB1_GRAYBOT1",
"S_SRB1_GRAYBOT2",
"S_SRB1_GRAYBOT3",
"S_SRB1_GRAYBOT4",
"S_SRB1_GRAYBOT5",
"S_SRB1_GRAYBOT6",
"S_SRB1_ROBOTOPOLIS1",
"S_SRB1_ROBOTOPOLIS2",
"S_SRB1_RBZBUZZ1",
"S_SRB1_RBZBUZZ2",
"S_SRB1_RBZSPIKES1",
"S_SRB1_RBZSPIKES2",
"S_SRB1_METALSONIC1",
"S_SRB1_METALSONIC2",
"S_SRB1_METALSONIC3",
"S_SRB1_GOLDBOT1",
"S_SRB1_GOLDBOT2",
"S_SRB1_GOLDBOT3",
"S_SRB1_GOLDBOT4",
"S_SRB1_GOLDBOT5",
"S_SRB1_GOLDBOT6",
"S_SRB1_GENREX1",
"S_SRB1_GENREX2",
#ifdef SEENAMES #ifdef SEENAMES
"S_NAMECHECK", "S_NAMECHECK",
#endif #endif
@ -6567,22 +6503,6 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_ROCKCRUMBLE15", "MT_ROCKCRUMBLE15",
"MT_ROCKCRUMBLE16", "MT_ROCKCRUMBLE16",
"MT_SRB1_CRAWLA",
"MT_SRB1_BAT",
"MT_SRB1_ROBOFISH",
"MT_SRB1_VOLCANOGUY",
"MT_SRB1_HOPPY",
"MT_SRB1_HOPPYWATER",
"MT_SRB1_HOPPYSKYLAB",
"MT_SRB1_MMZFLYING",
"MT_SRB1_UFO",
"MT_SRB1_GRAYBOT",
"MT_SRB1_ROBOTOPOLIS",
"MT_SRB1_RBZBUZZ",
"MT_SRB1_RBZSPIKES",
"MT_SRB1_METALSONIC",
"MT_SRB1_GOLDBOT",
"MT_SRB1_GENREX",
#ifdef SEENAMES #ifdef SEENAMES
"MT_NAMECHECK", "MT_NAMECHECK",
#endif #endif
@ -7173,6 +7093,22 @@ struct {
{"PAL_MIXUP",PAL_MIXUP}, {"PAL_MIXUP",PAL_MIXUP},
{"PAL_RECYCLE",PAL_RECYCLE}, {"PAL_RECYCLE",PAL_RECYCLE},
{"PAL_NUKE",PAL_NUKE}, {"PAL_NUKE",PAL_NUKE},
// for P_DamageMobj
//// Damage types
{"DMG_WATER",DMG_WATER},
{"DMG_FIRE",DMG_FIRE},
{"DMG_ELECTRIC",DMG_ELECTRIC},
{"DMG_SPIKE",DMG_SPIKE},
{"DMG_NUKE",DMG_NUKE},
//// Death types
{"DMG_INSTAKILL",DMG_INSTAKILL},
{"DMG_DROWNED",DMG_DROWNED},
{"DMG_SPACEDROWN",DMG_SPACEDROWN},
{"DMG_DEATHPIT",DMG_DEATHPIT},
{"DMG_CRUSHED",DMG_CRUSHED},
{"DMG_SPECTATOR",DMG_SPECTATOR},
//// Masks
{"DMG_DEATHMASK",DMG_DEATHMASK},
// Gametypes, for use with global var "gametype" // Gametypes, for use with global var "gametype"
{"GT_COOP",GT_COOP}, {"GT_COOP",GT_COOP},

View File

@ -1721,6 +1721,18 @@ INT32 I_PutEnv(char *variable)
return putenv(variable); return putenv(variable);
} }
INT32 I_ClipboardCopy(const char *data, size_t size)
{
(void)data;
(void)size;
return -1;
}
char *I_ClipboardPaste(void)
{
return NULL;
}
const CPUInfoFlags *I_CPUInfo(void) const CPUInfoFlags *I_CPUInfo(void)
{ {
static CPUInfoFlags DOS_CPUInfo; static CPUInfoFlags DOS_CPUInfo;

View File

@ -436,6 +436,9 @@ extern INT32 cv_debug;
// Misc stuff for later... // Misc stuff for later...
// ======================= // =======================
// Modifier key variables, accessible anywhere
extern UINT8 shiftdown, ctrldown, altdown;
// if we ever make our alloc stuff... // if we ever make our alloc stuff...
#define ZZ_Alloc(x) Z_Malloc(x, PU_STATIC, NULL) #define ZZ_Alloc(x) Z_Malloc(x, PU_STATIC, NULL)

View File

@ -162,6 +162,18 @@ INT32 I_PutEnv(char *variable)
return -1; return -1;
} }
INT32 I_ClipboardCopy(const char *data, size_t size)
{
(void)data;
(void)size;
return -1;
}
char *I_ClipboardPaste(void)
{
return NULL;
}
void I_RegisterSysCommands(void) {} void I_RegisterSysCommands(void) {}
#include "../sdl/dosstr.c" #include "../sdl/dosstr.c"

View File

@ -559,7 +559,7 @@ static void F_IntroDrawScene(void)
if (finalecount < 4) if (finalecount < 4)
S_StopMusic(); S_StopMusic();
if (finalecount == 4) if (finalecount == 4)
S_ChangeMusicInternal("stjr", false); S_ChangeMusicInternal("_stjr", false);
x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(334<<FRACBITS, aspect)/2; x = (BASEVIDWIDTH<<FRACBITS)/2 - FixedMul(334<<FRACBITS, aspect)/2;
y = (BASEVIDHEIGHT<<FRACBITS)/2 - FixedMul(358<<FRACBITS, aspect)/2; y = (BASEVIDHEIGHT<<FRACBITS)/2 - FixedMul(358<<FRACBITS, aspect)/2;
V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_CACHE)), aspect); V_DrawSciencePatch(x, y, 0, (patch = W_CachePatchName("WAHH1", PU_CACHE)), aspect);
@ -771,7 +771,7 @@ void F_IntroDrawer(void)
F_RunWipe(99,true); F_RunWipe(99,true);
} }
S_ChangeMusicInternal("read_m", false); S_ChangeMusicInternal("_intro", false);
} }
else if (intro_scenenum == 3) else if (intro_scenenum == 3)
roidtics = BASEVIDWIDTH - 64; roidtics = BASEVIDWIDTH - 64;
@ -1130,7 +1130,7 @@ void F_StartCredits(void)
CON_ClearHUD(); CON_ClearHUD();
S_StopMusic(); S_StopMusic();
S_ChangeMusicInternal("credit", false); S_ChangeMusicInternal("_creds", false);
finalecount = 0; finalecount = 0;
animtimer = 0; animtimer = 0;
@ -1427,7 +1427,7 @@ void F_StartTitleScreen(void)
// IWAD dependent stuff. // IWAD dependent stuff.
S_ChangeMusicInternal("titles", looptitle); S_ChangeMusicInternal("_title", looptitle);
animtimer = 0; animtimer = 0;
@ -1593,7 +1593,7 @@ void F_StartContinue(void)
// In case menus are still up?!! // In case menus are still up?!!
M_ClearMenus(true); M_ClearMenus(true);
S_ChangeMusicInternal("contsc", false); S_ChangeMusicInternal("_conti", false);
S_StopSounds(); S_StopSounds();
timetonext = TICRATE*11; timetonext = TICRATE*11;

View File

@ -88,6 +88,7 @@ UINT8 modeattacking = ATTACKING_NONE;
boolean disableSpeedAdjust = false; boolean disableSpeedAdjust = false;
boolean imcontinuing = false; boolean imcontinuing = false;
boolean runemeraldmanager = false; boolean runemeraldmanager = false;
UINT16 emeraldspawndelay = 60*TICRATE;
// menu demo things // menu demo things
UINT8 numDemos = 3; UINT8 numDemos = 3;
@ -2193,7 +2194,7 @@ void G_PlayerReborn(INT32 player)
p->pflags |= PF_JUMPDOWN; p->pflags |= PF_JUMPDOWN;
p->playerstate = PST_LIVE; p->playerstate = PST_LIVE;
p->health = 1; // 0 rings p->rings = 0; // 0 rings
p->panim = PA_IDLE; // standing animation p->panim = PA_IDLE; // standing animation
if ((netgame || multiplayer) && !p->spectator) if ((netgame || multiplayer) && !p->spectator)

View File

@ -656,6 +656,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
{ {
FOutVector v[4]; FOutVector v[4];
FSurfaceInfo Surf; FSurfaceInfo Surf;
float sdupx, sdupy;
if (w < 0 || h < 0) if (w < 0 || h < 0)
return; // consistency w/ software return; // consistency w/ software
@ -664,10 +665,16 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
// | /| // | /|
// |/ | // |/ |
// 0--1 // 0--1
v[0].x = v[3].x = (x - 160.0f)/160.0f; sdupx = FIXED_TO_FLOAT(vid.fdupx)*2.0f;
v[2].x = v[1].x = ((x+w) - 160.0f)/160.0f; sdupy = FIXED_TO_FLOAT(vid.fdupy)*2.0f;
v[0].y = v[1].y = -(y - 100.0f)/100.0f;
v[2].y = v[3].y = -((y+h) - 100.0f)/100.0f; if (color & V_NOSCALESTART)
sdupx = sdupy = 2.0f;
v[0].x = v[3].x = (x*sdupx)/vid.width - 1;
v[2].x = v[1].x = (x*sdupx + w*sdupx)/vid.width - 1;
v[0].y = v[1].y = 1-(y*sdupy)/vid.height;
v[2].y = v[3].y = 1-(y*sdupy + h*sdupy)/vid.height;
//Hurdler: do we still use this argb color? if not, we should remove it //Hurdler: do we still use this argb color? if not, we should remove it
v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //; v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //;

View File

@ -476,23 +476,6 @@ light_t *t_lspr[NUMSPRITES] =
&lspr[NOLIGHT], // SPR_GWLG &lspr[NOLIGHT], // SPR_GWLG
&lspr[NOLIGHT], // SPR_GWLR &lspr[NOLIGHT], // SPR_GWLR
// SRB1 Sprites
&lspr[NOLIGHT], // SPR_SRBA
&lspr[NOLIGHT], // SPR_SRBB
&lspr[NOLIGHT], // SPR_SRBC
&lspr[NOLIGHT], // SPR_SRBD
&lspr[NOLIGHT], // SPR_SRBE
&lspr[NOLIGHT], // SPR_SRBF
&lspr[NOLIGHT], // SPR_SRBG
&lspr[NOLIGHT], // SPR_SRBH
&lspr[NOLIGHT], // SPR_SRBI
&lspr[NOLIGHT], // SPR_SRBJ
&lspr[NOLIGHT], // SPR_SRBK
&lspr[NOLIGHT], // SPR_SRBL
&lspr[NOLIGHT], // SPR_SRBM
&lspr[NOLIGHT], // SPR_SRBN
&lspr[NOLIGHT], // SPR_SRBO
// Free slots // Free slots
&lspr[NOLIGHT], &lspr[NOLIGHT],
&lspr[NOLIGHT], &lspr[NOLIGHT],

View File

@ -45,7 +45,7 @@
#include "hw_md2.h" #include "hw_md2.h"
#define R_FAKEFLOORS #define R_FAKEFLOORS
//#define HWPRECIP #define HWPRECIP
#define SORTING #define SORTING
//#define POLYSKY //#define POLYSKY
@ -4401,7 +4401,6 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
FOutVector *wv; FOutVector *wv;
GLPatch_t *gpatch; // sprite patch converted to hardware GLPatch_t *gpatch; // sprite patch converted to hardware
FSurfaceInfo Surf; FSurfaceInfo Surf;
sector_t *sector;
if (!spr->mobj) if (!spr->mobj)
return; return;
@ -4455,19 +4454,38 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
//Hurdler: 25/04/2000: now support colormap in hardware mode //Hurdler: 25/04/2000: now support colormap in hardware mode
HWR_GetMappedPatch(gpatch, spr->colormap); HWR_GetMappedPatch(gpatch, spr->colormap);
sector = spr->mobj->subsector->sector; // colormap test
if (sector->ffloors)
{ {
ffloor_t *caster = sector->lightlist[R_GetPlaneLight(sector, spr->mobj->z, false)].caster; sector_t *sector = spr->mobj->subsector->sector;
sector = caster ? &sectors[caster->secnum] : sector; UINT8 lightlevel = 255;
} extracolormap_t *colormap = sector->extra_colormap;
// sprite lighting by modulating the RGB components if (sector->numlights)
if (sector->extra_colormap) {
Surf.FlatColor.rgba = HWR_Lighting(spr->sectorlight,sector->extra_colormap->rgba,sector->extra_colormap->fadergba, false, false); INT32 light;
light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *sector->lightlist[light].lightlevel;
if (sector->lightlist[light].extra_colormap)
colormap = sector->lightlist[light].extra_colormap;
}
else else
Surf.FlatColor.rgba = HWR_Lighting(spr->sectorlight,NORMALFOG,FADEFOG, false, false); {
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = sector->lightlevel;
if (sector->extra_colormap)
colormap = sector->extra_colormap;
}
if (colormap)
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
else
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
}
if (spr->mobj->flags2 & MF2_SHADOW) if (spr->mobj->flags2 & MF2_SHADOW)
{ {
@ -5295,6 +5313,11 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
// //
vis = HWR_NewVisSprite(); vis = HWR_NewVisSprite();
vis->x1 = x1; vis->x1 = x1;
#if 0
vis->x2 = x2;
#else
(void)x2;
#endif
vis->x2 = tx; vis->x2 = tx;
vis->tz = tz; vis->tz = tz;
vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
@ -5307,7 +5330,6 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
// set top/bottom coords // set top/bottom coords
vis->ty = FIXED_TO_FLOAT(thing->z + spritecachedinfo[lumpoff].topoffset) - gr_viewz; vis->ty = FIXED_TO_FLOAT(thing->z + spritecachedinfo[lumpoff].topoffset) - gr_viewz;
vis->sectorlight = 0xff;
vis->precip = true; vis->precip = true;
} }
#endif #endif

View File

@ -308,6 +308,23 @@ static md2_model_t *md2_readModel(const char *filename)
model->header.numSkins = 1; model->header.numSkins = 1;
#define MD2LIMITCHECK(field, max, msgname) \
if (field > max) \
{ \
CONS_Alert(CONS_ERROR, "md2_readModel: %s has too many " msgname " (# found: %d, maximum: %d)\n", filename, field, max); \
md2_freeModel (model); \
return 0; \
}
// Uncomment if these are actually needed
// MD2LIMITCHECK(model->header.numSkins, MD2_MAX_SKINS, "skins")
// MD2LIMITCHECK(model->header.numTexCoords, MD2_MAX_TEXCOORDS, "texture coordinates")
MD2LIMITCHECK(model->header.numTriangles, MD2_MAX_TRIANGLES, "triangles")
MD2LIMITCHECK(model->header.numFrames, MD2_MAX_FRAMES, "frames")
MD2LIMITCHECK(model->header.numVertices, MD2_MAX_VERTICES, "vertices")
#undef MD2LIMITCHECK
// read skins // read skins
fseek(file, model->header.offsetSkins, SEEK_SET); fseek(file, model->header.offsetSkins, SEEK_SET);
if (model->header.numSkins > 0) if (model->header.numSkins > 0)
@ -319,8 +336,6 @@ static md2_model_t *md2_readModel(const char *filename)
md2_freeModel (model); md2_freeModel (model);
return 0; return 0;
} }
;
} }
// read texture coordinates // read texture coordinates
@ -334,8 +349,6 @@ static md2_model_t *md2_readModel(const char *filename)
md2_freeModel (model); md2_freeModel (model);
return 0; return 0;
} }
} }
// read triangles // read triangles
@ -769,6 +782,7 @@ void HWR_InitMD2(void)
md2_playermodels[s].grpatch = NULL; md2_playermodels[s].grpatch = NULL;
md2_playermodels[s].skin = -1; md2_playermodels[s].skin = -1;
md2_playermodels[s].notfound = true; md2_playermodels[s].notfound = true;
md2_playermodels[s].error = false;
} }
for (i = 0; i < NUMSPRITES; i++) for (i = 0; i < NUMSPRITES; i++)
{ {
@ -777,6 +791,7 @@ void HWR_InitMD2(void)
md2_models[i].grpatch = NULL; md2_models[i].grpatch = NULL;
md2_models[i].skin = -1; md2_models[i].skin = -1;
md2_models[i].notfound = true; md2_models[i].notfound = true;
md2_models[i].error = false;
} }
// read the md2.dat file // read the md2.dat file
@ -1378,6 +1393,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
else else
md2 = &md2_models[spr->mobj->sprite]; md2 = &md2_models[spr->mobj->sprite];
if (md2->error)
return; // we already failed loading this before :(
if (!md2->model) if (!md2->model)
{ {
//CONS_Debug(DBG_RENDER, "Loading MD2... (%s)", sprnames[spr->mobj->sprite]); //CONS_Debug(DBG_RENDER, "Loading MD2... (%s)", sprnames[spr->mobj->sprite]);
@ -1391,6 +1408,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
else else
{ {
//CONS_Debug(DBG_RENDER, " FAILED\n"); //CONS_Debug(DBG_RENDER, " FAILED\n");
md2->error = true; // prevent endless fail
return; return;
} }
} }

View File

@ -123,6 +123,7 @@ typedef struct
void *blendgrpatch; void *blendgrpatch;
boolean notfound; boolean notfound;
INT32 skin; INT32 skin;
boolean error;
} md2_t; } md2_t;
extern md2_t md2_models[NUMSPRITES]; extern md2_t md2_models[NUMSPRITES];

View File

@ -757,15 +757,8 @@ void HU_clearChatChars(void)
// //
boolean HU_Responder(event_t *ev) boolean HU_Responder(event_t *ev)
{ {
static boolean shiftdown = false;
UINT8 c; UINT8 c;
if (ev->data1 == KEY_LSHIFT || ev->data1 == KEY_RSHIFT)
{
shiftdown = (ev->type == ev_keydown);
return chat_on;
}
if (ev->type != ev_keydown) if (ev->type != ev_keydown)
return false; return false;
@ -1198,7 +1191,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
V_DrawString(x + 20, y, V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| ((players[tab[i].num].health > 0) ? 0 : V_60TRANS) | ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_60TRANS)
| V_ALLOWLOWERCASE, tab[i].name); | V_ALLOWLOWERCASE, tab[i].name);
// Draw emeralds // Draw emeralds
@ -1208,7 +1201,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
HU_DrawEmeralds(x-12,y+2,tab[i].emeralds); HU_DrawEmeralds(x-12,y+2,tab[i].emeralds);
} }
if (players[tab[i].num].health <= 0) if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
V_DrawSmallTranslucentPatch (x, y-4, V_80TRANS, livesback); V_DrawSmallTranslucentPatch (x, y-4, V_80TRANS, livesback);
else else
V_DrawSmallScaledPatch (x, y-4, 0, livesback); V_DrawSmallScaledPatch (x, y-4, 0, livesback);
@ -1220,7 +1213,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
V_DrawSmallScaledPatch(x, y-4, 0, superprefix[players[tab[i].num].skin]); V_DrawSmallScaledPatch(x, y-4, 0, superprefix[players[tab[i].num].skin]);
else else
{ {
if (players[tab[i].num].health <= 0) if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
V_DrawSmallTranslucentPatch(x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin]); V_DrawSmallTranslucentPatch(x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin]);
else else
V_DrawSmallScaledPatch(x, y-4, 0, faceprefix[players[tab[i].num].skin]); V_DrawSmallScaledPatch(x, y-4, 0, faceprefix[players[tab[i].num].skin]);
@ -1236,7 +1229,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
else else
{ {
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE); colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE);
if (players[tab[i].num].health <= 0) if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
V_DrawSmallTranslucentMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap); V_DrawSmallTranslucentMappedPatch (x, y-4, V_80TRANS, faceprefix[players[tab[i].num].skin], colormap);
else else
V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap); V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
@ -1244,10 +1237,10 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
} }
if (G_GametypeUsesLives()) //show lives if (G_GametypeUsesLives()) //show lives
V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE|((players[tab[i].num].health > 0) ? 0 : V_60TRANS), va("%dx", players[tab[i].num].lives)); V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE|((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_60TRANS), va("%dx", players[tab[i].num].lives));
else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT) else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT)
{ {
if (players[tab[i].num].health <= 0) if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
V_DrawSmallTranslucentPatch(x-32, y-4, V_60TRANS, tagico); V_DrawSmallTranslucentPatch(x-32, y-4, V_60TRANS, tagico);
else else
V_DrawSmallScaledPatch(x-32, y-4, 0, tagico); V_DrawSmallScaledPatch(x-32, y-4, 0, tagico);
@ -1260,13 +1253,13 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
if (players[tab[i].num].exiting) if (players[tab[i].num].exiting)
V_DrawRightAlignedString(x+240, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime))); V_DrawRightAlignedString(x+240, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime)));
else else
V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].health > 0) ? 0 : V_60TRANS), va("%u", tab[i].count)); V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_60TRANS), va("%u", tab[i].count));
} }
else else
V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].health > 0) ? 0 : V_60TRANS), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count))); V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_60TRANS), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count)));
} }
else else
V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].health > 0) ? 0 : V_60TRANS), va("%u", tab[i].count)); V_DrawRightAlignedString(x+240, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_60TRANS), va("%u", tab[i].count));
y += 16; y += 16;
} }
@ -1311,7 +1304,7 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer)
strlcpy(name, tab[i].name, 9); strlcpy(name, tab[i].name, 9);
V_DrawString(x + 20, y, V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT) | ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_TRANSLUCENT)
| V_ALLOWLOWERCASE, name); | V_ALLOWLOWERCASE, name);
if (gametype == GT_CTF) if (gametype == GT_CTF)
@ -1337,12 +1330,12 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer)
else else
{ {
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE); colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE);
if (players[tab[i].num].health <= 0) if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
V_DrawSmallTranslucentMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap); V_DrawSmallTranslucentMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
else else
V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap); V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
} }
V_DrawRightAlignedThinString(x+120, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); V_DrawRightAlignedThinString(x+120, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
} }
} }
@ -1367,7 +1360,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
strlcpy(name, tab[i].name, 9); strlcpy(name, tab[i].name, 9);
V_DrawString(x + 20, y, V_DrawString(x + 20, y,
((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0) ((tab[i].num == whiteplayer) ? V_YELLOWMAP : 0)
| ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT) | ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_TRANSLUCENT)
| V_ALLOWLOWERCASE, name); | V_ALLOWLOWERCASE, name);
if (G_GametypeUsesLives()) //show lives if (G_GametypeUsesLives()) //show lives
@ -1390,7 +1383,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
V_DrawSmallScaledPatch (x, y-4, 0, superprefix[players[tab[i].num].skin]); V_DrawSmallScaledPatch (x, y-4, 0, superprefix[players[tab[i].num].skin]);
else else
{ {
if (players[tab[i].num].health <= 0) if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
V_DrawSmallTranslucentPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin]); V_DrawSmallTranslucentPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin]);
else else
V_DrawSmallScaledPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin]); V_DrawSmallScaledPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin]);
@ -1406,7 +1399,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
else else
{ {
colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE); colormap = R_GetTranslationColormap(players[tab[i].num].skin, players[tab[i].num].mo ? players[tab[i].num].mo->color : tab[i].color, GTC_CACHE);
if (players[tab[i].num].health <= 0) if (players[tab[i].num].mo && players[tab[i].num].mo->health <= 0)
V_DrawSmallTranslucentMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap); V_DrawSmallTranslucentMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
else else
V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap); V_DrawSmallMappedPatch (x, y-4, 0, faceprefix[players[tab[i].num].skin], colormap);
@ -1421,13 +1414,13 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
if (players[tab[i].num].exiting) if (players[tab[i].num].exiting)
V_DrawRightAlignedThinString(x+156, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime))); V_DrawRightAlignedThinString(x+156, y, 0, va("%i:%02i.%02i", G_TicsToMinutes(players[tab[i].num].realtime,true), G_TicsToSeconds(players[tab[i].num].realtime), G_TicsToCentiseconds(players[tab[i].num].realtime)));
else else
V_DrawRightAlignedThinString(x+156, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); V_DrawRightAlignedThinString(x+156, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
} }
else else
V_DrawRightAlignedThinString(x+156, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count))); V_DrawRightAlignedThinString(x+156, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_TRANSLUCENT), va("%i:%02i.%02i", G_TicsToMinutes(tab[i].count,true), G_TicsToSeconds(tab[i].count), G_TicsToCentiseconds(tab[i].count)));
} }
else else
V_DrawRightAlignedThinString(x+120, y, ((players[tab[i].num].health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count)); V_DrawRightAlignedThinString(x+120, y, ((players[tab[i].num].mo && players[tab[i].num].mo->health > 0) ? 0 : V_TRANSLUCENT), va("%u", tab[i].count));
y += 16; y += 16;
if (y > 160) if (y > 160)

View File

@ -296,6 +296,14 @@ char *I_GetEnv(const char *name);
INT32 I_PutEnv(char *variable); INT32 I_PutEnv(char *variable);
/** \brief Put data in system clipboard
*/
INT32 I_ClipboardCopy(const char *data, size_t size);
/** \brief Retrieve data from system clipboard
*/
const char *I_ClipboardPaste(void);
void I_RegisterSysCommands(void); void I_RegisterSysCommands(void);
#endif #endif

View File

@ -362,23 +362,6 @@ char sprnames[NUMSPRITES + 1][5] =
// Gravity Well Objects // Gravity Well Objects
"GWLG", "GWLG",
"GWLR", "GWLR",
// SRB1 Sprites
"SRBA",
"SRBB",
"SRBC",
"SRBD",
"SRBE",
"SRBF",
"SRBG",
"SRBH",
"SRBI",
"SRBJ",
"SRBK",
"SRBL",
"SRBM",
"SRBN",
"SRBO",
}; };
char spr2names[NUMPLAYERSPRITES][5] = char spr2names[NUMPLAYERSPRITES][5] =
@ -496,32 +479,32 @@ state_t states[NUMSTATES] =
{SPR_THOK, FF_TRANS50, 8, {NULL}, 0, 0, S_NULL}, // S_THOK {SPR_THOK, FF_TRANS50, 8, {NULL}, 0, 0, S_NULL}, // S_THOK
// Player // Player
{SPR_PLAY, SPR2_STND, 105, {NULL}, 0, 0, S_PLAY_WAIT}, // S_PLAY_STND {SPR_PLAY, SPR2_STND|FF_ANIMATE, 105, {NULL}, 0, 7, S_PLAY_WAIT}, // S_PLAY_STND
{SPR_PLAY, SPR2_WAIT, 16, {NULL}, 0, 0, S_PLAY_WAIT}, // S_PLAY_WAIT {SPR_PLAY, SPR2_WAIT|FF_ANIMATE, -1, {NULL}, 0, 16, S_NULL}, // S_PLAY_WAIT
{SPR_PLAY, SPR2_WALK, 4, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_WALK {SPR_PLAY, SPR2_WALK, 4, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_WALK
{SPR_PLAY, SPR2_RUN , 2, {NULL}, 0, 0, S_PLAY_RUN}, // S_PLAY_RUN {SPR_PLAY, SPR2_RUN , 2, {NULL}, 0, 0, S_PLAY_RUN}, // S_PLAY_RUN
{SPR_PLAY, SPR2_PEEL, 2, {NULL}, 0, 0, S_PLAY_PEEL}, // S_PLAY_PEEL {SPR_PLAY, SPR2_PEEL, 2, {NULL}, 0, 0, S_PLAY_PEEL}, // S_PLAY_PEEL
{SPR_PLAY, SPR2_PAIN, 350, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_PAIN {SPR_PLAY, SPR2_PAIN|FF_ANIMATE, 350, {NULL}, 0, 4, S_PLAY_FALL}, // S_PLAY_PAIN
{SPR_PLAY, SPR2_DEAD, 4, {NULL}, 0, 0, S_PLAY_DEAD}, // S_PLAY_DEAD {SPR_PLAY, SPR2_DEAD|FF_ANIMATE, -1, {NULL}, 0, 4, S_NULL}, // S_PLAY_DEAD
{SPR_PLAY, SPR2_DRWN, 4, {NULL}, 0, 0, S_PLAY_DRWN}, // S_PLAY_DRWN {SPR_PLAY, SPR2_DRWN|FF_ANIMATE, -1, {NULL}, 0, 4, S_NULL}, // S_PLAY_DRWN
{SPR_PLAY, SPR2_SPIN, 1, {NULL}, 0, 0, S_PLAY_SPIN}, // S_PLAY_SPIN {SPR_PLAY, SPR2_SPIN, 1, {NULL}, 0, 0, S_PLAY_SPIN}, // S_PLAY_SPIN
{SPR_PLAY, SPR2_DASH, 2, {NULL}, 0, 0, S_PLAY_DASH}, // S_PLAY_DASH {SPR_PLAY, SPR2_DASH, 2, {NULL}, 0, 0, S_PLAY_DASH}, // S_PLAY_DASH
{SPR_PLAY, SPR2_GASP, 14, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_GASP {SPR_PLAY, SPR2_GASP|FF_ANIMATE, 14, {NULL}, 0, 4, S_PLAY_WALK}, // S_PLAY_GASP
{SPR_PLAY, SPR2_JUMP, 1, {NULL}, 0, 0, S_PLAY_JUMP}, // S_PLAY_JUMP {SPR_PLAY, SPR2_JUMP, 1, {NULL}, 0, 0, S_PLAY_JUMP}, // S_PLAY_JUMP
{SPR_PLAY, SPR2_SPNG, 2, {NULL}, 0, 0, S_PLAY_SPRING}, // S_PLAY_SPRING {SPR_PLAY, SPR2_SPNG, 2, {NULL}, 0, 0, S_PLAY_SPRING}, // S_PLAY_SPRING
{SPR_PLAY, SPR2_FALL, 2, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_FALL {SPR_PLAY, SPR2_FALL, 2, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_FALL
{SPR_PLAY, SPR2_EDGE, 12, {NULL}, 0, 0, S_PLAY_EDGE}, // S_PLAY_EDGE {SPR_PLAY, SPR2_EDGE|FF_ANIMATE, -1, {NULL}, 0, 12, S_NULL}, // S_PLAY_EDGE
{SPR_PLAY, SPR2_RIDE, 4, {NULL}, 0, 0, S_PLAY_RIDE}, // S_PLAY_RIDE {SPR_PLAY, SPR2_RIDE, 4, {NULL}, 0, 0, S_PLAY_RIDE}, // S_PLAY_RIDE
// CA_FLY/CA_SWIM // CA_FLY/CA_SWIM
{SPR_PLAY, SPR2_FLY , 2, {NULL}, 0, 0, S_PLAY_FLY}, // S_PLAY_FLY {SPR_PLAY, SPR2_FLY , 2, {NULL}, 0, 0, S_PLAY_FLY}, // S_PLAY_FLY
{SPR_PLAY, SPR2_SWIM, 2, {NULL}, 0, 0, S_PLAY_SWIM}, // S_PLAY_SWIM {SPR_PLAY, SPR2_SWIM, 2, {NULL}, 0, 0, S_PLAY_SWIM}, // S_PLAY_SWIM
{SPR_PLAY, SPR2_TIRE, 12, {NULL}, 0, 0, S_PLAY_FLY_TIRED}, // S_PLAY_FLY_TIRED {SPR_PLAY, SPR2_TIRE, 12, {NULL}, 0, 0, S_PLAY_FLY_TIRED}, // S_PLAY_FLY_TIRED
// CA_GLIDEANDCLIMB // CA_GLIDEANDCLIMB
{SPR_PLAY, SPR2_GLID, 2, {NULL}, 0, 0, S_PLAY_GLIDE}, // S_PLAY_GLIDE {SPR_PLAY, SPR2_GLID, 2, {NULL}, 0, 0, S_PLAY_GLIDE}, // S_PLAY_GLIDE
{SPR_PLAY, SPR2_CLNG, 6, {NULL}, 0, 0, S_PLAY_CLING}, // S_PLAY_CLING {SPR_PLAY, SPR2_CLNG|FF_ANIMATE, -1, {NULL}, 0, 4, S_NULL}, // S_PLAY_CLING
{SPR_PLAY, SPR2_CLMB, 5, {NULL}, 0, 0, S_PLAY_CLIMB}, // S_PLAY_CLIMB {SPR_PLAY, SPR2_CLMB, 5, {NULL}, 0, 0, S_PLAY_CLIMB}, // S_PLAY_CLIMB
// CA_TWINSPIN // CA_TWINSPIN
{SPR_PLAY, SPR2_TWIN|FF_SPR2ENDSTATE, 1, {NULL}, S_PLAY_JUMP, 0, S_PLAY_TWINSPIN}, // S_PLAY_TWINSPIN {SPR_PLAY, SPR2_TWIN|FF_SPR2ENDSTATE, 1, {NULL}, S_PLAY_JUMP, 0, S_PLAY_TWINSPIN}, // S_PLAY_TWINSPIN
@ -531,33 +514,33 @@ state_t states[NUMSTATES] =
{SPR_PLAY, SPR2_MLEE, 20, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_MELEE_FINISH {SPR_PLAY, SPR2_MLEE, 20, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_MELEE_FINISH
// SF_SUPERANIMS // SF_SUPERANIMS
{SPR_PLAY, SPR2_SSTD, 7, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_STND {SPR_PLAY, SPR2_SSTD|FF_ANIMATE, -1, {NULL}, 0, 7, S_NULL}, // S_PLAY_SUPER_STND
{SPR_PLAY, SPR2_SWLK, 7, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_WALK {SPR_PLAY, SPR2_SWLK, 7, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_WALK
{SPR_PLAY, SPR2_SRUN, 7, {NULL}, 0, 0, S_PLAY_SUPER_RUN}, // S_PLAY_SUPER_RUN {SPR_PLAY, SPR2_SRUN, 7, {NULL}, 0, 0, S_PLAY_SUPER_RUN}, // S_PLAY_SUPER_RUN
{SPR_PLAY, SPR2_SPEE, 7, {NULL}, 0, 0, S_PLAY_SUPER_PEEL}, // S_PLAY_SUPER_PEEL {SPR_PLAY, SPR2_SPEE, 7, {NULL}, 0, 0, S_PLAY_SUPER_PEEL}, // S_PLAY_SUPER_PEEL
{SPR_PLAY, SPR2_SPAN, -1, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_PAIN {SPR_PLAY, SPR2_SPAN|FF_ANIMATE, 350, {NULL}, 0, 4, S_PLAY_SUPER_FALL}, // S_PLAY_SUPER_PAIN
{SPR_PLAY, SPR2_SSTN, -1, {NULL}, 0, 0, S_PLAY_SUPER_STND}, // S_PLAY_SUPER_STUN {SPR_PLAY, SPR2_SSTN|FF_ANIMATE, 350, {NULL}, 0, 4, S_PLAY_SUPER_FALL}, // S_PLAY_SUPER_STUN
{SPR_PLAY, SPR2_SDTH, 4, {NULL}, 0, 0, S_PLAY_SUPER_DEAD}, // S_PLAY_SUPER_DEAD {SPR_PLAY, SPR2_SDTH|FF_ANIMATE, -1, {NULL}, 0, 4, S_NULL}, // S_PLAY_SUPER_DEAD
{SPR_PLAY, SPR2_SDRN, 4, {NULL}, 0, 0, S_PLAY_SUPER_DRWN}, // S_PLAY_SUPER_DRWN {SPR_PLAY, SPR2_SDRN|FF_ANIMATE, -1, {NULL}, 0, 4, S_NULL}, // S_PLAY_SUPER_DRWN
{SPR_PLAY, SPR2_SSPN, 1, {NULL}, 0, 0, S_PLAY_SUPER_SPIN}, // S_PLAY_SUPER_SPIN {SPR_PLAY, SPR2_SSPN, 1, {NULL}, 0, 0, S_PLAY_SUPER_SPIN}, // S_PLAY_SUPER_SPIN
{SPR_PLAY, SPR2_SGSP, 14, {NULL}, 0, 0, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_GASP {SPR_PLAY, SPR2_SGSP|FF_ANIMATE, 14, {NULL}, 0, 4, S_PLAY_SUPER_WALK}, // S_PLAY_SUPER_GASP
{SPR_PLAY, SPR2_SJMP, 1, {NULL}, 0, 0, S_PLAY_SUPER_JUMP}, // S_PLAY_SUPER_JUMP {SPR_PLAY, SPR2_SJMP, 1, {NULL}, 0, 0, S_PLAY_SUPER_JUMP}, // S_PLAY_SUPER_JUMP
{SPR_PLAY, SPR2_SSPG, 2, {NULL}, 0, 0, S_PLAY_SUPER_SPRING}, // S_PLAY_SUPER_SPRING {SPR_PLAY, SPR2_SSPG, 2, {NULL}, 0, 0, S_PLAY_SUPER_SPRING}, // S_PLAY_SUPER_SPRING
{SPR_PLAY, SPR2_SFAL, 2, {NULL}, 0, 0, S_PLAY_SUPER_FALL}, // S_PLAY_SUPER_FALL {SPR_PLAY, SPR2_SFAL, 2, {NULL}, 0, 0, S_PLAY_SUPER_FALL}, // S_PLAY_SUPER_FALL
{SPR_PLAY, SPR2_SEDG, 12, {NULL}, 0, 0, S_PLAY_SUPER_EDGE}, // S_PLAY_SUPER_EDGE {SPR_PLAY, SPR2_SEDG|FF_ANIMATE, -1, {NULL}, 0, 12, S_NULL}, // S_PLAY_SUPER_EDGE
{SPR_PLAY, SPR2_SRID, 4, {NULL}, 0, 0, S_PLAY_SUPER_RIDE}, // S_PLAY_SUPER_RIDE {SPR_PLAY, SPR2_SRID, 4, {NULL}, 0, 0, S_PLAY_SUPER_RIDE}, // S_PLAY_SUPER_RIDE
{SPR_PLAY, SPR2_SFLT, 7, {NULL}, 0, 0, S_PLAY_SUPER_FLOAT}, // S_PLAY_SUPER_FLOAT {SPR_PLAY, SPR2_SFLT, 7, {NULL}, 0, 0, S_PLAY_SUPER_FLOAT}, // S_PLAY_SUPER_FLOAT
// SF_SUPER // SF_SUPER
{SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS2}, // S_PLAY_SUPER_TRANS {SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS2}, // S_PLAY_SUPER_TRANS
{SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS3}, // S_PLAY_SUPER_TRANS2 {SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS3}, // S_PLAY_SUPER_TRANS2
{SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS4}, // S_PLAY_SUPER_TRANS3 {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS4}, // S_PLAY_SUPER_TRANS3
{SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS5}, // S_PLAY_SUPER_TRANS4 {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS5}, // S_PLAY_SUPER_TRANS4
{SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS6}, // S_PLAY_SUPER_TRANS5 {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS6}, // S_PLAY_SUPER_TRANS5
{SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS7}, // S_PLAY_SUPER_TRANS6 {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS7}, // S_PLAY_SUPER_TRANS6
{SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS8}, // S_PLAY_SUPER_TRANS7 {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS8}, // S_PLAY_SUPER_TRANS7
{SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS9}, // S_PLAY_SUPER_TRANS8 {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_PLAY_SUPER_TRANS9}, // S_PLAY_SUPER_TRANS8
{SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 16, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_SUPER_TRANS9 {SPR_PLAY, SPR2_TRNS|FF_FULLBRIGHT, 16, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_SUPER_TRANS9
{SPR_NULL, 0, -1, {NULL}, 0, 0, S_OBJPLACE_DUMMY}, //S_OBJPLACE_DUMMY {SPR_NULL, 0, -1, {NULL}, 0, 0, S_OBJPLACE_DUMMY}, //S_OBJPLACE_DUMMY
@ -2770,69 +2753,6 @@ state_t states[NUMSTATES] =
{SPR_ROIO, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 4, 2, S_ROCKCRUMBLEO}, // S_ROCKCRUMBLEO {SPR_ROIO, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 4, 2, S_ROCKCRUMBLEO}, // S_ROCKCRUMBLEO
{SPR_ROIP, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 4, 2, S_ROCKCRUMBLEP}, // S_ROCKCRUMBLEP {SPR_ROIP, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 4, 2, S_ROCKCRUMBLEP}, // S_ROCKCRUMBLEP
{SPR_SRBA, 0, 5, {A_Look}, 0, 0, S_SRB1_CRAWLA1}, // S_SRB1_CRAWLA1
{SPR_SRBA, 0, 3, {A_Chase}, 0, 0, S_SRB1_CRAWLA3}, // S_SRB1_CRAWLA2
{SPR_SRBA, 1, 3, {A_Chase}, 0, 0, S_SRB1_CRAWLA4}, // S_SRB1_CRAWLA3
{SPR_SRBA, 2, 3, {A_Chase}, 0, 0, S_SRB1_CRAWLA2}, // S_SRB1_CRAWLA4
{SPR_SRBB, 0, 2, {A_Look}, 0, 0, S_SRB1_BAT2}, // S_SRB1_BAT1
{SPR_SRBB, 1, 2, {A_Look}, 0, 0, S_SRB1_BAT1}, // S_SRB1_BAT2
{SPR_SRBB, 0, 2, {A_BuzzFly}, 0, 0, S_SRB1_BAT4}, // S_SRB1_BAT3
{SPR_SRBB, 1, 2, {A_BuzzFly}, 0, 0, S_SRB1_BAT3}, // S_SRB1_BAT4
{SPR_SRBC, 0, 2, {A_Look}, 0, 0, S_SRB1_ROBOFISH1}, // S_SRB1_ROBOFISH1
{SPR_SRBC, 1, 2, {A_BuzzFly}, 0, 0, S_SRB1_ROBOFISH3}, // S_SRB1_ROBOFISH2
{SPR_SRBC, 0, 2, {A_BuzzFly}, 0, 0, S_SRB1_ROBOFISH2}, // S_SRB1_ROBOFISH3
{SPR_SRBD, 0, 2, {A_Look}, 0, 0, S_SRB1_VOLCANOGUY1}, // S_SRB1_VOLCANOGUY1
{SPR_SRBD, 0, 2, {A_BuzzFly}, 0, 0, S_SRB1_VOLCANOGUY2}, // S_SRB1_VOLCANOGUY2
{SPR_SRBE, 0, 2, {A_BunnyHop}, 7, 2, S_SRB1_HOPPY2}, // S_SRB1_HOPPY1
{SPR_SRBE, 1, 2, {A_BunnyHop}, 7, -2, S_SRB1_HOPPY1}, // S_SRB1_HOPPY2
{SPR_SRBE, 0, 2, {A_BunnyHop}, 4, 2, S_SRB1_HOPPYWATER2}, // S_SRB1_HOPPYWATER1
{SPR_SRBE, 1, 2, {A_BunnyHop}, 4, -2, S_SRB1_HOPPYWATER1}, // S_SRB1_HOPPYWATER2
{SPR_SRBF, 0, 2, {A_BunnyHop}, 7, 0, S_SRB1_HOPPYSKYLAB1}, // S_SRB1_HOPPYSKYLAB1
{SPR_SRBG, 0, 16, {A_MoveAbsolute}, 0, 5, S_SRB1_MMZFLYING2}, // S_SRB1_MMZFLYING1
{SPR_SRBG, 0, 16, {A_MoveAbsolute}, 180, 5, S_SRB1_MMZFLYING3}, // S_SRB1_MMZFLYING2
{SPR_SRBG, 0, 1, {A_MoveAbsolute}, 0, 5, S_SRB1_MMZFLYING4}, // S_SRB1_MMZFLYING3
{SPR_SRBG, 0, 7, {A_MoveAbsolute}, 0, 5, S_SRB1_MMZFLYING5}, // S_SRB1_MMZFLYING4
{SPR_SRBG, 0, 8, {A_MoveAbsolute}, 180, 5, S_SRB1_MMZFLYING1}, // S_SRB1_MMZFLYING5
{SPR_SRBH, 0, 16, {A_MoveAbsolute}, 180, 5, S_SRB1_UFO2}, // S_SRB1_UFO1
{SPR_SRBH, 0, 16, {A_MoveAbsolute}, 0, 5, S_SRB1_UFO1}, // S_SRB1_UFO2
{SPR_SRBI, 0, 4, {A_MoveAbsolute}, 0, 7, S_SRB1_GRAYBOT2}, // S_SRB1_GRAYBOT1
{SPR_SRBI, 1, 4, {A_MoveAbsolute}, 0, 7, S_SRB1_GRAYBOT3}, // S_SRB1_GRAYBOT2
{SPR_SRBI, 0, 4, {A_MoveAbsolute}, 0, 7, S_SRB1_GRAYBOT4}, // S_SRB1_GRAYBOT3
{SPR_SRBI, 1, 4, {A_MoveAbsolute}, 180, 7, S_SRB1_GRAYBOT5}, // S_SRB1_GRAYBOT4
{SPR_SRBI, 0, 4, {A_MoveAbsolute}, 180, 7, S_SRB1_GRAYBOT6}, // S_SRB1_GRAYBOT5
{SPR_SRBI, 1, 4, {A_MoveAbsolute}, 180, 7, S_SRB1_GRAYBOT1}, // S_SRB1_GRAYBOT6
{SPR_SRBJ, 0, 8, {A_MoveAbsolute}, 0, 5, S_SRB1_ROBOTOPOLIS2}, // S_SRB1_ROBOTOPOLIS1
{SPR_SRBJ, 1, 8, {A_MoveAbsolute}, 0, -5, S_SRB1_ROBOTOPOLIS1}, // S_SRB1_ROBOTOPOLIS2
{SPR_SRBK, 0, 8, {A_MoveAbsolute}, 0, 5, S_SRB1_RBZBUZZ2}, // S_SRB1_RBZBUZZ1
{SPR_SRBK, 1, 8, {A_MoveAbsolute}, 0, -5, S_SRB1_RBZBUZZ1}, // S_SRB1_RBZBUZZ2
{SPR_SRBL, 0, 35, {A_ZThrust}, 4, (1<<16)+1, S_SRB1_RBZSPIKES2}, // S_SRB1_RBZSPIKES1
{SPR_SRBL, 0, 35, {A_ZThrust}, -4, (1<<16)+1, S_SRB1_RBZSPIKES1}, // S_SRB1_RBZSPIKES2
{SPR_SRBM, 0, 4, {NULL}, 0, 0, S_SRB1_METALSONIC2}, // S_SRB1_METALSONIC1
{SPR_SRBM, 1, 4, {NULL}, 0, 0, S_SRB1_METALSONIC3}, // S_SRB1_METALSONIC2
{SPR_SRBM, 2, 4, {NULL}, 0, 0, S_SRB1_METALSONIC1}, // S_SRB1_METALSONIC3
{SPR_SRBN, 0, 2, {A_MoveAbsolute}, 0, 7, S_SRB1_GOLDBOT2}, // S_SRB1_GOLDBOT1
{SPR_SRBN, 1, 2, {A_MoveAbsolute}, 0, 7, S_SRB1_GOLDBOT3}, // S_SRB1_GOLDBOT2
{SPR_SRBN, 0, 2, {A_MoveAbsolute}, 0, 7, S_SRB1_GOLDBOT4}, // S_SRB1_GOLDBOT3
{SPR_SRBN, 1, 2, {A_MoveAbsolute}, 180, 7, S_SRB1_GOLDBOT5}, // S_SRB1_GOLDBOT4
{SPR_SRBN, 0, 2, {A_MoveAbsolute}, 180, 7, S_SRB1_GOLDBOT6}, // S_SRB1_GOLDBOT5
{SPR_SRBN, 1, 2, {A_MoveAbsolute}, 180, 7, S_SRB1_GOLDBOT1}, // S_SRB1_GOLDBOT6
{SPR_SRBO, 0, 2, {A_Look}, 0, 0, S_SRB1_GENREX1}, // S_SRB1_GENREX1
{SPR_SRBO, 0, 2, {A_BuzzFly}, 0, 0, S_SRB1_GENREX2}, // S_SRB1_GENREX2
#ifdef SEENAMES #ifdef SEENAMES
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK
#endif #endif
@ -13948,438 +13868,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate S_NULL // raisestate
}, },
{ // MT_SRB1_CRAWLA
4000, // doomednum
S_SRB1_CRAWLA1, // spawnstate
1, // spawnhealth
S_SRB1_CRAWLA2, // seestate
sfx_None, // seesound
32, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
200, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
3, // speed
20*FRACUNIT, // radius
40*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY, // flags
S_NULL // raisestate
},
{ // MT_SRB1_BAT
4001, // doomednum
S_SRB1_BAT1, // spawnstate
1, // spawnhealth
S_SRB1_BAT3, // seestate
sfx_None, // seesound
2, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
3072, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
4*FRACUNIT, // speed
17*FRACUNIT, // radius
40*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY|MF_NOGRAVITY|MF_SLIDEME, // flags
S_NULL // raisestate
},
{ // MT_SRB1_ROBOFISH
4002, // doomednum
S_SRB1_ROBOFISH1, // spawnstate
1, // spawnhealth
S_SRB1_ROBOFISH2, // seestate
sfx_None, // seesound
2, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
3072, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
4*FRACUNIT, // speed
22*FRACUNIT, // radius
32*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY|MF_NOGRAVITY|MF_SLIDEME, // flags
S_NULL // raisestate
},
{ // MT_SRB1_VOLCANOGUY
4003, // doomednum
S_SRB1_VOLCANOGUY1, // spawnstate
1, // spawnhealth
S_SRB1_VOLCANOGUY2, // seestate
sfx_None, // seesound
2, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
3072, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
4*FRACUNIT, // speed
20*FRACUNIT, // radius
40*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY|MF_NOGRAVITY|MF_SLIDEME, // flags
S_NULL // raisestate
},
{ // MT_SRB1_HOPPY
4004, // doomednum
S_SRB1_HOPPY1, // spawnstate
1, // spawnhealth
S_SRB1_HOPPY1, // seestate
sfx_None, // seesound
2, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
3072, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
FRACUNIT, // speed
20*FRACUNIT, // radius
32*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY, // flags
S_NULL // raisestate
},
{ // MT_SRB1_HOPPYWATER
4005, // doomednum
S_SRB1_HOPPYWATER1, // spawnstate
1, // spawnhealth
S_SRB1_HOPPYWATER1, // seestate
sfx_None, // seesound
2, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
3072, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
FRACUNIT, // speed
20*FRACUNIT, // radius
32*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY, // flags
S_NULL // raisestate
},
{ // MT_SRB1_HOPPYSKYLAB
4006, // doomednum
S_SRB1_HOPPYSKYLAB1, // spawnstate
1, // spawnhealth
S_SRB1_HOPPYSKYLAB1, // seestate
sfx_None, // seesound
2, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
3072, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
FRACUNIT, // speed
10*FRACUNIT, // radius
34*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY, // flags
S_NULL // raisestate
},
{ // MT_SRB1_MMZFLYING
4007, // doomednum
S_SRB1_MMZFLYING1, // spawnstate
1, // spawnhealth
S_SRB1_MMZFLYING1, // seestate
sfx_None, // seesound
32, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
200, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
FRACUNIT, // speed
24*FRACUNIT, // radius
32*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY|MF_NOGRAVITY|MF_FLOAT, // flags
S_NULL // raisestate
},
{ // MT_SRB1_UFO
4008, // doomednum
S_SRB1_UFO1, // spawnstate
1, // spawnhealth
S_SRB1_UFO1, // seestate
sfx_None, // seesound
32, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
200, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
3, // speed
24*FRACUNIT, // radius
32*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY|MF_NOGRAVITY|MF_FLOAT|MF_SPAWNCEILING, // flags
S_NULL // raisestate
},
{ // MT_SRB1_GRAYBOT
4009, // doomednum
S_SRB1_GRAYBOT1,// spawnstate
1, // spawnhealth
S_SRB1_GRAYBOT1,// seestate
sfx_None, // seesound
32, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
200, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
3, // speed
21*FRACUNIT, // radius
69*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY|MF_NOGRAVITY|MF_FLOAT, // flags
S_NULL // raisestate
},
{ // MT_SRB1_ROBOTOPOLIS
4010, // doomednum
S_SRB1_ROBOTOPOLIS1, // spawnstate
1, // spawnhealth
S_SRB1_ROBOTOPOLIS1, // seestate
sfx_None, // seesound
32, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
200, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
3, // speed
36*FRACUNIT, // radius
62*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY|MF_NOGRAVITY|MF_FLOAT, // flags
S_NULL // raisestate
},
{ // MT_SRB1_RBZBUZZ
4011, // doomednum
S_SRB1_RBZBUZZ1,// spawnstate
1, // spawnhealth
S_SRB1_RBZBUZZ1,// seestate
sfx_None, // seesound
32, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
200, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
3, // speed
44*FRACUNIT, // radius
45*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY|MF_NOGRAVITY|MF_FLOAT, // flags
S_NULL // raisestate
},
{ // MT_SRB1_RBZSPIKES
4012, // doomednum
S_SRB1_RBZSPIKES1, // spawnstate
1, // spawnhealth
S_SRB1_RBZSPIKES1, // seestate
sfx_None, // seesound
32, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
200, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
3, // speed
10*FRACUNIT, // radius
53*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SOLID|MF_ENEMY|MF_NOGRAVITY|MF_FLOAT, // flags
S_NULL // raisestate
},
{ // MT_SRB1_METALSONIC
4013, // doomednum
S_SRB1_METALSONIC1, // spawnstate
1000, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_NULL, // deathstate
S_NULL, // xdeathstate
sfx_None, // deathsound
21*FRACUNIT, // speed
16*FRACUNIT, // radius
40*FRACUNIT, // height
0, // display offset
100, // mass
1, // damage
sfx_None, // activesound
MF_SLIDEME|MF_SOLID|MF_PUSHABLE, // flags
S_NULL // raisestate
},
{ // MT_SRB1_GOLDBOT
4014, // doomednum
S_SRB1_GOLDBOT1,// spawnstate
1, // spawnhealth
S_SRB1_GOLDBOT1,// seestate
sfx_None, // seesound
32, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
200, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
3, // speed
21*FRACUNIT, // radius
69*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY|MF_NOGRAVITY|MF_FLOAT, // flags
S_NULL // raisestate
},
{ // MT_SRB1_GENREX
4015, // doomednum
S_SRB1_GENREX1, // spawnstate
1, // spawnhealth
S_SRB1_GENREX2, // seestate
sfx_None, // seesound
2, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
3072, // painchance
sfx_None, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
S_XPLD1, // deathstate
S_NULL, // xdeathstate
sfx_pop, // deathsound
4*FRACUNIT, // speed
17*FRACUNIT, // radius
40*FRACUNIT, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY|MF_NOGRAVITY|MF_SLIDEME, // flags
S_NULL // raisestate
},
#ifdef SEENAMES #ifdef SEENAMES
{ // MT_NAMECHECK { // MT_NAMECHECK
-1, // doomednum -1, // doomednum

View File

@ -555,23 +555,6 @@ typedef enum sprite
SPR_GWLG, SPR_GWLG,
SPR_GWLR, SPR_GWLR,
// SRB1 Sprites
SPR_SRBA,
SPR_SRBB,
SPR_SRBC,
SPR_SRBD,
SPR_SRBE,
SPR_SRBF,
SPR_SRBG,
SPR_SRBH,
SPR_SRBI,
SPR_SRBJ,
SPR_SRBK,
SPR_SRBL,
SPR_SRBM,
SPR_SRBN,
SPR_SRBO,
SPR_FIRSTFREESLOT, SPR_FIRSTFREESLOT,
SPR_LASTFREESLOT = SPR_FIRSTFREESLOT + NUMSPRITEFREESLOTS - 1, SPR_LASTFREESLOT = SPR_FIRSTFREESLOT + NUMSPRITEFREESLOTS - 1,
NUMSPRITES NUMSPRITES
@ -2901,70 +2884,6 @@ typedef enum state
S_ROCKCRUMBLEO, S_ROCKCRUMBLEO,
S_ROCKCRUMBLEP, S_ROCKCRUMBLEP,
S_SRB1_CRAWLA1,
S_SRB1_CRAWLA2,
S_SRB1_CRAWLA3,
S_SRB1_CRAWLA4,
S_SRB1_BAT1,
S_SRB1_BAT2,
S_SRB1_BAT3,
S_SRB1_BAT4,
S_SRB1_ROBOFISH1,
S_SRB1_ROBOFISH2,
S_SRB1_ROBOFISH3,
S_SRB1_VOLCANOGUY1,
S_SRB1_VOLCANOGUY2,
S_SRB1_HOPPY1,
S_SRB1_HOPPY2,
S_SRB1_HOPPYWATER1,
S_SRB1_HOPPYWATER2,
S_SRB1_HOPPYSKYLAB1,
S_SRB1_MMZFLYING1,
S_SRB1_MMZFLYING2,
S_SRB1_MMZFLYING3,
S_SRB1_MMZFLYING4,
S_SRB1_MMZFLYING5,
S_SRB1_UFO1,
S_SRB1_UFO2,
S_SRB1_GRAYBOT1,
S_SRB1_GRAYBOT2,
S_SRB1_GRAYBOT3,
S_SRB1_GRAYBOT4,
S_SRB1_GRAYBOT5,
S_SRB1_GRAYBOT6,
S_SRB1_ROBOTOPOLIS1,
S_SRB1_ROBOTOPOLIS2,
S_SRB1_RBZBUZZ1,
S_SRB1_RBZBUZZ2,
S_SRB1_RBZSPIKES1,
S_SRB1_RBZSPIKES2,
S_SRB1_METALSONIC1,
S_SRB1_METALSONIC2,
S_SRB1_METALSONIC3,
S_SRB1_GOLDBOT1,
S_SRB1_GOLDBOT2,
S_SRB1_GOLDBOT3,
S_SRB1_GOLDBOT4,
S_SRB1_GOLDBOT5,
S_SRB1_GOLDBOT6,
S_SRB1_GENREX1,
S_SRB1_GENREX2,
#ifdef SEENAMES #ifdef SEENAMES
S_NAMECHECK, S_NAMECHECK,
#endif #endif
@ -3494,22 +3413,6 @@ typedef enum mobj_type
MT_ROCKCRUMBLE15, MT_ROCKCRUMBLE15,
MT_ROCKCRUMBLE16, MT_ROCKCRUMBLE16,
MT_SRB1_CRAWLA,
MT_SRB1_BAT,
MT_SRB1_ROBOFISH,
MT_SRB1_VOLCANOGUY,
MT_SRB1_HOPPY,
MT_SRB1_HOPPYWATER,
MT_SRB1_HOPPYSKYLAB,
MT_SRB1_MMZFLYING,
MT_SRB1_UFO,
MT_SRB1_GRAYBOT,
MT_SRB1_ROBOTOPOLIS,
MT_SRB1_RBZBUZZ,
MT_SRB1_RBZSPIKES,
MT_SRB1_METALSONIC,
MT_SRB1_GOLDBOT,
MT_SRB1_GENREX,
#ifdef SEENAMES #ifdef SEENAMES
MT_NAMECHECK, MT_NAMECHECK,
#endif #endif

View File

@ -309,6 +309,19 @@ static int lib_pRemoveMobj(lua_State *L)
return 0; return 0;
} }
// P_IsValidSprite2 technically doesn't exist, and probably never should... but too much would need to be exposed to allow this to be checked by other methods.
static int lib_pIsValidSprite2(lua_State *L)
{
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
UINT8 spr2 = (UINT8)luaL_checkinteger(L, 2);
//HUDSAFE
if (!mobj)
return LUA_ErrInvalid(L, "mobj_t");
lua_pushboolean(L, (mobj->skin && (((skin_t *)mobj->skin)->sprites[spr2].numframes > 0)));
return 1;
}
static int lib_pSpawnMissile(lua_State *L) static int lib_pSpawnMissile(lua_State *L)
{ {
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
@ -618,6 +631,17 @@ static int lib_pAddPlayerScore(lua_State *L)
return 0; return 0;
} }
static int lib_pStealPlayerScore(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
UINT32 amount = (UINT32)luaL_checkinteger(L, 2);
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
P_StealPlayerScore(player, amount);
return 0;
}
static int lib_pPlayerInPain(lua_State *L) static int lib_pPlayerInPain(lua_State *L)
{ {
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
@ -1132,7 +1156,7 @@ static int lib_pPlayerRingBurst(lua_State *L)
if (!player) if (!player)
return LUA_ErrInvalid(L, "player_t"); return LUA_ErrInvalid(L, "player_t");
if (num_rings == -1) if (num_rings == -1)
num_rings = player->health - 1; num_rings = player->rings;
P_PlayerRingBurst(player, num_rings); P_PlayerRingBurst(player, num_rings);
return 0; return 0;
} }
@ -1157,6 +1181,16 @@ static int lib_pPlayerWeaponAmmoBurst(lua_State *L)
return 0; return 0;
} }
static int lib_pPlayerWeaponPanelOrAmmoBurst(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
P_PlayerWeaponPanelOrAmmoBurst(player);
return 0;
}
static int lib_pPlayerEmeraldBurst(lua_State *L) static int lib_pPlayerEmeraldBurst(lua_State *L)
{ {
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
@ -1264,6 +1298,16 @@ static int lib_pDoNightsScore(lua_State *L)
return 0; return 0;
} }
static int lib_pDoMatchSuper(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
P_DoMatchSuper(player);
return 0;
}
// P_SPEC // P_SPEC
//////////// ////////////
@ -2005,6 +2049,7 @@ static luaL_Reg lib[] = {
// don't add P_SetMobjState or P_SetPlayerMobjState, use "mobj.state = S_NEWSTATE" instead. // don't add P_SetMobjState or P_SetPlayerMobjState, use "mobj.state = S_NEWSTATE" instead.
{"P_SpawnMobj",lib_pSpawnMobj}, {"P_SpawnMobj",lib_pSpawnMobj},
{"P_RemoveMobj",lib_pRemoveMobj}, {"P_RemoveMobj",lib_pRemoveMobj},
{"P_IsValidSprite2", lib_pIsValidSprite2},
{"P_SpawnMissile",lib_pSpawnMissile}, {"P_SpawnMissile",lib_pSpawnMissile},
{"P_SpawnXYZMissile",lib_pSpawnXYZMissile}, {"P_SpawnXYZMissile",lib_pSpawnXYZMissile},
{"P_SpawnPointMissile",lib_pSpawnPointMissile}, {"P_SpawnPointMissile",lib_pSpawnPointMissile},
@ -2031,6 +2076,7 @@ static luaL_Reg lib[] = {
{"P_GetPlayerSpinHeight",lib_pGetPlayerSpinHeight}, {"P_GetPlayerSpinHeight",lib_pGetPlayerSpinHeight},
{"P_GetPlayerControlDirection",lib_pGetPlayerControlDirection}, {"P_GetPlayerControlDirection",lib_pGetPlayerControlDirection},
{"P_AddPlayerScore",lib_pAddPlayerScore}, {"P_AddPlayerScore",lib_pAddPlayerScore},
{"P_StealPlayerScore",lib_pStealPlayerScore},
{"P_PlayerInPain",lib_pPlayerInPain}, {"P_PlayerInPain",lib_pPlayerInPain},
{"P_DoPlayerPain",lib_pDoPlayerPain}, {"P_DoPlayerPain",lib_pDoPlayerPain},
{"P_ResetPlayer",lib_pResetPlayer}, {"P_ResetPlayer",lib_pResetPlayer},
@ -2081,6 +2127,7 @@ static luaL_Reg lib[] = {
{"P_PlayerRingBurst",lib_pPlayerRingBurst}, {"P_PlayerRingBurst",lib_pPlayerRingBurst},
{"P_PlayerWeaponPanelBurst",lib_pPlayerWeaponPanelBurst}, {"P_PlayerWeaponPanelBurst",lib_pPlayerWeaponPanelBurst},
{"P_PlayerWeaponAmmoBurst",lib_pPlayerWeaponAmmoBurst}, {"P_PlayerWeaponAmmoBurst",lib_pPlayerWeaponAmmoBurst},
{"P_PlayerWeaponPanelOrAmmoBurst", lib_pPlayerWeaponPanelOrAmmoBurst},
{"P_PlayerEmeraldBurst",lib_pPlayerEmeraldBurst}, {"P_PlayerEmeraldBurst",lib_pPlayerEmeraldBurst},
{"P_PlayerFlagBurst",lib_pPlayerFlagBurst}, {"P_PlayerFlagBurst",lib_pPlayerFlagBurst},
{"P_PlayRinglossSound",lib_pPlayRinglossSound}, {"P_PlayRinglossSound",lib_pPlayRinglossSound},
@ -2089,6 +2136,7 @@ static luaL_Reg lib[] = {
{"P_PlayLivesJingle",lib_pPlayLivesJingle}, {"P_PlayLivesJingle",lib_pPlayLivesJingle},
{"P_CanPickupItem",lib_pCanPickupItem}, {"P_CanPickupItem",lib_pCanPickupItem},
{"P_DoNightsScore",lib_pDoNightsScore}, {"P_DoNightsScore",lib_pDoNightsScore},
{"P_DoMatchSuper",lib_pDoMatchSuper},
// p_spec // p_spec
{"P_Thrust",lib_pThrust}, {"P_Thrust",lib_pThrust},

View File

@ -62,9 +62,9 @@ boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_Touch
#define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type #define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type
#define LUAh_MobjThinker(mo) LUAh_MobjHook(mo, hook_MobjThinker) // Hook for P_MobjThinker or P_SceneryThinker by mobj type #define LUAh_MobjThinker(mo) LUAh_MobjHook(mo, hook_MobjThinker) // Hook for P_MobjThinker or P_SceneryThinker by mobj type
#define LUAh_BossThinker(mo) LUAh_MobjHook(mo, hook_BossThinker) // Hook for P_GenericBossThinker by mobj type #define LUAh_BossThinker(mo) LUAh_MobjHook(mo, hook_BossThinker) // Hook for P_GenericBossThinker by mobj type
UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Should mobj take damage?) UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype); // Hook for P_DamageMobj by mobj type (Should mobj take damage?)
boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Mobj actually takes damage!) boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype); // Hook for P_DamageMobj by mobj type (Mobj actually takes damage!)
boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source); // Hook for P_KillMobj by mobj type boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype); // Hook for P_KillMobj by mobj type
#define LUAh_BossDeath(mo) LUAh_MobjHook(mo, hook_BossDeath) // Hook for A_BossDeath by mobj type #define LUAh_BossDeath(mo) LUAh_MobjHook(mo, hook_BossDeath) // Hook for A_BossDeath by mobj type
#define LUAh_MobjRemoved(mo) LUAh_MobjHook(mo, hook_MobjRemoved) // Hook for P_RemoveMobj by mobj type #define LUAh_MobjRemoved(mo) LUAh_MobjHook(mo, hook_MobjRemoved) // Hook for P_RemoveMobj by mobj type
#define LUAh_JumpSpecial(player) LUAh_PlayerHook(player, hook_JumpSpecial) // Hook for P_DoJumpStuff (Any-jumping) #define LUAh_JumpSpecial(player) LUAh_PlayerHook(player, hook_JumpSpecial) // Hook for P_DoJumpStuff (Any-jumping)
@ -75,7 +75,7 @@ boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8 damagetype); // Hook for hurt messages
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer #define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
#endif #endif

View File

@ -412,7 +412,7 @@ boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher)
} }
// Hook for P_DamageMobj by mobj type (Should mobj take damage?) // Hook for P_DamageMobj by mobj type (Should mobj take damage?)
UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage) UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
{ {
hook_p hookp; hook_p hookp;
UINT8 shouldDamage = 0; // 0 = default, 1 = force yes, 2 = force no. UINT8 shouldDamage = 0; // 0 = default, 1 = force yes, 2 = force no.
@ -431,14 +431,16 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
LUA_PushUserdata(gL, inflictor, META_MOBJ); LUA_PushUserdata(gL, inflictor, META_MOBJ);
LUA_PushUserdata(gL, source, META_MOBJ); LUA_PushUserdata(gL, source, META_MOBJ);
lua_pushinteger(gL, damage); lua_pushinteger(gL, damage);
lua_pushinteger(gL, damagetype);
} }
lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX); lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -5); lua_pushvalue(gL, -6);
lua_pushvalue(gL, -5); lua_pushvalue(gL, -6);
lua_pushvalue(gL, -5); lua_pushvalue(gL, -6);
lua_pushvalue(gL, -5); lua_pushvalue(gL, -6);
if (lua_pcall(gL, 4, 1, 0)) { lua_pushvalue(gL, -6);
if (lua_pcall(gL, 5, 1, 0)) {
if (!hookp->error || cv_debug & DBG_LUA) if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1); lua_pop(gL, 1);
@ -460,7 +462,7 @@ UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
} }
// Hook for P_DamageMobj by mobj type (Mobj actually takes damage!) // Hook for P_DamageMobj by mobj type (Mobj actually takes damage!)
boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage) boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
{ {
hook_p hookp; hook_p hookp;
boolean hooked = false; boolean hooked = false;
@ -479,14 +481,16 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
LUA_PushUserdata(gL, inflictor, META_MOBJ); LUA_PushUserdata(gL, inflictor, META_MOBJ);
LUA_PushUserdata(gL, source, META_MOBJ); LUA_PushUserdata(gL, source, META_MOBJ);
lua_pushinteger(gL, damage); lua_pushinteger(gL, damage);
lua_pushinteger(gL, damagetype);
} }
lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX); lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -5); lua_pushvalue(gL, -6);
lua_pushvalue(gL, -5); lua_pushvalue(gL, -6);
lua_pushvalue(gL, -5); lua_pushvalue(gL, -6);
lua_pushvalue(gL, -5); lua_pushvalue(gL, -6);
if (lua_pcall(gL, 4, 1, 0)) { lua_pushvalue(gL, -6);
if (lua_pcall(gL, 5, 1, 0)) {
if (!hookp->error || cv_debug & DBG_LUA) if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1); lua_pop(gL, 1);
@ -503,7 +507,7 @@ boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32
} }
// Hook for P_KillMobj by mobj type // Hook for P_KillMobj by mobj type
boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source) boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype)
{ {
hook_p hookp; hook_p hookp;
boolean hooked = false; boolean hooked = false;
@ -521,13 +525,15 @@ boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source)
LUA_PushUserdata(gL, target, META_MOBJ); LUA_PushUserdata(gL, target, META_MOBJ);
LUA_PushUserdata(gL, inflictor, META_MOBJ); LUA_PushUserdata(gL, inflictor, META_MOBJ);
LUA_PushUserdata(gL, source, META_MOBJ); LUA_PushUserdata(gL, source, META_MOBJ);
lua_pushinteger(gL, damagetype);
} }
lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX); lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -4); lua_pushvalue(gL, -5);
lua_pushvalue(gL, -4); lua_pushvalue(gL, -5);
lua_pushvalue(gL, -4); lua_pushvalue(gL, -5);
if (lua_pcall(gL, 3, 1, 0)) { lua_pushvalue(gL, -5);
if (lua_pcall(gL, 4, 1, 0)) {
if (!hookp->error || cv_debug & DBG_LUA) if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1); lua_pop(gL, 1);
@ -729,7 +735,7 @@ boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg)
} }
// Hook for hurt messages // Hook for hurt messages
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source) boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8 damagetype)
{ {
hook_p hookp; hook_p hookp;
boolean hooked = false; boolean hooked = false;
@ -747,13 +753,15 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source)
LUA_PushUserdata(gL, player, META_PLAYER); LUA_PushUserdata(gL, player, META_PLAYER);
LUA_PushUserdata(gL, inflictor, META_MOBJ); LUA_PushUserdata(gL, inflictor, META_MOBJ);
LUA_PushUserdata(gL, source, META_MOBJ); LUA_PushUserdata(gL, source, META_MOBJ);
lua_pushinteger(gL, damagetype);
} }
lua_pushfstring(gL, FMT_HOOKID, hookp->id); lua_pushfstring(gL, FMT_HOOKID, hookp->id);
lua_gettable(gL, LUA_REGISTRYINDEX); lua_gettable(gL, LUA_REGISTRYINDEX);
lua_pushvalue(gL, -4); lua_pushvalue(gL, -5);
lua_pushvalue(gL, -4); lua_pushvalue(gL, -5);
lua_pushvalue(gL, -4); lua_pushvalue(gL, -5);
if (lua_pcall(gL, 3, 1, 0)) { lua_pushvalue(gL, -5);
if (lua_pcall(gL, 4, 1, 0)) {
if (!hookp->error || cv_debug & DBG_LUA) if (!hookp->error || cv_debug & DBG_LUA)
CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1));
lua_pop(gL, 1); lua_pop(gL, 1);

View File

@ -34,6 +34,7 @@ enum mobj_e {
mobj_angle, mobj_angle,
mobj_sprite, mobj_sprite,
mobj_frame, mobj_frame,
mobj_sprite2,
mobj_anim_duration, mobj_anim_duration,
mobj_touching_sectorlist, mobj_touching_sectorlist,
mobj_subsector, mobj_subsector,
@ -93,6 +94,7 @@ static const char *const mobj_opt[] = {
"angle", "angle",
"sprite", "sprite",
"frame", "frame",
"sprite2",
"anim_duration", "anim_duration",
"touching_sectorlist", "touching_sectorlist",
"subsector", "subsector",
@ -189,6 +191,9 @@ static int mobj_get(lua_State *L)
case mobj_frame: case mobj_frame:
lua_pushinteger(L, mo->frame); lua_pushinteger(L, mo->frame);
break; break;
case mobj_sprite2:
lua_pushinteger(L, mo->sprite2);
break;
case mobj_anim_duration: case mobj_anim_duration:
lua_pushinteger(L, mo->anim_duration); lua_pushinteger(L, mo->anim_duration);
break; break;
@ -411,6 +416,9 @@ static int mobj_set(lua_State *L)
case mobj_frame: case mobj_frame:
mo->frame = (UINT32)luaL_checkinteger(L, 3); mo->frame = (UINT32)luaL_checkinteger(L, 3);
break; break;
case mobj_sprite2:
mo->sprite2 = P_GetMobjSprite2(mo, (UINT8)luaL_checkinteger(L, 3));
break;
case mobj_anim_duration: case mobj_anim_duration:
mo->anim_duration = (UINT16)luaL_checkinteger(L, 3); mo->anim_duration = (UINT16)luaL_checkinteger(L, 3);
break; break;

View File

@ -122,8 +122,8 @@ static int player_get(lua_State *L)
lua_pushfixed(L, plr->bob); lua_pushfixed(L, plr->bob);
else if (fastcmp(field,"aiming")) else if (fastcmp(field,"aiming"))
lua_pushangle(L, plr->aiming); lua_pushangle(L, plr->aiming);
else if (fastcmp(field,"health")) else if (fastcmp(field,"rings"))
lua_pushinteger(L, plr->health); lua_pushinteger(L, plr->rings);
else if (fastcmp(field,"pity")) else if (fastcmp(field,"pity"))
lua_pushinteger(L, plr->pity); lua_pushinteger(L, plr->pity);
else if (fastcmp(field,"currentweapon")) else if (fastcmp(field,"currentweapon"))
@ -382,8 +382,8 @@ static int player_set(lua_State *L)
else if (plr == &players[secondarydisplayplayer]) else if (plr == &players[secondarydisplayplayer])
localaiming2 = plr->aiming; localaiming2 = plr->aiming;
} }
else if (fastcmp(field,"health")) else if (fastcmp(field,"rings"))
plr->health = (INT32)luaL_checkinteger(L, 3); plr->rings = (INT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"pity")) else if (fastcmp(field,"pity"))
plr->pity = (SINT8)luaL_checkinteger(L, 3); plr->pity = (SINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"currentweapon")) else if (fastcmp(field,"currentweapon"))

View File

@ -452,7 +452,7 @@ void Command_RTeleport_f(void)
else else
inty = 0; inty = 0;
ss = R_PointInSubsector(p->mo->x + intx*FRACUNIT, p->mo->y + inty*FRACUNIT); ss = R_IsPointInSubsector(p->mo->x + intx*FRACUNIT, p->mo->y + inty*FRACUNIT);
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height) if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
{ {
CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n")); CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n"));
@ -606,7 +606,7 @@ void Command_CauseCfail_f(void)
players[consoleplayer].mo->y = 123311; //cfail cansuled kthxbye players[consoleplayer].mo->y = 123311; //cfail cansuled kthxbye
players[consoleplayer].mo->z = 123311; players[consoleplayer].mo->z = 123311;
players[consoleplayer].score = 1337; players[consoleplayer].score = 1337;
players[consoleplayer].health = 1337; players[consoleplayer].rings = 1337;
players[consoleplayer].mo->destscale = 25; players[consoleplayer].mo->destscale = 25;
P_SetThingPosition(players[consoleplayer].mo); P_SetThingPosition(players[consoleplayer].mo);
@ -720,7 +720,7 @@ void Command_Setrings_f(void)
if (COM_Argc() > 1) if (COM_Argc() > 1)
{ {
// P_GivePlayerRings does value clamping // P_GivePlayerRings does value clamping
players[consoleplayer].health = players[consoleplayer].mo->health = 1; players[consoleplayer].rings = 0;
P_GivePlayerRings(&players[consoleplayer], atoi(COM_Argv(1))); P_GivePlayerRings(&players[consoleplayer], atoi(COM_Argv(1)));
if (!G_IsSpecialStage(gamemap) || !useNightsSS) if (!G_IsSpecialStage(gamemap) || !useNightsSS)
players[consoleplayer].totalring -= atoi(COM_Argv(1)); //undo totalring addition done in P_GivePlayerRings players[consoleplayer].totalring -= atoi(COM_Argv(1)); //undo totalring addition done in P_GivePlayerRings
@ -1165,19 +1165,20 @@ void OP_ObjectplaceMovement(player_t *player)
if (player->pflags & PF_ATTACKDOWN) if (player->pflags & PF_ATTACKDOWN)
{ {
// Are ANY objectplace buttons pressed? If no, remove flag. // Are ANY objectplace buttons pressed? If no, remove flag.
if (!(cmd->buttons & (BT_ATTACK|BT_TOSSFLAG|BT_CAMRIGHT|BT_CAMLEFT))) if (!(cmd->buttons & (BT_ATTACK|BT_TOSSFLAG|BT_WEAPONNEXT|BT_WEAPONPREV)))
player->pflags &= ~PF_ATTACKDOWN; player->pflags &= ~PF_ATTACKDOWN;
// Do nothing. // Do nothing.
return; return;
} }
if (cmd->buttons & BT_CAMLEFT) if (cmd->buttons & BT_WEAPONPREV)
{ {
OP_CycleThings(-1); OP_CycleThings(-1);
player->pflags |= PF_ATTACKDOWN; player->pflags |= PF_ATTACKDOWN;
} }
else if (cmd->buttons & BT_CAMRIGHT)
if (cmd->buttons & BT_WEAPONNEXT)
{ {
OP_CycleThings(1); OP_CycleThings(1);
player->pflags |= PF_ATTACKDOWN; player->pflags |= PF_ATTACKDOWN;
@ -1264,10 +1265,10 @@ void Command_ObjectPlace_f(void)
HU_DoCEcho(va(M_GetText( HU_DoCEcho(va(M_GetText(
"\\\\\\\\\\\\\\\\\\\\\\\\\x82" "\\\\\\\\\\\\\\\\\\\\\\\\\x82"
" Objectplace Controls: \x80\\\\" " Objectplace Controls: \x80\\\\"
"Camera L/R: Cycle mapthings\\" "Weapon Next/Prev: Cycle mapthings\\"
" Jump: Float up \\" " Jump: Float up \\"
" Spin: Float down \\" " Spin: Float down \\"
" Fire Ring: Place object \\"))); " Fire Ring: Place object \\")));
} }
// Save all the player's data. // Save all the player's data.
@ -1297,7 +1298,7 @@ void Command_ObjectPlace_f(void)
// Like the classics, recover from death by entering objectplace // Like the classics, recover from death by entering objectplace
if (players[0].mo->health <= 0) if (players[0].mo->health <= 0)
{ {
players[0].mo->health = players[0].health = 1; players[0].mo->health = 1;
players[0].deadtimer = 0; players[0].deadtimer = 0;
op_oldflags1 = mobjinfo[MT_PLAYER].flags; op_oldflags1 = mobjinfo[MT_PLAYER].flags;
++players[0].lives; ++players[0].lives;

View File

@ -565,7 +565,7 @@ extraemblem_t extraemblems[MAXEXTRAEMBLEMS] =
{"Game Complete", "Complete 1P Mode", 10, 'X', SKINCOLOR_BLUE, 0}, {"Game Complete", "Complete 1P Mode", 10, 'X', SKINCOLOR_BLUE, 0},
{"All Emeralds", "Complete 1P Mode with all Emeralds", 11, 'V', SKINCOLOR_GREY, 0}, {"All Emeralds", "Complete 1P Mode with all Emeralds", 11, 'V', SKINCOLOR_GREY, 0},
{"Perfect Bonus", "Perfect Bonus on a non-secret stage", 30, 'P', SKINCOLOR_GOLD, 0}, {"Perfect Bonus", "Perfect Bonus on a non-secret stage", 30, 'P', SKINCOLOR_GOLD, 0},
{"SRB1 Remake", "Complete SRB1 Remake", 21, 'O', SKINCOLOR_RUST, 0}, {"PLACEHOLDER", "PLACEHOLDER", 0, 'O', SKINCOLOR_RUST, 0},
{"NiGHTS Mastery", "Show your mastery of NiGHTS!", 22, 'W', SKINCOLOR_TEAL, 0}, {"NiGHTS Mastery", "Show your mastery of NiGHTS!", 22, 'W', SKINCOLOR_TEAL, 0},
}; };
@ -586,9 +586,9 @@ unlockable_t unlockables[MAXUNLOCKABLES] =
/* 08 */ {"BONUS LEVELS", "", 100, 0, SECRET_HEADER, 0, true, true, 0}, /* 08 */ {"BONUS LEVELS", "", 100, 0, SECRET_HEADER, 0, true, true, 0},
/* 09 */ {"SRB1 Remake", "Collect 20 Emblems", 130, 40, SECRET_WARP, 101, false, false, 0}, /* 09 */ {"PLACEHOLDER", "PLACEHOLDER", 0, 0, SECRET_NONE, 0, true, true, 0},
/* 10 */ {"Mario Koopa Blast", "Collect 60 Emblems", 110, 42, SECRET_WARP, 30, false, false, 0}, /* 10 */ {"Mario Koopa Blast", "Collect 60 Emblems", 110, 42, SECRET_WARP, 30, false, false, 0},
/* 11 */ {"SRB1 Level Select", "Complete SRB1 Remake", 140, 21, SECRET_LEVELSELECT, 2, false, true, 0}, /* 11 */ {"PLACEHOLDER", "PLACEHOLDER", 0, 0, SECRET_NONE, 0, true, true, 0},
/* 12 */ {"Spring Hill Zone", "Collect 100 Emblems", 0, 44, SECRET_NONE, 0, false, false, 0}, /* 12 */ {"Spring Hill Zone", "Collect 100 Emblems", 0, 44, SECRET_NONE, 0, false, false, 0},
/* 13 */ {"Black Hole", "A Rank in all Special Stages", 0, 50, SECRET_NONE, 0, false, true, 0}, /* 13 */ {"Black Hole", "A Rank in all Special Stages", 0, 50, SECRET_NONE, 0, false, true, 0},
@ -624,9 +624,6 @@ void M_SetupDefaultConditionSets(void)
// -- 20: Beat AGZ // -- 20: Beat AGZ
M_AddRawCondition(20, 1, UC_MAPBEATEN, 40, 0, 0); M_AddRawCondition(20, 1, UC_MAPBEATEN, 40, 0, 0);
// -- 21: Beat SRB1 Remake
M_AddRawCondition(21, 1, UC_MAPBEATEN, 132, 0, 0);
// -- 22: Beat Black Hole // -- 22: Beat Black Hole
M_AddRawCondition(22, 1, UC_MAPBEATEN, 57, 0, 0); M_AddRawCondition(22, 1, UC_MAPBEATEN, 57, 0, 0);

View File

@ -183,9 +183,6 @@ static INT32 vidm_selected = 0;
static INT32 vidm_nummodes; static INT32 vidm_nummodes;
static INT32 vidm_column_size; static INT32 vidm_column_size;
// what a headache.
static boolean shiftdown = false;
// //
// PROTOTYPES // PROTOTYPES
// //
@ -2083,11 +2080,6 @@ boolean M_Responder(event_t *ev)
|| gamestate == GS_CREDITS || gamestate == GS_EVALUATION) || gamestate == GS_CREDITS || gamestate == GS_EVALUATION)
return false; return false;
if (ev->type == ev_keyup && (ev->data1 == KEY_LSHIFT || ev->data1 == KEY_RSHIFT))
{
shiftdown = false;
return false;
}
if (noFurtherInput) if (noFurtherInput)
{ {
// Ignore input after enter/escape/other buttons // Ignore input after enter/escape/other buttons
@ -2101,10 +2093,6 @@ boolean M_Responder(event_t *ev)
// added 5-2-98 remap virtual keys (mouse & joystick buttons) // added 5-2-98 remap virtual keys (mouse & joystick buttons)
switch (ch) switch (ch)
{ {
case KEY_LSHIFT:
case KEY_RSHIFT:
shiftdown = true;
break; //return false;
case KEY_MOUSE1: case KEY_MOUSE1:
case KEY_JOY1: case KEY_JOY1:
case KEY_JOY1 + 2: case KEY_JOY1 + 2:
@ -3831,7 +3819,7 @@ static void M_HandleImageDef(INT32 choice)
static void M_PandorasBox(INT32 choice) static void M_PandorasBox(INT32 choice)
{ {
(void)choice; (void)choice;
CV_StealthSetValue(&cv_dummyrings, max(players[consoleplayer].health - 1, 0)); CV_StealthSetValue(&cv_dummyrings, max(players[consoleplayer].rings, 0));
CV_StealthSetValue(&cv_dummylives, players[consoleplayer].lives); CV_StealthSetValue(&cv_dummylives, players[consoleplayer].lives);
CV_StealthSetValue(&cv_dummycontinues, players[consoleplayer].continues); CV_StealthSetValue(&cv_dummycontinues, players[consoleplayer].continues);
M_SetupNextMenu(&SR_PandoraDef); M_SetupNextMenu(&SR_PandoraDef);
@ -3839,7 +3827,7 @@ static void M_PandorasBox(INT32 choice)
static boolean M_ExitPandorasBox(void) static boolean M_ExitPandorasBox(void)
{ {
if (cv_dummyrings.value != max(players[consoleplayer].health - 1, 0)) if (cv_dummyrings.value != max(players[consoleplayer].rings, 0))
COM_ImmedExecute(va("setrings %d", cv_dummyrings.value)); COM_ImmedExecute(va("setrings %d", cv_dummyrings.value));
if (cv_dummylives.value != players[consoleplayer].lives) if (cv_dummylives.value != players[consoleplayer].lives)
COM_ImmedExecute(va("setlives %d", cv_dummylives.value)); COM_ImmedExecute(va("setlives %d", cv_dummylives.value));
@ -4836,7 +4824,7 @@ static void M_SetupChoosePlayer(INT32 choice)
if (Playing() == false) if (Playing() == false)
{ {
S_StopMusic(); S_StopMusic();
S_ChangeMusicInternal("chrsel", true); S_ChangeMusicInternal("_chsel", true);
} }
SP_PlayerDef.prevMenu = currentMenu; SP_PlayerDef.prevMenu = currentMenu;
@ -5271,7 +5259,7 @@ void M_DrawTimeAttackMenu(void)
lumpnum_t lumpnum; lumpnum_t lumpnum;
char beststr[40]; char beststr[40];
S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback S_ChangeMusicInternal("_inter", true); // Eww, but needed for when user hits escape during demo playback
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE)); V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
@ -5434,7 +5422,7 @@ static void M_TimeAttack(INT32 choice)
itemOn = tastart; // "Start" is selected. itemOn = tastart; // "Start" is selected.
G_SetGamestate(GS_TIMEATTACK); G_SetGamestate(GS_TIMEATTACK);
S_ChangeMusicInternal("racent", true); S_ChangeMusicInternal("_inter", true);
} }
// Drawing function for Nights Attack // Drawing function for Nights Attack
@ -5444,7 +5432,7 @@ void M_DrawNightsAttackMenu(void)
lumpnum_t lumpnum; lumpnum_t lumpnum;
char beststr[40]; char beststr[40];
S_ChangeMusicInternal("racent", true); // Eww, but needed for when user hits escape during demo playback S_ChangeMusicInternal("_inter", true); // Eww, but needed for when user hits escape during demo playback
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE)); V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
@ -5567,7 +5555,7 @@ static void M_NightsAttack(INT32 choice)
itemOn = nastart; // "Start" is selected. itemOn = nastart; // "Start" is selected.
G_SetGamestate(GS_TIMEATTACK); G_SetGamestate(GS_TIMEATTACK);
S_ChangeMusicInternal("racent", true); S_ChangeMusicInternal("_inter", true);
} }
// Player has selected the "START" from the nights attack screen // Player has selected the "START" from the nights attack screen
@ -5801,7 +5789,7 @@ static void M_ModeAttackEndGame(INT32 choice)
itemOn = currentMenu->lastOn; itemOn = currentMenu->lastOn;
G_SetGamestate(GS_TIMEATTACK); G_SetGamestate(GS_TIMEATTACK);
modeattacking = ATTACKING_NONE; modeattacking = ATTACKING_NONE;
S_ChangeMusicInternal("racent", true); S_ChangeMusicInternal("_inter", true);
// Update replay availability. // Update replay availability.
CV_AddValue(&cv_nextmap, 1); CV_AddValue(&cv_nextmap, 1);
CV_AddValue(&cv_nextmap, -1); CV_AddValue(&cv_nextmap, -1);
@ -7016,7 +7004,7 @@ static void M_ToggleDigital(void)
if (nodigimusic) return; if (nodigimusic) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value);
S_StopMusic(); S_StopMusic();
S_ChangeMusicInternal("lclear", false); S_ChangeMusicInternal("_clear", false);
M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING); M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING);
} }
else else
@ -7043,7 +7031,7 @@ static void M_ToggleMIDI(void)
I_InitMIDIMusic(); I_InitMIDIMusic();
if (nomidimusic) return; if (nomidimusic) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value);
S_ChangeMusicInternal("lclear", false); S_ChangeMusicInternal("_clear", false);
M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING); M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING);
} }
else else

View File

@ -269,6 +269,18 @@ INT32 I_PutEnv(char *variable)
return -1; return -1;
} }
INT32 I_ClipboardCopy(const char *data, size_t size)
{
(void)data;
(void)size;
return -1;
}
char *I_ClipboardPaste(void)
{
return NULL;
}
void I_RegisterSysCommands(void) {} void I_RegisterSysCommands(void) {}
#include "../sdl/dosstr.c" #include "../sdl/dosstr.c"

View File

@ -658,15 +658,15 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed
if ((netgame || multiplayer) && player->spectator) if ((netgame || multiplayer) && player->spectator)
continue; continue;
if (player->health <= 0)
continue; // dead
if (player->pflags & PF_INVIS) if (player->pflags & PF_INVIS)
continue; // ignore notarget continue; // ignore notarget
if (!player->mo || P_MobjWasRemoved(player->mo)) if (!player->mo || P_MobjWasRemoved(player->mo))
continue; continue;
if (player->mo->health <= 0)
continue; // dead
if (dist > 0 if (dist > 0
&& P_AproxDistance(P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y), player->mo->z - actor->z) > dist) && P_AproxDistance(P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y), player->mo->z - actor->z) > dist)
continue; // Too far away continue; // Too far away
@ -730,7 +730,7 @@ static boolean P_LookForShield(mobj_t *actor)
player = &players[actor->lastlook]; player = &players[actor->lastlook];
if (player->health <= 0 || !player->mo) if (!player->mo || player->mo->health <= 0)
continue; // dead continue; // dead
//When in CTF, don't pull rings that you cannot pick up. //When in CTF, don't pull rings that you cannot pick up.
@ -2553,6 +2553,7 @@ void A_1upThinker(mobj_t *actor)
{ {
P_SetTarget(&actor->tracer, P_SpawnMobj(actor->x, actor->y, actor->z, MT_OVERLAY)); P_SetTarget(&actor->tracer, P_SpawnMobj(actor->x, actor->y, actor->z, MT_OVERLAY));
P_SetTarget(&actor->tracer->target, actor); P_SetTarget(&actor->tracer->target, actor);
actor->tracer->skin = &skins[players[closestplayer].skin]; // required here to prevent spr2 default showing stand for a single frame
P_SetMobjState(actor->tracer, actor->info->seestate); P_SetMobjState(actor->tracer, actor->info->seestate);
// The overlay is going to be one tic early turning off and on // The overlay is going to be one tic early turning off and on
@ -2813,7 +2814,7 @@ void A_BossDeath(mobj_t *mo)
// make sure there is a player alive for victory // make sure there is a player alive for victory
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && (players[i].health > 0 if (playeringame[i] && ((players[i].mo && players[i].mo->health > 0)
|| ((netgame || multiplayer) && (players[i].lives > 0 || players[i].continues > 0)))) || ((netgame || multiplayer) && (players[i].lives > 0 || players[i].continues > 0))))
break; break;
@ -3156,7 +3157,7 @@ void A_Invincibility(mobj_t *actor)
S_StopMusic(); S_StopMusic();
if (mariomode) if (mariomode)
G_GhostAddColor(GHC_INVINCIBLE); G_GhostAddColor(GHC_INVINCIBLE);
S_ChangeMusicInternal((mariomode) ? "minvnc" : "invinc", false); S_ChangeMusicInternal((mariomode) ? "_minv" : "_inv", false);
} }
} }
@ -3192,7 +3193,7 @@ void A_SuperSneakers(mobj_t *actor)
else else
{ {
S_StopMusic(); S_StopMusic();
S_ChangeMusicInternal("shoes", false); S_ChangeMusicInternal("_shoes", false);
} }
} }
} }
@ -8379,7 +8380,7 @@ void A_RingDrain(mobj_t *actor)
} }
player = actor->target->player; player = actor->target->player;
P_GivePlayerRings(player, -min(locvar1, player->mo->health-1)); P_GivePlayerRings(player, -min(locvar1, player->rings));
} }
// Function: A_SplitShot // Function: A_SplitShot
@ -8687,7 +8688,7 @@ void A_CheckTargetRings(mobj_t *actor)
if (!(actor->target) || !(actor->target->player)) if (!(actor->target) || !(actor->target->player))
return; return;
if (actor->target->player->health >= locvar1) if (actor->target->player->rings >= locvar1)
P_SetMobjState(actor, locvar2); P_SetMobjState(actor, locvar2);
} }
@ -8709,7 +8710,7 @@ void A_CheckRings(mobj_t *actor)
#endif #endif
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
cntr += players[i].health-1; cntr += players[i].rings;
if (cntr >= locvar1) if (cntr >= locvar1)
P_SetMobjState(actor, locvar2); P_SetMobjState(actor, locvar2);
@ -9281,7 +9282,7 @@ void A_ForceWin(mobj_t *actor)
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
if (playeringame[i] && (players[i].health > 0 if (playeringame[i] && ((players[i].mo && players[i].mo->health > 0)
|| ((netgame || multiplayer) && (players[i].lives > 0 || players[i].continues > 0)))) || ((netgame || multiplayer) && (players[i].lives > 0 || players[i].continues > 0))))
break; break;
} }

View File

@ -221,6 +221,65 @@ void P_DoNightsScore(player_t *player)
dummymo->destscale = 2*FRACUNIT; dummymo->destscale = 2*FRACUNIT;
} }
//
// P_DoMatchSuper
//
// Checks if you have all 7 pw_emeralds, then turns you "super". =P
//
void P_DoMatchSuper(player_t *player)
{
UINT16 match_emeralds = player->powers[pw_emeralds];
boolean doteams = false;
int i;
// If this gametype has teams, check every player on your team for emeralds.
if (G_GametypeHasTeams())
{
doteams = true;
for (i = 0; i < MAXPLAYERS; i++)
if (players[i].ctfteam == player->ctfteam)
match_emeralds |= players[i].powers[pw_emeralds];
}
if (!ALL7EMERALDS(match_emeralds))
return;
// Got 'em all? Turn "super"!
emeraldspawndelay = invulntics + 1;
player->powers[pw_emeralds] = 0;
player->powers[pw_invulnerability] = emeraldspawndelay;
player->powers[pw_sneakers] = emeraldspawndelay;
if (P_IsLocalPlayer(player) && !player->powers[pw_super])
{
S_StopMusic();
if (mariomode)
G_GhostAddColor(GHC_INVINCIBLE);
S_ChangeMusicInternal((mariomode) ? "_minv" : "_inv", false);
}
// Also steal 50 points from every enemy, sealing your victory.
P_StealPlayerScore(player, 50);
// In a team game?
// Check everyone else on your team for emeralds, and turn those helpful assisting players invincible too.
if (doteams)
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].ctfteam == player->ctfteam
&& players[i].powers[pw_emeralds] != 0)
{
players[i].powers[pw_emeralds] = 0;
player->powers[pw_invulnerability] = invulntics + 1;
player->powers[pw_sneakers] = player->powers[pw_invulnerability];
if (P_IsLocalPlayer(player) && !player->powers[pw_super])
{
S_StopMusic();
if (mariomode)
G_GhostAddColor(GHC_INVINCIBLE);
S_ChangeMusicInternal((mariomode) ? "_minv" : "_inv", false);
}
}
}
/** Takes action based on a ::MF_SPECIAL thing touched by a player. /** Takes action based on a ::MF_SPECIAL thing touched by a player.
* Actually, this just checks a few things (heights, toucher->player, no * Actually, this just checks a few things (heights, toucher->player, no
* objectplace, no dead or disappearing things) * objectplace, no dead or disappearing things)
@ -445,7 +504,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
{ {
INT32 pindex = special->info->mass - (INT32)pw_infinityring; INT32 pindex = special->info->mass - (INT32)pw_infinityring;
player->powers[special->info->mass] += (UINT16)special->info->reactiontime; player->powers[special->info->mass] += (UINT16)special->reactiontime;
player->ringweapons |= 1 << (pindex-1); player->ringweapons |= 1 << (pindex-1);
if (player->powers[special->info->mass] > rw_maximums[pindex]) if (player->powers[special->info->mass] > rw_maximums[pindex])
@ -532,7 +591,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
return; return;
if (special->threshold) if (special->threshold)
{
player->powers[pw_emeralds] |= special->info->speed; player->powers[pw_emeralds] |= special->info->speed;
P_DoMatchSuper(player);
}
else else
emeralds |= special->info->speed; emeralds |= special->info->speed;
@ -553,6 +615,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
return; return;
player->powers[pw_emeralds] |= special->threshold; player->powers[pw_emeralds] |= special->threshold;
P_DoMatchSuper(player);
break; break;
// Secret emblem thingy // Secret emblem thingy
@ -814,16 +877,14 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (G_IsSpecialStage(gamemap) && !player->exiting) if (G_IsSpecialStage(gamemap) && !player->exiting)
{ // In special stages, share rings. Everyone gives up theirs to the player who touched the capsule { // In special stages, share rings. Everyone gives up theirs to the player who touched the capsule
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && (&players[i] != player) && players[i].mo->health > 1) if (playeringame[i] && (&players[i] != player) && players[i].rings > 0)
{ {
toucher->health += players[i].mo->health-1; player->rings += players[i].rings;
player->health = toucher->health; players[i].rings = 0;
players[i].mo->health = 1;
players[i].health = players[i].mo->health;
} }
} }
if (!(player->health > 1) || player->exiting) if (player->rings <= 0 || player->exiting)
return; return;
// Mark the player as 'pull into the capsule' // Mark the player as 'pull into the capsule'
@ -1380,7 +1441,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
} }
if (player->powers[pw_invulnerability] || player->powers[pw_flashing] if (player->powers[pw_invulnerability] || player->powers[pw_flashing]
|| (player->powers[pw_super] && !(ALL7EMERALDS(player->powers[pw_emeralds])))) || player->powers[pw_super])
return; return;
if (player->powers[pw_shield] || player->bot) //If One-Hit Shield if (player->powers[pw_shield] || player->bot) //If One-Hit Shield
{ {
@ -1390,11 +1451,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
else else
{ {
P_PlayRinglossSound(toucher); P_PlayRinglossSound(toucher);
if (toucher->health > 10) if (player->rings >= 10)
toucher->health -= 10; player->rings -= 10;
else else
toucher->health = 1; player->rings = 0;
player->health = toucher->health;
} }
P_DoPlayerPain(player, special, NULL); P_DoPlayerPain(player, special, NULL);
@ -1496,6 +1556,9 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
if (!player) if (!player)
return; // Impossible! return; // Impossible!
if (!player->mo)
return; // Also impossible!
if (player->spectator) if (player->spectator)
return; // No messages for dying (crushed) spectators. return; // No messages for dying (crushed) spectators.
@ -1503,11 +1566,11 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
return; // Presumably it's obvious what's happening in splitscreen. return; // Presumably it's obvious what's happening in splitscreen.
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
if (LUAh_HurtMsg(player, inflictor, source)) if (LUAh_HurtMsg(player, inflictor, source, damagetype))
return; return;
#endif #endif
deadtarget = (player->health <= 0); deadtarget = (player->mo->health <= 0);
// Target's name // Target's name
snprintf(targetname, sizeof(targetname), "%s%s%s", snprintf(targetname, sizeof(targetname), "%s%s%s",
@ -1541,7 +1604,7 @@ static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *sour
else switch (inflictor->type) else switch (inflictor->type)
{ {
case MT_PLAYER: case MT_PLAYER:
if ((inflictor->player->powers[pw_shield] & SH_NOSTACK) == SH_BOMB) if (damagetype == DMG_NUKE) // SH_BOMB, armageddon shield
str = M_GetText("%s%s's armageddon blast %s %s.\n"); str = M_GetText("%s%s's armageddon blast %s %s.\n");
else if (inflictor->player->powers[pw_invulnerability]) else if (inflictor->player->powers[pw_invulnerability])
str = M_GetText("%s%s's invincibility aura %s %s.\n"); str = M_GetText("%s%s's invincibility aura %s %s.\n");
@ -1974,7 +2037,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
target->health = 0; // This makes it easy to check if something's dead elsewhere. target->health = 0; // This makes it easy to check if something's dead elsewhere.
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
if (LUAh_MobjDeath(target, inflictor, source) || P_MobjWasRemoved(target)) if (LUAh_MobjDeath(target, inflictor, source, damagetype) || P_MobjWasRemoved(target))
return; return;
#endif #endif
@ -2104,7 +2167,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
if (P_IsLocalPlayer(target->player)/* && target->player == &players[consoleplayer] */) if (P_IsLocalPlayer(target->player)/* && target->player == &players[consoleplayer] */)
{ {
S_StopMusic(); // Stop the Music! Tails 03-14-2000 S_StopMusic(); // Stop the Music! Tails 03-14-2000
S_ChangeMusicInternal("gmover", false); // Yousa dead now, Okieday? Tails 03-14-2000 S_ChangeMusicInternal("_gover", false); // Yousa dead now, Okieday? Tails 03-14-2000
} }
} }
} }
@ -2442,8 +2505,7 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
player_t *player = target->player; player_t *player = target->player;
tic_t oldnightstime = player->nightstime; tic_t oldnightstime = player->nightstime;
if (!player->powers[pw_flashing] if (!player->powers[pw_flashing])
&& !(player->pflags & PF_GODMODE))
{ {
angle_t fa; angle_t fa;
@ -2493,7 +2555,7 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source)
&& player->nightstime < 10*TICRATE) && player->nightstime < 10*TICRATE)
{ {
//S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH //S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH
S_ChangeMusicInternal("drown",false); S_ChangeMusicInternal("_drown",false);
} }
} }
} }
@ -2558,27 +2620,18 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou
return true; return true;
} }
if (target->health <= 1) // Death if (player->rings > 0) // Ring loss
{
P_PlayRinglossSound(target);
P_PlayerRingBurst(player, player->rings);
}
else // Death
{ {
P_PlayDeathSound(target); P_PlayDeathSound(target);
P_PlayVictorySound(source); // Killer laughs at you! LAUGHS! BWAHAHAHHAHAA!! P_PlayVictorySound(source); // Killer laughs at you! LAUGHS! BWAHAHAHHAHAA!!
} }
else if (target->health > 1) // Ring loss
{
P_PlayRinglossSound(target);
P_PlayerRingBurst(player, player->mo->health - 1);
}
if (inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player) && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))
{
player->health -= 10;
if (player->health < 2)
player->health = 2;
target->health = player->health;
}
else
player->health = target->health = 1;
player->rings = 0;
return true; return true;
} }
@ -2629,7 +2682,7 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage)
// Burst weapons and emeralds in Match/CTF only // Burst weapons and emeralds in Match/CTF only
if (source && (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF)) if (source && (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF))
{ {
P_PlayerRingBurst(player, player->health - 1); P_PlayerRingBurst(player, player->rings);
P_PlayerEmeraldBurst(player, false); P_PlayerEmeraldBurst(player, false);
} }
@ -2757,7 +2810,7 @@ void P_RemoveShield(player_t *player)
player->powers[pw_shield] = player->powers[pw_shield] & SH_STACK; player->powers[pw_shield] = player->powers[pw_shield] & SH_STACK;
} }
static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage) static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
{ {
// Must do pain first to set flashing -- P_RemoveShield can cause damage // Must do pain first to set flashing -- P_RemoveShield can cause damage
P_DoPlayerPain(player, source, inflictor); P_DoPlayerPain(player, source, inflictor);
@ -2766,7 +2819,7 @@ static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source,
P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2); P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2);
if (source && (source->type == MT_SPIKE || (source->type == MT_NULL && source->threshold == 43))) // spikes if ((source && source->type == MT_SPIKE) || damagetype == DMG_SPIKE) // spikes
S_StartSound(player->mo, sfx_spkdth); S_StartSound(player->mo, sfx_spkdth);
else else
S_StartSound (player->mo, sfx_shldls); // Ba-Dum! Shield loss. S_StartSound (player->mo, sfx_shldls); // Ba-Dum! Shield loss.
@ -2791,15 +2844,12 @@ static void P_ShieldDamage(player_t *player, mobj_t *inflictor, mobj_t *source,
static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype) static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
{ {
if (!(inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player) && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))) P_DoPlayerPain(player, source, inflictor);
{
P_DoPlayerPain(player, source, inflictor);
P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2); P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2);
if ((source && source->type == MT_SPIKE) || damagetype == DMG_SPIKE) // spikes if ((source && source->type == MT_SPIKE) || damagetype == DMG_SPIKE) // spikes
S_StartSound(player->mo, sfx_spkdth); S_StartSound(player->mo, sfx_spkdth);
}
if (source && source->player && !player->powers[pw_super]) //don't score points against super players if (source && source->player && !player->powers[pw_super]) //don't score points against super players
{ {
@ -2821,6 +2871,10 @@ static void P_RingDamage(player_t *player, mobj_t *inflictor, mobj_t *source, IN
// Ring loss sound plays despite hitting spikes // Ring loss sound plays despite hitting spikes
P_PlayRinglossSound(player->mo); // Ringledingle! P_PlayRinglossSound(player->mo); // Ringledingle!
P_PlayerRingBurst(player, damage);
player->rings -= damage;
if (player->rings < 0)
player->rings = 0;
} }
/** Damages an object, which may or may not be a player. /** Damages an object, which may or may not be a player.
@ -2869,7 +2923,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
// Everything above here can't be forced. // Everything above here can't be forced.
if (!metalrecording) if (!metalrecording)
{ {
UINT8 shouldForce = LUAh_ShouldDamage(target, inflictor, source, damage); UINT8 shouldForce = LUAh_ShouldDamage(target, inflictor, source, damage, damagetype);
if (P_MobjWasRemoved(target)) if (P_MobjWasRemoved(target))
return (shouldForce == 1); // mobj was removed return (shouldForce == 1); // mobj was removed
if (shouldForce == 1) if (shouldForce == 1)
@ -2912,7 +2966,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return false; return false;
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target)) if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype) || P_MobjWasRemoved(target))
return true; return true;
#endif #endif
@ -2940,7 +2994,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return false; return false;
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target)) if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype) || P_MobjWasRemoved(target))
return true; return true;
#endif #endif
@ -2950,7 +3004,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
else if (target->flags & MF_ENEMY) else if (target->flags & MF_ENEMY)
{ {
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target)) if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype) || P_MobjWasRemoved(target))
return true; return true;
} }
#endif #endif
@ -2964,6 +3018,9 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (player->exiting) if (player->exiting)
return false; return false;
if (player->pflags & PF_GODMODE)
return false;
if (!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS)) if (!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS))
return false; return false;
@ -2991,11 +3048,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return false; // Don't hit yourself with your own paraloop, baka return false; // Don't hit yourself with your own paraloop, baka
if (source && source->player && !cv_friendlyfire.value if (source && source->player && !cv_friendlyfire.value
&& (gametype == GT_COOP && (gametype == GT_COOP
|| (G_GametypeHasTeams() && target->player->ctfteam == source->player->ctfteam))) || (G_GametypeHasTeams() && player->ctfteam == source->player->ctfteam)))
return false; // Don't run eachother over in special stages and team games and such return false; // Don't run eachother over in special stages and team games and such
} }
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
if (LUAh_MobjDamage(target, inflictor, source, damage)) if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
return true; return true;
#endif #endif
P_NiGHTSDamage(target, source); // -5s :( P_NiGHTSDamage(target, source); // -5s :(
@ -3026,12 +3083,12 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return false; return false;
} }
if (!force && player->pflags & PF_GODMODE)
return false;
// Instant-Death // Instant-Death
if (damagetype & DMG_DEATHMASK) if (damagetype & DMG_DEATHMASK)
{
P_KillPlayer(player, source, damage); P_KillPlayer(player, source, damage);
player->rings = 0;
}
else if (metalrecording) else if (metalrecording)
{ {
if (!inflictor) if (!inflictor)
@ -3045,19 +3102,19 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return false; // Metal Sonic walk through flame !! return false; // Metal Sonic walk through flame !!
else else
{ // Oh no! Metal Sonic is hit !! { // Oh no! Metal Sonic is hit !!
P_ShieldDamage(player, inflictor, source, damage); P_ShieldDamage(player, inflictor, source, damage, damagetype);
return true; return true;
} }
} }
else if (player->powers[pw_invulnerability] || player->powers[pw_flashing] // ignore bouncing & such in invulnerability else if (player->powers[pw_invulnerability] || player->powers[pw_flashing] // ignore bouncing & such in invulnerability
|| (player->powers[pw_super] && !(ALL7EMERALDS(player->powers[pw_emeralds]) && inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player)))) || player->powers[pw_super])
{ {
if (force || (inflictor && (inflictor->flags & MF_MISSILE) if (force || (inflictor && (inflictor->flags & MF_MISSILE)
&& (inflictor->flags2 & MF2_SUPERFIRE) && (inflictor->flags2 & MF2_SUPERFIRE)
&& player->powers[pw_super])) && player->powers[pw_super]))
{ {
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
if (!LUAh_MobjDamage(target, inflictor, source, damage)) if (!LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
#endif #endif
P_SuperDamage(player, inflictor, source, damage); P_SuperDamage(player, inflictor, source, damage);
return true; return true;
@ -3066,67 +3123,35 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
return false; return false;
} }
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
else if (LUAh_MobjDamage(target, inflictor, source, damage)) else if (LUAh_MobjDamage(target, inflictor, source, damage, damagetype))
return true; return true;
#endif #endif
else if (!player->powers[pw_super] && (player->powers[pw_shield] || player->bot)) //If One-Hit Shield else if (player->powers[pw_shield] || player->bot) //If One-Hit Shield
{ {
P_ShieldDamage(player, inflictor, source, damage); P_ShieldDamage(player, inflictor, source, damage, damagetype);
damage = 0; damage = 0;
} }
else if (player->mo->health > 1) // No shield but have rings. else if (player->rings > 0) // No shield but have rings.
{ {
damage = player->mo->health - 1; damage = player->rings;
P_RingDamage(player, inflictor, source, damage, damagetype); P_RingDamage(player, inflictor, source, damage, damagetype);
damage = 0;
}
// To reduce griefing potential, don't allow players to be killed
// by friendly fire. Spilling their rings and other items is enough.
else if (!force && G_GametypeHasTeams()
&& source && source->player && (source->player->ctfteam == player->ctfteam)
&& cv_friendlyfire.value)
{
damage = 0;
P_ShieldDamage(player, inflictor, source, damage, damagetype);
} }
else // No shield, no rings, no invincibility. else // No shield, no rings, no invincibility.
{ {
// To reduce griefing potential, don't allow players to be killed damage = 1;
// by friendly fire. Spilling their rings and other items is enough. P_KillPlayer(player, source, damage);
if (force || !(G_GametypeHasTeams()
&& source && source->player && (source->player->ctfteam == player->ctfteam)
&& cv_friendlyfire.value))
{
damage = 1;
P_KillPlayer(player, source, damage);
}
else
{
damage = 0;
P_ShieldDamage(player, inflictor, source, damage);
}
} }
if (inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player) && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))
{
if (player->powers[pw_shield])
{
P_RemoveShield(player);
return true;
}
else
{
player->health -= (10 * (1 << (INT32)(player->powers[pw_super] / 10500)));
if (player->health < 2)
player->health = 2;
}
if (gametype == GT_CTF && (player->gotflag & (GF_REDFLAG|GF_BLUEFLAG)))
P_PlayerFlagBurst(player, false);
}
else if (damagetype & DMG_DEATHMASK)
player->health = 0;
else
{
player->health -= damage; // mirror mobj health here
target->player->powers[pw_flashing] = flashingtics;
if (damage > 0) // don't spill emeralds/ammo/panels for shield damage
P_PlayerRingBurst(player, damage);
}
if (player->health < 0)
player->health = 0;
P_HitDeathMessages(player, inflictor, source, damagetype); P_HitDeathMessages(player, inflictor, source, damagetype);
P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2); P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2);
@ -3138,13 +3163,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
P_DamageMobj(source, target, target, 1, 0); P_DamageMobj(source, target, target, 1, 0);
// do the damage // do the damage
if (player && player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && inflictor && ((inflictor->flags & MF_MISSILE) || inflictor->player)) if (damagetype & DMG_DEATHMASK)
{
target->health -= (10 * (1 << (INT32)(player->powers[pw_super] / 10500)));
if (target->health < 2)
target->health = 2;
}
else if (damagetype & DMG_DEATHMASK)
target->health = 0; target->health = 0;
else else
target->health -= damage; target->health -= damage;
@ -3159,10 +3178,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
} }
if (player) if (player)
{ P_ResetPlayer(target->player);
if (!(player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds])))
P_ResetPlayer(target->player);
}
else else
switch (target->type) switch (target->type)
{ {
@ -3185,16 +3201,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
// if not intent on another player, // if not intent on another player,
// chase after this one // chase after this one
P_SetTarget(&target->target, source); P_SetTarget(&target->target, source);
if (target->state == &states[target->info->spawnstate] && target->info->seestate != S_NULL)
{
if (player)
{
if (!(player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds])))
P_SetPlayerMobjState(target, target->info->seestate);
}
else
P_SetMobjState(target, target->info->seestate);
}
} }
return true; return true;
@ -3220,7 +3226,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
return; return;
// If no health, don't spawn ring! // If no health, don't spawn ring!
if (player->mo->health <= 1) if (player->rings <= 0)
num_rings = 0; num_rings = 0;
if (num_rings > 32 && !(player->pflags & PF_NIGHTSFALL)) if (num_rings > 32 && !(player->pflags & PF_NIGHTSFALL))
@ -3230,11 +3236,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
P_PlayerEmeraldBurst(player, false); P_PlayerEmeraldBurst(player, false);
// Spill weapons first // Spill weapons first
if (player->ringweapons) P_PlayerWeaponPanelOrAmmoBurst(player);
P_PlayerWeaponPanelBurst(player);
// Spill the ammo
P_PlayerWeaponAmmoBurst(player);
for (i = 0; i < num_rings; i++) for (i = 0; i < num_rings; i++)
{ {
@ -3491,6 +3493,75 @@ void P_PlayerWeaponAmmoBurst(player_t *player)
} }
} }
void P_PlayerWeaponPanelOrAmmoBurst(player_t *player)
{
mobj_t *mo;
angle_t fa;
fixed_t ns;
INT32 i = 0;
fixed_t z;
#define SETUP_DROP(thingtype) \
z = player->mo->z; \
if (player->mo->eflags & MFE_VERTICALFLIP) \
z += player->mo->height - mobjinfo[thingtype].height; \
fa = ((i*FINEANGLES/16) + (player->mo->angle>>ANGLETOFINESHIFT)) & FINEMASK; \
ns = FixedMul(3*FRACUNIT, player->mo->scale); \
#define DROP_WEAPON(rwflag, pickup, ammo, power) \
if (player->ringweapons & rwflag) \
{ \
player->ringweapons &= ~rwflag; \
SETUP_DROP(pickup) \
mo = P_SpawnMobj(player->mo->x, player->mo->y, z, pickup); \
mo->reactiontime = 0; \
mo->flags2 |= MF2_DONTRESPAWN; \
mo->flags &= ~(MF_NOGRAVITY|MF_NOCLIPHEIGHT); \
P_SetTarget(&mo->target, player->mo); \
mo->fuse = 12*TICRATE; \
mo->destscale = player->mo->scale; \
P_SetScale(mo, player->mo->scale); \
mo->momx = FixedMul(FINECOSINE(fa),ns); \
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD))) \
mo->momy = FixedMul(FINESINE(fa),ns); \
P_SetObjectMomZ(mo, 4*FRACUNIT, false); \
if (i & 1) \
P_SetObjectMomZ(mo, 4*FRACUNIT, true); \
++i; \
} \
else if (player->powers[power] > 0) \
{ \
SETUP_DROP(ammo) \
mo = P_SpawnMobj(player->mo->x, player->mo->y, z, ammo); \
mo->health = player->powers[power]; \
mo->flags2 |= MF2_DONTRESPAWN; \
mo->flags &= ~(MF_NOGRAVITY|MF_NOCLIPHEIGHT); \
P_SetTarget(&mo->target, player->mo); \
mo->fuse = 12*TICRATE; \
mo->destscale = player->mo->scale; \
P_SetScale(mo, player->mo->scale); \
mo->momx = FixedMul(FINECOSINE(fa),ns); \
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD))) \
mo->momy = FixedMul(FINESINE(fa),ns); \
P_SetObjectMomZ(mo, 3*FRACUNIT, false); \
if (i & 1) \
P_SetObjectMomZ(mo, 3*FRACUNIT, true); \
player->powers[power] = 0; \
++i; \
}
DROP_WEAPON(RW_BOUNCE, MT_BOUNCEPICKUP, MT_BOUNCERING, pw_bouncering);
DROP_WEAPON(RW_RAIL, MT_RAILPICKUP, MT_RAILRING, pw_railring);
DROP_WEAPON(RW_AUTO, MT_AUTOPICKUP, MT_AUTOMATICRING, pw_automaticring);
DROP_WEAPON(RW_EXPLODE, MT_EXPLODEPICKUP, MT_EXPLOSIONRING, pw_explosionring);
DROP_WEAPON(RW_SCATTER, MT_SCATTERPICKUP, MT_SCATTERRING, pw_scatterring);
DROP_WEAPON(RW_GRENADE, MT_GRENADEPICKUP, MT_GRENADERING, pw_grenadering);
DROP_WEAPON(0, 0, MT_INFINITYRING, pw_infinityring);
#undef DROP_WEAPON
#undef SETUP_DROP
}
// //
// P_PlayerEmeraldBurst // P_PlayerEmeraldBurst
// //

View File

@ -124,6 +124,7 @@ extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate;
INT32 P_GetPlayerControlDirection(player_t *player); INT32 P_GetPlayerControlDirection(player_t *player);
void P_AddPlayerScore(player_t *player, UINT32 amount); void P_AddPlayerScore(player_t *player, UINT32 amount);
void P_StealPlayerScore(player_t *player, UINT32 amount);
void P_ResetCamera(player_t *player, camera_t *thiscam); void P_ResetCamera(player_t *player, camera_t *thiscam);
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam); boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam);
void P_SlideCameraMove(camera_t *thiscam); void P_SlideCameraMove(camera_t *thiscam);
@ -211,6 +212,7 @@ void P_PrecipitationEffects(void);
void P_RemoveMobj(mobj_t *th); void P_RemoveMobj(mobj_t *th);
boolean P_MobjWasRemoved(mobj_t *th); boolean P_MobjWasRemoved(mobj_t *th);
void P_RemoveSavegameMobj(mobj_t *th); void P_RemoveSavegameMobj(mobj_t *th);
UINT8 P_GetMobjSprite2(mobj_t *mobj, UINT8 spr2);
boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state); boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state);
boolean P_SetMobjState(mobj_t *mobj, statenum_t state); boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
void P_RunShields(void); void P_RunShields(void);
@ -380,7 +382,8 @@ typedef struct BasicFF_s
#define DMG_FIRE 2 #define DMG_FIRE 2
#define DMG_ELECTRIC 3 #define DMG_ELECTRIC 3
#define DMG_SPIKE 4 #define DMG_SPIKE 4
//#define DMG_SPECIALSTAGE 5 #define DMG_NUKE 5 // bomb shield
//#define DMG_SPECIALSTAGE 6
//// Death types - cannot be combined with damage types //// Death types - cannot be combined with damage types
#define DMG_INSTAKILL 0x80 #define DMG_INSTAKILL 0x80
#define DMG_DROWNED 0x80+1 #define DMG_DROWNED 0x80+1
@ -399,6 +402,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
void P_PlayerRingBurst(player_t *player, INT32 num_rings); /// \todo better fit in p_user.c void P_PlayerRingBurst(player_t *player, INT32 num_rings); /// \todo better fit in p_user.c
void P_PlayerWeaponPanelBurst(player_t *player); void P_PlayerWeaponPanelBurst(player_t *player);
void P_PlayerWeaponAmmoBurst(player_t *player); void P_PlayerWeaponAmmoBurst(player_t *player);
void P_PlayerWeaponPanelOrAmmoBurst(player_t *player);
void P_PlayerEmeraldBurst(player_t *player, boolean toss); void P_PlayerEmeraldBurst(player_t *player, boolean toss);
void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck); void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck);
@ -413,6 +417,7 @@ void P_ResetStarposts(void);
boolean P_CanPickupItem(player_t *player, boolean weapon); boolean P_CanPickupItem(player_t *player, boolean weapon);
void P_DoNightsScore(player_t *player); void P_DoNightsScore(player_t *player);
void P_DoMatchSuper(player_t *player);
// //
// P_SPEC // P_SPEC

View File

@ -1115,18 +1115,24 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true; return true;
} }
topz = thing->z - FixedMul(FRACUNIT, thing->scale); topz = thing->z - thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways
// block only when jumping not high enough, // block only when jumping not high enough,
// (dont climb max. 24units while already in air) // (dont climb max. 24units while already in air)
// if not in air, let P_TryMove() decide if it's not too high // since return false doesn't handle momentum properly,
// we lie to P_TryMove() so it's always too high
if (tmthing->player && tmthing->z + tmthing->height > topz if (tmthing->player && tmthing->z + tmthing->height > topz
&& tmthing->z + tmthing->height < tmthing->ceilingz) && tmthing->z + tmthing->height < tmthing->ceilingz)
return false; // block while in air {
tmfloorz = tmceilingz = INT32_MIN; // block while in air
if (thing->flags & MF_SPRING) #ifdef ESLOPE
tmceilingslope = NULL;
#endif
tmfloorthing = thing; // needed for side collision
}
else if (thing->flags & MF_SPRING)
; ;
else if (topz < tmceilingz && tmthing->z+tmthing->height <= thing->z+thing->height) else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height)
{ {
tmceilingz = topz; tmceilingz = topz;
#ifdef ESLOPE #ifdef ESLOPE
@ -1152,17 +1158,24 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true; return true;
} }
topz = thing->z + thing->height + FixedMul(FRACUNIT, thing->scale); topz = thing->z + thing->height + thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways
// block only when jumping not high enough, // block only when jumping not high enough,
// (dont climb max. 24units while already in air) // (dont climb max. 24units while already in air)
// if not in air, let P_TryMove() decide if it's not too high // since return false doesn't handle momentum properly,
if (tmthing->player && tmthing->z < topz && tmthing->z > tmthing->floorz) // we lie to P_TryMove() so it's always too high
return false; // block while in air if (tmthing->player && tmthing->z < topz
&& tmthing->z > tmthing->floorz)
if (thing->flags & MF_SPRING) {
tmfloorz = tmceilingz = INT32_MAX; // block while in air
#ifdef ESLOPE
tmfloorslope = NULL;
#endif
tmfloorthing = thing; // needed for side collision
}
else if (thing->flags & MF_SPRING)
; ;
else if (topz > tmfloorz && tmthing->z >= thing->z) else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z)
{ {
tmfloorz = topz; tmfloorz = topz;
#ifdef ESLOPE #ifdef ESLOPE

View File

@ -86,9 +86,14 @@ void P_AddCachedAction(mobj_t *mobj, INT32 statenum)
// //
FUNCINLINE static ATTRINLINE void P_SetupStateAnimation(mobj_t *mobj, state_t *st) FUNCINLINE static ATTRINLINE void P_SetupStateAnimation(mobj_t *mobj, state_t *st)
{ {
INT32 animlength = (mobj->skin && mobj->sprite == SPR_PLAY)
? (INT32)(((skin_t *)mobj->skin)->sprites[mobj->sprite2].numframes) - 1
: st->var1;
if (!(st->frame & FF_ANIMATE)) if (!(st->frame & FF_ANIMATE))
return; return;
if (st->var1 == 0 || st->var2 == 0)
if (animlength <= 0 || st->var2 == 0)
{ {
mobj->frame &= ~FF_ANIMATE; mobj->frame &= ~FF_ANIMATE;
return; // Crash/stupidity prevention return; // Crash/stupidity prevention
@ -102,11 +107,11 @@ FUNCINLINE static ATTRINLINE void P_SetupStateAnimation(mobj_t *mobj, state_t *s
if (!leveltime) return; if (!leveltime) return;
mobj->anim_duration -= (leveltime + 2) % st->var2; // Duration synced to timer mobj->anim_duration -= (leveltime + 2) % st->var2; // Duration synced to timer
mobj->frame += ((leveltime + 2) / st->var2) % (st->var1 + 1); // Frame synced to timer (duration taken into account) mobj->frame += ((leveltime + 2) / st->var2) % (animlength + 1); // Frame synced to timer (duration taken into account)
} }
else if (st->frame & FF_RANDOMANIM) else if (st->frame & FF_RANDOMANIM)
{ {
mobj->frame += P_RandomKey(st->var1 + 1); // Random starting frame mobj->frame += P_RandomKey(animlength + 1); // Random starting frame
mobj->anim_duration -= P_RandomKey(st->var2); // Random duration for first frame mobj->anim_duration -= P_RandomKey(st->var2); // Random duration for first frame
} }
} }
@ -119,13 +124,23 @@ FUNCINLINE static ATTRINLINE void P_CycleStateAnimation(mobj_t *mobj)
// var2 determines delay between animation frames // var2 determines delay between animation frames
if (!(mobj->frame & FF_ANIMATE) || --mobj->anim_duration != 0) if (!(mobj->frame & FF_ANIMATE) || --mobj->anim_duration != 0)
return; return;
mobj->anim_duration = (UINT16)mobj->state->var2; mobj->anim_duration = (UINT16)mobj->state->var2;
// compare the current sprite frame to the one we started from if (mobj->sprite != SPR_PLAY)
// if more than var1 away from it, swap back to the original {
// else just advance by one // compare the current sprite frame to the one we started from
if (((++mobj->frame) & FF_FRAMEMASK) - (mobj->state->frame & FF_FRAMEMASK) > (UINT32)mobj->state->var1) // if more than var1 away from it, swap back to the original
mobj->frame = (mobj->state->frame & FF_FRAMEMASK) | (mobj->frame & ~FF_FRAMEMASK); // else just advance by one
if (((++mobj->frame) & FF_FRAMEMASK) - (mobj->state->frame & FF_FRAMEMASK) > (UINT32)mobj->state->var1)
mobj->frame = (mobj->state->frame & FF_FRAMEMASK) | (mobj->frame & ~FF_FRAMEMASK);
return;
}
// sprite2 version of above
if (mobj->skin && (((++mobj->frame) & FF_FRAMEMASK) >= (UINT32)(((skin_t *)mobj->skin)->sprites[mobj->sprite2].numframes)))
mobj->frame &= ~FF_FRAMEMASK;
} }
// //
@ -170,6 +185,215 @@ static void P_CyclePlayerMobjState(mobj_t *mobj)
} }
} }
//
// P_GetMobjSprite2
//
UINT8 P_GetMobjSprite2(mobj_t *mobj, UINT8 spr2)
{
player_t *player = mobj->player;
skin_t *skin = ((skin_t *)mobj->skin);
if (!skin)
return 0;
while ((skin->sprites[spr2].numframes <= 0)
&& spr2 != SPR2_STND)
{
switch(spr2)
{
case SPR2_PEEL:
spr2 = SPR2_RUN;
break;
case SPR2_RUN:
spr2 = SPR2_WALK;
break;
case SPR2_DRWN:
spr2 = SPR2_DEAD;
break;
case SPR2_DASH:
spr2 = SPR2_SPIN;
break;
case SPR2_GASP:
spr2 = SPR2_SPNG;
break;
case SPR2_JUMP:
spr2 = ((player
? player->charflags
: skin->flags)
& SF_NOJUMPSPIN) ? SPR2_SPNG : SPR2_SPIN;
break;
case SPR2_SPNG: // spring
spr2 = SPR2_FALL;
break;
case SPR2_FALL:
spr2 = SPR2_WALK;
break;
case SPR2_RIDE:
spr2 = SPR2_FALL;
break;
case SPR2_FLY:
spr2 = SPR2_SPNG;
break;
case SPR2_SWIM:
spr2 = SPR2_FLY;
break;
case SPR2_TIRE:
spr2 = (player && player->charability == CA_SWIM) ? SPR2_SWIM : SPR2_FLY;
break;
case SPR2_GLID:
spr2 = SPR2_FLY;
break;
case SPR2_CLMB:
spr2 = SPR2_SPIN;
break;
case SPR2_CLNG:
spr2 = SPR2_CLMB;
break;
case SPR2_TWIN:
spr2 = SPR2_SPIN;
break;
case SPR2_MLEE:
spr2 = SPR2_TWIN;
break;
// Super sprites fallback to regular sprites
case SPR2_SWLK:
spr2 = SPR2_WALK;
break;
case SPR2_SRUN:
spr2 = SPR2_RUN;
break;
case SPR2_SPEE:
spr2 = SPR2_PEEL;
break;
case SPR2_SPAN:
spr2 = SPR2_PAIN;
break;
case SPR2_SSTN:
spr2 = SPR2_SPAN;
break;
case SPR2_SDTH:
spr2 = SPR2_DEAD;
break;
case SPR2_SDRN:
spr2 = SPR2_DRWN;
break;
case SPR2_SSPN:
spr2 = SPR2_SPIN;
break;
case SPR2_SGSP:
spr2 = SPR2_GASP;
break;
case SPR2_SJMP:
spr2 = ((player
? player->charflags
: skin->flags)
& SF_NOJUMPSPIN) ? SPR2_SSPG : SPR2_SSPN;
break;
case SPR2_SSPG:
spr2 = SPR2_SPNG;
break;
case SPR2_SFAL:
spr2 = SPR2_FALL;
break;
case SPR2_SEDG:
spr2 = SPR2_EDGE;
break;
case SPR2_SRID:
spr2 = SPR2_RIDE;
break;
case SPR2_SFLT:
spr2 = SPR2_SWLK;
break;
// NiGHTS sprites.
case SPR2_NTRN:
spr2 = SPR2_TRNS;
break;
case SPR2_NSTD:
spr2 = SPR2_SSTD;
break;
case SPR2_NFLT:
spr2 = (skin->flags & SF_SUPERANIMS) ? SPR2_SFLT : SPR2_FALL; // This is skin-exclusive so the default NiGHTS skin changing system plays nice.
break;
case SPR2_NPUL:
spr2 = SPR2_NFLT;
break;
case SPR2_NPAN:
spr2 = SPR2_NPUL;
break;
case SPR2_NATK:
spr2 = SPR2_SSPN;
break;
/*case SPR2_NGT0:
spr2 = SPR2_STND;
break;*/
case SPR2_NGT1:
case SPR2_NGT7:
case SPR2_DRL0:
spr2 = SPR2_NGT0;
break;
case SPR2_NGT2:
case SPR2_DRL1:
spr2 = SPR2_NGT1;
break;
case SPR2_NGT3:
case SPR2_DRL2:
spr2 = SPR2_NGT2;
break;
case SPR2_NGT4:
case SPR2_DRL3:
spr2 = SPR2_NGT3;
break;
case SPR2_NGT5:
case SPR2_DRL4:
spr2 = SPR2_NGT4;
break;
case SPR2_NGT6:
case SPR2_DRL5:
spr2 = SPR2_NGT5;
break;
case SPR2_DRL6:
spr2 = SPR2_NGT6;
break;
case SPR2_NGT8:
case SPR2_DRL7:
spr2 = SPR2_NGT7;
break;
case SPR2_NGT9:
case SPR2_DRL8:
spr2 = SPR2_NGT8;
break;
case SPR2_NGTA:
case SPR2_DRL9:
spr2 = SPR2_NGT9;
break;
case SPR2_NGTB:
case SPR2_DRLA:
spr2 = SPR2_NGTA;
break;
case SPR2_NGTC:
case SPR2_DRLB:
spr2 = SPR2_NGTB;
break;
case SPR2_DRLC:
spr2 = SPR2_NGTC;
break;
// Dunno? Just go to standing then.
default:
spr2 = SPR2_STND;
break;
}
}
return spr2;
}
// //
// P_SetPlayerMobjState // P_SetPlayerMobjState
// Returns true if the mobj is still present. // Returns true if the mobj is still present.
@ -396,216 +620,18 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
} }
} }
mobj->anim_duration = (UINT16)st->var2; // only used if FF_ANIMATE is set
// Player animations // Player animations
if (st->sprite == SPR_PLAY) if (st->sprite == SPR_PLAY)
{ {
skin_t *skin = ((skin_t *)mobj->skin); skin_t *skin = ((skin_t *)mobj->skin);
boolean noalt = false;
UINT8 spr2 = st->frame & FF_FRAMEMASK;
UINT16 frame = (mobj->frame & FF_FRAMEMASK)+1; UINT16 frame = (mobj->frame & FF_FRAMEMASK)+1;
UINT8 numframes; UINT8 numframes;
while (skin && ((numframes = skin->sprites[spr2].numframes) <= 0) UINT8 spr2 = P_GetMobjSprite2(mobj, st->frame & FF_FRAMEMASK);
&& spr2 != SPR2_STND)
{
switch(spr2)
{
case SPR2_PEEL:
spr2 = SPR2_RUN;
break;
case SPR2_RUN:
spr2 = SPR2_WALK;
break;
case SPR2_DRWN:
spr2 = SPR2_DEAD;
break;
case SPR2_DASH:
spr2 = SPR2_SPIN;
break;
case SPR2_GASP:
spr2 = SPR2_SPNG;
break;
case SPR2_JUMP:
spr2 = (player->charflags & SF_NOJUMPSPIN) ? SPR2_SPNG : SPR2_SPIN;
break;
case SPR2_SPNG: // spring
spr2 = SPR2_FALL;
break;
case SPR2_FALL:
spr2 = SPR2_WALK;
break;
case SPR2_RIDE:
spr2 = SPR2_FALL;
break;
case SPR2_FLY: if (skin)
spr2 = SPR2_SPNG; numframes = skin->sprites[spr2].numframes;
break; else
case SPR2_SWIM:
spr2 = SPR2_FLY;
break;
case SPR2_TIRE:
spr2 = (player->charability == CA_FLY) ? SPR2_FLY : SPR2_SWIM;
break;
case SPR2_GLID:
spr2 = SPR2_FLY;
break;
case SPR2_CLMB:
spr2 = SPR2_SPIN;
break;
case SPR2_CLNG:
spr2 = SPR2_CLMB;
break;
case SPR2_TWIN:
spr2 = SPR2_SPIN;
break;
case SPR2_MLEE:
spr2 = SPR2_TWIN;
break;
// Super sprites fallback to regular sprites
case SPR2_SWLK:
spr2 = SPR2_WALK;
break;
case SPR2_SRUN:
spr2 = SPR2_RUN;
break;
case SPR2_SPEE:
spr2 = SPR2_PEEL;
break;
case SPR2_SPAN:
spr2 = SPR2_PAIN;
break;
case SPR2_SSTN:
spr2 = SPR2_SPAN;
break;
case SPR2_SDTH:
spr2 = SPR2_DEAD;
break;
case SPR2_SDRN:
spr2 = SPR2_DRWN;
break;
case SPR2_SSPN:
spr2 = SPR2_SPIN;
break;
case SPR2_SGSP:
spr2 = SPR2_GASP;
break;
case SPR2_SJMP:
spr2 = (player->charflags & SF_NOJUMPSPIN) ? SPR2_SSPG : SPR2_SSPN;
break;
case SPR2_SSPG:
spr2 = SPR2_SPNG;
break;
case SPR2_SFAL:
spr2 = SPR2_FALL;
break;
case SPR2_SEDG:
spr2 = SPR2_EDGE;
break;
case SPR2_SRID:
spr2 = SPR2_RIDE;
break;
case SPR2_SFLT:
spr2 = SPR2_SWLK;
break;
// NiGHTS sprites.
case SPR2_NTRN:
spr2 = SPR2_TRNS;
break;
case SPR2_NSTD:
spr2 = SPR2_SSTD;
break;
case SPR2_NFLT:
spr2 = (skin->flags & SF_SUPERANIMS) ? SPR2_SFLT : SPR2_FALL; // This is skin-exclusive so the default NiGHTS skin changing system plays nice.
break;
case SPR2_NPUL:
spr2 = SPR2_NFLT;
break;
case SPR2_NPAN:
spr2 = SPR2_NPUL;
break;
case SPR2_NATK:
spr2 = SPR2_SSPN;
break;
/*case SPR2_NGT0:
spr2 = SPR2_STND;
break;*/
case SPR2_NGT1:
case SPR2_NGT7:
case SPR2_DRL0:
spr2 = SPR2_NGT0;
break;
case SPR2_NGT2:
case SPR2_DRL1:
spr2 = SPR2_NGT1;
break;
case SPR2_NGT3:
case SPR2_DRL2:
spr2 = SPR2_NGT2;
break;
case SPR2_NGT4:
case SPR2_DRL3:
spr2 = SPR2_NGT3;
break;
case SPR2_NGT5:
case SPR2_DRL4:
spr2 = SPR2_NGT4;
break;
case SPR2_NGT6:
case SPR2_DRL5:
spr2 = SPR2_NGT5;
break;
case SPR2_DRL6:
spr2 = SPR2_NGT6;
break;
case SPR2_NGT8:
case SPR2_DRL7:
spr2 = SPR2_NGT7;
break;
case SPR2_NGT9:
case SPR2_DRL8:
spr2 = SPR2_NGT8;
break;
case SPR2_NGTA:
case SPR2_DRL9:
spr2 = SPR2_NGT9;
break;
case SPR2_NGTB:
case SPR2_DRLA:
spr2 = SPR2_NGTA;
break;
case SPR2_NGTC:
case SPR2_DRLB:
spr2 = SPR2_NGTB;
break;
case SPR2_DRLC:
spr2 = SPR2_NGTC;
break;
// Sprites for non-player objects? There's nothing we can do.
case SPR2_SIGN:
case SPR2_LIFE:
noalt = true;
break;
// Dunno? Just go to standing then.
default:
spr2 = SPR2_STND;
break;
}
if (noalt)
break;
}
if (!skin)
{ {
frame = 0; frame = 0;
numframes = 0; numframes = 0;
@ -628,7 +654,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
{ {
if (st->frame & FF_SPR2ENDSTATE) // no frame advancement if (st->frame & FF_SPR2ENDSTATE) // no frame advancement
{ {
if (st->var1 == S_NULL) if (st->var1 == mobj->state-states)
frame--; frame--;
else else
{ {
@ -651,9 +677,10 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
{ {
mobj->sprite = st->sprite; mobj->sprite = st->sprite;
mobj->frame = st->frame; mobj->frame = st->frame;
P_SetupStateAnimation(mobj, st);
} }
P_SetupStateAnimation(mobj, st);
// Modified handling. // Modified handling.
// Call action functions when the state is set // Call action functions when the state is set
@ -723,10 +750,11 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
if (st->sprite == SPR_PLAY) if (st->sprite == SPR_PLAY)
{ {
skin_t *skin = ((skin_t *)mobj->skin); skin_t *skin = ((skin_t *)mobj->skin);
UINT8 spr2 = st->frame & FF_FRAMEMASK;
UINT16 frame = (mobj->frame & FF_FRAMEMASK)+1; UINT16 frame = (mobj->frame & FF_FRAMEMASK)+1;
UINT8 numframes; UINT8 numframes;
UINT8 spr2 = P_GetMobjSprite2(mobj, st->frame & FF_FRAMEMASK);
if (skin) if (skin)
numframes = skin->sprites[spr2].numframes; numframes = skin->sprites[spr2].numframes;
else else
@ -750,8 +778,17 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
if (frame >= numframes) if (frame >= numframes)
{ {
if (st->frame & FF_SPR2ENDSTATE) if (st->frame & FF_SPR2ENDSTATE) // no frame advancement
return P_SetPlayerMobjState(mobj, st->var1); // Differs from P_SetPlayerMobjState - allows object to be removed via S_NULL {
if (st->var1 == mobj->state-states)
frame--;
else
{
if (mobj->frame & FF_FRAMEMASK)
mobj->frame--;
return P_SetMobjState(mobj, st->var1);
}
}
else else
frame = 0; frame = 0;
} }
@ -764,9 +801,10 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
{ {
mobj->sprite = st->sprite; mobj->sprite = st->sprite;
mobj->frame = st->frame; mobj->frame = st->frame;
P_SetupStateAnimation(mobj, st);
} }
P_SetupStateAnimation(mobj, st);
// Modified handling. // Modified handling.
// Call action functions when the state is set // Call action functions when the state is set
@ -1046,14 +1084,12 @@ void P_EmeraldManager(void)
else else
break; break;
if (leveltime < TICRATE) // Start of map spawnpoints[j]->threshold = emeraldspawndelay + P_RandomByte() * (TICRATE/5);
spawnpoints[j]->threshold = 60*TICRATE + P_RandomByte() * (TICRATE/5);
else
spawnpoints[j]->threshold = P_RandomByte() * (TICRATE/5);
break; break;
} }
} }
emeraldspawndelay = 0;
} }
// //
@ -4156,17 +4192,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
} }
animonly: animonly:
// cycle through states, P_CyclePlayerMobjState(mobj);
// calling action functions at transitions
if (mobj->tics != -1)
{
mobj->tics--;
// you can cycle through multiple states in a tic
if (!mobj->tics)
if (!P_SetPlayerMobjState(mobj, mobj->state->nextstate))
return; // freed itself
}
} }
static void CalculatePrecipFloor(precipmobj_t *mobj) static void CalculatePrecipFloor(precipmobj_t *mobj)
@ -4337,15 +4363,15 @@ boolean P_BossTargetPlayer(mobj_t *actor, boolean closest)
player = &players[actor->lastlook]; player = &players[actor->lastlook];
if (player->health <= 0)
continue; // dead
if (player->pflags & PF_INVIS || player->bot || player->spectator) if (player->pflags & PF_INVIS || player->bot || player->spectator)
continue; // ignore notarget continue; // ignore notarget
if (!player->mo || P_MobjWasRemoved(player->mo)) if (!player->mo || P_MobjWasRemoved(player->mo))
continue; continue;
if (player->mo->health <= 0)
continue; //dead
if (!P_CheckSight(actor, player->mo)) if (!P_CheckSight(actor, player->mo))
continue; // out of sight continue; // out of sight
@ -4375,15 +4401,15 @@ boolean P_SupermanLook4Players(mobj_t *actor)
{ {
if (playeringame[c]) if (playeringame[c])
{ {
if (players[c].health <= 0)
continue; // dead
if (players[c].pflags & PF_INVIS) if (players[c].pflags & PF_INVIS)
continue; // ignore notarget continue; // ignore notarget
if (!players[c].mo || players[c].bot) if (!players[c].mo || players[c].bot)
continue; continue;
if (players[c].mo->health <= 0)
continue; // dead
playersinthegame[stop] = &players[c]; playersinthegame[stop] = &players[c];
stop++; stop++;
} }
@ -6450,6 +6476,8 @@ void P_RunOverlays(void)
P_UnsetThingPosition(mo); P_UnsetThingPosition(mo);
mo->x = destx; mo->x = destx;
mo->y = desty; mo->y = desty;
mo->radius = mo->target->radius;
mo->height = mo->target->height;
if (mo->eflags & MFE_VERTICALFLIP) if (mo->eflags & MFE_VERTICALFLIP)
mo->z = (mo->target->z + mo->target->height - mo->height) - zoffs; mo->z = (mo->target->z + mo->target->height - mo->height) - zoffs;
else else
@ -7154,7 +7182,7 @@ void P_MobjThinker(mobj_t *mobj)
P_SetTarget(&mobj->target, NULL); P_SetTarget(&mobj->target, NULL);
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo if (playeringame[i] && players[i].mo
&& players[i].mare == mobj->threshold && players[i].health > 1) && players[i].mare == mobj->threshold && players[i].rings > 0)
{ {
fixed_t dist = P_AproxDistance(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y); fixed_t dist = P_AproxDistance(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y);
if (dist < shortest) if (dist < shortest)
@ -8818,8 +8846,10 @@ void P_SpawnPlayer(INT32 playernum)
// (usefulness: when body mobj is detached from player (who respawns), // (usefulness: when body mobj is detached from player (who respawns),
// the dead body mobj retains the skin through the 'spritedef' override). // the dead body mobj retains the skin through the 'spritedef' override).
mobj->skin = &skins[p->skin]; mobj->skin = &skins[p->skin];
P_SetupStateAnimation(mobj, mobj->state);
mobj->health = p->health; mobj->health = 1;
p->rings = 0;
p->playerstate = PST_LIVE; p->playerstate = PST_LIVE;
p->bonustime = false; p->bonustime = false;
@ -10719,7 +10749,7 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 allowai
{ {
mobj_t *th; mobj_t *th;
angle_t an; angle_t an;
fixed_t x, y, z, slope = 0; fixed_t x, y, z, slope = 0, speed;
// angle at which you fire, is player angle // angle at which you fire, is player angle
an = angle; an = angle;
@ -10751,9 +10781,13 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 allowai
P_SetTarget(&th->target, source); P_SetTarget(&th->target, source);
speed = th->info->speed;
if (source->player && source->player->charability == CA_FLY)
speed = FixedMul(speed, 3*FRACUNIT/2);
th->angle = an; th->angle = an;
th->momx = FixedMul(th->info->speed, FINECOSINE(an>>ANGLETOFINESHIFT)); th->momx = FixedMul(speed, FINECOSINE(an>>ANGLETOFINESHIFT));
th->momy = FixedMul(th->info->speed, FINESINE(an>>ANGLETOFINESHIFT)); th->momy = FixedMul(speed, FINESINE(an>>ANGLETOFINESHIFT));
if (allowaim) if (allowaim)
{ {
@ -10761,7 +10795,7 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 allowai
th->momy = FixedMul(th->momy,FINECOSINE(source->player->aiming>>ANGLETOFINESHIFT)); th->momy = FixedMul(th->momy,FINECOSINE(source->player->aiming>>ANGLETOFINESHIFT));
} }
th->momz = FixedMul(th->info->speed, slope); th->momz = FixedMul(speed, slope);
//scaling done here so it doesn't clutter up the code above //scaling done here so it doesn't clutter up the code above
th->momx = FixedMul(th->momx, th->scale); th->momx = FixedMul(th->momx, th->scale);
@ -10815,4 +10849,3 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo
P_SetScale(newmobj, mobj->scale); P_SetScale(newmobj, mobj->scale);
return newmobj; return newmobj;
} }

View File

@ -453,5 +453,6 @@ void P_EmeraldManager(void);
extern mapthing_t *huntemeralds[MAXHUNTEMERALDS]; extern mapthing_t *huntemeralds[MAXHUNTEMERALDS];
extern INT32 numhuntemeralds; extern INT32 numhuntemeralds;
extern boolean runemeraldmanager; extern boolean runemeraldmanager;
extern UINT16 emeraldspawndelay;
extern INT32 numstarposts; extern INT32 numstarposts;
#endif #endif

View File

@ -128,7 +128,7 @@ static void P_NetArchivePlayers(void)
WRITEANGLE(save_p, players[i].aiming); WRITEANGLE(save_p, players[i].aiming);
WRITEANGLE(save_p, players[i].awayviewaiming); WRITEANGLE(save_p, players[i].awayviewaiming);
WRITEINT32(save_p, players[i].awayviewtics); WRITEINT32(save_p, players[i].awayviewtics);
WRITEINT32(save_p, players[i].health); WRITEINT32(save_p, players[i].rings);
WRITESINT8(save_p, players[i].pity); WRITESINT8(save_p, players[i].pity);
WRITEINT32(save_p, players[i].currentweapon); WRITEINT32(save_p, players[i].currentweapon);
@ -308,7 +308,7 @@ static void P_NetUnArchivePlayers(void)
players[i].aiming = READANGLE(save_p); players[i].aiming = READANGLE(save_p);
players[i].awayviewaiming = READANGLE(save_p); players[i].awayviewaiming = READANGLE(save_p);
players[i].awayviewtics = READINT32(save_p); players[i].awayviewtics = READINT32(save_p);
players[i].health = READINT32(save_p); players[i].rings = READINT32(save_p);
players[i].pity = READSINT8(save_p); players[i].pity = READSINT8(save_p);
players[i].currentweapon = READINT32(save_p); players[i].currentweapon = READINT32(save_p);

View File

@ -2086,6 +2086,7 @@ static void P_LevelInitStuff(void)
// special stage tokens, emeralds, and ring total // special stage tokens, emeralds, and ring total
tokenbits = 0; tokenbits = 0;
runemeraldmanager = false; runemeraldmanager = false;
emeraldspawndelay = 60*TICRATE;
nummaprings = 0; nummaprings = 0;
// emerald hunt // emerald hunt
@ -2128,7 +2129,7 @@ static void P_LevelInitStuff(void)
players[i].gotcontinue = false; players[i].gotcontinue = false;
players[i].xtralife = players[i].deadtimer = players[i].numboxes = players[i].totalring = players[i].laps = 0; players[i].xtralife = players[i].deadtimer = players[i].numboxes = players[i].totalring = players[i].laps = 0;
players[i].health = 1; players[i].rings = 0;
players[i].aiming = 0; players[i].aiming = 0;
players[i].pflags &= ~PF_TIMEOVER; players[i].pflags &= ~PF_TIMEOVER;
@ -2585,11 +2586,7 @@ boolean P_SetupLevel(boolean skipprecip)
lastloadedmaplumpnum = W_GetNumForName(maplumpname = G_BuildMapName(gamemap)); lastloadedmaplumpnum = W_GetNumForName(maplumpname = G_BuildMapName(gamemap));
R_ReInitColormaps(mapheaderinfo[gamemap-1]->palette); R_ReInitColormaps(mapheaderinfo[gamemap-1]->palette);
CON_ReSetupBackColormap(mapheaderinfo[gamemap-1]->palette); CON_SetupBackColormap();
// now part of level loading since in future each level may have
// its own anim texture sequences, switches etc.
P_InitPicAnims();
// SRB2 determines the sky texture to be used depending on the map header. // SRB2 determines the sky texture to be used depending on the map header.
P_SetupLevelSky(mapheaderinfo[gamemap-1]->skynum, true); P_SetupLevelSky(mapheaderinfo[gamemap-1]->skynum, true);
@ -3001,6 +2998,9 @@ boolean P_AddWadFile(const char *wadfilename, char **firstmapname)
else else
R_FlushTextureCache(); // just reload it from file R_FlushTextureCache(); // just reload it from file
// Reload ANIMATED / ANIMDEFS
P_InitPicAnims();
// Flush and reload HUD graphics // Flush and reload HUD graphics
ST_UnloadGraphics(); ST_UnloadGraphics();
HU_LoadGraphics(); HU_LoadGraphics();

View File

@ -221,8 +221,8 @@ static animdef_t harddefs[] =
static animdef_t *animdefs = NULL; static animdef_t *animdefs = NULL;
// A prototype; here instead of p_spec.h, so they're "private" // A prototype; here instead of p_spec.h, so they're "private"
void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum, INT32 *i); void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum);
void P_ParseAnimationDefintion(SINT8 istexture, INT32 *i); void P_ParseAnimationDefintion(SINT8 istexture);
/** Sets up texture and flat animations. /** Sets up texture and flat animations.
* *
@ -232,24 +232,21 @@ void P_ParseAnimationDefintion(SINT8 istexture, INT32 *i);
* Issues an error if any animation cycles are invalid. * Issues an error if any animation cycles are invalid.
* *
* \sa P_FindAnimatedFlat, P_SetupLevelFlatAnims * \sa P_FindAnimatedFlat, P_SetupLevelFlatAnims
* \author Steven McGranahan (original), Shadow Hog (had to rewrite it to handle multiple WADs) * \author Steven McGranahan (original), Shadow Hog (had to rewrite it to handle multiple WADs), JTE (had to rewrite it to handle multiple WADs _correctly_)
*/ */
void P_InitPicAnims(void) void P_InitPicAnims(void)
{ {
// Init animation // Init animation
INT32 i; // Position in the animdefs array
INT32 w; // WAD INT32 w; // WAD
UINT8 *wadAnimdefs; // not to be confused with animdefs, the combined total of every ANIMATED lump in every WAD, or ANIMDEFS, the ZDoom lump I intend to implement later UINT8 *animatedLump;
UINT8 *currentPos; UINT8 *currentPos;
size_t i;
I_Assert(animdefs == NULL);
if (W_CheckNumForName("ANIMATED") != LUMPERROR || W_CheckNumForName("ANIMDEFS") != LUMPERROR) if (W_CheckNumForName("ANIMATED") != LUMPERROR || W_CheckNumForName("ANIMDEFS") != LUMPERROR)
{ {
if (animdefs) for (w = numwadfiles-1, maxanims = 0; w >= 0; w--)
{
Z_Free(animdefs);
animdefs = NULL;
}
for (w = 0, i = 0, maxanims = 0; w < numwadfiles; w++)
{ {
UINT16 animatedLumpNum; UINT16 animatedLumpNum;
UINT16 animdefsLumpNum; UINT16 animdefsLumpNum;
@ -258,20 +255,20 @@ void P_InitPicAnims(void)
animatedLumpNum = W_CheckNumForNamePwad("ANIMATED", w, 0); animatedLumpNum = W_CheckNumForNamePwad("ANIMATED", w, 0);
if (animatedLumpNum != INT16_MAX) if (animatedLumpNum != INT16_MAX)
{ {
wadAnimdefs = (UINT8 *)W_CacheLumpNumPwad(w, animatedLumpNum, PU_STATIC); animatedLump = (UINT8 *)W_CacheLumpNumPwad(w, animatedLumpNum, PU_STATIC);
// Get the number of animations in the file // Get the number of animations in the file
for (currentPos = wadAnimdefs; *currentPos != UINT8_MAX; maxanims++, currentPos+=23); i = maxanims;
for (currentPos = animatedLump; *currentPos != UINT8_MAX; maxanims++, currentPos+=23);
// Resize animdefs (or if it hasn't been created, create it) // Resize animdefs (or if it hasn't been created, create it)
animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL); animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL);
// Sanity check it // Sanity check it
if (!animdefs) { if (!animdefs)
I_Error("Not enough free memory for ANIMATED data"); I_Error("Not enough free memory for ANIMATED data");
}
// Populate the new array // Populate the new array
for (currentPos = wadAnimdefs; *currentPos != UINT8_MAX; i++, currentPos+=23) for (currentPos = animatedLump; *currentPos != UINT8_MAX; i++, currentPos+=23)
{ {
M_Memcpy(&(animdefs[i].istexture), currentPos, 1); // istexture, 1 byte M_Memcpy(&(animdefs[i].istexture), currentPos, 1); // istexture, 1 byte
M_Memcpy(animdefs[i].endname, (currentPos + 1), 9); // endname, 9 bytes M_Memcpy(animdefs[i].endname, (currentPos + 1), 9); // endname, 9 bytes
@ -279,15 +276,13 @@ void P_InitPicAnims(void)
M_Memcpy(&(animdefs[i].speed), (currentPos + 19), 4); // speed, 4 bytes M_Memcpy(&(animdefs[i].speed), (currentPos + 19), 4); // speed, 4 bytes
} }
Z_Free(wadAnimdefs); Z_Free(animatedLump);
} }
// Now find ANIMDEFS // Now find ANIMDEFS
animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", w, 0); animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", w, 0);
if (animdefsLumpNum != INT16_MAX) if (animdefsLumpNum != INT16_MAX)
{ P_ParseANIMDEFSLump(w, animdefsLumpNum);
P_ParseANIMDEFSLump(w, animdefsLumpNum, &i);
}
} }
// Define the last one // Define the last one
animdefs[maxanims].istexture = -1; animdefs[maxanims].istexture = -1;
@ -347,16 +342,20 @@ void P_InitPicAnims(void)
lastanim->istexture = -1; lastanim->istexture = -1;
R_ClearTextureNumCache(false); R_ClearTextureNumCache(false);
// Clear animdefs now that we're done with it.
// We'll only be using anims from now on.
if (animdefs != harddefs) if (animdefs != harddefs)
Z_ChangeTag(animdefs, PU_CACHE); Z_Free(animdefs);
animdefs = NULL;
} }
void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum, INT32 *i) void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum)
{ {
char *animdefsLump; char *animdefsLump;
size_t animdefsLumpLength; size_t animdefsLumpLength;
char *animdefsText; char *animdefsText;
char *animdefsToken; char *animdefsToken;
char *p;
// Since lumps AREN'T \0-terminated like I'd assumed they should be, I'll // Since lumps AREN'T \0-terminated like I'd assumed they should be, I'll
// need to make a space of memory where I can ensure that it will terminate // need to make a space of memory where I can ensure that it will terminate
@ -376,18 +375,19 @@ void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum, INT32 *i)
Z_Free(animdefsLump); Z_Free(animdefsLump);
// Now, let's start parsing this thing // Now, let's start parsing this thing
animdefsToken = M_GetToken(animdefsText); p = animdefsText;
animdefsToken = M_GetToken(p);
while (animdefsToken != NULL) while (animdefsToken != NULL)
{ {
if (stricmp(animdefsToken, "TEXTURE") == 0) if (stricmp(animdefsToken, "TEXTURE") == 0)
{ {
Z_Free(animdefsToken); Z_Free(animdefsToken);
P_ParseAnimationDefintion(1, i); P_ParseAnimationDefintion(1);
} }
else if (stricmp(animdefsToken, "FLAT") == 0) else if (stricmp(animdefsToken, "FLAT") == 0)
{ {
Z_Free(animdefsToken); Z_Free(animdefsToken);
P_ParseAnimationDefintion(0, i); P_ParseAnimationDefintion(0);
} }
else if (stricmp(animdefsToken, "OSCILLATE") == 0) else if (stricmp(animdefsToken, "OSCILLATE") == 0)
{ {
@ -398,23 +398,22 @@ void P_ParseANIMDEFSLump(INT32 wadNum, UINT16 lumpnum, INT32 *i)
{ {
I_Error("Error parsing ANIMDEFS lump: Expected \"TEXTURE\" or \"FLAT\", got \"%s\"",animdefsToken); I_Error("Error parsing ANIMDEFS lump: Expected \"TEXTURE\" or \"FLAT\", got \"%s\"",animdefsToken);
} }
animdefsToken = M_GetToken(NULL); // parse next line
while (*p != '\0' && *p != '\n') ++p;
if (*p == '\n') ++p;
animdefsToken = M_GetToken(p);
} }
Z_Free(animdefsToken); Z_Free(animdefsToken);
Z_Free((void *)animdefsText); Z_Free((void *)animdefsText);
} }
void P_ParseAnimationDefintion(SINT8 istexture, INT32 *i) void P_ParseAnimationDefintion(SINT8 istexture)
{ {
char *animdefsToken; char *animdefsToken;
size_t animdefsTokenLength; size_t animdefsTokenLength;
char *endPos; char *endPos;
INT32 animSpeed; INT32 animSpeed;
size_t i;
// Increase the size to make room for the new animation definition
maxanims++;
animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL);
animdefs[*i].istexture = istexture;
// Startname // Startname
animdefsToken = M_GetToken(NULL); animdefsToken = M_GetToken(NULL);
@ -448,14 +447,39 @@ void P_ParseAnimationDefintion(SINT8 istexture, INT32 *i)
{ {
I_Error("Error parsing ANIMDEFS lump: lump name \"%s\" exceeds 8 characters", animdefsToken); I_Error("Error parsing ANIMDEFS lump: lump name \"%s\" exceeds 8 characters", animdefsToken);
} }
strncpy(animdefs[*i].startname, animdefsToken, 9);
// Search for existing animdef
for (i = 0; i < maxanims; i++)
if (stricmp(animdefsToken, animdefs[i].startname) == 0)
{
//CONS_Alert(CONS_NOTICE, "Duplicate animation: %s\n", animdefsToken);
// If we weren't parsing in reverse order, we would `break` here and parse the new data into the existing slot we found.
// Instead, we're just going to skip parsing the rest of this line entirely.
Z_Free(animdefsToken);
return;
}
// Not found
if (i == maxanims)
{
// Increase the size to make room for the new animation definition
maxanims++;
animdefs = (animdef_t *)Z_Realloc(animdefs, sizeof(animdef_t)*(maxanims + 1), PU_STATIC, NULL);
strncpy(animdefs[i].startname, animdefsToken, 9);
}
// animdefs[i].startname is now set to animdefsToken either way.
Z_Free(animdefsToken); Z_Free(animdefsToken);
// set texture type
animdefs[i].istexture = istexture;
// "RANGE" // "RANGE"
animdefsToken = M_GetToken(NULL); animdefsToken = M_GetToken(NULL);
if (animdefsToken == NULL) if (animdefsToken == NULL)
{ {
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"RANGE\" after \"%s\"'s startname should be", animdefs[*i].startname); I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"RANGE\" after \"%s\"'s startname should be", animdefs[i].startname);
} }
if (stricmp(animdefsToken, "ALLOWDECALS") == 0) if (stricmp(animdefsToken, "ALLOWDECALS") == 0)
{ {
@ -470,7 +494,7 @@ void P_ParseAnimationDefintion(SINT8 istexture, INT32 *i)
} }
if (stricmp(animdefsToken, "RANGE") != 0) if (stricmp(animdefsToken, "RANGE") != 0)
{ {
I_Error("Error parsing ANIMDEFS lump: Expected \"RANGE\" after \"%s\"'s startname, got \"%s\"", animdefs[*i].startname, animdefsToken); I_Error("Error parsing ANIMDEFS lump: Expected \"RANGE\" after \"%s\"'s startname, got \"%s\"", animdefs[i].startname, animdefsToken);
} }
Z_Free(animdefsToken); Z_Free(animdefsToken);
@ -478,21 +502,21 @@ void P_ParseAnimationDefintion(SINT8 istexture, INT32 *i)
animdefsToken = M_GetToken(NULL); animdefsToken = M_GetToken(NULL);
if (animdefsToken == NULL) if (animdefsToken == NULL)
{ {
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s end texture/flat name should be", animdefs[*i].startname); I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s end texture/flat name should be", animdefs[i].startname);
} }
animdefsTokenLength = strlen(animdefsToken); animdefsTokenLength = strlen(animdefsToken);
if (animdefsTokenLength>8) if (animdefsTokenLength>8)
{ {
I_Error("Error parsing ANIMDEFS lump: lump name \"%s\" exceeds 8 characters", animdefsToken); I_Error("Error parsing ANIMDEFS lump: lump name \"%s\" exceeds 8 characters", animdefsToken);
} }
strncpy(animdefs[*i].endname, animdefsToken, 9); strncpy(animdefs[i].endname, animdefsToken, 9);
Z_Free(animdefsToken); Z_Free(animdefsToken);
// "TICS" // "TICS"
animdefsToken = M_GetToken(NULL); animdefsToken = M_GetToken(NULL);
if (animdefsToken == NULL) if (animdefsToken == NULL)
{ {
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s \"TICS\" should be", animdefs[*i].startname); I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s \"TICS\" should be", animdefs[i].startname);
} }
if (stricmp(animdefsToken, "RAND") == 0) if (stricmp(animdefsToken, "RAND") == 0)
{ {
@ -501,7 +525,7 @@ void P_ParseAnimationDefintion(SINT8 istexture, INT32 *i)
} }
if (stricmp(animdefsToken, "TICS") != 0) if (stricmp(animdefsToken, "TICS") != 0)
{ {
I_Error("Error parsing ANIMDEFS lump: Expected \"TICS\" in animation definition for \"%s\", got \"%s\"", animdefs[*i].startname, animdefsToken); I_Error("Error parsing ANIMDEFS lump: Expected \"TICS\" in animation definition for \"%s\", got \"%s\"", animdefs[i].startname, animdefsToken);
} }
Z_Free(animdefsToken); Z_Free(animdefsToken);
@ -509,7 +533,7 @@ void P_ParseAnimationDefintion(SINT8 istexture, INT32 *i)
animdefsToken = M_GetToken(NULL); animdefsToken = M_GetToken(NULL);
if (animdefsToken == NULL) if (animdefsToken == NULL)
{ {
I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s animation speed should be", animdefs[*i].startname); I_Error("Error parsing ANIMDEFS lump: Unexpected end of file where \"%s\"'s animation speed should be", animdefs[i].startname);
} }
endPos = NULL; endPos = NULL;
#ifndef AVOID_ERRNO #ifndef AVOID_ERRNO
@ -523,13 +547,10 @@ void P_ParseAnimationDefintion(SINT8 istexture, INT32 *i)
#endif #endif
|| animSpeed < 0) // Number is not positive || animSpeed < 0) // Number is not positive
{ {
I_Error("Error parsing ANIMDEFS lump: Expected a positive integer for \"%s\"'s animation speed, got \"%s\"", animdefs[*i].startname, animdefsToken); I_Error("Error parsing ANIMDEFS lump: Expected a positive integer for \"%s\"'s animation speed, got \"%s\"", animdefs[i].startname, animdefsToken);
} }
animdefs[*i].speed = animSpeed; animdefs[i].speed = animSpeed;
Z_Free(animdefsToken); Z_Free(animdefsToken);
// Increment i before we go, so this doesn't cause issues later
(*i)++;
} }
@ -1600,10 +1621,10 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
if (!playeringame[i] || players[i].spectator) if (!playeringame[i] || players[i].spectator)
continue; continue;
if (!players[i].mo || players[i].mo->health < 1) if (!players[i].mo || players[i].rings <= 0)
continue; continue;
rings += players[i].mo->health-1; rings += players[i].rings;
} }
} }
else else
@ -1611,7 +1632,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
if (!(actor && actor->player)) if (!(actor && actor->player))
return false; // no player to count rings from here, sorry return false; // no player to count rings from here, sorry
rings = actor->health-1; rings = actor->player->rings;
} }
if (triggerline->flags & ML_NOCLIMB) if (triggerline->flags & ML_NOCLIMB)
@ -3527,10 +3548,9 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
break; break;
case 9: // Ring Drainer (Floor Touch) case 9: // Ring Drainer (Floor Touch)
case 10: // Ring Drainer (No Floor Touch) case 10: // Ring Drainer (No Floor Touch)
if (leveltime % (TICRATE/2) == 0 && player->mo->health > 1) if (leveltime % (TICRATE/2) == 0 && player->rings > 0)
{ {
player->mo->health--; player->rings--;
player->health--;
S_StartSound(player->mo, sfx_itemup); S_StartSound(player->mo, sfx_itemup);
} }
break; break;
@ -3538,7 +3558,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
if (player->powers[pw_invulnerability] || player->powers[pw_flashing] || player->powers[pw_super] || player->exiting || player->bot) if (player->powers[pw_invulnerability] || player->powers[pw_flashing] || player->powers[pw_super] || player->exiting || player->bot)
break; break;
if (!(player->powers[pw_shield] || player->mo->health > 1)) // Don't do anything if no shield or rings anyway if (!(player->powers[pw_shield] || player->rings > 0)) // Don't do anything if no shield or rings anyway
break; break;
if (player->powers[pw_shield]) if (player->powers[pw_shield])
@ -3546,14 +3566,13 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
P_RemoveShield(player); P_RemoveShield(player);
S_StartSound(player->mo, sfx_shldls); // Ba-Dum! Shield loss. S_StartSound(player->mo, sfx_shldls); // Ba-Dum! Shield loss.
} }
else if (player->mo->health > 1) else if (player->rings > 0)
{ {
P_PlayRinglossSound(player->mo); P_PlayRinglossSound(player->mo);
if (player->mo->health > 10) if (player->rings >= 10)
player->mo->health -= 10; player->rings -= 10;
else else
player->mo->health = 1; player->rings = 0;
player->health = player->mo->health;
} }
P_DoPlayerPain(player, NULL, NULL); // this does basically everything that was here before P_DoPlayerPain(player, NULL, NULL); // this does basically everything that was here before

View File

@ -469,7 +469,7 @@ static inline void P_DoSpecialStageStuff(void)
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i]) if (playeringame[i])
{ {
ssrings += (players[i].mo->health-1); ssrings += players[i].rings;
// If in water, deplete timer 6x as fast. // If in water, deplete timer 6x as fast.
if ((players[i].mo->eflags & MFE_TOUCHWATER) if ((players[i].mo->eflags & MFE_TOUCHWATER)

View File

@ -697,7 +697,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
{ {
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i]/* && players[i].pflags & PF_NIGHTSMODE*/) if (playeringame[i]/* && players[i].pflags & PF_NIGHTSMODE*/)
total_rings += players[i].health-1; total_rings += players[i].rings;
} }
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
@ -715,8 +715,8 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
} }
else else
{ {
players[i].finishedrings = (INT16)(players[i].health - 1); players[i].finishedrings = (INT16)(players[i].rings);
P_AddPlayerScore(&players[i], (players[i].health - 1) * 50); P_AddPlayerScore(&players[i], (players[i].rings) * 50);
} }
// Add score to leaderboards now // Add score to leaderboards now
@ -727,7 +727,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
players[i].lastmarescore = players[i].marescore; players[i].lastmarescore = players[i].marescore;
players[i].marescore = 0; players[i].marescore = 0;
players[i].mo->health = players[i].health = 1; players[i].rings = 0;
P_DoPlayerExit(&players[i]); P_DoPlayerExit(&players[i]);
} }
} }
@ -735,12 +735,12 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
{ {
/// \todo Handle multi-mare special stages. /// \todo Handle multi-mare special stages.
// Ring bonus // Ring bonus
P_AddPlayerScore(player, (player->health - 1) * 50); P_AddPlayerScore(player, (player->rings) * 50);
player->lastmare = (UINT8)oldmare; player->lastmare = (UINT8)oldmare;
player->texttimer = 4*TICRATE; player->texttimer = 4*TICRATE;
player->textvar = 4; // Score and grades player->textvar = 4; // Score and grades
player->finishedrings = (INT16)(player->health - 1); player->finishedrings = (INT16)(player->rings);
// Add score to temp leaderboards // Add score to temp leaderboards
if (!(netgame||multiplayer) && P_IsLocalPlayer(player)) if (!(netgame||multiplayer) && P_IsLocalPlayer(player))
@ -751,7 +751,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
player->marescore = 0; player->marescore = 0;
player->marebegunat = leveltime; player->marebegunat = leveltime;
player->mo->health = player->health = 1; player->rings = 0;
} }
else else
{ {
@ -895,30 +895,23 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings)
if (!player->mo) if (!player->mo)
return; return;
player->mo->health += num_rings; player->rings += num_rings;
player->health += num_rings;
if (!G_IsSpecialStage(gamemap) || !useNightsSS) if (!G_IsSpecialStage(gamemap) || !useNightsSS)
player->totalring += num_rings; player->totalring += num_rings;
// Can only get up to 9999 rings, sorry! // Can only get up to 9999 rings, sorry!
if (player->mo->health > 10000) if (player->rings > 9999)
{ player->rings = 9999;
player->mo->health = 10000; else if (player->rings < 0)
player->health = 10000; player->rings = 0;
}
else if (player->mo->health < 1)
{
player->mo->health = 1;
player->health = 1;
}
// Now extra life bonuses are handled here instead of in P_MovePlayer, since why not? // Now extra life bonuses are handled here instead of in P_MovePlayer, since why not?
if (!ultimatemode && !modeattacking && !G_IsSpecialStage(gamemap) && G_GametypeUsesLives()) if (!ultimatemode && !modeattacking && !G_IsSpecialStage(gamemap) && G_GametypeUsesLives())
{ {
INT32 gainlives = 0; INT32 gainlives = 0;
while (player->xtralife < maxXtraLife && player->health > 100 * (player->xtralife+1)) while (player->xtralife < maxXtraLife && player->rings >= 100 * (player->xtralife+1))
{ {
++gainlives; ++gainlives;
++player->xtralife; ++player->xtralife;
@ -958,7 +951,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings)
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC) && P_IsLocalPlayer(player)) if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC) && P_IsLocalPlayer(player))
{ {
S_StopMusic(); S_StopMusic();
S_ChangeMusicInternal("supers", true); S_ChangeMusicInternal("_super", true);
} }
S_StartSound(NULL, sfx_supert); //let all players hear it -mattw_cfi S_StartSound(NULL, sfx_supert); //let all players hear it -mattw_cfi
@ -969,10 +962,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings)
player->mo->momx = player->mo->momy = player->mo->momz = 0; player->mo->momx = player->mo->momy = player->mo->momz = 0;
if (giverings) if (giverings)
{ player->rings = 50;
player->mo->health = 51;
player->health = player->mo->health;
}
// Just in case. // Just in case.
if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC)) if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC))
@ -991,6 +981,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings)
P_PlayerFlagBurst(player, false); P_PlayerFlagBurst(player, false);
} }
// Adds to the player's score // Adds to the player's score
void P_AddPlayerScore(player_t *player, UINT32 amount) void P_AddPlayerScore(player_t *player, UINT32 amount)
{ {
@ -1077,6 +1068,42 @@ void P_AddPlayerScore(player_t *player, UINT32 amount)
} }
} }
// Steals from every enemy's score.
void P_StealPlayerScore(player_t *player, UINT32 amount)
{
boolean teams = G_GametypeHasTeams();
UINT32 stolen = 0;
int i;
for (i = 0; i < MAXPLAYERS; i++)
{
if (&players[i] == player
|| (teams && players[i].ctfteam == player->ctfteam))
continue;
if (players[i].score >= amount)
{
stolen += amount;
players[i].score -= amount;
}
else
{
stolen += players[i].score;
players[i].score = 0;
}
}
if (stolen > 0)
{
// In team match, all stolen points are removed from the enemy team's running score.
if (gametype == GT_TEAMMATCH)
{
if (player->ctfteam == 1)
bluescore -= amount;
else if (player->ctfteam == 2)
redscore -= amount;
}
P_AddPlayerScore(player, stolen);
}
}
// //
// P_PlayLivesJingle // P_PlayLivesJingle
// //
@ -1094,7 +1121,7 @@ void P_PlayLivesJingle(player_t *player)
if (player) if (player)
player->powers[pw_extralife] = extralifetics + 1; player->powers[pw_extralife] = extralifetics + 1;
S_StopMusic(); // otherwise it won't restart if this is done twice in a row S_StopMusic(); // otherwise it won't restart if this is done twice in a row
S_ChangeMusicInternal("xtlife", false); S_ChangeMusicInternal("_1up", false);
} }
} }
@ -1112,9 +1139,9 @@ void P_RestoreMusic(player_t *player)
return; return;
S_SpeedMusic(1.0f); S_SpeedMusic(1.0f);
if (player->powers[pw_super] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC)) if (player->powers[pw_super] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC))
S_ChangeMusicInternal("supers", true); S_ChangeMusicInternal("_super", true);
else if (player->powers[pw_invulnerability] > 1) else if (player->powers[pw_invulnerability] > 1)
S_ChangeMusicInternal((mariomode) ? "minvnc" : "invinc", false); S_ChangeMusicInternal((mariomode) ? "_minv" : "_inv", false);
else if (player->powers[pw_sneakers] > 1 && !player->powers[pw_super]) else if (player->powers[pw_sneakers] > 1 && !player->powers[pw_super])
{ {
if (mapheaderinfo[gamemap-1]->levelflags & LF_SPEEDMUSIC) if (mapheaderinfo[gamemap-1]->levelflags & LF_SPEEDMUSIC)
@ -1123,7 +1150,7 @@ void P_RestoreMusic(player_t *player)
S_ChangeMusic(mapmusname, mapmusflags, true); S_ChangeMusic(mapmusname, mapmusflags, true);
} }
else else
S_ChangeMusicInternal("shoes", true); S_ChangeMusicInternal("_shoes", true);
} }
else else
S_ChangeMusic(mapmusname, mapmusflags, true); S_ChangeMusic(mapmusname, mapmusflags, true);
@ -2054,7 +2081,7 @@ static void P_CheckUnderwaterAndSpaceTimer(player_t *player)
&& player == &players[consoleplayer]) && player == &players[consoleplayer])
{ {
S_StopMusic(); S_StopMusic();
S_ChangeMusicInternal("drown", false); S_ChangeMusicInternal("_drown", false);
} }
} }
@ -2262,14 +2289,13 @@ static void P_DoClimbing(player_t *player)
fixed_t platy; fixed_t platy;
subsector_t *glidesector; subsector_t *glidesector;
boolean climb = true; boolean climb = true;
boolean onesided = ((player->lastsidehit != -1 && player->lastlinehit != -1) && !(lines[player->lastlinehit].backsector));
platx = P_ReturnThrustX(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale)); platx = P_ReturnThrustX(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
platy = P_ReturnThrustY(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale)); platy = P_ReturnThrustY(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy); glidesector = R_IsPointInSubsector(player->mo->x + platx, player->mo->y + platy);
if (onesided || glidesector->sector != player->mo->subsector->sector) if (!glidesector || glidesector->sector != player->mo->subsector->sector)
{ {
boolean floorclimb = false; boolean floorclimb = false;
boolean thrust = false; boolean thrust = false;
@ -2277,7 +2303,7 @@ static void P_DoClimbing(player_t *player)
boolean skyclimber = false; boolean skyclimber = false;
fixed_t floorheight, ceilingheight; // ESLOPE fixed_t floorheight, ceilingheight; // ESLOPE
if (onesided) if (!glidesector)
floorclimb = true; floorclimb = true;
else else
{ {
@ -3130,72 +3156,61 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd)
mobj_t *mo = NULL; mobj_t *mo = NULL;
player->pflags |= PF_ATTACKDOWN; player->pflags |= PF_ATTACKDOWN;
#define TAKE_AMMO(player, power) \
player->powers[power]--; \
if (player->rings < 1) \
{ \
if (player->powers[power] > 0) \
player->powers[power]--; \
} \
else \
player->rings--;
if (cmd->buttons & BT_FIRENORMAL) // No powers, just a regular ring. if (cmd->buttons & BT_FIRENORMAL) // No powers, just a regular ring.
goto firenormal; //code repetition sucks. goto firenormal; //code repetition sucks.
// Bounce ring // Bounce ring
else if (player->currentweapon == WEP_BOUNCE && player->powers[pw_bouncering]) else if (player->currentweapon == WEP_BOUNCE && player->powers[pw_bouncering])
{ {
if (player->health <= 1) TAKE_AMMO(player, pw_bouncering);
return;
P_SetWeaponDelay(player, TICRATE/4); P_SetWeaponDelay(player, TICRATE/4);
mo = P_SpawnPlayerMissile(player->mo, MT_THROWNBOUNCE, MF2_BOUNCERING); mo = P_SpawnPlayerMissile(player->mo, MT_THROWNBOUNCE, MF2_BOUNCERING);
if (mo) if (mo)
mo->fuse = 3*TICRATE; // Bounce Ring time mo->fuse = 3*TICRATE; // Bounce Ring time
player->powers[pw_bouncering]--;
player->mo->health--;
player->health--;
} }
// Rail ring // Rail ring
else if (player->currentweapon == WEP_RAIL && player->powers[pw_railring]) else if (player->currentweapon == WEP_RAIL && player->powers[pw_railring])
{ {
if (player->health <= 1) TAKE_AMMO(player, pw_railring);
return;
P_SetWeaponDelay(player, (3*TICRATE)/2); P_SetWeaponDelay(player, (3*TICRATE)/2);
mo = P_SpawnPlayerMissile(player->mo, MT_REDRING, MF2_RAILRING|MF2_DONTDRAW); mo = P_SpawnPlayerMissile(player->mo, MT_REDRING, MF2_RAILRING|MF2_DONTDRAW);
// Rail has no unique thrown object, therefore its sound plays here. // Rail has no unique thrown object, therefore its sound plays here.
S_StartSound(player->mo, sfx_rail1); S_StartSound(player->mo, sfx_rail1);
player->powers[pw_railring]--;
player->mo->health--;
player->health--;
} }
// Automatic // Automatic
else if (player->currentweapon == WEP_AUTO && player->powers[pw_automaticring]) else if (player->currentweapon == WEP_AUTO && player->powers[pw_automaticring])
{ {
if (player->health <= 1) TAKE_AMMO(player, pw_automaticring);
return;
player->pflags &= ~PF_ATTACKDOWN; player->pflags &= ~PF_ATTACKDOWN;
P_SetWeaponDelay(player, 2); P_SetWeaponDelay(player, 2);
mo = P_SpawnPlayerMissile(player->mo, MT_THROWNAUTOMATIC, MF2_AUTOMATIC); mo = P_SpawnPlayerMissile(player->mo, MT_THROWNAUTOMATIC, MF2_AUTOMATIC);
player->powers[pw_automaticring]--;
player->mo->health--;
player->health--;
} }
// Explosion // Explosion
else if (player->currentweapon == WEP_EXPLODE && player->powers[pw_explosionring]) else if (player->currentweapon == WEP_EXPLODE && player->powers[pw_explosionring])
{ {
if (player->health <= 1) TAKE_AMMO(player, pw_explosionring);
return;
P_SetWeaponDelay(player, (3*TICRATE)/2); P_SetWeaponDelay(player, (3*TICRATE)/2);
mo = P_SpawnPlayerMissile(player->mo, MT_THROWNEXPLOSION, MF2_EXPLOSION); mo = P_SpawnPlayerMissile(player->mo, MT_THROWNEXPLOSION, MF2_EXPLOSION);
player->powers[pw_explosionring]--;
player->mo->health--;
player->health--;
} }
// Grenade // Grenade
else if (player->currentweapon == WEP_GRENADE && player->powers[pw_grenadering]) else if (player->currentweapon == WEP_GRENADE && player->powers[pw_grenadering])
{ {
if (player->health <= 1) TAKE_AMMO(player, pw_grenadering);
return;
P_SetWeaponDelay(player, TICRATE/3); P_SetWeaponDelay(player, TICRATE/3);
mo = P_SpawnPlayerMissile(player->mo, MT_THROWNGRENADE, MF2_EXPLOSION); mo = P_SpawnPlayerMissile(player->mo, MT_THROWNGRENADE, MF2_EXPLOSION);
@ -3205,10 +3220,6 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd)
//P_InstaThrust(mo, player->mo->angle, FixedMul(mo->info->speed, player->mo->scale)); //P_InstaThrust(mo, player->mo->angle, FixedMul(mo->info->speed, player->mo->scale));
mo->fuse = mo->info->mass; mo->fuse = mo->info->mass;
} }
player->powers[pw_grenadering]--;
player->mo->health--;
player->health--;
} }
// Scatter // Scatter
// Note: Ignores MF2_RAILRING // Note: Ignores MF2_RAILRING
@ -3218,8 +3229,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd)
angle_t shotangle = player->mo->angle; angle_t shotangle = player->mo->angle;
angle_t oldaiming = player->aiming; angle_t oldaiming = player->aiming;
if (player->health <= 1) TAKE_AMMO(player, pw_scatterring);
return;
P_SetWeaponDelay(player, (2*TICRATE)/3); P_SetWeaponDelay(player, (2*TICRATE)/3);
// Center // Center
@ -3245,10 +3255,6 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd)
player->mo->z = oldz; player->mo->z = oldz;
player->aiming = oldaiming; player->aiming = oldaiming;
player->powers[pw_scatterring]--;
player->mo->health--;
player->health--;
return; return;
} }
// No powers, just a regular ring. // No powers, just a regular ring.
@ -3272,7 +3278,7 @@ firenormal:
// Red Ring // Red Ring
else else
{ {
if (player->health <= 1) if (player->rings <= 0)
return; return;
P_SetWeaponDelay(player, TICRATE/4); P_SetWeaponDelay(player, TICRATE/4);
@ -3281,11 +3287,12 @@ firenormal:
if (mo) if (mo)
P_ColorTeamMissile(mo, player); P_ColorTeamMissile(mo, player);
player->mo->health--; player->rings--;
player->health--;
} }
} }
#undef TAKE_AMMO
if (mo) if (mo)
{ {
if (mo->flags & MF_MISSILE && mo->flags2 & MF2_RAILRING) if (mo->flags & MF_MISSILE && mo->flags2 & MF2_RAILRING)
@ -3336,7 +3343,7 @@ static void P_DoSuperStuff(player_t *player)
return; // NiGHTS Super doesn't mix with normal super return; // NiGHTS Super doesn't mix with normal super
// Does player have all emeralds? If so, flag the "Ready For Super!" // Does player have all emeralds? If so, flag the "Ready For Super!"
if ((ALL7EMERALDS(emeralds) || ALL7EMERALDS(player->powers[pw_emeralds])) && player->health > 50) if (ALL7EMERALDS(emeralds) && player->rings >= 50)
player->pflags |= PF_SUPERREADY; player->pflags |= PF_SUPERREADY;
else else
player->pflags &= ~PF_SUPERREADY; player->pflags &= ~PF_SUPERREADY;
@ -3344,7 +3351,7 @@ static void P_DoSuperStuff(player_t *player)
if (player->powers[pw_super]) if (player->powers[pw_super])
{ {
// If you're super and not Sonic, de-superize! // If you're super and not Sonic, de-superize!
if (!((ALL7EMERALDS(emeralds)) && (player->charflags & SF_SUPER)) && !(ALL7EMERALDS(player->powers[pw_emeralds]))) if (!(ALL7EMERALDS(emeralds) && player->charflags & SF_SUPER))
{ {
player->powers[pw_super] = 0; player->powers[pw_super] = 0;
P_SetPlayerMobjState(player->mo, S_PLAY_STND); P_SetPlayerMobjState(player->mo, S_PLAY_STND);
@ -3374,10 +3381,7 @@ static void P_DoSuperStuff(player_t *player)
// Deplete one ring every second while super // Deplete one ring every second while super
if ((leveltime % TICRATE == 0) && !(player->exiting)) if ((leveltime % TICRATE == 0) && !(player->exiting))
{ player->rings--;
player->health--;
player->mo->health--;
}
player->mo->color = (player->pflags & PF_GODMODE && cv_debug == 0) player->mo->color = (player->pflags & PF_GODMODE && cv_debug == 0)
? (SKINCOLOR_SUPERSILVER1 + 5*((leveltime >> 1) % 7)) // A wholesome easter egg. ? (SKINCOLOR_SUPERSILVER1 + 5*((leveltime >> 1) % 7)) // A wholesome easter egg.
@ -3394,7 +3398,7 @@ static void P_DoSuperStuff(player_t *player)
G_GhostAddColor(GHC_SUPER); G_GhostAddColor(GHC_SUPER);
// Ran out of rings while super! // Ran out of rings while super!
if (player->health <= 1 || player->exiting) if (player->rings <= 0 || player->exiting)
{ {
player->powers[pw_emeralds] = 0; // lost the power stones player->powers[pw_emeralds] = 0; // lost the power stones
P_SpawnGhostMobj(player->mo); P_SpawnGhostMobj(player->mo);
@ -3451,12 +3455,6 @@ static void P_DoSuperStuff(player_t *player)
P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); P_SetPlayerMobjState(player->mo, S_PLAY_RIDE);
break; break;
} }
if (!player->exiting)
{
player->health = 1;
player->mo->health = 1;
}
} }
// Inform the netgame that the champion has fallen in the heat of battle. // Inform the netgame that the champion has fallen in the heat of battle.
@ -3484,12 +3482,12 @@ static void P_DoSuperStuff(player_t *player)
// //
boolean P_SuperReady(player_t *player) boolean P_SuperReady(player_t *player)
{ {
if ((player->pflags & PF_SUPERREADY) && !player->powers[pw_super] && !player->powers[pw_tailsfly] if (player->pflags & PF_SUPERREADY && !player->powers[pw_super] && !player->powers[pw_tailsfly]
&& !(player->powers[pw_shield] & SH_NOSTACK) && !(player->powers[pw_shield] & SH_NOSTACK)
&& !player->powers[pw_invulnerability] && !player->powers[pw_invulnerability]
&& !(maptol & TOL_NIGHTS) // don't turn 'regular super' in nights levels && !(maptol & TOL_NIGHTS) // don't turn 'regular super' in nights levels
&& player->pflags & PF_JUMPED && player->pflags & PF_JUMPED
&& ((player->charflags & SF_SUPER) || ALL7EMERALDS(player->powers[pw_emeralds]))) && player->charflags & SF_SUPER)
return true; return true;
return false; return false;
@ -4086,13 +4084,6 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
player->pflags |= PF_GLIDING|PF_THOKKED; player->pflags |= PF_GLIDING|PF_THOKKED;
player->glidetime = 0; player->glidetime = 0;
if (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))
{
// Glide at double speed while super.
glidespeed *= 2;
player->pflags &= ~PF_THOKKED;
}
P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE); P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE);
P_InstaThrust(player->mo, player->mo->angle, FixedMul(glidespeed, player->mo->scale)); P_InstaThrust(player->mo, player->mo->angle, FixedMul(glidespeed, player->mo->scale));
player->pflags &= ~(PF_SPINNING|PF_STARTDASH); player->pflags &= ~(PF_SPINNING|PF_STARTDASH);
@ -4217,8 +4208,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
player->pflags &= ~PF_JUMPDOWN; player->pflags &= ~PF_JUMPDOWN;
// Repeat abilities, but not double jump! // Repeat abilities, but not double jump!
if ((player->charability2 == CA2_MULTIABILITY && player->charability != CA_DOUBLEJUMP) if (player->charability2 == CA2_MULTIABILITY && player->charability != CA_DOUBLEJUMP)
|| (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds])))
player->secondjump = 0; player->secondjump = 0;
else if (player->charability == CA_FLOAT && player->secondjump == 1) else if (player->charability == CA_FLOAT && player->secondjump == 1)
player->secondjump = 2; player->secondjump = 2;
@ -4462,9 +4452,6 @@ static void P_2dMovement(player_t *player)
if (cmd->forwardmove != 0) if (cmd->forwardmove != 0)
P_SetObjectMomZ(player->mo, FixedDiv(cmd->forwardmove*FRACUNIT,10*FRACUNIT), false); P_SetObjectMomZ(player->mo, FixedDiv(cmd->forwardmove*FRACUNIT,10*FRACUNIT), false);
if (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))
player->mo->momz *= 2;
player->mo->momx = 0; player->mo->momx = 0;
} }
else if (cmd->sidemove != 0 && !(player->pflags & PF_GLIDING || player->exiting else if (cmd->sidemove != 0 && !(player->pflags & PF_GLIDING || player->exiting
@ -4662,11 +4649,7 @@ static void P_3dMovement(player_t *player)
if (player->climbing) if (player->climbing)
{ {
if (cmd->forwardmove) if (cmd->forwardmove)
{
P_SetObjectMomZ(player->mo, FixedDiv(cmd->forwardmove*FRACUNIT, 10*FRACUNIT), false); P_SetObjectMomZ(player->mo, FixedDiv(cmd->forwardmove*FRACUNIT, 10*FRACUNIT), false);
if (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))
player->mo->momz *= 2;
}
} }
else if (!analogmove else if (!analogmove
&& cmd->forwardmove != 0 && !(player->pflags & PF_GLIDING || player->exiting && cmd->forwardmove != 0 && !(player->pflags & PF_GLIDING || player->exiting
@ -4700,12 +4683,7 @@ static void P_3dMovement(player_t *player)
} }
// Sideways movement // Sideways movement
if (player->climbing) if (player->climbing)
{ P_InstaThrust(player->mo, player->mo->angle-ANGLE_90, FixedMul(FixedDiv(cmd->sidemove*FRACUNIT, 10*FRACUNIT), player->mo->scale));
if (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))
P_InstaThrust(player->mo, player->mo->angle-ANGLE_90, FixedMul(FixedDiv(cmd->sidemove*FRACUNIT, 5*FRACUNIT), player->mo->scale));
else
P_InstaThrust(player->mo, player->mo->angle-ANGLE_90, FixedMul(FixedDiv(cmd->sidemove*FRACUNIT, 10*FRACUNIT), player->mo->scale));
}
// Analog movement control // Analog movement control
else if (analogmove) else if (analogmove)
{ {
@ -5434,12 +5412,10 @@ static void P_DoNiGHTSCapsule(player_t *player)
if (G_IsSpecialStage(gamemap)) if (G_IsSpecialStage(gamemap))
{ // In special stages, share rings. Everyone gives up theirs to the capsule player always, because we can't have any individualism here! { // In special stages, share rings. Everyone gives up theirs to the capsule player always, because we can't have any individualism here!
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && (&players[i] != player) && players[i].mo->health > 1) if (playeringame[i] && (&players[i] != player) && players[i].rings > 0)
{ {
player->mo->health += players[i].mo->health-1; player->rings += players[i].rings;
player->health = player->mo->health; players[i].rings = 0;
players[i].mo->health = 1;
players[i].health = players[i].mo->health;
} }
} }
@ -5448,10 +5424,9 @@ static void P_DoNiGHTSCapsule(player_t *player)
&& player->mo->y == player->capsule->y && player->mo->y == player->capsule->y
&& player->mo->z == player->capsule->z+(player->capsule->height/3)) && player->mo->z == player->capsule->z+(player->capsule->height/3))
{ {
if (player->mo->health > 1) if (player->rings > 0)
{ {
player->mo->health--; player->rings--;
player->health--;
player->capsule->health--; player->capsule->health--;
player->capsule->extravalue1++; player->capsule->extravalue1++;
@ -5621,7 +5596,7 @@ static void P_NiGHTSMovement(player_t *player)
} }
else if (P_IsLocalPlayer(player) && player->nightstime == 10*TICRATE) else if (P_IsLocalPlayer(player) && player->nightstime == 10*TICRATE)
// S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH // S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH
S_ChangeMusicInternal("drown",false); S_ChangeMusicInternal("_drown",false);
if (player->mo->z < player->mo->floorz) if (player->mo->z < player->mo->floorz)
@ -6143,7 +6118,7 @@ static void P_PlayerDropWeapon(player_t *player)
if (mo) if (mo)
{ {
player->mo->health--; player->rings--;
P_InstaThrust(mo, player->mo->angle-ANGLE_180, 8*FRACUNIT); P_InstaThrust(mo, player->mo->angle-ANGLE_180, 8*FRACUNIT);
P_SetObjectMomZ(mo, 4*FRACUNIT, false); P_SetObjectMomZ(mo, 4*FRACUNIT, false);
mo->flags2 |= MF2_DONTRESPAWN; mo->flags2 |= MF2_DONTRESPAWN;
@ -6446,7 +6421,7 @@ static void P_MovePlayer(player_t *player)
if (playeringame[i]) if (playeringame[i])
players[i].exiting = (14*TICRATE)/5 + 1; players[i].exiting = (14*TICRATE)/5 + 1;
} }
else if (player->health > 1) else if (player->rings > 0)
P_DamageMobj(player->mo, NULL, NULL, 1, 0); P_DamageMobj(player->mo, NULL, NULL, 1, 0);
player->pflags &= ~PF_NIGHTSFALL; player->pflags &= ~PF_NIGHTSFALL;
} }
@ -6603,8 +6578,8 @@ static void P_MovePlayer(player_t *player)
P_ResetPlayer(player); // down, stop gliding. P_ResetPlayer(player); // down, stop gliding.
if (onground) if (onground)
P_SetPlayerMobjState(player->mo, S_PLAY_WALK); P_SetPlayerMobjState(player->mo, S_PLAY_WALK);
else if ((player->charability2 == CA2_MULTIABILITY) else if (player->charability2 == CA2_MULTIABILITY
|| (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && player->charability == CA_GLIDEANDCLIMB)) && player->charability == CA_GLIDEANDCLIMB)
{ {
player->pflags |= PF_JUMPED; player->pflags |= PF_JUMPED;
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
@ -6857,11 +6832,6 @@ static void P_MovePlayer(player_t *player)
{ {
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super]) if ((player->powers[pw_shield] & SH_NOSTACK) == SH_JUMP && !player->powers[pw_super])
P_DoJumpShield(player); P_DoJumpShield(player);
else if (player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]) && player->charability == CA_FLY)
{
P_DoJumpShield(player);
player->mo->momz *= 2;
}
} }
// Bomb shield activation // Bomb shield activation
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_BOMB) if ((player->powers[pw_shield] & SH_NOSTACK) == SH_BOMB)
@ -7458,12 +7428,12 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius)
mo->flags |= MF_SPECIAL|MF_SHOOTABLE; mo->flags |= MF_SPECIAL|MF_SHOOTABLE;
if (mo->type == MT_EGGGUARD && mo->tracer) //nuke Egg Guard's shield! if (mo->type == MT_EGGGUARD && mo->tracer) //nuke Egg Guard's shield!
P_KillMobj(mo->tracer, inflictor, source, 0); P_KillMobj(mo->tracer, inflictor, source, DMG_NUKE);
if (mo->flags & MF_BOSS || mo->type == MT_PLAYER) //don't OHKO bosses nor players! if (mo->flags & MF_BOSS || mo->type == MT_PLAYER) //don't OHKO bosses nor players!
P_DamageMobj(mo, inflictor, source, 1, 0); P_DamageMobj(mo, inflictor, source, 1, DMG_NUKE);
else else
P_DamageMobj(mo, inflictor, source, 1000, 0); P_DamageMobj(mo, inflictor, source, 1000, DMG_NUKE);
} }
} }
@ -8652,7 +8622,7 @@ void P_PlayerThink(player_t *player)
#endif #endif
// todo: Figure out what is actually causing these problems in the first place... // todo: Figure out what is actually causing these problems in the first place...
if ((player->health <= 0 || player->mo->health <= 0) && player->playerstate == PST_LIVE) //you should be DEAD! if (player->mo->health <= 0 && player->playerstate == PST_LIVE) //you should be DEAD!
{ {
CONS_Debug(DBG_GAMELOGIC, "P_PlayerThink: Player %s in PST_LIVE with 0 health. (\"Zombie bug\")\n", sizeu1(playeri)); CONS_Debug(DBG_GAMELOGIC, "P_PlayerThink: Player %s in PST_LIVE with 0 health. (\"Zombie bug\")\n", sizeu1(playeri));
player->playerstate = PST_DEAD; player->playerstate = PST_DEAD;
@ -8745,14 +8715,14 @@ void P_PlayerThink(player_t *player)
if (countdown == 11*TICRATE - 1) if (countdown == 11*TICRATE - 1)
{ {
if (P_IsLocalPlayer(player)) if (P_IsLocalPlayer(player))
S_ChangeMusicInternal("drown", false); S_ChangeMusicInternal("_drown", false);
} }
// If you've hit the countdown and you haven't made // If you've hit the countdown and you haven't made
// it to the exit, you're a goner! // it to the exit, you're a goner!
else if (countdown == 1 && !player->exiting && player->lives > 0) else if (countdown == 1 && !player->exiting && player->lives > 0)
{ {
if (netgame && player->health > 0) if (netgame && player->mo->health > 0)
CONS_Printf(M_GetText("%s ran out of time.\n"), player_names[player-players]); CONS_Printf(M_GetText("%s ran out of time.\n"), player_names[player-players]);
player->pflags |= PF_TIMEOVER; player->pflags |= PF_TIMEOVER;
@ -8841,7 +8811,7 @@ void P_PlayerThink(player_t *player)
{ {
player->score = 0; player->score = 0;
player->mo->health = 1; player->mo->health = 1;
player->health = 1; player->rings = 0;
} }
if ((netgame || multiplayer) && player->lives <= 0) if ((netgame || multiplayer) && player->lives <= 0)
@ -9014,7 +8984,7 @@ void P_PlayerThink(player_t *player)
if (player->powers[pw_flashing] && player->powers[pw_flashing] < UINT16_MAX && ((player->pflags & PF_NIGHTSMODE) || player->powers[pw_flashing] < flashingtics)) if (player->powers[pw_flashing] && player->powers[pw_flashing] < UINT16_MAX && ((player->pflags & PF_NIGHTSMODE) || player->powers[pw_flashing] < flashingtics))
player->powers[pw_flashing]--; player->powers[pw_flashing]--;
if (player->powers[pw_tailsfly] && player->powers[pw_tailsfly] < UINT16_MAX && player->charability != CA_SWIM && !(player->powers[pw_super] && ALL7EMERALDS(player->powers[pw_emeralds]))) // tails fly counter if (player->powers[pw_tailsfly] && player->powers[pw_tailsfly] < UINT16_MAX && player->charability != CA_SWIM) // tails fly counter
player->powers[pw_tailsfly]--; player->powers[pw_tailsfly]--;
if (player->powers[pw_underwater] && (player->pflags & PF_GODMODE || (player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)) if (player->powers[pw_underwater] && (player->pflags & PF_GODMODE || (player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL))
@ -9330,10 +9300,6 @@ void P_PlayerAfterThink(player_t *player)
if (player->currentweapon == WEP_RAIL && (!(player->ringweapons & RW_RAIL) || !player->powers[pw_railring])) if (player->currentweapon == WEP_RAIL && (!(player->ringweapons & RW_RAIL) || !player->powers[pw_railring]))
player->currentweapon = 0; player->currentweapon = 0;
// If you're out of rings, but have Infinity Rings left, switch to that.
if (player->currentweapon != 0 && player->health <= 1 && player->powers[pw_infinityring])
player->currentweapon = 0;
if (P_IsLocalPlayer(player) && (player->pflags & PF_WPNDOWN) && player->currentweapon != oldweapon) if (P_IsLocalPlayer(player) && (player->pflags & PF_WPNDOWN) && player->currentweapon != oldweapon)
S_StartSound(NULL, sfx_wepchg); S_StartSound(NULL, sfx_wepchg);

View File

@ -263,7 +263,7 @@ static UINT8 *R_GenerateTexture(size_t texnum)
texturememory += blocksize; texturememory += blocksize;
block = Z_Malloc(blocksize+1, PU_STATIC, &texturecache[texnum]); block = Z_Malloc(blocksize+1, PU_STATIC, &texturecache[texnum]);
memset(block, 0xF7, blocksize+1); // Transparency hack memset(block, 0xFF, blocksize+1); // Transparency hack
// columns lookup table // columns lookup table
colofs = (UINT32 *)(void *)block; colofs = (UINT32 *)(void *)block;
@ -1542,6 +1542,9 @@ void R_InitData(void)
CONS_Printf("R_LoadTextures()...\n"); CONS_Printf("R_LoadTextures()...\n");
R_LoadTextures(); R_LoadTextures();
CONS_Printf("P_InitPicAnims()...\n");
P_InitPicAnims();
CONS_Printf("R_InitSprites()...\n"); CONS_Printf("R_InitSprites()...\n");
R_InitSpriteLumps(); R_InitSpriteLumps();
R_InitSprites(); R_InitSprites();

View File

@ -771,7 +771,7 @@ subsector_t *R_PointInSubsector(fixed_t x, fixed_t y)
} }
// //
// R_IsPointInSubsector, same as above but returns 0 if not in subsector - this does not work in opengl because of polyvertex_t // R_IsPointInSubsector, same as above but returns 0 if not in subsector
// //
subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y) subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
{ {
@ -795,7 +795,8 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
ret = &subsectors[nodenum & ~NF_SUBSECTOR]; ret = &subsectors[nodenum & ~NF_SUBSECTOR];
for (i = 0; i < ret->numlines; i++) for (i = 0; i < ret->numlines; i++)
if (R_PointOnSegSide(x, y, &segs[ret->firstline + i])) //if (R_PointOnSegSide(x, y, &segs[ret->firstline + i])) -- breaks in ogl because polyvertex_t cast over vertex pointers
if (P_PointOnLineSide(x, y, segs[ret->firstline + i].linedef) != segs[ret->firstline + i].side)
return 0; return 0;
return ret; return ret;

View File

@ -1349,7 +1349,7 @@ static void R_ProjectSprite(mobj_t *thing)
if (sortscale < linkscale) if (sortscale < linkscale)
dispoffset *= -1; // if it's physically behind, make sure it's ordered behind (if dispoffset > 0) dispoffset *= -1; // if it's physically behind, make sure it's ordered behind (if dispoffset > 0)
sortscale = linkscale; // now make sure it's linked sortscale = linkscale; // now make sure it's linked
} }
// PORTAL SPRITE CLIPPING // PORTAL SPRITE CLIPPING

View File

@ -411,6 +411,7 @@ void SCR_DisplayTicRate(void)
tic_t ontic = I_GetTime(); tic_t ontic = I_GetTime();
tic_t totaltics = 0; tic_t totaltics = 0;
INT32 ticcntcolor = 0; INT32 ticcntcolor = 0;
INT32 offs = (cv_debug ? 8 : 0);
for (i = lasttic + 1; i < TICRATE+lasttic && i < ontic; ++i) for (i = lasttic + 1; i < TICRATE+lasttic && i < ontic; ++i)
fpsgraph[i % TICRATE] = false; fpsgraph[i % TICRATE] = false;
@ -424,9 +425,9 @@ void SCR_DisplayTicRate(void)
if (totaltics <= TICRATE/2) ticcntcolor = V_REDMAP; if (totaltics <= TICRATE/2) ticcntcolor = V_REDMAP;
else if (totaltics == TICRATE) ticcntcolor = V_GREENMAP; else if (totaltics == TICRATE) ticcntcolor = V_GREENMAP;
V_DrawString(vid.width-(24*vid.dupx), vid.height-(16*vid.dupy), V_DrawString(vid.width-((24+(6*offs))*vid.dupx), vid.height-((16-offs)*vid.dupy),
V_YELLOWMAP|V_NOSCALESTART, "FPS"); V_YELLOWMAP|V_NOSCALESTART, "FPS");
V_DrawString(vid.width-(40*vid.dupx), vid.height-( 8*vid.dupy), V_DrawString(vid.width-(40*vid.dupx), vid.height-(8*vid.dupy),
ticcntcolor|V_NOSCALESTART, va("%02d/%02u", totaltics, TICRATE)); ticcntcolor|V_NOSCALESTART, va("%02d/%02u", totaltics, TICRATE));
lasttic = ontic; lasttic = ontic;

View File

@ -2647,6 +2647,47 @@ INT32 I_PutEnv(char *variable)
#endif #endif
} }
INT32 I_ClipboardCopy(const char *data, size_t size)
{
char storage[256];
if (size > 255)
size = 255;
memcpy(storage, data, size);
storage[size] = 0;
if (SDL_SetClipboardText(storage))
return 0;
return -1;
}
const char *I_ClipboardPaste(void)
{
static char clipboard_modified[256];
char *clipboard_contents, *i = clipboard_modified;
if (!SDL_HasClipboardText())
return NULL;
clipboard_contents = SDL_GetClipboardText();
memcpy(clipboard_modified, clipboard_contents, 255);
SDL_free(clipboard_contents);
clipboard_modified[255] = 0;
while (*i)
{
if (*i == '\n' || *i == '\r')
{ // End on newline
*i = 0;
break;
}
else if (*i == '\t')
*i = ' '; // Tabs become spaces
else if (*i < 32 || (unsigned)*i > 127)
*i = '?'; // Nonprintable chars become question marks
++i;
}
return (const char *)&clipboard_modified;
}
/** \brief The isWadPathOk function /** \brief The isWadPathOk function
\param path string path to check \param path string path to check

View File

@ -220,7 +220,7 @@ static Mix_Chunk *ds2chunk(void *stream)
break; break;
default: // convert arbitrary hz to 44100. default: // convert arbitrary hz to 44100.
step = 0; step = 0;
frac = ((UINT32)freq << FRACBITS) / 44100; frac = ((UINT32)freq << FRACBITS) / 44100 + 1; //Add 1 to counter truncation.
while (i < samples) while (i < samples)
{ {
o = (INT16)(*s+0x80)<<8; // changed signedness and shift up to 16 bits o = (INT16)(*s+0x80)<<8; // changed signedness and shift up to 16 bits

View File

@ -24,7 +24,6 @@ boolean OglSdlSurface(INT32 w, INT32 h);
void OglSdlFinishUpdate(boolean vidwait); void OglSdlFinishUpdate(boolean vidwait);
extern SDL_Window *window;
extern SDL_Renderer *renderer; extern SDL_Renderer *renderer;
extern SDL_GLContext sdlglcontext; extern SDL_GLContext sdlglcontext;
extern Uint16 realwidth; extern Uint16 realwidth;

View File

@ -71,4 +71,7 @@ void I_GetConsoleEvents(void);
void SDLforceUngrabMouse(void); void SDLforceUngrabMouse(void);
// Needed for some WIN32 functions
extern SDL_Window *window;
#endif #endif

View File

@ -2666,6 +2666,18 @@ INT32 I_PutEnv(char *variable)
#endif #endif
} }
INT32 I_ClipboardCopy(const char *data, size_t size)
{
(void)data;
(void)size;
return -1;
}
char *I_ClipboardPaste(void)
{
return NULL;
}
/** \brief The isWadPathOk function /** \brief The isWadPathOk function
\param path string path to check \param path string path to check

View File

@ -288,15 +288,15 @@ void ST_LoadGraphics(void)
scatterring = W_CachePatchName("SCATIND", PU_HUDGFX); scatterring = W_CachePatchName("SCATIND", PU_HUDGFX);
grenadering = W_CachePatchName("GRENIND", PU_HUDGFX); grenadering = W_CachePatchName("GRENIND", PU_HUDGFX);
railring = W_CachePatchName("RAILIND", PU_HUDGFX); railring = W_CachePatchName("RAILIND", PU_HUDGFX);
jumpshield = W_CachePatchName("WHTVB0", PU_HUDGFX); jumpshield = W_CachePatchName("TVWWC0", PU_HUDGFX);
forceshield = W_CachePatchName("BLTVB0", PU_HUDGFX); forceshield = W_CachePatchName("TVFOC0", PU_HUDGFX);
ringshield = W_CachePatchName("YLTVB0", PU_HUDGFX); ringshield = W_CachePatchName("TVATC0", PU_HUDGFX);
watershield = W_CachePatchName("ELTVB0", PU_HUDGFX); watershield = W_CachePatchName("TVELC0", PU_HUDGFX);
bombshield = W_CachePatchName("BKTVB0", PU_HUDGFX); bombshield = W_CachePatchName("TVARC0", PU_HUDGFX);
pityshield = W_CachePatchName("GRTVB0", PU_HUDGFX); pityshield = W_CachePatchName("TVPIC0", PU_HUDGFX);
invincibility = W_CachePatchName("PINVB0", PU_HUDGFX); invincibility = W_CachePatchName("TVIVC0", PU_HUDGFX);
sneakers = W_CachePatchName("SHTVB0", PU_HUDGFX); sneakers = W_CachePatchName("TVSSC0", PU_HUDGFX);
gravboots = W_CachePatchName("GBTVB0", PU_HUDGFX); gravboots = W_CachePatchName("TVGVC0", PU_HUDGFX);
tagico = W_CachePatchName("TAGICO", PU_HUDGFX); tagico = W_CachePatchName("TAGICO", PU_HUDGFX);
rflagico = W_CachePatchName("RFLAGICO", PU_HUDGFX); rflagico = W_CachePatchName("RFLAGICO", PU_HUDGFX);
@ -546,19 +546,26 @@ static void ST_DrawNightsOverlayNum(INT32 x /* right border */, INT32 y, INT32 a
static void ST_drawDebugInfo(void) static void ST_drawDebugInfo(void)
{ {
INT32 height = 192; INT32 height = 192;
INT32 dist = 8;
if (!stplyr->mo) if (!(stplyr->mo && cv_debug))
return; return;
if (cv_ticrate.value)
{
height -= 12;
dist >>= 1;
}
if (cv_debug & DBG_BASIC) if (cv_debug & DBG_BASIC)
{ {
const fixed_t d = AngleFixed(stplyr->mo->angle); const fixed_t d = AngleFixed(stplyr->mo->angle);
V_DrawRightAlignedString(320, 168, V_MONOSPACE, va("X: %6d", stplyr->mo->x>>FRACBITS)); V_DrawRightAlignedString(320, height - 24, V_MONOSPACE, va("X: %6d", stplyr->mo->x>>FRACBITS));
V_DrawRightAlignedString(320, 176, V_MONOSPACE, va("Y: %6d", stplyr->mo->y>>FRACBITS)); V_DrawRightAlignedString(320, height - 16, V_MONOSPACE, va("Y: %6d", stplyr->mo->y>>FRACBITS));
V_DrawRightAlignedString(320, 184, V_MONOSPACE, va("Z: %6d", stplyr->mo->z>>FRACBITS)); V_DrawRightAlignedString(320, height - 8, V_MONOSPACE, va("Z: %6d", stplyr->mo->z>>FRACBITS));
V_DrawRightAlignedString(320, 192, V_MONOSPACE, va("A: %6d", FixedInt(d))); V_DrawRightAlignedString(320, height, V_MONOSPACE, va("A: %6d", FixedInt(d)));
height = 152; height -= (32+dist);
} }
if (cv_debug & DBG_DETAILED) if (cv_debug & DBG_DETAILED)
@ -569,11 +576,12 @@ static void ST_drawDebugInfo(void)
V_DrawRightAlignedString(320, height - 80, V_MONOSPACE, va("AIR: %4d, %3d", stplyr->powers[pw_underwater], stplyr->powers[pw_spacetime])); V_DrawRightAlignedString(320, height - 80, V_MONOSPACE, va("AIR: %4d, %3d", stplyr->powers[pw_underwater], stplyr->powers[pw_spacetime]));
// Flags // Flags
V_DrawRightAlignedString(304-64, height - 72, V_MONOSPACE, "Flags:"); V_DrawRightAlignedString(304-74, height - 72, V_MONOSPACE, "PF:");
V_DrawString(304-60, height - 72, (stplyr->jumping) ? V_GREENMAP : V_REDMAP, "JM"); V_DrawString(304-72, height - 72, (stplyr->jumping) ? V_GREENMAP : V_REDMAP, "JM");
V_DrawString(304-40, height - 72, (stplyr->pflags & PF_JUMPED) ? V_GREENMAP : V_REDMAP, "JD"); V_DrawString(304-54, height - 72, (stplyr->pflags & PF_JUMPED) ? V_GREENMAP : V_REDMAP, "JD");
V_DrawString(304-20, height - 72, (stplyr->pflags & PF_SPINNING) ? V_GREENMAP : V_REDMAP, "SP"); V_DrawString(304-36, height - 72, (stplyr->pflags & PF_SPINNING) ? V_GREENMAP : V_REDMAP, "SP");
V_DrawString(304, height - 72, (stplyr->pflags & PF_STARTDASH) ? V_GREENMAP : V_REDMAP, "ST"); V_DrawString(304-18, height - 72, (stplyr->pflags & PF_STARTDASH) ? V_GREENMAP : V_REDMAP, "ST");
V_DrawString(304, height - 72, (stplyr->pflags & PF_THOKKED) ? V_GREENMAP : V_REDMAP, "TH");
V_DrawRightAlignedString(320, height - 64, V_MONOSPACE, va("CEILZ: %6d", stplyr->mo->ceilingz>>FRACBITS)); V_DrawRightAlignedString(320, height - 64, V_MONOSPACE, va("CEILZ: %6d", stplyr->mo->ceilingz>>FRACBITS));
V_DrawRightAlignedString(320, height - 56, V_MONOSPACE, va("FLOORZ: %6d", stplyr->mo->floorz>>FRACBITS)); V_DrawRightAlignedString(320, height - 56, V_MONOSPACE, va("FLOORZ: %6d", stplyr->mo->floorz>>FRACBITS));
@ -587,7 +595,7 @@ static void ST_drawDebugInfo(void)
V_DrawRightAlignedString(320, height - 8, V_MONOSPACE, va("MOMZ: %6d", stplyr->mo->momz>>FRACBITS)); V_DrawRightAlignedString(320, height - 8, V_MONOSPACE, va("MOMZ: %6d", stplyr->mo->momz>>FRACBITS));
V_DrawRightAlignedString(320, height, V_MONOSPACE, va("SPEED: %6d", stplyr->speed>>FRACBITS)); V_DrawRightAlignedString(320, height, V_MONOSPACE, va("SPEED: %6d", stplyr->speed>>FRACBITS));
height -= 120; height -= (112+dist);
} }
if (cv_debug & DBG_RANDOMIZER) // randomizer testing if (cv_debug & DBG_RANDOMIZER) // randomizer testing
@ -600,12 +608,12 @@ static void ST_drawDebugInfo(void)
V_DrawRightAlignedString(320, height - 8, V_MONOSPACE, va("Seed: %08x", P_GetRandSeed())); V_DrawRightAlignedString(320, height - 8, V_MONOSPACE, va("Seed: %08x", P_GetRandSeed()));
V_DrawRightAlignedString(320, height, V_MONOSPACE, va("== : .%04d", peekres)); V_DrawRightAlignedString(320, height, V_MONOSPACE, va("== : .%04d", peekres));
height -= 32; height -= (24+dist);
} }
if (cv_debug & DBG_MEMORY) if (cv_debug & DBG_MEMORY)
{ {
V_DrawRightAlignedString(320, height, V_MONOSPACE, va("Heap used: %7sKB", sizeu1(Z_TagsUsage(0, INT32_MAX)>>10))); V_DrawRightAlignedString(320, height, V_MONOSPACE, va("Heap: %7sKB", sizeu1(Z_TagsUsage(0, INT32_MAX)>>10)));
} }
} }
@ -664,9 +672,9 @@ static void ST_drawTime(void)
static inline void ST_drawRings(void) static inline void ST_drawRings(void)
{ {
INT32 ringnum = max(stplyr->health-1, 0); INT32 ringnum = max(stplyr->rings, 0);
ST_DrawPatchFromHudWS(HUD_RINGS, ((stplyr->health <= 1 && leveltime/5 & 1) ? rrings : sborings)); ST_DrawPatchFromHudWS(HUD_RINGS, ((stplyr->rings <= 0 && leveltime/5 & 1) ? rrings : sborings));
if (objectplacing) if (objectplacing)
ringnum = op_currentdoomednum; ringnum = op_currentdoomednum;
@ -675,8 +683,8 @@ static inline void ST_drawRings(void)
INT32 i; INT32 i;
ringnum = 0; ringnum = 0;
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo && players[i].mo->health > 1) if (playeringame[i] && players[i].mo && players[i].rings > 0)
ringnum += players[i].mo->health - 1; ringnum += players[i].rings;
} }
ST_DrawNumFromHudWS(HUD_RINGSNUM, ringnum); ST_DrawNumFromHudWS(HUD_RINGSNUM, ringnum);
@ -1145,11 +1153,11 @@ static void ST_drawNiGHTSHUD(void)
INT32 i; INT32 i;
total_ringcount = 0; total_ringcount = 0;
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] /*&& players[i].pflags & PF_NIGHTSMODE*/ && players[i].health) if (playeringame[i] /*&& players[i].pflags & PF_NIGHTSMODE*/ && players[i].rings)
total_ringcount += players[i].health - 1; total_ringcount += players[i].rings;
} }
else else
total_ringcount = stplyr->health-1; total_ringcount = stplyr->rings;
if (stplyr->capsule) if (stplyr->capsule)
{ {
@ -1361,7 +1369,7 @@ static void ST_drawWeaponRing(powertype_t weapon, INT32 rwflag, INT32 wepflag, I
txtflags |= V_YELLOWMAP; txtflags |= V_YELLOWMAP;
if (weapon == pw_infinityring if (weapon == pw_infinityring
|| (stplyr->ringweapons & rwflag && stplyr->health > 1)) || (stplyr->ringweapons & rwflag))
txtflags |= V_20TRANS; txtflags |= V_20TRANS;
else else
{ {
@ -1399,7 +1407,7 @@ static void ST_drawMatchHUD(void)
if (stplyr->powers[pw_infinityring]) if (stplyr->powers[pw_infinityring])
ST_drawWeaponRing(pw_infinityring, 0, 0, offset, infinityring); ST_drawWeaponRing(pw_infinityring, 0, 0, offset, infinityring);
else if (stplyr->health > 1) else if (stplyr->rings > 0)
V_DrawScaledPatch(8 + offset, STRINGY(162), V_SNAPTOLEFT, normring); V_DrawScaledPatch(8 + offset, STRINGY(162), V_SNAPTOLEFT, normring);
else else
V_DrawTranslucentPatch(8 + offset, STRINGY(162), V_SNAPTOLEFT|V_80TRANS, normring); V_DrawTranslucentPatch(8 + offset, STRINGY(162), V_SNAPTOLEFT|V_80TRANS, normring);

View File

@ -774,43 +774,51 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
if (!screens[0]) if (!screens[0])
return; return;
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT) if (c & V_NOSCALESTART)
{ // Clear the entire screen, from dest to deststop. Yes, this really works.
memset(screens[0], (UINT8)(c&255), vid.width * vid.height * vid.bpp);
return;
}
dest = screens[0] + y*dupy*vid.width + x*dupx;
deststop = screens[0] + vid.rowbytes * vid.height;
if (w == BASEVIDWIDTH)
w = vid.width;
else
w *= dupx;
if (h == BASEVIDHEIGHT)
h = vid.height;
else
h *= dupy;
if (x && y && x + w < vid.width && y + h < vid.height)
{ {
// Center it if necessary dest = screens[0] + y*vid.width + x;
if (vid.width != BASEVIDWIDTH * dupx) deststop = screens[0] + vid.rowbytes * vid.height;
{ }
// dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx, else
// so center this imaginary screen {
if (c & V_SNAPTORIGHT) if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
dest += (vid.width - (BASEVIDWIDTH * dupx)); { // Clear the entire screen, from dest to deststop. Yes, this really works.
else if (!(c & V_SNAPTOLEFT)) memset(screens[0], (UINT8)(c&255), vid.width * vid.height * vid.bpp);
dest += (vid.width - (BASEVIDWIDTH * dupx)) / 2; return;
} }
if (vid.height != BASEVIDHEIGHT * dupy)
dest = screens[0] + y*dupy*vid.width + x*dupx;
deststop = screens[0] + vid.rowbytes * vid.height;
if (w == BASEVIDWIDTH)
w = vid.width;
else
w *= dupx;
if (h == BASEVIDHEIGHT)
h = vid.height;
else
h *= dupy;
if (x && y && x + w < vid.width && y + h < vid.height)
{ {
// same thing here // Center it if necessary
if (c & V_SNAPTOBOTTOM) if (vid.width != BASEVIDWIDTH * dupx)
dest += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width; {
else if (!(c & V_SNAPTOTOP)) // dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx,
dest += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width / 2; // so center this imaginary screen
if (c & V_SNAPTORIGHT)
dest += (vid.width - (BASEVIDWIDTH * dupx));
else if (!(c & V_SNAPTOLEFT))
dest += (vid.width - (BASEVIDWIDTH * dupx)) / 2;
}
if (vid.height != BASEVIDHEIGHT * dupy)
{
// same thing here
if (c & V_SNAPTOBOTTOM)
dest += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width;
else if (!(c & V_SNAPTOTOP))
dest += (vid.height - (BASEVIDHEIGHT * dupy)) * vid.width / 2;
}
} }
} }
@ -968,45 +976,38 @@ void V_DrawFadeScreen(void)
} }
// Simple translucency with one color, over a set number of lines starting from the top. // Simple translucency with one color, over a set number of lines starting from the top.
void V_DrawFadeConsBack(INT32 plines, INT32 pcolor) void V_DrawFadeConsBack(INT32 plines)
{ {
UINT8 *deststop, *colormap, *buf; UINT8 *deststop, *buf;
#ifdef HWRENDER // not win32 only 19990829 by Kin #ifdef HWRENDER // not win32 only 19990829 by Kin
if (rendermode != render_soft && rendermode != render_none) if (rendermode != render_soft && rendermode != render_none)
{ {
UINT32 hwcolor; UINT32 hwcolor;
switch (pcolor) switch (cons_backcolor.value)
{ {
case 0: hwcolor = 0xffffff00; break; //white case 0: hwcolor = 0xffffff00; break; // White
case 1: hwcolor = 0xff800000; break; //orange case 1: hwcolor = 0x80808000; break; // Gray
case 2: hwcolor = 0x0000ff00; break; //blue case 2: hwcolor = 0x40201000; break; // Brown
case 3: hwcolor = 0x00800000; break; //green case 3: hwcolor = 0xff000000; break; // Red
case 4: hwcolor = 0x80808000; break; //gray case 4: hwcolor = 0xff800000; break; // Orange
case 5: hwcolor = 0xff000000; break; //red case 5: hwcolor = 0x80800000; break; // Yellow
default: hwcolor = 0x00800000; break; //green case 6: hwcolor = 0x00800000; break; // Green
case 7: hwcolor = 0x0000ff00; break; // Blue
case 8: hwcolor = 0x4080ff00; break; // Cyan
// Default green
default: hwcolor = 0x00800000; break;
} }
HWR_DrawConsoleBack(hwcolor, plines); HWR_DrawConsoleBack(hwcolor, plines);
return; return;
} }
#endif #endif
switch (pcolor)
{
case 0: colormap = cwhitemap; break;
case 1: colormap = corangemap; break;
case 2: colormap = cbluemap; break;
case 3: colormap = cgreenmap; break;
case 4: colormap = cgraymap; break;
case 5: colormap = credmap; break;
default: colormap = cgreenmap; break;
}
// heavily simplified -- we don't need to know x or y position, // heavily simplified -- we don't need to know x or y position,
// just the stop position // just the stop position
deststop = screens[0] + vid.rowbytes * min(plines, vid.height); deststop = screens[0] + vid.rowbytes * min(plines, vid.height);
for (buf = screens[0]; buf < deststop; ++buf) for (buf = screens[0]; buf < deststop; ++buf)
*buf = colormap[*buf]; *buf = consolebgmap[*buf];
} }
// Gets string colormap, used for 0x80 color codes // Gets string colormap, used for 0x80 color codes

View File

@ -145,7 +145,7 @@ void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum);
// fade down the screen buffer before drawing the menu over // fade down the screen buffer before drawing the menu over
void V_DrawFadeScreen(void); void V_DrawFadeScreen(void);
void V_DrawFadeConsBack(INT32 plines, INT32 pcolor); void V_DrawFadeConsBack(INT32 plines);
// draw a single character // draw a single character
void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed); void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed);

View File

@ -3598,6 +3598,18 @@ INT32 I_PutEnv(char *variable)
return putenv(variable); return putenv(variable);
} }
INT32 I_ClipboardCopy(const char *data, size_t size)
{
(void)data;
(void)size;
return -1;
}
const char *I_ClipboardPaste(void)
{
return NULL;
}
typedef BOOL (WINAPI *p_IsProcessorFeaturePresent) (DWORD); typedef BOOL (WINAPI *p_IsProcessorFeaturePresent) (DWORD);
const CPUInfoFlags *I_CPUInfo(void) const CPUInfoFlags *I_CPUInfo(void)

View File

@ -3470,6 +3470,18 @@ INT32 I_PutEnv(char *variable)
return putenv(variable); return putenv(variable);
} }
INT32 I_ClipboardCopy(const char *data, size_t size)
{
(void)data;
(void)size;
return -1;
}
char *I_ClipboardPaste(void)
{
return NULL;
}
typedef BOOL (WINAPI *MyFunc3) (DWORD); typedef BOOL (WINAPI *MyFunc3) (DWORD);
const CPUInfoFlags *I_CPUInfo(void) const CPUInfoFlags *I_CPUInfo(void)

View File

@ -679,7 +679,7 @@ void Y_Ticker(void)
boolean anybonuses = false; boolean anybonuses = false;
if (!intertic) // first time only if (!intertic) // first time only
S_ChangeMusicInternal("lclear", false); // don't loop it S_ChangeMusicInternal("_clear", false); // don't loop it
if (intertic < TICRATE) // one second pause before tally begins if (intertic < TICRATE) // one second pause before tally begins
return; return;
@ -740,7 +740,7 @@ void Y_Ticker(void)
if (!intertic) // first time only if (!intertic) // first time only
{ {
S_ChangeMusicInternal("lclear", false); // don't loop it S_ChangeMusicInternal("_clear", false); // don't loop it
tallydonetic = 0; tallydonetic = 0;
} }
@ -801,7 +801,7 @@ void Y_Ticker(void)
else if (intertype == int_match || intertype == int_ctf || intertype == int_teammatch) // match else if (intertype == int_match || intertype == int_ctf || intertype == int_teammatch) // match
{ {
if (!intertic) // first time only if (!intertic) // first time only
S_ChangeMusicInternal("racent", true); // loop it S_ChangeMusicInternal("_inter", true); // loop it
// If a player has left or joined, recalculate scores. // If a player has left or joined, recalculate scores.
if (data.match.numplayers != D_NumPlayers()) if (data.match.numplayers != D_NumPlayers())
@ -810,7 +810,7 @@ void Y_Ticker(void)
else if (intertype == int_race || intertype == int_classicrace) // race else if (intertype == int_race || intertype == int_classicrace) // race
{ {
if (!intertic) // first time only if (!intertic) // first time only
S_ChangeMusicInternal("racent", true); // loop it S_ChangeMusicInternal("_inter", true); // loop it
// Don't bother recalcing for race. It doesn't make as much sense. // Don't bother recalcing for race. It doesn't make as much sense.
} }
@ -839,13 +839,13 @@ static void Y_UpdateRecordReplays(void)
if ((mainrecords[gamemap-1]->time == 0) || (players[consoleplayer].realtime < mainrecords[gamemap-1]->time)) if ((mainrecords[gamemap-1]->time == 0) || (players[consoleplayer].realtime < mainrecords[gamemap-1]->time))
mainrecords[gamemap-1]->time = players[consoleplayer].realtime; mainrecords[gamemap-1]->time = players[consoleplayer].realtime;
if ((UINT16)(players[consoleplayer].health - 1) > mainrecords[gamemap-1]->rings) if ((UINT16)(players[consoleplayer].rings) > mainrecords[gamemap-1]->rings)
mainrecords[gamemap-1]->rings = (UINT16)(players[consoleplayer].health - 1); mainrecords[gamemap-1]->rings = (UINT16)(players[consoleplayer].rings);
// Save demo! // Save demo!
bestdemo[255] = '\0'; bestdemo[255] = '\0';
lastdemo[255] = '\0'; lastdemo[255] = '\0';
G_SetDemoTime(players[consoleplayer].realtime, players[consoleplayer].score, (UINT16)(players[consoleplayer].health-1)); G_SetDemoTime(players[consoleplayer].realtime, players[consoleplayer].score, (UINT16)(players[consoleplayer].rings));
G_CheckDemoStatus(); G_CheckDemoStatus();
I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755); I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755);
@ -1435,7 +1435,7 @@ static void Y_CalculateCompetitionWinners(void)
bestat[j] = true; bestat[j] = true;
times[i] = players[i].realtime; times[i] = players[i].realtime;
rings[i] = (UINT32)max(players[i].health-1, 0); rings[i] = (UINT32)max(players[i].rings, 0);
maxrings[i] = (UINT32)players[i].totalring; maxrings[i] = (UINT32)players[i].totalring;
monitors[i] = (UINT32)players[i].numboxes; monitors[i] = (UINT32)players[i].numboxes;
scores[i] = (UINT32)min(players[i].score, 99999990); scores[i] = (UINT32)min(players[i].score, 99999990);
@ -1450,7 +1450,7 @@ static void Y_CalculateCompetitionWinners(void)
else else
bestat[0] = false; bestat[0] = false;
if (max(players[i].health-1, 0) >= max(players[j].health-1, 0)) if (max(players[i].rings, 0) >= max(players[j].rings, 0))
points[i]++; points[i]++;
else else
bestat[1] = false; bestat[1] = false;
@ -1573,7 +1573,7 @@ static void Y_SetRingBonus(player_t *player, y_bonus_t *bstruct)
{ {
strncpy(bstruct->patch, "YB_RING", sizeof(bstruct->patch)); strncpy(bstruct->patch, "YB_RING", sizeof(bstruct->patch));
bstruct->display = true; bstruct->display = true;
bstruct->points = max(0, (player->health-1) * 100); bstruct->points = max(0, (player->rings) * 100);
} }
// //
@ -1621,7 +1621,7 @@ static void Y_SetPerfectBonus(player_t *player, y_bonus_t *bstruct)
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
if (!playeringame[i]) continue; if (!playeringame[i]) continue;
sharedringtotal += players[i].health - 1; sharedringtotal += players[i].rings;
} }
if (!sharedringtotal || sharedringtotal < nummaprings) if (!sharedringtotal || sharedringtotal < nummaprings)
data.coop.gotperfbonus = 0; data.coop.gotperfbonus = 0;