mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-06-03 18:21:32 +00:00
Formatted doomclassic code with Astyle
This commit is contained in:
parent
f67a6733d9
commit
539c3a93cd
144 changed files with 35422 additions and 31476 deletions
|
@ -46,7 +46,8 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#define safeOutputDebug(x)
|
#define safeOutputDebug(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct SplitscreenData {
|
struct SplitscreenData
|
||||||
|
{
|
||||||
int PLAYERCOUNT;
|
int PLAYERCOUNT;
|
||||||
int globalSkill;
|
int globalSkill;
|
||||||
int globalEpisode;
|
int globalEpisode;
|
||||||
|
@ -55,7 +56,7 @@ struct SplitscreenData {
|
||||||
int globalFragLimit;
|
int globalFragLimit;
|
||||||
};
|
};
|
||||||
|
|
||||||
void DL_InitNetworking( DoomInterface *pdi );
|
void DL_InitNetworking( DoomInterface* pdi );
|
||||||
|
|
||||||
extern int PLAYERCOUNT;
|
extern int PLAYERCOUNT;
|
||||||
extern bool globalNetworking;
|
extern bool globalNetworking;
|
||||||
|
@ -68,7 +69,8 @@ extern int globalNeedUpsell;
|
||||||
extern bool globalPauseTime;
|
extern bool globalPauseTime;
|
||||||
|
|
||||||
|
|
||||||
enum MenuStates{
|
enum MenuStates
|
||||||
|
{
|
||||||
MENU_NONE,
|
MENU_NONE,
|
||||||
MENU_XBOX_SYSTEM,
|
MENU_XBOX_SYSTEM,
|
||||||
MENU_PAUSE,
|
MENU_PAUSE,
|
||||||
|
@ -90,10 +92,11 @@ enum MenuStates{
|
||||||
MENU_COUNT
|
MENU_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
int maxPing;
|
int maxPing;
|
||||||
|
|
||||||
const wchar_t * image;
|
const wchar_t* image;
|
||||||
} PingImage_t;
|
} PingImage_t;
|
||||||
|
|
||||||
extern PingImage_t pingsImages[];
|
extern PingImage_t pingsImages[];
|
||||||
|
|
|
@ -71,10 +71,10 @@ typedef unsigned int dword;
|
||||||
// DG: provide MAXINT seems to be available on MSVC but not MinGW,
|
// DG: provide MAXINT seems to be available on MSVC but not MinGW,
|
||||||
// so use the standard defines from limits.h
|
// so use the standard defines from limits.h
|
||||||
#ifndef MAXINT
|
#ifndef MAXINT
|
||||||
#define MAXINT INT_MAX
|
#define MAXINT INT_MAX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MININT
|
#ifndef MININT
|
||||||
#define MININT INT_MIN
|
#define MININT INT_MIN
|
||||||
#endif
|
#endif
|
||||||
// DG end
|
// DG end
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -36,18 +36,18 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
// Called by main loop.
|
// Called by main loop.
|
||||||
qboolean AM_Responder (event_t* ev);
|
qboolean AM_Responder( event_t* ev );
|
||||||
|
|
||||||
// Called by main loop.
|
// Called by main loop.
|
||||||
void AM_Ticker (void);
|
void AM_Ticker( void );
|
||||||
|
|
||||||
// Called by main loop,
|
// Called by main loop,
|
||||||
// called instead of view drawer if automap active.
|
// called instead of view drawer if automap active.
|
||||||
void AM_Drawer (void);
|
void AM_Drawer( void );
|
||||||
|
|
||||||
// Called to force the automap to quit
|
// Called to force the automap to quit
|
||||||
// if the level is completed while it is up.
|
// if the level is completed while it is up.
|
||||||
void AM_Stop (void);
|
void AM_Stop( void );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,515 +26,545 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
===========================================================================
|
===========================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
memset(::g, 0, sizeof(*::g));
|
memset( ::g, 0, sizeof( *::g ) );
|
||||||
// am_map.constructs begin //
|
// am_map.constructs begin //
|
||||||
::g->cheating = 0;
|
::g->cheating = 0;
|
||||||
::g->grid = 0;
|
::g->grid = 0;
|
||||||
::g->leveljuststarted = 1; // kluge until AM_LevelInit() is called
|
::g->leveljuststarted = 1; // kluge until AM_LevelInit() is called
|
||||||
::g->automapactive = false;
|
::g->automapactive = false;
|
||||||
::g->finit_width = SCREENWIDTH;
|
::g->finit_width = SCREENWIDTH;
|
||||||
::g->finit_height = SCREENHEIGHT - (32 * GLOBAL_IMAGE_SCALER);
|
::g->finit_height = SCREENHEIGHT - ( 32 * GLOBAL_IMAGE_SCALER );
|
||||||
::g->scale_mtof = (fixed_t)INITSCALEMTOF;
|
::g->scale_mtof = ( fixed_t )INITSCALEMTOF;
|
||||||
::g->markpointnum = 0; // next point to be assigned
|
::g->markpointnum = 0; // next point to be assigned
|
||||||
::g->followplayer = 1; // specifies whether to follow the player around
|
::g->followplayer = 1; // specifies whether to follow the player around
|
||||||
::g->stopped = true;
|
::g->stopped = true;
|
||||||
::g->lastlevel = -1;
|
::g->lastlevel = -1;
|
||||||
::g->lastepisode = -1;
|
::g->lastepisode = -1;
|
||||||
::g->cheatstate=0;
|
::g->cheatstate = 0;
|
||||||
::g->bigstate=0;
|
::g->bigstate = 0;
|
||||||
::g->nexttic = 0;
|
::g->nexttic = 0;
|
||||||
::g->litelevelscnt = 0;
|
::g->litelevelscnt = 0;
|
||||||
// am_map.constructs end //
|
// am_map.constructs end //
|
||||||
// doomstat.constructs begin //
|
// doomstat.constructs begin //
|
||||||
::g->gamemode = indetermined;
|
::g->gamemode = indetermined;
|
||||||
::g->gamemission = doom;
|
::g->gamemission = doom;
|
||||||
::g->language = english;
|
::g->language = english;
|
||||||
// doomstat.constructs end //
|
// doomstat.constructs end //
|
||||||
// d_main.constructs begin //
|
// d_main.constructs begin //
|
||||||
::g->singletics = false; // debug flag to cancel adaptiveness
|
::g->singletics = false; // debug flag to cancel adaptiveness
|
||||||
::g->oldgamestate = (gamestate_t)-1;
|
::g->oldgamestate = ( gamestate_t ) - 1;
|
||||||
::g->wipegamestate = GS_DEMOSCREEN;
|
::g->wipegamestate = GS_DEMOSCREEN;
|
||||||
::g->viewactivestate = false;
|
::g->viewactivestate = false;
|
||||||
::g->menuactivestate = false;
|
::g->menuactivestate = false;
|
||||||
::g->inhelpscreensstate = false;
|
::g->inhelpscreensstate = false;
|
||||||
::g->fullscreen = false;
|
::g->fullscreen = false;
|
||||||
::g->wipe = false;
|
::g->wipe = false;
|
||||||
::g->wipedone = true;
|
::g->wipedone = true;
|
||||||
// d_main.constructs end //
|
// d_main.constructs end //
|
||||||
// d_net.constructs begin //
|
// d_net.constructs begin //
|
||||||
doomcom_t temp_doomcom = {
|
doomcom_t temp_doomcom =
|
||||||
|
{
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
memcpy( &::g->doomcom, &temp_doomcom, sizeof(temp_doomcom) );
|
memcpy( &::g->doomcom, &temp_doomcom, sizeof( temp_doomcom ) );
|
||||||
// d_net.constructs end //
|
// d_net.constructs end //
|
||||||
// f_wipe.constructs begin //
|
// f_wipe.constructs begin //
|
||||||
::g->go = 0;
|
::g->go = 0;
|
||||||
// f_wipe.constructs end //
|
// f_wipe.constructs end //
|
||||||
// g_game.constructs begin //
|
// g_game.constructs begin //
|
||||||
::g->precache = true; // if true, load all graphics at start
|
::g->precache = true; // if true, load all graphics at start
|
||||||
fixed_t temp_forwardmove[2] = {
|
fixed_t temp_forwardmove[2] =
|
||||||
0x19, 0x32
|
{
|
||||||
|
0x19, 0x32
|
||||||
};
|
};
|
||||||
memcpy( ::g->forwardmove, temp_forwardmove, sizeof(temp_forwardmove) );
|
memcpy( ::g->forwardmove, temp_forwardmove, sizeof( temp_forwardmove ) );
|
||||||
fixed_t temp_sidemove[2] = {
|
fixed_t temp_sidemove[2] =
|
||||||
0x18, 0x28
|
{
|
||||||
|
0x18, 0x28
|
||||||
};
|
};
|
||||||
memcpy( ::g->sidemove, temp_sidemove, sizeof(temp_sidemove) );
|
memcpy( ::g->sidemove, temp_sidemove, sizeof( temp_sidemove ) );
|
||||||
fixed_t temp_angleturn[3] = {
|
fixed_t temp_angleturn[3] =
|
||||||
640, 1280, 320 // + slow turn
|
{
|
||||||
|
640, 1280, 320 // + slow turn
|
||||||
};
|
};
|
||||||
memcpy( ::g->angleturn, temp_angleturn, sizeof(temp_angleturn) );
|
memcpy( ::g->angleturn, temp_angleturn, sizeof( temp_angleturn ) );
|
||||||
::g->mousebuttons = &::g->mousearray[1]; // allow [-1]
|
::g->mousebuttons = &::g->mousearray[1]; // allow [-1]
|
||||||
::g->joybuttons = &::g->joyarray[1]; // allow [-1]
|
::g->joybuttons = &::g->joyarray[1]; // allow [-1]
|
||||||
// g_game.constructs end //
|
// g_game.constructs end //
|
||||||
// hu_lib.constructs begin //
|
// hu_lib.constructs begin //
|
||||||
::g->lastautomapactive = true;
|
::g->lastautomapactive = true;
|
||||||
// hu_lib.constructs end //
|
// hu_lib.constructs end //
|
||||||
// hu_stuff.constructs begin //
|
// hu_stuff.constructs begin //
|
||||||
::g->always_off = false;
|
::g->always_off = false;
|
||||||
::g->headsupactive = false;
|
::g->headsupactive = false;
|
||||||
::g->head = 0;
|
::g->head = 0;
|
||||||
::g->tail = 0;
|
::g->tail = 0;
|
||||||
::g->shiftdown = false;
|
::g->shiftdown = false;
|
||||||
::g->altdown = false;
|
::g->altdown = false;
|
||||||
::g->num_nobrainers = 0;
|
::g->num_nobrainers = 0;
|
||||||
// hu_stuff.constructs end //
|
// hu_stuff.constructs end //
|
||||||
// i_input.constructs begin //
|
// i_input.constructs begin //
|
||||||
// i_input.constructs end //
|
// i_input.constructs end //
|
||||||
// i_system.constructs begin //
|
// i_system.constructs begin //
|
||||||
::g->mb_used = 2;
|
::g->mb_used = 2;
|
||||||
::g->current_time = 0;
|
::g->current_time = 0;
|
||||||
// i_system.constructs end //
|
// i_system.constructs end //
|
||||||
// m_cheat.constructs begin //
|
// m_cheat.constructs begin //
|
||||||
::g->firsttime = 1;
|
::g->firsttime = 1;
|
||||||
::g->usedcheatbuffer = 0;
|
::g->usedcheatbuffer = 0;
|
||||||
// m_cheat.constructs end //
|
// m_cheat.constructs end //
|
||||||
// m_menu.constructs begin //
|
// m_menu.constructs begin //
|
||||||
|
|
||||||
menuitem_t temp_QuitMenu[3] = {
|
menuitem_t temp_QuitMenu[3] =
|
||||||
{1,"M_ACPT", M_ExitGame,'a'},
|
{
|
||||||
{1,"M_CAN", M_CancelExit,'c'},
|
{1, "M_ACPT", M_ExitGame, 'a'},
|
||||||
{1,"M_CHG", M_GameSelection,'g'}
|
{1, "M_CAN", M_CancelExit, 'c'},
|
||||||
|
{1, "M_CHG", M_GameSelection, 'g'}
|
||||||
};
|
};
|
||||||
memcpy( ::g->QuitMenu, temp_QuitMenu, sizeof(temp_QuitMenu) );
|
memcpy( ::g->QuitMenu, temp_QuitMenu, sizeof( temp_QuitMenu ) );
|
||||||
menu_t temp_QuitDef = {
|
menu_t temp_QuitDef =
|
||||||
|
{
|
||||||
qut_end, // # of menu items
|
qut_end, // # of menu items
|
||||||
&::g->MainDef, // previous menu
|
&::g->MainDef, // previous menu
|
||||||
::g->QuitMenu, // menuitem_t ->
|
::g->QuitMenu, // menuitem_t ->
|
||||||
M_DrawQuit, // drawing routine ->
|
M_DrawQuit, // drawing routine ->
|
||||||
48,63, // x,y
|
48, 63, // x,y
|
||||||
g_accept // lastOn
|
g_accept // lastOn
|
||||||
};
|
};
|
||||||
memcpy( &::g->QuitDef, &temp_QuitDef, sizeof(temp_QuitDef) );
|
memcpy( &::g->QuitDef, &temp_QuitDef, sizeof( temp_QuitDef ) );
|
||||||
|
|
||||||
menuitem_t temp_MainMenu[5]=
|
menuitem_t temp_MainMenu[5] =
|
||||||
{
|
{
|
||||||
{1,"M_NGAME",M_NewGame,'n'},
|
{1, "M_NGAME", M_NewGame, 'n'},
|
||||||
{1,"M_OPTION",M_Options,'o'},
|
{1, "M_OPTION", M_Options, 'o'},
|
||||||
{1,"M_LOADG",M_LoadGame,'l'},
|
{1, "M_LOADG", M_LoadGame, 'l'},
|
||||||
{1,"M_SAVEG",M_SaveGame,'m'},
|
{1, "M_SAVEG", M_SaveGame, 'm'},
|
||||||
// Another hickup with Special edition.
|
// Another hickup with Special edition.
|
||||||
//{1,"M_RDTHIS",M_ReadThis,'r'},
|
//{1,"M_RDTHIS",M_ReadThis,'r'},
|
||||||
{1,"M_QUITG",M_QuitDOOM,'q'}
|
{1, "M_QUITG", M_QuitDOOM, 'q'}
|
||||||
};
|
};
|
||||||
memcpy( &::g->MainMenu, temp_MainMenu, sizeof(temp_MainMenu) );
|
memcpy( &::g->MainMenu, temp_MainMenu, sizeof( temp_MainMenu ) );
|
||||||
menu_t temp_MainDef = {
|
menu_t temp_MainDef =
|
||||||
|
{
|
||||||
main_end,
|
main_end,
|
||||||
NULL,
|
NULL,
|
||||||
::g->MainMenu,
|
::g->MainMenu,
|
||||||
M_DrawMainMenu,
|
M_DrawMainMenu,
|
||||||
97,64,
|
97, 64,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
memcpy( &::g->MainDef, &temp_MainDef, sizeof(temp_MainDef) );
|
memcpy( &::g->MainDef, &temp_MainDef, sizeof( temp_MainDef ) );
|
||||||
menuitem_t temp_EpisodeMenu[4] = {
|
menuitem_t temp_EpisodeMenu[4] =
|
||||||
{1,"M_EPI1", M_Episode,'k'},
|
{
|
||||||
{1,"M_EPI2", M_Episode,'t'},
|
{1, "M_EPI1", M_Episode, 'k'},
|
||||||
{1,"M_EPI3", M_Episode,'i'},
|
{1, "M_EPI2", M_Episode, 't'},
|
||||||
{1,"M_EPI4", M_Episode,'t'}
|
{1, "M_EPI3", M_Episode, 'i'},
|
||||||
|
{1, "M_EPI4", M_Episode, 't'}
|
||||||
};
|
};
|
||||||
memcpy( ::g->EpisodeMenu, temp_EpisodeMenu, sizeof(temp_EpisodeMenu) );
|
memcpy( ::g->EpisodeMenu, temp_EpisodeMenu, sizeof( temp_EpisodeMenu ) );
|
||||||
menu_t temp_EpiDef = {
|
menu_t temp_EpiDef =
|
||||||
|
{
|
||||||
ep_end, // # of menu items
|
ep_end, // # of menu items
|
||||||
&::g->MainDef, // previous menu
|
&::g->MainDef, // previous menu
|
||||||
::g->EpisodeMenu, // menuitem_t ->
|
::g->EpisodeMenu, // menuitem_t ->
|
||||||
M_DrawEpisode, // drawing routine ->
|
M_DrawEpisode, // drawing routine ->
|
||||||
48,63, // x,y
|
48, 63, // x,y
|
||||||
ep1 // lastOn
|
ep1 // lastOn
|
||||||
};
|
};
|
||||||
memcpy( &::g->EpiDef, &temp_EpiDef, sizeof(temp_EpiDef) );
|
memcpy( &::g->EpiDef, &temp_EpiDef, sizeof( temp_EpiDef ) );
|
||||||
|
|
||||||
menuitem_t temp_ExpansionMenu[2] = {
|
menuitem_t temp_ExpansionMenu[2] =
|
||||||
{1,"M_EPI1", M_Expansion,'h'},
|
{
|
||||||
{1,"M_EPI2", M_Expansion,'n'},
|
{1, "M_EPI1", M_Expansion, 'h'},
|
||||||
|
{1, "M_EPI2", M_Expansion, 'n'},
|
||||||
};
|
};
|
||||||
memcpy( ::g->ExpansionMenu, temp_ExpansionMenu, sizeof(temp_ExpansionMenu) );
|
memcpy( ::g->ExpansionMenu, temp_ExpansionMenu, sizeof( temp_ExpansionMenu ) );
|
||||||
menu_t temp_ExpDef = {
|
menu_t temp_ExpDef =
|
||||||
|
{
|
||||||
ex_end, // # of menu items
|
ex_end, // # of menu items
|
||||||
&::g->MainDef, // previous menu
|
&::g->MainDef, // previous menu
|
||||||
::g->ExpansionMenu, // menuitem_t ->
|
::g->ExpansionMenu, // menuitem_t ->
|
||||||
M_DrawEpisode, // drawing routine ->
|
M_DrawEpisode, // drawing routine ->
|
||||||
48,63, // x,y
|
48, 63, // x,y
|
||||||
ex1 // lastOn
|
ex1 // lastOn
|
||||||
};
|
};
|
||||||
memcpy( &::g->ExpDef, &temp_ExpDef, sizeof(temp_ExpDef) );
|
memcpy( &::g->ExpDef, &temp_ExpDef, sizeof( temp_ExpDef ) );
|
||||||
|
|
||||||
menuitem_t temp_LoadExpMenu[2] = {
|
menuitem_t temp_LoadExpMenu[2] =
|
||||||
{1,"M_EPI1", M_LoadExpansion,'h'},
|
{
|
||||||
{1,"M_EPI2", M_LoadExpansion,'n'},
|
{1, "M_EPI1", M_LoadExpansion, 'h'},
|
||||||
|
{1, "M_EPI2", M_LoadExpansion, 'n'},
|
||||||
};
|
};
|
||||||
memcpy( ::g->LoadExpMenu, temp_LoadExpMenu, sizeof(temp_LoadExpMenu) );
|
memcpy( ::g->LoadExpMenu, temp_LoadExpMenu, sizeof( temp_LoadExpMenu ) );
|
||||||
menu_t temp_LoadExpDef = {
|
menu_t temp_LoadExpDef =
|
||||||
|
{
|
||||||
ex_end, // # of menu items
|
ex_end, // # of menu items
|
||||||
&::g->MainDef, // previous menu
|
&::g->MainDef, // previous menu
|
||||||
::g->LoadExpMenu, // menuitem_t ->
|
::g->LoadExpMenu, // menuitem_t ->
|
||||||
M_DrawEpisode, // drawing routine ->
|
M_DrawEpisode, // drawing routine ->
|
||||||
48,63, // x,y
|
48, 63, // x,y
|
||||||
ex1 // lastOn
|
ex1 // lastOn
|
||||||
};
|
};
|
||||||
memcpy( &::g->LoadExpDef, &temp_LoadExpDef, sizeof(temp_LoadExpDef) );
|
memcpy( &::g->LoadExpDef, &temp_LoadExpDef, sizeof( temp_LoadExpDef ) );
|
||||||
|
|
||||||
menuitem_t temp_NewGameMenu[5] = {
|
menuitem_t temp_NewGameMenu[5] =
|
||||||
{1,"M_JKILL", M_ChooseSkill, 'i'},
|
{
|
||||||
{1,"M_ROUGH", M_ChooseSkill, 'h'},
|
{1, "M_JKILL", M_ChooseSkill, 'i'},
|
||||||
{1,"M_HURT", M_ChooseSkill, 'h'},
|
{1, "M_ROUGH", M_ChooseSkill, 'h'},
|
||||||
{1,"M_ULTRA", M_ChooseSkill, 'u'},
|
{1, "M_HURT", M_ChooseSkill, 'h'},
|
||||||
{1,"M_NMARE", M_ChooseSkill, 'n'}
|
{1, "M_ULTRA", M_ChooseSkill, 'u'},
|
||||||
|
{1, "M_NMARE", M_ChooseSkill, 'n'}
|
||||||
};
|
};
|
||||||
memcpy( ::g->NewGameMenu, temp_NewGameMenu, sizeof(temp_NewGameMenu) );
|
memcpy( ::g->NewGameMenu, temp_NewGameMenu, sizeof( temp_NewGameMenu ) );
|
||||||
menu_t temp_NewDef = {
|
menu_t temp_NewDef =
|
||||||
|
{
|
||||||
newg_end, // # of menu items
|
newg_end, // # of menu items
|
||||||
&::g->EpiDef, // previous menu
|
&::g->EpiDef, // previous menu
|
||||||
::g->NewGameMenu, // menuitem_t ->
|
::g->NewGameMenu, // menuitem_t ->
|
||||||
M_DrawNewGame, // drawing routine ->
|
M_DrawNewGame, // drawing routine ->
|
||||||
48,63, // x,y
|
48, 63, // x,y
|
||||||
hurtme // lastOn
|
hurtme // lastOn
|
||||||
};
|
};
|
||||||
memcpy( &::g->NewDef, &temp_NewDef, sizeof(temp_NewDef) );
|
memcpy( &::g->NewDef, &temp_NewDef, sizeof( temp_NewDef ) );
|
||||||
menuitem_t temp_OptionsMenu[8] = {
|
menuitem_t temp_OptionsMenu[8] =
|
||||||
{1,"M_GDHIGH", M_FullScreen,'f'},
|
{
|
||||||
{1,"M_SCRNSZ", M_ChangeGPad,'m'},
|
{1, "M_GDHIGH", M_FullScreen, 'f'},
|
||||||
{1,"M_MESSG", M_ChangeMessages,'m'},
|
{1, "M_SCRNSZ", M_ChangeGPad, 'm'},
|
||||||
|
{1, "M_MESSG", M_ChangeMessages, 'm'},
|
||||||
//{1,"M_DETAIL", M_ChangeDetail,'g'},
|
//{1,"M_DETAIL", M_ChangeDetail,'g'},
|
||||||
//{2,"M_SCRNSZ", M_SizeDisplay,'s'},
|
//{2,"M_SCRNSZ", M_SizeDisplay,'s'},
|
||||||
{-1,"",0},
|
{ -1, "", 0},
|
||||||
{2,"M_MSENS", M_ChangeSensitivity,'m'},
|
{2, "M_MSENS", M_ChangeSensitivity, 'm'},
|
||||||
{-1,"",0},
|
{ -1, "", 0},
|
||||||
{1,"M_SVOL", M_Sound,'s'}
|
{1, "M_SVOL", M_Sound, 's'}
|
||||||
};
|
};
|
||||||
memcpy( ::g->OptionsMenu, temp_OptionsMenu, sizeof(temp_OptionsMenu) );
|
memcpy( ::g->OptionsMenu, temp_OptionsMenu, sizeof( temp_OptionsMenu ) );
|
||||||
menu_t temp_OptionsDef = {
|
menu_t temp_OptionsDef =
|
||||||
|
{
|
||||||
opt_end,
|
opt_end,
|
||||||
&::g->MainDef,
|
&::g->MainDef,
|
||||||
::g->OptionsMenu,
|
::g->OptionsMenu,
|
||||||
M_DrawOptions,
|
M_DrawOptions,
|
||||||
60,37,
|
60, 37,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
memcpy( &::g->OptionsDef, &temp_OptionsDef, sizeof(temp_OptionsDef) );
|
memcpy( &::g->OptionsDef, &temp_OptionsDef, sizeof( temp_OptionsDef ) );
|
||||||
menuitem_t temp_SoundMenu[4] = {
|
menuitem_t temp_SoundMenu[4] =
|
||||||
{2,"M_SFXVOL",M_SfxVol,'s'},
|
{
|
||||||
{-1,"",0},
|
{2, "M_SFXVOL", M_SfxVol, 's'},
|
||||||
{2,"M_MUSVOL",M_MusicVol,'m'},
|
{ -1, "", 0},
|
||||||
{-1,"",0}
|
{2, "M_MUSVOL", M_MusicVol, 'm'},
|
||||||
|
{ -1, "", 0}
|
||||||
};
|
};
|
||||||
memcpy( ::g->SoundMenu, temp_SoundMenu, sizeof(temp_SoundMenu) );
|
memcpy( ::g->SoundMenu, temp_SoundMenu, sizeof( temp_SoundMenu ) );
|
||||||
menu_t temp_SoundDef = {
|
menu_t temp_SoundDef =
|
||||||
|
{
|
||||||
sound_end,
|
sound_end,
|
||||||
&::g->OptionsDef,
|
&::g->OptionsDef,
|
||||||
::g->SoundMenu,
|
::g->SoundMenu,
|
||||||
M_DrawSound,
|
M_DrawSound,
|
||||||
80,64,
|
80, 64,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
memcpy( &::g->SoundDef, &temp_SoundDef, sizeof(temp_SoundDef) );
|
memcpy( &::g->SoundDef, &temp_SoundDef, sizeof( temp_SoundDef ) );
|
||||||
menuitem_t temp_LoadMenu[6] = {
|
menuitem_t temp_LoadMenu[6] =
|
||||||
{1,"", M_LoadSelect,'1'},
|
{
|
||||||
{1,"", M_LoadSelect,'2'},
|
{1, "", M_LoadSelect, '1'},
|
||||||
{1,"", M_LoadSelect,'3'},
|
{1, "", M_LoadSelect, '2'},
|
||||||
{1,"", M_LoadSelect,'4'},
|
{1, "", M_LoadSelect, '3'},
|
||||||
{1,"", M_LoadSelect,'5'},
|
{1, "", M_LoadSelect, '4'},
|
||||||
{1,"", M_LoadSelect,'6'}
|
{1, "", M_LoadSelect, '5'},
|
||||||
|
{1, "", M_LoadSelect, '6'}
|
||||||
};
|
};
|
||||||
memcpy( ::g->LoadMenu, temp_LoadMenu, sizeof(temp_LoadMenu) );
|
memcpy( ::g->LoadMenu, temp_LoadMenu, sizeof( temp_LoadMenu ) );
|
||||||
menu_t temp_LoadDef = {
|
menu_t temp_LoadDef =
|
||||||
|
{
|
||||||
load_end,
|
load_end,
|
||||||
&::g->MainDef,
|
&::g->MainDef,
|
||||||
::g->LoadMenu,
|
::g->LoadMenu,
|
||||||
M_DrawLoad,
|
M_DrawLoad,
|
||||||
80,54,
|
80, 54,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
memcpy( &::g->LoadDef, &temp_LoadDef, sizeof(temp_LoadDef) );
|
memcpy( &::g->LoadDef, &temp_LoadDef, sizeof( temp_LoadDef ) );
|
||||||
menuitem_t temp_SaveMenu[6] = {
|
menuitem_t temp_SaveMenu[6] =
|
||||||
{1,"", M_SaveSelect,'1'},
|
{
|
||||||
{1,"", M_SaveSelect,'2'},
|
{1, "", M_SaveSelect, '1'},
|
||||||
{1,"", M_SaveSelect,'3'},
|
{1, "", M_SaveSelect, '2'},
|
||||||
{1,"", M_SaveSelect,'4'},
|
{1, "", M_SaveSelect, '3'},
|
||||||
{1,"", M_SaveSelect,'5'},
|
{1, "", M_SaveSelect, '4'},
|
||||||
{1,"", M_SaveSelect,'6'}
|
{1, "", M_SaveSelect, '5'},
|
||||||
|
{1, "", M_SaveSelect, '6'}
|
||||||
};
|
};
|
||||||
memcpy( ::g->SaveMenu, temp_SaveMenu, sizeof(temp_SaveMenu) );
|
memcpy( ::g->SaveMenu, temp_SaveMenu, sizeof( temp_SaveMenu ) );
|
||||||
menu_t temp_SaveDef = {
|
menu_t temp_SaveDef =
|
||||||
|
{
|
||||||
load_end,
|
load_end,
|
||||||
&::g->MainDef,
|
&::g->MainDef,
|
||||||
::g->SaveMenu,
|
::g->SaveMenu,
|
||||||
M_DrawSave,
|
M_DrawSave,
|
||||||
80,54,
|
80, 54,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
memcpy( &::g->SaveDef, &temp_SaveDef, sizeof(temp_SaveDef) );
|
memcpy( &::g->SaveDef, &temp_SaveDef, sizeof( temp_SaveDef ) );
|
||||||
int temp_quitsounds[8] = {
|
int temp_quitsounds[8] =
|
||||||
|
{
|
||||||
sfx_pldeth,
|
sfx_pldeth,
|
||||||
sfx_dmpain,
|
sfx_dmpain,
|
||||||
sfx_popain,
|
sfx_popain,
|
||||||
sfx_slop,
|
sfx_slop,
|
||||||
sfx_telept,
|
sfx_telept,
|
||||||
sfx_posit1,
|
sfx_posit1,
|
||||||
sfx_posit3,
|
sfx_posit3,
|
||||||
sfx_sgtatk
|
sfx_sgtatk
|
||||||
};
|
};
|
||||||
memcpy( ::g->quitsounds, temp_quitsounds, sizeof(temp_quitsounds) );
|
memcpy( ::g->quitsounds, temp_quitsounds, sizeof( temp_quitsounds ) );
|
||||||
int temp_quitsounds2[8] = {
|
int temp_quitsounds2[8] =
|
||||||
|
{
|
||||||
sfx_vilact,
|
sfx_vilact,
|
||||||
sfx_getpow,
|
sfx_getpow,
|
||||||
sfx_boscub,
|
sfx_boscub,
|
||||||
sfx_slop,
|
sfx_slop,
|
||||||
sfx_skeswg,
|
sfx_skeswg,
|
||||||
sfx_kntdth,
|
sfx_kntdth,
|
||||||
sfx_bspact,
|
sfx_bspact,
|
||||||
sfx_sgtatk
|
sfx_sgtatk
|
||||||
};
|
};
|
||||||
memcpy( ::g->quitsounds2, temp_quitsounds2, sizeof(temp_quitsounds2) );
|
memcpy( ::g->quitsounds2, temp_quitsounds2, sizeof( temp_quitsounds2 ) );
|
||||||
::g->joywait = 0;
|
::g->joywait = 0;
|
||||||
::g->mousewait = 0;
|
::g->mousewait = 0;
|
||||||
::g->mmenu_mousey = 0;
|
::g->mmenu_mousey = 0;
|
||||||
::g->lasty = 0;
|
::g->lasty = 0;
|
||||||
::g->mmenu_mousex = 0;
|
::g->mmenu_mousex = 0;
|
||||||
::g->lastx = 0;
|
::g->lastx = 0;
|
||||||
// m_menu.constructs end //
|
// m_menu.constructs end //
|
||||||
// m_misc.constructs begin //
|
// m_misc.constructs begin //
|
||||||
::g->g_pszSaveFile = "\\save.dat";
|
::g->g_pszSaveFile = "\\save.dat";
|
||||||
::g->g_pszImagePath = "d:\\saveimage.xbx";
|
::g->g_pszImagePath = "d:\\saveimage.xbx";
|
||||||
::g->g_pszImageMeta = "saveimage.xbx";
|
::g->g_pszImageMeta = "saveimage.xbx";
|
||||||
extern const char* const temp_chat_macros[];
|
extern const char* const temp_chat_macros[];
|
||||||
for (int i = 0; i < 10; i++)
|
for( int i = 0; i < 10; i++ )
|
||||||
{
|
{
|
||||||
chat_macros[i] = temp_chat_macros[i];
|
chat_macros[i] = temp_chat_macros[i];
|
||||||
}
|
}
|
||||||
default_t temp_defaults[35] = {
|
default_t temp_defaults[35] =
|
||||||
default_t( "mouse_sensitivity",&::g->mouseSensitivity, 7 ),
|
{
|
||||||
|
default_t( "mouse_sensitivity", &::g->mouseSensitivity, 7 ),
|
||||||
|
|
||||||
default_t( "show_messages",&::g->showMessages, 1 ),
|
default_t( "show_messages", &::g->showMessages, 1 ),
|
||||||
|
|
||||||
default_t( "key_right",&::g->key_right, KEY_RIGHTARROW ),
|
default_t( "key_right", &::g->key_right, KEY_RIGHTARROW ),
|
||||||
default_t( "key_left",&::g->key_left, KEY_LEFTARROW ),
|
default_t( "key_left", &::g->key_left, KEY_LEFTARROW ),
|
||||||
default_t( "key_up",&::g->key_up, KEY_UPARROW ),
|
default_t( "key_up", &::g->key_up, KEY_UPARROW ),
|
||||||
default_t( "key_down",&::g->key_down, KEY_DOWNARROW ),
|
default_t( "key_down", &::g->key_down, KEY_DOWNARROW ),
|
||||||
default_t( "key_strafeleft",&::g->key_strafeleft, ',' ),
|
default_t( "key_strafeleft", &::g->key_strafeleft, ',' ),
|
||||||
default_t( "key_straferight",&::g->key_straferight, '.' ),
|
default_t( "key_straferight", &::g->key_straferight, '.' ),
|
||||||
|
|
||||||
default_t( "key_fire",&::g->key_fire, KEY_RCTRL ),
|
default_t( "key_fire", &::g->key_fire, KEY_RCTRL ),
|
||||||
default_t( "key_use",&::g->key_use, ' ' ),
|
default_t( "key_use", &::g->key_use, ' ' ),
|
||||||
default_t( "key_strafe",&::g->key_strafe, KEY_RALT ),
|
default_t( "key_strafe", &::g->key_strafe, KEY_RALT ),
|
||||||
default_t( "key_speed",&::g->key_speed, KEY_RSHIFT ),
|
default_t( "key_speed", &::g->key_speed, KEY_RSHIFT ),
|
||||||
|
|
||||||
default_t( "use_mouse",&::g->usemouse, 1 ),
|
default_t( "use_mouse", &::g->usemouse, 1 ),
|
||||||
default_t( "mouseb_fire",&::g->mousebfire,0 ),
|
default_t( "mouseb_fire", &::g->mousebfire, 0 ),
|
||||||
default_t( "mouseb_strafe",&::g->mousebstrafe,1 ),
|
default_t( "mouseb_strafe", &::g->mousebstrafe, 1 ),
|
||||||
default_t( "mouseb_forward",&::g->mousebforward,2 ),
|
default_t( "mouseb_forward", &::g->mousebforward, 2 ),
|
||||||
|
|
||||||
default_t( "use_joystick",&::g->usejoystick, 0 ),
|
default_t( "use_joystick", &::g->usejoystick, 0 ),
|
||||||
default_t( "joyb_fire",&::g->joybfire,0 ),
|
default_t( "joyb_fire", &::g->joybfire, 0 ),
|
||||||
default_t( "joyb_strafe",&::g->joybstrafe,1 ),
|
default_t( "joyb_strafe", &::g->joybstrafe, 1 ),
|
||||||
default_t( "joyb_use",&::g->joybuse,3 ),
|
default_t( "joyb_use", &::g->joybuse, 3 ),
|
||||||
default_t( "joyb_speed",&::g->joybspeed,2 ),
|
default_t( "joyb_speed", &::g->joybspeed, 2 ),
|
||||||
|
|
||||||
default_t( "screenblocks",&::g->screenblocks, 10 ),
|
default_t( "screenblocks", &::g->screenblocks, 10 ),
|
||||||
default_t( "detaillevel",&::g->detailLevel, 0 ),
|
default_t( "detaillevel", &::g->detailLevel, 0 ),
|
||||||
|
|
||||||
default_t( "snd_channels",&::g->numChannels, S_NUMCHANNELS ),
|
default_t( "snd_channels", &::g->numChannels, S_NUMCHANNELS ),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
default_t( "usegamma",&::g->usegamma, 0 ),
|
default_t( "usegamma", &::g->usegamma, 0 ),
|
||||||
|
|
||||||
default_t( "chatmacro0", &::g->chat_macros[0], HUSTR_CHATMACRO0 ),
|
default_t( "chatmacro0", &::g->chat_macros[0], HUSTR_CHATMACRO0 ),
|
||||||
default_t( "chatmacro1", &::g->chat_macros[1], HUSTR_CHATMACRO1 ),
|
default_t( "chatmacro1", &::g->chat_macros[1], HUSTR_CHATMACRO1 ),
|
||||||
default_t( "chatmacro2", &::g->chat_macros[2], HUSTR_CHATMACRO2 ),
|
default_t( "chatmacro2", &::g->chat_macros[2], HUSTR_CHATMACRO2 ),
|
||||||
default_t( "chatmacro3", &::g->chat_macros[3], HUSTR_CHATMACRO3 ),
|
default_t( "chatmacro3", &::g->chat_macros[3], HUSTR_CHATMACRO3 ),
|
||||||
default_t( "chatmacro4", &::g->chat_macros[4], HUSTR_CHATMACRO4 ),
|
default_t( "chatmacro4", &::g->chat_macros[4], HUSTR_CHATMACRO4 ),
|
||||||
default_t( "chatmacro5", &::g->chat_macros[5], HUSTR_CHATMACRO5 ),
|
default_t( "chatmacro5", &::g->chat_macros[5], HUSTR_CHATMACRO5 ),
|
||||||
default_t( "chatmacro6", &::g->chat_macros[6], HUSTR_CHATMACRO6 ),
|
default_t( "chatmacro6", &::g->chat_macros[6], HUSTR_CHATMACRO6 ),
|
||||||
default_t( "chatmacro7", &::g->chat_macros[7], HUSTR_CHATMACRO7 ),
|
default_t( "chatmacro7", &::g->chat_macros[7], HUSTR_CHATMACRO7 ),
|
||||||
default_t( "chatmacro8", &::g->chat_macros[8], HUSTR_CHATMACRO8 ),
|
default_t( "chatmacro8", &::g->chat_macros[8], HUSTR_CHATMACRO8 ),
|
||||||
default_t( "chatmacro9", &::g->chat_macros[9], HUSTR_CHATMACRO9 )
|
default_t( "chatmacro9", &::g->chat_macros[9], HUSTR_CHATMACRO9 )
|
||||||
|
|
||||||
};
|
};
|
||||||
memcpy( ::g->defaults, temp_defaults, sizeof(temp_defaults) );
|
memcpy( ::g->defaults, temp_defaults, sizeof( temp_defaults ) );
|
||||||
// m_misc.constructs end //
|
// m_misc.constructs end //
|
||||||
// m_random.constructs begin //
|
// m_random.constructs begin //
|
||||||
::g->rndindex = 0;
|
::g->rndindex = 0;
|
||||||
::g->prndindex = 0;
|
::g->prndindex = 0;
|
||||||
// m_random.constructs end //
|
// m_random.constructs end //
|
||||||
// p_enemy.constructs begin //
|
// p_enemy.constructs begin //
|
||||||
::g->TRACEANGLE = 0xc000000;
|
::g->TRACEANGLE = 0xc000000;
|
||||||
::g->easy = 0;
|
::g->easy = 0;
|
||||||
// p_enemy.constructs end //
|
// p_enemy.constructs end //
|
||||||
// r_bsp.constructs begin //
|
// r_bsp.constructs begin //
|
||||||
int temp_checkcoord[12][4] = {
|
int temp_checkcoord[12][4] =
|
||||||
{3,0,2,1},
|
{
|
||||||
{3,0,2,0},
|
{3, 0, 2, 1},
|
||||||
{3,1,2,0},
|
{3, 0, 2, 0},
|
||||||
{0},
|
{3, 1, 2, 0},
|
||||||
{2,0,2,1},
|
{0},
|
||||||
{0,0,0,0},
|
{2, 0, 2, 1},
|
||||||
{3,1,3,0},
|
{0, 0, 0, 0},
|
||||||
{0},
|
{3, 1, 3, 0},
|
||||||
{2,0,3,1},
|
{0},
|
||||||
{2,1,3,1},
|
{2, 0, 3, 1},
|
||||||
{2,1,3,0}
|
{2, 1, 3, 1},
|
||||||
|
{2, 1, 3, 0}
|
||||||
};
|
};
|
||||||
memcpy( ::g->checkcoord, temp_checkcoord, sizeof(temp_checkcoord) );
|
memcpy( ::g->checkcoord, temp_checkcoord, sizeof( temp_checkcoord ) );
|
||||||
// r_bsp.constructs end //
|
// r_bsp.constructs end //
|
||||||
// r_draw.constructs begin //
|
// r_draw.constructs begin //
|
||||||
int temp_fuzzoffset[FUZZTABLE] = {
|
int temp_fuzzoffset[FUZZTABLE] =
|
||||||
FUZZOFF,-FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,
|
{
|
||||||
FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,
|
FUZZOFF, -FUZZOFF, FUZZOFF, -FUZZOFF, FUZZOFF, FUZZOFF, -FUZZOFF,
|
||||||
FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,-FUZZOFF,-FUZZOFF,-FUZZOFF,
|
FUZZOFF, FUZZOFF, -FUZZOFF, FUZZOFF, FUZZOFF, FUZZOFF, -FUZZOFF,
|
||||||
FUZZOFF,-FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,
|
FUZZOFF, FUZZOFF, FUZZOFF, -FUZZOFF, -FUZZOFF, -FUZZOFF, -FUZZOFF,
|
||||||
FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,-FUZZOFF,FUZZOFF,
|
FUZZOFF, -FUZZOFF, -FUZZOFF, FUZZOFF, FUZZOFF, FUZZOFF, FUZZOFF, -FUZZOFF,
|
||||||
FUZZOFF,-FUZZOFF,-FUZZOFF,-FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,
|
FUZZOFF, -FUZZOFF, FUZZOFF, FUZZOFF, -FUZZOFF, -FUZZOFF, FUZZOFF,
|
||||||
FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF,FUZZOFF,-FUZZOFF,FUZZOFF
|
FUZZOFF, -FUZZOFF, -FUZZOFF, -FUZZOFF, -FUZZOFF, FUZZOFF, FUZZOFF,
|
||||||
|
FUZZOFF, FUZZOFF, -FUZZOFF, FUZZOFF, FUZZOFF, -FUZZOFF, FUZZOFF
|
||||||
};
|
};
|
||||||
memcpy( ::g->fuzzoffset, temp_fuzzoffset, sizeof(temp_fuzzoffset) );
|
memcpy( ::g->fuzzoffset, temp_fuzzoffset, sizeof( temp_fuzzoffset ) );
|
||||||
::g->fuzzpos = 0;
|
::g->fuzzpos = 0;
|
||||||
// r_draw.constructs end //
|
// r_draw.constructs end //
|
||||||
// r_main.constructs begin //
|
// r_main.constructs begin //
|
||||||
::g->validcount = 1;
|
::g->validcount = 1;
|
||||||
// r_main.constructs end //
|
// r_main.constructs end //
|
||||||
// sounds.constructs begin //
|
// sounds.constructs begin //
|
||||||
musicinfo_t temp_S_music[80] = {
|
musicinfo_t temp_S_music[80] =
|
||||||
{ 0 },
|
{
|
||||||
{ "e1m1", 0 },
|
{ 0 },
|
||||||
{ "e1m2", 0 },
|
{ "e1m1", 0 },
|
||||||
{ "e1m3", 0 },
|
{ "e1m2", 0 },
|
||||||
{ "e1m4", 0 },
|
{ "e1m3", 0 },
|
||||||
{ "e1m5", 0 },
|
{ "e1m4", 0 },
|
||||||
{ "e1m6", 0 },
|
{ "e1m5", 0 },
|
||||||
{ "e1m7", 0 },
|
{ "e1m6", 0 },
|
||||||
{ "e1m8", 0 },
|
{ "e1m7", 0 },
|
||||||
{ "e1m9", 0 },
|
{ "e1m8", 0 },
|
||||||
{ "e2m1", 0 },
|
{ "e1m9", 0 },
|
||||||
{ "e2m2", 0 },
|
{ "e2m1", 0 },
|
||||||
{ "e2m3", 0 },
|
{ "e2m2", 0 },
|
||||||
{ "e2m4", 0 },
|
{ "e2m3", 0 },
|
||||||
{ "e2m5", 0 },
|
{ "e2m4", 0 },
|
||||||
{ "e2m6", 0 },
|
{ "e2m5", 0 },
|
||||||
{ "e2m7", 0 },
|
{ "e2m6", 0 },
|
||||||
{ "e2m8", 0 },
|
{ "e2m7", 0 },
|
||||||
{ "e2m9", 0 },
|
{ "e2m8", 0 },
|
||||||
{ "e3m1", 0 },
|
{ "e2m9", 0 },
|
||||||
{ "e3m2", 0 },
|
{ "e3m1", 0 },
|
||||||
{ "e3m3", 0 },
|
{ "e3m2", 0 },
|
||||||
{ "e3m4", 0 },
|
{ "e3m3", 0 },
|
||||||
{ "e3m5", 0 },
|
{ "e3m4", 0 },
|
||||||
{ "e3m6", 0 },
|
{ "e3m5", 0 },
|
||||||
{ "e3m7", 0 },
|
{ "e3m6", 0 },
|
||||||
{ "e3m8", 0 },
|
{ "e3m7", 0 },
|
||||||
{ "e3m9", 0 },
|
{ "e3m8", 0 },
|
||||||
{ "inter", 0 },
|
{ "e3m9", 0 },
|
||||||
{ "intro", 0 },
|
{ "inter", 0 },
|
||||||
{ "bunny", 0 },
|
{ "intro", 0 },
|
||||||
{ "victor", 0 },
|
{ "bunny", 0 },
|
||||||
{ "introa", 0 },
|
{ "victor", 0 },
|
||||||
{ "runnin", 0 },
|
{ "introa", 0 },
|
||||||
{ "stalks", 0 },
|
{ "runnin", 0 },
|
||||||
{ "countd", 0 },
|
{ "stalks", 0 },
|
||||||
{ "betwee", 0 },
|
{ "countd", 0 },
|
||||||
{ "doom", 0 },
|
{ "betwee", 0 },
|
||||||
{ "the_da", 0 },
|
{ "doom", 0 },
|
||||||
{ "shawn", 0 },
|
{ "the_da", 0 },
|
||||||
{ "ddtblu", 0 },
|
{ "shawn", 0 },
|
||||||
{ "in_cit", 0 },
|
{ "ddtblu", 0 },
|
||||||
{ "dead", 0 },
|
{ "in_cit", 0 },
|
||||||
{ "stlks2", 0 },
|
{ "dead", 0 },
|
||||||
{ "theda2", 0 },
|
{ "stlks2", 0 },
|
||||||
{ "doom2", 0 },
|
{ "theda2", 0 },
|
||||||
{ "ddtbl2", 0 },
|
{ "doom2", 0 },
|
||||||
{ "runni2", 0 },
|
{ "ddtbl2", 0 },
|
||||||
{ "dead2", 0 },
|
{ "runni2", 0 },
|
||||||
{ "stlks3", 0 },
|
{ "dead2", 0 },
|
||||||
{ "romero", 0 },
|
{ "stlks3", 0 },
|
||||||
{ "shawn2", 0 },
|
{ "romero", 0 },
|
||||||
{ "messag", 0 },
|
{ "shawn2", 0 },
|
||||||
{ "count2", 0 },
|
{ "messag", 0 },
|
||||||
{ "ddtbl3", 0 },
|
{ "count2", 0 },
|
||||||
{ "ampie", 0 },
|
{ "ddtbl3", 0 },
|
||||||
{ "theda3", 0 },
|
{ "ampie", 0 },
|
||||||
{ "adrian", 0 },
|
{ "theda3", 0 },
|
||||||
{ "messg2", 0 },
|
{ "adrian", 0 },
|
||||||
{ "romer2", 0 },
|
{ "messg2", 0 },
|
||||||
{ "tense", 0 },
|
{ "romer2", 0 },
|
||||||
{ "shawn3", 0 },
|
{ "tense", 0 },
|
||||||
{ "openin", 0 },
|
{ "shawn3", 0 },
|
||||||
{ "evil", 0 },
|
{ "openin", 0 },
|
||||||
{ "ultima", 0 },
|
{ "evil", 0 },
|
||||||
{ "read_m", 0 },
|
{ "ultima", 0 },
|
||||||
{ "dm2ttl", 0 },
|
{ "read_m", 0 },
|
||||||
{ "dm2int", 0 }
|
{ "dm2ttl", 0 },
|
||||||
|
{ "dm2int", 0 }
|
||||||
};
|
};
|
||||||
memcpy( ::g->S_music, temp_S_music, sizeof(temp_S_music) );
|
memcpy( ::g->S_music, temp_S_music, sizeof( temp_S_music ) );
|
||||||
// sounds.constructs end //
|
// sounds.constructs end //
|
||||||
// st_stuff.constructs begin //
|
// st_stuff.constructs begin //
|
||||||
::g->veryfirsttime = 1;
|
::g->veryfirsttime = 1;
|
||||||
::g->st_msgcounter=0;
|
::g->st_msgcounter = 0;
|
||||||
::g->st_oldhealth = -1;
|
::g->st_oldhealth = -1;
|
||||||
::g->st_facecount = 0;
|
::g->st_facecount = 0;
|
||||||
::g->st_faceindex = 0;
|
::g->st_faceindex = 0;
|
||||||
::g->oldhealth = -1;
|
::g->oldhealth = -1;
|
||||||
::g->lastattackdown = -1;
|
::g->lastattackdown = -1;
|
||||||
::g->priority = 0;
|
::g->priority = 0;
|
||||||
::g->largeammo = 1994; // means "n/a"
|
::g->largeammo = 1994; // means "n/a"
|
||||||
::g->st_palette = 0;
|
::g->st_palette = 0;
|
||||||
::g->st_stopped = true;
|
::g->st_stopped = true;
|
||||||
// st_stuff.constructs end //
|
// st_stuff.constructs end //
|
||||||
// s_sound.constructs begin //
|
// s_sound.constructs begin //
|
||||||
::g->mus_playing=0;
|
::g->mus_playing = 0;
|
||||||
// s_sound.constructs end //
|
// s_sound.constructs end //
|
||||||
// wi_stuff.constructs begin //
|
// wi_stuff.constructs begin //
|
||||||
int temp_NUMANIMS[NUMEPISODES] = {
|
int temp_NUMANIMS[NUMEPISODES] =
|
||||||
sizeof(epsd0animinfo)/sizeof(anim_t),
|
{
|
||||||
sizeof(epsd1animinfo)/sizeof(anim_t),
|
sizeof( epsd0animinfo ) / sizeof( anim_t ),
|
||||||
sizeof(epsd2animinfo)/sizeof(anim_t)
|
sizeof( epsd1animinfo ) / sizeof( anim_t ),
|
||||||
|
sizeof( epsd2animinfo ) / sizeof( anim_t )
|
||||||
};
|
};
|
||||||
memcpy( ::g->NUMANIMS, temp_NUMANIMS, sizeof(temp_NUMANIMS) );
|
memcpy( ::g->NUMANIMS, temp_NUMANIMS, sizeof( temp_NUMANIMS ) );
|
||||||
::g->snl_pointeron = false;
|
::g->snl_pointeron = false;
|
||||||
extern const anim_t temp_epsd0animinfo[10];
|
extern const anim_t temp_epsd0animinfo[10];
|
||||||
extern const anim_t temp_epsd1animinfo[9];
|
extern const anim_t temp_epsd1animinfo[9];
|
||||||
extern const anim_t temp_epsd2animinfo[6];
|
extern const anim_t temp_epsd2animinfo[6];
|
||||||
memcpy(::g->epsd0animinfo, temp_epsd0animinfo, sizeof(temp_epsd0animinfo));
|
memcpy( ::g->epsd0animinfo, temp_epsd0animinfo, sizeof( temp_epsd0animinfo ) );
|
||||||
memcpy(::g->epsd1animinfo, temp_epsd1animinfo, sizeof(temp_epsd1animinfo));
|
memcpy( ::g->epsd1animinfo, temp_epsd1animinfo, sizeof( temp_epsd1animinfo ) );
|
||||||
memcpy(::g->epsd2animinfo, temp_epsd2animinfo, sizeof(temp_epsd2animinfo));
|
memcpy( ::g->epsd2animinfo, temp_epsd2animinfo, sizeof( temp_epsd2animinfo ) );
|
||||||
wi_stuff_anims[0] = ::g->epsd0animinfo;
|
wi_stuff_anims[0] = ::g->epsd0animinfo;
|
||||||
wi_stuff_anims[1] = ::g->epsd1animinfo;
|
wi_stuff_anims[1] = ::g->epsd1animinfo;
|
||||||
wi_stuff_anims[2] = ::g->epsd2animinfo;
|
wi_stuff_anims[2] = ::g->epsd2animinfo;
|
||||||
// wi_stuff.constructs end //
|
// wi_stuff.constructs end //
|
||||||
// z_zone.constructs begin //
|
// z_zone.constructs begin //
|
||||||
::g->zones[NUM_ZONES] = NULL;
|
::g->zones[NUM_ZONES] = NULL;
|
||||||
::g->NumAlloc = 0;
|
::g->NumAlloc = 0;
|
||||||
// z_zone.constructs end //
|
// z_zone.constructs end //
|
||||||
// info constructs begin //
|
// info constructs begin //
|
||||||
extern const state_t tempStates[NUMSTATES];
|
extern const state_t tempStates[NUMSTATES];
|
||||||
memcpy(::g->states, tempStates, sizeof(tempStates));
|
memcpy( ::g->states, tempStates, sizeof( tempStates ) );
|
||||||
// info constructs end //
|
// info constructs end //
|
||||||
// p_local begin //
|
// p_local begin //
|
||||||
::g->rejectmatrix = NULL;
|
::g->rejectmatrix = NULL;
|
||||||
// p_local end //
|
// p_local end //
|
||||||
// r_data begin //]
|
// r_data begin //]
|
||||||
::g->s_numtextures = 0;
|
::g->s_numtextures = 0;
|
||||||
// r_data end //
|
// r_data end //
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,35 +40,35 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// Input event types.
|
// Input event types.
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
ev_keydown,
|
ev_keydown,
|
||||||
ev_keyup,
|
ev_keyup,
|
||||||
ev_mouse,
|
ev_mouse,
|
||||||
ev_joystick,
|
ev_joystick,
|
||||||
ev_none,
|
ev_none,
|
||||||
} evtype_t;
|
} evtype_t;
|
||||||
|
|
||||||
// Event structure.
|
// Event structure.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
evtype_t type;
|
evtype_t type;
|
||||||
int data1; // keys / mouse/joystick buttons
|
int data1; // keys / mouse/joystick buttons
|
||||||
int data2; // mouse/joystick x move
|
int data2; // mouse/joystick x move
|
||||||
int data3; // mouse/joystick y move
|
int data3; // mouse/joystick y move
|
||||||
} event_t;
|
} event_t;
|
||||||
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
ga_nothing,
|
ga_nothing,
|
||||||
ga_loadlevel,
|
ga_loadlevel,
|
||||||
ga_newgame,
|
ga_newgame,
|
||||||
ga_loadgame,
|
ga_loadgame,
|
||||||
ga_savegame,
|
ga_savegame,
|
||||||
ga_playdemo,
|
ga_playdemo,
|
||||||
ga_completed,
|
ga_completed,
|
||||||
ga_victory,
|
ga_victory,
|
||||||
ga_worlddone,
|
ga_worlddone,
|
||||||
ga_screenshot
|
ga_screenshot
|
||||||
} gameaction_t;
|
} gameaction_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,31 +78,31 @@ typedef enum
|
||||||
//
|
//
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
// Press "Fire".
|
// Press "Fire".
|
||||||
BT_ATTACK = 1,
|
BT_ATTACK = 1,
|
||||||
// Use button, to open doors, activate switches.
|
// Use button, to open doors, activate switches.
|
||||||
BT_USE = 2,
|
BT_USE = 2,
|
||||||
|
|
||||||
// Flag: game events, not really buttons.
|
// Flag: game events, not really buttons.
|
||||||
BT_SPECIAL = 128,
|
BT_SPECIAL = 128,
|
||||||
BT_SPECIALMASK = 3,
|
BT_SPECIALMASK = 3,
|
||||||
|
|
||||||
// Flag, weapon change pending.
|
// Flag, weapon change pending.
|
||||||
// If true, the next 3 bits hold weapon num.
|
// If true, the next 3 bits hold weapon num.
|
||||||
BT_CHANGE = 4,
|
BT_CHANGE = 4,
|
||||||
// The 3bit weapon mask and shift, convenience.
|
// The 3bit weapon mask and shift, convenience.
|
||||||
BT_WEAPONMASK = (8+16+32),
|
BT_WEAPONMASK = ( 8 + 16 + 32 ),
|
||||||
BT_WEAPONSHIFT = 3,
|
BT_WEAPONSHIFT = 3,
|
||||||
|
|
||||||
// Pause the game.
|
// Pause the game.
|
||||||
BTS_PAUSE = 1,
|
BTS_PAUSE = 1,
|
||||||
// Save the game at each console.
|
// Save the game at each console.
|
||||||
BTS_SAVEGAME = 2,
|
BTS_SAVEGAME = 2,
|
||||||
|
|
||||||
// Savegame slot numbers
|
// Savegame slot numbers
|
||||||
// occupy the second byte of buttons.
|
// occupy the second byte of buttons.
|
||||||
BTS_SAVEMASK = (4+8+16),
|
BTS_SAVEMASK = ( 4 + 8 + 16 ),
|
||||||
BTS_SAVESHIFT = 2,
|
BTS_SAVESHIFT = 2,
|
||||||
|
|
||||||
} buttoncode_t;
|
} buttoncode_t;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "Precompiled.h"
|
#include "Precompiled.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "d_items.h"
|
#pragma implementation "d_items.h"
|
||||||
#endif
|
#endif
|
||||||
#include "d_items.h"
|
#include "d_items.h"
|
||||||
|
|
||||||
|
@ -53,87 +53,87 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
//
|
//
|
||||||
const weaponinfo_t weaponinfo[NUMWEAPONS] =
|
const weaponinfo_t weaponinfo[NUMWEAPONS] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
// fist
|
// fist
|
||||||
am_noammo,
|
am_noammo,
|
||||||
S_PUNCHUP,
|
S_PUNCHUP,
|
||||||
S_PUNCHDOWN,
|
S_PUNCHDOWN,
|
||||||
S_PUNCH,
|
S_PUNCH,
|
||||||
S_PUNCH1,
|
S_PUNCH1,
|
||||||
S_NULL
|
S_NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// pistol
|
// pistol
|
||||||
am_clip,
|
am_clip,
|
||||||
S_PISTOLUP,
|
S_PISTOLUP,
|
||||||
S_PISTOLDOWN,
|
S_PISTOLDOWN,
|
||||||
S_PISTOL,
|
S_PISTOL,
|
||||||
S_PISTOL1,
|
S_PISTOL1,
|
||||||
S_PISTOLFLASH
|
S_PISTOLFLASH
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// shotgun
|
// shotgun
|
||||||
am_shell,
|
am_shell,
|
||||||
S_SGUNUP,
|
S_SGUNUP,
|
||||||
S_SGUNDOWN,
|
S_SGUNDOWN,
|
||||||
S_SGUN,
|
S_SGUN,
|
||||||
S_SGUN1,
|
S_SGUN1,
|
||||||
S_SGUNFLASH1
|
S_SGUNFLASH1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// chaingun
|
// chaingun
|
||||||
am_clip,
|
am_clip,
|
||||||
S_CHAINUP,
|
S_CHAINUP,
|
||||||
S_CHAINDOWN,
|
S_CHAINDOWN,
|
||||||
S_CHAIN,
|
S_CHAIN,
|
||||||
S_CHAIN1,
|
S_CHAIN1,
|
||||||
S_CHAINFLASH1
|
S_CHAINFLASH1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// missile launcher
|
// missile launcher
|
||||||
am_misl,
|
am_misl,
|
||||||
S_MISSILEUP,
|
S_MISSILEUP,
|
||||||
S_MISSILEDOWN,
|
S_MISSILEDOWN,
|
||||||
S_MISSILE,
|
S_MISSILE,
|
||||||
S_MISSILE1,
|
S_MISSILE1,
|
||||||
S_MISSILEFLASH1
|
S_MISSILEFLASH1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// plasma rifle
|
// plasma rifle
|
||||||
am_cell,
|
am_cell,
|
||||||
S_PLASMAUP,
|
S_PLASMAUP,
|
||||||
S_PLASMADOWN,
|
S_PLASMADOWN,
|
||||||
S_PLASMA,
|
S_PLASMA,
|
||||||
S_PLASMA1,
|
S_PLASMA1,
|
||||||
S_PLASMAFLASH1
|
S_PLASMAFLASH1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// bfg 9000
|
// bfg 9000
|
||||||
am_cell,
|
am_cell,
|
||||||
S_BFGUP,
|
S_BFGUP,
|
||||||
S_BFGDOWN,
|
S_BFGDOWN,
|
||||||
S_BFG,
|
S_BFG,
|
||||||
S_BFG1,
|
S_BFG1,
|
||||||
S_BFGFLASH1
|
S_BFGFLASH1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// chainsaw
|
// chainsaw
|
||||||
am_noammo,
|
am_noammo,
|
||||||
S_SAWUP,
|
S_SAWUP,
|
||||||
S_SAWDOWN,
|
S_SAWDOWN,
|
||||||
S_SAW,
|
S_SAW,
|
||||||
S_SAW1,
|
S_SAW1,
|
||||||
S_NULL
|
S_NULL
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// super shotgun
|
// super shotgun
|
||||||
am_shell,
|
am_shell,
|
||||||
S_DSGUNUP,
|
S_DSGUNUP,
|
||||||
S_DSGUNDOWN,
|
S_DSGUNDOWN,
|
||||||
S_DSGUN,
|
S_DSGUN,
|
||||||
S_DSGUN1,
|
S_DSGUN1,
|
||||||
S_DSGUNFLASH1
|
S_DSGUNFLASH1
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,19 +32,19 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Weapon info: sprite frames, ammunition use.
|
// Weapon info: sprite frames, ammunition use.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
ammotype_t ammo;
|
ammotype_t ammo;
|
||||||
int upstate;
|
int upstate;
|
||||||
int downstate;
|
int downstate;
|
||||||
int readystate;
|
int readystate;
|
||||||
int atkstate;
|
int atkstate;
|
||||||
int flashstate;
|
int flashstate;
|
||||||
|
|
||||||
} weaponinfo_t;
|
} weaponinfo_t;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const char* extraWad;
|
extern const char* extraWad;
|
||||||
|
@ -40,8 +40,8 @@ extern const char* extraWad;
|
||||||
#define MAXWADFILES 20
|
#define MAXWADFILES 20
|
||||||
extern const char* wadfiles[MAXWADFILES];
|
extern const char* wadfiles[MAXWADFILES];
|
||||||
|
|
||||||
void D_AddExtraWadFile( const char *file );
|
void D_AddExtraWadFile( const char* file );
|
||||||
void D_AddFile ( const char *file);
|
void D_AddFile( const char* file );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,25 +51,25 @@ void D_AddFile ( const char *file);
|
||||||
// calls all startup code, parses command line options.
|
// calls all startup code, parses command line options.
|
||||||
// If not overrided by user input, calls N_AdvanceDemo.
|
// If not overrided by user input, calls N_AdvanceDemo.
|
||||||
//
|
//
|
||||||
void D_DoomMain (void);
|
void D_DoomMain( void );
|
||||||
|
|
||||||
// Called by IO functions when input is detected.
|
// Called by IO functions when input is detected.
|
||||||
void D_PostEvent (event_t* ev);
|
void D_PostEvent( event_t* ev );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// BASE LEVEL
|
// BASE LEVEL
|
||||||
//
|
//
|
||||||
void D_PageTicker (void);
|
void D_PageTicker( void );
|
||||||
void D_PageDrawer (void);
|
void D_PageDrawer( void );
|
||||||
void D_AdvanceDemo (void);
|
void D_AdvanceDemo( void );
|
||||||
void D_StartTitle (void);
|
void D_StartTitle( void );
|
||||||
|
|
||||||
//#define R_OK 0x01
|
//#define R_OK 0x01
|
||||||
//#define X_OK 0x02
|
//#define X_OK 0x02
|
||||||
//#define W_OK 0x04
|
//#define W_OK 0x04
|
||||||
int access(char* name, int val);
|
int access( char* name, int val );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
CMD_SEND = 1,
|
CMD_SEND = 1,
|
||||||
CMD_GET = 2
|
CMD_GET = 2
|
||||||
|
|
||||||
} command_t;
|
} command_t;
|
||||||
|
|
||||||
|
@ -67,17 +67,17 @@ typedef enum
|
||||||
//
|
//
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// High bit is retransmit request.
|
// High bit is retransmit request.
|
||||||
unsigned checksum;
|
unsigned checksum;
|
||||||
// Only valid if NCMD_RETRANSMIT.
|
// Only valid if NCMD_RETRANSMIT.
|
||||||
byte retransmitfrom;
|
byte retransmitfrom;
|
||||||
|
|
||||||
byte sourceDest;
|
byte sourceDest;
|
||||||
|
|
||||||
byte starttic;
|
byte starttic;
|
||||||
byte player;
|
byte player;
|
||||||
byte numtics;
|
byte numtics;
|
||||||
ticcmd_t cmds[BACKUPTICS];
|
ticcmd_t cmds[BACKUPTICS];
|
||||||
|
|
||||||
} doomdata_t;
|
} doomdata_t;
|
||||||
|
|
||||||
|
@ -86,51 +86,51 @@ typedef struct
|
||||||
|
|
||||||
struct doomcom_t
|
struct doomcom_t
|
||||||
{
|
{
|
||||||
// Supposed to be DOOMCOM_ID?
|
// Supposed to be DOOMCOM_ID?
|
||||||
long id;
|
long id;
|
||||||
|
|
||||||
// DOOM executes an int to execute commands.
|
// DOOM executes an int to execute commands.
|
||||||
short intnum;
|
short intnum;
|
||||||
// Communication between DOOM and the driver.
|
// Communication between DOOM and the driver.
|
||||||
// Is CMD_SEND or CMD_GET.
|
// Is CMD_SEND or CMD_GET.
|
||||||
short command;
|
short command;
|
||||||
// Is dest for send, set by get (-1 = no packet).
|
// Is dest for send, set by get (-1 = no packet).
|
||||||
short remotenode;
|
short remotenode;
|
||||||
|
|
||||||
// Number of bytes in doomdata to be sent
|
// Number of bytes in doomdata to be sent
|
||||||
short datalength;
|
short datalength;
|
||||||
|
|
||||||
// Info common to all nodes.
|
// Info common to all nodes.
|
||||||
// Console is allways node 0.
|
// Console is allways node 0.
|
||||||
short numnodes;
|
short numnodes;
|
||||||
// Flag: 1 = no duplication, 2-5 = dup for slow nets.
|
// Flag: 1 = no duplication, 2-5 = dup for slow nets.
|
||||||
short ticdup;
|
short ticdup;
|
||||||
// Flag: 1 = send a backup tic in every packet.
|
// Flag: 1 = send a backup tic in every packet.
|
||||||
short extratics;
|
short extratics;
|
||||||
// Flag: 1 = deathmatch.
|
// Flag: 1 = deathmatch.
|
||||||
short deathmatch;
|
short deathmatch;
|
||||||
// Flag: -1 = new game, 0-5 = load savegame
|
// Flag: -1 = new game, 0-5 = load savegame
|
||||||
short savegame;
|
short savegame;
|
||||||
short episode; // 1-3
|
short episode; // 1-3
|
||||||
short map; // 1-9
|
short map; // 1-9
|
||||||
short skill; // 1-5
|
short skill; // 1-5
|
||||||
|
|
||||||
// Info specific to this node.
|
// Info specific to this node.
|
||||||
short consoleplayer;
|
short consoleplayer;
|
||||||
short numplayers;
|
short numplayers;
|
||||||
|
|
||||||
// These are related to the 3-display mode,
|
// These are related to the 3-display mode,
|
||||||
// in which two drones looking left and right
|
// in which two drones looking left and right
|
||||||
// were used to render two additional views
|
// were used to render two additional views
|
||||||
// on two additional computers.
|
// on two additional computers.
|
||||||
// Probably not operational anymore.
|
// Probably not operational anymore.
|
||||||
// 1 = left, 0 = center, -1 = right
|
// 1 = left, 0 = center, -1 = right
|
||||||
short angleoffset;
|
short angleoffset;
|
||||||
// 1 = drone
|
// 1 = drone
|
||||||
short drone;
|
short drone;
|
||||||
|
|
||||||
// The packet data to be sent.
|
// The packet data to be sent.
|
||||||
doomdata_t data;
|
doomdata_t data;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
@ -138,14 +138,14 @@ struct doomcom_t
|
||||||
class idUserCmdMgr;
|
class idUserCmdMgr;
|
||||||
|
|
||||||
// Create any new ticcmds and broadcast to other players.
|
// Create any new ticcmds and broadcast to other players.
|
||||||
void NetUpdate ( idUserCmdMgr * userCmdMgr );
|
void NetUpdate( idUserCmdMgr* userCmdMgr );
|
||||||
|
|
||||||
// Broadcasts special packets to other players
|
// Broadcasts special packets to other players
|
||||||
// to notify of game exit
|
// to notify of game exit
|
||||||
void D_QuitNetGame (void);
|
void D_QuitNetGame( void );
|
||||||
|
|
||||||
//? how many ticks to run?
|
//? how many ticks to run?
|
||||||
bool TryRunTics (void);
|
bool TryRunTics( void );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -47,7 +47,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "d_ticcmd.h"
|
#include "d_ticcmd.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,12 +58,12 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
//
|
//
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
// Playing or camping.
|
// Playing or camping.
|
||||||
PST_LIVE,
|
PST_LIVE,
|
||||||
// Dead on the ground, view follows killer.
|
// Dead on the ground, view follows killer.
|
||||||
PST_DEAD,
|
PST_DEAD,
|
||||||
// Ready to restart/respawn???
|
// Ready to restart/respawn???
|
||||||
PST_REBORN
|
PST_REBORN
|
||||||
|
|
||||||
} playerstate_t;
|
} playerstate_t;
|
||||||
|
|
||||||
|
@ -73,12 +73,12 @@ typedef enum
|
||||||
//
|
//
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
// No clipping, walk through barriers.
|
// No clipping, walk through barriers.
|
||||||
CF_NOCLIP = 1,
|
CF_NOCLIP = 1,
|
||||||
// No damage, no health loss.
|
// No damage, no health loss.
|
||||||
CF_GODMODE = 2,
|
CF_GODMODE = 2,
|
||||||
// Not really a cheat, just a debug aid.
|
// Not really a cheat, just a debug aid.
|
||||||
CF_NOMOMENTUM = 4,
|
CF_NOMOMENTUM = 4,
|
||||||
|
|
||||||
// Gives kfa at the beginning of the level.
|
// Gives kfa at the beginning of the level.
|
||||||
CF_GIVEALL = 8,
|
CF_GIVEALL = 8,
|
||||||
|
@ -92,89 +92,89 @@ typedef enum
|
||||||
//
|
//
|
||||||
typedef struct player_s
|
typedef struct player_s
|
||||||
{
|
{
|
||||||
mobj_t* mo;
|
mobj_t* mo;
|
||||||
playerstate_t playerstate;
|
playerstate_t playerstate;
|
||||||
ticcmd_t cmd;
|
ticcmd_t cmd;
|
||||||
|
|
||||||
// Determine POV,
|
// Determine POV,
|
||||||
// including viewpoint bobbing during movement.
|
// including viewpoint bobbing during movement.
|
||||||
// Focal origin above r.z
|
// Focal origin above r.z
|
||||||
fixed_t viewz;
|
fixed_t viewz;
|
||||||
// Base height above floor for viewz.
|
// Base height above floor for viewz.
|
||||||
fixed_t viewheight;
|
fixed_t viewheight;
|
||||||
// Bob/squat speed.
|
// Bob/squat speed.
|
||||||
fixed_t deltaviewheight;
|
fixed_t deltaviewheight;
|
||||||
// bounded/scaled total momentum.
|
// bounded/scaled total momentum.
|
||||||
fixed_t bob;
|
fixed_t bob;
|
||||||
|
|
||||||
// This is only used between levels,
|
// This is only used between levels,
|
||||||
// mo->health is used during levels.
|
// mo->health is used during levels.
|
||||||
int health;
|
int health;
|
||||||
int armorpoints;
|
int armorpoints;
|
||||||
// Armor type is 0-2.
|
// Armor type is 0-2.
|
||||||
int armortype;
|
int armortype;
|
||||||
|
|
||||||
// Power ups. invinc and invis are tic counters.
|
// Power ups. invinc and invis are tic counters.
|
||||||
int powers[NUMPOWERS];
|
int powers[NUMPOWERS];
|
||||||
qboolean cards[NUMCARDS];
|
qboolean cards[NUMCARDS];
|
||||||
qboolean backpack;
|
qboolean backpack;
|
||||||
|
|
||||||
// Frags, kills of other players.
|
// Frags, kills of other players.
|
||||||
int frags[MAXPLAYERS];
|
int frags[MAXPLAYERS];
|
||||||
weapontype_t readyweapon;
|
weapontype_t readyweapon;
|
||||||
|
|
||||||
// Is wp_nochange if not changing.
|
// Is wp_nochange if not changing.
|
||||||
weapontype_t pendingweapon;
|
weapontype_t pendingweapon;
|
||||||
|
|
||||||
int weaponowned[NUMWEAPONS];
|
int weaponowned[NUMWEAPONS];
|
||||||
int ammo[NUMAMMO];
|
int ammo[NUMAMMO];
|
||||||
int maxammo[NUMAMMO];
|
int maxammo[NUMAMMO];
|
||||||
|
|
||||||
// True if button down last tic.
|
// True if button down last tic.
|
||||||
int attackdown;
|
int attackdown;
|
||||||
int usedown;
|
int usedown;
|
||||||
|
|
||||||
// Bit flags, for cheats and debug.
|
// Bit flags, for cheats and debug.
|
||||||
// See cheat_t, above.
|
// See cheat_t, above.
|
||||||
int cheats;
|
int cheats;
|
||||||
|
|
||||||
// Refired shots are less accurate.
|
// Refired shots are less accurate.
|
||||||
int refire;
|
int refire;
|
||||||
|
|
||||||
// For intermission stats.
|
// For intermission stats.
|
||||||
int killcount;
|
int killcount;
|
||||||
int itemcount;
|
int itemcount;
|
||||||
int secretcount;
|
int secretcount;
|
||||||
|
|
||||||
int chainsawKills;
|
int chainsawKills;
|
||||||
int berserkKills;
|
int berserkKills;
|
||||||
|
|
||||||
// Hint messages.
|
// Hint messages.
|
||||||
const char* message;
|
const char* message;
|
||||||
|
|
||||||
// For screen flashing (red or bright).
|
// For screen flashing (red or bright).
|
||||||
int damagecount;
|
int damagecount;
|
||||||
int bonuscount;
|
int bonuscount;
|
||||||
|
|
||||||
// Who did damage (NULL for floors/ceilings).
|
// Who did damage (NULL for floors/ceilings).
|
||||||
mobj_t* attacker;
|
mobj_t* attacker;
|
||||||
|
|
||||||
// So gun flashes light up areas.
|
// So gun flashes light up areas.
|
||||||
int extralight;
|
int extralight;
|
||||||
|
|
||||||
// Current PLAYPAL, ???
|
// Current PLAYPAL, ???
|
||||||
// can be set to REDCOLORMAP for pain, etc.
|
// can be set to REDCOLORMAP for pain, etc.
|
||||||
int fixedcolormap;
|
int fixedcolormap;
|
||||||
|
|
||||||
// Player skin colorshift,
|
// Player skin colorshift,
|
||||||
// 0-3 for which color to draw player.
|
// 0-3 for which color to draw player.
|
||||||
int colormap;
|
int colormap;
|
||||||
|
|
||||||
// Overlay view sprites (gun, etc).
|
// Overlay view sprites (gun, etc).
|
||||||
pspdef_t psprites[NUMPSPRITES];
|
pspdef_t psprites[NUMPSPRITES];
|
||||||
|
|
||||||
// True if secret level has been done.
|
// True if secret level has been done.
|
||||||
qboolean didsecret;
|
qboolean didsecret;
|
||||||
|
|
||||||
} player_t;
|
} player_t;
|
||||||
|
|
||||||
|
@ -185,41 +185,41 @@ typedef struct player_s
|
||||||
//
|
//
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
qboolean in; // whether the player is in game
|
qboolean in; // whether the player is in game
|
||||||
|
|
||||||
// Player stats, kills, collected items etc.
|
// Player stats, kills, collected items etc.
|
||||||
int skills;
|
int skills;
|
||||||
int sitems;
|
int sitems;
|
||||||
int ssecret;
|
int ssecret;
|
||||||
int stime;
|
int stime;
|
||||||
int frags[4];
|
int frags[4];
|
||||||
int score; // current score on entry, modified on return
|
int score; // current score on entry, modified on return
|
||||||
|
|
||||||
} wbplayerstruct_t;
|
} wbplayerstruct_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int epsd; // episode # (0-2)
|
int epsd; // episode # (0-2)
|
||||||
|
|
||||||
// if true, splash the secret level
|
// if true, splash the secret level
|
||||||
qboolean didsecret;
|
qboolean didsecret;
|
||||||
|
|
||||||
// previous and next levels, origin 0
|
// previous and next levels, origin 0
|
||||||
int last;
|
int last;
|
||||||
int next;
|
int next;
|
||||||
|
|
||||||
int maxkills;
|
int maxkills;
|
||||||
int maxitems;
|
int maxitems;
|
||||||
int maxsecret;
|
int maxsecret;
|
||||||
int maxfrags;
|
int maxfrags;
|
||||||
|
|
||||||
// the par time
|
// the par time
|
||||||
int partime;
|
int partime;
|
||||||
|
|
||||||
// index of this player in game
|
// index of this player in game
|
||||||
int pnum;
|
int pnum;
|
||||||
|
|
||||||
wbplayerstruct_t plyr[MAXPLAYERS];
|
wbplayerstruct_t plyr[MAXPLAYERS];
|
||||||
|
|
||||||
} wbstartstruct_t;
|
} wbstartstruct_t;
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// a pic is an unmasked block of pixels
|
// a pic is an unmasked block of pixels
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
byte width;
|
byte width;
|
||||||
byte height;
|
byte height;
|
||||||
byte data;
|
byte data;
|
||||||
} pic_t;
|
} pic_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -41,15 +41,15 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// action functions cleanly.
|
// action functions cleanly.
|
||||||
//
|
//
|
||||||
struct mobj_t;
|
struct mobj_t;
|
||||||
typedef void (*actionf_v)();
|
typedef void ( *actionf_v )();
|
||||||
typedef void (*actionf_p1)( mobj_t* );
|
typedef void ( *actionf_p1 )( mobj_t* );
|
||||||
typedef void (*actionf_p2)( void*, void* );
|
typedef void ( *actionf_p2 )( void*, void* );
|
||||||
|
|
||||||
typedef union
|
typedef union
|
||||||
{
|
{
|
||||||
actionf_p1 acp1;
|
actionf_p1 acp1;
|
||||||
actionf_v acv;
|
actionf_v acv;
|
||||||
actionf_p2 acp2;
|
actionf_p2 acp2;
|
||||||
|
|
||||||
} actionf_t;
|
} actionf_t;
|
||||||
|
|
||||||
|
@ -66,9 +66,9 @@ typedef actionf_t think_t;
|
||||||
// Doubly linked list of actors.
|
// Doubly linked list of actors.
|
||||||
typedef struct thinker_s
|
typedef struct thinker_s
|
||||||
{
|
{
|
||||||
struct thinker_s* prev;
|
struct thinker_s* prev;
|
||||||
struct thinker_s* next;
|
struct thinker_s* next;
|
||||||
think_t function;
|
think_t function;
|
||||||
|
|
||||||
} thinker_t;
|
} thinker_t;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The data sampled per tick (single player)
|
// The data sampled per tick (single player)
|
||||||
|
@ -41,11 +41,11 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// plus a checksum for internal state consistency.
|
// plus a checksum for internal state consistency.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char forwardmove; // *2048 for move
|
char forwardmove; // *2048 for move
|
||||||
char sidemove; // *2048 for move
|
char sidemove; // *2048 for move
|
||||||
short angleturn; // <<16 for angle delta
|
short angleturn; // <<16 for angle delta
|
||||||
short consistancy; // checks for net game
|
short consistancy; // checks for net game
|
||||||
byte buttons;
|
byte buttons;
|
||||||
byte nextPrevWeapon;
|
byte nextPrevWeapon;
|
||||||
} ticcmd_t;
|
} ticcmd_t;
|
||||||
|
|
||||||
|
|
|
@ -47,25 +47,25 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// to provide a complete scene geometry description.
|
// to provide a complete scene geometry description.
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ML_LABEL, // A separator, name, ExMx or MAPxx
|
ML_LABEL, // A separator, name, ExMx or MAPxx
|
||||||
ML_THINGS, // Monsters, items..
|
ML_THINGS, // Monsters, items..
|
||||||
ML_LINEDEFS, // LineDefs, from editing
|
ML_LINEDEFS, // LineDefs, from editing
|
||||||
ML_SIDEDEFS, // SideDefs, from editing
|
ML_SIDEDEFS, // SideDefs, from editing
|
||||||
ML_VERTEXES, // Vertices, edited and BSP splits generated
|
ML_VERTEXES, // Vertices, edited and BSP splits generated
|
||||||
ML_SEGS, // LineSegs, from LineDefs split by BSP
|
ML_SEGS, // LineSegs, from LineDefs split by BSP
|
||||||
ML_SSECTORS, // SubSectors, list of LineSegs
|
ML_SSECTORS, // SubSectors, list of LineSegs
|
||||||
ML_NODES, // BSP nodes
|
ML_NODES, // BSP nodes
|
||||||
ML_SECTORS, // Sectors, from editing
|
ML_SECTORS, // Sectors, from editing
|
||||||
ML_REJECT, // LUT, sector-sector visibility
|
ML_REJECT, // LUT, sector-sector visibility
|
||||||
ML_BLOCKMAP // LUT, motion clipping, walls/grid element
|
ML_BLOCKMAP // LUT, motion clipping, walls/grid element
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// A single Vertex.
|
// A single Vertex.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
short x;
|
short x;
|
||||||
short y;
|
short y;
|
||||||
} mapvertex_t;
|
} mapvertex_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,13 +73,13 @@ typedef struct
|
||||||
// by setting textures and offsets.
|
// by setting textures and offsets.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
short textureoffset;
|
short textureoffset;
|
||||||
short rowoffset;
|
short rowoffset;
|
||||||
char toptexture[8];
|
char toptexture[8];
|
||||||
char bottomtexture[8];
|
char bottomtexture[8];
|
||||||
char midtexture[8];
|
char midtexture[8];
|
||||||
// Front sector, towards viewer.
|
// Front sector, towards viewer.
|
||||||
short sector;
|
short sector;
|
||||||
} mapsidedef_t;
|
} mapsidedef_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,13 +88,13 @@ typedef struct
|
||||||
// to the BSP builder.
|
// to the BSP builder.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
short v1;
|
short v1;
|
||||||
short v2;
|
short v2;
|
||||||
short flags;
|
short flags;
|
||||||
short special;
|
short special;
|
||||||
short tag;
|
short tag;
|
||||||
// sidenum[1] will be -1 if one sided
|
// sidenum[1] will be -1 if one sided
|
||||||
short sidenum[2];
|
short sidenum[2];
|
||||||
} maplinedef_t;
|
} maplinedef_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,21 +145,21 @@ typedef struct
|
||||||
// Sector definition, from editing.
|
// Sector definition, from editing.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
short floorheight;
|
short floorheight;
|
||||||
short ceilingheight;
|
short ceilingheight;
|
||||||
char floorpic[8];
|
char floorpic[8];
|
||||||
char ceilingpic[8];
|
char ceilingpic[8];
|
||||||
short lightlevel;
|
short lightlevel;
|
||||||
short special;
|
short special;
|
||||||
short tag;
|
short tag;
|
||||||
} mapsector_t;
|
} mapsector_t;
|
||||||
|
|
||||||
// SubSector, as generated by BSP.
|
// SubSector, as generated by BSP.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
short numsegs;
|
short numsegs;
|
||||||
// Index of first one, segs are stored sequentially.
|
// Index of first one, segs are stored sequentially.
|
||||||
short firstseg;
|
short firstseg;
|
||||||
} mapsubsector_t;
|
} mapsubsector_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,12 +167,12 @@ typedef struct
|
||||||
// using partition lines selected by BSP builder.
|
// using partition lines selected by BSP builder.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
short v1;
|
short v1;
|
||||||
short v2;
|
short v2;
|
||||||
short angle;
|
short angle;
|
||||||
short linedef;
|
short linedef;
|
||||||
short side;
|
short side;
|
||||||
short offset;
|
short offset;
|
||||||
} mapseg_t;
|
} mapseg_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,19 +184,19 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// Partition line from (x,y) to x+dx,y+dy)
|
// Partition line from (x,y) to x+dx,y+dy)
|
||||||
short x;
|
short x;
|
||||||
short y;
|
short y;
|
||||||
short dx;
|
short dx;
|
||||||
short dy;
|
short dy;
|
||||||
|
|
||||||
// Bounding box for each child,
|
// Bounding box for each child,
|
||||||
// clip against view frustum.
|
// clip against view frustum.
|
||||||
short bbox[2][4];
|
short bbox[2][4];
|
||||||
|
|
||||||
// If NF_SUBSECTOR its a subsector,
|
// If NF_SUBSECTOR its a subsector,
|
||||||
// else it's a node of another subtree.
|
// else it's a node of another subtree.
|
||||||
unsigned short children[2];
|
unsigned short children[2];
|
||||||
|
|
||||||
} mapnode_t;
|
} mapnode_t;
|
||||||
|
|
||||||
|
@ -207,11 +207,11 @@ typedef struct
|
||||||
// plus skill/visibility flags and attributes.
|
// plus skill/visibility flags and attributes.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
short x;
|
short x;
|
||||||
short y;
|
short y;
|
||||||
short angle;
|
short angle;
|
||||||
short type;
|
short type;
|
||||||
short options;
|
short options;
|
||||||
} mapthing_t;
|
} mapthing_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "Precompiled.h"
|
#include "Precompiled.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "doomdef.h"
|
#pragma implementation "doomdef.h"
|
||||||
#endif
|
#endif
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
|
|
||||||
|
|
|
@ -45,12 +45,12 @@ enum { VERSION = 111 };
|
||||||
// to handle IWAD dependend animations etc.
|
// to handle IWAD dependend animations etc.
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
shareware, // DOOM 1 shareware, E1, M9
|
shareware, // DOOM 1 shareware, E1, M9
|
||||||
registered, // DOOM 1 registered, E3, M27
|
registered, // DOOM 1 registered, E3, M27
|
||||||
commercial, // DOOM 2 retail, E1 M34
|
commercial, // DOOM 2 retail, E1 M34
|
||||||
// DOOM 2 german edition not handled
|
// DOOM 2 german edition not handled
|
||||||
retail, // DOOM 1 retail, E4, M36
|
retail, // DOOM 1 retail, E4, M36
|
||||||
indetermined // Well, no IWAD found.
|
indetermined // Well, no IWAD found.
|
||||||
|
|
||||||
} GameMode_t;
|
} GameMode_t;
|
||||||
|
|
||||||
|
@ -58,14 +58,14 @@ typedef enum
|
||||||
// Mission packs - might be useful for TC stuff?
|
// Mission packs - might be useful for TC stuff?
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
doom, // DOOM 1
|
doom, // DOOM 1
|
||||||
doom2, // DOOM 2
|
doom2, // DOOM 2
|
||||||
pack_tnt, // TNT mission pack
|
pack_tnt, // TNT mission pack
|
||||||
pack_plut, // Plutonia pack
|
pack_plut, // Plutonia pack
|
||||||
pack_master, // Master levels
|
pack_master, // Master levels
|
||||||
pack_nerve, // Nerve levels
|
pack_nerve, // Nerve levels
|
||||||
|
|
||||||
none
|
none
|
||||||
|
|
||||||
} GameMission_t;
|
} GameMission_t;
|
||||||
|
|
||||||
|
@ -73,9 +73,9 @@ typedef enum
|
||||||
// Identify language to use, software localization.
|
// Identify language to use, software localization.
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
english,
|
english,
|
||||||
german,
|
german,
|
||||||
unknown
|
unknown
|
||||||
|
|
||||||
} Language_t;
|
} Language_t;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ typedef enum
|
||||||
// If rangecheck is undefined,
|
// If rangecheck is undefined,
|
||||||
// most parameter validation debugging code will not be compiled
|
// most parameter validation debugging code will not be compiled
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define RANGECHECK
|
#define RANGECHECK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Do or do not use external soundserver.
|
// Do or do not use external soundserver.
|
||||||
|
@ -138,10 +138,10 @@ typedef enum
|
||||||
// the game final animation, or a demo.
|
// the game final animation, or a demo.
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GS_LEVEL,
|
GS_LEVEL,
|
||||||
GS_INTERMISSION,
|
GS_INTERMISSION,
|
||||||
GS_FINALE,
|
GS_FINALE,
|
||||||
GS_DEMOSCREEN
|
GS_DEMOSCREEN
|
||||||
} gamestate_t;
|
} gamestate_t;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -158,11 +158,11 @@ typedef enum
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
sk_baby,
|
sk_baby,
|
||||||
sk_easy,
|
sk_easy,
|
||||||
sk_medium,
|
sk_medium,
|
||||||
sk_hard,
|
sk_hard,
|
||||||
sk_nightmare
|
sk_nightmare
|
||||||
} skill_t;
|
} skill_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,14 +173,14 @@ typedef enum
|
||||||
//
|
//
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
it_bluecard,
|
it_bluecard,
|
||||||
it_yellowcard,
|
it_yellowcard,
|
||||||
it_redcard,
|
it_redcard,
|
||||||
it_blueskull,
|
it_blueskull,
|
||||||
it_yellowskull,
|
it_yellowskull,
|
||||||
it_redskull,
|
it_redskull,
|
||||||
|
|
||||||
NUMCARDS
|
NUMCARDS
|
||||||
|
|
||||||
} card_t;
|
} card_t;
|
||||||
|
|
||||||
|
@ -191,20 +191,20 @@ typedef enum
|
||||||
// user has not changed weapon.
|
// user has not changed weapon.
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
wp_fist,
|
wp_fist,
|
||||||
wp_pistol,
|
wp_pistol,
|
||||||
wp_shotgun,
|
wp_shotgun,
|
||||||
wp_chaingun,
|
wp_chaingun,
|
||||||
wp_missile,
|
wp_missile,
|
||||||
wp_plasma,
|
wp_plasma,
|
||||||
wp_bfg,
|
wp_bfg,
|
||||||
wp_chainsaw,
|
wp_chainsaw,
|
||||||
wp_supershotgun,
|
wp_supershotgun,
|
||||||
|
|
||||||
NUMWEAPONS,
|
NUMWEAPONS,
|
||||||
|
|
||||||
// No pending weapon change.
|
// No pending weapon change.
|
||||||
wp_nochange
|
wp_nochange
|
||||||
|
|
||||||
} weapontype_t;
|
} weapontype_t;
|
||||||
|
|
||||||
|
@ -212,12 +212,12 @@ typedef enum
|
||||||
// Ammunition types defined.
|
// Ammunition types defined.
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
am_clip, // Pistol / chaingun ammo.
|
am_clip, // Pistol / chaingun ammo.
|
||||||
am_shell, // Shotgun / double barreled shotgun.
|
am_shell, // Shotgun / double barreled shotgun.
|
||||||
am_cell, // Plasma rifle, BFG.
|
am_cell, // Plasma rifle, BFG.
|
||||||
am_misl, // Missile launcher.
|
am_misl, // Missile launcher.
|
||||||
NUMAMMO,
|
NUMAMMO,
|
||||||
am_noammo // Unlimited for chainsaw / fist.
|
am_noammo // Unlimited for chainsaw / fist.
|
||||||
|
|
||||||
} ammotype_t;
|
} ammotype_t;
|
||||||
|
|
||||||
|
@ -225,13 +225,13 @@ typedef enum
|
||||||
// Power up artifacts.
|
// Power up artifacts.
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
pw_invulnerability,
|
pw_invulnerability,
|
||||||
pw_strength,
|
pw_strength,
|
||||||
pw_invisibility,
|
pw_invisibility,
|
||||||
pw_ironfeet,
|
pw_ironfeet,
|
||||||
pw_allmap,
|
pw_allmap,
|
||||||
pw_infrared,
|
pw_infrared,
|
||||||
NUMPOWERS
|
NUMPOWERS
|
||||||
|
|
||||||
} powertype_t;
|
} powertype_t;
|
||||||
|
|
||||||
|
@ -244,10 +244,10 @@ typedef enum
|
||||||
//
|
//
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
INVULNTICS = (30*TICRATE),
|
INVULNTICS = ( 30 * TICRATE ),
|
||||||
INVISTICS = (60*TICRATE),
|
INVISTICS = ( 60 * TICRATE ),
|
||||||
INFRATICS = (120*TICRATE),
|
INFRATICS = ( 120 * TICRATE ),
|
||||||
IRONTICS = (60*TICRATE)
|
IRONTICS = ( 60 * TICRATE )
|
||||||
|
|
||||||
} powerduration_t;
|
} powerduration_t;
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ typedef enum
|
||||||
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#define MAX_PATH 260
|
#define MAX_PATH 260
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,13 +55,15 @@ static char* mpArgVPtr[4][10];
|
||||||
|
|
||||||
static bool drawFullScreen = false;
|
static bool drawFullScreen = false;
|
||||||
|
|
||||||
DoomInterface::DoomInterface() {
|
DoomInterface::DoomInterface()
|
||||||
|
{
|
||||||
numplayers = 0;
|
numplayers = 0;
|
||||||
bFinished[0] = bFinished[1] = bFinished[2] = bFinished[3] = false;
|
bFinished[0] = bFinished[1] = bFinished[2] = bFinished[3] = false;
|
||||||
lastTicRun = 0;
|
lastTicRun = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DoomInterface::~DoomInterface() {
|
DoomInterface::~DoomInterface()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,85 +76,101 @@ void DoomInterface::Startup( int playerscount, bool multiplayer )
|
||||||
globalNetworking = multiplayer;
|
globalNetworking = multiplayer;
|
||||||
lastTicRun = 0;
|
lastTicRun = 0;
|
||||||
|
|
||||||
if (DoomLib::Z_Malloc == NULL) {
|
if( DoomLib::Z_Malloc == NULL )
|
||||||
|
{
|
||||||
DoomLib::Z_Malloc = Z_Malloc;
|
DoomLib::Z_Malloc = Z_Malloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Splitscreen
|
// Splitscreen
|
||||||
if ( !multiplayer && playerscount > 1 ) {
|
if( !multiplayer && playerscount > 1 )
|
||||||
|
{
|
||||||
localdargc += 2; // for the '-net' and the console number
|
localdargc += 2; // for the '-net' and the console number
|
||||||
localdargc += playerscount;
|
localdargc += playerscount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( multiplayer ) {
|
if( multiplayer )
|
||||||
|
{
|
||||||
// Force online games to 1 local player for now.
|
// Force online games to 1 local player for now.
|
||||||
// TODO: We should support local splitscreen and online.
|
// TODO: We should support local splitscreen and online.
|
||||||
numplayers = 1;
|
numplayers = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start up DooM Classic
|
// Start up DooM Classic
|
||||||
for ( i = 0; i < numplayers; ++i)
|
for( i = 0; i < numplayers; ++i )
|
||||||
{
|
{
|
||||||
DoomLib::SetPlayer(i);
|
DoomLib::SetPlayer( i );
|
||||||
|
|
||||||
bFinished[i] = false;
|
bFinished[i] = false;
|
||||||
DoomLib::InitGlobals( NULL );
|
DoomLib::InitGlobals( NULL );
|
||||||
|
|
||||||
if ( globalNetworking ) {
|
if( globalNetworking )
|
||||||
|
{
|
||||||
printf( "Starting mulitplayer game, argv = " );
|
printf( "Starting mulitplayer game, argv = " );
|
||||||
for ( int j = 0; j < mpArgc[0]; ++j ) {
|
for( int j = 0; j < mpArgc[0]; ++j )
|
||||||
|
{
|
||||||
printf( " %s", mpArgVPtr[0][j] );
|
printf( " %s", mpArgVPtr[0][j] );
|
||||||
}
|
}
|
||||||
printf( "\n" );
|
printf( "\n" );
|
||||||
DoomLib::InitGame(mpArgc[i], mpArgVPtr[i] );
|
DoomLib::InitGame( mpArgc[i], mpArgVPtr[i] );
|
||||||
} else {
|
}
|
||||||
DoomLib::InitGame(localdargc, (char **)dargv[i] );
|
else
|
||||||
|
{
|
||||||
|
DoomLib::InitGame( localdargc, ( char** )dargv[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DoomLib::skipToLoad ) {
|
if( DoomLib::skipToLoad )
|
||||||
|
{
|
||||||
G_LoadGame( DoomLib::loadGamePath );
|
G_LoadGame( DoomLib::loadGamePath );
|
||||||
DoomLib::skipToLoad = false;
|
DoomLib::skipToLoad = false;
|
||||||
::g->menuactive = 0;
|
::g->menuactive = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DoomLib::skipToNew ) {
|
if( DoomLib::skipToNew )
|
||||||
|
{
|
||||||
static int startLevel = 1;
|
static int startLevel = 1;
|
||||||
G_DeferedInitNew((skill_t)DoomLib::chosenSkill,DoomLib::chosenEpisode+1, startLevel);
|
G_DeferedInitNew( ( skill_t )DoomLib::chosenSkill, DoomLib::chosenEpisode + 1, startLevel );
|
||||||
DoomLib::skipToNew = false;
|
DoomLib::skipToNew = false;
|
||||||
::g->menuactive = 0;
|
::g->menuactive = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DoomLib::SetPlayer(-1);
|
DoomLib::SetPlayer( -1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DoomInterface::Frame( int iTime, idUserCmdMgr * userCmdMgr )
|
bool DoomInterface::Frame( int iTime, idUserCmdMgr* userCmdMgr )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
bool bAllFinished = true;
|
bool bAllFinished = true;
|
||||||
|
|
||||||
if ( !globalNetworking || ( lastTicRun < iTime ) ) {
|
if( !globalNetworking || ( lastTicRun < iTime ) )
|
||||||
|
{
|
||||||
|
|
||||||
drawFullScreen = false;
|
drawFullScreen = false;
|
||||||
|
|
||||||
DoomLib::SetPlayer( 0 );
|
DoomLib::SetPlayer( 0 );
|
||||||
DoomLib::PollNetwork();
|
DoomLib::PollNetwork();
|
||||||
|
|
||||||
for (i = 0; i < numplayers; ++i)
|
for( i = 0; i < numplayers; ++i )
|
||||||
{
|
{
|
||||||
DoomLib::SetPlayer( i );
|
DoomLib::SetPlayer( i );
|
||||||
|
|
||||||
I_SetTime( iTime );
|
I_SetTime( iTime );
|
||||||
|
|
||||||
if (bFinished[i] == false) {
|
if( bFinished[i] == false )
|
||||||
|
{
|
||||||
bAllFinished = false;
|
bAllFinished = false;
|
||||||
bFinished[i] = DoomLib::Poll();
|
bFinished[i] = DoomLib::Poll();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
if (::g->wipedone) {
|
if( ::g->wipedone )
|
||||||
if ( !waitingForWipe ) {
|
{
|
||||||
|
if( !waitingForWipe )
|
||||||
|
{
|
||||||
const bool didRunTic = DoomLib::Tic( userCmdMgr );
|
const bool didRunTic = DoomLib::Tic( userCmdMgr );
|
||||||
if ( didRunTic == false ) {
|
if( didRunTic == false )
|
||||||
|
{
|
||||||
//printf( "Skipping tic and yielding because not enough time has passed.\n" );
|
//printf( "Skipping tic and yielding because not enough time has passed.\n" );
|
||||||
|
|
||||||
// Give lower priority threads a chance to run.
|
// Give lower priority threads a chance to run.
|
||||||
|
@ -161,18 +179,20 @@ bool DoomInterface::Frame( int iTime, idUserCmdMgr * userCmdMgr )
|
||||||
}
|
}
|
||||||
DoomLib::Frame();
|
DoomLib::Frame();
|
||||||
}
|
}
|
||||||
if (::g->wipe) {
|
if( ::g->wipe )
|
||||||
|
{
|
||||||
DoomLib::Wipe();
|
DoomLib::Wipe();
|
||||||
// Draw the menus over the wipe.
|
// Draw the menus over the wipe.
|
||||||
M_Drawer();
|
M_Drawer();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ::g->gamestate != GS_LEVEL && GetNumPlayers() > 2 ) {
|
if( ::g->gamestate != GS_LEVEL && GetNumPlayers() > 2 )
|
||||||
|
{
|
||||||
drawFullScreen = true;
|
drawFullScreen = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DoomLib::SetPlayer(-1);
|
DoomLib::SetPlayer( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
DoomLib::SetPlayer( 0 );
|
DoomLib::SetPlayer( 0 );
|
||||||
|
@ -181,7 +201,9 @@ bool DoomInterface::Frame( int iTime, idUserCmdMgr * userCmdMgr )
|
||||||
DoomLib::SetPlayer( -1 );
|
DoomLib::SetPlayer( -1 );
|
||||||
|
|
||||||
lastTicRun = iTime;
|
lastTicRun = iTime;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
printf( "Skipping this frame becase it's not time to run a tic yet.\n" );
|
printf( "Skipping this frame becase it's not time to run a tic yet.\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,10 +212,12 @@ bool DoomInterface::Frame( int iTime, idUserCmdMgr * userCmdMgr )
|
||||||
|
|
||||||
void I_ShutdownNetwork();
|
void I_ShutdownNetwork();
|
||||||
|
|
||||||
void DoomInterface::Shutdown() {
|
void DoomInterface::Shutdown()
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for ( i=0; i < numplayers; i++ ) {
|
for( i = 0; i < numplayers; i++ )
|
||||||
|
{
|
||||||
DoomLib::SetPlayer( i );
|
DoomLib::SetPlayer( i );
|
||||||
D_QuitNetGame();
|
D_QuitNetGame();
|
||||||
}
|
}
|
||||||
|
@ -201,7 +225,8 @@ void DoomInterface::Shutdown() {
|
||||||
// Shutdown local network state
|
// Shutdown local network state
|
||||||
I_ShutdownNetwork();
|
I_ShutdownNetwork();
|
||||||
|
|
||||||
for ( i=0; i < numplayers; i++ ) {
|
for( i = 0; i < numplayers; i++ )
|
||||||
|
{
|
||||||
DoomLib::SetPlayer( i );
|
DoomLib::SetPlayer( i );
|
||||||
DoomLib::Shutdown();
|
DoomLib::Shutdown();
|
||||||
}
|
}
|
||||||
|
@ -213,11 +238,14 @@ void DoomInterface::Shutdown() {
|
||||||
|
|
||||||
qboolean G_CheckDemoStatus();
|
qboolean G_CheckDemoStatus();
|
||||||
|
|
||||||
void DoomInterface::QuitCurrentGame() {
|
void DoomInterface::QuitCurrentGame()
|
||||||
for ( int i = 0; i < numplayers; i++ ) {
|
{
|
||||||
|
for( int i = 0; i < numplayers; i++ )
|
||||||
|
{
|
||||||
DoomLib::SetPlayer( i );
|
DoomLib::SetPlayer( i );
|
||||||
|
|
||||||
if(::g->netgame) {
|
if( ::g->netgame )
|
||||||
|
{
|
||||||
// Shut down networking
|
// Shut down networking
|
||||||
D_QuitNetGame();
|
D_QuitNetGame();
|
||||||
}
|
}
|
||||||
|
@ -232,8 +260,8 @@ void DoomInterface::QuitCurrentGame() {
|
||||||
lastTicRun = 0;
|
lastTicRun = 0;
|
||||||
|
|
||||||
//if ( !gameLocal->IsSplitscreen() ) {
|
//if ( !gameLocal->IsSplitscreen() ) {
|
||||||
// Start background demos
|
// Start background demos
|
||||||
D_StartTitle();
|
D_StartTitle();
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,12 +269,15 @@ void DoomInterface::QuitCurrentGame() {
|
||||||
I_ShutdownNetwork();
|
I_ShutdownNetwork();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoomInterface::EndDMGame() {
|
void DoomInterface::EndDMGame()
|
||||||
|
{
|
||||||
|
|
||||||
for ( int i = 0; i < numplayers; i++ ) {
|
for( int i = 0; i < numplayers; i++ )
|
||||||
|
{
|
||||||
DoomLib::SetPlayer( i );
|
DoomLib::SetPlayer( i );
|
||||||
|
|
||||||
if(::g->netgame) {
|
if( ::g->netgame )
|
||||||
|
{
|
||||||
D_QuitNetGame();
|
D_QuitNetGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,40 +295,47 @@ void DoomInterface::EndDMGame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
int DoomInterface::CurrentPlayer() {
|
int DoomInterface::CurrentPlayer()
|
||||||
|
{
|
||||||
return DoomLib::GetPlayer();
|
return DoomLib::GetPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoomInterface::GetNumPlayers() const {
|
int DoomInterface::GetNumPlayers() const
|
||||||
|
{
|
||||||
return numplayers;
|
return numplayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ID_ENABLE_DOOM_CLASSIC_NETWORKING
|
#ifdef ID_ENABLE_DOOM_CLASSIC_NETWORKING
|
||||||
void DoomInterface::SetNetworking( DoomLib::RecvFunc recv, DoomLib::SendFunc send, DoomLib::SendRemoteFunc sendRemote ) {
|
void DoomInterface::SetNetworking( DoomLib::RecvFunc recv, DoomLib::SendFunc send, DoomLib::SendRemoteFunc sendRemote )
|
||||||
|
{
|
||||||
DoomLib::SetNetworking( recv, send, sendRemote );
|
DoomLib::SetNetworking( recv, send, sendRemote );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void DoomInterface::SetMultiplayerPlayers(int localPlayerIndex, int playerCount, int localPlayer, std::vector<std::string> playerAddresses) {
|
void DoomInterface::SetMultiplayerPlayers( int localPlayerIndex, int playerCount, int localPlayer, std::vector<std::string> playerAddresses )
|
||||||
|
{
|
||||||
|
|
||||||
for(int i = 0; i < 10; i++) {
|
for( int i = 0; i < 10; i++ )
|
||||||
|
{
|
||||||
mpArgVPtr[localPlayerIndex][i] = mpArgV[localPlayerIndex][i];
|
mpArgVPtr[localPlayerIndex][i] = mpArgV[localPlayerIndex][i];
|
||||||
}
|
}
|
||||||
|
|
||||||
mpArgc[localPlayerIndex] = playerCount+5;
|
mpArgc[localPlayerIndex] = playerCount + 5;
|
||||||
|
|
||||||
strcpy(mpArgV[localPlayerIndex][0], "doomlauncher");
|
strcpy( mpArgV[localPlayerIndex][0], "doomlauncher" );
|
||||||
strcpy(mpArgV[localPlayerIndex][1], "-dup");
|
strcpy( mpArgV[localPlayerIndex][1], "-dup" );
|
||||||
strcpy(mpArgV[localPlayerIndex][2], "1");
|
strcpy( mpArgV[localPlayerIndex][2], "1" );
|
||||||
strcpy(mpArgV[localPlayerIndex][3], "-net");
|
strcpy( mpArgV[localPlayerIndex][3], "-net" );
|
||||||
|
|
||||||
sprintf(mpArgV[localPlayerIndex][4], "%d", localPlayer);
|
sprintf( mpArgV[localPlayerIndex][4], "%d", localPlayer );
|
||||||
strcpy(mpArgV[localPlayerIndex][5], playerAddresses[localPlayer].c_str());
|
strcpy( mpArgV[localPlayerIndex][5], playerAddresses[localPlayer].c_str() );
|
||||||
|
|
||||||
int currentArg = 6;
|
int currentArg = 6;
|
||||||
for(int i = 0; i < playerCount; i++) {
|
for( int i = 0; i < playerCount; i++ )
|
||||||
if(i != localPlayer) {
|
{
|
||||||
strcpy(mpArgV[localPlayerIndex][currentArg], playerAddresses[i].c_str());
|
if( i != localPlayer )
|
||||||
|
{
|
||||||
|
strcpy( mpArgV[localPlayerIndex][currentArg], playerAddresses[i].c_str() );
|
||||||
currentArg++;
|
currentArg++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,13 +39,13 @@ class idUserCmdMgr;
|
||||||
class DoomInterface
|
class DoomInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DoomInterface();
|
DoomInterface();
|
||||||
virtual ~DoomInterface();
|
virtual ~DoomInterface();
|
||||||
|
|
||||||
typedef int ( *NoParamCallback)();
|
typedef int ( *NoParamCallback )();
|
||||||
|
|
||||||
void Startup( int players, bool multiplayer = false );
|
void Startup( int players, bool multiplayer = false );
|
||||||
bool Frame( int time, idUserCmdMgr * userCmdMgr );
|
bool Frame( int time, idUserCmdMgr* userCmdMgr );
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
void QuitCurrentGame();
|
void QuitCurrentGame();
|
||||||
void EndDMGame();
|
void EndDMGame();
|
||||||
|
@ -60,7 +60,7 @@ public:
|
||||||
|
|
||||||
static int CurrentPlayer();
|
static int CurrentPlayer();
|
||||||
|
|
||||||
void SetMultiplayerPlayers(int localPlayerIndex, int playerCount, int localPlayer, std::vector<std::string> playerAddresses );
|
void SetMultiplayerPlayers( int localPlayerIndex, int playerCount, int localPlayer, std::vector<std::string> playerAddresses );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int numplayers;
|
int numplayers;
|
||||||
|
@ -71,4 +71,4 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -50,184 +50,219 @@ bool globalPauseTime = false;
|
||||||
int PLAYERCOUNT = 1;
|
int PLAYERCOUNT = 1;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
bool debugOutput = true;
|
bool debugOutput = true;
|
||||||
#else
|
#else
|
||||||
bool debugOutput = false;
|
bool debugOutput = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace DoomLib
|
namespace DoomLib
|
||||||
{
|
{
|
||||||
static const char * Expansion_Names[] = {
|
static const char* Expansion_Names[] =
|
||||||
"Ultimate DOOM", "DOOM II: Hell On Earth", "Final DOOM: TNT Evilution", "Final DOOM: Plutonia Experiment", "DOOM II: Master Levels", "DOOM II: No Rest For The Living"
|
{
|
||||||
};
|
"Ultimate DOOM", "DOOM II: Hell On Earth", "Final DOOM: TNT Evilution", "Final DOOM: Plutonia Experiment", "DOOM II: Master Levels", "DOOM II: No Rest For The Living"
|
||||||
|
};
|
||||||
|
|
||||||
static const char* Skill_Names[] = {
|
static const char* Skill_Names[] =
|
||||||
"I'm Too Young To Die!", "Hey, Not Too Rough!", "Hurt Me Plenty!", "Ultra-Violence", "Nightmare"
|
{
|
||||||
};
|
"I'm Too Young To Die!", "Hey, Not Too Rough!", "Hurt Me Plenty!", "Ultra-Violence", "Nightmare"
|
||||||
|
};
|
||||||
|
|
||||||
static const char* Filter_Names[] = {
|
static const char* Filter_Names[] =
|
||||||
"#str_friends", "#str_around", "#str_top15"
|
{
|
||||||
};
|
"#str_friends", "#str_around", "#str_top15"
|
||||||
|
};
|
||||||
|
|
||||||
// Game-specific setup values.
|
// Game-specific setup values.
|
||||||
static const char * Doom_MapNames[] = {
|
static const char* Doom_MapNames[] =
|
||||||
"E1M1: Hangar", "E1M2: Nuclear Plant", "E1M3: Toxin Refinery", "E1M4: Command Control", "E1M5: Phobos Lab", "E1M6: Central Processing", "E1M7: Computer Station", "E1M8: Phobos Anomaly", "E1M9: Military Base",
|
{
|
||||||
"E2M1: Deimos Anomaly", "E2M2: Containment Area", "E2M3: Refinery", "E2M4: Deimos Lab", "E2M5: Command Center", "E2M6: Halls of the Damned", "E2M7: Spawning Vats", "E2M8: Tower of Babel", "E2M9: Fortress of Mystery",
|
"E1M1: Hangar", "E1M2: Nuclear Plant", "E1M3: Toxin Refinery", "E1M4: Command Control", "E1M5: Phobos Lab", "E1M6: Central Processing", "E1M7: Computer Station", "E1M8: Phobos Anomaly", "E1M9: Military Base",
|
||||||
"E3M1: Hell Keep", "E3M2: Slough of Despair", "E3M3: Pandemonium", "E3M4: House of Pain", "E3M5: Unholy Cathedral", "E3M6: MT. Erebus", "E3M7: Gate to Limbo", "E3M8: DIS", "E3M9: Warrens",
|
"E2M1: Deimos Anomaly", "E2M2: Containment Area", "E2M3: Refinery", "E2M4: Deimos Lab", "E2M5: Command Center", "E2M6: Halls of the Damned", "E2M7: Spawning Vats", "E2M8: Tower of Babel", "E2M9: Fortress of Mystery",
|
||||||
"E4M1: Hell Beneath", "E4M2: Perfect Hatred", "E4M3: Sever The Wicked", "E4M4: Unruly Evil", "E4M5: They Will Repent", "E4M6: Against Thee Wickedly", "E4M7: And Hell Followed", "E4M8: Unto The Cruel", "E4M9: Fear"
|
"E3M1: Hell Keep", "E3M2: Slough of Despair", "E3M3: Pandemonium", "E3M4: House of Pain", "E3M5: Unholy Cathedral", "E3M6: MT. Erebus", "E3M7: Gate to Limbo", "E3M8: DIS", "E3M9: Warrens",
|
||||||
};
|
"E4M1: Hell Beneath", "E4M2: Perfect Hatred", "E4M3: Sever The Wicked", "E4M4: Unruly Evil", "E4M5: They Will Repent", "E4M6: Against Thee Wickedly", "E4M7: And Hell Followed", "E4M8: Unto The Cruel", "E4M9: Fear"
|
||||||
|
};
|
||||||
|
|
||||||
static const char * Doom2_MapNames[] = {
|
static const char* Doom2_MapNames[] =
|
||||||
"1: Entryway", "2: Underhalls", "3: The Gantlet", "4: The Focus", "5: The Waste Tunnels", "6: The Crusher", "7: Dead Simple", "8: Tricks and Traps", "9: The Pit", "10: Refueling Base",
|
{
|
||||||
"11: Circle of Death", "12: The Factory", "13: Downtown", "14: The Inmost Dens", "15: Industrial Zone", "16: Suburbs", "17: Tenements", "18: The Courtyard", "19: The Citadel", "20: Gotcha!",
|
"1: Entryway", "2: Underhalls", "3: The Gantlet", "4: The Focus", "5: The Waste Tunnels", "6: The Crusher", "7: Dead Simple", "8: Tricks and Traps", "9: The Pit", "10: Refueling Base",
|
||||||
"21: Nirvana", "22: The Catacombs", "23: Barrels O' Fun", "24: The Chasm", "25: Bloodfalls", "26: The Abandoned Mines", "27: Monster Condo", "28: The Spirit World", "29: The Living End",
|
"11: Circle of Death", "12: The Factory", "13: Downtown", "14: The Inmost Dens", "15: Industrial Zone", "16: Suburbs", "17: Tenements", "18: The Courtyard", "19: The Citadel", "20: Gotcha!",
|
||||||
"30: Icon of Sin", "31: IDKFA", "32: Keen"
|
"21: Nirvana", "22: The Catacombs", "23: Barrels O' Fun", "24: The Chasm", "25: Bloodfalls", "26: The Abandoned Mines", "27: Monster Condo", "28: The Spirit World", "29: The Living End",
|
||||||
};
|
"30: Icon of Sin", "31: IDKFA", "32: Keen"
|
||||||
|
};
|
||||||
|
|
||||||
static const char * TNT_MapNames[] = {
|
static const char* TNT_MapNames[] =
|
||||||
"1: System Control", "2: Human BBQ", "3: Power Control", "4: Wormhole", "5: Hangar", "6: Open Season", "7: Prison", "8: Metal", "9: Stronghold", "10: Redemption", "11: Storage Facility",
|
{
|
||||||
"12: Crater", "13: Nukage Processing", "14: Steel Works", "15: Dead Zone", "16: Deepest Reaches", "17: Processing Area", "18: Mill", "19: Shipping & Respawning", "20: Central Processing",
|
"1: System Control", "2: Human BBQ", "3: Power Control", "4: Wormhole", "5: Hangar", "6: Open Season", "7: Prison", "8: Metal", "9: Stronghold", "10: Redemption", "11: Storage Facility",
|
||||||
"21: Administration Center", "22: Habitat", "23: Lunar Mining Project", "24: Quarry", "25: Baron's Den", "26: Ballistyx", "27: Mount Pain", "28: Heck", "29: River Styx", "30: Last Call", "31: Pharaoh", "32: Caribbean"
|
"12: Crater", "13: Nukage Processing", "14: Steel Works", "15: Dead Zone", "16: Deepest Reaches", "17: Processing Area", "18: Mill", "19: Shipping & Respawning", "20: Central Processing",
|
||||||
};
|
"21: Administration Center", "22: Habitat", "23: Lunar Mining Project", "24: Quarry", "25: Baron's Den", "26: Ballistyx", "27: Mount Pain", "28: Heck", "29: River Styx", "30: Last Call", "31: Pharaoh", "32: Caribbean"
|
||||||
|
};
|
||||||
|
|
||||||
static const char * Plut_MapNames[] = {
|
static const char* Plut_MapNames[] =
|
||||||
"1: Congo", "2: Well of Souls", "3: Aztec", "4: Caged", "5: Ghost Town", "6: Baron's Lair", "7: Caughtyard", "8: Realm", "9: Abattoire", "10: Onslaught", "11: Hunted", "12: Speed", "13: The Crypt", "14: Genesis",
|
{
|
||||||
"15: The Twilight", "16: The Omen", "17: Compound", "18: Neurosphere", "19: NME", "20: The Death Domain", "21: Slayer", "22: Impossible Mission", "23: Tombstone", "24: The Final Frontier", "25: The Temple of Darkness",
|
"1: Congo", "2: Well of Souls", "3: Aztec", "4: Caged", "5: Ghost Town", "6: Baron's Lair", "7: Caughtyard", "8: Realm", "9: Abattoire", "10: Onslaught", "11: Hunted", "12: Speed", "13: The Crypt", "14: Genesis",
|
||||||
"26: Bunker", "27: Anti-Christ", "28: The Sewers", "29: Odyssey of Noises", "30: The Gateway of Hell", "31: Cyberden", "32: Go 2 It"
|
"15: The Twilight", "16: The Omen", "17: Compound", "18: Neurosphere", "19: NME", "20: The Death Domain", "21: Slayer", "22: Impossible Mission", "23: Tombstone", "24: The Final Frontier", "25: The Temple of Darkness",
|
||||||
};
|
"26: Bunker", "27: Anti-Christ", "28: The Sewers", "29: Odyssey of Noises", "30: The Gateway of Hell", "31: Cyberden", "32: Go 2 It"
|
||||||
|
};
|
||||||
|
|
||||||
static const char * Mast_MapNames[] = {
|
static const char* Mast_MapNames[] =
|
||||||
"1: Attack", "2: Canyon","3: The Catwalk", "4: The Combine", "5: The Fistula", "6: The Garrison", "7: Titan Manor", "8: Paradox", "9: Subspace", "10: Subterra", "11: Trapped On Titan", "12: Virgil's Lead", "13: Minos' Judgement",
|
{
|
||||||
"14: Bloodsea Keep", "15: Mephisto's Maosoleum", "16: Nessus", "17: Geryon", "18: Vesperas", "19: Black Tower", "20: The Express Elevator To Hell", "21: Bad Dream"
|
"1: Attack", "2: Canyon", "3: The Catwalk", "4: The Combine", "5: The Fistula", "6: The Garrison", "7: Titan Manor", "8: Paradox", "9: Subspace", "10: Subterra", "11: Trapped On Titan", "12: Virgil's Lead", "13: Minos' Judgement",
|
||||||
};
|
"14: Bloodsea Keep", "15: Mephisto's Maosoleum", "16: Nessus", "17: Geryon", "18: Vesperas", "19: Black Tower", "20: The Express Elevator To Hell", "21: Bad Dream"
|
||||||
|
};
|
||||||
|
|
||||||
static const char * Nerve_MapNames[] = {
|
static const char* Nerve_MapNames[] =
|
||||||
"1: The Earth Base", "2: The Pain Labs", "3: Canyon of the Dead", "4: Hell Mountain", "5: Vivisection", "6: Inferno of Blood", "7: Baron's Banquet", "8: Tomb of Malevolence", "9: March of Demons"
|
{
|
||||||
};
|
"1: The Earth Base", "2: The Pain Labs", "3: Canyon of the Dead", "4: Hell Mountain", "5: Vivisection", "6: Inferno of Blood", "7: Baron's Banquet", "8: Tomb of Malevolence", "9: March of Demons"
|
||||||
|
};
|
||||||
|
|
||||||
const ExpansionData App_Expansion_Data_Local[] = {
|
const ExpansionData App_Expansion_Data_Local[] =
|
||||||
{ ExpansionData::IWAD, retail, doom, "DOOM", DOOMWADDIR"DOOM.WAD", NULL, "base/textures/DOOMICON.PNG" , Doom_MapNames },
|
{
|
||||||
{ ExpansionData::IWAD, commercial, doom2, "DOOM 2", DOOMWADDIR"DOOM2.WAD", NULL, "base/textures/DOOM2ICON.PNG" , Doom2_MapNames },
|
{ ExpansionData::IWAD, retail, doom, "DOOM", DOOMWADDIR"DOOM.WAD", NULL, "base/textures/DOOMICON.PNG" , Doom_MapNames },
|
||||||
{ ExpansionData::IWAD, commercial, pack_tnt, "FINAL DOOM: TNT EVILUTION", DOOMWADDIR"TNT.WAD", NULL, "base/textures/TNTICON.PNG" , TNT_MapNames },
|
{ ExpansionData::IWAD, commercial, doom2, "DOOM 2", DOOMWADDIR"DOOM2.WAD", NULL, "base/textures/DOOM2ICON.PNG" , Doom2_MapNames },
|
||||||
{ ExpansionData::IWAD, commercial, pack_plut, "FINAL DOOM: PLUTONIA EXPERIMENT", DOOMWADDIR"PLUTONIA.WAD", NULL, "base/textures/PLUTICON.PNG" , Plut_MapNames },
|
{ ExpansionData::IWAD, commercial, pack_tnt, "FINAL DOOM: TNT EVILUTION", DOOMWADDIR"TNT.WAD", NULL, "base/textures/TNTICON.PNG" , TNT_MapNames },
|
||||||
{ ExpansionData::PWAD, commercial, pack_master, "DOOM 2: MASTER LEVELS", DOOMWADDIR"DOOM2.WAD", DOOMWADDIR"MASTERLEVELS.WAD", "base/textures/MASTICON.PNG" , Mast_MapNames },
|
{ ExpansionData::IWAD, commercial, pack_plut, "FINAL DOOM: PLUTONIA EXPERIMENT", DOOMWADDIR"PLUTONIA.WAD", NULL, "base/textures/PLUTICON.PNG" , Plut_MapNames },
|
||||||
{ ExpansionData::PWAD, commercial, pack_nerve, "DOOM 2: NO REST FOR THE LIVING", DOOMWADDIR"DOOM2.WAD", DOOMWADDIR"NERVE.WAD", "base/textures/NERVEICON.PNG" , Nerve_MapNames },
|
{ ExpansionData::PWAD, commercial, pack_master, "DOOM 2: MASTER LEVELS", DOOMWADDIR"DOOM2.WAD", DOOMWADDIR"MASTERLEVELS.WAD", "base/textures/MASTICON.PNG" , Mast_MapNames },
|
||||||
};
|
{ ExpansionData::PWAD, commercial, pack_nerve, "DOOM 2: NO REST FOR THE LIVING", DOOMWADDIR"DOOM2.WAD", DOOMWADDIR"NERVE.WAD", "base/textures/NERVEICON.PNG" , Nerve_MapNames },
|
||||||
|
};
|
||||||
|
|
||||||
int classicRemap[K_LAST_KEY];
|
int classicRemap[K_LAST_KEY];
|
||||||
|
|
||||||
const ExpansionData * GetCurrentExpansion() {
|
const ExpansionData* GetCurrentExpansion()
|
||||||
return &App_Expansion_Data_Local[ DoomLib::expansionSelected ];
|
{
|
||||||
|
return &App_Expansion_Data_Local[ DoomLib::expansionSelected ];
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCurrentExpansion( int expansion )
|
||||||
|
{
|
||||||
|
expansionDirty = true;
|
||||||
|
expansionSelected = expansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetIdealExpansion( int expansion )
|
||||||
|
{
|
||||||
|
idealExpansion = expansion;
|
||||||
|
}
|
||||||
|
|
||||||
|
idStr currentMapName;
|
||||||
|
idStr currentDifficulty;
|
||||||
|
|
||||||
|
void SetCurrentMapName( idStr name )
|
||||||
|
{
|
||||||
|
currentMapName = name;
|
||||||
|
}
|
||||||
|
const idStr& GetCurrentMapName()
|
||||||
|
{
|
||||||
|
return currentMapName;
|
||||||
|
}
|
||||||
|
void SetCurrentDifficulty( idStr name )
|
||||||
|
{
|
||||||
|
currentDifficulty = name;
|
||||||
|
}
|
||||||
|
const idStr& GetCurrentDifficulty()
|
||||||
|
{
|
||||||
|
return currentDifficulty;
|
||||||
|
}
|
||||||
|
|
||||||
|
int currentplayer = -1;
|
||||||
|
|
||||||
|
Globals* globaldata[4];
|
||||||
|
|
||||||
|
//RecvFunc Recv;
|
||||||
|
//SendFunc Send;
|
||||||
|
//SendRemoteFunc SendRemote;
|
||||||
|
|
||||||
|
|
||||||
|
bool Active = true;
|
||||||
|
DoomInterface Interface;
|
||||||
|
|
||||||
|
int idealExpansion = 0;
|
||||||
|
int expansionSelected = 0;
|
||||||
|
bool expansionDirty = true;
|
||||||
|
|
||||||
|
bool skipToLoad = false;
|
||||||
|
char loadGamePath[MAX_PATH];
|
||||||
|
|
||||||
|
bool skipToNew = false;
|
||||||
|
int chosenSkill = 0;
|
||||||
|
int chosenEpisode = 1;
|
||||||
|
|
||||||
|
idMatchParameters matchParms;
|
||||||
|
|
||||||
|
void* ( *Z_Malloc )( int size, int tag, void* user ) = NULL;
|
||||||
|
void ( *Z_FreeTag )( int lowtag );
|
||||||
|
|
||||||
|
idArray< idSysMutex, 4 > playerScreenMutexes;
|
||||||
|
|
||||||
|
void ExitGame()
|
||||||
|
{
|
||||||
|
// TODO: If we ever support splitscreen and online,
|
||||||
|
// we'll have to call D_QuitNetGame for all local players.
|
||||||
|
DoomLib::SetPlayer( 0 );
|
||||||
|
D_QuitNetGame();
|
||||||
|
|
||||||
|
session->QuitMatch();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShowXToContinue( bool activate )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
========================
|
||||||
|
DoomLib::GetGameSKU
|
||||||
|
========================
|
||||||
|
*/
|
||||||
|
gameSKU_t GetGameSKU()
|
||||||
|
{
|
||||||
|
|
||||||
|
if( common->GetCurrentGame() == DOOM_CLASSIC )
|
||||||
|
{
|
||||||
|
return GAME_SKU_DOOM1_BFG;
|
||||||
|
}
|
||||||
|
else if( common->GetCurrentGame() == DOOM2_CLASSIC )
|
||||||
|
{
|
||||||
|
return GAME_SKU_DOOM2_BFG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCurrentExpansion( int expansion ) {
|
assert( false && "Invalid basepath" );
|
||||||
expansionDirty = true;
|
return GAME_SKU_DCC;
|
||||||
expansionSelected = expansion;
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
========================
|
||||||
|
DoomLib::ActivateGame
|
||||||
|
========================
|
||||||
|
*/
|
||||||
|
void ActivateGame()
|
||||||
|
{
|
||||||
|
Active = true;
|
||||||
|
|
||||||
|
// Turn off menu toggler
|
||||||
|
int originalPlayer = DoomLib::GetPlayer();
|
||||||
|
|
||||||
|
for( int i = 0; i < Interface.GetNumPlayers(); i++ )
|
||||||
|
{
|
||||||
|
DoomLib::SetPlayer( i );
|
||||||
|
::g->menuactive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetIdealExpansion( int expansion ) {
|
globalPauseTime = false;
|
||||||
idealExpansion = expansion;
|
|
||||||
}
|
DoomLib::SetPlayer( originalPlayer );
|
||||||
|
}
|
||||||
idStr currentMapName;
|
|
||||||
idStr currentDifficulty;
|
/*
|
||||||
|
========================
|
||||||
void SetCurrentMapName( idStr name ) { currentMapName = name; }
|
DoomLib::HandleEndMatch
|
||||||
const idStr & GetCurrentMapName() { return currentMapName; }
|
========================
|
||||||
void SetCurrentDifficulty( idStr name ) { currentDifficulty = name; }
|
*/
|
||||||
const idStr & GetCurrentDifficulty() { return currentDifficulty; }
|
void HandleEndMatch()
|
||||||
|
{
|
||||||
int currentplayer = -1;
|
if( session->GetGameLobbyBase().IsHost() )
|
||||||
|
{
|
||||||
Globals *globaldata[4];
|
ShowXToContinue( false );
|
||||||
|
session->EndMatch();
|
||||||
//RecvFunc Recv;
|
|
||||||
//SendFunc Send;
|
|
||||||
//SendRemoteFunc SendRemote;
|
|
||||||
|
|
||||||
|
|
||||||
bool Active = true;
|
|
||||||
DoomInterface Interface;
|
|
||||||
|
|
||||||
int idealExpansion = 0;
|
|
||||||
int expansionSelected = 0;
|
|
||||||
bool expansionDirty = true;
|
|
||||||
|
|
||||||
bool skipToLoad = false;
|
|
||||||
char loadGamePath[MAX_PATH];
|
|
||||||
|
|
||||||
bool skipToNew = false;
|
|
||||||
int chosenSkill = 0;
|
|
||||||
int chosenEpisode = 1;
|
|
||||||
|
|
||||||
idMatchParameters matchParms;
|
|
||||||
|
|
||||||
void * (*Z_Malloc)( int size, int tag, void* user ) = NULL;
|
|
||||||
void (*Z_FreeTag)(int lowtag );
|
|
||||||
|
|
||||||
idArray< idSysMutex, 4 > playerScreenMutexes;
|
|
||||||
|
|
||||||
void ExitGame() {
|
|
||||||
// TODO: If we ever support splitscreen and online,
|
|
||||||
// we'll have to call D_QuitNetGame for all local players.
|
|
||||||
DoomLib::SetPlayer( 0 );
|
|
||||||
D_QuitNetGame();
|
|
||||||
|
|
||||||
session->QuitMatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShowXToContinue( bool activate ) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
========================
|
|
||||||
DoomLib::GetGameSKU
|
|
||||||
========================
|
|
||||||
*/
|
|
||||||
gameSKU_t GetGameSKU() {
|
|
||||||
|
|
||||||
if ( common->GetCurrentGame() == DOOM_CLASSIC ) {
|
|
||||||
return GAME_SKU_DOOM1_BFG;
|
|
||||||
} else if ( common->GetCurrentGame() == DOOM2_CLASSIC ) {
|
|
||||||
return GAME_SKU_DOOM2_BFG;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert( false && "Invalid basepath" );
|
|
||||||
return GAME_SKU_DCC;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
========================
|
|
||||||
DoomLib::ActivateGame
|
|
||||||
========================
|
|
||||||
*/
|
|
||||||
void ActivateGame() {
|
|
||||||
Active = true;
|
|
||||||
|
|
||||||
// Turn off menu toggler
|
|
||||||
int originalPlayer = DoomLib::GetPlayer();
|
|
||||||
|
|
||||||
for ( int i = 0; i < Interface.GetNumPlayers(); i++ ) {
|
|
||||||
DoomLib::SetPlayer(i);
|
|
||||||
::g->menuactive = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
globalPauseTime = false;
|
|
||||||
|
|
||||||
DoomLib::SetPlayer( originalPlayer );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
========================
|
|
||||||
DoomLib::HandleEndMatch
|
|
||||||
========================
|
|
||||||
*/
|
|
||||||
void HandleEndMatch() {
|
|
||||||
if ( session->GetGameLobbyBase().IsHost() ) {
|
|
||||||
ShowXToContinue( false );
|
|
||||||
session->EndMatch();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -242,24 +277,28 @@ extern void I_ShutdownGraphics();
|
||||||
extern void I_ProcessSoundEvents();
|
extern void I_ProcessSoundEvents();
|
||||||
|
|
||||||
|
|
||||||
void DoomLib::InitGlobals( void *ptr /* = NULL */ )
|
void DoomLib::InitGlobals( void* ptr /* = NULL */ )
|
||||||
{
|
{
|
||||||
if (ptr == NULL)
|
if( ptr == NULL )
|
||||||
|
{
|
||||||
ptr = new Globals;
|
ptr = new Globals;
|
||||||
|
}
|
||||||
|
|
||||||
globaldata[currentplayer] = static_cast<Globals*>(ptr);
|
globaldata[currentplayer] = static_cast<Globals*>( ptr );
|
||||||
|
|
||||||
memset( globaldata[currentplayer], 0, sizeof(Globals) );
|
memset( globaldata[currentplayer], 0, sizeof( Globals ) );
|
||||||
g = globaldata[currentplayer];
|
g = globaldata[currentplayer];
|
||||||
g->InitGlobals();
|
g->InitGlobals();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *DoomLib::GetGlobalData( int player ) {
|
void* DoomLib::GetGlobalData( int player )
|
||||||
|
{
|
||||||
return globaldata[player];
|
return globaldata[player];
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoomLib::InitControlRemap() {
|
void DoomLib::InitControlRemap()
|
||||||
|
{
|
||||||
|
|
||||||
memset( classicRemap, K_NONE, sizeof( classicRemap ) );
|
memset( classicRemap, K_NONE, sizeof( classicRemap ) );
|
||||||
|
|
||||||
|
@ -280,17 +319,22 @@ void DoomLib::InitControlRemap() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
keyNum_t DoomLib::RemapControl( keyNum_t key ) {
|
keyNum_t DoomLib::RemapControl( keyNum_t key )
|
||||||
|
{
|
||||||
|
|
||||||
if( classicRemap[ key ] == K_NONE ) {
|
if( classicRemap[ key ] == K_NONE )
|
||||||
|
{
|
||||||
return key;
|
return key;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
if( ::g->menuactive && key == K_JOY2 ) {
|
if( ::g->menuactive && key == K_JOY2 )
|
||||||
|
{
|
||||||
return K_BACKSPACE;
|
return K_BACKSPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (keyNum_t)classicRemap[ key ];
|
return ( keyNum_t )classicRemap[ key ];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -312,8 +356,8 @@ bool DoomLib::Poll()
|
||||||
return D_DoomMainPoll();
|
return D_DoomMainPoll();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TryRunTics( idUserCmdMgr * userCmdMgr );
|
bool TryRunTics( idUserCmdMgr* userCmdMgr );
|
||||||
bool DoomLib::Tic( idUserCmdMgr * userCmdMgr )
|
bool DoomLib::Tic( idUserCmdMgr* userCmdMgr )
|
||||||
{
|
{
|
||||||
return TryRunTics( userCmdMgr );
|
return TryRunTics( userCmdMgr );
|
||||||
}
|
}
|
||||||
|
@ -334,7 +378,8 @@ void DoomLib::Frame( int realoffset, int buffer )
|
||||||
// suffers too much, we can try to narrow the scope.
|
// suffers too much, we can try to narrow the scope.
|
||||||
// Just be careful, because the player's screen data is updated in many different
|
// Just be careful, because the player's screen data is updated in many different
|
||||||
// places.
|
// places.
|
||||||
if ( 0 <= currentplayer && currentplayer <= 4 ) {
|
if( 0 <= currentplayer && currentplayer <= 4 )
|
||||||
|
{
|
||||||
idScopedCriticalSection crit( playerScreenMutexes[currentplayer] );
|
idScopedCriticalSection crit( playerScreenMutexes[currentplayer] );
|
||||||
|
|
||||||
D_RunFrame( true );
|
D_RunFrame( true );
|
||||||
|
@ -343,7 +388,7 @@ void DoomLib::Frame( int realoffset, int buffer )
|
||||||
|
|
||||||
void DoomLib::Draw()
|
void DoomLib::Draw()
|
||||||
{
|
{
|
||||||
R_RenderPlayerView (&::g->players[::g->displayplayer]);
|
R_RenderPlayerView( &::g->players[::g->displayplayer] );
|
||||||
}
|
}
|
||||||
|
|
||||||
angle_t GetViewAngle()
|
angle_t GetViewAngle()
|
||||||
|
@ -354,8 +399,8 @@ angle_t GetViewAngle()
|
||||||
void SetViewAngle( angle_t ang )
|
void SetViewAngle( angle_t ang )
|
||||||
{
|
{
|
||||||
g->viewangle = ang;
|
g->viewangle = ang;
|
||||||
::g->viewxoffset = (finesine[g->viewangle>>ANGLETOFINESHIFT]*::g->realoffset) >> 8;
|
::g->viewxoffset = ( finesine[g->viewangle >> ANGLETOFINESHIFT]*::g->realoffset ) >> 8;
|
||||||
::g->viewyoffset = (finecosine[g->viewangle>>ANGLETOFINESHIFT]*::g->realoffset) >> 8;
|
::g->viewyoffset = ( finecosine[g->viewangle >> ANGLETOFINESHIFT]*::g->realoffset ) >> 8;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +426,8 @@ fixed_t GetViewY()
|
||||||
return ::g->viewy + ::g->viewyoffset;
|
return ::g->viewy + ::g->viewyoffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoomLib::Shutdown() {
|
void DoomLib::Shutdown()
|
||||||
|
{
|
||||||
//D_QuitNetGame ();
|
//D_QuitNetGame ();
|
||||||
I_ShutdownSound();
|
I_ShutdownSound();
|
||||||
I_ShutdownGraphics();
|
I_ShutdownGraphics();
|
||||||
|
@ -389,12 +435,14 @@ void DoomLib::Shutdown() {
|
||||||
W_Shutdown();
|
W_Shutdown();
|
||||||
|
|
||||||
// De-allocate the zone memory (never happened in original doom, until quit)
|
// De-allocate the zone memory (never happened in original doom, until quit)
|
||||||
if ( ::g->mainzone ) {
|
if( ::g->mainzone )
|
||||||
|
{
|
||||||
free( ::g->mainzone );
|
free( ::g->mainzone );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the globals
|
// Delete the globals
|
||||||
if ( globaldata[currentplayer] ) {
|
if( globaldata[currentplayer] )
|
||||||
|
{
|
||||||
delete globaldata[currentplayer];
|
delete globaldata[currentplayer];
|
||||||
globaldata[currentplayer] = NULL;
|
globaldata[currentplayer] = NULL;
|
||||||
}
|
}
|
||||||
|
@ -405,13 +453,16 @@ void DoomLib::SetPlayer( int id )
|
||||||
{
|
{
|
||||||
currentplayer = id;
|
currentplayer = id;
|
||||||
|
|
||||||
if ( id < 0 || id >= MAX_PLAYERS ) {
|
if( id < 0 || id >= MAX_PLAYERS )
|
||||||
|
{
|
||||||
g = NULL;
|
g = NULL;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
|
|
||||||
// Big Fucking hack.
|
// Big Fucking hack.
|
||||||
if( globalNetworking && session->GetGameLobbyBase().GetMatchParms().matchFlags | MATCH_ONLINE ) {
|
if( globalNetworking && session->GetGameLobbyBase().GetMatchParms().matchFlags | MATCH_ONLINE )
|
||||||
|
{
|
||||||
currentplayer = 0;
|
currentplayer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,18 +484,20 @@ int DoomLib::GetPlayer()
|
||||||
return currentplayer;
|
return currentplayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte DoomLib::BuildSourceDest( int toNode ) {
|
byte DoomLib::BuildSourceDest( int toNode )
|
||||||
|
{
|
||||||
byte sourceDest = 0;
|
byte sourceDest = 0;
|
||||||
sourceDest |= ::g->consoleplayer << 2;
|
sourceDest |= ::g->consoleplayer << 2;
|
||||||
sourceDest |= RemoteNodeToPlayerIndex( toNode );
|
sourceDest |= RemoteNodeToPlayerIndex( toNode );
|
||||||
return sourceDest;
|
return sourceDest;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_Printf(char *error, ...);
|
void I_Printf( char* error, ... );
|
||||||
|
|
||||||
void DoomLib::GetSourceDest( byte sourceDest, int* source, int* dest ) {
|
void DoomLib::GetSourceDest( byte sourceDest, int* source, int* dest )
|
||||||
|
{
|
||||||
|
|
||||||
int src = (sourceDest & 12) >> 2;
|
int src = ( sourceDest & 12 ) >> 2;
|
||||||
int dst = sourceDest & 3;
|
int dst = sourceDest & 3;
|
||||||
|
|
||||||
*source = PlayerIndexToRemoteNode( src );
|
*source = PlayerIndexToRemoteNode( src );
|
||||||
|
@ -453,14 +506,16 @@ void DoomLib::GetSourceDest( byte sourceDest, int* source, int* dest ) {
|
||||||
*dest = PlayerIndexToRemoteNode( dst );
|
*dest = PlayerIndexToRemoteNode( dst );
|
||||||
}
|
}
|
||||||
|
|
||||||
int nodeMap[4][4] = {
|
int nodeMap[4][4] =
|
||||||
|
{
|
||||||
{0, 1, 2, 3}, //Player 0
|
{0, 1, 2, 3}, //Player 0
|
||||||
{1, 0, 2, 3}, //Player 1
|
{1, 0, 2, 3}, //Player 1
|
||||||
{2, 0, 1, 3}, //Player 2
|
{2, 0, 1, 3}, //Player 2
|
||||||
{3, 0, 1, 2} //Player 3
|
{3, 0, 1, 2} //Player 3
|
||||||
};
|
};
|
||||||
|
|
||||||
int DoomLib::RemoteNodeToPlayerIndex( int node ) {
|
int DoomLib::RemoteNodeToPlayerIndex( int node )
|
||||||
|
{
|
||||||
//This needs to be called with the proper doom globals set so this calculation will work properly
|
//This needs to be called with the proper doom globals set so this calculation will work properly
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -479,14 +534,16 @@ int DoomLib::RemoteNodeToPlayerIndex( int node ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int indexMap[4][4] = {
|
int indexMap[4][4] =
|
||||||
|
{
|
||||||
{0, 1, 2, 3}, //Player 0
|
{0, 1, 2, 3}, //Player 0
|
||||||
{1, 0, 2, 3}, //Player 1
|
{1, 0, 2, 3}, //Player 1
|
||||||
{1, 2, 0, 3}, //Player 2
|
{1, 2, 0, 3}, //Player 2
|
||||||
{1, 2, 3, 0} //Player 3
|
{1, 2, 3, 0} //Player 3
|
||||||
};
|
};
|
||||||
|
|
||||||
int DoomLib::PlayerIndexToRemoteNode( int index ) {
|
int DoomLib::PlayerIndexToRemoteNode( int index )
|
||||||
|
{
|
||||||
/*int player = ::g->consoleplayer;
|
/*int player = ::g->consoleplayer;
|
||||||
if( index == 0 ) {
|
if( index == 0 ) {
|
||||||
return player;
|
return player;
|
||||||
|
@ -498,14 +555,17 @@ int DoomLib::PlayerIndexToRemoteNode( int index ) {
|
||||||
return indexMap[::g->consoleplayer][index];
|
return indexMap[::g->consoleplayer][index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_Error (const char *error, ...);
|
void I_Error( const char* error, ... );
|
||||||
extern bool useTech5Packets;
|
extern bool useTech5Packets;
|
||||||
|
|
||||||
void DoomLib::PollNetwork() {
|
void DoomLib::PollNetwork()
|
||||||
|
{
|
||||||
#if 0
|
#if 0
|
||||||
if ( !useTech5Packets ) {
|
if( !useTech5Packets )
|
||||||
|
{
|
||||||
|
|
||||||
if ( !globalNetworking ) {
|
if( !globalNetworking )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,15 +574,17 @@ void DoomLib::PollNetwork() {
|
||||||
socklen_t fromlen;
|
socklen_t fromlen;
|
||||||
doomdata_t sw;
|
doomdata_t sw;
|
||||||
|
|
||||||
while(1) {
|
while( 1 )
|
||||||
|
{
|
||||||
int receivedSize = recvfrom( ::g->insocket, &sw, sizeof( doomdata_t ), MSG_DONTWAIT, &fromaddress, &fromlen );
|
int receivedSize = recvfrom( ::g->insocket, &sw, sizeof( doomdata_t ), MSG_DONTWAIT, &fromaddress, &fromlen );
|
||||||
//c = WSARecvFrom(::g->insocket, &buffer, 1, &num_recieved, &flags, (struct sockaddr*)&fromaddress, &fromlen, 0, 0);
|
//c = WSARecvFrom(::g->insocket, &buffer, 1, &num_recieved, &flags, (struct sockaddr*)&fromaddress, &fromlen, 0, 0);
|
||||||
|
|
||||||
if ( receivedSize < 0 )
|
if( receivedSize < 0 )
|
||||||
{
|
{
|
||||||
int err = sys_net_errno;
|
int err = sys_net_errno;
|
||||||
if (err != SYS_NET_EWOULDBLOCK ) {
|
if( err != SYS_NET_EWOULDBLOCK )
|
||||||
I_Error ("GetPacket: %d", err );
|
{
|
||||||
|
I_Error( "GetPacket: %d", err );
|
||||||
//I_Printf ("GetPacket: %s",strerror(errno));
|
//I_Printf ("GetPacket: %s",strerror(errno));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -535,21 +597,24 @@ void DoomLib::PollNetwork() {
|
||||||
GetSourceDest( sw.sourceDest, &source, &dest );
|
GetSourceDest( sw.sourceDest, &source, &dest );
|
||||||
|
|
||||||
//Push the packet onto the network stack to be processed.
|
//Push the packet onto the network stack to be processed.
|
||||||
DoomLib::Send( (char*)&sw, receivedSize, NULL, dest );
|
DoomLib::Send( ( char* )&sw, receivedSize, NULL, dest );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoomLib::SendNetwork() {
|
void DoomLib::SendNetwork()
|
||||||
|
{
|
||||||
|
|
||||||
if ( !globalNetworking ) {
|
if( !globalNetworking )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//DoomLib::SendRemote();
|
//DoomLib::SendRemote();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoomLib::RunSound() {
|
void DoomLib::RunSound()
|
||||||
|
{
|
||||||
|
|
||||||
I_ProcessSoundEvents();
|
I_ProcessSoundEvents();
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,8 @@ struct rumble_t
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum gameSKU_t {
|
enum gameSKU_t
|
||||||
|
{
|
||||||
GAME_SKU_DCC = 0, // Doom Classic Complete
|
GAME_SKU_DCC = 0, // Doom Classic Complete
|
||||||
GAME_SKU_DOOM1_BFG, // Doom 1 Ran from BFG
|
GAME_SKU_DOOM1_BFG, // Doom 1 Ran from BFG
|
||||||
GAME_SKU_DOOM2_BFG, // Doom 2 Ran from BFG
|
GAME_SKU_DOOM2_BFG, // Doom 2 Ran from BFG
|
||||||
|
@ -75,16 +76,17 @@ enum gameSKU_t {
|
||||||
ExpansionData
|
ExpansionData
|
||||||
================================================================================================
|
================================================================================================
|
||||||
*/
|
*/
|
||||||
struct ExpansionData {
|
struct ExpansionData
|
||||||
|
{
|
||||||
|
|
||||||
enum { IWAD = 0, PWAD = 1 } type;
|
enum { IWAD = 0, PWAD = 1 } type;
|
||||||
GameMode_t gameMode;
|
GameMode_t gameMode;
|
||||||
GameMission_t pack_type;
|
GameMission_t pack_type;
|
||||||
const char * expansionName;
|
const char* expansionName;
|
||||||
const char * iWadFilename;
|
const char* iWadFilename;
|
||||||
const char * pWadFilename;
|
const char* pWadFilename;
|
||||||
const char * saveImageFile;
|
const char* saveImageFile;
|
||||||
const char ** mapNames;
|
const char** mapNames;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -93,75 +95,75 @@ struct ExpansionData {
|
||||||
|
|
||||||
namespace DoomLib
|
namespace DoomLib
|
||||||
{
|
{
|
||||||
//typedef int ( *RecvFunc)( char* buff, DWORD *numRecv );
|
//typedef int ( *RecvFunc)( char* buff, DWORD *numRecv );
|
||||||
//typedef int ( *SendFunc)( const char* buff, DWORD size, sockaddr_in *target, int toNode );
|
//typedef int ( *SendFunc)( const char* buff, DWORD size, sockaddr_in *target, int toNode );
|
||||||
//typedef int ( *SendRemoteFunc)();
|
//typedef int ( *SendRemoteFunc)();
|
||||||
|
|
||||||
void InitGlobals( void *ptr = NULL );
|
void InitGlobals( void* ptr = NULL );
|
||||||
void InitGame( int argc, char ** argv );
|
void InitGame( int argc, char** argv );
|
||||||
void InitControlRemap();
|
void InitControlRemap();
|
||||||
keyNum_t RemapControl( keyNum_t key );
|
keyNum_t RemapControl( keyNum_t key );
|
||||||
bool Poll();
|
bool Poll();
|
||||||
bool Tic( idUserCmdMgr * userCmdMgr );
|
bool Tic( idUserCmdMgr* userCmdMgr );
|
||||||
void Wipe();
|
void Wipe();
|
||||||
void Frame( int realoffset = 0, int buffer = 0 );
|
void Frame( int realoffset = 0, int buffer = 0 );
|
||||||
void Draw();
|
void Draw();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
//void SetNetworking( RecvFunc rf, SendFunc sf, SendRemoteFunc sendRemote );
|
//void SetNetworking( RecvFunc rf, SendFunc sf, SendRemoteFunc sendRemote );
|
||||||
|
|
||||||
void SetPlayer( int id );
|
void SetPlayer( int id );
|
||||||
int GetPlayer();
|
int GetPlayer();
|
||||||
|
|
||||||
byte BuildSourceDest( int toNode );
|
byte BuildSourceDest( int toNode );
|
||||||
void GetSourceDest( byte sourceDest, int* source, int* dest );
|
void GetSourceDest( byte sourceDest, int* source, int* dest );
|
||||||
|
|
||||||
int RemoteNodeToPlayerIndex( int node );
|
int RemoteNodeToPlayerIndex( int node );
|
||||||
int PlayerIndexToRemoteNode( int index );
|
int PlayerIndexToRemoteNode( int index );
|
||||||
|
|
||||||
void PollNetwork();
|
void PollNetwork();
|
||||||
void SendNetwork();
|
void SendNetwork();
|
||||||
|
|
||||||
void *GetGlobalData( int player );
|
void* GetGlobalData( int player );
|
||||||
|
|
||||||
void RunSound();
|
void RunSound();
|
||||||
|
|
||||||
//extern RecvFunc Recv;
|
//extern RecvFunc Recv;
|
||||||
//extern SendFunc Send;
|
//extern SendFunc Send;
|
||||||
//extern SendRemoteFunc SendRemote;
|
//extern SendRemoteFunc SendRemote;
|
||||||
|
|
||||||
extern void* (*Z_Malloc)( int size, int tag, void* user );
|
extern void* ( *Z_Malloc )( int size, int tag, void* user );
|
||||||
extern void (*Z_FreeTag)(int lowtag );
|
extern void ( *Z_FreeTag )( int lowtag );
|
||||||
|
|
||||||
extern DoomInterface Interface;
|
extern DoomInterface Interface;
|
||||||
extern int idealExpansion;
|
extern int idealExpansion;
|
||||||
extern int expansionSelected;
|
extern int expansionSelected;
|
||||||
extern bool expansionDirty;
|
extern bool expansionDirty;
|
||||||
|
|
||||||
extern bool skipToLoad;
|
extern bool skipToLoad;
|
||||||
extern char loadGamePath[MAX_PATH];
|
extern char loadGamePath[MAX_PATH];
|
||||||
|
|
||||||
extern bool skipToNew;
|
extern bool skipToNew;
|
||||||
extern int chosenSkill;
|
extern int chosenSkill;
|
||||||
extern int chosenEpisode;
|
extern int chosenEpisode;
|
||||||
|
|
||||||
extern idMatchParameters matchParms;
|
extern idMatchParameters matchParms;
|
||||||
|
|
||||||
const ExpansionData * GetCurrentExpansion();
|
const ExpansionData* GetCurrentExpansion();
|
||||||
void SetCurrentExpansion( int expansion );
|
void SetCurrentExpansion( int expansion );
|
||||||
|
|
||||||
void SetIdealExpansion( int expansion );
|
void SetIdealExpansion( int expansion );
|
||||||
|
|
||||||
void SetCurrentMapName( idStr name );
|
void SetCurrentMapName( idStr name );
|
||||||
const idStr & GetCurrentMapName();
|
const idStr& GetCurrentMapName();
|
||||||
void SetCurrentDifficulty( idStr name );
|
void SetCurrentDifficulty( idStr name );
|
||||||
const idStr & GetCurrentDifficulty();
|
const idStr& GetCurrentDifficulty();
|
||||||
|
|
||||||
void ActivateGame();
|
void ActivateGame();
|
||||||
void ExitGame();
|
void ExitGame();
|
||||||
void ShowXToContinue( bool activate );
|
void ShowXToContinue( bool activate );
|
||||||
gameSKU_t GetGameSKU();
|
gameSKU_t GetGameSKU();
|
||||||
void HandleEndMatch();
|
void HandleEndMatch();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "doomstat.h"
|
#pragma implementation "doomstat.h"
|
||||||
#endif
|
#endif
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,45 +29,45 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "Precompiled.h"
|
#include "Precompiled.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "dstrings.h"
|
#pragma implementation "dstrings.h"
|
||||||
#endif
|
#endif
|
||||||
#include "dstrings.h"
|
#include "dstrings.h"
|
||||||
|
|
||||||
#include "globaldata.h"
|
#include "globaldata.h"
|
||||||
|
|
||||||
|
|
||||||
const char* endmsg[NUM_QUITMESSAGES+1]=
|
const char* endmsg[NUM_QUITMESSAGES + 1] =
|
||||||
{
|
{
|
||||||
// DOOM1
|
// DOOM1
|
||||||
QUITMSG,
|
QUITMSG,
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?"
|
"are you sure you want to quit?"
|
||||||
|
|
||||||
// QuitDOOM II messages
|
// QuitDOOM II messages
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?"
|
"are you sure you want to quit?"
|
||||||
|
|
||||||
// FinalDOOM?
|
// FinalDOOM?
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
"are you sure you want to quit?",
|
"are you sure you want to quit?",
|
||||||
|
|
||||||
// Internal debug. Different style, too.
|
// Internal debug. Different style, too.
|
||||||
"are you sure you want to quit?"
|
"are you sure you want to quit?"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -37,16 +37,16 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
//
|
//
|
||||||
|
|
||||||
// Called by main loop.
|
// Called by main loop.
|
||||||
qboolean F_Responder (event_t* ev);
|
qboolean F_Responder( event_t* ev );
|
||||||
|
|
||||||
// Called by main loop.
|
// Called by main loop.
|
||||||
void F_Ticker (void);
|
void F_Ticker( void );
|
||||||
|
|
||||||
// Called by main loop.
|
// Called by main loop.
|
||||||
void F_Drawer (void);
|
void F_Drawer( void );
|
||||||
|
|
||||||
|
|
||||||
void F_StartFinale (void);
|
void F_StartFinale( void );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,20 +50,22 @@ wipe_shittyColMajorXform
|
||||||
int width,
|
int width,
|
||||||
int height )
|
int height )
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
short* dest;
|
short* dest;
|
||||||
|
|
||||||
//dest = (short*) DoomLib::Z_Malloc(width*height*2, PU_STATIC, 0 );
|
//dest = (short*) DoomLib::Z_Malloc(width*height*2, PU_STATIC, 0 );
|
||||||
dest = new short[ width * height ];
|
dest = new short[ width * height ];
|
||||||
|
|
||||||
for(y=0;y<height;y++)
|
for( y = 0; y < height; y++ )
|
||||||
for(x=0;x<width;x++)
|
for( x = 0; x < width; x++ )
|
||||||
dest[x*height+y] = array[y*width+x];
|
{
|
||||||
|
dest[x * height + y] = array[y * width + x];
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(array, dest, width*height*2);
|
memcpy( array, dest, width * height * 2 );
|
||||||
|
|
||||||
//Z_Free(dest);
|
//Z_Free(dest);
|
||||||
delete[] dest;
|
delete[] dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,38 +76,43 @@ wipe_initMelt
|
||||||
int height,
|
int height,
|
||||||
int ticks )
|
int ticks )
|
||||||
{
|
{
|
||||||
int i, r;
|
int i, r;
|
||||||
|
|
||||||
// copy start screen to main screen
|
// copy start screen to main screen
|
||||||
memcpy(::g->wipe_scr, ::g->wipe_scr_start, width*height);
|
memcpy( ::g->wipe_scr, ::g->wipe_scr_start, width * height );
|
||||||
|
|
||||||
// makes this wipe faster (in theory)
|
// makes this wipe faster (in theory)
|
||||||
// to have stuff in column-major format
|
// to have stuff in column-major format
|
||||||
wipe_shittyColMajorXform((short*)::g->wipe_scr_start, width/2, height);
|
wipe_shittyColMajorXform( ( short* )::g->wipe_scr_start, width / 2, height );
|
||||||
wipe_shittyColMajorXform((short*)::g->wipe_scr_end, width/2, height);
|
wipe_shittyColMajorXform( ( short* )::g->wipe_scr_end, width / 2, height );
|
||||||
|
|
||||||
// setup initial column positions
|
// setup initial column positions
|
||||||
// (::g->wipe_y<0 => not ready to scroll yet)
|
// (::g->wipe_y<0 => not ready to scroll yet)
|
||||||
::g->wipe_y = (int *) DoomLib::Z_Malloc(width*sizeof(int), PU_STATIC, 0);
|
::g->wipe_y = ( int* ) DoomLib::Z_Malloc( width * sizeof( int ), PU_STATIC, 0 );
|
||||||
|
|
||||||
::g->wipe_y[0] = -(M_Random()%16);
|
::g->wipe_y[0] = -( M_Random() % 16 );
|
||||||
|
|
||||||
for (i=1;i<width;i++)
|
for( i = 1; i < width; i++ )
|
||||||
{
|
{
|
||||||
r = (M_Random()%3) - 1;
|
r = ( M_Random() % 3 ) - 1;
|
||||||
|
|
||||||
::g->wipe_y[i] = ::g->wipe_y[i-1] + r;
|
::g->wipe_y[i] = ::g->wipe_y[i - 1] + r;
|
||||||
|
|
||||||
if (::g->wipe_y[i] > 0)
|
if( ::g->wipe_y[i] > 0 )
|
||||||
|
{
|
||||||
::g->wipe_y[i] = 0;
|
::g->wipe_y[i] = 0;
|
||||||
else if (::g->wipe_y[i] == -16)
|
}
|
||||||
|
else if( ::g->wipe_y[i] == -16 )
|
||||||
|
{
|
||||||
::g->wipe_y[i] = -15;
|
::g->wipe_y[i] = -15;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wipe_doMelt( int width, int height, int ticks ) {
|
int wipe_doMelt( int width, int height, int ticks )
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
int dy;
|
int dy;
|
||||||
|
@ -115,43 +122,47 @@ int wipe_doMelt( int width, int height, int ticks ) {
|
||||||
short* d;
|
short* d;
|
||||||
qboolean done = true;
|
qboolean done = true;
|
||||||
|
|
||||||
width/=2;
|
width /= 2;
|
||||||
|
|
||||||
while (ticks--)
|
while( ticks-- )
|
||||||
{
|
{
|
||||||
for (i=0;i<width;i++)
|
for( i = 0; i < width; i++ )
|
||||||
{
|
{
|
||||||
if (::g->wipe_y[i]<0) {
|
if( ::g->wipe_y[i] < 0 )
|
||||||
|
{
|
||||||
|
|
||||||
::g->wipe_y[i]++;
|
::g->wipe_y[i]++;
|
||||||
done = false;
|
done = false;
|
||||||
}
|
}
|
||||||
else if (::g->wipe_y[i] < height) {
|
else if( ::g->wipe_y[i] < height )
|
||||||
|
{
|
||||||
|
|
||||||
dy = (::g->wipe_y[i] < 16 * GLOBAL_IMAGE_SCALER) ? ::g->wipe_y[i]+1 : 8 * GLOBAL_IMAGE_SCALER;
|
dy = ( ::g->wipe_y[i] < 16 * GLOBAL_IMAGE_SCALER ) ? ::g->wipe_y[i] + 1 : 8 * GLOBAL_IMAGE_SCALER;
|
||||||
|
|
||||||
if (::g->wipe_y[i]+dy >= height)
|
if( ::g->wipe_y[i] + dy >= height )
|
||||||
|
{
|
||||||
dy = height - ::g->wipe_y[i];
|
dy = height - ::g->wipe_y[i];
|
||||||
|
}
|
||||||
|
|
||||||
s = &((short *)::g->wipe_scr_end)[i*height+::g->wipe_y[i]];
|
s = &( ( short* )::g->wipe_scr_end )[i * height +::g->wipe_y[i]];
|
||||||
d = &((short *)::g->wipe_scr)[::g->wipe_y[i]*width+i];
|
d = &( ( short* )::g->wipe_scr )[::g->wipe_y[i] * width + i];
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
for (j=dy;j;j--)
|
for( j = dy; j; j-- )
|
||||||
{
|
{
|
||||||
d[idx] = *(s++);
|
d[idx] = *( s++ );
|
||||||
idx += width;
|
idx += width;
|
||||||
}
|
}
|
||||||
|
|
||||||
::g->wipe_y[i] += dy;
|
::g->wipe_y[i] += dy;
|
||||||
|
|
||||||
s = &((short *)::g->wipe_scr_start)[i*height];
|
s = &( ( short* )::g->wipe_scr_start )[i * height];
|
||||||
d = &((short *)::g->wipe_scr)[::g->wipe_y[i]*width+i];
|
d = &( ( short* )::g->wipe_scr )[::g->wipe_y[i] * width + i];
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
for (j=height-::g->wipe_y[i];j;j--)
|
for( j = height -::g->wipe_y[i]; j; j-- )
|
||||||
{
|
{
|
||||||
d[idx] = *(s++);
|
d[idx] = *( s++ );
|
||||||
idx += width;
|
idx += width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,9 +180,9 @@ wipe_exitMelt
|
||||||
int height,
|
int height,
|
||||||
int ticks )
|
int ticks )
|
||||||
{
|
{
|
||||||
Z_Free(::g->wipe_y);
|
Z_Free( ::g->wipe_y );
|
||||||
::g->wipe_y = NULL;
|
::g->wipe_y = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -181,9 +192,9 @@ wipe_StartScreen
|
||||||
int width,
|
int width,
|
||||||
int height )
|
int height )
|
||||||
{
|
{
|
||||||
::g->wipe_scr_start = ::g->screens[2];
|
::g->wipe_scr_start = ::g->screens[2];
|
||||||
I_ReadScreen(::g->wipe_scr_start);
|
I_ReadScreen( ::g->wipe_scr_start );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -193,10 +204,10 @@ wipe_EndScreen
|
||||||
int width,
|
int width,
|
||||||
int height )
|
int height )
|
||||||
{
|
{
|
||||||
::g->wipe_scr_end = ::g->screens[3];
|
::g->wipe_scr_end = ::g->screens[3];
|
||||||
I_ReadScreen(::g->wipe_scr_end);
|
I_ReadScreen( ::g->wipe_scr_end );
|
||||||
V_DrawBlock(x, y, 0, width, height, ::g->wipe_scr_start); // restore start scr.
|
V_DrawBlock( x, y, 0, width, height, ::g->wipe_scr_start ); // restore start scr.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -210,24 +221,24 @@ wipe_ScreenWipe
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
// initial stuff
|
// initial stuff
|
||||||
if (!::g->go)
|
if( !::g->go )
|
||||||
{
|
{
|
||||||
::g->go = 1;
|
::g->go = 1;
|
||||||
::g->wipe_scr = ::g->screens[0];
|
::g->wipe_scr = ::g->screens[0];
|
||||||
|
|
||||||
wipe_initMelt(width, height, ticks);
|
wipe_initMelt( width, height, ticks );
|
||||||
}
|
}
|
||||||
|
|
||||||
// do a piece of wipe-in
|
// do a piece of wipe-in
|
||||||
V_MarkRect(0, 0, width, height);
|
V_MarkRect( 0, 0, width, height );
|
||||||
|
|
||||||
rc = wipe_doMelt(width, height, ticks);
|
rc = wipe_doMelt( width, height, ticks );
|
||||||
|
|
||||||
// final stuff
|
// final stuff
|
||||||
if (rc)
|
if( rc )
|
||||||
{
|
{
|
||||||
::g->go = 0;
|
::g->go = 0;
|
||||||
wipe_exitMelt(width, height, ticks);
|
wipe_exitMelt( width, height, ticks );
|
||||||
}
|
}
|
||||||
|
|
||||||
return !::g->go;
|
return !::g->go;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -37,44 +37,44 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
//
|
//
|
||||||
// GAME
|
// GAME
|
||||||
//
|
//
|
||||||
void G_DeathMatchSpawnPlayer (int playernum);
|
void G_DeathMatchSpawnPlayer( int playernum );
|
||||||
|
|
||||||
void G_InitNew ( skill_t skill, int episode, int map );
|
void G_InitNew( skill_t skill, int episode, int map );
|
||||||
|
|
||||||
// Can be called by the startup code or M_Responder.
|
// Can be called by the startup code or M_Responder.
|
||||||
// A normal game starts at map 1,
|
// A normal game starts at map 1,
|
||||||
// but a warp test can start elsewhere
|
// but a warp test can start elsewhere
|
||||||
void G_DeferedInitNew (skill_t skill, int episode, int map);
|
void G_DeferedInitNew( skill_t skill, int episode, int map );
|
||||||
|
|
||||||
void G_DeferedPlayDemo (const char* demo);
|
void G_DeferedPlayDemo( const char* demo );
|
||||||
|
|
||||||
// Can be called by the startup code or M_Responder,
|
// Can be called by the startup code or M_Responder,
|
||||||
// calls P_SetupLevel or W_EnterWorld.
|
// calls P_SetupLevel or W_EnterWorld.
|
||||||
void G_LoadGame (char* name);
|
void G_LoadGame( char* name );
|
||||||
|
|
||||||
qboolean G_DoLoadGame ();
|
qboolean G_DoLoadGame();
|
||||||
|
|
||||||
// Called by M_Responder.
|
// Called by M_Responder.
|
||||||
void G_SaveGame (int slot, char* description);
|
void G_SaveGame( int slot, char* description );
|
||||||
|
|
||||||
// Only called by startup code.
|
// Only called by startup code.
|
||||||
void G_RecordDemo (char* name);
|
void G_RecordDemo( char* name );
|
||||||
|
|
||||||
void G_BeginRecording (void);
|
void G_BeginRecording( void );
|
||||||
|
|
||||||
void G_PlayDemo (char* name);
|
void G_PlayDemo( char* name );
|
||||||
void G_TimeDemo (const char* name);
|
void G_TimeDemo( const char* name );
|
||||||
qboolean G_CheckDemoStatus (void);
|
qboolean G_CheckDemoStatus( void );
|
||||||
|
|
||||||
void G_ExitLevel (void);
|
void G_ExitLevel( void );
|
||||||
void G_SecretExitLevel (void);
|
void G_SecretExitLevel( void );
|
||||||
|
|
||||||
void G_WorldDone (void);
|
void G_WorldDone( void );
|
||||||
|
|
||||||
void G_Ticker (void);
|
void G_Ticker( void );
|
||||||
qboolean G_Responder (event_t* ev);
|
qboolean G_Responder( event_t* ev );
|
||||||
|
|
||||||
void G_ScreenShot (void);
|
void G_ScreenShot( void );
|
||||||
|
|
||||||
#define MAXDEMOSIZE 512 * 1024
|
#define MAXDEMOSIZE 512 * 1024
|
||||||
#define SAVEGAMESIZE 256 * 1024 + MAXDEMOSIZE
|
#define SAVEGAMESIZE 256 * 1024 + MAXDEMOSIZE
|
||||||
|
|
|
@ -34,63 +34,63 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
//
|
//
|
||||||
// PROTOTYPES
|
// PROTOTYPES
|
||||||
//
|
//
|
||||||
void M_NewGame(int choice);
|
void M_NewGame( int choice );
|
||||||
void M_Episode(int choice);
|
void M_Episode( int choice );
|
||||||
void M_Expansion(int choice);
|
void M_Expansion( int choice );
|
||||||
void M_ChooseSkill(int choice);
|
void M_ChooseSkill( int choice );
|
||||||
void M_LoadGame(int choice);
|
void M_LoadGame( int choice );
|
||||||
void M_LoadExpansion(int choice);
|
void M_LoadExpansion( int choice );
|
||||||
void M_SaveGame(int choice);
|
void M_SaveGame( int choice );
|
||||||
void M_Options(int choice);
|
void M_Options( int choice );
|
||||||
void M_EndGame(int choice);
|
void M_EndGame( int choice );
|
||||||
void M_ReadThis(int choice);
|
void M_ReadThis( int choice );
|
||||||
void M_ReadThis2(int choice);
|
void M_ReadThis2( int choice );
|
||||||
void M_QuitDOOM(int choice);
|
void M_QuitDOOM( int choice );
|
||||||
void M_ExitGame(int choice);
|
void M_ExitGame( int choice );
|
||||||
void M_GameSelection(int choice);
|
void M_GameSelection( int choice );
|
||||||
void M_CancelExit(int choice);
|
void M_CancelExit( int choice );
|
||||||
|
|
||||||
void M_ChangeMessages(int choice);
|
void M_ChangeMessages( int choice );
|
||||||
void M_ChangeGPad(int choice);
|
void M_ChangeGPad( int choice );
|
||||||
void M_FullScreen(int choice);
|
void M_FullScreen( int choice );
|
||||||
void M_ChangeSensitivity(int choice);
|
void M_ChangeSensitivity( int choice );
|
||||||
void M_SfxVol(int choice);
|
void M_SfxVol( int choice );
|
||||||
void M_MusicVol(int choice);
|
void M_MusicVol( int choice );
|
||||||
void M_ChangeDetail(int choice);
|
void M_ChangeDetail( int choice );
|
||||||
void M_SizeDisplay(int choice);
|
void M_SizeDisplay( int choice );
|
||||||
void M_StartGame(int choice);
|
void M_StartGame( int choice );
|
||||||
void M_Sound(int choice);
|
void M_Sound( int choice );
|
||||||
|
|
||||||
void M_FinishReadThis(int choice);
|
void M_FinishReadThis( int choice );
|
||||||
void M_LoadSelect(int choice);
|
void M_LoadSelect( int choice );
|
||||||
void M_SaveSelect(int choice);
|
void M_SaveSelect( int choice );
|
||||||
void M_ReadSaveStrings(void);
|
void M_ReadSaveStrings( void );
|
||||||
void M_QuickSave(void);
|
void M_QuickSave( void );
|
||||||
void M_QuickLoad(void);
|
void M_QuickLoad( void );
|
||||||
|
|
||||||
void M_DrawMainMenu(void);
|
void M_DrawMainMenu( void );
|
||||||
void M_DrawQuit(void);
|
void M_DrawQuit( void );
|
||||||
void M_DrawReadThis1(void);
|
void M_DrawReadThis1( void );
|
||||||
void M_DrawReadThis2(void);
|
void M_DrawReadThis2( void );
|
||||||
void M_DrawNewGame(void);
|
void M_DrawNewGame( void );
|
||||||
void M_DrawEpisode(void);
|
void M_DrawEpisode( void );
|
||||||
void M_DrawOptions(void);
|
void M_DrawOptions( void );
|
||||||
void M_DrawSound(void);
|
void M_DrawSound( void );
|
||||||
void M_DrawLoad(void);
|
void M_DrawLoad( void );
|
||||||
void M_DrawSave(void);
|
void M_DrawSave( void );
|
||||||
|
|
||||||
void M_DrawSaveLoadBorder(int x,int y);
|
void M_DrawSaveLoadBorder( int x, int y );
|
||||||
void M_SetupNextMenu(menu_t *menudef);
|
void M_SetupNextMenu( menu_t* menudef );
|
||||||
void M_DrawThermo(int x,int y,int thermWidth,int thermDot);
|
void M_DrawThermo( int x, int y, int thermWidth, int thermDot );
|
||||||
void M_DrawEmptyCell(menu_t *menu,int item);
|
void M_DrawEmptyCell( menu_t* menu, int item );
|
||||||
void M_DrawSelCell(menu_t *menu,int item);
|
void M_DrawSelCell( menu_t* menu, int item );
|
||||||
void M_WriteText(int x, int y, const char *string);
|
void M_WriteText( int x, int y, const char* string );
|
||||||
int M_StringWidth(const char *string);
|
int M_StringWidth( const char* string );
|
||||||
int M_StringHeight(const char *string);
|
int M_StringHeight( const char* string );
|
||||||
void M_StartControlPanel(void);
|
void M_StartControlPanel( void );
|
||||||
void M_StartMessage(const char *string,messageRoutine_t routine,qboolean input);
|
void M_StartMessage( const char* string, messageRoutine_t routine, qboolean input );
|
||||||
void M_StopMessage(void);
|
void M_StopMessage( void );
|
||||||
void M_ClearMenus (void);
|
void M_ClearMenus( void );
|
||||||
|
|
||||||
extern const anim_t temp_epsd0animinfo[10];
|
extern const anim_t temp_epsd0animinfo[10];
|
||||||
extern const anim_t temp_epsd1animinfo[9];
|
extern const anim_t temp_epsd1animinfo[9];
|
||||||
|
@ -102,5 +102,5 @@ void Globals::InitGlobals()
|
||||||
#include "constructs.h"
|
#include "constructs.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
Globals *g;
|
Globals* g;
|
||||||
|
|
||||||
|
|
|
@ -55,17 +55,18 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
|
|
||||||
struct Globals {
|
struct Globals
|
||||||
|
{
|
||||||
void InitGlobals();
|
void InitGlobals();
|
||||||
#include "vars.h"
|
#include "vars.h"
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Globals *g;
|
extern Globals* g;
|
||||||
|
|
||||||
#define GLOBAL( type, name ) type name
|
#define GLOBAL( type, name ) type name
|
||||||
#define GLOBAL_ARRAY( type, name, count ) type name[count]
|
#define GLOBAL_ARRAY( type, name, count ) type name[count]
|
||||||
|
|
||||||
extern void localCalculateAchievements(bool epComplete);
|
extern void localCalculateAchievements( bool epComplete );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,15 +43,15 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// qboolean : whether the screen is always erased
|
// qboolean : whether the screen is always erased
|
||||||
|
|
||||||
|
|
||||||
void HUlib_init(void)
|
void HUlib_init( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUlib_clearTextLine(hu_textline_t* t)
|
void HUlib_clearTextLine( hu_textline_t* t )
|
||||||
{
|
{
|
||||||
t->len = 0;
|
t->len = 0;
|
||||||
t->l[0] = 0;
|
t->l[0] = 0;
|
||||||
t->needsupdate = true;
|
t->needsupdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -62,11 +62,11 @@ HUlib_initTextLine
|
||||||
patch_t** f,
|
patch_t** f,
|
||||||
int sc )
|
int sc )
|
||||||
{
|
{
|
||||||
t->x = x;
|
t->x = x;
|
||||||
t->y = y;
|
t->y = y;
|
||||||
t->f = f;
|
t->f = f;
|
||||||
t->sc = sc;
|
t->sc = sc;
|
||||||
HUlib_clearTextLine(t);
|
HUlib_clearTextLine( t );
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean
|
qboolean
|
||||||
|
@ -75,28 +75,33 @@ HUlib_addCharToTextLine
|
||||||
char ch )
|
char ch )
|
||||||
{
|
{
|
||||||
|
|
||||||
if (t->len == HU_MAXLINELENGTH)
|
if( t->len == HU_MAXLINELENGTH )
|
||||||
return false;
|
{
|
||||||
else
|
return false;
|
||||||
{
|
}
|
||||||
t->l[t->len++] = ch;
|
else
|
||||||
t->l[t->len] = 0;
|
{
|
||||||
t->needsupdate = 4;
|
t->l[t->len++] = ch;
|
||||||
return true;
|
t->l[t->len] = 0;
|
||||||
}
|
t->needsupdate = 4;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean HUlib_delCharFromTextLine(hu_textline_t* t)
|
qboolean HUlib_delCharFromTextLine( hu_textline_t* t )
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!t->len) return false;
|
if( !t->len )
|
||||||
else
|
{
|
||||||
{
|
return false;
|
||||||
t->l[--t->len] = 0;
|
}
|
||||||
t->needsupdate = 4;
|
else
|
||||||
return true;
|
{
|
||||||
}
|
t->l[--t->len] = 0;
|
||||||
|
t->needsupdate = 4;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,73 +111,82 @@ HUlib_drawTextLine
|
||||||
qboolean drawcursor )
|
qboolean drawcursor )
|
||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int w;
|
int w;
|
||||||
int x;
|
int x;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
|
||||||
// draw the new stuff
|
// draw the new stuff
|
||||||
x = l->x;
|
x = l->x;
|
||||||
for (i=0;i<l->len;i++)
|
for( i = 0; i < l->len; i++ )
|
||||||
{
|
|
||||||
c = toupper(l->l[i]);
|
|
||||||
if (c != ' '
|
|
||||||
&& c >= l->sc
|
|
||||||
&& c <= '_')
|
|
||||||
{
|
{
|
||||||
w = SHORT(l->f[c - l->sc]->width);
|
c = toupper( l->l[i] );
|
||||||
if (x+w > SCREENWIDTH)
|
if( c != ' '
|
||||||
break;
|
&& c >= l->sc
|
||||||
V_DrawPatchDirect(x, l->y, FG, l->f[c - l->sc]);
|
&& c <= '_' )
|
||||||
x += w;
|
{
|
||||||
|
w = SHORT( l->f[c - l->sc]->width );
|
||||||
|
if( x + w > SCREENWIDTH )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
V_DrawPatchDirect( x, l->y, FG, l->f[c - l->sc] );
|
||||||
|
x += w;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x += 4;
|
||||||
|
if( x >= SCREENWIDTH )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
x += 4;
|
|
||||||
if (x >= SCREENWIDTH)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw the cursor if requested
|
// draw the cursor if requested
|
||||||
if (drawcursor
|
if( drawcursor
|
||||||
&& x + SHORT(l->f['_' - l->sc]->width) <= SCREENWIDTH)
|
&& x + SHORT( l->f['_' - l->sc]->width ) <= SCREENWIDTH )
|
||||||
{
|
{
|
||||||
V_DrawPatchDirect(x, l->y, FG, l->f['_' - l->sc]);
|
V_DrawPatchDirect( x, l->y, FG, l->f['_' - l->sc] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// sorta called by HU_Erase and just better darn get things straight
|
// sorta called by HU_Erase and just better darn get things straight
|
||||||
void HUlib_eraseTextLine(hu_textline_t* l)
|
void HUlib_eraseTextLine( hu_textline_t* l )
|
||||||
{
|
{
|
||||||
int lh;
|
int lh;
|
||||||
int y;
|
int y;
|
||||||
int yoffset;
|
int yoffset;
|
||||||
|
|
||||||
// Only erases when NOT in automap and the screen is reduced,
|
// Only erases when NOT in automap and the screen is reduced,
|
||||||
// and the text must either need updating or refreshing
|
// and the text must either need updating or refreshing
|
||||||
// (because of a recent change back from the automap)
|
// (because of a recent change back from the automap)
|
||||||
|
|
||||||
if (!::g->automapactive &&
|
if( !::g->automapactive &&
|
||||||
::g->viewwindowx && l->needsupdate)
|
::g->viewwindowx && l->needsupdate )
|
||||||
{
|
|
||||||
lh = SHORT(l->f[0]->height) + 1;
|
|
||||||
for (y=l->y,yoffset=y*SCREENWIDTH ; y<l->y+lh ; y++,yoffset+=SCREENWIDTH)
|
|
||||||
{
|
{
|
||||||
if (y < ::g->viewwindowy || y >= ::g->viewwindowy + ::g->viewheight)
|
lh = SHORT( l->f[0]->height ) + 1;
|
||||||
R_VideoErase(yoffset, SCREENWIDTH); // erase entire line
|
for( y = l->y, yoffset = y * SCREENWIDTH ; y < l->y + lh ; y++, yoffset += SCREENWIDTH )
|
||||||
else
|
{
|
||||||
{
|
if( y < ::g->viewwindowy || y >= ::g->viewwindowy + ::g->viewheight )
|
||||||
R_VideoErase(yoffset, ::g->viewwindowx); // erase left border
|
{
|
||||||
R_VideoErase(yoffset + ::g->viewwindowx + ::g->viewwidth, ::g->viewwindowx);
|
R_VideoErase( yoffset, SCREENWIDTH ); // erase entire line
|
||||||
// erase right border
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
R_VideoErase( yoffset, ::g->viewwindowx ); // erase left border
|
||||||
|
R_VideoErase( yoffset + ::g->viewwindowx + ::g->viewwidth, ::g->viewwindowx );
|
||||||
|
// erase right border
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
::g->lastautomapactive = ::g->automapactive;
|
::g->lastautomapactive = ::g->automapactive;
|
||||||
if (l->needsupdate) l->needsupdate--;
|
if( l->needsupdate )
|
||||||
|
{
|
||||||
|
l->needsupdate--;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,32 +201,36 @@ HUlib_initSText
|
||||||
qboolean* on )
|
qboolean* on )
|
||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
s->h = h;
|
s->h = h;
|
||||||
s->on = on;
|
s->on = on;
|
||||||
s->laston = true;
|
s->laston = true;
|
||||||
s->cl = 0;
|
s->cl = 0;
|
||||||
for (i=0;i<h;i++)
|
for( i = 0; i < h; i++ )
|
||||||
HUlib_initTextLine(&s->l[i],
|
HUlib_initTextLine( &s->l[i],
|
||||||
x, y - i*(SHORT(font[0]->height)+1),
|
x, y - i * ( SHORT( font[0]->height ) + 1 ),
|
||||||
font, startchar);
|
font, startchar );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUlib_addLineToSText(hu_stext_t* s)
|
void HUlib_addLineToSText( hu_stext_t* s )
|
||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// add a clear line
|
// add a clear line
|
||||||
if (++s->cl == s->h)
|
if( ++s->cl == s->h )
|
||||||
s->cl = 0;
|
{
|
||||||
HUlib_clearTextLine(&s->l[s->cl]);
|
s->cl = 0;
|
||||||
|
}
|
||||||
|
HUlib_clearTextLine( &s->l[s->cl] );
|
||||||
|
|
||||||
// everything needs updating
|
// everything needs updating
|
||||||
for (i=0 ; i<s->h ; i++)
|
for( i = 0 ; i < s->h ; i++ )
|
||||||
s->l[i].needsupdate = 4;
|
{
|
||||||
|
s->l[i].needsupdate = 4;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,50 +240,60 @@ HUlib_addMessageToSText
|
||||||
const char* prefix,
|
const char* prefix,
|
||||||
const char* msg )
|
const char* msg )
|
||||||
{
|
{
|
||||||
HUlib_addLineToSText(s);
|
HUlib_addLineToSText( s );
|
||||||
if (prefix)
|
if( prefix )
|
||||||
while (*prefix)
|
while( *prefix )
|
||||||
HUlib_addCharToTextLine(&s->l[s->cl], *(prefix++));
|
{
|
||||||
|
HUlib_addCharToTextLine( &s->l[s->cl], *( prefix++ ) );
|
||||||
|
}
|
||||||
|
|
||||||
while (*msg)
|
while( *msg )
|
||||||
HUlib_addCharToTextLine(&s->l[s->cl], *(msg++));
|
{
|
||||||
|
HUlib_addCharToTextLine( &s->l[s->cl], *( msg++ ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUlib_drawSText(hu_stext_t* s)
|
void HUlib_drawSText( hu_stext_t* s )
|
||||||
{
|
{
|
||||||
int i, idx;
|
int i, idx;
|
||||||
hu_textline_t *l;
|
hu_textline_t* l;
|
||||||
|
|
||||||
if (!*s->on)
|
if( !*s->on )
|
||||||
return; // if not on, don't draw
|
{
|
||||||
|
return; // if not on, don't draw
|
||||||
|
}
|
||||||
|
|
||||||
// draw everything
|
// draw everything
|
||||||
for (i=0 ; i<s->h ; i++)
|
for( i = 0 ; i < s->h ; i++ )
|
||||||
{
|
{
|
||||||
idx = s->cl - i;
|
idx = s->cl - i;
|
||||||
if (idx < 0)
|
if( idx < 0 )
|
||||||
idx += s->h; // handle queue of ::g->lines
|
{
|
||||||
|
idx += s->h; // handle queue of ::g->lines
|
||||||
|
}
|
||||||
|
|
||||||
l = &s->l[idx];
|
l = &s->l[idx];
|
||||||
|
|
||||||
// need a decision made here on whether to skip the draw
|
// need a decision made here on whether to skip the draw
|
||||||
HUlib_drawTextLine(l, false); // no cursor, please
|
HUlib_drawTextLine( l, false ); // no cursor, please
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUlib_eraseSText(hu_stext_t* s)
|
void HUlib_eraseSText( hu_stext_t* s )
|
||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0 ; i<s->h ; i++)
|
for( i = 0 ; i < s->h ; i++ )
|
||||||
{
|
{
|
||||||
if (s->laston && !*s->on)
|
if( s->laston && !*s->on )
|
||||||
s->l[i].needsupdate = 4;
|
{
|
||||||
HUlib_eraseTextLine(&s->l[i]);
|
s->l[i].needsupdate = 4;
|
||||||
}
|
}
|
||||||
s->laston = *s->on;
|
HUlib_eraseTextLine( &s->l[i] );
|
||||||
|
}
|
||||||
|
s->laston = *s->on;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,31 +306,35 @@ HUlib_initIText
|
||||||
int startchar,
|
int startchar,
|
||||||
qboolean* on )
|
qboolean* on )
|
||||||
{
|
{
|
||||||
it->lm = 0; // default left margin is start of text
|
it->lm = 0; // default left margin is start of text
|
||||||
it->on = on;
|
it->on = on;
|
||||||
it->laston = true;
|
it->laston = true;
|
||||||
HUlib_initTextLine(&it->l, x, y, font, startchar);
|
HUlib_initTextLine( &it->l, x, y, font, startchar );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// The following deletion routines adhere to the left margin restriction
|
// The following deletion routines adhere to the left margin restriction
|
||||||
void HUlib_delCharFromIText(hu_itext_t* it)
|
void HUlib_delCharFromIText( hu_itext_t* it )
|
||||||
{
|
{
|
||||||
if (it->l.len != it->lm)
|
if( it->l.len != it->lm )
|
||||||
HUlib_delCharFromTextLine(&it->l);
|
{
|
||||||
|
HUlib_delCharFromTextLine( &it->l );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUlib_eraseLineFromIText(hu_itext_t* it)
|
void HUlib_eraseLineFromIText( hu_itext_t* it )
|
||||||
{
|
{
|
||||||
while (it->lm != it->l.len)
|
while( it->lm != it->l.len )
|
||||||
HUlib_delCharFromTextLine(&it->l);
|
{
|
||||||
|
HUlib_delCharFromTextLine( &it->l );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resets left margin as well
|
// Resets left margin as well
|
||||||
void HUlib_resetIText(hu_itext_t* it)
|
void HUlib_resetIText( hu_itext_t* it )
|
||||||
{
|
{
|
||||||
it->lm = 0;
|
it->lm = 0;
|
||||||
HUlib_clearTextLine(&it->l);
|
HUlib_clearTextLine( &it->l );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -310,9 +342,11 @@ HUlib_addPrefixToIText
|
||||||
( hu_itext_t* it,
|
( hu_itext_t* it,
|
||||||
char* str )
|
char* str )
|
||||||
{
|
{
|
||||||
while (*str)
|
while( *str )
|
||||||
HUlib_addCharToTextLine(&it->l, *(str++));
|
{
|
||||||
it->lm = it->l.len;
|
HUlib_addCharToTextLine( &it->l, *( str++ ) );
|
||||||
|
}
|
||||||
|
it->lm = it->l.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
// wrapper function for handling general keyed input.
|
// wrapper function for handling general keyed input.
|
||||||
|
@ -323,36 +357,44 @@ HUlib_keyInIText
|
||||||
unsigned char ch )
|
unsigned char ch )
|
||||||
{
|
{
|
||||||
|
|
||||||
if (ch >= ' ' && ch <= '_')
|
if( ch >= ' ' && ch <= '_' )
|
||||||
HUlib_addCharToTextLine(&it->l, (char) ch);
|
{
|
||||||
else
|
HUlib_addCharToTextLine( &it->l, ( char ) ch );
|
||||||
if (ch == KEY_BACKSPACE)
|
}
|
||||||
HUlib_delCharFromIText(it);
|
else if( ch == KEY_BACKSPACE )
|
||||||
else
|
{
|
||||||
if (ch != KEY_ENTER)
|
HUlib_delCharFromIText( it );
|
||||||
return false; // did not eat key
|
}
|
||||||
|
else if( ch != KEY_ENTER )
|
||||||
|
{
|
||||||
|
return false; // did not eat key
|
||||||
|
}
|
||||||
|
|
||||||
return true; // ate the key
|
return true; // ate the key
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUlib_drawIText(hu_itext_t* it)
|
void HUlib_drawIText( hu_itext_t* it )
|
||||||
{
|
{
|
||||||
|
|
||||||
hu_textline_t *l = &it->l;
|
hu_textline_t* l = &it->l;
|
||||||
|
|
||||||
if (!*it->on)
|
if( !*it->on )
|
||||||
return;
|
{
|
||||||
HUlib_drawTextLine(l, true); // draw the line w/ cursor
|
return;
|
||||||
|
}
|
||||||
|
HUlib_drawTextLine( l, true ); // draw the line w/ cursor
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HUlib_eraseIText(hu_itext_t* it)
|
void HUlib_eraseIText( hu_itext_t* it )
|
||||||
{
|
{
|
||||||
if (it->laston && !*it->on)
|
if( it->laston && !*it->on )
|
||||||
it->l.needsupdate = 4;
|
{
|
||||||
HUlib_eraseTextLine(&it->l);
|
it->l.needsupdate = 4;
|
||||||
it->laston = *it->on;
|
}
|
||||||
|
HUlib_eraseTextLine( &it->l );
|
||||||
|
it->laston = *it->on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,17 +46,17 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// (parent of Scrolling Text and Input Text widgets)
|
// (parent of Scrolling Text and Input Text widgets)
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// left-justified position of scrolling text window
|
// left-justified position of scrolling text window
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
patch_t** f; // font
|
patch_t** f; // font
|
||||||
int sc; // start character
|
int sc; // start character
|
||||||
char l[HU_MAXLINELENGTH+1]; // line of text
|
char l[HU_MAXLINELENGTH + 1]; // line of text
|
||||||
int len; // current line length
|
int len; // current line length
|
||||||
|
|
||||||
// whether this line needs to be udpated
|
// whether this line needs to be udpated
|
||||||
int needsupdate;
|
int needsupdate;
|
||||||
|
|
||||||
} hu_textline_t;
|
} hu_textline_t;
|
||||||
|
|
||||||
|
@ -66,13 +66,13 @@ typedef struct
|
||||||
// (child of Text Line widget)
|
// (child of Text Line widget)
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
hu_textline_t l[HU_MAXLINES]; // text lines to draw
|
hu_textline_t l[HU_MAXLINES]; // text lines to draw
|
||||||
int h; // height in lines
|
int h; // height in lines
|
||||||
int cl; // current line number
|
int cl; // current line number
|
||||||
|
|
||||||
// pointer to qboolean stating whether to update window
|
// pointer to qboolean stating whether to update window
|
||||||
qboolean* on;
|
qboolean* on;
|
||||||
qboolean laston; // last value of *->on.
|
qboolean laston; // last value of *->on.
|
||||||
|
|
||||||
} hu_stext_t;
|
} hu_stext_t;
|
||||||
|
|
||||||
|
@ -82,14 +82,14 @@ typedef struct
|
||||||
// (child of Text Line widget)
|
// (child of Text Line widget)
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
hu_textline_t l; // text line to input on
|
hu_textline_t l; // text line to input on
|
||||||
|
|
||||||
// left margin past which I am not to delete characters
|
// left margin past which I am not to delete characters
|
||||||
int lm;
|
int lm;
|
||||||
|
|
||||||
// pointer to qboolean stating whether to update window
|
// pointer to qboolean stating whether to update window
|
||||||
qboolean* on;
|
qboolean* on;
|
||||||
qboolean laston; // last value of *->on;
|
qboolean laston; // last value of *->on;
|
||||||
|
|
||||||
} hu_itext_t;
|
} hu_itext_t;
|
||||||
|
|
||||||
|
@ -99,28 +99,28 @@ typedef struct
|
||||||
//
|
//
|
||||||
|
|
||||||
// initializes heads-up widget library
|
// initializes heads-up widget library
|
||||||
void HUlib_init(void);
|
void HUlib_init( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// textline code
|
// textline code
|
||||||
//
|
//
|
||||||
|
|
||||||
// clear a line of text
|
// clear a line of text
|
||||||
void HUlib_clearTextLine(hu_textline_t *t);
|
void HUlib_clearTextLine( hu_textline_t* t );
|
||||||
|
|
||||||
void HUlib_initTextLine(hu_textline_t *t, int x, int y, patch_t **f, int sc);
|
void HUlib_initTextLine( hu_textline_t* t, int x, int y, patch_t** f, int sc );
|
||||||
|
|
||||||
// returns success
|
// returns success
|
||||||
qboolean HUlib_addCharToTextLine(hu_textline_t *t, char ch);
|
qboolean HUlib_addCharToTextLine( hu_textline_t* t, char ch );
|
||||||
|
|
||||||
// returns success
|
// returns success
|
||||||
qboolean HUlib_delCharFromTextLine(hu_textline_t *t);
|
qboolean HUlib_delCharFromTextLine( hu_textline_t* t );
|
||||||
|
|
||||||
// draws tline
|
// draws tline
|
||||||
void HUlib_drawTextLine(hu_textline_t *l, qboolean drawcursor);
|
void HUlib_drawTextLine( hu_textline_t* l, qboolean drawcursor );
|
||||||
|
|
||||||
// erases text line
|
// erases text line
|
||||||
void HUlib_eraseTextLine(hu_textline_t *l);
|
void HUlib_eraseTextLine( hu_textline_t* l );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -139,7 +139,7 @@ HUlib_initSText
|
||||||
qboolean* on );
|
qboolean* on );
|
||||||
|
|
||||||
// add a new line
|
// add a new line
|
||||||
void HUlib_addLineToSText(hu_stext_t* s);
|
void HUlib_addLineToSText( hu_stext_t* s );
|
||||||
|
|
||||||
// ?
|
// ?
|
||||||
void
|
void
|
||||||
|
@ -149,10 +149,10 @@ HUlib_addMessageToSText
|
||||||
const char* msg );
|
const char* msg );
|
||||||
|
|
||||||
// draws stext
|
// draws stext
|
||||||
void HUlib_drawSText(hu_stext_t* s);
|
void HUlib_drawSText( hu_stext_t* s );
|
||||||
|
|
||||||
// erases all stext lines
|
// erases all stext lines
|
||||||
void HUlib_eraseSText(hu_stext_t* s);
|
void HUlib_eraseSText( hu_stext_t* s );
|
||||||
|
|
||||||
// Input Text Line widget routines
|
// Input Text Line widget routines
|
||||||
void
|
void
|
||||||
|
@ -165,13 +165,13 @@ HUlib_initIText
|
||||||
qboolean* on );
|
qboolean* on );
|
||||||
|
|
||||||
// enforces left margin
|
// enforces left margin
|
||||||
void HUlib_delCharFromIText(hu_itext_t* it);
|
void HUlib_delCharFromIText( hu_itext_t* it );
|
||||||
|
|
||||||
// enforces left margin
|
// enforces left margin
|
||||||
void HUlib_eraseLineFromIText(hu_itext_t* it);
|
void HUlib_eraseLineFromIText( hu_itext_t* it );
|
||||||
|
|
||||||
// resets line and left margin
|
// resets line and left margin
|
||||||
void HUlib_resetIText(hu_itext_t* it);
|
void HUlib_resetIText( hu_itext_t* it );
|
||||||
|
|
||||||
// left of left-margin
|
// left of left-margin
|
||||||
void
|
void
|
||||||
|
@ -185,10 +185,10 @@ HUlib_keyInIText
|
||||||
( hu_itext_t* it,
|
( hu_itext_t* it,
|
||||||
unsigned char ch );
|
unsigned char ch );
|
||||||
|
|
||||||
void HUlib_drawIText(hu_itext_t* it);
|
void HUlib_drawIText( hu_itext_t* it );
|
||||||
|
|
||||||
// erases all itext lines
|
// erases all itext lines
|
||||||
void HUlib_eraseIText(hu_itext_t* it);
|
void HUlib_eraseIText( hu_itext_t* it );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -96,93 +96,93 @@ const char* mapnames[] =
|
||||||
{
|
{
|
||||||
|
|
||||||
HUSTR_E1M1,
|
HUSTR_E1M1,
|
||||||
HUSTR_E1M2,
|
HUSTR_E1M2,
|
||||||
HUSTR_E1M3,
|
HUSTR_E1M3,
|
||||||
HUSTR_E1M4,
|
HUSTR_E1M4,
|
||||||
HUSTR_E1M5,
|
HUSTR_E1M5,
|
||||||
HUSTR_E1M6,
|
HUSTR_E1M6,
|
||||||
HUSTR_E1M7,
|
HUSTR_E1M7,
|
||||||
HUSTR_E1M8,
|
HUSTR_E1M8,
|
||||||
HUSTR_E1M9,
|
HUSTR_E1M9,
|
||||||
|
|
||||||
HUSTR_E2M1,
|
HUSTR_E2M1,
|
||||||
HUSTR_E2M2,
|
HUSTR_E2M2,
|
||||||
HUSTR_E2M3,
|
HUSTR_E2M3,
|
||||||
HUSTR_E2M4,
|
HUSTR_E2M4,
|
||||||
HUSTR_E2M5,
|
HUSTR_E2M5,
|
||||||
HUSTR_E2M6,
|
HUSTR_E2M6,
|
||||||
HUSTR_E2M7,
|
HUSTR_E2M7,
|
||||||
HUSTR_E2M8,
|
HUSTR_E2M8,
|
||||||
HUSTR_E2M9,
|
HUSTR_E2M9,
|
||||||
|
|
||||||
HUSTR_E3M1,
|
HUSTR_E3M1,
|
||||||
HUSTR_E3M2,
|
HUSTR_E3M2,
|
||||||
HUSTR_E3M3,
|
HUSTR_E3M3,
|
||||||
HUSTR_E3M4,
|
HUSTR_E3M4,
|
||||||
HUSTR_E3M5,
|
HUSTR_E3M5,
|
||||||
HUSTR_E3M6,
|
HUSTR_E3M6,
|
||||||
HUSTR_E3M7,
|
HUSTR_E3M7,
|
||||||
HUSTR_E3M8,
|
HUSTR_E3M8,
|
||||||
HUSTR_E3M9,
|
HUSTR_E3M9,
|
||||||
|
|
||||||
HUSTR_E4M1,
|
HUSTR_E4M1,
|
||||||
HUSTR_E4M2,
|
HUSTR_E4M2,
|
||||||
HUSTR_E4M3,
|
HUSTR_E4M3,
|
||||||
HUSTR_E4M4,
|
HUSTR_E4M4,
|
||||||
HUSTR_E4M5,
|
HUSTR_E4M5,
|
||||||
HUSTR_E4M6,
|
HUSTR_E4M6,
|
||||||
HUSTR_E4M7,
|
HUSTR_E4M7,
|
||||||
HUSTR_E4M8,
|
HUSTR_E4M8,
|
||||||
HUSTR_E4M9,
|
HUSTR_E4M9,
|
||||||
|
|
||||||
"NEWLEVEL",
|
"NEWLEVEL",
|
||||||
"NEWLEVEL",
|
"NEWLEVEL",
|
||||||
"NEWLEVEL",
|
"NEWLEVEL",
|
||||||
"NEWLEVEL",
|
"NEWLEVEL",
|
||||||
"NEWLEVEL",
|
"NEWLEVEL",
|
||||||
"NEWLEVEL",
|
"NEWLEVEL",
|
||||||
"NEWLEVEL",
|
"NEWLEVEL",
|
||||||
"NEWLEVEL",
|
"NEWLEVEL",
|
||||||
"NEWLEVEL"
|
"NEWLEVEL"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* mapnames2[] =
|
const char* mapnames2[] =
|
||||||
{
|
{
|
||||||
HUSTR_1,
|
HUSTR_1,
|
||||||
HUSTR_2,
|
HUSTR_2,
|
||||||
HUSTR_3,
|
HUSTR_3,
|
||||||
HUSTR_4,
|
HUSTR_4,
|
||||||
HUSTR_5,
|
HUSTR_5,
|
||||||
HUSTR_6,
|
HUSTR_6,
|
||||||
HUSTR_7,
|
HUSTR_7,
|
||||||
HUSTR_8,
|
HUSTR_8,
|
||||||
HUSTR_9,
|
HUSTR_9,
|
||||||
HUSTR_10,
|
HUSTR_10,
|
||||||
HUSTR_11,
|
HUSTR_11,
|
||||||
|
|
||||||
HUSTR_12,
|
HUSTR_12,
|
||||||
HUSTR_13,
|
HUSTR_13,
|
||||||
HUSTR_14,
|
HUSTR_14,
|
||||||
HUSTR_15,
|
HUSTR_15,
|
||||||
HUSTR_16,
|
HUSTR_16,
|
||||||
HUSTR_17,
|
HUSTR_17,
|
||||||
HUSTR_18,
|
HUSTR_18,
|
||||||
HUSTR_19,
|
HUSTR_19,
|
||||||
HUSTR_20,
|
HUSTR_20,
|
||||||
|
|
||||||
HUSTR_21,
|
HUSTR_21,
|
||||||
HUSTR_22,
|
HUSTR_22,
|
||||||
HUSTR_23,
|
HUSTR_23,
|
||||||
HUSTR_24,
|
HUSTR_24,
|
||||||
HUSTR_25,
|
HUSTR_25,
|
||||||
HUSTR_26,
|
HUSTR_26,
|
||||||
HUSTR_27,
|
HUSTR_27,
|
||||||
HUSTR_28,
|
HUSTR_28,
|
||||||
HUSTR_29,
|
HUSTR_29,
|
||||||
HUSTR_30,
|
HUSTR_30,
|
||||||
HUSTR_31,
|
HUSTR_31,
|
||||||
HUSTR_32,
|
HUSTR_32,
|
||||||
HUSTR_33
|
HUSTR_33
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -190,78 +190,78 @@ const char* mapnames2[] =
|
||||||
const char* mapnamesp[] =
|
const char* mapnamesp[] =
|
||||||
{
|
{
|
||||||
PHUSTR_1,
|
PHUSTR_1,
|
||||||
PHUSTR_2,
|
PHUSTR_2,
|
||||||
PHUSTR_3,
|
PHUSTR_3,
|
||||||
PHUSTR_4,
|
PHUSTR_4,
|
||||||
PHUSTR_5,
|
PHUSTR_5,
|
||||||
PHUSTR_6,
|
PHUSTR_6,
|
||||||
PHUSTR_7,
|
PHUSTR_7,
|
||||||
PHUSTR_8,
|
PHUSTR_8,
|
||||||
PHUSTR_9,
|
PHUSTR_9,
|
||||||
PHUSTR_10,
|
PHUSTR_10,
|
||||||
PHUSTR_11,
|
PHUSTR_11,
|
||||||
|
|
||||||
PHUSTR_12,
|
PHUSTR_12,
|
||||||
PHUSTR_13,
|
PHUSTR_13,
|
||||||
PHUSTR_14,
|
PHUSTR_14,
|
||||||
PHUSTR_15,
|
PHUSTR_15,
|
||||||
PHUSTR_16,
|
PHUSTR_16,
|
||||||
PHUSTR_17,
|
PHUSTR_17,
|
||||||
PHUSTR_18,
|
PHUSTR_18,
|
||||||
PHUSTR_19,
|
PHUSTR_19,
|
||||||
PHUSTR_20,
|
PHUSTR_20,
|
||||||
|
|
||||||
PHUSTR_21,
|
PHUSTR_21,
|
||||||
PHUSTR_22,
|
PHUSTR_22,
|
||||||
PHUSTR_23,
|
PHUSTR_23,
|
||||||
PHUSTR_24,
|
PHUSTR_24,
|
||||||
PHUSTR_25,
|
PHUSTR_25,
|
||||||
PHUSTR_26,
|
PHUSTR_26,
|
||||||
PHUSTR_27,
|
PHUSTR_27,
|
||||||
PHUSTR_28,
|
PHUSTR_28,
|
||||||
PHUSTR_29,
|
PHUSTR_29,
|
||||||
PHUSTR_30,
|
PHUSTR_30,
|
||||||
PHUSTR_31,
|
PHUSTR_31,
|
||||||
PHUSTR_32
|
PHUSTR_32
|
||||||
};
|
};
|
||||||
|
|
||||||
// TNT WAD map names.
|
// TNT WAD map names.
|
||||||
const char *mapnamest[] =
|
const char* mapnamest[] =
|
||||||
{
|
{
|
||||||
THUSTR_1,
|
THUSTR_1,
|
||||||
THUSTR_2,
|
THUSTR_2,
|
||||||
THUSTR_3,
|
THUSTR_3,
|
||||||
THUSTR_4,
|
THUSTR_4,
|
||||||
THUSTR_5,
|
THUSTR_5,
|
||||||
THUSTR_6,
|
THUSTR_6,
|
||||||
THUSTR_7,
|
THUSTR_7,
|
||||||
THUSTR_8,
|
THUSTR_8,
|
||||||
THUSTR_9,
|
THUSTR_9,
|
||||||
THUSTR_10,
|
THUSTR_10,
|
||||||
THUSTR_11,
|
THUSTR_11,
|
||||||
|
|
||||||
THUSTR_12,
|
THUSTR_12,
|
||||||
THUSTR_13,
|
THUSTR_13,
|
||||||
THUSTR_14,
|
THUSTR_14,
|
||||||
THUSTR_15,
|
THUSTR_15,
|
||||||
THUSTR_16,
|
THUSTR_16,
|
||||||
THUSTR_17,
|
THUSTR_17,
|
||||||
THUSTR_18,
|
THUSTR_18,
|
||||||
THUSTR_19,
|
THUSTR_19,
|
||||||
THUSTR_20,
|
THUSTR_20,
|
||||||
|
|
||||||
THUSTR_21,
|
THUSTR_21,
|
||||||
THUSTR_22,
|
THUSTR_22,
|
||||||
THUSTR_23,
|
THUSTR_23,
|
||||||
THUSTR_24,
|
THUSTR_24,
|
||||||
THUSTR_25,
|
THUSTR_25,
|
||||||
THUSTR_26,
|
THUSTR_26,
|
||||||
THUSTR_27,
|
THUSTR_27,
|
||||||
THUSTR_28,
|
THUSTR_28,
|
||||||
THUSTR_29,
|
THUSTR_29,
|
||||||
THUSTR_30,
|
THUSTR_30,
|
||||||
THUSTR_31,
|
THUSTR_31,
|
||||||
THUSTR_32
|
THUSTR_32
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -271,50 +271,50 @@ const char english_shiftxform[] =
|
||||||
{
|
{
|
||||||
|
|
||||||
0,
|
0,
|
||||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||||
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||||
31,
|
31,
|
||||||
' ', '!', '"', '#', '$', '%', '&',
|
' ', '!', '"', '#', '$', '%', '&',
|
||||||
'"', // shift-'
|
'"', // shift-'
|
||||||
'(', ')', '*', '+',
|
'(', ')', '*', '+',
|
||||||
'<', // shift-,
|
'<', // shift-,
|
||||||
'_', // shift--
|
'_', // shift--
|
||||||
'>', // shift-.
|
'>', // shift-.
|
||||||
'?', // shift-/
|
'?', // shift-/
|
||||||
')', // shift-0
|
')', // shift-0
|
||||||
'!', // shift-1
|
'!', // shift-1
|
||||||
'@', // shift-2
|
'@', // shift-2
|
||||||
'#', // shift-3
|
'#', // shift-3
|
||||||
'$', // shift-4
|
'$', // shift-4
|
||||||
'%', // shift-5
|
'%', // shift-5
|
||||||
'^', // shift-6
|
'^', // shift-6
|
||||||
'&', // shift-7
|
'&', // shift-7
|
||||||
'*', // shift-8
|
'*', // shift-8
|
||||||
'(', // shift-9
|
'(', // shift-9
|
||||||
':',
|
':',
|
||||||
':', // shift-;
|
':', // shift-;
|
||||||
'<',
|
'<',
|
||||||
'+', // shift-=
|
'+', // shift-=
|
||||||
'>', '?', '@',
|
'>', '?', '@',
|
||||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
||||||
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||||
'[', // shift-[
|
'[', // shift-[
|
||||||
'!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
|
'!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
|
||||||
']', // shift-]
|
']', // shift-]
|
||||||
'"', '_',
|
'"', '_',
|
||||||
'\'', // shift-`
|
'\'', // shift-`
|
||||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
||||||
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||||
'{', '|', '}', '~', 127
|
'{', '|', '}', '~', 127
|
||||||
};
|
};
|
||||||
|
|
||||||
char ForeignTranslation(unsigned char ch)
|
char ForeignTranslation( unsigned char ch )
|
||||||
{
|
{
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HU_Init(void)
|
void HU_Init( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
@ -326,27 +326,29 @@ void HU_Init(void)
|
||||||
|
|
||||||
// load the heads-up font
|
// load the heads-up font
|
||||||
j = HU_FONTSTART;
|
j = HU_FONTSTART;
|
||||||
for (i=0;i<HU_FONTSIZE;i++)
|
for( i = 0; i < HU_FONTSIZE; i++ )
|
||||||
{
|
{
|
||||||
snprintf(buffer, buffer_len, "STCFN%03d", j++);
|
snprintf( buffer, buffer_len, "STCFN%03d", j++ );
|
||||||
::g->hu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC_SHARED);
|
::g->hu_font[i] = ( patch_t* ) W_CacheLumpName( buffer, PU_STATIC_SHARED );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HU_Stop(void)
|
void HU_Stop( void )
|
||||||
{
|
{
|
||||||
::g->headsupactive = false;
|
::g->headsupactive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HU_Start(void)
|
void HU_Start( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
const char* s;
|
const char* s;
|
||||||
|
|
||||||
if (::g->headsupactive)
|
if( ::g->headsupactive )
|
||||||
|
{
|
||||||
HU_Stop();
|
HU_Stop();
|
||||||
|
}
|
||||||
|
|
||||||
::g->plr = &::g->players[::g->consoleplayer];
|
::g->plr = &::g->players[::g->consoleplayer];
|
||||||
::g->message_on = false;
|
::g->message_on = false;
|
||||||
|
@ -355,94 +357,104 @@ void HU_Start(void)
|
||||||
::g->chat_on = false;
|
::g->chat_on = false;
|
||||||
|
|
||||||
// create the message widget
|
// create the message widget
|
||||||
HUlib_initSText(&::g->w_message,
|
HUlib_initSText( &::g->w_message,
|
||||||
HU_MSGX, HU_MSGY, HU_MSGHEIGHT,
|
HU_MSGX, HU_MSGY, HU_MSGHEIGHT,
|
||||||
::g->hu_font,
|
::g->hu_font,
|
||||||
HU_FONTSTART, &::g->message_on);
|
HU_FONTSTART, &::g->message_on );
|
||||||
|
|
||||||
// create the map title widget
|
// create the map title widget
|
||||||
HUlib_initTextLine(&::g->w_title,
|
HUlib_initTextLine( &::g->w_title,
|
||||||
HU_TITLEX, HU_TITLEY,
|
HU_TITLEX, HU_TITLEY,
|
||||||
::g->hu_font,
|
::g->hu_font,
|
||||||
HU_FONTSTART);
|
HU_FONTSTART );
|
||||||
|
|
||||||
switch ( ::g->gamemode )
|
switch( ::g->gamemode )
|
||||||
{
|
{
|
||||||
case shareware:
|
case shareware:
|
||||||
case registered:
|
case registered:
|
||||||
case retail:
|
case retail:
|
||||||
s = HU_TITLE;
|
s = HU_TITLE;
|
||||||
break;
|
break;
|
||||||
case commercial:
|
case commercial:
|
||||||
default:
|
default:
|
||||||
if( DoomLib::expansionSelected == 5 ) {
|
if( DoomLib::expansionSelected == 5 )
|
||||||
int map = ::g->gamemap;
|
{
|
||||||
if( ::g->gamemap > 9 ) {
|
int map = ::g->gamemap;
|
||||||
map = 0;
|
if( ::g->gamemap > 9 )
|
||||||
|
{
|
||||||
|
map = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
s = DoomLib::GetCurrentExpansion()->mapNames[ map - 1 ];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s = DoomLib::GetCurrentExpansion()->mapNames[ ::g->gamemap - 1 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
s = DoomLib::GetCurrentExpansion()->mapNames[ map - 1 ];
|
|
||||||
} else {
|
|
||||||
s = DoomLib::GetCurrentExpansion()->mapNames[ ::g->gamemap - 1 ];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*s)
|
while( *s )
|
||||||
HUlib_addCharToTextLine(&::g->w_title, *(s++));
|
{
|
||||||
|
HUlib_addCharToTextLine( &::g->w_title, *( s++ ) );
|
||||||
|
}
|
||||||
|
|
||||||
// create the chat widget
|
// create the chat widget
|
||||||
HUlib_initIText(&::g->w_chat,
|
HUlib_initIText( &::g->w_chat,
|
||||||
HU_INPUTX, HU_INPUTY,
|
HU_INPUTX, HU_INPUTY,
|
||||||
::g->hu_font,
|
::g->hu_font,
|
||||||
HU_FONTSTART, &::g->chat_on);
|
HU_FONTSTART, &::g->chat_on );
|
||||||
|
|
||||||
// create the inputbuffer widgets
|
// create the inputbuffer widgets
|
||||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
for( i = 0 ; i < MAXPLAYERS ; i++ )
|
||||||
HUlib_initIText(&::g->w_inputbuffer[i], 0, 0, 0, 0, &::g->always_off);
|
{
|
||||||
|
HUlib_initIText( &::g->w_inputbuffer[i], 0, 0, 0, 0, &::g->always_off );
|
||||||
|
}
|
||||||
|
|
||||||
::g->headsupactive = true;
|
::g->headsupactive = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HU_Drawer(void)
|
void HU_Drawer( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
HUlib_drawSText(&::g->w_message);
|
HUlib_drawSText( &::g->w_message );
|
||||||
HUlib_drawIText(&::g->w_chat);
|
HUlib_drawIText( &::g->w_chat );
|
||||||
if (::g->automapactive)
|
if( ::g->automapactive )
|
||||||
HUlib_drawTextLine(&::g->w_title, false);
|
{
|
||||||
|
HUlib_drawTextLine( &::g->w_title, false );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HU_Erase(void)
|
void HU_Erase( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
HUlib_eraseSText(&::g->w_message);
|
HUlib_eraseSText( &::g->w_message );
|
||||||
HUlib_eraseIText(&::g->w_chat);
|
HUlib_eraseIText( &::g->w_chat );
|
||||||
HUlib_eraseTextLine(&::g->w_title);
|
HUlib_eraseTextLine( &::g->w_title );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HU_Ticker(void)
|
void HU_Ticker( void )
|
||||||
{
|
{
|
||||||
// tick down message counter if message is up
|
// tick down message counter if message is up
|
||||||
if (::g->message_counter && !--::g->message_counter)
|
if( ::g->message_counter && !--::g->message_counter )
|
||||||
{
|
{
|
||||||
::g->message_on = false;
|
::g->message_on = false;
|
||||||
::g->message_nottobefuckedwith = false;
|
::g->message_nottobefuckedwith = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( m_inDemoMode.GetBool() == false && m_show_messages.GetBool() ) || ::g->message_dontfuckwithme)
|
if( ( m_inDemoMode.GetBool() == false && m_show_messages.GetBool() ) || ::g->message_dontfuckwithme )
|
||||||
{
|
{
|
||||||
|
|
||||||
// display message if necessary
|
// display message if necessary
|
||||||
if ((::g->plr->message && !::g->message_nottobefuckedwith)
|
if( ( ::g->plr->message && !::g->message_nottobefuckedwith )
|
||||||
|| (::g->plr->message && ::g->message_dontfuckwithme))
|
|| ( ::g->plr->message && ::g->message_dontfuckwithme ) )
|
||||||
{
|
{
|
||||||
HUlib_addMessageToSText(&::g->w_message, 0, ::g->plr->message);
|
HUlib_addMessageToSText( &::g->w_message, 0, ::g->plr->message );
|
||||||
::g->plr->message = 0;
|
::g->plr->message = 0;
|
||||||
::g->message_on = true;
|
::g->message_on = true;
|
||||||
::g->message_counter = HU_MSGTIMEOUT;
|
::g->message_counter = HU_MSGTIMEOUT;
|
||||||
|
@ -456,27 +468,27 @@ void HU_Ticker(void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void HU_queueChatChar(char c)
|
void HU_queueChatChar( char c )
|
||||||
{
|
{
|
||||||
if (((::g->head + 1) & (QUEUESIZE-1)) == ::g->tail)
|
if( ( ( ::g->head + 1 ) & ( QUEUESIZE - 1 ) ) == ::g->tail )
|
||||||
{
|
{
|
||||||
::g->plr->message = HUSTR_MSGU;
|
::g->plr->message = HUSTR_MSGU;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
::g->chatchars[::g->head] = c;
|
::g->chatchars[::g->head] = c;
|
||||||
::g->head = (::g->head + 1) & (QUEUESIZE-1);
|
::g->head = ( ::g->head + 1 ) & ( QUEUESIZE - 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char HU_dequeueChatChar(void)
|
char HU_dequeueChatChar( void )
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
if (::g->head != ::g->tail)
|
if( ::g->head != ::g->tail )
|
||||||
{
|
{
|
||||||
c = ::g->chatchars[::g->tail];
|
c = ::g->chatchars[::g->tail];
|
||||||
::g->tail = (::g->tail + 1) & (QUEUESIZE-1);
|
::g->tail = ( ::g->tail + 1 ) & ( QUEUESIZE - 1 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -486,7 +498,7 @@ char HU_dequeueChatChar(void)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean HU_Responder(event_t *ev)
|
qboolean HU_Responder( event_t* ev )
|
||||||
{
|
{
|
||||||
|
|
||||||
const char* macromessage;
|
const char* macromessage;
|
||||||
|
@ -498,70 +510,84 @@ qboolean HU_Responder(event_t *ev)
|
||||||
const static char destination_keys[MAXPLAYERS] =
|
const static char destination_keys[MAXPLAYERS] =
|
||||||
{
|
{
|
||||||
HUSTR_KEYGREEN,
|
HUSTR_KEYGREEN,
|
||||||
HUSTR_KEYINDIGO,
|
HUSTR_KEYINDIGO,
|
||||||
HUSTR_KEYBROWN,
|
HUSTR_KEYBROWN,
|
||||||
HUSTR_KEYRED
|
HUSTR_KEYRED
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
numplayers = 0;
|
numplayers = 0;
|
||||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
for( i = 0 ; i < MAXPLAYERS ; i++ )
|
||||||
|
{
|
||||||
numplayers += ::g->playeringame[i];
|
numplayers += ::g->playeringame[i];
|
||||||
|
}
|
||||||
|
|
||||||
if (ev->data1 == KEY_RSHIFT)
|
if( ev->data1 == KEY_RSHIFT )
|
||||||
{
|
{
|
||||||
::g->shiftdown = ev->type == ev_keydown;
|
::g->shiftdown = ev->type == ev_keydown;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (ev->data1 == KEY_RALT || ev->data1 == KEY_LALT)
|
else if( ev->data1 == KEY_RALT || ev->data1 == KEY_LALT )
|
||||||
{
|
{
|
||||||
::g->altdown = ev->type == ev_keydown;
|
::g->altdown = ev->type == ev_keydown;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ev->type != ev_keydown)
|
if( ev->type != ev_keydown )
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!::g->chat_on)
|
|
||||||
{
|
{
|
||||||
if (ev->data1 == HU_MSGREFRESH)
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !::g->chat_on )
|
||||||
|
{
|
||||||
|
if( ev->data1 == HU_MSGREFRESH )
|
||||||
{
|
{
|
||||||
::g->message_on = true;
|
::g->message_on = true;
|
||||||
::g->message_counter = HU_MSGTIMEOUT;
|
::g->message_counter = HU_MSGTIMEOUT;
|
||||||
eatkey = true;
|
eatkey = true;
|
||||||
}
|
}
|
||||||
else if (::g->netgame && ev->data1 == HU_INPUTTOGGLE)
|
else if( ::g->netgame && ev->data1 == HU_INPUTTOGGLE )
|
||||||
{
|
{
|
||||||
eatkey = ::g->chat_on = true;
|
eatkey = ::g->chat_on = true;
|
||||||
HUlib_resetIText(&::g->w_chat);
|
HUlib_resetIText( &::g->w_chat );
|
||||||
HU_queueChatChar(HU_BROADCAST);
|
HU_queueChatChar( HU_BROADCAST );
|
||||||
}
|
}
|
||||||
else if (::g->netgame && numplayers > 2)
|
else if( ::g->netgame && numplayers > 2 )
|
||||||
{
|
{
|
||||||
for (i=0; i<MAXPLAYERS ; i++)
|
for( i = 0; i < MAXPLAYERS ; i++ )
|
||||||
{
|
{
|
||||||
if (ev->data1 == destination_keys[i])
|
if( ev->data1 == destination_keys[i] )
|
||||||
{
|
{
|
||||||
if (::g->playeringame[i] && i!=::g->consoleplayer)
|
if( ::g->playeringame[i] && i !=::g->consoleplayer )
|
||||||
{
|
{
|
||||||
eatkey = ::g->chat_on = true;
|
eatkey = ::g->chat_on = true;
|
||||||
HUlib_resetIText(&::g->w_chat);
|
HUlib_resetIText( &::g->w_chat );
|
||||||
HU_queueChatChar(i+1);
|
HU_queueChatChar( i + 1 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (i == ::g->consoleplayer)
|
else if( i == ::g->consoleplayer )
|
||||||
{
|
{
|
||||||
::g->num_nobrainers++;
|
::g->num_nobrainers++;
|
||||||
if (::g->num_nobrainers < 3)
|
if( ::g->num_nobrainers < 3 )
|
||||||
|
{
|
||||||
::g->plr->message = HUSTR_TALKTOSELF1;
|
::g->plr->message = HUSTR_TALKTOSELF1;
|
||||||
else if (::g->num_nobrainers < 6)
|
}
|
||||||
|
else if( ::g->num_nobrainers < 6 )
|
||||||
|
{
|
||||||
::g->plr->message = HUSTR_TALKTOSELF2;
|
::g->plr->message = HUSTR_TALKTOSELF2;
|
||||||
else if (::g->num_nobrainers < 9)
|
}
|
||||||
|
else if( ::g->num_nobrainers < 9 )
|
||||||
|
{
|
||||||
::g->plr->message = HUSTR_TALKTOSELF3;
|
::g->plr->message = HUSTR_TALKTOSELF3;
|
||||||
else if (::g->num_nobrainers < 32)
|
}
|
||||||
|
else if( ::g->num_nobrainers < 32 )
|
||||||
|
{
|
||||||
::g->plr->message = HUSTR_TALKTOSELF4;
|
::g->plr->message = HUSTR_TALKTOSELF4;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
::g->plr->message = HUSTR_TALKTOSELF5;
|
::g->plr->message = HUSTR_TALKTOSELF5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -571,52 +597,60 @@ qboolean HU_Responder(event_t *ev)
|
||||||
{
|
{
|
||||||
c = ev->data1;
|
c = ev->data1;
|
||||||
// send a macro
|
// send a macro
|
||||||
if (::g->altdown)
|
if( ::g->altdown )
|
||||||
{
|
{
|
||||||
c = c - '0';
|
c = c - '0';
|
||||||
if (c > 9)
|
if( c > 9 )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
// I_PrintfE( "got here\n");
|
// I_PrintfE( "got here\n");
|
||||||
macromessage = temp_chat_macros[c];
|
macromessage = temp_chat_macros[c];
|
||||||
|
|
||||||
// kill last message with a '\n'
|
// kill last message with a '\n'
|
||||||
HU_queueChatChar(KEY_ENTER); // DEBUG!!!
|
HU_queueChatChar( KEY_ENTER ); // DEBUG!!!
|
||||||
|
|
||||||
// send the macro message
|
// send the macro message
|
||||||
while (*macromessage)
|
while( *macromessage )
|
||||||
HU_queueChatChar(*macromessage++);
|
{
|
||||||
HU_queueChatChar(KEY_ENTER);
|
HU_queueChatChar( *macromessage++ );
|
||||||
|
}
|
||||||
|
HU_queueChatChar( KEY_ENTER );
|
||||||
|
|
||||||
// leave chat mode and notify that it was sent
|
// leave chat mode and notify that it was sent
|
||||||
::g->chat_on = false;
|
::g->chat_on = false;
|
||||||
strcpy(::g->lastmessage, temp_chat_macros[c]);
|
strcpy( ::g->lastmessage, temp_chat_macros[c] );
|
||||||
::g->plr->message = ::g->lastmessage;
|
::g->plr->message = ::g->lastmessage;
|
||||||
eatkey = true;
|
eatkey = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (::g->shiftdown || (c >= 'a' && c <= 'z'))
|
if( ::g->shiftdown || ( c >= 'a' && c <= 'z' ) )
|
||||||
|
{
|
||||||
c = shiftxform[c];
|
c = shiftxform[c];
|
||||||
eatkey = HUlib_keyInIText(&::g->w_chat, c);
|
}
|
||||||
if (eatkey)
|
eatkey = HUlib_keyInIText( &::g->w_chat, c );
|
||||||
|
if( eatkey )
|
||||||
{
|
{
|
||||||
// static unsigned char buf[20]; // DEBUG
|
// static unsigned char buf[20]; // DEBUG
|
||||||
HU_queueChatChar(c);
|
HU_queueChatChar( c );
|
||||||
|
|
||||||
// sprintf(buf, "KEY: %d => %d", ev->data1, c);
|
// sprintf(buf, "KEY: %d => %d", ev->data1, c);
|
||||||
// ::g->plr->message = buf;
|
// ::g->plr->message = buf;
|
||||||
}
|
}
|
||||||
if (c == KEY_ENTER)
|
if( c == KEY_ENTER )
|
||||||
{
|
{
|
||||||
::g->chat_on = false;
|
::g->chat_on = false;
|
||||||
if (::g->w_chat.l.len)
|
if( ::g->w_chat.l.len )
|
||||||
{
|
{
|
||||||
strcpy(::g->lastmessage, ::g->w_chat.l.l);
|
strcpy( ::g->lastmessage, ::g->w_chat.l.l );
|
||||||
::g->plr->message = ::g->lastmessage;
|
::g->plr->message = ::g->lastmessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (c == KEY_ESCAPE)
|
else if( c == KEY_ESCAPE )
|
||||||
|
{
|
||||||
::g->chat_on = false;
|
::g->chat_on = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,15 +55,15 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// HEADS UP TEXT
|
// HEADS UP TEXT
|
||||||
//
|
//
|
||||||
|
|
||||||
void HU_Init(void);
|
void HU_Init( void );
|
||||||
void HU_Start(void);
|
void HU_Start( void );
|
||||||
|
|
||||||
qboolean HU_Responder(event_t* ev);
|
qboolean HU_Responder( event_t* ev );
|
||||||
|
|
||||||
void HU_Ticker(void);
|
void HU_Ticker( void );
|
||||||
void HU_Drawer(void);
|
void HU_Drawer( void );
|
||||||
char HU_dequeueChatChar(void);
|
char HU_dequeueChatChar( void );
|
||||||
void HU_Erase(void);
|
void HU_Erase( void );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -53,27 +53,35 @@ extern int PLAYERCOUNT;
|
||||||
|
|
||||||
#define NUM_BUTTONS 4
|
#define NUM_BUTTONS 4
|
||||||
|
|
||||||
static bool Cheat_God() {
|
static bool Cheat_God()
|
||||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
{
|
||||||
|
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
::g->plyr->cheats ^= CF_GODMODE;
|
::g->plyr->cheats ^= CF_GODMODE;
|
||||||
if (::g->plyr->cheats & CF_GODMODE)
|
if( ::g->plyr->cheats & CF_GODMODE )
|
||||||
{
|
{
|
||||||
if (::g->plyr->mo)
|
if( ::g->plyr->mo )
|
||||||
|
{
|
||||||
::g->plyr->mo->health = 100;
|
::g->plyr->mo->health = 100;
|
||||||
|
}
|
||||||
|
|
||||||
::g->plyr->health = 100;
|
::g->plyr->health = 100;
|
||||||
::g->plyr->message = STSTR_DQDON;
|
::g->plyr->message = STSTR_DQDON;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
::g->plyr->message = STSTR_DQDOFF;
|
::g->plyr->message = STSTR_DQDOFF;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
static bool Cheat_NextLevel() {
|
static bool Cheat_NextLevel()
|
||||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
{
|
||||||
|
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
G_ExitLevel();
|
G_ExitLevel();
|
||||||
|
@ -81,8 +89,10 @@ static bool Cheat_NextLevel() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Cheat_GiveAll() {
|
static bool Cheat_GiveAll()
|
||||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
{
|
||||||
|
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,39 +100,53 @@ static bool Cheat_GiveAll() {
|
||||||
::g->plyr->armortype = 2;
|
::g->plyr->armortype = 2;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i<NUMWEAPONS;i++)
|
for( i = 0; i < NUMWEAPONS; i++ )
|
||||||
|
{
|
||||||
::g->plyr->weaponowned[i] = true;
|
::g->plyr->weaponowned[i] = true;
|
||||||
|
}
|
||||||
|
|
||||||
for (i=0;i<NUMAMMO;i++)
|
for( i = 0; i < NUMAMMO; i++ )
|
||||||
|
{
|
||||||
::g->plyr->ammo[i] = ::g->plyr->maxammo[i];
|
::g->plyr->ammo[i] = ::g->plyr->maxammo[i];
|
||||||
|
}
|
||||||
|
|
||||||
for (i=0;i<NUMCARDS;i++)
|
for( i = 0; i < NUMCARDS; i++ )
|
||||||
|
{
|
||||||
::g->plyr->cards[i] = true;
|
::g->plyr->cards[i] = true;
|
||||||
|
}
|
||||||
|
|
||||||
::g->plyr->message = STSTR_KFAADDED;
|
::g->plyr->message = STSTR_KFAADDED;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Cheat_GiveAmmo() {
|
static bool Cheat_GiveAmmo()
|
||||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
{
|
||||||
|
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
::g->plyr->armorpoints = 200;
|
::g->plyr->armorpoints = 200;
|
||||||
::g->plyr->armortype = 2;
|
::g->plyr->armortype = 2;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i<NUMWEAPONS;i++)
|
for( i = 0; i < NUMWEAPONS; i++ )
|
||||||
|
{
|
||||||
::g->plyr->weaponowned[i] = true;
|
::g->plyr->weaponowned[i] = true;
|
||||||
|
}
|
||||||
|
|
||||||
for (i=0;i<NUMAMMO;i++)
|
for( i = 0; i < NUMAMMO; i++ )
|
||||||
|
{
|
||||||
::g->plyr->ammo[i] = ::g->plyr->maxammo[i];
|
::g->plyr->ammo[i] = ::g->plyr->maxammo[i];
|
||||||
|
}
|
||||||
|
|
||||||
::g->plyr->message = STSTR_KFAADDED;
|
::g->plyr->message = STSTR_KFAADDED;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Cheat_Choppers() {
|
static bool Cheat_Choppers()
|
||||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
{
|
||||||
|
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
::g->plyr->weaponowned[wp_chainsaw] = true;
|
::g->plyr->weaponowned[wp_chainsaw] = true;
|
||||||
|
@ -130,21 +154,30 @@ static bool Cheat_Choppers() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern qboolean P_GivePower ( player_t* player, int /*powertype_t*/ power );
|
extern qboolean P_GivePower( player_t* player, int /*powertype_t*/ power );
|
||||||
|
|
||||||
static void TogglePowerUp( int i ) {
|
static void TogglePowerUp( int i )
|
||||||
if (!::g->plyr->powers[i])
|
{
|
||||||
P_GivePower( ::g->plyr, i);
|
if( !::g->plyr->powers[i] )
|
||||||
else if (i!=pw_strength)
|
{
|
||||||
|
P_GivePower( ::g->plyr, i );
|
||||||
|
}
|
||||||
|
else if( i != pw_strength )
|
||||||
|
{
|
||||||
::g->plyr->powers[i] = 1;
|
::g->plyr->powers[i] = 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
::g->plyr->powers[i] = 0;
|
::g->plyr->powers[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
::g->plyr->message = STSTR_BEHOLDX;
|
::g->plyr->message = STSTR_BEHOLDX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Cheat_GiveInvul() {
|
static bool Cheat_GiveInvul()
|
||||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
{
|
||||||
|
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +185,10 @@ static bool Cheat_GiveInvul() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Cheat_GiveBerserk() {
|
static bool Cheat_GiveBerserk()
|
||||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
{
|
||||||
|
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,8 +196,10 @@ static bool Cheat_GiveBerserk() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Cheat_GiveBlur() {
|
static bool Cheat_GiveBlur()
|
||||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
{
|
||||||
|
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,8 +207,10 @@ static bool Cheat_GiveBlur() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Cheat_GiveRad() {
|
static bool Cheat_GiveRad()
|
||||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
{
|
||||||
|
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,8 +218,10 @@ static bool Cheat_GiveRad() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Cheat_GiveMap() {
|
static bool Cheat_GiveMap()
|
||||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
{
|
||||||
|
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,8 +229,10 @@ static bool Cheat_GiveMap() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Cheat_GiveLight() {
|
static bool Cheat_GiveLight()
|
||||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
{
|
||||||
|
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,20 +244,21 @@ static bool Cheat_GiveLight() {
|
||||||
|
|
||||||
#ifndef __PS3__
|
#ifndef __PS3__
|
||||||
|
|
||||||
static bool tracking = false;
|
static bool tracking = false;
|
||||||
static int currentCode[NUM_BUTTONS];
|
static int currentCode[NUM_BUTTONS];
|
||||||
static int currentCheatLength;
|
static int currentCheatLength;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef bool(*cheat_command)(void);
|
typedef bool( *cheat_command )( void );
|
||||||
struct cheatcode_t
|
struct cheatcode_t
|
||||||
{
|
{
|
||||||
int code[NUM_BUTTONS];
|
int code[NUM_BUTTONS];
|
||||||
cheat_command function;
|
cheat_command function;
|
||||||
};
|
};
|
||||||
|
|
||||||
static cheatcode_t codes[] = {
|
static cheatcode_t codes[] =
|
||||||
|
{
|
||||||
{ {0, 1, 1, 0}, Cheat_God }, // a b b a
|
{ {0, 1, 1, 0}, Cheat_God }, // a b b a
|
||||||
{ {0, 0, 1, 1}, Cheat_NextLevel }, // a a b b
|
{ {0, 0, 1, 1}, Cheat_NextLevel }, // a a b b
|
||||||
{ {1, 0, 1, 0}, Cheat_GiveAmmo }, // b a b a
|
{ {1, 0, 1, 0}, Cheat_GiveAmmo }, // b a b a
|
||||||
|
@ -228,10 +272,11 @@ static cheatcode_t codes[] = {
|
||||||
{ {3, 3, 3, 2}, Cheat_GiveLight}, // y y y x
|
{ {3, 3, 3, 2}, Cheat_GiveLight}, // y y y x
|
||||||
};
|
};
|
||||||
|
|
||||||
const static int numberOfCodes = sizeof(codes) / sizeof(codes[0]);
|
const static int numberOfCodes = sizeof( codes ) / sizeof( codes[0] );
|
||||||
|
|
||||||
|
|
||||||
void BeginTrackingCheat() {
|
void BeginTrackingCheat()
|
||||||
|
{
|
||||||
#if ALLOW_CHEATS
|
#if ALLOW_CHEATS
|
||||||
tracking = true;
|
tracking = true;
|
||||||
currentCheatLength = 0;
|
currentCheatLength = 0;
|
||||||
|
@ -239,25 +284,32 @@ void BeginTrackingCheat() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndTrackingCheat() {
|
void EndTrackingCheat()
|
||||||
|
{
|
||||||
#if ALLOW_CHEATS
|
#if ALLOW_CHEATS
|
||||||
tracking = false;
|
tracking = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void S_StartSound ( void* origin, int sfx_id );
|
extern void S_StartSound( void* origin, int sfx_id );
|
||||||
|
|
||||||
void CheckCheat( int button ) {
|
void CheckCheat( int button )
|
||||||
|
{
|
||||||
#if ALLOW_CHEATS
|
#if ALLOW_CHEATS
|
||||||
if( tracking && !::g->netgame ) {
|
if( tracking && !::g->netgame )
|
||||||
|
{
|
||||||
|
|
||||||
currentCode[ currentCheatLength++ ] = button;
|
currentCode[ currentCheatLength++ ] = button;
|
||||||
|
|
||||||
if( currentCheatLength == NUM_BUTTONS ) {
|
if( currentCheatLength == NUM_BUTTONS )
|
||||||
for( int i = 0; i < numberOfCodes; ++i) {
|
{
|
||||||
if( memcmp( &codes[i].code[0], ¤tCode[0], sizeof(currentCode) ) == 0 ) {
|
for( int i = 0; i < numberOfCodes; ++i )
|
||||||
if(codes[i].function()) {
|
{
|
||||||
S_StartSound(0, sfx_cybsit);
|
if( memcmp( &codes[i].code[0], ¤tCode[0], sizeof( currentCode ) ) == 0 )
|
||||||
|
{
|
||||||
|
if( codes[i].function() )
|
||||||
|
{
|
||||||
|
S_StartSound( 0, sfx_cybsit );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,7 +330,7 @@ float xbox_deadzone = 0.28f;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void I_InitInput(void)
|
void I_InitInput( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,46 +339,49 @@ void I_ShutdownInput()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static float _joyAxisConvert(short x, float xbxScale, float dScale, float deadZone)
|
static float _joyAxisConvert( short x, float xbxScale, float dScale, float deadZone )
|
||||||
{
|
{
|
||||||
//const float signConverted = x - 127;
|
//const float signConverted = x - 127;
|
||||||
float y = x - 127;
|
float y = x - 127;
|
||||||
y = y / xbxScale;
|
y = y / xbxScale;
|
||||||
return (fabs(y) < deadZone) ? 0.f : (y * dScale);
|
return ( fabs( y ) < deadZone ) ? 0.f : ( y * dScale );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int I_PollMouseInputEvents( controller_t *con)
|
int I_PollMouseInputEvents( controller_t* con )
|
||||||
{
|
{
|
||||||
int numEvents = 0;
|
int numEvents = 0;
|
||||||
|
|
||||||
return numEvents;
|
return numEvents;
|
||||||
}
|
}
|
||||||
|
|
||||||
int I_ReturnMouseInputEvent( const int n, event_t* e) {
|
int I_ReturnMouseInputEvent( const int n, event_t* e )
|
||||||
|
{
|
||||||
e->type = ev_mouse;
|
e->type = ev_mouse;
|
||||||
e->data1 = e->data2 = e->data3 = 0;
|
e->data1 = e->data2 = e->data3 = 0;
|
||||||
|
|
||||||
switch(::g->mouseEvents[n].type) {
|
switch( ::g->mouseEvents[n].type )
|
||||||
case IETAxis:
|
{
|
||||||
switch (::g->mouseEvents[n].action)
|
case IETAxis:
|
||||||
{
|
switch( ::g->mouseEvents[n].action )
|
||||||
case M_DELTAX:
|
{
|
||||||
e->data2 = ::g->mouseEvents[n].data;
|
case M_DELTAX:
|
||||||
break;
|
e->data2 = ::g->mouseEvents[n].data;
|
||||||
case M_DELTAY:
|
break;
|
||||||
e->data3 = ::g->mouseEvents[n].data;
|
case M_DELTAY:
|
||||||
break;
|
e->data3 = ::g->mouseEvents[n].data;
|
||||||
}
|
break;
|
||||||
return 1;
|
}
|
||||||
|
return 1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int I_PollJoystickInputEvents( controller_t *con ) {
|
int I_PollJoystickInputEvents( controller_t* con )
|
||||||
|
{
|
||||||
int numEvents = 0;
|
int numEvents = 0;
|
||||||
|
|
||||||
return numEvents;
|
return numEvents;
|
||||||
|
@ -335,137 +390,153 @@ int I_PollJoystickInputEvents( controller_t *con ) {
|
||||||
//
|
//
|
||||||
// Translates the key currently in X_event
|
// Translates the key currently in X_event
|
||||||
//
|
//
|
||||||
static int xlatekey(int key)
|
static int xlatekey( int key )
|
||||||
{
|
{
|
||||||
int rc = KEY_F1;
|
int rc = KEY_F1;
|
||||||
|
|
||||||
switch (key)
|
switch( key )
|
||||||
{
|
{
|
||||||
case 0: // A
|
case 0: // A
|
||||||
//rc = KEY_ENTER;
|
|
||||||
rc = ' ';
|
|
||||||
break;
|
|
||||||
case 3: // Y
|
|
||||||
rc = '1';
|
|
||||||
break;
|
|
||||||
case 1: // B
|
|
||||||
if( ::g->menuactive ) {
|
|
||||||
rc = KEY_BACKSPACE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
rc = '2';
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2: // X
|
|
||||||
//rc = ' ';
|
|
||||||
rc = KEY_TAB;
|
|
||||||
break;
|
|
||||||
case 4: // White
|
|
||||||
rc = KEY_MINUS;
|
|
||||||
break;
|
|
||||||
case 5: // Black
|
|
||||||
rc = KEY_EQUALS;
|
|
||||||
break;
|
|
||||||
case 6: // Left triggers
|
|
||||||
rc = KEY_RSHIFT;
|
|
||||||
break;
|
|
||||||
case 7: // Right
|
|
||||||
rc = KEY_RCTRL;
|
|
||||||
break;
|
|
||||||
case 8: // Up
|
|
||||||
if( ::g->menuactive ) {
|
|
||||||
rc = KEY_UPARROW;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//rc = KEY_ENTER;
|
//rc = KEY_ENTER;
|
||||||
rc = '3';
|
rc = ' ';
|
||||||
}
|
break;
|
||||||
break;
|
case 3: // Y
|
||||||
case 9:
|
rc = '1';
|
||||||
if( ::g->menuactive ) {
|
break;
|
||||||
rc = KEY_DOWNARROW;
|
case 1: // B
|
||||||
}
|
if( ::g->menuactive )
|
||||||
else {
|
{
|
||||||
//rc = KEY_TAB;
|
rc = KEY_BACKSPACE;
|
||||||
rc = '5';
|
}
|
||||||
}
|
else
|
||||||
break;
|
{
|
||||||
case 10:
|
rc = '2';
|
||||||
if( ::g->menuactive ) {
|
}
|
||||||
rc = KEY_UPARROW;
|
break;
|
||||||
}
|
case 2: // X
|
||||||
else {
|
//rc = ' ';
|
||||||
//rc = '1';
|
rc = KEY_TAB;
|
||||||
rc = '6';
|
break;
|
||||||
}
|
case 4: // White
|
||||||
break;
|
rc = KEY_MINUS;
|
||||||
case 11:
|
break;
|
||||||
if( ::g->menuactive ) {
|
case 5: // Black
|
||||||
rc = KEY_DOWNARROW;
|
rc = KEY_EQUALS;
|
||||||
}
|
break;
|
||||||
else {
|
case 6: // Left triggers
|
||||||
//rc = '2';
|
rc = KEY_RSHIFT;
|
||||||
rc = '4';
|
break;
|
||||||
}
|
case 7: // Right
|
||||||
break;
|
rc = KEY_RCTRL;
|
||||||
case 12: // start
|
break;
|
||||||
rc = KEY_ESCAPE;
|
case 8: // Up
|
||||||
break;
|
if( ::g->menuactive )
|
||||||
case 13: //select
|
{
|
||||||
//rc = KEY_ESCAPE;
|
rc = KEY_UPARROW;
|
||||||
break;
|
}
|
||||||
case 14: // lclick
|
else
|
||||||
case 15: // rclick
|
{
|
||||||
//rc = ' ';
|
//rc = KEY_ENTER;
|
||||||
break;
|
rc = '3';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
if( ::g->menuactive )
|
||||||
|
{
|
||||||
|
rc = KEY_DOWNARROW;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//rc = KEY_TAB;
|
||||||
|
rc = '5';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
if( ::g->menuactive )
|
||||||
|
{
|
||||||
|
rc = KEY_UPARROW;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//rc = '1';
|
||||||
|
rc = '6';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
if( ::g->menuactive )
|
||||||
|
{
|
||||||
|
rc = KEY_DOWNARROW;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//rc = '2';
|
||||||
|
rc = '4';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 12: // start
|
||||||
|
rc = KEY_ESCAPE;
|
||||||
|
break;
|
||||||
|
case 13: //select
|
||||||
|
//rc = KEY_ESCAPE;
|
||||||
|
break;
|
||||||
|
case 14: // lclick
|
||||||
|
case 15: // rclick
|
||||||
|
//rc = ' ';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int I_ReturnJoystickInputEvent( const int n, event_t* e) {
|
int I_ReturnJoystickInputEvent( const int n, event_t* e )
|
||||||
|
{
|
||||||
|
|
||||||
e->data1 = e->data2 = e->data3 = 0;
|
e->data1 = e->data2 = e->data3 = 0;
|
||||||
|
|
||||||
switch(::g->joyEvents[n].type)
|
switch( ::g->joyEvents[n].type )
|
||||||
{
|
{
|
||||||
case IETAxis:
|
case IETAxis:
|
||||||
e->type = ev_joystick;//ev_mouse;
|
e->type = ev_joystick;//ev_mouse;
|
||||||
switch (::g->joyEvents[n].action)
|
switch( ::g->joyEvents[n].action )
|
||||||
{
|
{
|
||||||
case J_DELTAX:
|
case J_DELTAX:
|
||||||
/*
|
/*
|
||||||
if (::g->joyEvents[n].data < 0)
|
if (::g->joyEvents[n].data < 0)
|
||||||
e->data2 = -1;
|
e->data2 = -1;
|
||||||
else if (::g->joyEvents[n].data > 0)
|
else if (::g->joyEvents[n].data > 0)
|
||||||
e->data2 = 1;
|
e->data2 = 1;
|
||||||
*/
|
*/
|
||||||
e->data2 = ::g->joyEvents[n].data;
|
e->data2 = ::g->joyEvents[n].data;
|
||||||
break;
|
break;
|
||||||
case J_DELTAY:
|
case J_DELTAY:
|
||||||
e->type = ev_mouse;
|
e->type = ev_mouse;
|
||||||
e->data3 = ::g->joyEvents[n].data;
|
e->data3 = ::g->joyEvents[n].data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
case IETButtonAnalog:
|
case IETButtonAnalog:
|
||||||
case IETButtonDigital:
|
case IETButtonDigital:
|
||||||
if (::g->joyEvents[n].data)
|
if( ::g->joyEvents[n].data )
|
||||||
e->type = ev_keydown;
|
{
|
||||||
else
|
e->type = ev_keydown;
|
||||||
e->type = ev_keyup;
|
}
|
||||||
e->data1 = xlatekey(::g->joyEvents[n].action);
|
else
|
||||||
return 1;
|
{
|
||||||
|
e->type = ev_keyup;
|
||||||
|
}
|
||||||
|
e->data1 = xlatekey( ::g->joyEvents[n].action );
|
||||||
|
return 1;
|
||||||
|
|
||||||
case IETNone:
|
case IETNone:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_EndJoystickInputEvents() {
|
void I_EndJoystickInputEvents()
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < 18; i++)
|
for( i = 0; i < 18; i++ )
|
||||||
{
|
{
|
||||||
::g->joyEvents[i].type = IETNone;
|
::g->joyEvents[i].type = IETNone;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "i_net.h"
|
#pragma implementation "i_net.h"
|
||||||
#endif
|
#endif
|
||||||
#include "i_net.h"
|
#include "i_net.h"
|
||||||
|
|
||||||
|
@ -54,6 +54,6 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// For some odd reason...
|
// For some odd reason...
|
||||||
|
|
||||||
|
|
||||||
void NetSend (void);
|
void NetSend( void );
|
||||||
qboolean NetListen (void);
|
qboolean NetListen( void );
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// Called by D_DoomMain.
|
// Called by D_DoomMain.
|
||||||
|
|
||||||
|
|
||||||
void I_InitNetwork (void);
|
void I_InitNetwork( void );
|
||||||
void I_NetCmd (void);
|
void I_NetCmd( void );
|
||||||
|
|
||||||
// DHM - Nerve
|
// DHM - Nerve
|
||||||
void I_ShutdownNetwork();
|
void I_ShutdownNetwork();
|
||||||
|
|
|
@ -48,33 +48,36 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
#include "doomlib.h"
|
#include "doomlib.h"
|
||||||
|
|
||||||
void NetSend (void);
|
void NetSend( void );
|
||||||
qboolean NetListen (void);
|
qboolean NetListen( void );
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
bool IsValidSocket( int socketDescriptor );
|
{
|
||||||
int GetLastSocketError();
|
bool IsValidSocket( int socketDescriptor );
|
||||||
|
int GetLastSocketError();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================
|
========================
|
||||||
Returns true if the socket is valid. I made this function to help abstract the differences
|
Returns true if the socket is valid. I made this function to help abstract the differences
|
||||||
between WinSock (used on Xbox) and BSD sockets, which the PS3 follows more closely.
|
between WinSock (used on Xbox) and BSD sockets, which the PS3 follows more closely.
|
||||||
========================
|
========================
|
||||||
*/
|
*/
|
||||||
bool IsValidSocket( int socketDescriptor ) {
|
bool IsValidSocket( int socketDescriptor )
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
========================
|
========================
|
||||||
Returns the last error reported by the platform's socket library.
|
Returns the last error reported by the platform's socket library.
|
||||||
========================
|
========================
|
||||||
*/
|
*/
|
||||||
int GetLastSocketError() {
|
int GetLastSocketError()
|
||||||
return 0;
|
{
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -83,19 +86,20 @@ namespace {
|
||||||
int DOOMPORT = 1002; // DHM - Nerve :: On original XBox, ports 1000 - 1255 saved you a byte on every packet. 360 too?
|
int DOOMPORT = 1002; // DHM - Nerve :: On original XBox, ports 1000 - 1255 saved you a byte on every packet. 360 too?
|
||||||
|
|
||||||
|
|
||||||
unsigned long GetServerIP() {
|
unsigned long GetServerIP()
|
||||||
|
{
|
||||||
//return ::g->sendaddress[::g->doomcom.consoleplayer].sin_addr.s_addr;
|
//return ::g->sendaddress[::g->doomcom.consoleplayer].sin_addr.s_addr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void (*netget) (void);
|
void ( *netget )( void );
|
||||||
void (*netsend) (void);
|
void ( *netsend )( void );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// UDPsocket
|
// UDPsocket
|
||||||
//
|
//
|
||||||
int UDPsocket (void)
|
int UDPsocket( void )
|
||||||
{
|
{
|
||||||
//int s;
|
//int s;
|
||||||
|
|
||||||
|
@ -122,7 +126,7 @@ void BindToLocalPort( int s, int port )
|
||||||
//
|
//
|
||||||
// PacketSend
|
// PacketSend
|
||||||
//
|
//
|
||||||
void PacketSend (void)
|
void PacketSend( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -131,12 +135,12 @@ void PacketSend (void)
|
||||||
//
|
//
|
||||||
// PacketGet
|
// PacketGet
|
||||||
//
|
//
|
||||||
void PacketGet (void)
|
void PacketGet( void )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int I_TrySetupNetwork(void)
|
static int I_TrySetupNetwork( void )
|
||||||
{
|
{
|
||||||
// DHM - Moved to Session
|
// DHM - Moved to Session
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -145,7 +149,7 @@ static int I_TrySetupNetwork(void)
|
||||||
//
|
//
|
||||||
// I_InitNetwork
|
// I_InitNetwork
|
||||||
//
|
//
|
||||||
void I_InitNetwork (void)
|
void I_InitNetwork( void )
|
||||||
{
|
{
|
||||||
//qboolean trueval = true;
|
//qboolean trueval = true;
|
||||||
int i;
|
int i;
|
||||||
|
@ -153,37 +157,47 @@ void I_InitNetwork (void)
|
||||||
//int a = 0;
|
//int a = 0;
|
||||||
// struct hostent* hostentry; // host information entry
|
// struct hostent* hostentry; // host information entry
|
||||||
|
|
||||||
memset (&::g->doomcom, 0, sizeof(::g->doomcom) );
|
memset( &::g->doomcom, 0, sizeof( ::g->doomcom ) );
|
||||||
|
|
||||||
// set up for network
|
// set up for network
|
||||||
i = M_CheckParm ("-dup");
|
i = M_CheckParm( "-dup" );
|
||||||
if (i && i< ::g->myargc-1)
|
if( i && i < ::g->myargc - 1 )
|
||||||
{
|
{
|
||||||
::g->doomcom.ticdup = ::g->myargv[i+1][0]-'0';
|
::g->doomcom.ticdup = ::g->myargv[i + 1][0] - '0';
|
||||||
if (::g->doomcom.ticdup < 1)
|
if( ::g->doomcom.ticdup < 1 )
|
||||||
|
{
|
||||||
::g->doomcom.ticdup = 1;
|
::g->doomcom.ticdup = 1;
|
||||||
if (::g->doomcom.ticdup > 9)
|
}
|
||||||
|
if( ::g->doomcom.ticdup > 9 )
|
||||||
|
{
|
||||||
::g->doomcom.ticdup = 9;
|
::g->doomcom.ticdup = 9;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
::g->doomcom.ticdup = 1;
|
|
||||||
|
|
||||||
if (M_CheckParm ("-extratic"))
|
|
||||||
::g->doomcom.extratics = 1;
|
|
||||||
else
|
|
||||||
::g->doomcom.extratics = 0;
|
|
||||||
|
|
||||||
p = M_CheckParm ("-port");
|
|
||||||
if (p && p < ::g->myargc-1)
|
|
||||||
{
|
{
|
||||||
DOOMPORT = atoi (::g->myargv[p+1]);
|
::g->doomcom.ticdup = 1;
|
||||||
I_Printf ("using alternate port %i\n",DOOMPORT);
|
}
|
||||||
|
|
||||||
|
if( M_CheckParm( "-extratic" ) )
|
||||||
|
{
|
||||||
|
::g->doomcom.extratics = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
::g->doomcom.extratics = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = M_CheckParm( "-port" );
|
||||||
|
if( p && p < ::g->myargc - 1 )
|
||||||
|
{
|
||||||
|
DOOMPORT = atoi( ::g->myargv[p + 1] );
|
||||||
|
I_Printf( "using alternate port %i\n", DOOMPORT );
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse network game options,
|
// parse network game options,
|
||||||
// -net <::g->consoleplayer> <host> <host> ...
|
// -net <::g->consoleplayer> <host> <host> ...
|
||||||
i = M_CheckParm ("-net");
|
i = M_CheckParm( "-net" );
|
||||||
if (!i || !I_TrySetupNetwork())
|
if( !i || !I_TrySetupNetwork() )
|
||||||
{
|
{
|
||||||
// single player game
|
// single player game
|
||||||
::g->netgame = false;
|
::g->netgame = false;
|
||||||
|
@ -207,30 +221,34 @@ void I_InitNetwork (void)
|
||||||
// skip the console number
|
// skip the console number
|
||||||
++i;
|
++i;
|
||||||
::g->doomcom.numnodes = 0;
|
::g->doomcom.numnodes = 0;
|
||||||
for (; i < ::g->myargc; ++i)
|
for( ; i < ::g->myargc; ++i )
|
||||||
{
|
{
|
||||||
::g->sendaddress[::g->doomcom.numnodes].sin_family = AF_INET;
|
::g->sendaddress[::g->doomcom.numnodes].sin_family = AF_INET;
|
||||||
::g->sendaddress[::g->doomcom.numnodes].sin_port = htons(DOOMPORT);
|
::g->sendaddress[::g->doomcom.numnodes].sin_port = htons( DOOMPORT );
|
||||||
|
|
||||||
// Pull out the port number.
|
// Pull out the port number.
|
||||||
const std::string ipAddressWithPort( ::g->myargv[i] );
|
const std::string ipAddressWithPort( ::g->myargv[i] );
|
||||||
const std::size_t colonPosition = ipAddressWithPort.find_last_of(':');
|
const std::size_t colonPosition = ipAddressWithPort.find_last_of( ':' );
|
||||||
std::string ipOnly;
|
std::string ipOnly;
|
||||||
|
|
||||||
if( colonPosition != std::string::npos && colonPosition + 1 < ipAddressWithPort.size() ) {
|
if( colonPosition != std::string::npos && colonPosition + 1 < ipAddressWithPort.size() )
|
||||||
|
{
|
||||||
const std::string portOnly( ipAddressWithPort.substr( colonPosition + 1 ) );
|
const std::string portOnly( ipAddressWithPort.substr( colonPosition + 1 ) );
|
||||||
|
|
||||||
::g->sendaddress[::g->doomcom.numnodes].sin_port = htons( atoi( portOnly.c_str() ) );
|
::g->sendaddress[::g->doomcom.numnodes].sin_port = htons( atoi( portOnly.c_str() ) );
|
||||||
|
|
||||||
ipOnly = ipAddressWithPort.substr( 0, colonPosition );
|
ipOnly = ipAddressWithPort.substr( 0, colonPosition );
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Assume the address doesn't include a port.
|
// Assume the address doesn't include a port.
|
||||||
ipOnly = ipAddressWithPort;
|
ipOnly = ipAddressWithPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
in_addr_t ipAddress = inet_addr( ipOnly.c_str() );
|
in_addr_t ipAddress = inet_addr( ipOnly.c_str() );
|
||||||
|
|
||||||
if ( ipAddress == INADDR_NONE ) {
|
if( ipAddress == INADDR_NONE )
|
||||||
|
{
|
||||||
I_Error( "Invalid IP Address: %s\n", ipOnly.c_str() );
|
I_Error( "Invalid IP Address: %s\n", ipOnly.c_str() );
|
||||||
session->QuitMatch();
|
session->QuitMatch();
|
||||||
common->AddDialog( GDM_OPPONENT_CONNECTION_LOST, DIALOG_ACCEPT, NULL, NULL, false );
|
common->AddDialog( GDM_OPPONENT_CONNECTION_LOST, DIALOG_ACCEPT, NULL, NULL, false );
|
||||||
|
@ -243,16 +261,17 @@ void I_InitNetwork (void)
|
||||||
::g->doomcom.numplayers = ::g->doomcom.numnodes;
|
::g->doomcom.numplayers = ::g->doomcom.numnodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( globalNetworking ) {
|
if( globalNetworking )
|
||||||
|
{
|
||||||
// Setup sockets
|
// Setup sockets
|
||||||
::g->insocket = UDPsocket ();
|
::g->insocket = UDPsocket();
|
||||||
BindToLocalPort (::g->insocket,htons(DOOMPORT));
|
BindToLocalPort( ::g->insocket, htons( DOOMPORT ) );
|
||||||
|
|
||||||
// PS3 call to enable non-blocking mode
|
// PS3 call to enable non-blocking mode
|
||||||
int nonblocking = 1; // Non-zero is nonblocking mode.
|
int nonblocking = 1; // Non-zero is nonblocking mode.
|
||||||
setsockopt( ::g->insocket, SOL_SOCKET, SO_NBIO, &nonblocking, sizeof(nonblocking));
|
setsockopt( ::g->insocket, SOL_SOCKET, SO_NBIO, &nonblocking, sizeof( nonblocking ) );
|
||||||
|
|
||||||
::g->sendsocket = UDPsocket ();
|
::g->sendsocket = UDPsocket();
|
||||||
|
|
||||||
I_Printf( "[+] Setting up sockets for player %d\n", DoomLib::GetPlayer() );
|
I_Printf( "[+] Setting up sockets for player %d\n", DoomLib::GetPlayer() );
|
||||||
}
|
}
|
||||||
|
@ -260,11 +279,12 @@ void I_InitNetwork (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DHM - Nerve
|
// DHM - Nerve
|
||||||
void I_ShutdownNetwork() {
|
void I_ShutdownNetwork()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_NetCmd (void)
|
void I_NetCmd( void )
|
||||||
{
|
{
|
||||||
//if (::g->doomcom.command == CMD_SEND)
|
//if (::g->doomcom.command == CMD_SEND)
|
||||||
//{
|
//{
|
||||||
|
|
|
@ -33,9 +33,9 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
// UNIX hack, to be removed.
|
// UNIX hack, to be removed.
|
||||||
#ifdef SNDSERV
|
#ifdef SNDSERV
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
extern FILE* sndserver;
|
extern FILE* sndserver;
|
||||||
extern char* sndserver_filename;
|
extern char* sndserver_filename;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
|
@ -48,11 +48,11 @@ void I_InitSound();
|
||||||
void I_InitSoundHardware( int numOutputChannels_, int channelMask );
|
void I_InitSoundHardware( int numOutputChannels_, int channelMask );
|
||||||
|
|
||||||
// ... update sound buffer and audio device at runtime...
|
// ... update sound buffer and audio device at runtime...
|
||||||
void I_UpdateSound(void);
|
void I_UpdateSound( void );
|
||||||
void I_SubmitSound(void);
|
void I_SubmitSound( void );
|
||||||
|
|
||||||
// ... shut down and relase at program termination.
|
// ... shut down and relase at program termination.
|
||||||
void I_ShutdownSound(void);
|
void I_ShutdownSound( void );
|
||||||
void I_ShutdownSoundHardware();
|
void I_ShutdownSoundHardware();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -63,20 +63,20 @@ void I_ShutdownSoundHardware();
|
||||||
void I_SetChannels();
|
void I_SetChannels();
|
||||||
|
|
||||||
// Get raw data lump index for sound descriptor.
|
// Get raw data lump index for sound descriptor.
|
||||||
int I_GetSfxLumpNum (sfxinfo_t* sfxinfo );
|
int I_GetSfxLumpNum( sfxinfo_t* sfxinfo );
|
||||||
|
|
||||||
|
|
||||||
// Starts a sound in a particular sound channel.
|
// Starts a sound in a particular sound channel.
|
||||||
int I_StartSound( int id, mobj_t *origin, mobj_t *listener_origin, int vol, int pitch, int priority );
|
int I_StartSound( int id, mobj_t* origin, mobj_t* listener_origin, int vol, int pitch, int priority );
|
||||||
|
|
||||||
|
|
||||||
// Stops a sound channel.
|
// Stops a sound channel.
|
||||||
void I_StopSound(int handle, int player = -1);
|
void I_StopSound( int handle, int player = -1 );
|
||||||
|
|
||||||
// Called by S_*() functions
|
// Called by S_*() functions
|
||||||
// to see if a channel is still playing.
|
// to see if a channel is still playing.
|
||||||
// Returns 0 if no longer playing, 1 if playing.
|
// Returns 0 if no longer playing, 1 if playing.
|
||||||
int I_SoundIsPlaying(int handle);
|
int I_SoundIsPlaying( int handle );
|
||||||
|
|
||||||
// Updates the volume, separation,
|
// Updates the volume, separation,
|
||||||
// and pitch of a sound channel.
|
// and pitch of a sound channel.
|
||||||
|
@ -86,28 +86,28 @@ void I_SetSfxVolume( int );
|
||||||
//
|
//
|
||||||
// MUSIC I/O
|
// MUSIC I/O
|
||||||
//
|
//
|
||||||
void I_InitMusic(void);
|
void I_InitMusic( void );
|
||||||
void I_ShutdownMusic(void);
|
void I_ShutdownMusic( void );
|
||||||
// Volume.
|
// Volume.
|
||||||
void I_SetMusicVolume(int volume);
|
void I_SetMusicVolume( int volume );
|
||||||
// PAUSE game handling.
|
// PAUSE game handling.
|
||||||
void I_PauseSong(int handle);
|
void I_PauseSong( int handle );
|
||||||
void I_ResumeSong(int handle);
|
void I_ResumeSong( int handle );
|
||||||
// Registers a song handle to song data.
|
// Registers a song handle to song data.
|
||||||
int I_RegisterSong(void *data, int length);
|
int I_RegisterSong( void* data, int length );
|
||||||
// Called by anything that wishes to start music.
|
// Called by anything that wishes to start music.
|
||||||
// plays a song, and when the song is done,
|
// plays a song, and when the song is done,
|
||||||
// starts playing it again in an endless loop.
|
// starts playing it again in an endless loop.
|
||||||
// Horrible thing to do, considering.
|
// Horrible thing to do, considering.
|
||||||
void I_PlaySong( const char *songname, int looping );
|
void I_PlaySong( const char* songname, int looping );
|
||||||
// Stops a song over 3 seconds.
|
// Stops a song over 3 seconds.
|
||||||
void I_StopSong(int handle);
|
void I_StopSong( int handle );
|
||||||
// See above (register), then think backwards
|
// See above (register), then think backwards
|
||||||
void I_UnRegisterSong(int handle);
|
void I_UnRegisterSong( int handle );
|
||||||
// Update Music (XMP), check for notifications
|
// Update Music (XMP), check for notifications
|
||||||
void I_UpdateMusic(void);
|
void I_UpdateMusic( void );
|
||||||
|
|
||||||
int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len);
|
int Mus2Midi( unsigned char* bytes, unsigned char* out, int* len );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -79,36 +79,40 @@ int totalBufferSize;
|
||||||
bool waitingForMusic;
|
bool waitingForMusic;
|
||||||
bool musicReady;
|
bool musicReady;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
float z;
|
float z;
|
||||||
} vec3_t;
|
} vec3_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
vec3_t OrientTop;
|
vec3_t OrientTop;
|
||||||
vec3_t OrientFront;
|
vec3_t OrientFront;
|
||||||
vec3_t Position;
|
vec3_t Position;
|
||||||
} doomListener_t;
|
} doomListener_t;
|
||||||
|
|
||||||
typedef struct tagActiveSound_t {
|
typedef struct tagActiveSound_t
|
||||||
|
{
|
||||||
ALuint alSourceVoice;
|
ALuint alSourceVoice;
|
||||||
int id;
|
int id;
|
||||||
int valid;
|
int valid;
|
||||||
int start;
|
int start;
|
||||||
int player;
|
int player;
|
||||||
bool localSound;
|
bool localSound;
|
||||||
mobj_t *originator;
|
mobj_t* originator;
|
||||||
} activeSound_t;
|
} activeSound_t;
|
||||||
|
|
||||||
// cheap little struct to hold a sound
|
// cheap little struct to hold a sound
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
int vol;
|
int vol;
|
||||||
int player;
|
int player;
|
||||||
int pitch;
|
int pitch;
|
||||||
int priority;
|
int priority;
|
||||||
mobj_t *originator;
|
mobj_t* originator;
|
||||||
mobj_t *listener;
|
mobj_t* listener;
|
||||||
} soundEvent_t;
|
} soundEvent_t;
|
||||||
|
|
||||||
// array of all the possible sounds
|
// array of all the possible sounds
|
||||||
|
@ -149,7 +153,7 @@ getsfx
|
||||||
// This function loads the sound data from the WAD lump,
|
// This function loads the sound data from the WAD lump,
|
||||||
// for single sound.
|
// for single sound.
|
||||||
//
|
//
|
||||||
void* getsfx ( const char* sfxname, int* len )
|
void* getsfx( const char* sfxname, int* len )
|
||||||
{
|
{
|
||||||
unsigned char* sfx;
|
unsigned char* sfx;
|
||||||
unsigned char* sfxmem;
|
unsigned char* sfxmem;
|
||||||
|
@ -170,25 +174,30 @@ void* getsfx ( const char* sfxname, int* len )
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// If sound requested is not found in current WAD, use pistol as default
|
// If sound requested is not found in current WAD, use pistol as default
|
||||||
if ( W_CheckNumForName( name ) == -1 )
|
if( W_CheckNumForName( name ) == -1 )
|
||||||
|
{
|
||||||
sfxlump = W_GetNumForName( "dspistol" );
|
sfxlump = W_GetNumForName( "dspistol" );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
sfxlump = W_GetNumForName( name );
|
sfxlump = W_GetNumForName( name );
|
||||||
|
}
|
||||||
|
|
||||||
// Sound lump headers are 8 bytes.
|
// Sound lump headers are 8 bytes.
|
||||||
const int SOUND_LUMP_HEADER_SIZE_IN_BYTES = 8;
|
const int SOUND_LUMP_HEADER_SIZE_IN_BYTES = 8;
|
||||||
|
|
||||||
size = W_LumpLength( sfxlump ) - SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
size = W_LumpLength( sfxlump ) - SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
||||||
|
|
||||||
sfx = (unsigned char*)W_CacheLumpNum( sfxlump, PU_CACHE_SHARED );
|
sfx = ( unsigned char* )W_CacheLumpNum( sfxlump, PU_CACHE_SHARED );
|
||||||
const unsigned char * sfxSampleStart = sfx + SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
const unsigned char* sfxSampleStart = sfx + SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
||||||
|
|
||||||
// Allocate from zone memory.
|
// Allocate from zone memory.
|
||||||
//sfxmem = (float*)DoomLib::Z_Malloc( size*(sizeof(float)), PU_SOUND_SHARED, 0 );
|
//sfxmem = (float*)DoomLib::Z_Malloc( size*(sizeof(float)), PU_SOUND_SHARED, 0 );
|
||||||
sfxmem = (unsigned char*)malloc( size * sizeof(unsigned char) );
|
sfxmem = ( unsigned char* )malloc( size * sizeof( unsigned char ) );
|
||||||
|
|
||||||
// Now copy, and convert to Xbox360 native float samples, do initial volume ramp, and scale
|
// Now copy, and convert to Xbox360 native float samples, do initial volume ramp, and scale
|
||||||
for ( int i = 0; i < size; i++ ) {
|
for( int i = 0; i < size; i++ )
|
||||||
|
{
|
||||||
sfxmem[i] = sfxSampleStart[i];// * scale;
|
sfxmem[i] = sfxSampleStart[i];// * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +208,7 @@ void* getsfx ( const char* sfxname, int* len )
|
||||||
*len = size;
|
*len = size;
|
||||||
|
|
||||||
// Return allocated padded data.
|
// Return allocated padded data.
|
||||||
return (void *) (sfxmem);
|
return ( void* )( sfxmem );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -219,7 +228,7 @@ I_SetSfxVolume
|
||||||
*/
|
*/
|
||||||
void I_SetSfxVolume( int volume )
|
void I_SetSfxVolume( int volume )
|
||||||
{
|
{
|
||||||
x_SoundVolume = ((float)volume / 15.f) * GLOBAL_VOLUME_MULTIPLIER;
|
x_SoundVolume = ( ( float )volume / 15.f ) * GLOBAL_VOLUME_MULTIPLIER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -253,9 +262,10 @@ I_StartSound2
|
||||||
// priority, it is ignored.
|
// priority, it is ignored.
|
||||||
// Pitching (that is, increased speed of playback) is set
|
// Pitching (that is, increased speed of playback) is set
|
||||||
//
|
//
|
||||||
int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin, int pitch, int priority )
|
int I_StartSound2( int id, int player, mobj_t* origin, mobj_t* listener_origin, int pitch, int priority )
|
||||||
{
|
{
|
||||||
if ( !soundHardwareInitialized || id == 0 ) {
|
if( !soundHardwareInitialized || id == 0 )
|
||||||
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,13 +274,15 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
||||||
int oldest = 0, oldestnum = -1;
|
int oldest = 0, oldestnum = -1;
|
||||||
|
|
||||||
// these id's should not overlap
|
// these id's should not overlap
|
||||||
if ( id == sfx_sawup || id == sfx_sawidl || id == sfx_sawful || id == sfx_sawhit || id == sfx_stnmov ) {
|
if( id == sfx_sawup || id == sfx_sawidl || id == sfx_sawful || id == sfx_sawhit || id == sfx_stnmov )
|
||||||
|
{
|
||||||
// Loop all channels, check.
|
// Loop all channels, check.
|
||||||
for ( i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
for( i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||||
{
|
{
|
||||||
sound = &activeSounds[i];
|
sound = &activeSounds[i];
|
||||||
|
|
||||||
if ( sound->valid && ( sound->id == id && sound->player == player ) ) {
|
if( sound->valid && ( sound->id == id && sound->player == player ) )
|
||||||
|
{
|
||||||
I_StopSound( sound->id, player );
|
I_StopSound( sound->id, player );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -278,26 +290,32 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
||||||
}
|
}
|
||||||
|
|
||||||
// find a valid channel, or one that has finished playing
|
// find a valid channel, or one that has finished playing
|
||||||
for ( i = 0; i < NUM_SOUNDBUFFERS; i++ ) {
|
for( i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||||
|
{
|
||||||
sound = &activeSounds[i];
|
sound = &activeSounds[i];
|
||||||
|
|
||||||
if ( !sound->valid )
|
if( !sound->valid )
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !oldest || oldest > sound->start ) {
|
if( !oldest || oldest > sound->start )
|
||||||
|
{
|
||||||
oldestnum = i;
|
oldestnum = i;
|
||||||
oldest = sound->start;
|
oldest = sound->start;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALint sourceState;
|
ALint sourceState;
|
||||||
alGetSourcei( sound->alSourceVoice, AL_SOURCE_STATE, &sourceState );
|
alGetSourcei( sound->alSourceVoice, AL_SOURCE_STATE, &sourceState );
|
||||||
if ( sourceState == AL_STOPPED ) {
|
if( sourceState == AL_STOPPED )
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// none found, so use the oldest one
|
// none found, so use the oldest one
|
||||||
if ( i == NUM_SOUNDBUFFERS ) {
|
if( i == NUM_SOUNDBUFFERS )
|
||||||
|
{
|
||||||
i = oldestnum;
|
i = oldestnum;
|
||||||
sound = &activeSounds[i];
|
sound = &activeSounds[i];
|
||||||
}
|
}
|
||||||
|
@ -305,7 +323,8 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
||||||
alSourceStop( sound->alSourceVoice );
|
alSourceStop( sound->alSourceVoice );
|
||||||
|
|
||||||
// Attach the source voice to the correct buffer
|
// Attach the source voice to the correct buffer
|
||||||
if ( sound->id != id ) {
|
if( sound->id != id )
|
||||||
|
{
|
||||||
alSourcei( sound->alSourceVoice, AL_BUFFER, 0 );
|
alSourcei( sound->alSourceVoice, AL_BUFFER, 0 );
|
||||||
alSourcei( sound->alSourceVoice, AL_BUFFER, alBuffers[id] );
|
alSourcei( sound->alSourceVoice, AL_BUFFER, alBuffers[id] );
|
||||||
}
|
}
|
||||||
|
@ -314,24 +333,31 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
||||||
alSourcef( sound->alSourceVoice, AL_GAIN, x_SoundVolume );
|
alSourcef( sound->alSourceVoice, AL_GAIN, x_SoundVolume );
|
||||||
|
|
||||||
// Set the source voice pitch
|
// Set the source voice pitch
|
||||||
alSourcef( sound->alSourceVoice, AL_PITCH, 1 + ((float)pitch-128.f)/95.f );
|
alSourcef( sound->alSourceVoice, AL_PITCH, 1 + ( ( float )pitch - 128.f ) / 95.f );
|
||||||
|
|
||||||
// Set the source voice position
|
// Set the source voice position
|
||||||
ALfloat x = 0.f;
|
ALfloat x = 0.f;
|
||||||
ALfloat y = 0.f;
|
ALfloat y = 0.f;
|
||||||
ALfloat z = 0.f;
|
ALfloat z = 0.f;
|
||||||
if ( origin ) {
|
if( origin )
|
||||||
if ( origin == listener_origin ) {
|
{
|
||||||
|
if( origin == listener_origin )
|
||||||
|
{
|
||||||
sound->localSound = true;
|
sound->localSound = true;
|
||||||
} else {
|
|
||||||
sound->localSound = false;
|
|
||||||
x = (ALfloat)(origin->x >> FRACBITS);
|
|
||||||
z = (ALfloat)(origin->y >> FRACBITS);
|
|
||||||
}
|
}
|
||||||
} else {
|
else
|
||||||
|
{
|
||||||
|
sound->localSound = false;
|
||||||
|
x = ( ALfloat )( origin->x >> FRACBITS );
|
||||||
|
z = ( ALfloat )( origin->y >> FRACBITS );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sound->localSound = true;
|
sound->localSound = true;
|
||||||
}
|
}
|
||||||
if ( sound->localSound ) {
|
if( sound->localSound )
|
||||||
|
{
|
||||||
x = doom_Listener.Position.x;
|
x = doom_Listener.Position.x;
|
||||||
z = doom_Listener.Position.z;
|
z = doom_Listener.Position.z;
|
||||||
}
|
}
|
||||||
|
@ -356,10 +382,12 @@ I_ProcessSoundEvents
|
||||||
*/
|
*/
|
||||||
void I_ProcessSoundEvents( void )
|
void I_ProcessSoundEvents( void )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < 128; i++ ) {
|
for( int i = 0; i < 128; i++ )
|
||||||
if( soundEvents[i].pitch ) {
|
{
|
||||||
|
if( soundEvents[i].pitch )
|
||||||
|
{
|
||||||
I_StartSound2( i, soundEvents[i].player, soundEvents[i].originator, soundEvents[i].listener,
|
I_StartSound2( i, soundEvents[i].player, soundEvents[i].originator, soundEvents[i].listener,
|
||||||
soundEvents[i].pitch, soundEvents[i].priority );
|
soundEvents[i].pitch, soundEvents[i].priority );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memset( soundEvents, 0, sizeof( soundEvents ) );
|
memset( soundEvents, 0, sizeof( soundEvents ) );
|
||||||
|
@ -370,19 +398,24 @@ void I_ProcessSoundEvents( void )
|
||||||
I_StartSound
|
I_StartSound
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
int I_StartSound ( int id, mobj_t *origin, mobj_t *listener_origin, int vol, int pitch, int priority )
|
int I_StartSound( int id, mobj_t* origin, mobj_t* listener_origin, int vol, int pitch, int priority )
|
||||||
{
|
{
|
||||||
// only allow player 0s sounds in intermission and finale screens
|
// only allow player 0s sounds in intermission and finale screens
|
||||||
if( ::g->gamestate != GS_LEVEL && DoomLib::GetPlayer() != 0 ) {
|
if( ::g->gamestate != GS_LEVEL && DoomLib::GetPlayer() != 0 )
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're only one player or we're trying to play the chainsaw sound, do it normal
|
// if we're only one player or we're trying to play the chainsaw sound, do it normal
|
||||||
// otherwise only allow one sound of each type per frame
|
// otherwise only allow one sound of each type per frame
|
||||||
if( PLAYERCOUNT == 1 || id == sfx_sawup || id == sfx_sawidl || id == sfx_sawful || id == sfx_sawhit ) {
|
if( PLAYERCOUNT == 1 || id == sfx_sawup || id == sfx_sawidl || id == sfx_sawful || id == sfx_sawhit )
|
||||||
|
{
|
||||||
return I_StartSound2( id, ::g->consoleplayer, origin, listener_origin, pitch, priority );
|
return I_StartSound2( id, ::g->consoleplayer, origin, listener_origin, pitch, priority );
|
||||||
} else {
|
}
|
||||||
if( soundEvents[ id ].vol < vol ) {
|
else
|
||||||
|
{
|
||||||
|
if( soundEvents[ id ].vol < vol )
|
||||||
|
{
|
||||||
soundEvents[ id ].player = DoomLib::GetPlayer();
|
soundEvents[ id ].player = DoomLib::GetPlayer();
|
||||||
soundEvents[ id ].pitch = pitch;
|
soundEvents[ id ].pitch = pitch;
|
||||||
soundEvents[ id ].priority = priority;
|
soundEvents[ id ].priority = priority;
|
||||||
|
@ -399,7 +432,7 @@ int I_StartSound ( int id, mobj_t *origin, mobj_t *listener_origin, int vol, int
|
||||||
I_StopSound
|
I_StopSound
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_StopSound ( int handle, int player )
|
void I_StopSound( int handle, int player )
|
||||||
{
|
{
|
||||||
// You need the handle returned by StartSound.
|
// You need the handle returned by StartSound.
|
||||||
// Would be looping all channels,
|
// Would be looping all channels,
|
||||||
|
@ -408,15 +441,20 @@ void I_StopSound ( int handle, int player )
|
||||||
int i;
|
int i;
|
||||||
activeSound_t* sound = 0;
|
activeSound_t* sound = 0;
|
||||||
|
|
||||||
for ( i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
for( i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||||
|
{
|
||||||
sound = &activeSounds[i];
|
sound = &activeSounds[i];
|
||||||
if ( !sound->valid || sound->id != handle || (player >= 0 && sound->player != player) )
|
if( !sound->valid || sound->id != handle || ( player >= 0 && sound->player != player ) )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( i == NUM_SOUNDBUFFERS )
|
if( i == NUM_SOUNDBUFFERS )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Stop the sound
|
// Stop the sound
|
||||||
alSourceStop( sound->alSourceVoice );
|
alSourceStop( sound->alSourceVoice );
|
||||||
|
@ -432,21 +470,26 @@ I_SoundIsPlaying
|
||||||
*/
|
*/
|
||||||
int I_SoundIsPlaying( int handle )
|
int I_SoundIsPlaying( int handle )
|
||||||
{
|
{
|
||||||
if ( !soundHardwareInitialized ) {
|
if( !soundHardwareInitialized )
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
activeSound_t* sound;
|
activeSound_t* sound;
|
||||||
|
|
||||||
for ( i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
for( i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||||
|
{
|
||||||
sound = &activeSounds[i];
|
sound = &activeSounds[i];
|
||||||
if ( !sound->valid || sound->id != handle )
|
if( !sound->valid || sound->id != handle )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ALint sourceState;
|
ALint sourceState;
|
||||||
alGetSourcei( sound->alSourceVoice, AL_SOURCE_STATE, &sourceState );
|
alGetSourcei( sound->alSourceVoice, AL_SOURCE_STATE, &sourceState );
|
||||||
if ( sourceState == AL_PLAYING ) {
|
if( sourceState == AL_PLAYING )
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -463,13 +506,15 @@ I_UpdateSound
|
||||||
// channels and update sound positions.
|
// channels and update sound positions.
|
||||||
void I_UpdateSound( void )
|
void I_UpdateSound( void )
|
||||||
{
|
{
|
||||||
if ( !soundHardwareInitialized ) {
|
if( !soundHardwareInitialized )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update listener orientation and position
|
// Update listener orientation and position
|
||||||
mobj_t *playerObj = ::g->players[0].mo;
|
mobj_t* playerObj = ::g->players[0].mo;
|
||||||
if ( playerObj ) {
|
if( playerObj )
|
||||||
|
{
|
||||||
angle_t pAngle = playerObj->angle;
|
angle_t pAngle = playerObj->angle;
|
||||||
fixed_t fx, fz;
|
fixed_t fx, fz;
|
||||||
|
|
||||||
|
@ -478,13 +523,15 @@ void I_UpdateSound( void )
|
||||||
fx = finecosine[pAngle];
|
fx = finecosine[pAngle];
|
||||||
fz = finesine[pAngle];
|
fz = finesine[pAngle];
|
||||||
|
|
||||||
doom_Listener.OrientFront.x = (float)(fx) / 65535.f;
|
doom_Listener.OrientFront.x = ( float )( fx ) / 65535.f;
|
||||||
doom_Listener.OrientFront.y = 0.f;
|
doom_Listener.OrientFront.y = 0.f;
|
||||||
doom_Listener.OrientFront.z = (float)(fz) / 65535.f;
|
doom_Listener.OrientFront.z = ( float )( fz ) / 65535.f;
|
||||||
doom_Listener.Position.x = (float)(playerObj->x >> FRACBITS);
|
doom_Listener.Position.x = ( float )( playerObj->x >> FRACBITS );
|
||||||
doom_Listener.Position.y = 0.f;
|
doom_Listener.Position.y = 0.f;
|
||||||
doom_Listener.Position.z = (float)(playerObj->y >> FRACBITS);
|
doom_Listener.Position.z = ( float )( playerObj->y >> FRACBITS );
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
doom_Listener.OrientFront.x = 0.f;
|
doom_Listener.OrientFront.x = 0.f;
|
||||||
doom_Listener.OrientFront.y = 0.f;
|
doom_Listener.OrientFront.y = 0.f;
|
||||||
doom_Listener.OrientFront.z = 1.f;
|
doom_Listener.OrientFront.z = 1.f;
|
||||||
|
@ -495,31 +542,38 @@ void I_UpdateSound( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
ALfloat listenerOrientation[] = { doom_Listener.OrientFront.x, doom_Listener.OrientFront.y,
|
ALfloat listenerOrientation[] = { doom_Listener.OrientFront.x, doom_Listener.OrientFront.y,
|
||||||
doom_Listener.OrientFront.z, doom_Listener.OrientTop.x, doom_Listener.OrientTop.y,
|
doom_Listener.OrientFront.z, doom_Listener.OrientTop.x, doom_Listener.OrientTop.y,
|
||||||
doom_Listener.OrientTop.z };
|
doom_Listener.OrientTop.z
|
||||||
|
};
|
||||||
alListenerfv( AL_ORIENTATION, listenerOrientation );
|
alListenerfv( AL_ORIENTATION, listenerOrientation );
|
||||||
alListener3f( AL_POSITION, doom_Listener.Position.x, doom_Listener.Position.y, doom_Listener.Position.z );
|
alListener3f( AL_POSITION, doom_Listener.Position.x, doom_Listener.Position.y, doom_Listener.Position.z );
|
||||||
|
|
||||||
// Update playing source voice positions
|
// Update playing source voice positions
|
||||||
int i;
|
int i;
|
||||||
activeSound_t* sound;
|
activeSound_t* sound;
|
||||||
for ( i=0; i < NUM_SOUNDBUFFERS; i++ ) {
|
for( i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||||
|
{
|
||||||
sound = &activeSounds[i];
|
sound = &activeSounds[i];
|
||||||
|
|
||||||
if ( !sound->valid ) {
|
if( !sound->valid )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALint sourceState;
|
ALint sourceState;
|
||||||
alGetSourcei( sound->alSourceVoice, AL_SOURCE_STATE, &sourceState );
|
alGetSourcei( sound->alSourceVoice, AL_SOURCE_STATE, &sourceState );
|
||||||
if ( sourceState == AL_PLAYING ) {
|
if( sourceState == AL_PLAYING )
|
||||||
if ( sound->localSound ) {
|
{
|
||||||
|
if( sound->localSound )
|
||||||
|
{
|
||||||
alSource3f( sound->alSourceVoice, AL_POSITION, doom_Listener.Position.x,
|
alSource3f( sound->alSourceVoice, AL_POSITION, doom_Listener.Position.x,
|
||||||
doom_Listener.Position.y, doom_Listener.Position.z );
|
doom_Listener.Position.y, doom_Listener.Position.z );
|
||||||
} else {
|
}
|
||||||
ALfloat x = (ALfloat)(sound->originator->x >> FRACBITS);
|
else
|
||||||
|
{
|
||||||
|
ALfloat x = ( ALfloat )( sound->originator->x >> FRACBITS );
|
||||||
ALfloat y = 0.f;
|
ALfloat y = 0.f;
|
||||||
ALfloat z = (ALfloat)(sound->originator->y >> FRACBITS);
|
ALfloat z = ( ALfloat )( sound->originator->y >> FRACBITS );
|
||||||
|
|
||||||
alSource3f( sound->alSourceVoice, AL_POSITION, x, y, z );
|
alSource3f( sound->alSourceVoice, AL_POSITION, x, y, z );
|
||||||
}
|
}
|
||||||
|
@ -546,12 +600,15 @@ void I_ShutdownSound( void )
|
||||||
int done = 0;
|
int done = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ( S_initialized ) {
|
if( S_initialized )
|
||||||
|
{
|
||||||
// Stop all sounds
|
// Stop all sounds
|
||||||
for ( i = 0; i < NUM_SOUNDBUFFERS; i++ ) {
|
for( i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||||
activeSound_t * sound = &activeSounds[i];
|
{
|
||||||
|
activeSound_t* sound = &activeSounds[i];
|
||||||
|
|
||||||
if ( !sound ) {
|
if( !sound )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,8 +616,10 @@ void I_ShutdownSound( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free allocated sound memory
|
// Free allocated sound memory
|
||||||
for ( i = 1; i < NUMSFX; i++ ) {
|
for( i = 1; i < NUMSFX; i++ )
|
||||||
if ( S_sfx[i].data && !(S_sfx[i].link) ) {
|
{
|
||||||
|
if( S_sfx[i].data && !( S_sfx[i].link ) )
|
||||||
|
{
|
||||||
free( S_sfx[i].data );
|
free( S_sfx[i].data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -584,13 +643,15 @@ void I_InitSoundHardware( int numOutputChannels_, int channelMask )
|
||||||
::numOutputChannels = numOutputChannels_;
|
::numOutputChannels = numOutputChannels_;
|
||||||
|
|
||||||
// Initialize source voices
|
// Initialize source voices
|
||||||
for ( int i = 0; i < NUM_SOUNDBUFFERS; i++ ) {
|
for( int i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||||
|
{
|
||||||
I_InitSoundChannel( i, numOutputChannels );
|
I_InitSoundChannel( i, numOutputChannels );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create OpenAL buffers for all sounds
|
// Create OpenAL buffers for all sounds
|
||||||
for ( int i = 1; i < NUMSFX; i++ ) {
|
for( int i = 1; i < NUMSFX; i++ )
|
||||||
alGenBuffers( (ALuint)1, &alBuffers[i] );
|
{
|
||||||
|
alGenBuffers( ( ALuint )1, &alBuffers[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
I_InitMusic();
|
I_InitMusic();
|
||||||
|
@ -613,14 +674,17 @@ void I_ShutdownSoundHardware()
|
||||||
I_ShutdownMusic();
|
I_ShutdownMusic();
|
||||||
|
|
||||||
// Delete all source voices
|
// Delete all source voices
|
||||||
for ( int i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
for( int i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||||
activeSound_t * sound = &activeSounds[i];
|
{
|
||||||
|
activeSound_t* sound = &activeSounds[i];
|
||||||
|
|
||||||
if ( !sound ) {
|
if( !sound )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sound->alSourceVoice ) {
|
if( sound->alSourceVoice )
|
||||||
|
{
|
||||||
alSourceStop( sound->alSourceVoice );
|
alSourceStop( sound->alSourceVoice );
|
||||||
alSourcei( sound->alSourceVoice, AL_BUFFER, 0 );
|
alSourcei( sound->alSourceVoice, AL_BUFFER, 0 );
|
||||||
alDeleteSources( 1, &sound->alSourceVoice );
|
alDeleteSources( 1, &sound->alSourceVoice );
|
||||||
|
@ -628,7 +692,8 @@ void I_ShutdownSoundHardware()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete OpenAL buffers for all sounds
|
// Delete OpenAL buffers for all sounds
|
||||||
for ( int i = 0; i < NUMSFX; i++ ) {
|
for( int i = 0; i < NUMSFX; i++ )
|
||||||
|
{
|
||||||
alDeleteBuffers( 1, &alBuffers[i] );
|
alDeleteBuffers( 1, &alBuffers[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -640,9 +705,9 @@ I_InitSoundChannel
|
||||||
*/
|
*/
|
||||||
void I_InitSoundChannel( int channel, int numOutputChannels_ )
|
void I_InitSoundChannel( int channel, int numOutputChannels_ )
|
||||||
{
|
{
|
||||||
activeSound_t *soundchannel = &activeSounds[ channel ];
|
activeSound_t* soundchannel = &activeSounds[ channel ];
|
||||||
|
|
||||||
alGenSources( (ALuint)1, &soundchannel->alSourceVoice );
|
alGenSources( ( ALuint )1, &soundchannel->alSourceVoice );
|
||||||
|
|
||||||
alSource3f( soundchannel->alSourceVoice, AL_VELOCITY, 0.f, 0.f, 0.f );
|
alSource3f( soundchannel->alSourceVoice, AL_VELOCITY, 0.f, 0.f, 0.f );
|
||||||
alSourcef( soundchannel->alSourceVoice, AL_LOOPING, AL_FALSE );
|
alSourcef( soundchannel->alSourceVoice, AL_LOOPING, AL_FALSE );
|
||||||
|
@ -658,7 +723,8 @@ I_InitSound
|
||||||
*/
|
*/
|
||||||
void I_InitSound()
|
void I_InitSound()
|
||||||
{
|
{
|
||||||
if ( S_initialized == 0 ) {
|
if( S_initialized == 0 )
|
||||||
|
{
|
||||||
// Set up listener parameters
|
// Set up listener parameters
|
||||||
doom_Listener.OrientFront.x = 0.f;
|
doom_Listener.OrientFront.x = 0.f;
|
||||||
doom_Listener.OrientFront.y = 0.f;
|
doom_Listener.OrientFront.y = 0.f;
|
||||||
|
@ -672,18 +738,23 @@ void I_InitSound()
|
||||||
doom_Listener.Position.y = 0.f;
|
doom_Listener.Position.y = 0.f;
|
||||||
doom_Listener.Position.z = 0.f;
|
doom_Listener.Position.z = 0.f;
|
||||||
|
|
||||||
for ( int i = 1; i < NUMSFX; i++ ) {
|
for( int i = 1; i < NUMSFX; i++ )
|
||||||
|
{
|
||||||
// Alias? Example is the chaingun sound linked to pistol.
|
// Alias? Example is the chaingun sound linked to pistol.
|
||||||
if ( !S_sfx[i].link ) {
|
if( !S_sfx[i].link )
|
||||||
|
{
|
||||||
// Load data from WAD file.
|
// Load data from WAD file.
|
||||||
S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] );
|
S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] );
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Previously loaded already?
|
// Previously loaded already?
|
||||||
S_sfx[i].data = S_sfx[i].link->data;
|
S_sfx[i].data = S_sfx[i].link->data;
|
||||||
lengths[i] = lengths[ (S_sfx[i].link-S_sfx) / sizeof(sfxinfo_t) ];
|
lengths[i] = lengths[( S_sfx[i].link - S_sfx ) / sizeof( sfxinfo_t ) ];
|
||||||
}
|
}
|
||||||
if ( S_sfx[i].data ) {
|
if( S_sfx[i].data )
|
||||||
alBufferData( alBuffers[i], SFX_SAMPLETYPE, (byte*)S_sfx[i].data, lengths[i], SFX_RATE );
|
{
|
||||||
|
alBufferData( alBuffers[i], SFX_SAMPLETYPE, ( byte* )S_sfx[i].data, lengths[i], SFX_RATE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,7 +772,8 @@ void I_SubmitSound( void )
|
||||||
// Only do this for player 0, it will still handle positioning
|
// Only do this for player 0, it will still handle positioning
|
||||||
// for other players, but it can't be outside the game
|
// for other players, but it can't be outside the game
|
||||||
// frame like the soundEvents are.
|
// frame like the soundEvents are.
|
||||||
if ( DoomLib::GetPlayer() == 0 ) {
|
if( DoomLib::GetPlayer() == 0 )
|
||||||
|
{
|
||||||
// Do 3D positioning of sounds
|
// Do 3D positioning of sounds
|
||||||
I_UpdateSound();
|
I_UpdateSound();
|
||||||
|
|
||||||
|
@ -724,7 +796,7 @@ I_SetMusicVolume
|
||||||
*/
|
*/
|
||||||
void I_SetMusicVolume( int volume )
|
void I_SetMusicVolume( int volume )
|
||||||
{
|
{
|
||||||
x_MusicVolume = (float)volume / 15.f;
|
x_MusicVolume = ( float )volume / 15.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -734,7 +806,8 @@ I_InitMusic
|
||||||
*/
|
*/
|
||||||
void I_InitMusic( void )
|
void I_InitMusic( void )
|
||||||
{
|
{
|
||||||
if ( !Music_initialized ) {
|
if( !Music_initialized )
|
||||||
|
{
|
||||||
// Initialize Timidity
|
// Initialize Timidity
|
||||||
Timidity_Init( MIDI_RATE, MIDI_FORMAT, MIDI_CHANNELS, MIDI_RATE, "classicmusic/gravis.cfg" );
|
Timidity_Init( MIDI_RATE, MIDI_FORMAT, MIDI_CHANNELS, MIDI_RATE, "classicmusic/gravis.cfg" );
|
||||||
|
|
||||||
|
@ -743,12 +816,12 @@ void I_InitMusic( void )
|
||||||
waitingForMusic = false;
|
waitingForMusic = false;
|
||||||
musicReady = false;
|
musicReady = false;
|
||||||
|
|
||||||
alGenSources( (ALuint)1, &alMusicSourceVoice );
|
alGenSources( ( ALuint )1, &alMusicSourceVoice );
|
||||||
|
|
||||||
alSourcef( alMusicSourceVoice, AL_PITCH, 1.f );
|
alSourcef( alMusicSourceVoice, AL_PITCH, 1.f );
|
||||||
alSourcef( alMusicSourceVoice, AL_LOOPING, AL_TRUE );
|
alSourcef( alMusicSourceVoice, AL_LOOPING, AL_TRUE );
|
||||||
|
|
||||||
alGenBuffers( (ALuint)1, &alMusicBuffer );
|
alGenBuffers( ( ALuint )1, &alMusicBuffer );
|
||||||
|
|
||||||
Music_initialized = true;
|
Music_initialized = true;
|
||||||
}
|
}
|
||||||
|
@ -761,18 +834,22 @@ I_ShutdownMusic
|
||||||
*/
|
*/
|
||||||
void I_ShutdownMusic( void )
|
void I_ShutdownMusic( void )
|
||||||
{
|
{
|
||||||
if ( Music_initialized ) {
|
if( Music_initialized )
|
||||||
if ( alMusicSourceVoice ) {
|
{
|
||||||
|
if( alMusicSourceVoice )
|
||||||
|
{
|
||||||
I_StopSong( 0 );
|
I_StopSong( 0 );
|
||||||
alSourcei( alMusicSourceVoice, AL_BUFFER, 0 );
|
alSourcei( alMusicSourceVoice, AL_BUFFER, 0 );
|
||||||
alDeleteSources( 1, &alMusicSourceVoice );
|
alDeleteSources( 1, &alMusicSourceVoice );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( alMusicBuffer ) {
|
if( alMusicBuffer )
|
||||||
|
{
|
||||||
alDeleteBuffers( 1, &alMusicBuffer );
|
alDeleteBuffers( 1, &alMusicBuffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( musicBuffer ) {
|
if( musicBuffer )
|
||||||
|
{
|
||||||
free( musicBuffer );
|
free( musicBuffer );
|
||||||
musicBuffer = NULL;
|
musicBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
@ -787,11 +864,12 @@ void I_ShutdownMusic( void )
|
||||||
Music_initialized = false;
|
Music_initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len);
|
int Mus2Midi( unsigned char* bytes, unsigned char* out, int* len );
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
const int MaxMidiConversionSize = 1024 * 1024;
|
{
|
||||||
unsigned char midiConversionBuffer[MaxMidiConversionSize];
|
const int MaxMidiConversionSize = 1024 * 1024;
|
||||||
|
unsigned char midiConversionBuffer[MaxMidiConversionSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -799,20 +877,21 @@ namespace {
|
||||||
I_LoadSong
|
I_LoadSong
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_LoadSong( const char * songname )
|
void I_LoadSong( const char* songname )
|
||||||
{
|
{
|
||||||
idStr lumpName = "d_";
|
idStr lumpName = "d_";
|
||||||
lumpName += static_cast< const char * >( songname );
|
lumpName += static_cast< const char* >( songname );
|
||||||
|
|
||||||
unsigned char * musFile = static_cast< unsigned char * >( W_CacheLumpName( lumpName.c_str(), PU_STATIC_SHARED ) );
|
unsigned char* musFile = static_cast< unsigned char* >( W_CacheLumpName( lumpName.c_str(), PU_STATIC_SHARED ) );
|
||||||
|
|
||||||
int length = 0;
|
int length = 0;
|
||||||
Mus2Midi( musFile, midiConversionBuffer, &length );
|
Mus2Midi( musFile, midiConversionBuffer, &length );
|
||||||
|
|
||||||
doomMusic = Timidity_LoadSongMem( midiConversionBuffer, length );
|
doomMusic = Timidity_LoadSongMem( midiConversionBuffer, length );
|
||||||
|
|
||||||
if ( doomMusic ) {
|
if( doomMusic )
|
||||||
musicBuffer = (byte *)malloc( MIDI_CHANNELS * MIDI_FORMAT_BYTES * doomMusic->samples );
|
{
|
||||||
|
musicBuffer = ( byte* )malloc( MIDI_CHANNELS * MIDI_FORMAT_BYTES * doomMusic->samples );
|
||||||
totalBufferSize = doomMusic->samples * MIDI_CHANNELS * MIDI_FORMAT_BYTES;
|
totalBufferSize = doomMusic->samples * MIDI_CHANNELS * MIDI_FORMAT_BYTES;
|
||||||
Timidity_Start( doomMusic );
|
Timidity_Start( doomMusic );
|
||||||
|
|
||||||
|
@ -820,10 +899,12 @@ void I_LoadSong( const char * songname )
|
||||||
int num_bytes = 0;
|
int num_bytes = 0;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
rc = Timidity_PlaySome( musicBuffer + offset, MIDI_RATE, &num_bytes );
|
rc = Timidity_PlaySome( musicBuffer + offset, MIDI_RATE, &num_bytes );
|
||||||
offset += num_bytes;
|
offset += num_bytes;
|
||||||
} while ( rc != RC_TUNE_END );
|
}
|
||||||
|
while( rc != RC_TUNE_END );
|
||||||
|
|
||||||
Timidity_Stop();
|
Timidity_Stop();
|
||||||
Timidity_FreeSong( doomMusic );
|
Timidity_FreeSong( doomMusic );
|
||||||
|
@ -837,16 +918,18 @@ void I_LoadSong( const char * songname )
|
||||||
I_PlaySong
|
I_PlaySong
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_PlaySong( const char *songname, int looping )
|
void I_PlaySong( const char* songname, int looping )
|
||||||
{
|
{
|
||||||
if ( !Music_initialized ) {
|
if( !Music_initialized )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
I_StopSong( 0 );
|
I_StopSong( 0 );
|
||||||
|
|
||||||
// Clear old state
|
// Clear old state
|
||||||
if ( musicBuffer ) {
|
if( musicBuffer )
|
||||||
|
{
|
||||||
free( musicBuffer );
|
free( musicBuffer );
|
||||||
musicBuffer = 0;
|
musicBuffer = 0;
|
||||||
}
|
}
|
||||||
|
@ -855,7 +938,8 @@ void I_PlaySong( const char *songname, int looping )
|
||||||
I_LoadSong( songname );
|
I_LoadSong( songname );
|
||||||
waitingForMusic = true;
|
waitingForMusic = true;
|
||||||
|
|
||||||
if ( DoomLib::GetPlayer() >= 0 ) {
|
if( DoomLib::GetPlayer() >= 0 )
|
||||||
|
{
|
||||||
::g->mus_looping = looping;
|
::g->mus_looping = looping;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -867,18 +951,23 @@ I_UpdateMusic
|
||||||
*/
|
*/
|
||||||
void I_UpdateMusic( void )
|
void I_UpdateMusic( void )
|
||||||
{
|
{
|
||||||
if ( !Music_initialized ) {
|
if( !Music_initialized )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( alMusicSourceVoice ) {
|
if( alMusicSourceVoice )
|
||||||
|
{
|
||||||
// Set the volume
|
// Set the volume
|
||||||
alSourcef( alMusicSourceVoice, AL_GAIN, x_MusicVolume * GLOBAL_VOLUME_MULTIPLIER );
|
alSourcef( alMusicSourceVoice, AL_GAIN, x_MusicVolume * GLOBAL_VOLUME_MULTIPLIER );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( waitingForMusic ) {
|
if( waitingForMusic )
|
||||||
if ( musicReady && alMusicSourceVoice ) {
|
{
|
||||||
if ( musicBuffer ) {
|
if( musicReady && alMusicSourceVoice )
|
||||||
|
{
|
||||||
|
if( musicBuffer )
|
||||||
|
{
|
||||||
alSourcei( alMusicSourceVoice, AL_BUFFER, 0 );
|
alSourcei( alMusicSourceVoice, AL_BUFFER, 0 );
|
||||||
alBufferData( alMusicBuffer, MIDI_SAMPLETYPE, musicBuffer, totalBufferSize, MIDI_RATE );
|
alBufferData( alMusicBuffer, MIDI_SAMPLETYPE, musicBuffer, totalBufferSize, MIDI_RATE );
|
||||||
alSourcei( alMusicSourceVoice, AL_BUFFER, alMusicBuffer );
|
alSourcei( alMusicSourceVoice, AL_BUFFER, alMusicBuffer );
|
||||||
|
@ -895,9 +984,10 @@ void I_UpdateMusic( void )
|
||||||
I_PauseSong
|
I_PauseSong
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_PauseSong ( int handle )
|
void I_PauseSong( int handle )
|
||||||
{
|
{
|
||||||
if ( !Music_initialized || !alMusicSourceVoice ) {
|
if( !Music_initialized || !alMusicSourceVoice )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -909,9 +999,10 @@ void I_PauseSong ( int handle )
|
||||||
I_ResumeSong
|
I_ResumeSong
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_ResumeSong ( int handle )
|
void I_ResumeSong( int handle )
|
||||||
{
|
{
|
||||||
if ( !Music_initialized || !alMusicSourceVoice ) {
|
if( !Music_initialized || !alMusicSourceVoice )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,7 +1016,8 @@ I_StopSong
|
||||||
*/
|
*/
|
||||||
void I_StopSong( int handle )
|
void I_StopSong( int handle )
|
||||||
{
|
{
|
||||||
if ( !Music_initialized || !alMusicSourceVoice ) {
|
if( !Music_initialized || !alMusicSourceVoice )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,83 +35,89 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
|
|
||||||
// Init at program start...
|
// Init at program start...
|
||||||
void I_InitSound(){}
|
void I_InitSound() {}
|
||||||
void I_InitSoundHardware( int numOutputChannels_, int channelMask ){}
|
void I_InitSoundHardware( int numOutputChannels_, int channelMask ) {}
|
||||||
|
|
||||||
// ... update sound buffer and audio device at runtime...
|
// ... update sound buffer and audio device at runtime...
|
||||||
void I_UpdateSound(void){}
|
void I_UpdateSound( void ) {}
|
||||||
void I_SubmitSound(void){}
|
void I_SubmitSound( void ) {}
|
||||||
|
|
||||||
// ... shut down and relase at program termination.
|
// ... shut down and relase at program termination.
|
||||||
void I_ShutdownSound(void){}
|
void I_ShutdownSound( void ) {}
|
||||||
void I_ShutdownSoundHardware(){}
|
void I_ShutdownSoundHardware() {}
|
||||||
|
|
||||||
//
|
//
|
||||||
// SFX I/O
|
// SFX I/O
|
||||||
//
|
//
|
||||||
|
|
||||||
// Initialize channels?
|
// Initialize channels?
|
||||||
void I_SetChannels(){}
|
void I_SetChannels() {}
|
||||||
|
|
||||||
// Get raw data lump index for sound descriptor.
|
// Get raw data lump index for sound descriptor.
|
||||||
int I_GetSfxLumpNum (sfxinfo_t* sfxinfo )
|
int I_GetSfxLumpNum( sfxinfo_t* sfxinfo )
|
||||||
{
|
{
|
||||||
char namebuf[9];
|
char namebuf[9];
|
||||||
sprintf(namebuf, "ds%s", sfxinfo->name);
|
sprintf( namebuf, "ds%s", sfxinfo->name );
|
||||||
return W_GetNumForName(namebuf);
|
return W_GetNumForName( namebuf );
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_ProcessSoundEvents( void ){}
|
void I_ProcessSoundEvents( void ) {}
|
||||||
|
|
||||||
// Starts a sound in a particular sound channel.
|
// Starts a sound in a particular sound channel.
|
||||||
int I_StartSound( int id, mobj_t *origin, mobj_t *listener_origin, int vol, int pitch, int priority )
|
int I_StartSound( int id, mobj_t* origin, mobj_t* listener_origin, int vol, int pitch, int priority )
|
||||||
{ return 0; }
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Stops a sound channel.
|
// Stops a sound channel.
|
||||||
void I_StopSound(int handle, int player){}
|
void I_StopSound( int handle, int player ) {}
|
||||||
|
|
||||||
// Called by S_*() functions
|
// Called by S_*() functions
|
||||||
// to see if a channel is still playing.
|
// to see if a channel is still playing.
|
||||||
// Returns 0 if no longer playing, 1 if playing.
|
// Returns 0 if no longer playing, 1 if playing.
|
||||||
int I_SoundIsPlaying(int handle)
|
int I_SoundIsPlaying( int handle )
|
||||||
{ return 0; }
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Updates the volume, separation,
|
// Updates the volume, separation,
|
||||||
// and pitch of a sound channel.
|
// and pitch of a sound channel.
|
||||||
void I_UpdateSoundParams( int handle, int vol, int sep, int pitch ){}
|
void I_UpdateSoundParams( int handle, int vol, int sep, int pitch ) {}
|
||||||
|
|
||||||
void I_SetSfxVolume( int ){}
|
void I_SetSfxVolume( int ) {}
|
||||||
//
|
//
|
||||||
// MUSIC I/O
|
// MUSIC I/O
|
||||||
//
|
//
|
||||||
void I_InitMusic(void){}
|
void I_InitMusic( void ) {}
|
||||||
|
|
||||||
void I_ShutdownMusic(void){}
|
void I_ShutdownMusic( void ) {}
|
||||||
|
|
||||||
// Volume.
|
// Volume.
|
||||||
void I_SetMusicVolume(int volume){}
|
void I_SetMusicVolume( int volume ) {}
|
||||||
|
|
||||||
// PAUSE game handling.
|
// PAUSE game handling.
|
||||||
void I_PauseSong(int handle){}
|
void I_PauseSong( int handle ) {}
|
||||||
|
|
||||||
void I_ResumeSong(int handle){}
|
void I_ResumeSong( int handle ) {}
|
||||||
|
|
||||||
// Registers a song handle to song data.
|
// Registers a song handle to song data.
|
||||||
int I_RegisterSong(void *data, int length)
|
int I_RegisterSong( void* data, int length )
|
||||||
{ return 0; }
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Called by anything that wishes to start music.
|
// Called by anything that wishes to start music.
|
||||||
// plays a song, and when the song is done,
|
// plays a song, and when the song is done,
|
||||||
// starts playing it again in an endless loop.
|
// starts playing it again in an endless loop.
|
||||||
// Horrible thing to do, considering.
|
// Horrible thing to do, considering.
|
||||||
void I_PlaySong( const char *songname, int looping ){}
|
void I_PlaySong( const char* songname, int looping ) {}
|
||||||
|
|
||||||
// Stops a song over 3 seconds.
|
// Stops a song over 3 seconds.
|
||||||
void I_StopSong(int handle){}
|
void I_StopSong( int handle ) {}
|
||||||
|
|
||||||
// See above (register), then think backwards
|
// See above (register), then think backwards
|
||||||
void I_UnRegisterSong(int handle){}
|
void I_UnRegisterSong( int handle ) {}
|
||||||
|
|
||||||
// Update Music (XMP), check for notifications
|
// Update Music (XMP), check for notifications
|
||||||
void I_UpdateMusic(void){}
|
void I_UpdateMusic( void ) {}
|
||||||
|
|
|
@ -58,27 +58,27 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "sound/snd_local.h"
|
#include "sound/snd_local.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER // DG: xaudio can only be used with MSVC
|
#ifdef _MSC_VER // DG: xaudio can only be used with MSVC
|
||||||
#include <xaudio2.h>
|
#include <xaudio2.h>
|
||||||
#include <x3daudio.h>
|
#include <x3daudio.h>
|
||||||
#endif // DG end
|
#endif // DG end
|
||||||
|
|
||||||
#pragma warning ( disable : 4244 )
|
#pragma warning ( disable : 4244 )
|
||||||
|
|
||||||
#define MIDI_CHANNELS 2
|
#define MIDI_CHANNELS 2
|
||||||
#if 1
|
#if 1
|
||||||
#define MIDI_RATE 22050
|
#define MIDI_RATE 22050
|
||||||
#define MIDI_SAMPLETYPE XAUDIOSAMPLETYPE_8BITPCM
|
#define MIDI_SAMPLETYPE XAUDIOSAMPLETYPE_8BITPCM
|
||||||
#define MIDI_FORMAT AUDIO_U8
|
#define MIDI_FORMAT AUDIO_U8
|
||||||
#define MIDI_FORMAT_BYTES 1
|
#define MIDI_FORMAT_BYTES 1
|
||||||
#else
|
#else
|
||||||
#define MIDI_RATE 48000
|
#define MIDI_RATE 48000
|
||||||
#define MIDI_SAMPLETYPE XAUDIOSAMPLETYPE_16BITPCM
|
#define MIDI_SAMPLETYPE XAUDIOSAMPLETYPE_16BITPCM
|
||||||
#define MIDI_FORMAT AUDIO_S16MSB
|
#define MIDI_FORMAT AUDIO_S16MSB
|
||||||
#define MIDI_FORMAT_BYTES 2
|
#define MIDI_FORMAT_BYTES 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER // DG: xaudio can only be used with MSVC
|
#ifdef _MSC_VER // DG: xaudio can only be used with MSVC
|
||||||
IXAudio2SourceVoice* pMusicSourceVoice;
|
IXAudio2SourceVoice* pMusicSourceVoice;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MidiSong* doomMusic;
|
MidiSong* doomMusic;
|
||||||
|
@ -90,7 +90,8 @@ bool waitingForMusic;
|
||||||
bool musicReady;
|
bool musicReady;
|
||||||
|
|
||||||
|
|
||||||
typedef struct tagActiveSound_t {
|
typedef struct tagActiveSound_t
|
||||||
|
{
|
||||||
IXAudio2SourceVoice* m_pSourceVoice; // Source voice
|
IXAudio2SourceVoice* m_pSourceVoice; // Source voice
|
||||||
X3DAUDIO_DSP_SETTINGS m_DSPSettings;
|
X3DAUDIO_DSP_SETTINGS m_DSPSettings;
|
||||||
X3DAUDIO_EMITTER m_Emitter;
|
X3DAUDIO_EMITTER m_Emitter;
|
||||||
|
@ -100,18 +101,19 @@ typedef struct tagActiveSound_t {
|
||||||
int start;
|
int start;
|
||||||
int player;
|
int player;
|
||||||
bool localSound;
|
bool localSound;
|
||||||
mobj_t *originator;
|
mobj_t* originator;
|
||||||
} activeSound_t;
|
} activeSound_t;
|
||||||
|
|
||||||
|
|
||||||
// cheap little struct to hold a sound
|
// cheap little struct to hold a sound
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
int vol;
|
int vol;
|
||||||
int player;
|
int player;
|
||||||
int pitch;
|
int pitch;
|
||||||
int priority;
|
int priority;
|
||||||
mobj_t *originator;
|
mobj_t* originator;
|
||||||
mobj_t *listener;
|
mobj_t* listener;
|
||||||
} soundEvent_t;
|
} soundEvent_t;
|
||||||
|
|
||||||
// array of all the possible sounds
|
// array of all the possible sounds
|
||||||
|
@ -139,9 +141,9 @@ static bool soundHardwareInitialized = false;
|
||||||
|
|
||||||
// DG: xaudio can only be used with MSVC
|
// DG: xaudio can only be used with MSVC
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
X3DAUDIO_HANDLE X3DAudioInstance;
|
X3DAUDIO_HANDLE X3DAudioInstance;
|
||||||
|
|
||||||
X3DAUDIO_LISTENER doom_Listener;
|
X3DAUDIO_LISTENER doom_Listener;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//float localSoundVolumeEntries[] = { 0.f, 0.f, 0.9f, 0.5f, 0.f, 0.f };
|
//float localSoundVolumeEntries[] = { 0.f, 0.f, 0.9f, 0.5f, 0.f, 0.f };
|
||||||
|
@ -158,7 +160,7 @@ getsfx
|
||||||
// This function loads the sound data from the WAD lump,
|
// This function loads the sound data from the WAD lump,
|
||||||
// for single sound.
|
// for single sound.
|
||||||
//
|
//
|
||||||
void* getsfx ( const char* sfxname, int* len )
|
void* getsfx( const char* sfxname, int* len )
|
||||||
{
|
{
|
||||||
unsigned char* sfx;
|
unsigned char* sfx;
|
||||||
unsigned char* sfxmem;
|
unsigned char* sfxmem;
|
||||||
|
@ -169,36 +171,43 @@ void* getsfx ( const char* sfxname, int* len )
|
||||||
|
|
||||||
// Get the sound data from the WAD, allocate lump
|
// Get the sound data from the WAD, allocate lump
|
||||||
// in zone memory.
|
// in zone memory.
|
||||||
sprintf(name, "ds%s", sfxname);
|
sprintf( name, "ds%s", sfxname );
|
||||||
|
|
||||||
// Scale down the plasma gun, it clips
|
// Scale down the plasma gun, it clips
|
||||||
if ( strcmp( sfxname, "plasma" ) == 0 ) {
|
if( strcmp( sfxname, "plasma" ) == 0 )
|
||||||
|
{
|
||||||
scale = 0.75f;
|
scale = 0.75f;
|
||||||
}
|
}
|
||||||
if ( strcmp( sfxname, "itemup" ) == 0 ) {
|
if( strcmp( sfxname, "itemup" ) == 0 )
|
||||||
|
{
|
||||||
scale = 1.333f;
|
scale = 1.333f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If sound requested is not found in current WAD, use pistol as default
|
// If sound requested is not found in current WAD, use pistol as default
|
||||||
if ( W_CheckNumForName(name) == -1 )
|
if( W_CheckNumForName( name ) == -1 )
|
||||||
sfxlump = W_GetNumForName("dspistol");
|
{
|
||||||
|
sfxlump = W_GetNumForName( "dspistol" );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sfxlump = W_GetNumForName(name);
|
{
|
||||||
|
sfxlump = W_GetNumForName( name );
|
||||||
|
}
|
||||||
|
|
||||||
// Sound lump headers are 8 bytes.
|
// Sound lump headers are 8 bytes.
|
||||||
const int SOUND_LUMP_HEADER_SIZE_IN_BYTES = 8;
|
const int SOUND_LUMP_HEADER_SIZE_IN_BYTES = 8;
|
||||||
|
|
||||||
size = W_LumpLength( sfxlump ) - SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
size = W_LumpLength( sfxlump ) - SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
||||||
|
|
||||||
sfx = (unsigned char*)W_CacheLumpNum( sfxlump, PU_CACHE_SHARED );
|
sfx = ( unsigned char* )W_CacheLumpNum( sfxlump, PU_CACHE_SHARED );
|
||||||
const unsigned char * sfxSampleStart = sfx + SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
const unsigned char* sfxSampleStart = sfx + SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
||||||
|
|
||||||
// Allocate from zone memory.
|
// Allocate from zone memory.
|
||||||
//sfxmem = (float*)DoomLib::Z_Malloc( size*(sizeof(float)), PU_SOUND_SHARED, 0 );
|
//sfxmem = (float*)DoomLib::Z_Malloc( size*(sizeof(float)), PU_SOUND_SHARED, 0 );
|
||||||
sfxmem = (unsigned char*)malloc( size * sizeof(unsigned char) );
|
sfxmem = ( unsigned char* )malloc( size * sizeof( unsigned char ) );
|
||||||
|
|
||||||
// Now copy, and convert to Xbox360 native float samples, do initial volume ramp, and scale
|
// Now copy, and convert to Xbox360 native float samples, do initial volume ramp, and scale
|
||||||
for ( int i=0; i<size; i++ ) {
|
for( int i = 0; i < size; i++ )
|
||||||
|
{
|
||||||
sfxmem[i] = sfxSampleStart[i];// * scale;
|
sfxmem[i] = sfxSampleStart[i];// * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +218,7 @@ void* getsfx ( const char* sfxname, int* len )
|
||||||
*len = size;
|
*len = size;
|
||||||
|
|
||||||
// Return allocated padded data.
|
// Return allocated padded data.
|
||||||
return (void *) (sfxmem);
|
return ( void* )( sfxmem );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -217,7 +226,8 @@ void* getsfx ( const char* sfxname, int* len )
|
||||||
I_SetChannels
|
I_SetChannels
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_SetChannels() {
|
void I_SetChannels()
|
||||||
|
{
|
||||||
// Original Doom set up lookup tables here
|
// Original Doom set up lookup tables here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,8 +236,9 @@ void I_SetChannels() {
|
||||||
I_SetSfxVolume
|
I_SetSfxVolume
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_SetSfxVolume(int volume) {
|
void I_SetSfxVolume( int volume )
|
||||||
x_SoundVolume = ((float)volume / 15.f) * GLOBAL_VOLUME_MULTIPLIER;
|
{
|
||||||
|
x_SoundVolume = ( ( float )volume / 15.f ) * GLOBAL_VOLUME_MULTIPLIER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -239,11 +250,11 @@ I_GetSfxLumpNum
|
||||||
// Retrieve the raw data lump index
|
// Retrieve the raw data lump index
|
||||||
// for a given SFX name.
|
// for a given SFX name.
|
||||||
//
|
//
|
||||||
int I_GetSfxLumpNum(sfxinfo_t* sfx)
|
int I_GetSfxLumpNum( sfxinfo_t* sfx )
|
||||||
{
|
{
|
||||||
char namebuf[9];
|
char namebuf[9];
|
||||||
sprintf(namebuf, "ds%s", sfx->name);
|
sprintf( namebuf, "ds%s", sfx->name );
|
||||||
return W_GetNumForName(namebuf);
|
return W_GetNumForName( namebuf );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -261,24 +272,28 @@ I_StartSound2
|
||||||
// priority, it is ignored.
|
// priority, it is ignored.
|
||||||
// Pitching (that is, increased speed of playback) is set
|
// Pitching (that is, increased speed of playback) is set
|
||||||
//
|
//
|
||||||
int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin, int pitch, int priority ) {
|
int I_StartSound2( int id, int player, mobj_t* origin, mobj_t* listener_origin, int pitch, int priority )
|
||||||
if ( !soundHardwareInitialized ) {
|
{
|
||||||
|
if( !soundHardwareInitialized )
|
||||||
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
XAUDIO2_VOICE_STATE state;
|
XAUDIO2_VOICE_STATE state;
|
||||||
activeSound_t* sound = 0;
|
activeSound_t* sound = 0;
|
||||||
int oldest = 0, oldestnum = -1;
|
int oldest = 0, oldestnum = -1;
|
||||||
|
|
||||||
// these id's should not overlap
|
// these id's should not overlap
|
||||||
if ( id == sfx_sawup || id == sfx_sawidl || id == sfx_sawful || id == sfx_sawhit || id == sfx_stnmov ) {
|
if( id == sfx_sawup || id == sfx_sawidl || id == sfx_sawful || id == sfx_sawhit || id == sfx_stnmov )
|
||||||
|
{
|
||||||
// Loop all channels, check.
|
// Loop all channels, check.
|
||||||
for (i=0 ; i < NUM_SOUNDBUFFERS ; i++)
|
for( i = 0 ; i < NUM_SOUNDBUFFERS ; i++ )
|
||||||
{
|
{
|
||||||
sound = &activeSounds[i];
|
sound = &activeSounds[i];
|
||||||
|
|
||||||
if (sound->valid && ( sound->id == id && sound->player == player ) ) {
|
if( sound->valid && ( sound->id == id && sound->player == player ) )
|
||||||
|
{
|
||||||
I_StopSound( sound->id, player );
|
I_StopSound( sound->id, player );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -286,25 +301,30 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
||||||
}
|
}
|
||||||
|
|
||||||
// find a valid channel, or one that has finished playing
|
// find a valid channel, or one that has finished playing
|
||||||
for (i = 0; i < NUM_SOUNDBUFFERS; ++i) {
|
for( i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||||
|
{
|
||||||
sound = &activeSounds[i];
|
sound = &activeSounds[i];
|
||||||
|
|
||||||
if (!sound->valid)
|
if( !sound->valid )
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!oldest || oldest > sound->start) {
|
if( !oldest || oldest > sound->start )
|
||||||
|
{
|
||||||
oldestnum = i;
|
oldestnum = i;
|
||||||
oldest = sound->start;
|
oldest = sound->start;
|
||||||
}
|
}
|
||||||
|
|
||||||
sound->m_pSourceVoice->GetState( &state );
|
sound->m_pSourceVoice->GetState( &state );
|
||||||
if ( state.BuffersQueued == 0 ) {
|
if( state.BuffersQueued == 0 )
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// none found, so use the oldest one
|
// none found, so use the oldest one
|
||||||
if (i == NUM_SOUNDBUFFERS)
|
if( i == NUM_SOUNDBUFFERS )
|
||||||
{
|
{
|
||||||
i = oldestnum;
|
i = oldestnum;
|
||||||
sound = &activeSounds[i];
|
sound = &activeSounds[i];
|
||||||
|
@ -318,7 +338,7 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
||||||
XAUDIO2_BUFFER Packet = { 0 };
|
XAUDIO2_BUFFER Packet = { 0 };
|
||||||
Packet.Flags = XAUDIO2_END_OF_STREAM;
|
Packet.Flags = XAUDIO2_END_OF_STREAM;
|
||||||
Packet.AudioBytes = lengths[id];
|
Packet.AudioBytes = lengths[id];
|
||||||
Packet.pAudioData = (BYTE*)S_sfx[id].data;
|
Packet.pAudioData = ( BYTE* )S_sfx[id].data;
|
||||||
Packet.PlayBegin = 0;
|
Packet.PlayBegin = 0;
|
||||||
Packet.PlayLength = 0;
|
Packet.PlayLength = 0;
|
||||||
Packet.LoopBegin = XAUDIO2_NO_LOOP_REGION;
|
Packet.LoopBegin = XAUDIO2_NO_LOOP_REGION;
|
||||||
|
@ -331,14 +351,15 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
||||||
sound->m_pSourceVoice->SetVolume( x_SoundVolume );
|
sound->m_pSourceVoice->SetVolume( x_SoundVolume );
|
||||||
|
|
||||||
// Set voice pitch
|
// Set voice pitch
|
||||||
sound->m_pSourceVoice->SetFrequencyRatio( 1 + ((float)pitch-128.f)/95.f );
|
sound->m_pSourceVoice->SetFrequencyRatio( 1 + ( ( float )pitch - 128.f ) / 95.f );
|
||||||
|
|
||||||
// Set initial spatialization
|
// Set initial spatialization
|
||||||
if ( origin && origin != listener_origin ) {
|
if( origin && origin != listener_origin )
|
||||||
|
{
|
||||||
// Update Emitter Position
|
// Update Emitter Position
|
||||||
sound->m_Emitter.Position.x = (float)(origin->x >> FRACBITS);
|
sound->m_Emitter.Position.x = ( float )( origin->x >> FRACBITS );
|
||||||
sound->m_Emitter.Position.y = 0.f;
|
sound->m_Emitter.Position.y = 0.f;
|
||||||
sound->m_Emitter.Position.z = (float)(origin->y >> FRACBITS);
|
sound->m_Emitter.Position.z = ( float )( origin->y >> FRACBITS );
|
||||||
|
|
||||||
// Calculate 3D positioned speaker volumes
|
// Calculate 3D positioned speaker volumes
|
||||||
DWORD dwCalculateFlags = X3DAUDIO_CALCULATE_MATRIX;
|
DWORD dwCalculateFlags = X3DAUDIO_CALCULATE_MATRIX;
|
||||||
|
@ -348,7 +369,9 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
||||||
sound->m_pSourceVoice->SetOutputMatrix( NULL, 1, numOutputChannels, sound->m_DSPSettings.pMatrixCoefficients );
|
sound->m_pSourceVoice->SetOutputMatrix( NULL, 1, numOutputChannels, sound->m_DSPSettings.pMatrixCoefficients );
|
||||||
|
|
||||||
sound->localSound = false;
|
sound->localSound = false;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Local(or Global) sound, fixed speaker volumes
|
// Local(or Global) sound, fixed speaker volumes
|
||||||
sound->m_pSourceVoice->SetOutputMatrix( NULL, 1, numOutputChannels, localSoundVolumeEntries );
|
sound->m_pSourceVoice->SetOutputMatrix( NULL, 1, numOutputChannels, localSoundVolumeEntries );
|
||||||
|
|
||||||
|
@ -357,12 +380,14 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
||||||
|
|
||||||
// Submit packet
|
// Submit packet
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
if( FAILED( hr = sound->m_pSourceVoice->SubmitSourceBuffer( &Packet ) ) ) {
|
if( FAILED( hr = sound->m_pSourceVoice->SubmitSourceBuffer( &Packet ) ) )
|
||||||
|
{
|
||||||
int fail = 1;
|
int fail = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play the source voice
|
// Play the source voice
|
||||||
if( FAILED( hr = sound->m_pSourceVoice->Start( 0 ) ) ) {
|
if( FAILED( hr = sound->m_pSourceVoice->Start( 0 ) ) )
|
||||||
|
{
|
||||||
int fail = 1;
|
int fail = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,9 +406,12 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
||||||
I_ProcessSoundEvents
|
I_ProcessSoundEvents
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_ProcessSoundEvents() {
|
void I_ProcessSoundEvents()
|
||||||
for( int i = 0; i < 128; i++ ) {
|
{
|
||||||
if( soundEvents[i].pitch ) {
|
for( int i = 0; i < 128; i++ )
|
||||||
|
{
|
||||||
|
if( soundEvents[i].pitch )
|
||||||
|
{
|
||||||
I_StartSound2( i, soundEvents[i].player, soundEvents[i].originator, soundEvents[i].listener, soundEvents[i].pitch, soundEvents[i].priority );
|
I_StartSound2( i, soundEvents[i].player, soundEvents[i].originator, soundEvents[i].listener, soundEvents[i].pitch, soundEvents[i].priority );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -395,19 +423,24 @@ void I_ProcessSoundEvents() {
|
||||||
I_StartSound
|
I_StartSound
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
int I_StartSound ( int id, mobj_t *origin, mobj_t *listener_origin, int vol, int pitch, int priority ) {
|
int I_StartSound( int id, mobj_t* origin, mobj_t* listener_origin, int vol, int pitch, int priority )
|
||||||
|
{
|
||||||
// only allow player 0s sounds in intermission and finale screens
|
// only allow player 0s sounds in intermission and finale screens
|
||||||
if( ::g->gamestate != GS_LEVEL && DoomLib::GetPlayer() != 0 ) {
|
if( ::g->gamestate != GS_LEVEL && DoomLib::GetPlayer() != 0 )
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're only one player or we're trying to play the chainsaw sound, do it normal
|
// if we're only one player or we're trying to play the chainsaw sound, do it normal
|
||||||
// otherwise only allow one sound of each type per frame
|
// otherwise only allow one sound of each type per frame
|
||||||
if( PLAYERCOUNT == 1 || id == sfx_sawup || id == sfx_sawidl || id == sfx_sawful || id == sfx_sawhit ) {
|
if( PLAYERCOUNT == 1 || id == sfx_sawup || id == sfx_sawidl || id == sfx_sawful || id == sfx_sawhit )
|
||||||
|
{
|
||||||
return I_StartSound2( id, ::g->consoleplayer, origin, listener_origin, pitch, priority );
|
return I_StartSound2( id, ::g->consoleplayer, origin, listener_origin, pitch, priority );
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
if( soundEvents[ id ].vol < vol ) {
|
{
|
||||||
|
if( soundEvents[ id ].vol < vol )
|
||||||
|
{
|
||||||
soundEvents[ id ].player = DoomLib::GetPlayer();
|
soundEvents[ id ].player = DoomLib::GetPlayer();
|
||||||
soundEvents[ id ].pitch = pitch;
|
soundEvents[ id ].pitch = pitch;
|
||||||
soundEvents[ id ].priority = priority;
|
soundEvents[ id ].priority = priority;
|
||||||
|
@ -424,7 +457,7 @@ int I_StartSound ( int id, mobj_t *origin, mobj_t *listener_origin, int vol, int
|
||||||
I_StopSound
|
I_StopSound
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_StopSound (int handle, int player)
|
void I_StopSound( int handle, int player )
|
||||||
{
|
{
|
||||||
// You need the handle returned by StartSound.
|
// You need the handle returned by StartSound.
|
||||||
// Would be looping all channels,
|
// Would be looping all channels,
|
||||||
|
@ -434,19 +467,24 @@ void I_StopSound (int handle, int player)
|
||||||
int i;
|
int i;
|
||||||
activeSound_t* sound = 0;
|
activeSound_t* sound = 0;
|
||||||
|
|
||||||
for (i = 0; i < NUM_SOUNDBUFFERS; ++i)
|
for( i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||||
{
|
{
|
||||||
sound = &activeSounds[i];
|
sound = &activeSounds[i];
|
||||||
if (!sound->valid || sound->id != handle || (player >= 0 && sound->player != player) )
|
if( !sound->valid || sound->id != handle || ( player >= 0 && sound->player != player ) )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == NUM_SOUNDBUFFERS)
|
if( i == NUM_SOUNDBUFFERS )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// stop the sound
|
// stop the sound
|
||||||
if ( sound->m_pSourceVoice != NULL ) {
|
if( sound->m_pSourceVoice != NULL )
|
||||||
|
{
|
||||||
sound->m_pSourceVoice->Stop( 0 );
|
sound->m_pSourceVoice->Stop( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,8 +497,10 @@ void I_StopSound (int handle, int player)
|
||||||
I_SoundIsPlaying
|
I_SoundIsPlaying
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
int I_SoundIsPlaying(int handle) {
|
int I_SoundIsPlaying( int handle )
|
||||||
if ( !soundHardwareInitialized ) {
|
{
|
||||||
|
if( !soundHardwareInitialized )
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,14 +508,17 @@ int I_SoundIsPlaying(int handle) {
|
||||||
XAUDIO2_VOICE_STATE state;
|
XAUDIO2_VOICE_STATE state;
|
||||||
activeSound_t* sound;
|
activeSound_t* sound;
|
||||||
|
|
||||||
for (i = 0; i < NUM_SOUNDBUFFERS; ++i)
|
for( i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||||
{
|
{
|
||||||
sound = &activeSounds[i];
|
sound = &activeSounds[i];
|
||||||
if (!sound->valid || sound->id != handle)
|
if( !sound->valid || sound->id != handle )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
sound->m_pSourceVoice->GetState( &state );
|
sound->m_pSourceVoice->GetState( &state );
|
||||||
if ( state.BuffersQueued > 0 ) {
|
if( state.BuffersQueued > 0 )
|
||||||
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -490,8 +533,10 @@ I_UpdateSound
|
||||||
*/
|
*/
|
||||||
// Update Listener Position and go through all the
|
// Update Listener Position and go through all the
|
||||||
// channels and update speaker volumes for 3D sound.
|
// channels and update speaker volumes for 3D sound.
|
||||||
void I_UpdateSound() {
|
void I_UpdateSound()
|
||||||
if ( !soundHardwareInitialized ) {
|
{
|
||||||
|
if( !soundHardwareInitialized )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,17 +544,20 @@ void I_UpdateSound() {
|
||||||
XAUDIO2_VOICE_STATE state;
|
XAUDIO2_VOICE_STATE state;
|
||||||
activeSound_t* sound;
|
activeSound_t* sound;
|
||||||
|
|
||||||
for ( i=0; i < NUM_SOUNDBUFFERS; i++ ) {
|
for( i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||||
|
{
|
||||||
sound = &activeSounds[i];
|
sound = &activeSounds[i];
|
||||||
|
|
||||||
if ( !sound->valid || sound->localSound ) {
|
if( !sound->valid || sound->localSound )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sound->m_pSourceVoice->GetState( &state );
|
sound->m_pSourceVoice->GetState( &state );
|
||||||
|
|
||||||
if ( state.BuffersQueued > 0 ) {
|
if( state.BuffersQueued > 0 )
|
||||||
mobj_t *playerObj = ::g->players[ sound->player ].mo;
|
{
|
||||||
|
mobj_t* playerObj = ::g->players[ sound->player ].mo;
|
||||||
|
|
||||||
// Update Listener Orientation and Position
|
// Update Listener Orientation and Position
|
||||||
angle_t pAngle = playerObj->angle;
|
angle_t pAngle = playerObj->angle;
|
||||||
|
@ -520,18 +568,18 @@ void I_UpdateSound() {
|
||||||
fx = finecosine[pAngle];
|
fx = finecosine[pAngle];
|
||||||
fz = finesine[pAngle];
|
fz = finesine[pAngle];
|
||||||
|
|
||||||
doom_Listener.OrientFront.x = (float)(fx) / 65535.f;
|
doom_Listener.OrientFront.x = ( float )( fx ) / 65535.f;
|
||||||
doom_Listener.OrientFront.y = 0.f;
|
doom_Listener.OrientFront.y = 0.f;
|
||||||
doom_Listener.OrientFront.z = (float)(fz) / 65535.f;
|
doom_Listener.OrientFront.z = ( float )( fz ) / 65535.f;
|
||||||
|
|
||||||
doom_Listener.Position.x = (float)(playerObj->x >> FRACBITS);
|
doom_Listener.Position.x = ( float )( playerObj->x >> FRACBITS );
|
||||||
doom_Listener.Position.y = 0.f;
|
doom_Listener.Position.y = 0.f;
|
||||||
doom_Listener.Position.z = (float)(playerObj->y >> FRACBITS);
|
doom_Listener.Position.z = ( float )( playerObj->y >> FRACBITS );
|
||||||
|
|
||||||
// Update Emitter Position
|
// Update Emitter Position
|
||||||
sound->m_Emitter.Position.x = (float)(sound->originator->x >> FRACBITS);
|
sound->m_Emitter.Position.x = ( float )( sound->originator->x >> FRACBITS );
|
||||||
sound->m_Emitter.Position.y = 0.f;
|
sound->m_Emitter.Position.y = 0.f;
|
||||||
sound->m_Emitter.Position.z = (float)(sound->originator->y >> FRACBITS);
|
sound->m_Emitter.Position.z = ( float )( sound->originator->y >> FRACBITS );
|
||||||
|
|
||||||
// Calculate 3D positioned speaker volumes
|
// Calculate 3D positioned speaker volumes
|
||||||
DWORD dwCalculateFlags = X3DAUDIO_CALCULATE_MATRIX;
|
DWORD dwCalculateFlags = X3DAUDIO_CALCULATE_MATRIX;
|
||||||
|
@ -548,7 +596,8 @@ void I_UpdateSound() {
|
||||||
I_UpdateSoundParams
|
I_UpdateSoundParams
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_UpdateSoundParams( int handle, int vol, int sep, int pitch) {
|
void I_UpdateSoundParams( int handle, int vol, int sep, int pitch )
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -556,28 +605,35 @@ void I_UpdateSoundParams( int handle, int vol, int sep, int pitch) {
|
||||||
I_ShutdownSound
|
I_ShutdownSound
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_ShutdownSound(void) {
|
void I_ShutdownSound( void )
|
||||||
|
{
|
||||||
int done = 0;
|
int done = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ( S_initialized ) {
|
if( S_initialized )
|
||||||
|
{
|
||||||
// Stop all sounds, but don't destroy the XAudio2 buffers.
|
// Stop all sounds, but don't destroy the XAudio2 buffers.
|
||||||
for ( i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
for( i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||||
activeSound_t * sound = &activeSounds[i];
|
{
|
||||||
|
activeSound_t* sound = &activeSounds[i];
|
||||||
|
|
||||||
if ( sound == NULL ) {
|
if( sound == NULL )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
I_StopSound( sound->id, 0 );
|
I_StopSound( sound->id, 0 );
|
||||||
|
|
||||||
if ( sound->m_pSourceVoice ) {
|
if( sound->m_pSourceVoice )
|
||||||
|
{
|
||||||
sound->m_pSourceVoice->FlushSourceBuffers();
|
sound->m_pSourceVoice->FlushSourceBuffers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=1 ; i<NUMSFX ; i++) {
|
for( i = 1 ; i < NUMSFX ; i++ )
|
||||||
if ( S_sfx[i].data && !(S_sfx[i].link) ) {
|
{
|
||||||
|
if( S_sfx[i].data && !( S_sfx[i].link ) )
|
||||||
|
{
|
||||||
//Z_Free( S_sfx[i].data );
|
//Z_Free( S_sfx[i].data );
|
||||||
free( S_sfx[i].data );
|
free( S_sfx[i].data );
|
||||||
}
|
}
|
||||||
|
@ -599,7 +655,8 @@ Called from the tech4x initialization code. Sets up Doom classic's
|
||||||
sound channels.
|
sound channels.
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_InitSoundHardware( int numOutputChannels_, int channelMask ) {
|
void I_InitSoundHardware( int numOutputChannels_, int channelMask )
|
||||||
|
{
|
||||||
::numOutputChannels = numOutputChannels_;
|
::numOutputChannels = numOutputChannels_;
|
||||||
|
|
||||||
// Initialize the X3DAudio
|
// Initialize the X3DAudio
|
||||||
|
@ -608,7 +665,8 @@ void I_InitSoundHardware( int numOutputChannels_, int channelMask ) {
|
||||||
// SpeedOfSound - not used by doomclassic
|
// SpeedOfSound - not used by doomclassic
|
||||||
X3DAudioInitialize( channelMask, 340.29f, X3DAudioInstance );
|
X3DAudioInitialize( channelMask, 340.29f, X3DAudioInstance );
|
||||||
|
|
||||||
for ( int i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
for( int i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||||
|
{
|
||||||
// Initialize source voices
|
// Initialize source voices
|
||||||
I_InitSoundChannel( i, numOutputChannels );
|
I_InitSoundChannel( i, numOutputChannels );
|
||||||
}
|
}
|
||||||
|
@ -627,26 +685,31 @@ Called from the tech4x shutdown code. Tears down Doom classic's
|
||||||
sound channels.
|
sound channels.
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_ShutdownSoundHardware() {
|
void I_ShutdownSoundHardware()
|
||||||
|
{
|
||||||
soundHardwareInitialized = false;
|
soundHardwareInitialized = false;
|
||||||
|
|
||||||
I_ShutdownMusic();
|
I_ShutdownMusic();
|
||||||
|
|
||||||
for ( int i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
for( int i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||||
activeSound_t * sound = &activeSounds[i];
|
{
|
||||||
|
activeSound_t* sound = &activeSounds[i];
|
||||||
|
|
||||||
if ( sound == NULL ) {
|
if( sound == NULL )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sound->m_pSourceVoice ) {
|
if( sound->m_pSourceVoice )
|
||||||
|
{
|
||||||
sound->m_pSourceVoice->Stop();
|
sound->m_pSourceVoice->Stop();
|
||||||
sound->m_pSourceVoice->FlushSourceBuffers();
|
sound->m_pSourceVoice->FlushSourceBuffers();
|
||||||
sound->m_pSourceVoice->DestroyVoice();
|
sound->m_pSourceVoice->DestroyVoice();
|
||||||
sound->m_pSourceVoice = NULL;
|
sound->m_pSourceVoice = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sound->m_DSPSettings.pMatrixCoefficients ) {
|
if( sound->m_DSPSettings.pMatrixCoefficients )
|
||||||
|
{
|
||||||
delete [] sound->m_DSPSettings.pMatrixCoefficients;
|
delete [] sound->m_DSPSettings.pMatrixCoefficients;
|
||||||
sound->m_DSPSettings.pMatrixCoefficients = NULL;
|
sound->m_DSPSettings.pMatrixCoefficients = NULL;
|
||||||
}
|
}
|
||||||
|
@ -658,8 +721,9 @@ void I_ShutdownSoundHardware() {
|
||||||
I_InitSoundChannel
|
I_InitSoundChannel
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_InitSoundChannel( int channel, int numOutputChannels_ ) {
|
void I_InitSoundChannel( int channel, int numOutputChannels_ )
|
||||||
activeSound_t *soundchannel = &activeSounds[ channel ];
|
{
|
||||||
|
activeSound_t* soundchannel = &activeSounds[ channel ];
|
||||||
|
|
||||||
// RB: fixed non-aggregates cannot be initialized with initializer list
|
// RB: fixed non-aggregates cannot be initialized with initializer list
|
||||||
#if defined(USE_WINRT) //(_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
|
#if defined(USE_WINRT) //(_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
|
||||||
|
@ -678,7 +742,7 @@ void I_InitSoundChannel( int channel, int numOutputChannels_ ) {
|
||||||
soundchannel->m_Emitter.OrientTop.z = 0.0f;
|
soundchannel->m_Emitter.OrientTop.z = 0.0f;
|
||||||
soundchannel->m_Emitter.Position = ZeroVector;
|
soundchannel->m_Emitter.Position = ZeroVector;
|
||||||
soundchannel->m_Emitter.Velocity = ZeroVector;
|
soundchannel->m_Emitter.Velocity = ZeroVector;
|
||||||
soundchannel->m_Emitter.pCone = &(soundchannel->m_Cone);
|
soundchannel->m_Emitter.pCone = &( soundchannel->m_Cone );
|
||||||
soundchannel->m_Emitter.pCone->InnerAngle = 0.0f; // Setting the inner cone angles to X3DAUDIO_2PI and
|
soundchannel->m_Emitter.pCone->InnerAngle = 0.0f; // Setting the inner cone angles to X3DAUDIO_2PI and
|
||||||
// outer cone other than 0 causes
|
// outer cone other than 0 causes
|
||||||
// the emitter to act like a point emitter using the
|
// the emitter to act like a point emitter using the
|
||||||
|
@ -712,13 +776,13 @@ void I_InitSoundChannel( int channel, int numOutputChannels_ ) {
|
||||||
WAVEFORMATEX voiceFormat = {0};
|
WAVEFORMATEX voiceFormat = {0};
|
||||||
voiceFormat.wFormatTag = WAVE_FORMAT_PCM;
|
voiceFormat.wFormatTag = WAVE_FORMAT_PCM;
|
||||||
voiceFormat.nChannels = 1;
|
voiceFormat.nChannels = 1;
|
||||||
voiceFormat.nSamplesPerSec = 11025;
|
voiceFormat.nSamplesPerSec = 11025;
|
||||||
voiceFormat.nAvgBytesPerSec = 11025;
|
voiceFormat.nAvgBytesPerSec = 11025;
|
||||||
voiceFormat.nBlockAlign = 1;
|
voiceFormat.nBlockAlign = 1;
|
||||||
voiceFormat.wBitsPerSample = 8;
|
voiceFormat.wBitsPerSample = 8;
|
||||||
voiceFormat.cbSize = 0;
|
voiceFormat.cbSize = 0;
|
||||||
|
|
||||||
soundSystemLocal.hardware.GetIXAudio2()->CreateSourceVoice( &soundchannel->m_pSourceVoice, (WAVEFORMATEX *)&voiceFormat );
|
soundSystemLocal.hardware.GetIXAudio2()->CreateSourceVoice( &soundchannel->m_pSourceVoice, ( WAVEFORMATEX* )&voiceFormat );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -726,9 +790,11 @@ void I_InitSoundChannel( int channel, int numOutputChannels_ ) {
|
||||||
I_InitSound
|
I_InitSound
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_InitSound() {
|
void I_InitSound()
|
||||||
|
{
|
||||||
|
|
||||||
if (S_initialized == 0) {
|
if( S_initialized == 0 )
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// RB: non-aggregates cannot be initialized with initializer list
|
// RB: non-aggregates cannot be initialized with initializer list
|
||||||
|
@ -749,10 +815,10 @@ void I_InitSound() {
|
||||||
doom_Listener.Position = ZeroVector;
|
doom_Listener.Position = ZeroVector;
|
||||||
doom_Listener.Velocity = ZeroVector;
|
doom_Listener.Velocity = ZeroVector;
|
||||||
|
|
||||||
for (i=1 ; i<NUMSFX ; i++)
|
for( i = 1 ; i < NUMSFX ; i++ )
|
||||||
{
|
{
|
||||||
// Alias? Example is the chaingun sound linked to pistol.
|
// Alias? Example is the chaingun sound linked to pistol.
|
||||||
if (!S_sfx[i].link)
|
if( !S_sfx[i].link )
|
||||||
{
|
{
|
||||||
// Load data from WAD file.
|
// Load data from WAD file.
|
||||||
S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] );
|
S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] );
|
||||||
|
@ -761,7 +827,7 @@ void I_InitSound() {
|
||||||
{
|
{
|
||||||
// Previously loaded already?
|
// Previously loaded already?
|
||||||
S_sfx[i].data = S_sfx[i].link->data;
|
S_sfx[i].data = S_sfx[i].link->data;
|
||||||
lengths[i] = lengths[(S_sfx[i].link - S_sfx)/sizeof(sfxinfo_t)];
|
lengths[i] = lengths[( S_sfx[i].link - S_sfx ) / sizeof( sfxinfo_t )];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,12 +840,13 @@ void I_InitSound() {
|
||||||
I_SubmitSound
|
I_SubmitSound
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_SubmitSound(void)
|
void I_SubmitSound( void )
|
||||||
{
|
{
|
||||||
// Only do this for player 0, it will still handle positioning
|
// Only do this for player 0, it will still handle positioning
|
||||||
// for other players, but it can't be outside the game
|
// for other players, but it can't be outside the game
|
||||||
// frame like the soundEvents are.
|
// frame like the soundEvents are.
|
||||||
if ( DoomLib::GetPlayer() == 0 ) {
|
if( DoomLib::GetPlayer() == 0 )
|
||||||
|
{
|
||||||
// Do 3D positioning of sounds
|
// Do 3D positioning of sounds
|
||||||
I_UpdateSound();
|
I_UpdateSound();
|
||||||
|
|
||||||
|
@ -800,9 +867,9 @@ void I_SubmitSound(void)
|
||||||
I_SetMusicVolume
|
I_SetMusicVolume
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_SetMusicVolume(int volume)
|
void I_SetMusicVolume( int volume )
|
||||||
{
|
{
|
||||||
x_MusicVolume = (float)volume / 15.f;
|
x_MusicVolume = ( float )volume / 15.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -810,9 +877,10 @@ void I_SetMusicVolume(int volume)
|
||||||
I_InitMusic
|
I_InitMusic
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_InitMusic(void)
|
void I_InitMusic( void )
|
||||||
{
|
{
|
||||||
if ( !Music_initialized ) {
|
if( !Music_initialized )
|
||||||
|
{
|
||||||
// Initialize Timidity
|
// Initialize Timidity
|
||||||
Timidity_Init( MIDI_RATE, MIDI_FORMAT, MIDI_CHANNELS, MIDI_RATE, "classicmusic/gravis.cfg" );
|
Timidity_Init( MIDI_RATE, MIDI_FORMAT, MIDI_CHANNELS, MIDI_RATE, "classicmusic/gravis.cfg" );
|
||||||
|
|
||||||
|
@ -833,7 +901,7 @@ void I_InitMusic(void)
|
||||||
voiceFormat.cbSize = 0;
|
voiceFormat.cbSize = 0;
|
||||||
|
|
||||||
// RB: XAUDIO2_VOICE_MUSIC not available on Windows 8 SDK
|
// RB: XAUDIO2_VOICE_MUSIC not available on Windows 8 SDK
|
||||||
soundSystemLocal.hardware.GetIXAudio2()->CreateSourceVoice( &pMusicSourceVoice, (WAVEFORMATEX *)&voiceFormat/*, XAUDIO2_VOICE_MUSIC*/ );
|
soundSystemLocal.hardware.GetIXAudio2()->CreateSourceVoice( &pMusicSourceVoice, ( WAVEFORMATEX* )&voiceFormat/*, XAUDIO2_VOICE_MUSIC*/ );
|
||||||
// RB end
|
// RB end
|
||||||
|
|
||||||
Music_initialized = true;
|
Music_initialized = true;
|
||||||
|
@ -845,31 +913,38 @@ void I_InitMusic(void)
|
||||||
I_ShutdownMusic
|
I_ShutdownMusic
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_ShutdownMusic(void)
|
void I_ShutdownMusic( void )
|
||||||
{
|
{
|
||||||
I_StopSong( 0 );
|
I_StopSong( 0 );
|
||||||
|
|
||||||
if ( Music_initialized ) {
|
if( Music_initialized )
|
||||||
if ( pMusicSourceVoice ) {
|
{
|
||||||
|
if( pMusicSourceVoice )
|
||||||
|
{
|
||||||
pMusicSourceVoice->Stop();
|
pMusicSourceVoice->Stop();
|
||||||
pMusicSourceVoice->FlushSourceBuffers();
|
pMusicSourceVoice->FlushSourceBuffers();
|
||||||
pMusicSourceVoice->DestroyVoice();
|
pMusicSourceVoice->DestroyVoice();
|
||||||
pMusicSourceVoice = NULL;
|
pMusicSourceVoice = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hMusicThread ) {
|
if( hMusicThread )
|
||||||
|
{
|
||||||
DWORD rc;
|
DWORD rc;
|
||||||
|
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
GetExitCodeThread( hMusicThread, &rc );
|
GetExitCodeThread( hMusicThread, &rc );
|
||||||
if ( rc == STILL_ACTIVE ) {
|
if( rc == STILL_ACTIVE )
|
||||||
|
{
|
||||||
Sleep( 1 );
|
Sleep( 1 );
|
||||||
}
|
}
|
||||||
} while( rc == STILL_ACTIVE );
|
}
|
||||||
|
while( rc == STILL_ACTIVE );
|
||||||
|
|
||||||
CloseHandle( hMusicThread );
|
CloseHandle( hMusicThread );
|
||||||
}
|
}
|
||||||
if ( musicBuffer ) {
|
if( musicBuffer )
|
||||||
|
{
|
||||||
free( musicBuffer );
|
free( musicBuffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -887,11 +962,12 @@ void I_ShutdownMusic(void)
|
||||||
Music_initialized = false;
|
Music_initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len);
|
int Mus2Midi( unsigned char* bytes, unsigned char* out, int* len );
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
const int MaxMidiConversionSize = 1024 * 1024;
|
{
|
||||||
unsigned char midiConversionBuffer[MaxMidiConversionSize];
|
const int MaxMidiConversionSize = 1024 * 1024;
|
||||||
|
unsigned char midiConversionBuffer[MaxMidiConversionSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -899,19 +975,21 @@ namespace {
|
||||||
I_LoadSong
|
I_LoadSong
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
DWORD WINAPI I_LoadSong( LPVOID songname ) {
|
DWORD WINAPI I_LoadSong( LPVOID songname )
|
||||||
|
{
|
||||||
idStr lumpName = "d_";
|
idStr lumpName = "d_";
|
||||||
lumpName += static_cast< const char * >( songname );
|
lumpName += static_cast< const char* >( songname );
|
||||||
|
|
||||||
unsigned char * musFile = static_cast< unsigned char * >( W_CacheLumpName( lumpName.c_str(), PU_STATIC_SHARED ) );
|
unsigned char* musFile = static_cast< unsigned char* >( W_CacheLumpName( lumpName.c_str(), PU_STATIC_SHARED ) );
|
||||||
|
|
||||||
int length = 0;
|
int length = 0;
|
||||||
Mus2Midi( musFile, midiConversionBuffer, &length );
|
Mus2Midi( musFile, midiConversionBuffer, &length );
|
||||||
|
|
||||||
doomMusic = Timidity_LoadSongMem( midiConversionBuffer, length );
|
doomMusic = Timidity_LoadSongMem( midiConversionBuffer, length );
|
||||||
|
|
||||||
if ( doomMusic ) {
|
if( doomMusic )
|
||||||
musicBuffer = (byte *)malloc( MIDI_CHANNELS * MIDI_FORMAT_BYTES * doomMusic->samples );
|
{
|
||||||
|
musicBuffer = ( byte* )malloc( MIDI_CHANNELS * MIDI_FORMAT_BYTES * doomMusic->samples );
|
||||||
totalBufferSize = doomMusic->samples * MIDI_CHANNELS * MIDI_FORMAT_BYTES;
|
totalBufferSize = doomMusic->samples * MIDI_CHANNELS * MIDI_FORMAT_BYTES;
|
||||||
|
|
||||||
Timidity_Start( doomMusic );
|
Timidity_Start( doomMusic );
|
||||||
|
@ -920,10 +998,12 @@ DWORD WINAPI I_LoadSong( LPVOID songname ) {
|
||||||
int num_bytes = 0;
|
int num_bytes = 0;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
rc = Timidity_PlaySome( musicBuffer + offset, MIDI_RATE, &num_bytes );
|
rc = Timidity_PlaySome( musicBuffer + offset, MIDI_RATE, &num_bytes );
|
||||||
offset += num_bytes;
|
offset += num_bytes;
|
||||||
} while ( rc != RC_TUNE_END );
|
}
|
||||||
|
while( rc != RC_TUNE_END );
|
||||||
|
|
||||||
Timidity_Stop();
|
Timidity_Stop();
|
||||||
Timidity_FreeSong( doomMusic );
|
Timidity_FreeSong( doomMusic );
|
||||||
|
@ -939,13 +1019,15 @@ DWORD WINAPI I_LoadSong( LPVOID songname ) {
|
||||||
I_PlaySong
|
I_PlaySong
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_PlaySong( const char *songname, int looping)
|
void I_PlaySong( const char* songname, int looping )
|
||||||
{
|
{
|
||||||
if ( !Music_initialized ) {
|
if( !Music_initialized )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pMusicSourceVoice != NULL ) {
|
if( pMusicSourceVoice != NULL )
|
||||||
|
{
|
||||||
// Stop the voice and flush packets before freeing the musicBuffer
|
// Stop the voice and flush packets before freeing the musicBuffer
|
||||||
pMusicSourceVoice->Stop();
|
pMusicSourceVoice->Stop();
|
||||||
pMusicSourceVoice->FlushSourceBuffers();
|
pMusicSourceVoice->FlushSourceBuffers();
|
||||||
|
@ -954,30 +1036,35 @@ void I_PlaySong( const char *songname, int looping)
|
||||||
// Make sure voice is stopped before we free the buffer
|
// Make sure voice is stopped before we free the buffer
|
||||||
bool isStopped = false;
|
bool isStopped = false;
|
||||||
int d = 0;
|
int d = 0;
|
||||||
while ( !isStopped ) {
|
while( !isStopped )
|
||||||
|
{
|
||||||
XAUDIO2_VOICE_STATE test = {};
|
XAUDIO2_VOICE_STATE test = {};
|
||||||
|
|
||||||
if ( pMusicSourceVoice != NULL ) {
|
if( pMusicSourceVoice != NULL )
|
||||||
|
{
|
||||||
pMusicSourceVoice->GetState( &test );
|
pMusicSourceVoice->GetState( &test );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( test.pCurrentBufferContext == NULL && test.BuffersQueued == 0 ) {
|
if( test.pCurrentBufferContext == NULL && test.BuffersQueued == 0 )
|
||||||
|
{
|
||||||
isStopped = true;
|
isStopped = true;
|
||||||
}
|
}
|
||||||
//I_Printf( "waiting to stop (%d)\n", d++ );
|
//I_Printf( "waiting to stop (%d)\n", d++ );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear old state
|
// Clear old state
|
||||||
if ( musicBuffer != NULL ) {
|
if( musicBuffer != NULL )
|
||||||
|
{
|
||||||
free( musicBuffer );
|
free( musicBuffer );
|
||||||
musicBuffer = NULL;
|
musicBuffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
musicReady = false;
|
musicReady = false;
|
||||||
I_LoadSong( (LPVOID)songname );
|
I_LoadSong( ( LPVOID )songname );
|
||||||
waitingForMusic = true;
|
waitingForMusic = true;
|
||||||
|
|
||||||
if ( DoomLib::GetPlayer() >= 0 ) {
|
if( DoomLib::GetPlayer() >= 0 )
|
||||||
|
{
|
||||||
::g->mus_looping = looping;
|
::g->mus_looping = looping;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -987,21 +1074,26 @@ void I_PlaySong( const char *songname, int looping)
|
||||||
I_UpdateMusic
|
I_UpdateMusic
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_UpdateMusic() {
|
void I_UpdateMusic()
|
||||||
if ( !Music_initialized ) {
|
{
|
||||||
|
if( !Music_initialized )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( waitingForMusic ) {
|
if( waitingForMusic )
|
||||||
|
{
|
||||||
|
|
||||||
if ( musicReady && pMusicSourceVoice != NULL ) {
|
if( musicReady && pMusicSourceVoice != NULL )
|
||||||
|
{
|
||||||
|
|
||||||
if ( musicBuffer ) {
|
if( musicBuffer )
|
||||||
|
{
|
||||||
// Set up packet
|
// Set up packet
|
||||||
XAUDIO2_BUFFER Packet = { 0 };
|
XAUDIO2_BUFFER Packet = { 0 };
|
||||||
Packet.Flags = XAUDIO2_END_OF_STREAM;
|
Packet.Flags = XAUDIO2_END_OF_STREAM;
|
||||||
Packet.AudioBytes = totalBufferSize;
|
Packet.AudioBytes = totalBufferSize;
|
||||||
Packet.pAudioData = (BYTE*)musicBuffer;
|
Packet.pAudioData = ( BYTE* )musicBuffer;
|
||||||
Packet.PlayBegin = 0;
|
Packet.PlayBegin = 0;
|
||||||
Packet.PlayLength = 0;
|
Packet.PlayLength = 0;
|
||||||
Packet.LoopBegin = 0;
|
Packet.LoopBegin = 0;
|
||||||
|
@ -1011,12 +1103,14 @@ void I_UpdateMusic() {
|
||||||
|
|
||||||
// Submit packet
|
// Submit packet
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
if( FAILED( hr = pMusicSourceVoice->SubmitSourceBuffer( &Packet ) ) ) {
|
if( FAILED( hr = pMusicSourceVoice->SubmitSourceBuffer( &Packet ) ) )
|
||||||
|
{
|
||||||
int fail = 1;
|
int fail = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play the source voice
|
// Play the source voice
|
||||||
if( FAILED( hr = pMusicSourceVoice->Start( 0 ) ) ) {
|
if( FAILED( hr = pMusicSourceVoice->Start( 0 ) ) )
|
||||||
|
{
|
||||||
int fail = 1;
|
int fail = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1025,7 +1119,8 @@ void I_UpdateMusic() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pMusicSourceVoice != NULL ) {
|
if( pMusicSourceVoice != NULL )
|
||||||
|
{
|
||||||
// Set the volume
|
// Set the volume
|
||||||
pMusicSourceVoice->SetVolume( x_MusicVolume * GLOBAL_VOLUME_MULTIPLIER );
|
pMusicSourceVoice->SetVolume( x_MusicVolume * GLOBAL_VOLUME_MULTIPLIER );
|
||||||
}
|
}
|
||||||
|
@ -1036,13 +1131,15 @@ void I_UpdateMusic() {
|
||||||
I_PauseSong
|
I_PauseSong
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_PauseSong (int handle)
|
void I_PauseSong( int handle )
|
||||||
{
|
{
|
||||||
if ( !Music_initialized ) {
|
if( !Music_initialized )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pMusicSourceVoice != NULL ) {
|
if( pMusicSourceVoice != NULL )
|
||||||
|
{
|
||||||
// Stop the music source voice
|
// Stop the music source voice
|
||||||
pMusicSourceVoice->Stop( 0 );
|
pMusicSourceVoice->Stop( 0 );
|
||||||
}
|
}
|
||||||
|
@ -1053,14 +1150,16 @@ void I_PauseSong (int handle)
|
||||||
I_ResumeSong
|
I_ResumeSong
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_ResumeSong (int handle)
|
void I_ResumeSong( int handle )
|
||||||
{
|
{
|
||||||
if ( !Music_initialized ) {
|
if( !Music_initialized )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop the music source voice
|
// Stop the music source voice
|
||||||
if ( pMusicSourceVoice != NULL ) {
|
if( pMusicSourceVoice != NULL )
|
||||||
|
{
|
||||||
pMusicSourceVoice->Start( 0 );
|
pMusicSourceVoice->Start( 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1070,14 +1169,16 @@ void I_ResumeSong (int handle)
|
||||||
I_StopSong
|
I_StopSong
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_StopSong(int handle)
|
void I_StopSong( int handle )
|
||||||
{
|
{
|
||||||
if ( !Music_initialized ) {
|
if( !Music_initialized )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop the music source voice
|
// Stop the music source voice
|
||||||
if ( pMusicSourceVoice != NULL ) {
|
if( pMusicSourceVoice != NULL )
|
||||||
|
{
|
||||||
pMusicSourceVoice->Stop( 0 );
|
pMusicSourceVoice->Stop( 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1087,7 +1188,7 @@ void I_StopSong(int handle)
|
||||||
I_UnRegisterSong
|
I_UnRegisterSong
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
void I_UnRegisterSong(int handle)
|
void I_UnRegisterSong( int handle )
|
||||||
{
|
{
|
||||||
// does nothing
|
// does nothing
|
||||||
}
|
}
|
||||||
|
@ -1097,7 +1198,7 @@ void I_UnRegisterSong(int handle)
|
||||||
I_RegisterSong
|
I_RegisterSong
|
||||||
======================
|
======================
|
||||||
*/
|
*/
|
||||||
int I_RegisterSong(void* data, int length)
|
int I_RegisterSong( void* data, int length )
|
||||||
{
|
{
|
||||||
// does nothing
|
// does nothing
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -45,7 +45,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "i_system.h"
|
#pragma implementation "i_system.h"
|
||||||
#endif
|
#endif
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
|
|
||||||
|
@ -55,15 +55,15 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ticcmd_t* I_BaseTiccmd(void)
|
ticcmd_t* I_BaseTiccmd( void )
|
||||||
{
|
{
|
||||||
return &::g->emptycmd;
|
return &::g->emptycmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int I_GetHeapSize (void)
|
int I_GetHeapSize( void )
|
||||||
{
|
{
|
||||||
return ::g->mb_used*1024*1024;
|
return ::g->mb_used * 1024 * 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ int I_GetHeapSize (void)
|
||||||
// I_GetTime
|
// I_GetTime
|
||||||
// returns time in 1/70th second tics
|
// returns time in 1/70th second tics
|
||||||
//
|
//
|
||||||
int I_GetTime (void)
|
int I_GetTime( void )
|
||||||
{
|
{
|
||||||
return ::g->current_time;
|
return ::g->current_time;
|
||||||
}
|
}
|
||||||
|
@ -86,39 +86,39 @@ void I_SetTime( int time_in )
|
||||||
//
|
//
|
||||||
// I_Init
|
// I_Init
|
||||||
//
|
//
|
||||||
void I_Init (void)
|
void I_Init( void )
|
||||||
{
|
{
|
||||||
I_InitSound();
|
I_InitSound();
|
||||||
// I_InitGraphics();
|
// I_InitGraphics();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// I_Quit
|
// I_Quit
|
||||||
//
|
//
|
||||||
void I_Quit (void)
|
void I_Quit( void )
|
||||||
{
|
{
|
||||||
D_QuitNetGame ();
|
D_QuitNetGame();
|
||||||
I_ShutdownSound();
|
I_ShutdownSound();
|
||||||
I_ShutdownMusic();
|
I_ShutdownMusic();
|
||||||
M_SaveDefaults ();
|
M_SaveDefaults();
|
||||||
I_ShutdownGraphics();
|
I_ShutdownGraphics();
|
||||||
// exit(0);
|
// exit(0);
|
||||||
|
|
||||||
// Exceptions disabled by default on PS3
|
// Exceptions disabled by default on PS3
|
||||||
// throw;
|
// throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_WaitVBL(int count)
|
void I_WaitVBL( int count )
|
||||||
{
|
{
|
||||||
// PS3 fixme
|
// PS3 fixme
|
||||||
//Sleep(0);
|
//Sleep(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_BeginRead(void)
|
void I_BeginRead( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_EndRead(void)
|
void I_EndRead( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,56 +126,59 @@ void I_EndRead(void)
|
||||||
// I_Error
|
// I_Error
|
||||||
//
|
//
|
||||||
extern bool debugOutput;
|
extern bool debugOutput;
|
||||||
void I_Printf(const char* msg, ...)
|
void I_Printf( const char* msg, ... )
|
||||||
{
|
{
|
||||||
char pmsg[1024];
|
char pmsg[1024];
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
|
|
||||||
// Message first.
|
// Message first.
|
||||||
if( debugOutput ) {
|
if( debugOutput )
|
||||||
va_start (argptr,msg);
|
{
|
||||||
vsprintf (pmsg, msg, argptr);
|
va_start( argptr, msg );
|
||||||
|
vsprintf( pmsg, msg, argptr );
|
||||||
|
|
||||||
safeOutputDebug(pmsg);
|
safeOutputDebug( pmsg );
|
||||||
|
|
||||||
va_end (argptr);
|
va_end( argptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void I_PrintfE(const char* msg, ...)
|
void I_PrintfE( const char* msg, ... )
|
||||||
{
|
{
|
||||||
char pmsg[1024];
|
char pmsg[1024];
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
|
|
||||||
// Message first.
|
// Message first.
|
||||||
if( debugOutput ) {
|
if( debugOutput )
|
||||||
va_start (argptr,msg);
|
{
|
||||||
vsprintf (pmsg, msg, argptr);
|
va_start( argptr, msg );
|
||||||
|
vsprintf( pmsg, msg, argptr );
|
||||||
|
|
||||||
safeOutputDebug("ERROR: ");
|
safeOutputDebug( "ERROR: " );
|
||||||
safeOutputDebug(pmsg);
|
safeOutputDebug( pmsg );
|
||||||
|
|
||||||
va_end (argptr);
|
va_end( argptr );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_Error(const char *error, ...)
|
void I_Error( const char* error, ... )
|
||||||
{
|
{
|
||||||
const int ERROR_MSG_SIZE = 1024;
|
const int ERROR_MSG_SIZE = 1024;
|
||||||
char error_msg[ERROR_MSG_SIZE];
|
char error_msg[ERROR_MSG_SIZE];
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
|
|
||||||
// Message first.
|
// Message first.
|
||||||
if( debugOutput ) {
|
if( debugOutput )
|
||||||
va_start (argptr,error);
|
{
|
||||||
idStr::vsnPrintf (error_msg, ERROR_MSG_SIZE, error, argptr);
|
va_start( argptr, error );
|
||||||
|
idStr::vsnPrintf( error_msg, ERROR_MSG_SIZE, error, argptr );
|
||||||
|
|
||||||
safeOutputDebug("Error: ");
|
safeOutputDebug( "Error: " );
|
||||||
safeOutputDebug(error_msg);
|
safeOutputDebug( error_msg );
|
||||||
safeOutputDebug("\n");
|
safeOutputDebug( "\n" );
|
||||||
|
|
||||||
va_end (argptr);
|
va_end( argptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
// CRASH DUMP - enable this to get extra info on error from crash dumps
|
// CRASH DUMP - enable this to get extra info on error from crash dumps
|
||||||
|
|
|
@ -33,16 +33,16 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Called by DoomMain.
|
// Called by DoomMain.
|
||||||
void I_Init (void);
|
void I_Init( void );
|
||||||
|
|
||||||
// Called by D_DoomLoop,
|
// Called by D_DoomLoop,
|
||||||
// returns current time in tics.
|
// returns current time in tics.
|
||||||
int I_GetTime (void);
|
int I_GetTime( void );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -53,7 +53,7 @@ int I_GetTime (void);
|
||||||
// are performed here (joystick reading).
|
// are performed here (joystick reading).
|
||||||
// Can call D_PostEvent.
|
// Can call D_PostEvent.
|
||||||
//
|
//
|
||||||
void I_StartFrame (void);
|
void I_StartFrame( void );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -71,17 +71,17 @@ void I_StartFrame (void);
|
||||||
// or calls a loadable driver to build it.
|
// or calls a loadable driver to build it.
|
||||||
// This ticcmd will then be modified by the gameloop
|
// This ticcmd will then be modified by the gameloop
|
||||||
// for normal input.
|
// for normal input.
|
||||||
ticcmd_t* I_BaseTiccmd (void);
|
ticcmd_t* I_BaseTiccmd( void );
|
||||||
|
|
||||||
|
|
||||||
// Called by M_Responder when quit is selected.
|
// Called by M_Responder when quit is selected.
|
||||||
// Clean exit, displays sell blurb.
|
// Clean exit, displays sell blurb.
|
||||||
void I_Quit (void);
|
void I_Quit( void );
|
||||||
|
|
||||||
|
|
||||||
void I_Error (const char *error, ...);
|
void I_Error( const char* error, ... );
|
||||||
void I_Printf(const char *error, ...);
|
void I_Printf( const char* error, ... );
|
||||||
void I_PrintfE(const char *error, ...);
|
void I_PrintfE( const char* error, ... );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,42 +34,42 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Called by D_DoomMain,
|
// Called by D_DoomMain,
|
||||||
// determines the hardware configuration
|
// determines the hardware configuration
|
||||||
// and sets up the video mode
|
// and sets up the video mode
|
||||||
void I_InitGraphics (void);
|
void I_InitGraphics( void );
|
||||||
|
|
||||||
|
|
||||||
void I_ShutdownGraphics(void);
|
void I_ShutdownGraphics( void );
|
||||||
|
|
||||||
// Takes full 8 bit values.
|
// Takes full 8 bit values.
|
||||||
void I_SetPalette (byte* palette);
|
void I_SetPalette( byte* palette );
|
||||||
|
|
||||||
void I_UpdateNoBlit (void);
|
void I_UpdateNoBlit( void );
|
||||||
void I_FinishUpdate (void);
|
void I_FinishUpdate( void );
|
||||||
|
|
||||||
// Wait for vertical retrace or pause a bit.
|
// Wait for vertical retrace or pause a bit.
|
||||||
void I_WaitVBL(int count);
|
void I_WaitVBL( int count );
|
||||||
|
|
||||||
void I_ReadScreen (byte* scr);
|
void I_ReadScreen( byte* scr );
|
||||||
|
|
||||||
void I_BeginRead (void);
|
void I_BeginRead( void );
|
||||||
void I_EndRead (void);
|
void I_EndRead( void );
|
||||||
|
|
||||||
void I_InitInput (void);
|
void I_InitInput( void );
|
||||||
|
|
||||||
void I_ShutdownInput() ;
|
void I_ShutdownInput() ;
|
||||||
void I_InputFrame();
|
void I_InputFrame();
|
||||||
|
|
||||||
void I_UpdateControllerState(void);
|
void I_UpdateControllerState( void );
|
||||||
struct controller_t;
|
struct controller_t;
|
||||||
int I_PollMouseInputEvents( controller_t * ) ;
|
int I_PollMouseInputEvents( controller_t* ) ;
|
||||||
int I_ReturnMouseInputEvent( const int n, event_t* e);
|
int I_ReturnMouseInputEvent( const int n, event_t* e );
|
||||||
int I_PollJoystickInputEvents( controller_t * ) ;
|
int I_PollJoystickInputEvents( controller_t* ) ;
|
||||||
int I_ReturnJoystickInputEvent( const int n, event_t* e);
|
int I_ReturnJoystickInputEvent( const int n, event_t* e );
|
||||||
void I_EndJoystickInputEvents();
|
void I_EndJoystickInputEvents();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -50,9 +50,9 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void I_ShutdownGraphics(void)
|
void I_ShutdownGraphics( void )
|
||||||
{
|
{
|
||||||
// VVTODO: Shutdown Graphics
|
// VVTODO: Shutdown Graphics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,22 +60,28 @@ void I_ShutdownGraphics(void)
|
||||||
//
|
//
|
||||||
// I_StartFrame
|
// I_StartFrame
|
||||||
//
|
//
|
||||||
void I_StartFrame (void)
|
void I_StartFrame( void )
|
||||||
{
|
{
|
||||||
// er?
|
// er?
|
||||||
}
|
}
|
||||||
|
|
||||||
static void I_CombineMouseEvent(const event_t* in, event_t* out)
|
static void I_CombineMouseEvent( const event_t* in, event_t* out )
|
||||||
{
|
{
|
||||||
if (fabs((float)in->data1) > fabs((float)out->data1))
|
if( fabs( ( float )in->data1 ) > fabs( ( float )out->data1 ) )
|
||||||
|
{
|
||||||
out->data1 = in->data1;
|
out->data1 = in->data1;
|
||||||
if (fabs((float)in->data2) > fabs((float)out->data2))
|
}
|
||||||
|
if( fabs( ( float )in->data2 ) > fabs( ( float )out->data2 ) )
|
||||||
|
{
|
||||||
out->data2 = in->data2;
|
out->data2 = in->data2;
|
||||||
if (fabs((float)in->data3) > fabs((float)out->data3))
|
}
|
||||||
|
if( fabs( ( float )in->data3 ) > fabs( ( float )out->data3 ) )
|
||||||
|
{
|
||||||
out->data3 = in->data3;
|
out->data3 = in->data3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_GetEvents( controller_t *controller )
|
void I_GetEvents( controller_t* controller )
|
||||||
{
|
{
|
||||||
event_t e_mouse, e_joystick;
|
event_t e_mouse, e_joystick;
|
||||||
int numEvents;
|
int numEvents;
|
||||||
|
@ -86,56 +92,65 @@ void I_GetEvents( controller_t *controller )
|
||||||
e_joystick.data1 = e_joystick.data2 = e_joystick.data3 = 0;
|
e_joystick.data1 = e_joystick.data2 = e_joystick.data3 = 0;
|
||||||
|
|
||||||
numEvents = I_PollMouseInputEvents( controller );
|
numEvents = I_PollMouseInputEvents( controller );
|
||||||
if (numEvents)
|
if( numEvents )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
event_t e;
|
event_t e;
|
||||||
|
|
||||||
// right thumb stick
|
// right thumb stick
|
||||||
for (i = 0; i < numEvents; ++i)
|
for( i = 0; i < numEvents; ++i )
|
||||||
{
|
{
|
||||||
I_ReturnMouseInputEvent(i, &e);
|
I_ReturnMouseInputEvent( i, &e );
|
||||||
if (e.type == ev_mouse)
|
if( e.type == ev_mouse )
|
||||||
I_CombineMouseEvent(&e, &e_mouse);
|
{
|
||||||
else if (e.type == ev_joystick)
|
I_CombineMouseEvent( &e, &e_mouse );
|
||||||
I_CombineMouseEvent(&e, &e_joystick);
|
}
|
||||||
}
|
else if( e.type == ev_joystick )
|
||||||
}
|
{
|
||||||
|
I_CombineMouseEvent( &e, &e_joystick );
|
||||||
numEvents = I_PollJoystickInputEvents( controller );
|
|
||||||
if (numEvents)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
event_t e;
|
|
||||||
for (i = 0; i < numEvents; ++i)
|
|
||||||
{
|
|
||||||
I_ReturnJoystickInputEvent(i, &e);
|
|
||||||
if (e.type == ev_keydown || e.type == ev_keyup) {
|
|
||||||
D_PostEvent(&e);
|
|
||||||
} else if (e.type == ev_joystick) {
|
|
||||||
I_CombineMouseEvent(&e, &e_joystick);
|
|
||||||
} else if (e.type == ev_mouse) {
|
|
||||||
I_CombineMouseEvent(&e, &e_mouse);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
D_PostEvent(&e_mouse);
|
numEvents = I_PollJoystickInputEvents( controller );
|
||||||
D_PostEvent(&e_joystick);
|
if( numEvents )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
event_t e;
|
||||||
|
for( i = 0; i < numEvents; ++i )
|
||||||
|
{
|
||||||
|
I_ReturnJoystickInputEvent( i, &e );
|
||||||
|
if( e.type == ev_keydown || e.type == ev_keyup )
|
||||||
|
{
|
||||||
|
D_PostEvent( &e );
|
||||||
|
}
|
||||||
|
else if( e.type == ev_joystick )
|
||||||
|
{
|
||||||
|
I_CombineMouseEvent( &e, &e_joystick );
|
||||||
|
}
|
||||||
|
else if( e.type == ev_mouse )
|
||||||
|
{
|
||||||
|
I_CombineMouseEvent( &e, &e_mouse );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
D_PostEvent( &e_mouse );
|
||||||
|
D_PostEvent( &e_joystick );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// I_UpdateNoBlit
|
// I_UpdateNoBlit
|
||||||
//
|
//
|
||||||
void I_UpdateNoBlit (void)
|
void I_UpdateNoBlit( void )
|
||||||
{
|
{
|
||||||
// what is this?
|
// what is this?
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// I_FinishUpdate
|
// I_FinishUpdate
|
||||||
//
|
//
|
||||||
void I_FinishUpdate (void)
|
void I_FinishUpdate( void )
|
||||||
{
|
{
|
||||||
// DHM - These buffers are not used
|
// DHM - These buffers are not used
|
||||||
}
|
}
|
||||||
|
@ -144,18 +159,19 @@ void I_FinishUpdate (void)
|
||||||
//
|
//
|
||||||
// I_ReadScreen
|
// I_ReadScreen
|
||||||
//
|
//
|
||||||
void I_ReadScreen (byte* scr)
|
void I_ReadScreen( byte* scr )
|
||||||
{
|
{
|
||||||
memcpy(scr, ::g->screens[0], SCREENWIDTH*SCREENHEIGHT);
|
memcpy( scr, ::g->screens[0], SCREENWIDTH * SCREENHEIGHT );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned int I_PackColor( unsigned int a, unsigned int r, unsigned int g, unsigned int b ) {
|
inline unsigned int I_PackColor( unsigned int a, unsigned int r, unsigned int g, unsigned int b )
|
||||||
|
{
|
||||||
unsigned int color = 0;
|
unsigned int color = 0;
|
||||||
|
|
||||||
color |= (r & 255) << 24;
|
color |= ( r & 255 ) << 24;
|
||||||
color |= (g & 255) << 16;
|
color |= ( g & 255 ) << 16;
|
||||||
color |= (b & 255) << 8;
|
color |= ( b & 255 ) << 8;
|
||||||
color |= (a & 255);
|
color |= ( a & 255 );
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
@ -163,19 +179,19 @@ inline unsigned int I_PackColor( unsigned int a, unsigned int r, unsigned int g,
|
||||||
//
|
//
|
||||||
// I_SetPalette
|
// I_SetPalette
|
||||||
//
|
//
|
||||||
void I_SetPalette (byte* palette)
|
void I_SetPalette( byte* palette )
|
||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// set the X colormap entries
|
// set the X colormap entries
|
||||||
for (i=0 ; i<256 ; i++)
|
for( i = 0 ; i < 256 ; i++ )
|
||||||
{
|
{
|
||||||
int r,b,g;
|
int r, b, g;
|
||||||
r = gammatable[::g->usegamma][*palette++];
|
r = gammatable[::g->usegamma][*palette++];
|
||||||
g = gammatable[::g->usegamma][*palette++];
|
g = gammatable[::g->usegamma][*palette++];
|
||||||
b = gammatable[::g->usegamma][*palette++];
|
b = gammatable[::g->usegamma][*palette++];
|
||||||
::g->XColorMap[i] = I_PackColor(0xff, r, g, b);
|
::g->XColorMap[i] = I_PackColor( 0xff, r, g, b );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -42,17 +42,19 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// in the program's command line arguments.
|
// in the program's command line arguments.
|
||||||
// Returns the argument number (1 to argc-1)
|
// Returns the argument number (1 to argc-1)
|
||||||
// or 0 if not present
|
// or 0 if not present
|
||||||
int M_CheckParm (const char *check)
|
int M_CheckParm( const char* check )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 1; i < ::g->myargc; i++)
|
for( i = 1; i < ::g->myargc; i++ )
|
||||||
{
|
{
|
||||||
if ( !idStr::Icmp(check, ::g->myargv[i]) )
|
if( !idStr::Icmp( check, ::g->myargv[i] ) )
|
||||||
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ extern char** myargv;
|
||||||
|
|
||||||
// Returns the position of the given parameter
|
// Returns the position of the given parameter
|
||||||
// in the arg list (0 if not found).
|
// in the arg list (0 if not found).
|
||||||
int M_CheckParm (const char* check);
|
int M_CheckParm( const char* check );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "m_bbox.h"
|
#pragma implementation "m_bbox.h"
|
||||||
#endif
|
#endif
|
||||||
#include "m_bbox.h"
|
#include "m_bbox.h"
|
||||||
|
|
||||||
|
@ -39,10 +39,10 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void M_ClearBox (fixed_t *box)
|
void M_ClearBox( fixed_t* box )
|
||||||
{
|
{
|
||||||
box[BOXTOP] = box[BOXRIGHT] = MININT;
|
box[BOXTOP] = box[BOXRIGHT] = MININT;
|
||||||
box[BOXBOTTOM] = box[BOXLEFT] = MAXINT;
|
box[BOXBOTTOM] = box[BOXLEFT] = MAXINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -51,14 +51,22 @@ M_AddToBox
|
||||||
fixed_t x,
|
fixed_t x,
|
||||||
fixed_t y )
|
fixed_t y )
|
||||||
{
|
{
|
||||||
if (x<box[BOXLEFT])
|
if( x < box[BOXLEFT] )
|
||||||
box[BOXLEFT] = x;
|
{
|
||||||
else if (x>box[BOXRIGHT])
|
box[BOXLEFT] = x;
|
||||||
box[BOXRIGHT] = x;
|
}
|
||||||
if (y<box[BOXBOTTOM])
|
else if( x > box[BOXRIGHT] )
|
||||||
box[BOXBOTTOM] = y;
|
{
|
||||||
else if (y>box[BOXTOP])
|
box[BOXRIGHT] = x;
|
||||||
box[BOXTOP] = y;
|
}
|
||||||
|
if( y < box[BOXBOTTOM] )
|
||||||
|
{
|
||||||
|
box[BOXBOTTOM] = y;
|
||||||
|
}
|
||||||
|
else if( y > box[BOXTOP] )
|
||||||
|
{
|
||||||
|
box[BOXTOP] = y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,14 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// Bounding box coordinate storage.
|
// Bounding box coordinate storage.
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
BOXTOP,
|
BOXTOP,
|
||||||
BOXBOTTOM,
|
BOXBOTTOM,
|
||||||
BOXLEFT,
|
BOXLEFT,
|
||||||
BOXRIGHT
|
BOXRIGHT
|
||||||
}; // bbox coordinates
|
}; // bbox coordinates
|
||||||
|
|
||||||
// Bounding box functions.
|
// Bounding box functions.
|
||||||
void M_ClearBox (fixed_t* box);
|
void M_ClearBox( fixed_t* box );
|
||||||
|
|
||||||
void
|
void
|
||||||
M_AddToBox
|
M_AddToBox
|
||||||
|
|
|
@ -47,47 +47,66 @@ cht_CheckCheat
|
||||||
char key )
|
char key )
|
||||||
{
|
{
|
||||||
return 0; // ALAN : Checking the cheats CRASHES??
|
return 0; // ALAN : Checking the cheats CRASHES??
|
||||||
int i;
|
int i;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (::g->firsttime)
|
if( ::g->firsttime )
|
||||||
{
|
{
|
||||||
::g->firsttime = 0;
|
::g->firsttime = 0;
|
||||||
for (i=0;i<256;i++) ::g->cheat_xlate_table[i] = SCRAMBLE(i);
|
for( i = 0; i < 256; i++ )
|
||||||
}
|
{
|
||||||
|
::g->cheat_xlate_table[i] = SCRAMBLE( i );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!cht->p)
|
if( !cht->p )
|
||||||
{
|
{
|
||||||
cht->p = ::g->cheatbuffer + ::g->usedcheatbuffer;
|
cht->p = ::g->cheatbuffer + ::g->usedcheatbuffer;
|
||||||
int isize = 0;
|
int isize = 0;
|
||||||
while(cht->sequence[isize] != 0xff) cht->p[isize] = cht->sequence[isize];
|
while( cht->sequence[isize] != 0xff )
|
||||||
cht->p[isize] = 0xff;
|
{
|
||||||
::g->usedcheatbuffer += isize;
|
cht->p[isize] = cht->sequence[isize];
|
||||||
::g->usedcheatbuffer ++;
|
}
|
||||||
}
|
cht->p[isize] = 0xff;
|
||||||
|
::g->usedcheatbuffer += isize;
|
||||||
|
::g->usedcheatbuffer ++;
|
||||||
|
}
|
||||||
|
|
||||||
if (*cht->p == 0)
|
if( *cht->p == 0 )
|
||||||
*(cht->p++) = key;
|
{
|
||||||
else if
|
*( cht->p++ ) = key;
|
||||||
(::g->cheat_xlate_table[(unsigned char)key] == *cht->p) cht->p++;
|
}
|
||||||
else
|
else if
|
||||||
{
|
( ::g->cheat_xlate_table[( unsigned char )key] == *cht->p )
|
||||||
int isize = 0;
|
{
|
||||||
while(cht->sequence[isize] != 0xff) cht->p[isize] = cht->sequence[isize];
|
cht->p++;
|
||||||
cht->p[isize] = 0xff;
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
int isize = 0;
|
||||||
|
while( cht->sequence[isize] != 0xff )
|
||||||
|
{
|
||||||
|
cht->p[isize] = cht->sequence[isize];
|
||||||
|
}
|
||||||
|
cht->p[isize] = 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
if (*cht->p == 1)
|
if( *cht->p == 1 )
|
||||||
cht->p++;
|
{
|
||||||
else if (*cht->p == 0xff) // end of sequence character
|
cht->p++;
|
||||||
{
|
}
|
||||||
int isize = 0;
|
else if( *cht->p == 0xff ) // end of sequence character
|
||||||
while(cht->sequence[isize] != 0xff) cht->p[isize] = cht->sequence[isize];
|
{
|
||||||
cht->p[isize] = 0xff;
|
int isize = 0;
|
||||||
rc = 1;
|
while( cht->sequence[isize] != 0xff )
|
||||||
}
|
{
|
||||||
|
cht->p[isize] = cht->sequence[isize];
|
||||||
|
}
|
||||||
|
cht->p[isize] = 0xff;
|
||||||
|
rc = 1;
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -97,28 +116,33 @@ cht_GetParam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
unsigned char pb[16];
|
unsigned char pb[16];
|
||||||
unsigned char *p;
|
unsigned char* p;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
|
||||||
int isize = 0;
|
int isize = 0;
|
||||||
|
|
||||||
while(cht->sequence[isize] != 0xff) pb[isize] = cht->sequence[isize];
|
while( cht->sequence[isize] != 0xff )
|
||||||
|
{
|
||||||
|
pb[isize] = cht->sequence[isize];
|
||||||
|
}
|
||||||
pb[isize] = 0xff;
|
pb[isize] = 0xff;
|
||||||
p = &pb[0];
|
p = &pb[0];
|
||||||
|
|
||||||
while (*(p++) != 1);
|
while( *( p++ ) != 1 );
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
c = *p;
|
c = *p;
|
||||||
*(buffer++) = c;
|
*( buffer++ ) = c;
|
||||||
*(p++) = 0;
|
*( p++ ) = 0;
|
||||||
}
|
}
|
||||||
while (c && *p!=0xff );
|
while( c && *p != 0xff );
|
||||||
|
|
||||||
if (*p==0xff)
|
if( *p == 0xff )
|
||||||
*buffer = 0;
|
{
|
||||||
|
*buffer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
struct cheatseq_t
|
struct cheatseq_t
|
||||||
{
|
{
|
||||||
cheatseq_t() {}
|
cheatseq_t() {}
|
||||||
cheatseq_t( const unsigned char *seq, unsigned char *pin ) : sequence( seq ), p( pin ) {}
|
cheatseq_t( const unsigned char* seq, unsigned char* pin ) : sequence( seq ), p( pin ) {}
|
||||||
const unsigned char* sequence;
|
const unsigned char* sequence;
|
||||||
unsigned char* p;
|
unsigned char* p;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "Precompiled.h"
|
#include "Precompiled.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "m_fixed.h"
|
#pragma implementation "m_fixed.h"
|
||||||
#endif
|
#endif
|
||||||
#include "m_fixed.h"
|
#include "m_fixed.h"
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ FixedMul
|
||||||
( fixed_t a,
|
( fixed_t a,
|
||||||
fixed_t b )
|
fixed_t b )
|
||||||
{
|
{
|
||||||
return fixed_t( ((long long) a * (long long) b) >> FRACBITS );
|
return fixed_t( ( ( long long ) a * ( long long ) b ) >> FRACBITS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,9 +62,11 @@ FixedDiv
|
||||||
( fixed_t a,
|
( fixed_t a,
|
||||||
fixed_t b )
|
fixed_t b )
|
||||||
{
|
{
|
||||||
if ( (abs(a)>>14) >= abs(b))
|
if( ( abs( a ) >> 14 ) >= abs( b ) )
|
||||||
return (a^b)<0 ? MININT : MAXINT;
|
{
|
||||||
return FixedDiv2 (a,b);
|
return ( a ^ b ) < 0 ? MININT : MAXINT;
|
||||||
|
}
|
||||||
|
return FixedDiv2( a, b );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,17 +77,19 @@ FixedDiv2
|
||||||
fixed_t b )
|
fixed_t b )
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
long long c;
|
long long c;
|
||||||
c = ((long long)a<<16) / ((long long)b);
|
c = ( ( long long )a << 16 ) / ( ( long long )b );
|
||||||
return (fixed_t) c;
|
return ( fixed_t ) c;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
double c;
|
double c;
|
||||||
|
|
||||||
c = ((double)a) / ((double)b) * FRACUNIT;
|
c = ( ( double )a ) / ( ( double )b ) * FRACUNIT;
|
||||||
|
|
||||||
if (c >= 2147483648.0 || c < -2147483648.0)
|
if( c >= 2147483648.0 || c < -2147483648.0 )
|
||||||
I_Error("FixedDiv: divide by zero");
|
{
|
||||||
return (fixed_t) c;
|
I_Error( "FixedDiv: divide by zero" );
|
||||||
|
}
|
||||||
|
return ( fixed_t ) c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
typedef int fixed_t;
|
typedef int fixed_t;
|
||||||
|
|
||||||
fixed_t FixedMul (fixed_t a, fixed_t b);
|
fixed_t FixedMul( fixed_t a, fixed_t b );
|
||||||
fixed_t FixedDiv (fixed_t a, fixed_t b);
|
fixed_t FixedDiv( fixed_t a, fixed_t b );
|
||||||
fixed_t FixedDiv2 (fixed_t a, fixed_t b);
|
fixed_t FixedDiv2( fixed_t a, fixed_t b );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -41,24 +41,24 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// Even when the menu is not displayed,
|
// Even when the menu is not displayed,
|
||||||
// this can resize the view and change game parameters.
|
// this can resize the view and change game parameters.
|
||||||
// Does all the real work of the menu interaction.
|
// Does all the real work of the menu interaction.
|
||||||
qboolean M_Responder (event_t *ev);
|
qboolean M_Responder( event_t* ev );
|
||||||
|
|
||||||
|
|
||||||
// Called by main loop,
|
// Called by main loop,
|
||||||
// only used for menu (skull cursor) animation.
|
// only used for menu (skull cursor) animation.
|
||||||
void M_Ticker (void);
|
void M_Ticker( void );
|
||||||
|
|
||||||
// Called by main loop,
|
// Called by main loop,
|
||||||
// draws the menus directly into the screen buffer.
|
// draws the menus directly into the screen buffer.
|
||||||
void M_Drawer (void);
|
void M_Drawer( void );
|
||||||
|
|
||||||
// Called by D_DoomMain,
|
// Called by D_DoomMain,
|
||||||
// loads the config file.
|
// loads the config file.
|
||||||
void M_Init (void);
|
void M_Init( void );
|
||||||
|
|
||||||
// Called by intro code to force menu up upon a keypress,
|
// Called by intro code to force menu up upon a keypress,
|
||||||
// does nothing if menu is already up.
|
// does nothing if menu is already up.
|
||||||
void M_StartControlPanel (void);
|
void M_StartControlPanel( void );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -75,51 +75,62 @@ M_DrawText
|
||||||
qboolean direct,
|
qboolean direct,
|
||||||
char* string )
|
char* string )
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int w;
|
int w;
|
||||||
|
|
||||||
while (*string)
|
while( *string )
|
||||||
{
|
|
||||||
c = toupper(*string) - HU_FONTSTART;
|
|
||||||
string++;
|
|
||||||
if (c < 0 || c> HU_FONTSIZE)
|
|
||||||
{
|
{
|
||||||
x += 4;
|
c = toupper( *string ) - HU_FONTSTART;
|
||||||
continue;
|
string++;
|
||||||
|
if( c < 0 || c > HU_FONTSIZE )
|
||||||
|
{
|
||||||
|
x += 4;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
w = SHORT( ::g->hu_font[c]->width );
|
||||||
|
if( x + w > SCREENWIDTH )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( direct )
|
||||||
|
{
|
||||||
|
V_DrawPatchDirect( x, y, 0, ::g->hu_font[c] );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
V_DrawPatch( x, y, 0, ::g->hu_font[c] );
|
||||||
|
}
|
||||||
|
x += w;
|
||||||
}
|
}
|
||||||
|
|
||||||
w = SHORT (::g->hu_font[c]->width);
|
return x;
|
||||||
if (x+w > SCREENWIDTH)
|
|
||||||
break;
|
|
||||||
if (direct)
|
|
||||||
V_DrawPatchDirect(x, y, 0, ::g->hu_font[c]);
|
|
||||||
else
|
|
||||||
V_DrawPatch(x, y, 0, ::g->hu_font[c]);
|
|
||||||
x+=w;
|
|
||||||
}
|
|
||||||
|
|
||||||
return x;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// M_WriteFile
|
// M_WriteFile
|
||||||
//
|
//
|
||||||
bool M_WriteFile ( char const* name, void* source, int length ) {
|
bool M_WriteFile( char const* name, void* source, int length )
|
||||||
|
{
|
||||||
|
|
||||||
idFile * handle = NULL;
|
idFile* handle = NULL;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
handle = fileSystem->OpenFileWrite( name, "fs_savepath" );
|
handle = fileSystem->OpenFileWrite( name, "fs_savepath" );
|
||||||
|
|
||||||
if (handle == NULL )
|
if( handle == NULL )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
count = handle->Write( source, length );
|
count = handle->Write( source, length );
|
||||||
fileSystem->CloseFile( handle );
|
fileSystem->CloseFile( handle );
|
||||||
|
|
||||||
if (count < length)
|
if( count < length )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -128,24 +139,27 @@ bool M_WriteFile ( char const* name, void* source, int length ) {
|
||||||
//
|
//
|
||||||
// M_ReadFile
|
// M_ReadFile
|
||||||
//
|
//
|
||||||
int M_ReadFile ( char const* name, byte** buffer ) {
|
int M_ReadFile( char const* name, byte** buffer )
|
||||||
|
{
|
||||||
int count, length;
|
int count, length;
|
||||||
idFile * handle = NULL;
|
idFile* handle = NULL;
|
||||||
byte *buf;
|
byte* buf;
|
||||||
|
|
||||||
handle = fileSystem->OpenFileRead( name, false );
|
handle = fileSystem->OpenFileRead( name, false );
|
||||||
|
|
||||||
if (handle == NULL ) {
|
if( handle == NULL )
|
||||||
I_Error ("Couldn't read file %s", name);
|
{
|
||||||
|
I_Error( "Couldn't read file %s", name );
|
||||||
}
|
}
|
||||||
|
|
||||||
length = handle->Length();
|
length = handle->Length();
|
||||||
|
|
||||||
buf = ( byte* )Z_Malloc ( handle->Length(), PU_STATIC, NULL);
|
buf = ( byte* )Z_Malloc( handle->Length(), PU_STATIC, NULL );
|
||||||
count = handle->Read( buf, length );
|
count = handle->Read( buf, length );
|
||||||
|
|
||||||
if (count < length ) {
|
if( count < length )
|
||||||
I_Error ("Couldn't read file %s", name);
|
{
|
||||||
|
I_Error( "Couldn't read file %s", name );
|
||||||
}
|
}
|
||||||
|
|
||||||
fileSystem->CloseFile( handle );
|
fileSystem->CloseFile( handle );
|
||||||
|
@ -209,32 +223,32 @@ extern const char* const temp_chat_macros[];
|
||||||
//
|
//
|
||||||
// M_SaveDefaults
|
// M_SaveDefaults
|
||||||
//
|
//
|
||||||
void M_SaveDefaults (void)
|
void M_SaveDefaults( void )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
int i;
|
int i;
|
||||||
int v;
|
int v;
|
||||||
FILE* f;
|
FILE* f;
|
||||||
|
|
||||||
f = f o pen (::g->defaultfile, "w");
|
f = f o pen (::g->defaultfile, "w");
|
||||||
if (!f)
|
if (!f)
|
||||||
return; // can't write the file, but don't complain
|
return; // can't write the file, but don't complain
|
||||||
|
|
||||||
for (i=0 ; i<::g->numdefaults ; i++)
|
for (i=0 ; i<::g->numdefaults ; i++)
|
||||||
{
|
{
|
||||||
if (::g->defaults[i].defaultvalue > -0xfff
|
if (::g->defaults[i].defaultvalue > -0xfff
|
||||||
&& ::g->defaults[i].defaultvalue < 0xfff)
|
&& ::g->defaults[i].defaultvalue < 0xfff)
|
||||||
{
|
{
|
||||||
v = *::g->defaults[i].location;
|
v = *::g->defaults[i].location;
|
||||||
fprintf (f,"%s\t\t%i\n",::g->defaults[i].name,v);
|
fprintf (f,"%s\t\t%i\n",::g->defaults[i].name,v);
|
||||||
} else {
|
} else {
|
||||||
fprintf (f,"%s\t\t\"%s\"\n",::g->defaults[i].name,
|
fprintf (f,"%s\t\t\"%s\"\n",::g->defaults[i].name,
|
||||||
* (char **) (::g->defaults[i].location));
|
* (char **) (::g->defaults[i].location));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose (f);
|
fclose (f);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -242,71 +256,75 @@ void M_SaveDefaults (void)
|
||||||
// M_LoadDefaults
|
// M_LoadDefaults
|
||||||
//
|
//
|
||||||
|
|
||||||
void M_LoadDefaults (void)
|
void M_LoadDefaults( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
//int len;
|
//int len;
|
||||||
//FILE* f;
|
//FILE* f;
|
||||||
//char def[80];
|
//char def[80];
|
||||||
//char strparm[100];
|
//char strparm[100];
|
||||||
//char* newstring;
|
//char* newstring;
|
||||||
//int parm;
|
//int parm;
|
||||||
//qboolean isstring;
|
//qboolean isstring;
|
||||||
|
|
||||||
// set everything to base values
|
// set everything to base values
|
||||||
::g->numdefaults = sizeof(::g->defaults)/sizeof(::g->defaults[0]);
|
::g->numdefaults = sizeof( ::g->defaults ) / sizeof( ::g->defaults[0] );
|
||||||
for (i=0 ; i < ::g->numdefaults ; i++)
|
for( i = 0 ; i < ::g->numdefaults ; i++ )
|
||||||
|
{
|
||||||
*::g->defaults[i].location = ::g->defaults[i].defaultvalue;
|
*::g->defaults[i].location = ::g->defaults[i].defaultvalue;
|
||||||
|
}
|
||||||
|
|
||||||
// check for a custom default file
|
// check for a custom default file
|
||||||
i = M_CheckParm ("-config");
|
i = M_CheckParm( "-config" );
|
||||||
if (i && i < ::g->myargc-1)
|
if( i && i < ::g->myargc - 1 )
|
||||||
{
|
{
|
||||||
::g->defaultfile = ::g->myargv[i+1];
|
::g->defaultfile = ::g->myargv[i + 1];
|
||||||
I_Printf (" default file: %s\n",::g->defaultfile);
|
I_Printf( " default file: %s\n", ::g->defaultfile );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
::g->defaultfile = ::g->basedefault;
|
::g->defaultfile = ::g->basedefault;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// read the file in, overriding any set ::g->defaults
|
// read the file in, overriding any set ::g->defaults
|
||||||
f = f o pen (::g->defaultfile, "r");
|
f = f o pen (::g->defaultfile, "r");
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
while (!feof(f))
|
while (!feof(f))
|
||||||
{
|
|
||||||
isstring = false;
|
|
||||||
if (fscanf (f, "%79s %[^\n]\n", def, strparm) == 2)
|
|
||||||
{
|
{
|
||||||
if (strparm[0] == '"')
|
isstring = false;
|
||||||
|
if (fscanf (f, "%79s %[^\n]\n", def, strparm) == 2)
|
||||||
{
|
{
|
||||||
// get a string default
|
if (strparm[0] == '"')
|
||||||
isstring = true;
|
|
||||||
len = strlen(strparm);
|
|
||||||
newstring = (char *)DoomLib::Z_Malloc(len, PU_STATIC, 0);
|
|
||||||
strparm[len-1] = 0;
|
|
||||||
strcpy(newstring, strparm+1);
|
|
||||||
}
|
|
||||||
else if (strparm[0] == '0' && strparm[1] == 'x')
|
|
||||||
sscanf(strparm+2, "%x", &parm);
|
|
||||||
else
|
|
||||||
sscanf(strparm, "%i", &parm);
|
|
||||||
|
|
||||||
for (i=0 ; i<::g->numdefaults ; i++)
|
|
||||||
if (!strcmp(def, ::g->defaults[i].name))
|
|
||||||
{
|
{
|
||||||
if (!isstring)
|
// get a string default
|
||||||
*::g->defaults[i].location = parm;
|
isstring = true;
|
||||||
else
|
len = strlen(strparm);
|
||||||
*::g->defaults[i].location = (int) newstring;
|
newstring = (char *)DoomLib::Z_Malloc(len, PU_STATIC, 0);
|
||||||
break;
|
strparm[len-1] = 0;
|
||||||
|
strcpy(newstring, strparm+1);
|
||||||
}
|
}
|
||||||
}
|
else if (strparm[0] == '0' && strparm[1] == 'x')
|
||||||
}
|
sscanf(strparm+2, "%x", &parm);
|
||||||
|
else
|
||||||
|
sscanf(strparm, "%i", &parm);
|
||||||
|
|
||||||
fclose (f);
|
for (i=0 ; i<::g->numdefaults ; i++)
|
||||||
}
|
if (!strcmp(def, ::g->defaults[i].name))
|
||||||
*/
|
{
|
||||||
|
if (!isstring)
|
||||||
|
*::g->defaults[i].location = parm;
|
||||||
|
else
|
||||||
|
*::g->defaults[i].location = (int) newstring;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose (f);
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -335,37 +353,37 @@ WritePCXfile
|
||||||
//
|
//
|
||||||
// M_ScreenShot
|
// M_ScreenShot
|
||||||
//
|
//
|
||||||
void M_ScreenShot (void)
|
void M_ScreenShot( void )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
int i;
|
int i;
|
||||||
byte* linear;
|
byte* linear;
|
||||||
char lbmname[12];
|
char lbmname[12];
|
||||||
|
|
||||||
// munge planar buffer to linear
|
// munge planar buffer to linear
|
||||||
linear = ::g->screens[2];
|
linear = ::g->screens[2];
|
||||||
I_ReadScreen (linear);
|
I_ReadScreen (linear);
|
||||||
|
|
||||||
// find a file name to save it to
|
// find a file name to save it to
|
||||||
strcpy(lbmname,"DOOM00.pcx");
|
strcpy(lbmname,"DOOM00.pcx");
|
||||||
|
|
||||||
for (i=0 ; i<=99 ; i++)
|
for (i=0 ; i<=99 ; i++)
|
||||||
{
|
{
|
||||||
lbmname[4] = i/10 + '0';
|
lbmname[4] = i/10 + '0';
|
||||||
lbmname[5] = i%10 + '0';
|
lbmname[5] = i%10 + '0';
|
||||||
if (_access(lbmname,0) == -1)
|
if (_access(lbmname,0) == -1)
|
||||||
break; // file doesn't exist
|
break; // file doesn't exist
|
||||||
}
|
}
|
||||||
if (i==100)
|
if (i==100)
|
||||||
I_Error ("M_ScreenShot: Couldn't create a PCX");
|
I_Error ("M_ScreenShot: Couldn't create a PCX");
|
||||||
|
|
||||||
// save the pcx file
|
// save the pcx file
|
||||||
WritePCXfile (lbmname, linear,
|
WritePCXfile (lbmname, linear,
|
||||||
SCREENWIDTH, SCREENHEIGHT,
|
SCREENWIDTH, SCREENHEIGHT,
|
||||||
(byte*)W_CacheLumpName ("PLAYPAL",PU_CACHE_SHARED));
|
(byte*)W_CacheLumpName ("PLAYPAL",PU_CACHE_SHARED));
|
||||||
|
|
||||||
::g->players[::g->consoleplayer].message = "screen shot";
|
::g->players[::g->consoleplayer].message = "screen shot";
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,17 +41,17 @@ M_WriteFile
|
||||||
int length );
|
int length );
|
||||||
|
|
||||||
int
|
int
|
||||||
M_ReadFile
|
M_ReadFile
|
||||||
( char const* name,
|
( char const* name,
|
||||||
byte** buffer );
|
byte** buffer );
|
||||||
|
|
||||||
qboolean M_WriteSaveGame( void* source, int length );
|
qboolean M_WriteSaveGame( void* source, int length );
|
||||||
int M_ReadSaveGame ( byte** buffer );
|
int M_ReadSaveGame( byte** buffer );
|
||||||
|
|
||||||
void M_ScreenShot (void);
|
void M_ScreenShot( void );
|
||||||
|
|
||||||
void M_LoadDefaults (void);
|
void M_LoadDefaults( void );
|
||||||
void M_SaveDefaults (void);
|
void M_SaveDefaults( void );
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -34,45 +34,46 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// M_Random
|
// M_Random
|
||||||
// Returns a 0-255 number
|
// Returns a 0-255 number
|
||||||
//
|
//
|
||||||
const unsigned char rndtable[256] = {
|
const unsigned char rndtable[256] =
|
||||||
0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66 ,
|
{
|
||||||
74, 21, 211, 47, 80, 242, 154, 27, 205, 128, 161, 89, 77, 36 ,
|
0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66 ,
|
||||||
95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188 ,
|
74, 21, 211, 47, 80, 242, 154, 27, 205, 128, 161, 89, 77, 36 ,
|
||||||
52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224 ,
|
95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188 ,
|
||||||
149, 104, 25, 178, 252, 182, 202, 182, 141, 197, 4, 81, 181, 242 ,
|
52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224 ,
|
||||||
145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175, 249, 0 ,
|
149, 104, 25, 178, 252, 182, 202, 182, 141, 197, 4, 81, 181, 242 ,
|
||||||
175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235 ,
|
145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175, 249, 0 ,
|
||||||
25, 92, 20, 145, 138, 77, 69, 166, 78, 176, 173, 212, 166, 113 ,
|
175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235 ,
|
||||||
94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37, 171, 75 ,
|
25, 92, 20, 145, 138, 77, 69, 166, 78, 176, 173, 212, 166, 113 ,
|
||||||
136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196 ,
|
94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37, 171, 75 ,
|
||||||
135, 106, 63, 197, 195, 86, 96, 203, 113, 101, 170, 247, 181, 113 ,
|
136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196 ,
|
||||||
80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112, 166, 103, 241 ,
|
135, 106, 63, 197, 195, 86, 96, 203, 113, 101, 170, 247, 181, 113 ,
|
||||||
24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224 ,
|
80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112, 166, 103, 241 ,
|
||||||
145, 224, 81, 206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95 ,
|
24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224 ,
|
||||||
28, 139, 123, 98, 125, 196, 15, 70, 194, 253, 54, 14, 109, 226 ,
|
145, 224, 81, 206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95 ,
|
||||||
71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36 ,
|
28, 139, 123, 98, 125, 196, 15, 70, 194, 253, 54, 14, 109, 226 ,
|
||||||
17, 46, 52, 231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106 ,
|
71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36 ,
|
||||||
197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136 ,
|
17, 46, 52, 231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106 ,
|
||||||
120, 163, 236, 249
|
197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136 ,
|
||||||
|
120, 163, 236, 249
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Which one is deterministic?
|
// Which one is deterministic?
|
||||||
int P_Random (void)
|
int P_Random( void )
|
||||||
{
|
{
|
||||||
::g->prndindex = (::g->prndindex+1)&0xff;
|
::g->prndindex = ( ::g->prndindex + 1 ) & 0xff;
|
||||||
return rndtable[::g->prndindex];
|
return rndtable[::g->prndindex];
|
||||||
}
|
}
|
||||||
|
|
||||||
int M_Random (void)
|
int M_Random( void )
|
||||||
{
|
{
|
||||||
::g->rndindex = (::g->rndindex+1)&0xff;
|
::g->rndindex = ( ::g->rndindex + 1 ) & 0xff;
|
||||||
return rndtable[::g->rndindex];
|
return rndtable[::g->rndindex];
|
||||||
}
|
}
|
||||||
|
|
||||||
void M_ClearRandom (void)
|
void M_ClearRandom( void )
|
||||||
{
|
{
|
||||||
::g->rndindex = ::g->prndindex = 0;
|
::g->rndindex = ::g->prndindex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,13 +36,13 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
// Returns a number from 0 to 255,
|
// Returns a number from 0 to 255,
|
||||||
// from a lookup table.
|
// from a lookup table.
|
||||||
int M_Random (void);
|
int M_Random( void );
|
||||||
|
|
||||||
// As M_Random, but used only by the play simulation.
|
// As M_Random, but used only by the play simulation.
|
||||||
int P_Random (void);
|
int P_Random( void );
|
||||||
|
|
||||||
// Fix randoms for demos.
|
// Fix randoms for demos.
|
||||||
void M_ClearRandom (void);
|
void M_ClearRandom( void );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "m_swap.h"
|
#pragma implementation "m_swap.h"
|
||||||
#endif
|
#endif
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,20 +42,20 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
//long SwapLONG(long);
|
//long SwapLONG(long);
|
||||||
|
|
||||||
// Swap 16bit, that is, MSB and LSB byte.
|
// Swap 16bit, that is, MSB and LSB byte.
|
||||||
inline unsigned short SwapSHORT(unsigned short x)
|
inline unsigned short SwapSHORT( unsigned short x )
|
||||||
{
|
{
|
||||||
// No masking with 0xFF should be necessary.
|
// No masking with 0xFF should be necessary.
|
||||||
return (x>>8) | (x<<8);
|
return ( x >> 8 ) | ( x << 8 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Swapping 32bit.
|
// Swapping 32bit.
|
||||||
inline unsigned long SwapLONG( unsigned long x)
|
inline unsigned long SwapLONG( unsigned long x )
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
(x>>24)
|
( x >> 24 )
|
||||||
| ((x>>8) & 0xff00)
|
| ( ( x >> 8 ) & 0xff00 )
|
||||||
| ((x<<8) & 0xff0000)
|
| ( ( x << 8 ) & 0xff0000 )
|
||||||
| (x<<24);
|
| ( x << 24 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,15 +35,19 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
// reads a variable length integer
|
// reads a variable length integer
|
||||||
unsigned long ReadVarLen( char* buffer ) {
|
unsigned long ReadVarLen( char* buffer )
|
||||||
|
{
|
||||||
unsigned long value;
|
unsigned long value;
|
||||||
byte c;
|
byte c;
|
||||||
|
|
||||||
if ((value = *buffer++) & 0x80) {
|
if( ( value = *buffer++ ) & 0x80 )
|
||||||
|
{
|
||||||
value &= 0x7f;
|
value &= 0x7f;
|
||||||
do {
|
do
|
||||||
value = (value << 7) + ((c = *buffer++) & 0x7f);
|
{
|
||||||
} while (c & 0x80);
|
value = ( value << 7 ) + ( ( c = *buffer++ ) & 0x7f );
|
||||||
|
}
|
||||||
|
while( c & 0x80 );
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -54,79 +58,85 @@ int WriteVarLen( long value, byte* out )
|
||||||
long buffer, count = 0;
|
long buffer, count = 0;
|
||||||
|
|
||||||
buffer = value & 0x7f;
|
buffer = value & 0x7f;
|
||||||
while ((value >>= 7) > 0) {
|
while( ( value >>= 7 ) > 0 )
|
||||||
|
{
|
||||||
buffer <<= 8;
|
buffer <<= 8;
|
||||||
buffer += 0x80;
|
buffer += 0x80;
|
||||||
buffer += (value & 0x7f);
|
buffer += ( value & 0x7f );
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while( 1 )
|
||||||
|
{
|
||||||
++count;
|
++count;
|
||||||
*out = (byte)buffer;
|
*out = ( byte )buffer;
|
||||||
++out;
|
++out;
|
||||||
if (buffer & 0x80)
|
if( buffer & 0x80 )
|
||||||
|
{
|
||||||
buffer >>= 8;
|
buffer >>= 8;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
// writes a byte, and returns the buffer
|
// writes a byte, and returns the buffer
|
||||||
unsigned char* WriteByte(void* buf, byte b)
|
unsigned char* WriteByte( void* buf, byte b )
|
||||||
{
|
{
|
||||||
unsigned char* buffer = (unsigned char*)buf;
|
unsigned char* buffer = ( unsigned char* )buf;
|
||||||
*buffer++ = b;
|
*buffer++ = b;
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char* WriteShort(void* b, unsigned short s)
|
unsigned char* WriteShort( void* b, unsigned short s )
|
||||||
{
|
{
|
||||||
unsigned char* buffer = (unsigned char*)b;
|
unsigned char* buffer = ( unsigned char* )b;
|
||||||
*buffer++ = (s >> 8);
|
*buffer++ = ( s >> 8 );
|
||||||
*buffer++ = (s & 0x00FF);
|
*buffer++ = ( s & 0x00FF );
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char* WriteInt(void* b, unsigned int i)
|
unsigned char* WriteInt( void* b, unsigned int i )
|
||||||
{
|
{
|
||||||
unsigned char* buffer = (unsigned char*)b;
|
unsigned char* buffer = ( unsigned char* )b;
|
||||||
*buffer++ = (i & 0xff000000) >> 24;
|
*buffer++ = ( i & 0xff000000 ) >> 24;
|
||||||
*buffer++ = (i & 0x00ff0000) >> 16;
|
*buffer++ = ( i & 0x00ff0000 ) >> 16;
|
||||||
*buffer++ = (i & 0x0000ff00) >> 8;
|
*buffer++ = ( i & 0x0000ff00 ) >> 8;
|
||||||
*buffer++ = (i & 0x000000ff);
|
*buffer++ = ( i & 0x000000ff );
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format - 0(1 track only), 1(1 or more tracks, each play same time), 2(1 or more, each play seperatly)
|
// Format - 0(1 track only), 1(1 or more tracks, each play same time), 2(1 or more, each play seperatly)
|
||||||
void Midi_CreateHeader(MidiHeaderChunk_t* header, short format, short track_count, short division)
|
void Midi_CreateHeader( MidiHeaderChunk_t* header, short format, short track_count, short division )
|
||||||
{
|
{
|
||||||
WriteInt(header->name, 'MThd');
|
WriteInt( header->name, 'MThd' );
|
||||||
WriteInt(&header->length, 6);
|
WriteInt( &header->length, 6 );
|
||||||
WriteShort(&header->format, format);
|
WriteShort( &header->format, format );
|
||||||
WriteShort(&header->ntracks, track_count);
|
WriteShort( &header->ntracks, track_count );
|
||||||
WriteShort(&header->division, division);
|
WriteShort( &header->division, division );
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char* Midi_WriteTempo(unsigned char* buffer, int tempo)
|
unsigned char* Midi_WriteTempo( unsigned char* buffer, int tempo )
|
||||||
{
|
{
|
||||||
buffer = WriteByte(buffer, 0x00); // delta time
|
buffer = WriteByte( buffer, 0x00 ); // delta time
|
||||||
buffer = WriteByte(buffer, 0xff); // sys command
|
buffer = WriteByte( buffer, 0xff ); // sys command
|
||||||
buffer = WriteShort(buffer, 0x5103); // command - set tempo
|
buffer = WriteShort( buffer, 0x5103 ); // command - set tempo
|
||||||
|
|
||||||
buffer = WriteByte(buffer, tempo & 0x000000ff);
|
buffer = WriteByte( buffer, tempo & 0x000000ff );
|
||||||
buffer = WriteByte(buffer, (tempo & 0x0000ff00) >> 8);
|
buffer = WriteByte( buffer, ( tempo & 0x0000ff00 ) >> 8 );
|
||||||
buffer = WriteByte(buffer, (tempo & 0x00ff0000) >> 16);
|
buffer = WriteByte( buffer, ( tempo & 0x00ff0000 ) >> 16 );
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Midi_UpdateBytesWritten(int* bytes_written, int to_add, int max)
|
int Midi_UpdateBytesWritten( int* bytes_written, int to_add, int max )
|
||||||
{
|
{
|
||||||
*bytes_written += to_add;
|
*bytes_written += to_add;
|
||||||
if (max && *bytes_written > max)
|
if( max && *bytes_written > max )
|
||||||
{
|
{
|
||||||
assert(0);
|
assert( 0 );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -152,19 +162,21 @@ unsigned char MidiMap[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
// The MUS data is stored in little-endian.
|
// The MUS data is stored in little-endian.
|
||||||
namespace {
|
namespace
|
||||||
unsigned short LittleToNative( const unsigned short value ) {
|
{
|
||||||
return value;
|
unsigned short LittleToNative( const unsigned short value )
|
||||||
}
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len)
|
int Mus2Midi( unsigned char* bytes, unsigned char* out, int* len )
|
||||||
{
|
{
|
||||||
// mus header and instruments
|
// mus header and instruments
|
||||||
MUSheader_t header;
|
MUSheader_t header;
|
||||||
|
|
||||||
// current position in read buffer
|
// current position in read buffer
|
||||||
unsigned char* cur = bytes,* end;
|
unsigned char* cur = bytes, * end;
|
||||||
if( cur[0] != 'M' || cur[1] != 'U' || cur[2] != 'S' )
|
if( cur[0] != 'M' || cur[1] != 'U' || cur[2] != 'S' )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -186,8 +198,8 @@ int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len)
|
||||||
byte last_status = 0;
|
byte last_status = 0;
|
||||||
|
|
||||||
// read the mus header
|
// read the mus header
|
||||||
memcpy(&header, cur, sizeof(header));
|
memcpy( &header, cur, sizeof( header ) );
|
||||||
cur += sizeof(header);
|
cur += sizeof( header );
|
||||||
|
|
||||||
header.scoreLen = LittleToNative( header.scoreLen );
|
header.scoreLen = LittleToNative( header.scoreLen );
|
||||||
header.scoreStart = LittleToNative( header.scoreStart );
|
header.scoreStart = LittleToNative( header.scoreStart );
|
||||||
|
@ -197,11 +209,14 @@ int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len)
|
||||||
header.dummy = LittleToNative( header.dummy );
|
header.dummy = LittleToNative( header.dummy );
|
||||||
|
|
||||||
// only 15 supported
|
// only 15 supported
|
||||||
if (header.channels > MIDI_MAXCHANNELS - 1)
|
if( header.channels > MIDI_MAXCHANNELS - 1 )
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Map channel 15 to 9(percussions)
|
// Map channel 15 to 9(percussions)
|
||||||
for (temp = 0; temp < MIDI_MAXCHANNELS; ++temp) {
|
for( temp = 0; temp < MIDI_MAXCHANNELS; ++temp )
|
||||||
|
{
|
||||||
channelMap[temp] = -1;
|
channelMap[temp] = -1;
|
||||||
channel_volume[temp] = 0x40;
|
channel_volume[temp] = 0x40;
|
||||||
}
|
}
|
||||||
|
@ -212,142 +227,158 @@ int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len)
|
||||||
end = cur + header.scoreLen;
|
end = cur + header.scoreLen;
|
||||||
|
|
||||||
// Write out midi header
|
// Write out midi header
|
||||||
Midi_CreateHeader(&midiHeader, 0, 1, 0x0059);
|
Midi_CreateHeader( &midiHeader, 0, 1, 0x0059 );
|
||||||
Midi_UpdateBytesWritten(&bytes_written, MIDIHEADERSIZE, *len);
|
Midi_UpdateBytesWritten( &bytes_written, MIDIHEADERSIZE, *len );
|
||||||
memcpy(out, &midiHeader, MIDIHEADERSIZE); // cannot use sizeof(packs it to 16 bytes)
|
memcpy( out, &midiHeader, MIDIHEADERSIZE ); // cannot use sizeof(packs it to 16 bytes)
|
||||||
out += MIDIHEADERSIZE;
|
out += MIDIHEADERSIZE;
|
||||||
|
|
||||||
// Store this position, for later filling in the midiTrackHeader
|
// Store this position, for later filling in the midiTrackHeader
|
||||||
Midi_UpdateBytesWritten(&bytes_written, sizeof(midiTrackHeader), *len);
|
Midi_UpdateBytesWritten( &bytes_written, sizeof( midiTrackHeader ), *len );
|
||||||
midiTrackHeaderOut = out;
|
midiTrackHeaderOut = out;
|
||||||
out += sizeof(midiTrackHeader);
|
out += sizeof( midiTrackHeader );
|
||||||
|
|
||||||
|
|
||||||
// microseconds per quarter note(yikes)
|
// microseconds per quarter note(yikes)
|
||||||
Midi_UpdateBytesWritten(&bytes_written, 7, *len);
|
Midi_UpdateBytesWritten( &bytes_written, 7, *len );
|
||||||
out = Midi_WriteTempo(out, 0x001aa309);
|
out = Midi_WriteTempo( out, 0x001aa309 );
|
||||||
|
|
||||||
// Percussions channel starts out at full volume
|
// Percussions channel starts out at full volume
|
||||||
Midi_UpdateBytesWritten(&bytes_written, 4, *len);
|
Midi_UpdateBytesWritten( &bytes_written, 4, *len );
|
||||||
out = WriteByte(out, 0x00);
|
out = WriteByte( out, 0x00 );
|
||||||
out = WriteByte(out, 0xB9);
|
out = WriteByte( out, 0xB9 );
|
||||||
out = WriteByte(out, 0x07);
|
out = WriteByte( out, 0x07 );
|
||||||
out = WriteByte(out, 127);
|
out = WriteByte( out, 127 );
|
||||||
|
|
||||||
// Main Loop
|
// Main Loop
|
||||||
while (cur < end) {
|
while( cur < end )
|
||||||
|
{
|
||||||
byte channel;
|
byte channel;
|
||||||
byte event;
|
byte event;
|
||||||
byte temp_buffer[32]; // temp buffer for current iterator
|
byte temp_buffer[32]; // temp buffer for current iterator
|
||||||
byte *out_local = temp_buffer;
|
byte* out_local = temp_buffer;
|
||||||
byte status, bit1, bit2, bitc = 2;
|
byte status, bit1, bit2, bitc = 2;
|
||||||
|
|
||||||
// Read in current bit
|
// Read in current bit
|
||||||
event = *cur++;
|
event = *cur++;
|
||||||
channel = (event & 15); // current channel
|
channel = ( event & 15 ); // current channel
|
||||||
|
|
||||||
// Write variable length delta time
|
// Write variable length delta time
|
||||||
out_local += WriteVarLen(delta_time, out_local);
|
out_local += WriteVarLen( delta_time, out_local );
|
||||||
|
|
||||||
if (channelMap[channel] < 0) {
|
if( channelMap[channel] < 0 )
|
||||||
|
{
|
||||||
// Set all channels to 127 volume
|
// Set all channels to 127 volume
|
||||||
out_local = WriteByte(out_local, 0xB0 + currentChannel);
|
out_local = WriteByte( out_local, 0xB0 + currentChannel );
|
||||||
out_local = WriteByte(out_local, 0x07);
|
out_local = WriteByte( out_local, 0x07 );
|
||||||
out_local = WriteByte(out_local, 127);
|
out_local = WriteByte( out_local, 127 );
|
||||||
out_local = WriteByte(out_local, 0x00);
|
out_local = WriteByte( out_local, 0x00 );
|
||||||
|
|
||||||
channelMap[channel] = currentChannel++;
|
channelMap[channel] = currentChannel++;
|
||||||
if (currentChannel == 9)
|
if( currentChannel == 9 )
|
||||||
|
{
|
||||||
++currentChannel;
|
++currentChannel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status = channelMap[channel];
|
status = channelMap[channel];
|
||||||
|
|
||||||
// Handle ::g->events
|
// Handle ::g->events
|
||||||
switch ((event & 122) >> 4)
|
switch( ( event & 122 ) >> 4 )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert( 0 );
|
||||||
break;
|
break;
|
||||||
case MUSEVENT_KEYOFF:
|
case MUSEVENT_KEYOFF:
|
||||||
status |= 0x80;
|
status |= 0x80;
|
||||||
bit1 = *cur++;
|
|
||||||
bit2 = 0x40;
|
|
||||||
break;
|
|
||||||
case MUSEVENT_KEYON:
|
|
||||||
status |= 0x90;
|
|
||||||
bit1 = *cur & 127;
|
|
||||||
if (*cur++ & 128) // volume bit?
|
|
||||||
channel_volume[channelMap[channel]] = *cur++;
|
|
||||||
bit2 = channel_volume[channelMap[channel]];
|
|
||||||
break;
|
|
||||||
case MUSEVENT_PITCHWHEEL:
|
|
||||||
status |= 0xE0;
|
|
||||||
bit1 = (*cur & 1) >> 6;
|
|
||||||
bit2 = (*cur++ >> 1) & 127;
|
|
||||||
break;
|
|
||||||
case MUSEVENT_CHANNELMODE:
|
|
||||||
status |= 0xB0;
|
|
||||||
assert(*cur < sizeof(MidiMap) / sizeof(MidiMap[0]));
|
|
||||||
bit1 = MidiMap[*cur++];
|
|
||||||
bit2 = (*cur++ == 12) ? header.channels + 1 : 0x00;
|
|
||||||
break;
|
|
||||||
case MUSEVENT_CONTROLLERCHANGE:
|
|
||||||
if (*cur == 0) {
|
|
||||||
cur++;
|
|
||||||
status |= 0xC0;
|
|
||||||
bit1 = *cur++;
|
bit1 = *cur++;
|
||||||
bitc = 1;
|
bit2 = 0x40;
|
||||||
} else {
|
break;
|
||||||
|
case MUSEVENT_KEYON:
|
||||||
|
status |= 0x90;
|
||||||
|
bit1 = *cur & 127;
|
||||||
|
if( *cur++ & 128 ) // volume bit?
|
||||||
|
{
|
||||||
|
channel_volume[channelMap[channel]] = *cur++;
|
||||||
|
}
|
||||||
|
bit2 = channel_volume[channelMap[channel]];
|
||||||
|
break;
|
||||||
|
case MUSEVENT_PITCHWHEEL:
|
||||||
|
status |= 0xE0;
|
||||||
|
bit1 = ( *cur & 1 ) >> 6;
|
||||||
|
bit2 = ( *cur++ >> 1 ) & 127;
|
||||||
|
break;
|
||||||
|
case MUSEVENT_CHANNELMODE:
|
||||||
status |= 0xB0;
|
status |= 0xB0;
|
||||||
assert(*cur < sizeof(MidiMap) / sizeof(MidiMap[0]));
|
assert( *cur < sizeof( MidiMap ) / sizeof( MidiMap[0] ) );
|
||||||
bit1 = MidiMap[*cur++];
|
bit1 = MidiMap[*cur++];
|
||||||
bit2 = *cur++;
|
bit2 = ( *cur++ == 12 ) ? header.channels + 1 : 0x00;
|
||||||
}
|
break;
|
||||||
break;
|
case MUSEVENT_CONTROLLERCHANGE:
|
||||||
case 5: // Unknown
|
if( *cur == 0 )
|
||||||
assert(0);
|
{
|
||||||
break;
|
cur++;
|
||||||
case MUSEVENT_END: // End
|
status |= 0xC0;
|
||||||
status = 0xff;
|
bit1 = *cur++;
|
||||||
bit1 = 0x2f;
|
bitc = 1;
|
||||||
bit2 = 0x00;
|
}
|
||||||
assert(cur == end);
|
else
|
||||||
break;
|
{
|
||||||
case 7: // Unknown
|
status |= 0xB0;
|
||||||
assert(0);
|
assert( *cur < sizeof( MidiMap ) / sizeof( MidiMap[0] ) );
|
||||||
break;
|
bit1 = MidiMap[*cur++];
|
||||||
|
bit2 = *cur++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5: // Unknown
|
||||||
|
assert( 0 );
|
||||||
|
break;
|
||||||
|
case MUSEVENT_END: // End
|
||||||
|
status = 0xff;
|
||||||
|
bit1 = 0x2f;
|
||||||
|
bit2 = 0x00;
|
||||||
|
assert( cur == end );
|
||||||
|
break;
|
||||||
|
case 7: // Unknown
|
||||||
|
assert( 0 );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write it out
|
// Write it out
|
||||||
out_local = WriteByte(out_local, status);
|
out_local = WriteByte( out_local, status );
|
||||||
out_local = WriteByte(out_local, bit1);
|
out_local = WriteByte( out_local, bit1 );
|
||||||
if (bitc == 2)
|
if( bitc == 2 )
|
||||||
out_local = WriteByte(out_local, bit2);
|
{
|
||||||
|
out_local = WriteByte( out_local, bit2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write out temp stuff
|
// Write out temp stuff
|
||||||
if (out_local != temp_buffer)
|
if( out_local != temp_buffer )
|
||||||
{
|
{
|
||||||
Midi_UpdateBytesWritten(&bytes_written, out_local - temp_buffer, *len);
|
Midi_UpdateBytesWritten( &bytes_written, out_local - temp_buffer, *len );
|
||||||
memcpy(out, temp_buffer, out_local - temp_buffer);
|
memcpy( out, temp_buffer, out_local - temp_buffer );
|
||||||
out += out_local - temp_buffer;
|
out += out_local - temp_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event & 128) {
|
if( event & 128 )
|
||||||
|
{
|
||||||
delta_time = 0;
|
delta_time = 0;
|
||||||
do {
|
do
|
||||||
delta_time = delta_time * 128 + (*cur & 127);
|
{
|
||||||
} while ((*cur++ & 128));
|
delta_time = delta_time * 128 + ( *cur & 127 );
|
||||||
} else {
|
}
|
||||||
|
while( ( *cur++ & 128 ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
delta_time = 0;
|
delta_time = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out track header
|
// Write out track header
|
||||||
WriteInt(midiTrackHeader.name, 'MTrk');
|
WriteInt( midiTrackHeader.name, 'MTrk' );
|
||||||
WriteInt(&midiTrackHeader.length, out - midiTrackHeaderOut - sizeof(midiTrackHeader));
|
WriteInt( &midiTrackHeader.length, out - midiTrackHeaderOut - sizeof( midiTrackHeader ) );
|
||||||
memcpy(midiTrackHeaderOut, &midiTrackHeader, sizeof(midiTrackHeader));
|
memcpy( midiTrackHeaderOut, &midiTrackHeader, sizeof( midiTrackHeader ) );
|
||||||
|
|
||||||
// Store length written
|
// Store length written
|
||||||
*len = bytes_written;
|
*len = bytes_written;
|
||||||
|
|
|
@ -54,118 +54,119 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
// T_MoveCeiling
|
// T_MoveCeiling
|
||||||
//
|
//
|
||||||
|
|
||||||
void T_MoveCeiling (ceiling_t* ceiling)
|
void T_MoveCeiling( ceiling_t* ceiling )
|
||||||
{
|
{
|
||||||
result_e res;
|
result_e res;
|
||||||
|
|
||||||
switch(ceiling->direction)
|
switch( ceiling->direction )
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
// IN STASIS
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
// UP
|
|
||||||
res = T_MovePlane(ceiling->sector,
|
|
||||||
ceiling->speed,
|
|
||||||
ceiling->topheight,
|
|
||||||
false,1,ceiling->direction);
|
|
||||||
|
|
||||||
if (!(::g->leveltime&7))
|
|
||||||
{
|
{
|
||||||
switch(ceiling->type)
|
case 0:
|
||||||
{
|
// IN STASIS
|
||||||
case silentCrushAndRaise:
|
break;
|
||||||
break;
|
case 1:
|
||||||
default:
|
// UP
|
||||||
S_StartSound( &ceiling->sector->soundorg,
|
res = T_MovePlane( ceiling->sector,
|
||||||
sfx_stnmov);
|
ceiling->speed,
|
||||||
// ?
|
ceiling->topheight,
|
||||||
break;
|
false, 1, ceiling->direction );
|
||||||
}
|
|
||||||
|
if( !( ::g->leveltime & 7 ) )
|
||||||
|
{
|
||||||
|
switch( ceiling->type )
|
||||||
|
{
|
||||||
|
case silentCrushAndRaise:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
S_StartSound( &ceiling->sector->soundorg,
|
||||||
|
sfx_stnmov );
|
||||||
|
// ?
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( res == pastdest )
|
||||||
|
{
|
||||||
|
switch( ceiling->type )
|
||||||
|
{
|
||||||
|
case raiseToHighest:
|
||||||
|
P_RemoveActiveCeiling( ceiling );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case silentCrushAndRaise:
|
||||||
|
S_StartSound( &ceiling->sector->soundorg,
|
||||||
|
sfx_pstop );
|
||||||
|
case fastCrushAndRaise:
|
||||||
|
case crushAndRaise:
|
||||||
|
ceiling->direction = -1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -1:
|
||||||
|
// DOWN
|
||||||
|
res = T_MovePlane( ceiling->sector,
|
||||||
|
ceiling->speed,
|
||||||
|
ceiling->bottomheight,
|
||||||
|
ceiling->crush, 1, ceiling->direction );
|
||||||
|
|
||||||
|
if( !( ::g->leveltime & 7 ) )
|
||||||
|
{
|
||||||
|
switch( ceiling->type )
|
||||||
|
{
|
||||||
|
case silentCrushAndRaise:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
S_StartSound( &ceiling->sector->soundorg,
|
||||||
|
sfx_stnmov );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( res == pastdest )
|
||||||
|
{
|
||||||
|
switch( ceiling->type )
|
||||||
|
{
|
||||||
|
case silentCrushAndRaise:
|
||||||
|
S_StartSound( &ceiling->sector->soundorg,
|
||||||
|
sfx_pstop );
|
||||||
|
case crushAndRaise:
|
||||||
|
ceiling->speed = CEILSPEED;
|
||||||
|
case fastCrushAndRaise:
|
||||||
|
ceiling->direction = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case lowerAndCrush:
|
||||||
|
case lowerToFloor:
|
||||||
|
P_RemoveActiveCeiling( ceiling );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // ( res != pastdest )
|
||||||
|
{
|
||||||
|
if( res == crushed )
|
||||||
|
{
|
||||||
|
switch( ceiling->type )
|
||||||
|
{
|
||||||
|
case silentCrushAndRaise:
|
||||||
|
case crushAndRaise:
|
||||||
|
case lowerAndCrush:
|
||||||
|
ceiling->speed = CEILSPEED / 8;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res == pastdest)
|
|
||||||
{
|
|
||||||
switch(ceiling->type)
|
|
||||||
{
|
|
||||||
case raiseToHighest:
|
|
||||||
P_RemoveActiveCeiling(ceiling);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case silentCrushAndRaise:
|
|
||||||
S_StartSound( &ceiling->sector->soundorg,
|
|
||||||
sfx_pstop);
|
|
||||||
case fastCrushAndRaise:
|
|
||||||
case crushAndRaise:
|
|
||||||
ceiling->direction = -1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case -1:
|
|
||||||
// DOWN
|
|
||||||
res = T_MovePlane(ceiling->sector,
|
|
||||||
ceiling->speed,
|
|
||||||
ceiling->bottomheight,
|
|
||||||
ceiling->crush,1,ceiling->direction);
|
|
||||||
|
|
||||||
if (!(::g->leveltime&7))
|
|
||||||
{
|
|
||||||
switch(ceiling->type)
|
|
||||||
{
|
|
||||||
case silentCrushAndRaise: break;
|
|
||||||
default:
|
|
||||||
S_StartSound( &ceiling->sector->soundorg,
|
|
||||||
sfx_stnmov);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (res == pastdest)
|
|
||||||
{
|
|
||||||
switch(ceiling->type)
|
|
||||||
{
|
|
||||||
case silentCrushAndRaise:
|
|
||||||
S_StartSound( &ceiling->sector->soundorg,
|
|
||||||
sfx_pstop);
|
|
||||||
case crushAndRaise:
|
|
||||||
ceiling->speed = CEILSPEED;
|
|
||||||
case fastCrushAndRaise:
|
|
||||||
ceiling->direction = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case lowerAndCrush:
|
|
||||||
case lowerToFloor:
|
|
||||||
P_RemoveActiveCeiling(ceiling);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // ( res != pastdest )
|
|
||||||
{
|
|
||||||
if (res == crushed)
|
|
||||||
{
|
|
||||||
switch(ceiling->type)
|
|
||||||
{
|
|
||||||
case silentCrushAndRaise:
|
|
||||||
case crushAndRaise:
|
|
||||||
case lowerAndCrush:
|
|
||||||
ceiling->speed = CEILSPEED / 8;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -178,93 +179,97 @@ EV_DoCeiling
|
||||||
( line_t* line,
|
( line_t* line,
|
||||||
ceiling_e type )
|
ceiling_e type )
|
||||||
{
|
{
|
||||||
int secnum;
|
int secnum;
|
||||||
int rtn;
|
int rtn;
|
||||||
sector_t* sec;
|
sector_t* sec;
|
||||||
ceiling_t* ceiling;
|
ceiling_t* ceiling;
|
||||||
|
|
||||||
secnum = -1;
|
secnum = -1;
|
||||||
rtn = 0;
|
rtn = 0;
|
||||||
|
|
||||||
// Reactivate in-stasis ceilings...for certain types.
|
// Reactivate in-stasis ceilings...for certain types.
|
||||||
switch(type)
|
switch( type )
|
||||||
{
|
|
||||||
case fastCrushAndRaise:
|
|
||||||
case silentCrushAndRaise:
|
|
||||||
case crushAndRaise:
|
|
||||||
P_ActivateInStasisCeiling(line);
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
|
||||||
{
|
|
||||||
sec = &::g->sectors[secnum];
|
|
||||||
if (sec->specialdata)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// new door thinker
|
|
||||||
rtn = 1;
|
|
||||||
ceiling = (ceiling_t*)DoomLib::Z_Malloc(sizeof(*ceiling), PU_LEVEL, 0);
|
|
||||||
P_AddThinker (&ceiling->thinker);
|
|
||||||
sec->specialdata = ceiling;
|
|
||||||
ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling;
|
|
||||||
ceiling->sector = sec;
|
|
||||||
ceiling->crush = false;
|
|
||||||
|
|
||||||
switch(type)
|
|
||||||
{
|
{
|
||||||
case fastCrushAndRaise:
|
case fastCrushAndRaise:
|
||||||
ceiling->crush = true;
|
case silentCrushAndRaise:
|
||||||
ceiling->topheight = sec->ceilingheight;
|
case crushAndRaise:
|
||||||
ceiling->bottomheight = sec->floorheight + (8*FRACUNIT);
|
P_ActivateInStasisCeiling( line );
|
||||||
ceiling->direction = -1;
|
default:
|
||||||
ceiling->speed = CEILSPEED * 2;
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case silentCrushAndRaise:
|
|
||||||
case crushAndRaise:
|
|
||||||
ceiling->crush = true;
|
|
||||||
ceiling->topheight = sec->ceilingheight;
|
|
||||||
case lowerAndCrush:
|
|
||||||
case lowerToFloor:
|
|
||||||
ceiling->bottomheight = sec->floorheight;
|
|
||||||
if (type != lowerToFloor)
|
|
||||||
ceiling->bottomheight += 8*FRACUNIT;
|
|
||||||
ceiling->direction = -1;
|
|
||||||
ceiling->speed = CEILSPEED;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case raiseToHighest:
|
|
||||||
ceiling->topheight = P_FindHighestCeilingSurrounding(sec);
|
|
||||||
ceiling->direction = 1;
|
|
||||||
ceiling->speed = CEILSPEED;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ceiling->tag = sec->tag;
|
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||||
ceiling->type = type;
|
{
|
||||||
P_AddActiveCeiling(ceiling);
|
sec = &::g->sectors[secnum];
|
||||||
}
|
if( sec->specialdata )
|
||||||
return rtn;
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// new door thinker
|
||||||
|
rtn = 1;
|
||||||
|
ceiling = ( ceiling_t* )DoomLib::Z_Malloc( sizeof( *ceiling ), PU_LEVEL, 0 );
|
||||||
|
P_AddThinker( &ceiling->thinker );
|
||||||
|
sec->specialdata = ceiling;
|
||||||
|
ceiling->thinker.function.acp1 = ( actionf_p1 )T_MoveCeiling;
|
||||||
|
ceiling->sector = sec;
|
||||||
|
ceiling->crush = false;
|
||||||
|
|
||||||
|
switch( type )
|
||||||
|
{
|
||||||
|
case fastCrushAndRaise:
|
||||||
|
ceiling->crush = true;
|
||||||
|
ceiling->topheight = sec->ceilingheight;
|
||||||
|
ceiling->bottomheight = sec->floorheight + ( 8 * FRACUNIT );
|
||||||
|
ceiling->direction = -1;
|
||||||
|
ceiling->speed = CEILSPEED * 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case silentCrushAndRaise:
|
||||||
|
case crushAndRaise:
|
||||||
|
ceiling->crush = true;
|
||||||
|
ceiling->topheight = sec->ceilingheight;
|
||||||
|
case lowerAndCrush:
|
||||||
|
case lowerToFloor:
|
||||||
|
ceiling->bottomheight = sec->floorheight;
|
||||||
|
if( type != lowerToFloor )
|
||||||
|
{
|
||||||
|
ceiling->bottomheight += 8 * FRACUNIT;
|
||||||
|
}
|
||||||
|
ceiling->direction = -1;
|
||||||
|
ceiling->speed = CEILSPEED;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case raiseToHighest:
|
||||||
|
ceiling->topheight = P_FindHighestCeilingSurrounding( sec );
|
||||||
|
ceiling->direction = 1;
|
||||||
|
ceiling->speed = CEILSPEED;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ceiling->tag = sec->tag;
|
||||||
|
ceiling->type = type;
|
||||||
|
P_AddActiveCeiling( ceiling );
|
||||||
|
}
|
||||||
|
return rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add an active ceiling
|
// Add an active ceiling
|
||||||
//
|
//
|
||||||
void P_AddActiveCeiling(ceiling_t* c)
|
void P_AddActiveCeiling( ceiling_t* c )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < MAXCEILINGS;i++)
|
for( i = 0; i < MAXCEILINGS; i++ )
|
||||||
{
|
|
||||||
if (::g->activeceilings[i] == NULL)
|
|
||||||
{
|
{
|
||||||
::g->activeceilings[i] = c;
|
if( ::g->activeceilings[i] == NULL )
|
||||||
return;
|
{
|
||||||
|
::g->activeceilings[i] = c;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -272,20 +277,20 @@ void P_AddActiveCeiling(ceiling_t* c)
|
||||||
//
|
//
|
||||||
// Remove a ceiling's thinker
|
// Remove a ceiling's thinker
|
||||||
//
|
//
|
||||||
void P_RemoveActiveCeiling(ceiling_t* c)
|
void P_RemoveActiveCeiling( ceiling_t* c )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0;i < MAXCEILINGS;i++)
|
for( i = 0; i < MAXCEILINGS; i++ )
|
||||||
{
|
|
||||||
if (::g->activeceilings[i] == c)
|
|
||||||
{
|
{
|
||||||
::g->activeceilings[i]->sector->specialdata = NULL;
|
if( ::g->activeceilings[i] == c )
|
||||||
P_RemoveThinker (&::g->activeceilings[i]->thinker);
|
{
|
||||||
::g->activeceilings[i] = NULL;
|
::g->activeceilings[i]->sector->specialdata = NULL;
|
||||||
break;
|
P_RemoveThinker( &::g->activeceilings[i]->thinker );
|
||||||
|
::g->activeceilings[i] = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -293,21 +298,21 @@ void P_RemoveActiveCeiling(ceiling_t* c)
|
||||||
//
|
//
|
||||||
// Restart a ceiling that's in-stasis
|
// Restart a ceiling that's in-stasis
|
||||||
//
|
//
|
||||||
void P_ActivateInStasisCeiling(line_t* line)
|
void P_ActivateInStasisCeiling( line_t* line )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0;i < MAXCEILINGS;i++)
|
for( i = 0; i < MAXCEILINGS; i++ )
|
||||||
{
|
|
||||||
if (::g->activeceilings[i]
|
|
||||||
&& (::g->activeceilings[i]->tag == line->tag)
|
|
||||||
&& (::g->activeceilings[i]->direction == 0))
|
|
||||||
{
|
{
|
||||||
::g->activeceilings[i]->direction = ::g->activeceilings[i]->olddirection;
|
if( ::g->activeceilings[i]
|
||||||
::g->activeceilings[i]->thinker.function.acp1
|
&& ( ::g->activeceilings[i]->tag == line->tag )
|
||||||
= (actionf_p1)T_MoveCeiling;
|
&& ( ::g->activeceilings[i]->direction == 0 ) )
|
||||||
|
{
|
||||||
|
::g->activeceilings[i]->direction = ::g->activeceilings[i]->olddirection;
|
||||||
|
::g->activeceilings[i]->thinker.function.acp1
|
||||||
|
= ( actionf_p1 )T_MoveCeiling;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -316,26 +321,26 @@ void P_ActivateInStasisCeiling(line_t* line)
|
||||||
// EV_CeilingCrushStop
|
// EV_CeilingCrushStop
|
||||||
// Stop a ceiling from crushing!
|
// Stop a ceiling from crushing!
|
||||||
//
|
//
|
||||||
int EV_CeilingCrushStop(line_t *line)
|
int EV_CeilingCrushStop( line_t* line )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int rtn;
|
int rtn;
|
||||||
|
|
||||||
rtn = 0;
|
rtn = 0;
|
||||||
for (i = 0;i < MAXCEILINGS;i++)
|
for( i = 0; i < MAXCEILINGS; i++ )
|
||||||
{
|
|
||||||
if (::g->activeceilings[i]
|
|
||||||
&& (::g->activeceilings[i]->tag == line->tag)
|
|
||||||
&& (::g->activeceilings[i]->direction != 0))
|
|
||||||
{
|
{
|
||||||
::g->activeceilings[i]->olddirection = ::g->activeceilings[i]->direction;
|
if( ::g->activeceilings[i]
|
||||||
::g->activeceilings[i]->thinker.function.acv = (actionf_v)NULL;
|
&& ( ::g->activeceilings[i]->tag == line->tag )
|
||||||
::g->activeceilings[i]->direction = 0; // in-stasis
|
&& ( ::g->activeceilings[i]->direction != 0 ) )
|
||||||
rtn = 1;
|
{
|
||||||
|
::g->activeceilings[i]->olddirection = ::g->activeceilings[i]->direction;
|
||||||
|
::g->activeceilings[i]->thinker.function.acv = ( actionf_v )NULL;
|
||||||
|
::g->activeceilings[i]->direction = 0; // in-stasis
|
||||||
|
rtn = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return rtn;
|
return rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,141 +55,141 @@ extern bool globalNetworking;
|
||||||
//
|
//
|
||||||
// T_VerticalDoor
|
// T_VerticalDoor
|
||||||
//
|
//
|
||||||
void T_VerticalDoor (vldoor_t* door)
|
void T_VerticalDoor( vldoor_t* door )
|
||||||
{
|
{
|
||||||
result_e res;
|
result_e res;
|
||||||
|
|
||||||
switch(door->direction)
|
switch( door->direction )
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
// WAITING
|
|
||||||
if (!--door->topcountdown)
|
|
||||||
{
|
{
|
||||||
switch(door->type)
|
case 0:
|
||||||
{
|
// WAITING
|
||||||
case blazeRaise:
|
if( !--door->topcountdown )
|
||||||
door->direction = -1; // time to go back down
|
{
|
||||||
S_StartSound( &door->sector->soundorg,
|
switch( door->type )
|
||||||
sfx_bdcls);
|
{
|
||||||
break;
|
case blazeRaise:
|
||||||
|
door->direction = -1; // time to go back down
|
||||||
|
S_StartSound( &door->sector->soundorg,
|
||||||
|
sfx_bdcls );
|
||||||
|
break;
|
||||||
|
|
||||||
case normal:
|
case normal:
|
||||||
door->direction = -1; // time to go back down
|
door->direction = -1; // time to go back down
|
||||||
S_StartSound( &door->sector->soundorg,
|
S_StartSound( &door->sector->soundorg,
|
||||||
sfx_dorcls);
|
sfx_dorcls );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case close30ThenOpen:
|
case close30ThenOpen:
|
||||||
door->direction = 1;
|
door->direction = 1;
|
||||||
S_StartSound( &door->sector->soundorg,
|
S_StartSound( &door->sector->soundorg,
|
||||||
sfx_doropn);
|
sfx_doropn );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
// INITIAL WAIT
|
||||||
|
if( !--door->topcountdown )
|
||||||
|
{
|
||||||
|
switch( door->type )
|
||||||
|
{
|
||||||
|
case raiseIn5Mins:
|
||||||
|
door->direction = 1;
|
||||||
|
door->type = normal;
|
||||||
|
S_StartSound( &door->sector->soundorg,
|
||||||
|
sfx_doropn );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -1:
|
||||||
|
// DOWN
|
||||||
|
res = T_MovePlane( door->sector,
|
||||||
|
door->speed,
|
||||||
|
door->sector->floorheight,
|
||||||
|
false, 1, door->direction );
|
||||||
|
if( res == pastdest )
|
||||||
|
{
|
||||||
|
switch( door->type )
|
||||||
|
{
|
||||||
|
case blazeRaise:
|
||||||
|
case blazeClose:
|
||||||
|
door->sector->specialdata = NULL;
|
||||||
|
P_RemoveThinker( &door->thinker ); // unlink and free
|
||||||
|
S_StartSound( &door->sector->soundorg,
|
||||||
|
sfx_bdcls );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case normal:
|
||||||
|
case closed:
|
||||||
|
door->sector->specialdata = NULL;
|
||||||
|
P_RemoveThinker( &door->thinker ); // unlink and free
|
||||||
|
break;
|
||||||
|
|
||||||
|
case close30ThenOpen:
|
||||||
|
door->direction = 0;
|
||||||
|
door->topcountdown = TICRATE * 30;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( res == crushed )
|
||||||
|
{
|
||||||
|
switch( door->type )
|
||||||
|
{
|
||||||
|
case blazeClose:
|
||||||
|
case closed: // DO NOT GO BACK UP!
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
door->direction = 1;
|
||||||
|
S_StartSound( &door->sector->soundorg,
|
||||||
|
sfx_doropn );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
// UP
|
||||||
|
res = T_MovePlane( door->sector,
|
||||||
|
door->speed,
|
||||||
|
door->topheight,
|
||||||
|
false, 1, door->direction );
|
||||||
|
|
||||||
|
if( res == pastdest )
|
||||||
|
{
|
||||||
|
switch( door->type )
|
||||||
|
{
|
||||||
|
case blazeRaise:
|
||||||
|
case normal:
|
||||||
|
door->direction = 0; // wait at top
|
||||||
|
door->topcountdown = door->topwait;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case close30ThenOpen:
|
||||||
|
case blazeOpen:
|
||||||
|
case opened:
|
||||||
|
door->sector->specialdata = NULL;
|
||||||
|
P_RemoveThinker( &door->thinker ); // unlink and free
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
// INITIAL WAIT
|
|
||||||
if (!--door->topcountdown)
|
|
||||||
{
|
|
||||||
switch(door->type)
|
|
||||||
{
|
|
||||||
case raiseIn5Mins:
|
|
||||||
door->direction = 1;
|
|
||||||
door->type = normal;
|
|
||||||
S_StartSound( &door->sector->soundorg,
|
|
||||||
sfx_doropn);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case -1:
|
|
||||||
// DOWN
|
|
||||||
res = T_MovePlane(door->sector,
|
|
||||||
door->speed,
|
|
||||||
door->sector->floorheight,
|
|
||||||
false,1,door->direction);
|
|
||||||
if (res == pastdest)
|
|
||||||
{
|
|
||||||
switch(door->type)
|
|
||||||
{
|
|
||||||
case blazeRaise:
|
|
||||||
case blazeClose:
|
|
||||||
door->sector->specialdata = NULL;
|
|
||||||
P_RemoveThinker (&door->thinker); // unlink and free
|
|
||||||
S_StartSound( &door->sector->soundorg,
|
|
||||||
sfx_bdcls);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case normal:
|
|
||||||
case closed:
|
|
||||||
door->sector->specialdata = NULL;
|
|
||||||
P_RemoveThinker (&door->thinker); // unlink and free
|
|
||||||
break;
|
|
||||||
|
|
||||||
case close30ThenOpen:
|
|
||||||
door->direction = 0;
|
|
||||||
door->topcountdown = TICRATE*30;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (res == crushed)
|
|
||||||
{
|
|
||||||
switch(door->type)
|
|
||||||
{
|
|
||||||
case blazeClose:
|
|
||||||
case closed: // DO NOT GO BACK UP!
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
door->direction = 1;
|
|
||||||
S_StartSound( &door->sector->soundorg,
|
|
||||||
sfx_doropn);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
// UP
|
|
||||||
res = T_MovePlane(door->sector,
|
|
||||||
door->speed,
|
|
||||||
door->topheight,
|
|
||||||
false,1,door->direction);
|
|
||||||
|
|
||||||
if (res == pastdest)
|
|
||||||
{
|
|
||||||
switch(door->type)
|
|
||||||
{
|
|
||||||
case blazeRaise:
|
|
||||||
case normal:
|
|
||||||
door->direction = 0; // wait at top
|
|
||||||
door->topcountdown = door->topwait;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case close30ThenOpen:
|
|
||||||
case blazeOpen:
|
|
||||||
case opened:
|
|
||||||
door->sector->specialdata = NULL;
|
|
||||||
P_RemoveThinker (&door->thinker); // unlink and free
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -204,57 +204,71 @@ EV_DoLockedDoor
|
||||||
vldoor_e type,
|
vldoor_e type,
|
||||||
mobj_t* thing )
|
mobj_t* thing )
|
||||||
{
|
{
|
||||||
player_t* p;
|
player_t* p;
|
||||||
|
|
||||||
p = thing->player;
|
p = thing->player;
|
||||||
|
|
||||||
if (!p)
|
if( !p )
|
||||||
return 0;
|
|
||||||
|
|
||||||
switch(line->special)
|
|
||||||
{
|
|
||||||
case 99: // Blue Lock
|
|
||||||
case 133:
|
|
||||||
if ( !p )
|
|
||||||
return 0;
|
|
||||||
if (!p->cards[it_bluecard] && !p->cards[it_blueskull])
|
|
||||||
{
|
{
|
||||||
p->message = PD_BLUEO;
|
return 0;
|
||||||
if (p == &::g->players[::g->consoleplayer])
|
|
||||||
S_StartSound(NULL,sfx_oof);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case 134: // Red Lock
|
switch( line->special )
|
||||||
case 135:
|
|
||||||
if ( !p )
|
|
||||||
return 0;
|
|
||||||
if (!p->cards[it_redcard] && !p->cards[it_redskull])
|
|
||||||
{
|
{
|
||||||
p->message = PD_REDO;
|
case 99: // Blue Lock
|
||||||
if (p == &::g->players[::g->consoleplayer])
|
case 133:
|
||||||
S_StartSound(NULL,sfx_oof);
|
if( !p )
|
||||||
return 0;
|
{
|
||||||
}
|
return 0;
|
||||||
break;
|
}
|
||||||
|
if( !p->cards[it_bluecard] && !p->cards[it_blueskull] )
|
||||||
|
{
|
||||||
|
p->message = PD_BLUEO;
|
||||||
|
if( p == &::g->players[::g->consoleplayer] )
|
||||||
|
{
|
||||||
|
S_StartSound( NULL, sfx_oof );
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 136: // Yellow Lock
|
case 134: // Red Lock
|
||||||
case 137:
|
case 135:
|
||||||
if ( !p )
|
if( !p )
|
||||||
return 0;
|
{
|
||||||
if (!p->cards[it_yellowcard] &&
|
return 0;
|
||||||
!p->cards[it_yellowskull])
|
}
|
||||||
{
|
if( !p->cards[it_redcard] && !p->cards[it_redskull] )
|
||||||
p->message = PD_YELLOWO;
|
{
|
||||||
if (p == &::g->players[::g->consoleplayer])
|
p->message = PD_REDO;
|
||||||
S_StartSound(NULL,sfx_oof);
|
if( p == &::g->players[::g->consoleplayer] )
|
||||||
return 0;
|
{
|
||||||
}
|
S_StartSound( NULL, sfx_oof );
|
||||||
break;
|
}
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
return EV_DoDoor(line,type);
|
case 136: // Yellow Lock
|
||||||
|
case 137:
|
||||||
|
if( !p )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if( !p->cards[it_yellowcard] &&
|
||||||
|
!p->cards[it_yellowskull] )
|
||||||
|
{
|
||||||
|
p->message = PD_YELLOWO;
|
||||||
|
if( p == &::g->players[::g->consoleplayer] )
|
||||||
|
{
|
||||||
|
S_StartSound( NULL, sfx_oof );
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EV_DoDoor( line, type );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,85 +277,87 @@ EV_DoDoor
|
||||||
( line_t* line,
|
( line_t* line,
|
||||||
vldoor_e type )
|
vldoor_e type )
|
||||||
{
|
{
|
||||||
int secnum,rtn;
|
int secnum, rtn;
|
||||||
sector_t* sec;
|
sector_t* sec;
|
||||||
vldoor_t* door;
|
vldoor_t* door;
|
||||||
|
|
||||||
secnum = -1;
|
secnum = -1;
|
||||||
rtn = 0;
|
rtn = 0;
|
||||||
|
|
||||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||||
{
|
|
||||||
sec = &::g->sectors[secnum];
|
|
||||||
if (sec->specialdata)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
|
|
||||||
// new door thinker
|
|
||||||
rtn = 1;
|
|
||||||
door = (vldoor_t*)DoomLib::Z_Malloc(sizeof(*door), PU_LEVEL, 0);
|
|
||||||
P_AddThinker (&door->thinker);
|
|
||||||
sec->specialdata = door;
|
|
||||||
|
|
||||||
door->thinker.function.acp1 = (actionf_p1) T_VerticalDoor;
|
|
||||||
door->sector = sec;
|
|
||||||
door->type = type;
|
|
||||||
door->topwait = VDOORWAIT;
|
|
||||||
door->speed = VDOORSPEED;
|
|
||||||
|
|
||||||
switch(type)
|
|
||||||
{
|
{
|
||||||
case blazeClose:
|
sec = &::g->sectors[secnum];
|
||||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
if( sec->specialdata )
|
||||||
door->topheight -= 4*FRACUNIT;
|
{
|
||||||
door->direction = -1;
|
continue;
|
||||||
door->speed = VDOORSPEED * 4;
|
}
|
||||||
S_StartSound( &door->sector->soundorg,
|
|
||||||
sfx_bdcls);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case closed:
|
|
||||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
|
||||||
door->topheight -= 4*FRACUNIT;
|
|
||||||
door->direction = -1;
|
|
||||||
S_StartSound( &door->sector->soundorg,
|
|
||||||
sfx_dorcls);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case close30ThenOpen:
|
// new door thinker
|
||||||
door->topheight = sec->ceilingheight;
|
rtn = 1;
|
||||||
door->direction = -1;
|
door = ( vldoor_t* )DoomLib::Z_Malloc( sizeof( *door ), PU_LEVEL, 0 );
|
||||||
S_StartSound( &door->sector->soundorg,
|
P_AddThinker( &door->thinker );
|
||||||
sfx_dorcls);
|
sec->specialdata = door;
|
||||||
break;
|
|
||||||
|
|
||||||
case blazeRaise:
|
door->thinker.function.acp1 = ( actionf_p1 ) T_VerticalDoor;
|
||||||
case blazeOpen:
|
door->sector = sec;
|
||||||
door->direction = 1;
|
door->type = type;
|
||||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
door->topwait = VDOORWAIT;
|
||||||
door->topheight -= 4*FRACUNIT;
|
door->speed = VDOORSPEED;
|
||||||
door->speed = VDOORSPEED * 4;
|
|
||||||
if (door->topheight != sec->ceilingheight)
|
|
||||||
S_StartSound( &door->sector->soundorg,
|
|
||||||
sfx_bdopn);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case normal:
|
switch( type )
|
||||||
case opened:
|
{
|
||||||
door->direction = 1;
|
case blazeClose:
|
||||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||||
door->topheight -= 4*FRACUNIT;
|
door->topheight -= 4 * FRACUNIT;
|
||||||
if (door->topheight != sec->ceilingheight)
|
door->direction = -1;
|
||||||
S_StartSound( &door->sector->soundorg,
|
door->speed = VDOORSPEED * 4;
|
||||||
sfx_doropn);
|
S_StartSound( &door->sector->soundorg,
|
||||||
break;
|
sfx_bdcls );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case closed:
|
||||||
|
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||||
|
door->topheight -= 4 * FRACUNIT;
|
||||||
|
door->direction = -1;
|
||||||
|
S_StartSound( &door->sector->soundorg,
|
||||||
|
sfx_dorcls );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case close30ThenOpen:
|
||||||
|
door->topheight = sec->ceilingheight;
|
||||||
|
door->direction = -1;
|
||||||
|
S_StartSound( &door->sector->soundorg,
|
||||||
|
sfx_dorcls );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case blazeRaise:
|
||||||
|
case blazeOpen:
|
||||||
|
door->direction = 1;
|
||||||
|
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||||
|
door->topheight -= 4 * FRACUNIT;
|
||||||
|
door->speed = VDOORSPEED * 4;
|
||||||
|
if( door->topheight != sec->ceilingheight )
|
||||||
|
S_StartSound( &door->sector->soundorg,
|
||||||
|
sfx_bdopn );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case normal:
|
||||||
|
case opened:
|
||||||
|
door->direction = 1;
|
||||||
|
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||||
|
door->topheight -= 4 * FRACUNIT;
|
||||||
|
if( door->topheight != sec->ceilingheight )
|
||||||
|
S_StartSound( &door->sector->soundorg,
|
||||||
|
sfx_doropn );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
return rtn;
|
||||||
}
|
|
||||||
return rtn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -353,175 +369,192 @@ EV_VerticalDoor
|
||||||
( line_t* line,
|
( line_t* line,
|
||||||
mobj_t* thing )
|
mobj_t* thing )
|
||||||
{
|
{
|
||||||
player_t* player;
|
player_t* player;
|
||||||
int secnum;
|
int secnum;
|
||||||
sector_t* sec;
|
sector_t* sec;
|
||||||
vldoor_t* door;
|
vldoor_t* door;
|
||||||
int side;
|
int side;
|
||||||
|
|
||||||
side = 0; // only front ::g->sides can be used
|
side = 0; // only front ::g->sides can be used
|
||||||
|
|
||||||
// Check for locks
|
// Check for locks
|
||||||
player = thing->player;
|
player = thing->player;
|
||||||
|
|
||||||
switch(line->special)
|
switch( line->special )
|
||||||
{
|
|
||||||
case 26: // Blue Lock
|
|
||||||
case 32:
|
|
||||||
if ( !player )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!player->cards[it_bluecard] && !player->cards[it_blueskull])
|
|
||||||
{
|
{
|
||||||
player->message = PD_BLUEK;
|
case 26: // Blue Lock
|
||||||
if (globalNetworking || (player == &::g->players[::g->consoleplayer]))
|
case 32:
|
||||||
S_StartSound(player->mo,sfx_oof);
|
if( !player )
|
||||||
return;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !player->cards[it_bluecard] && !player->cards[it_blueskull] )
|
||||||
|
{
|
||||||
|
player->message = PD_BLUEK;
|
||||||
|
if( globalNetworking || ( player == &::g->players[::g->consoleplayer] ) )
|
||||||
|
{
|
||||||
|
S_StartSound( player->mo, sfx_oof );
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 27: // Yellow Lock
|
||||||
|
case 34:
|
||||||
|
if( !player )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !player->cards[it_yellowcard] &&
|
||||||
|
!player->cards[it_yellowskull] )
|
||||||
|
{
|
||||||
|
player->message = PD_YELLOWK;
|
||||||
|
if( globalNetworking || ( player == &::g->players[::g->consoleplayer] ) )
|
||||||
|
{
|
||||||
|
S_StartSound( player->mo, sfx_oof );
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 28: // Red Lock
|
||||||
|
case 33:
|
||||||
|
if( !player )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !player->cards[it_redcard] && !player->cards[it_redskull] )
|
||||||
|
{
|
||||||
|
player->message = PD_REDK;
|
||||||
|
if( globalNetworking || ( player == &::g->players[::g->consoleplayer] ) )
|
||||||
|
{
|
||||||
|
S_StartSound( player->mo, sfx_oof );
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case 27: // Yellow Lock
|
// if the sector has an active thinker, use it
|
||||||
case 34:
|
sec = ::g->sides[ line->sidenum[side ^ 1]] .sector;
|
||||||
if ( !player )
|
secnum = sec -::g->sectors;
|
||||||
return;
|
|
||||||
|
|
||||||
if (!player->cards[it_yellowcard] &&
|
if( sec->specialdata )
|
||||||
!player->cards[it_yellowskull])
|
|
||||||
{
|
{
|
||||||
player->message = PD_YELLOWK;
|
door = ( vldoor_t* )sec->specialdata;
|
||||||
if (globalNetworking || (player == &::g->players[::g->consoleplayer]))
|
switch( line->special )
|
||||||
S_StartSound(player->mo,sfx_oof);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 28: // Red Lock
|
|
||||||
case 33:
|
|
||||||
if ( !player )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!player->cards[it_redcard] && !player->cards[it_redskull])
|
|
||||||
{
|
|
||||||
player->message = PD_REDK;
|
|
||||||
if (globalNetworking || (player == &::g->players[::g->consoleplayer]))
|
|
||||||
S_StartSound(player->mo,sfx_oof);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the sector has an active thinker, use it
|
|
||||||
sec = ::g->sides[ line->sidenum[side^1]] .sector;
|
|
||||||
secnum = sec-::g->sectors;
|
|
||||||
|
|
||||||
if (sec->specialdata)
|
|
||||||
{
|
|
||||||
door = (vldoor_t*)sec->specialdata;
|
|
||||||
switch(line->special)
|
|
||||||
{
|
|
||||||
case 1: // ONLY FOR "RAISE" DOORS, NOT "OPEN"s
|
|
||||||
case 26:
|
|
||||||
case 27:
|
|
||||||
case 28:
|
|
||||||
case 117:
|
|
||||||
if (door->direction == -1)
|
|
||||||
door->direction = 1; // go back up
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!thing->player)
|
|
||||||
return; // JDC: bad guys never close doors
|
|
||||||
|
|
||||||
door->direction = -1; // start going down immediately
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// for proper sound
|
|
||||||
if (globalNetworking || (player == &::g->players[::g->consoleplayer])) {
|
|
||||||
switch(line->special)
|
|
||||||
{
|
{
|
||||||
case 117: // BLAZING DOOR RAISE
|
case 1: // ONLY FOR "RAISE" DOORS, NOT "OPEN"s
|
||||||
case 118: // BLAZING DOOR OPEN
|
case 26:
|
||||||
S_StartSound( &sec->soundorg,sfx_bdopn);
|
case 27:
|
||||||
break;
|
case 28:
|
||||||
|
case 117:
|
||||||
|
if( door->direction == -1 )
|
||||||
|
{
|
||||||
|
door->direction = 1; // go back up
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( !thing->player )
|
||||||
|
{
|
||||||
|
return; // JDC: bad guys never close doors
|
||||||
|
}
|
||||||
|
|
||||||
case 1: // NORMAL DOOR SOUND
|
door->direction = -1; // start going down immediately
|
||||||
case 31:
|
}
|
||||||
S_StartSound( &sec->soundorg,sfx_doropn);
|
return;
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default: // LOCKED DOOR SOUND
|
// for proper sound
|
||||||
S_StartSound( &sec->soundorg,sfx_doropn);
|
if( globalNetworking || ( player == &::g->players[::g->consoleplayer] ) )
|
||||||
break;
|
{
|
||||||
|
switch( line->special )
|
||||||
|
{
|
||||||
|
case 117: // BLAZING DOOR RAISE
|
||||||
|
case 118: // BLAZING DOOR OPEN
|
||||||
|
S_StartSound( &sec->soundorg, sfx_bdopn );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: // NORMAL DOOR SOUND
|
||||||
|
case 31:
|
||||||
|
S_StartSound( &sec->soundorg, sfx_doropn );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // LOCKED DOOR SOUND
|
||||||
|
S_StartSound( &sec->soundorg, sfx_doropn );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// new door thinker
|
// new door thinker
|
||||||
door = (vldoor_t*)DoomLib::Z_Malloc(sizeof(*door), PU_LEVEL, 0);
|
door = ( vldoor_t* )DoomLib::Z_Malloc( sizeof( *door ), PU_LEVEL, 0 );
|
||||||
P_AddThinker (&door->thinker);
|
P_AddThinker( &door->thinker );
|
||||||
sec->specialdata = door;
|
sec->specialdata = door;
|
||||||
door->thinker.function.acp1 = (actionf_p1) T_VerticalDoor;
|
door->thinker.function.acp1 = ( actionf_p1 ) T_VerticalDoor;
|
||||||
door->sector = sec;
|
door->sector = sec;
|
||||||
door->direction = 1;
|
door->direction = 1;
|
||||||
door->speed = VDOORSPEED;
|
door->speed = VDOORSPEED;
|
||||||
door->topwait = VDOORWAIT;
|
door->topwait = VDOORWAIT;
|
||||||
|
|
||||||
switch(line->special)
|
switch( line->special )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
case 26:
|
case 26:
|
||||||
case 27:
|
case 27:
|
||||||
case 28:
|
case 28:
|
||||||
door->type = normal;
|
door->type = normal;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 31:
|
case 31:
|
||||||
case 32:
|
case 32:
|
||||||
case 33:
|
case 33:
|
||||||
case 34:
|
case 34:
|
||||||
door->type = opened;
|
door->type = opened;
|
||||||
line->special = 0;
|
line->special = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 117: // blazing door raise
|
case 117: // blazing door raise
|
||||||
door->type = blazeRaise;
|
door->type = blazeRaise;
|
||||||
door->speed = VDOORSPEED*4;
|
door->speed = VDOORSPEED * 4;
|
||||||
break;
|
break;
|
||||||
case 118: // blazing door open
|
case 118: // blazing door open
|
||||||
door->type = blazeOpen;
|
door->type = blazeOpen;
|
||||||
line->special = 0;
|
line->special = 0;
|
||||||
door->speed = VDOORSPEED*4;
|
door->speed = VDOORSPEED * 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the top and bottom of the movement range
|
// find the top and bottom of the movement range
|
||||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||||
door->topheight -= 4*FRACUNIT;
|
door->topheight -= 4 * FRACUNIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Spawn a door that closes after 30 seconds
|
// Spawn a door that closes after 30 seconds
|
||||||
//
|
//
|
||||||
void P_SpawnDoorCloseIn30 (sector_t* sec)
|
void P_SpawnDoorCloseIn30( sector_t* sec )
|
||||||
{
|
{
|
||||||
vldoor_t* door;
|
vldoor_t* door;
|
||||||
|
|
||||||
door = (vldoor_t*)DoomLib::Z_Malloc( sizeof(*door), PU_LEVEL, 0);
|
door = ( vldoor_t* )DoomLib::Z_Malloc( sizeof( *door ), PU_LEVEL, 0 );
|
||||||
|
|
||||||
P_AddThinker (&door->thinker);
|
P_AddThinker( &door->thinker );
|
||||||
|
|
||||||
sec->specialdata = door;
|
sec->specialdata = door;
|
||||||
sec->special = 0;
|
sec->special = 0;
|
||||||
|
|
||||||
door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor;
|
door->thinker.function.acp1 = ( actionf_p1 )T_VerticalDoor;
|
||||||
door->sector = sec;
|
door->sector = sec;
|
||||||
door->direction = 0;
|
door->direction = 0;
|
||||||
door->type = normal;
|
door->type = normal;
|
||||||
door->speed = VDOORSPEED;
|
door->speed = VDOORSPEED;
|
||||||
door->topcountdown = 30 * TICRATE;
|
door->topcountdown = 30 * TICRATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -532,24 +565,24 @@ P_SpawnDoorRaiseIn5Mins
|
||||||
( sector_t* sec,
|
( sector_t* sec,
|
||||||
int secnum )
|
int secnum )
|
||||||
{
|
{
|
||||||
vldoor_t* door;
|
vldoor_t* door;
|
||||||
|
|
||||||
door = (vldoor_t*)DoomLib::Z_Malloc( sizeof(*door), PU_LEVEL, 0);
|
door = ( vldoor_t* )DoomLib::Z_Malloc( sizeof( *door ), PU_LEVEL, 0 );
|
||||||
|
|
||||||
P_AddThinker (&door->thinker);
|
P_AddThinker( &door->thinker );
|
||||||
|
|
||||||
sec->specialdata = door;
|
sec->specialdata = door;
|
||||||
sec->special = 0;
|
sec->special = 0;
|
||||||
|
|
||||||
door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor;
|
door->thinker.function.acp1 = ( actionf_p1 )T_VerticalDoor;
|
||||||
door->sector = sec;
|
door->sector = sec;
|
||||||
door->direction = 2;
|
door->direction = 2;
|
||||||
door->type = raiseIn5Mins;
|
door->type = raiseIn5Mins;
|
||||||
door->speed = VDOORSPEED;
|
door->speed = VDOORSPEED;
|
||||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||||
door->topheight -= 4*FRACUNIT;
|
door->topheight -= 4 * FRACUNIT;
|
||||||
door->topwait = VDOORWAIT;
|
door->topwait = VDOORWAIT;
|
||||||
door->topcountdown = 5 * 60 * TICRATE;
|
door->topcountdown = 5 * 60 * TICRATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -59,202 +59,206 @@ T_MovePlane
|
||||||
int floorOrCeiling,
|
int floorOrCeiling,
|
||||||
int direction )
|
int direction )
|
||||||
{
|
{
|
||||||
qboolean flag;
|
qboolean flag;
|
||||||
fixed_t lastpos;
|
fixed_t lastpos;
|
||||||
|
|
||||||
switch(floorOrCeiling)
|
switch( floorOrCeiling )
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
// FLOOR
|
|
||||||
switch(direction)
|
|
||||||
{
|
{
|
||||||
case -1:
|
case 0:
|
||||||
// DOWN
|
// FLOOR
|
||||||
if (sector->floorheight - speed < dest)
|
switch( direction )
|
||||||
{
|
{
|
||||||
lastpos = sector->floorheight;
|
case -1:
|
||||||
sector->floorheight = dest;
|
// DOWN
|
||||||
flag = P_ChangeSector(sector,crush);
|
if( sector->floorheight - speed < dest )
|
||||||
if (flag == true)
|
{
|
||||||
{
|
lastpos = sector->floorheight;
|
||||||
sector->floorheight =lastpos;
|
sector->floorheight = dest;
|
||||||
P_ChangeSector(sector,crush);
|
flag = P_ChangeSector( sector, crush );
|
||||||
//return crushed;
|
if( flag == true )
|
||||||
}
|
{
|
||||||
return pastdest;
|
sector->floorheight = lastpos;
|
||||||
}
|
P_ChangeSector( sector, crush );
|
||||||
else
|
//return crushed;
|
||||||
{
|
}
|
||||||
lastpos = sector->floorheight;
|
return pastdest;
|
||||||
sector->floorheight -= speed;
|
}
|
||||||
flag = P_ChangeSector(sector,crush);
|
else
|
||||||
if (flag == true)
|
{
|
||||||
{
|
lastpos = sector->floorheight;
|
||||||
sector->floorheight = lastpos;
|
sector->floorheight -= speed;
|
||||||
P_ChangeSector(sector,crush);
|
flag = P_ChangeSector( sector, crush );
|
||||||
return crushed;
|
if( flag == true )
|
||||||
}
|
{
|
||||||
}
|
sector->floorheight = lastpos;
|
||||||
break;
|
P_ChangeSector( sector, crush );
|
||||||
|
return crushed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// UP
|
// UP
|
||||||
if (sector->floorheight + speed > dest)
|
if( sector->floorheight + speed > dest )
|
||||||
{
|
{
|
||||||
lastpos = sector->floorheight;
|
lastpos = sector->floorheight;
|
||||||
sector->floorheight = dest;
|
sector->floorheight = dest;
|
||||||
flag = P_ChangeSector(sector,crush);
|
flag = P_ChangeSector( sector, crush );
|
||||||
if (flag == true)
|
if( flag == true )
|
||||||
{
|
{
|
||||||
sector->floorheight = lastpos;
|
sector->floorheight = lastpos;
|
||||||
P_ChangeSector(sector,crush);
|
P_ChangeSector( sector, crush );
|
||||||
//return crushed;
|
//return crushed;
|
||||||
}
|
}
|
||||||
return pastdest;
|
return pastdest;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// COULD GET CRUSHED
|
// COULD GET CRUSHED
|
||||||
lastpos = sector->floorheight;
|
lastpos = sector->floorheight;
|
||||||
sector->floorheight += speed;
|
sector->floorheight += speed;
|
||||||
flag = P_ChangeSector(sector,crush);
|
flag = P_ChangeSector( sector, crush );
|
||||||
if (flag == true)
|
if( flag == true )
|
||||||
{
|
{
|
||||||
if (crush == true)
|
if( crush == true )
|
||||||
return crushed;
|
{
|
||||||
sector->floorheight = lastpos;
|
return crushed;
|
||||||
P_ChangeSector(sector,crush);
|
}
|
||||||
return crushed;
|
sector->floorheight = lastpos;
|
||||||
}
|
P_ChangeSector( sector, crush );
|
||||||
}
|
return crushed;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// CEILING
|
// CEILING
|
||||||
switch(direction)
|
switch( direction )
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
// DOWN
|
// DOWN
|
||||||
if (sector->ceilingheight - speed < dest)
|
if( sector->ceilingheight - speed < dest )
|
||||||
{
|
{
|
||||||
lastpos = sector->ceilingheight;
|
lastpos = sector->ceilingheight;
|
||||||
sector->ceilingheight = dest;
|
sector->ceilingheight = dest;
|
||||||
flag = P_ChangeSector(sector,crush);
|
flag = P_ChangeSector( sector, crush );
|
||||||
|
|
||||||
if (flag == true)
|
if( flag == true )
|
||||||
{
|
{
|
||||||
sector->ceilingheight = lastpos;
|
sector->ceilingheight = lastpos;
|
||||||
P_ChangeSector(sector,crush);
|
P_ChangeSector( sector, crush );
|
||||||
//return crushed;
|
//return crushed;
|
||||||
}
|
}
|
||||||
return pastdest;
|
return pastdest;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// COULD GET CRUSHED
|
// COULD GET CRUSHED
|
||||||
lastpos = sector->ceilingheight;
|
lastpos = sector->ceilingheight;
|
||||||
sector->ceilingheight -= speed;
|
sector->ceilingheight -= speed;
|
||||||
flag = P_ChangeSector(sector,crush);
|
flag = P_ChangeSector( sector, crush );
|
||||||
|
|
||||||
if (flag == true)
|
if( flag == true )
|
||||||
{
|
{
|
||||||
if (crush == true)
|
if( crush == true )
|
||||||
return crushed;
|
{
|
||||||
sector->ceilingheight = lastpos;
|
return crushed;
|
||||||
P_ChangeSector(sector,crush);
|
}
|
||||||
return crushed;
|
sector->ceilingheight = lastpos;
|
||||||
}
|
P_ChangeSector( sector, crush );
|
||||||
}
|
return crushed;
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// UP
|
// UP
|
||||||
if (sector->ceilingheight + speed > dest)
|
if( sector->ceilingheight + speed > dest )
|
||||||
{
|
{
|
||||||
lastpos = sector->ceilingheight;
|
lastpos = sector->ceilingheight;
|
||||||
sector->ceilingheight = dest;
|
sector->ceilingheight = dest;
|
||||||
flag = P_ChangeSector(sector,crush);
|
flag = P_ChangeSector( sector, crush );
|
||||||
if (flag == true)
|
if( flag == true )
|
||||||
{
|
{
|
||||||
sector->ceilingheight = lastpos;
|
sector->ceilingheight = lastpos;
|
||||||
P_ChangeSector(sector,crush);
|
P_ChangeSector( sector, crush );
|
||||||
//return crushed;
|
//return crushed;
|
||||||
}
|
}
|
||||||
return pastdest;
|
return pastdest;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lastpos = sector->ceilingheight;
|
lastpos = sector->ceilingheight;
|
||||||
sector->ceilingheight += speed;
|
sector->ceilingheight += speed;
|
||||||
flag = P_ChangeSector(sector,crush);
|
flag = P_ChangeSector( sector, crush );
|
||||||
// UNUSED
|
// UNUSED
|
||||||
#if 0
|
#if 0
|
||||||
if (flag == true)
|
if( flag == true )
|
||||||
{
|
{
|
||||||
sector->ceilingheight = lastpos;
|
sector->ceilingheight = lastpos;
|
||||||
P_ChangeSector(sector,crush);
|
P_ChangeSector( sector, crush );
|
||||||
return crushed;
|
return crushed;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// MOVE A FLOOR TO IT'S DESTINATION (UP OR DOWN)
|
// MOVE A FLOOR TO IT'S DESTINATION (UP OR DOWN)
|
||||||
//
|
//
|
||||||
void T_MoveFloor(floormove_t* floor)
|
void T_MoveFloor( floormove_t* floor )
|
||||||
{
|
{
|
||||||
result_e res;
|
result_e res;
|
||||||
|
|
||||||
res = T_MovePlane(floor->sector,
|
res = T_MovePlane( floor->sector,
|
||||||
floor->speed,
|
floor->speed,
|
||||||
floor->floordestheight,
|
floor->floordestheight,
|
||||||
floor->crush,0,floor->direction);
|
floor->crush, 0, floor->direction );
|
||||||
|
|
||||||
if (!(::g->leveltime&7))
|
if( !( ::g->leveltime & 7 ) )
|
||||||
S_StartSound( &floor->sector->soundorg,
|
S_StartSound( &floor->sector->soundorg,
|
||||||
sfx_stnmov);
|
sfx_stnmov );
|
||||||
|
|
||||||
if (res == pastdest)
|
if( res == pastdest )
|
||||||
{
|
|
||||||
floor->sector->specialdata = NULL;
|
|
||||||
|
|
||||||
if (floor->direction == 1)
|
|
||||||
{
|
{
|
||||||
switch(floor->type)
|
floor->sector->specialdata = NULL;
|
||||||
{
|
|
||||||
case donutRaise:
|
|
||||||
floor->sector->special = floor->newspecial;
|
|
||||||
floor->sector->floorpic = floor->texture;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (floor->direction == -1)
|
|
||||||
{
|
|
||||||
switch(floor->type)
|
|
||||||
{
|
|
||||||
case lowerAndChange:
|
|
||||||
floor->sector->special = floor->newspecial;
|
|
||||||
floor->sector->floorpic = floor->texture;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
P_RemoveThinker(&floor->thinker);
|
|
||||||
|
|
||||||
S_StartSound( &floor->sector->soundorg,
|
if( floor->direction == 1 )
|
||||||
sfx_pstop);
|
{
|
||||||
}
|
switch( floor->type )
|
||||||
|
{
|
||||||
|
case donutRaise:
|
||||||
|
floor->sector->special = floor->newspecial;
|
||||||
|
floor->sector->floorpic = floor->texture;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( floor->direction == -1 )
|
||||||
|
{
|
||||||
|
switch( floor->type )
|
||||||
|
{
|
||||||
|
case lowerAndChange:
|
||||||
|
floor->sector->special = floor->newspecial;
|
||||||
|
floor->sector->floorpic = floor->texture;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
P_RemoveThinker( &floor->thinker );
|
||||||
|
|
||||||
|
S_StartSound( &floor->sector->soundorg,
|
||||||
|
sfx_pstop );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,186 +270,192 @@ EV_DoFloor
|
||||||
( line_t* line,
|
( line_t* line,
|
||||||
floor_e floortype )
|
floor_e floortype )
|
||||||
{
|
{
|
||||||
int secnum;
|
int secnum;
|
||||||
int rtn;
|
int rtn;
|
||||||
int i;
|
int i;
|
||||||
sector_t* sec;
|
sector_t* sec;
|
||||||
floormove_t* floor;
|
floormove_t* floor;
|
||||||
|
|
||||||
secnum = -1;
|
secnum = -1;
|
||||||
rtn = 0;
|
rtn = 0;
|
||||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||||
{
|
|
||||||
sec = &::g->sectors[secnum];
|
|
||||||
|
|
||||||
// ALREADY MOVING? IF SO, KEEP GOING...
|
|
||||||
if (sec->specialdata)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// new floor thinker
|
|
||||||
rtn = 1;
|
|
||||||
floor = (floormove_t*)DoomLib::Z_Malloc(sizeof(*floor), PU_LEVEL, 0);
|
|
||||||
P_AddThinker (&floor->thinker);
|
|
||||||
sec->specialdata = floor;
|
|
||||||
floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
|
|
||||||
floor->type = floortype;
|
|
||||||
floor->crush = false;
|
|
||||||
|
|
||||||
switch(floortype)
|
|
||||||
{
|
{
|
||||||
case lowerFloor:
|
sec = &::g->sectors[secnum];
|
||||||
floor->direction = -1;
|
|
||||||
floor->sector = sec;
|
|
||||||
floor->speed = FLOORSPEED;
|
|
||||||
floor->floordestheight =
|
|
||||||
P_FindHighestFloorSurrounding(sec);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case lowerFloorToLowest:
|
// ALREADY MOVING? IF SO, KEEP GOING...
|
||||||
floor->direction = -1;
|
if( sec->specialdata )
|
||||||
floor->sector = sec;
|
|
||||||
floor->speed = FLOORSPEED;
|
|
||||||
floor->floordestheight =
|
|
||||||
P_FindLowestFloorSurrounding(sec);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case turboLower:
|
|
||||||
floor->direction = -1;
|
|
||||||
floor->sector = sec;
|
|
||||||
floor->speed = FLOORSPEED * 4;
|
|
||||||
floor->floordestheight =
|
|
||||||
P_FindHighestFloorSurrounding(sec);
|
|
||||||
if (floor->floordestheight != sec->floorheight)
|
|
||||||
floor->floordestheight += 8*FRACUNIT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case raiseFloorCrush:
|
|
||||||
floor->crush = true;
|
|
||||||
case raiseFloor:
|
|
||||||
floor->direction = 1;
|
|
||||||
floor->sector = sec;
|
|
||||||
floor->speed = FLOORSPEED;
|
|
||||||
floor->floordestheight =
|
|
||||||
P_FindLowestCeilingSurrounding(sec);
|
|
||||||
if (floor->floordestheight > sec->ceilingheight)
|
|
||||||
floor->floordestheight = sec->ceilingheight;
|
|
||||||
floor->floordestheight -= (8*FRACUNIT)*
|
|
||||||
(floortype == raiseFloorCrush);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case raiseFloorTurbo:
|
|
||||||
floor->direction = 1;
|
|
||||||
floor->sector = sec;
|
|
||||||
floor->speed = FLOORSPEED*4;
|
|
||||||
floor->floordestheight =
|
|
||||||
P_FindNextHighestFloor(sec,sec->floorheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case raiseFloorToNearest:
|
|
||||||
floor->direction = 1;
|
|
||||||
floor->sector = sec;
|
|
||||||
floor->speed = FLOORSPEED;
|
|
||||||
floor->floordestheight =
|
|
||||||
P_FindNextHighestFloor(sec,sec->floorheight);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case raiseFloor24:
|
|
||||||
floor->direction = 1;
|
|
||||||
floor->sector = sec;
|
|
||||||
floor->speed = FLOORSPEED;
|
|
||||||
floor->floordestheight = floor->sector->floorheight +
|
|
||||||
24 * FRACUNIT;
|
|
||||||
break;
|
|
||||||
case raiseFloor512:
|
|
||||||
floor->direction = 1;
|
|
||||||
floor->sector = sec;
|
|
||||||
floor->speed = FLOORSPEED;
|
|
||||||
floor->floordestheight = floor->sector->floorheight +
|
|
||||||
512 * FRACUNIT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case raiseFloor24AndChange:
|
|
||||||
floor->direction = 1;
|
|
||||||
floor->sector = sec;
|
|
||||||
floor->speed = FLOORSPEED;
|
|
||||||
floor->floordestheight = floor->sector->floorheight +
|
|
||||||
24 * FRACUNIT;
|
|
||||||
sec->floorpic = line->frontsector->floorpic;
|
|
||||||
sec->special = line->frontsector->special;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case raiseToTexture:
|
|
||||||
{
|
|
||||||
int minsize = MAXINT;
|
|
||||||
side_t* side;
|
|
||||||
|
|
||||||
floor->direction = 1;
|
|
||||||
floor->sector = sec;
|
|
||||||
floor->speed = FLOORSPEED;
|
|
||||||
for (i = 0; i < sec->linecount; i++)
|
|
||||||
{
|
|
||||||
if (twoSided (secnum, i) )
|
|
||||||
{
|
|
||||||
side = getSide(secnum,i,0);
|
|
||||||
if (side->bottomtexture >= 0)
|
|
||||||
if (::g->s_textureheight[side->bottomtexture] <
|
|
||||||
minsize)
|
|
||||||
minsize =
|
|
||||||
::g->s_textureheight[side->bottomtexture];
|
|
||||||
side = getSide(secnum,i,1);
|
|
||||||
if (side->bottomtexture >= 0)
|
|
||||||
if (::g->s_textureheight[side->bottomtexture] <
|
|
||||||
minsize)
|
|
||||||
minsize =
|
|
||||||
::g->s_textureheight[side->bottomtexture];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
floor->floordestheight =
|
|
||||||
floor->sector->floorheight + minsize;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case lowerAndChange:
|
|
||||||
floor->direction = -1;
|
|
||||||
floor->sector = sec;
|
|
||||||
floor->speed = FLOORSPEED;
|
|
||||||
floor->floordestheight =
|
|
||||||
P_FindLowestFloorSurrounding(sec);
|
|
||||||
floor->texture = sec->floorpic;
|
|
||||||
|
|
||||||
for (i = 0; i < sec->linecount; i++)
|
|
||||||
{
|
|
||||||
if ( twoSided(secnum, i) )
|
|
||||||
{
|
{
|
||||||
if (getSide(secnum,i,0)->sector-::g->sectors == secnum)
|
continue;
|
||||||
{
|
}
|
||||||
sec = getSector(secnum,i,1);
|
|
||||||
|
// new floor thinker
|
||||||
if (sec->floorheight == floor->floordestheight)
|
rtn = 1;
|
||||||
{
|
floor = ( floormove_t* )DoomLib::Z_Malloc( sizeof( *floor ), PU_LEVEL, 0 );
|
||||||
floor->texture = sec->floorpic;
|
P_AddThinker( &floor->thinker );
|
||||||
floor->newspecial = sec->special;
|
sec->specialdata = floor;
|
||||||
break;
|
floor->thinker.function.acp1 = ( actionf_p1 ) T_MoveFloor;
|
||||||
}
|
floor->type = floortype;
|
||||||
}
|
floor->crush = false;
|
||||||
else
|
|
||||||
{
|
switch( floortype )
|
||||||
sec = getSector(secnum,i,0);
|
{
|
||||||
|
case lowerFloor:
|
||||||
if (sec->floorheight == floor->floordestheight)
|
floor->direction = -1;
|
||||||
{
|
floor->sector = sec;
|
||||||
floor->texture = sec->floorpic;
|
floor->speed = FLOORSPEED;
|
||||||
floor->newspecial = sec->special;
|
floor->floordestheight =
|
||||||
break;
|
P_FindHighestFloorSurrounding( sec );
|
||||||
}
|
break;
|
||||||
}
|
|
||||||
|
case lowerFloorToLowest:
|
||||||
|
floor->direction = -1;
|
||||||
|
floor->sector = sec;
|
||||||
|
floor->speed = FLOORSPEED;
|
||||||
|
floor->floordestheight =
|
||||||
|
P_FindLowestFloorSurrounding( sec );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case turboLower:
|
||||||
|
floor->direction = -1;
|
||||||
|
floor->sector = sec;
|
||||||
|
floor->speed = FLOORSPEED * 4;
|
||||||
|
floor->floordestheight =
|
||||||
|
P_FindHighestFloorSurrounding( sec );
|
||||||
|
if( floor->floordestheight != sec->floorheight )
|
||||||
|
{
|
||||||
|
floor->floordestheight += 8 * FRACUNIT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case raiseFloorCrush:
|
||||||
|
floor->crush = true;
|
||||||
|
case raiseFloor:
|
||||||
|
floor->direction = 1;
|
||||||
|
floor->sector = sec;
|
||||||
|
floor->speed = FLOORSPEED;
|
||||||
|
floor->floordestheight =
|
||||||
|
P_FindLowestCeilingSurrounding( sec );
|
||||||
|
if( floor->floordestheight > sec->ceilingheight )
|
||||||
|
{
|
||||||
|
floor->floordestheight = sec->ceilingheight;
|
||||||
|
}
|
||||||
|
floor->floordestheight -= ( 8 * FRACUNIT ) *
|
||||||
|
( floortype == raiseFloorCrush );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case raiseFloorTurbo:
|
||||||
|
floor->direction = 1;
|
||||||
|
floor->sector = sec;
|
||||||
|
floor->speed = FLOORSPEED * 4;
|
||||||
|
floor->floordestheight =
|
||||||
|
P_FindNextHighestFloor( sec, sec->floorheight );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case raiseFloorToNearest:
|
||||||
|
floor->direction = 1;
|
||||||
|
floor->sector = sec;
|
||||||
|
floor->speed = FLOORSPEED;
|
||||||
|
floor->floordestheight =
|
||||||
|
P_FindNextHighestFloor( sec, sec->floorheight );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case raiseFloor24:
|
||||||
|
floor->direction = 1;
|
||||||
|
floor->sector = sec;
|
||||||
|
floor->speed = FLOORSPEED;
|
||||||
|
floor->floordestheight = floor->sector->floorheight +
|
||||||
|
24 * FRACUNIT;
|
||||||
|
break;
|
||||||
|
case raiseFloor512:
|
||||||
|
floor->direction = 1;
|
||||||
|
floor->sector = sec;
|
||||||
|
floor->speed = FLOORSPEED;
|
||||||
|
floor->floordestheight = floor->sector->floorheight +
|
||||||
|
512 * FRACUNIT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case raiseFloor24AndChange:
|
||||||
|
floor->direction = 1;
|
||||||
|
floor->sector = sec;
|
||||||
|
floor->speed = FLOORSPEED;
|
||||||
|
floor->floordestheight = floor->sector->floorheight +
|
||||||
|
24 * FRACUNIT;
|
||||||
|
sec->floorpic = line->frontsector->floorpic;
|
||||||
|
sec->special = line->frontsector->special;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case raiseToTexture:
|
||||||
|
{
|
||||||
|
int minsize = MAXINT;
|
||||||
|
side_t* side;
|
||||||
|
|
||||||
|
floor->direction = 1;
|
||||||
|
floor->sector = sec;
|
||||||
|
floor->speed = FLOORSPEED;
|
||||||
|
for( i = 0; i < sec->linecount; i++ )
|
||||||
|
{
|
||||||
|
if( twoSided( secnum, i ) )
|
||||||
|
{
|
||||||
|
side = getSide( secnum, i, 0 );
|
||||||
|
if( side->bottomtexture >= 0 )
|
||||||
|
if( ::g->s_textureheight[side->bottomtexture] <
|
||||||
|
minsize )
|
||||||
|
minsize =
|
||||||
|
::g->s_textureheight[side->bottomtexture];
|
||||||
|
side = getSide( secnum, i, 1 );
|
||||||
|
if( side->bottomtexture >= 0 )
|
||||||
|
if( ::g->s_textureheight[side->bottomtexture] <
|
||||||
|
minsize )
|
||||||
|
minsize =
|
||||||
|
::g->s_textureheight[side->bottomtexture];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
floor->floordestheight =
|
||||||
|
floor->sector->floorheight + minsize;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case lowerAndChange:
|
||||||
|
floor->direction = -1;
|
||||||
|
floor->sector = sec;
|
||||||
|
floor->speed = FLOORSPEED;
|
||||||
|
floor->floordestheight =
|
||||||
|
P_FindLowestFloorSurrounding( sec );
|
||||||
|
floor->texture = sec->floorpic;
|
||||||
|
|
||||||
|
for( i = 0; i < sec->linecount; i++ )
|
||||||
|
{
|
||||||
|
if( twoSided( secnum, i ) )
|
||||||
|
{
|
||||||
|
if( getSide( secnum, i, 0 )->sector -::g->sectors == secnum )
|
||||||
|
{
|
||||||
|
sec = getSector( secnum, i, 1 );
|
||||||
|
|
||||||
|
if( sec->floorheight == floor->floordestheight )
|
||||||
|
{
|
||||||
|
floor->texture = sec->floorpic;
|
||||||
|
floor->newspecial = sec->special;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sec = getSector( secnum, i, 0 );
|
||||||
|
|
||||||
|
if( sec->floorheight == floor->floordestheight )
|
||||||
|
{
|
||||||
|
floor->texture = sec->floorpic;
|
||||||
|
floor->newspecial = sec->special;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
return rtn;
|
||||||
return rtn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -459,103 +469,114 @@ EV_BuildStairs
|
||||||
( line_t* line,
|
( line_t* line,
|
||||||
stair_e type )
|
stair_e type )
|
||||||
{
|
{
|
||||||
int secnum;
|
int secnum;
|
||||||
int height;
|
int height;
|
||||||
int i;
|
int i;
|
||||||
int newsecnum;
|
int newsecnum;
|
||||||
int texture;
|
int texture;
|
||||||
int ok;
|
int ok;
|
||||||
int rtn;
|
int rtn;
|
||||||
|
|
||||||
sector_t* sec;
|
sector_t* sec;
|
||||||
sector_t* tsec;
|
sector_t* tsec;
|
||||||
|
|
||||||
floormove_t* floor;
|
floormove_t* floor;
|
||||||
|
|
||||||
fixed_t stairsize = 0;
|
fixed_t stairsize = 0;
|
||||||
fixed_t speed = 0;
|
fixed_t speed = 0;
|
||||||
|
|
||||||
secnum = -1;
|
secnum = -1;
|
||||||
rtn = 0;
|
rtn = 0;
|
||||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||||
{
|
|
||||||
sec = &::g->sectors[secnum];
|
|
||||||
|
|
||||||
// ALREADY MOVING? IF SO, KEEP GOING...
|
|
||||||
if (sec->specialdata)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// new floor thinker
|
|
||||||
rtn = 1;
|
|
||||||
floor = (floormove_t*)DoomLib::Z_Malloc(sizeof(*floor), PU_LEVEL, 0);
|
|
||||||
P_AddThinker (&floor->thinker);
|
|
||||||
sec->specialdata = floor;
|
|
||||||
floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
|
|
||||||
floor->direction = 1;
|
|
||||||
floor->sector = sec;
|
|
||||||
switch(type)
|
|
||||||
{
|
{
|
||||||
case build8:
|
sec = &::g->sectors[secnum];
|
||||||
speed = FLOORSPEED/4;
|
|
||||||
stairsize = 8*FRACUNIT;
|
|
||||||
break;
|
|
||||||
case turbo16:
|
|
||||||
speed = FLOORSPEED*4;
|
|
||||||
stairsize = 16*FRACUNIT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
floor->speed = speed;
|
|
||||||
height = sec->floorheight + stairsize;
|
|
||||||
floor->floordestheight = height;
|
|
||||||
|
|
||||||
texture = sec->floorpic;
|
// ALREADY MOVING? IF SO, KEEP GOING...
|
||||||
|
if( sec->specialdata )
|
||||||
// Find next sector to raise
|
{
|
||||||
// 1. Find 2-sided line with same sector side[0]
|
continue;
|
||||||
// 2. Other side is the next sector to raise
|
}
|
||||||
do
|
|
||||||
{
|
|
||||||
ok = 0;
|
|
||||||
for (i = 0;i < sec->linecount;i++)
|
|
||||||
{
|
|
||||||
if ( !((sec->lines[i])->flags & ML_TWOSIDED) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
tsec = (sec->lines[i])->frontsector;
|
|
||||||
newsecnum = tsec-::g->sectors;
|
|
||||||
|
|
||||||
if (secnum != newsecnum)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
tsec = (sec->lines[i])->backsector;
|
|
||||||
newsecnum = tsec - ::g->sectors;
|
|
||||||
|
|
||||||
if (tsec->floorpic != texture)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
height += stairsize;
|
|
||||||
|
|
||||||
if (tsec->specialdata)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
sec = tsec;
|
|
||||||
secnum = newsecnum;
|
|
||||||
floor = (floormove_t*)DoomLib::Z_Malloc(sizeof(*floor), PU_LEVEL, 0);
|
|
||||||
|
|
||||||
P_AddThinker (&floor->thinker);
|
|
||||||
|
|
||||||
|
// new floor thinker
|
||||||
|
rtn = 1;
|
||||||
|
floor = ( floormove_t* )DoomLib::Z_Malloc( sizeof( *floor ), PU_LEVEL, 0 );
|
||||||
|
P_AddThinker( &floor->thinker );
|
||||||
sec->specialdata = floor;
|
sec->specialdata = floor;
|
||||||
floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
|
floor->thinker.function.acp1 = ( actionf_p1 ) T_MoveFloor;
|
||||||
floor->direction = 1;
|
floor->direction = 1;
|
||||||
floor->sector = sec;
|
floor->sector = sec;
|
||||||
|
switch( type )
|
||||||
|
{
|
||||||
|
case build8:
|
||||||
|
speed = FLOORSPEED / 4;
|
||||||
|
stairsize = 8 * FRACUNIT;
|
||||||
|
break;
|
||||||
|
case turbo16:
|
||||||
|
speed = FLOORSPEED * 4;
|
||||||
|
stairsize = 16 * FRACUNIT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
floor->speed = speed;
|
floor->speed = speed;
|
||||||
|
height = sec->floorheight + stairsize;
|
||||||
floor->floordestheight = height;
|
floor->floordestheight = height;
|
||||||
ok = 1;
|
|
||||||
break;
|
texture = sec->floorpic;
|
||||||
}
|
|
||||||
} while(ok);
|
// Find next sector to raise
|
||||||
}
|
// 1. Find 2-sided line with same sector side[0]
|
||||||
return rtn;
|
// 2. Other side is the next sector to raise
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ok = 0;
|
||||||
|
for( i = 0; i < sec->linecount; i++ )
|
||||||
|
{
|
||||||
|
if( !( ( sec->lines[i] )->flags & ML_TWOSIDED ) )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
tsec = ( sec->lines[i] )->frontsector;
|
||||||
|
newsecnum = tsec -::g->sectors;
|
||||||
|
|
||||||
|
if( secnum != newsecnum )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
tsec = ( sec->lines[i] )->backsector;
|
||||||
|
newsecnum = tsec - ::g->sectors;
|
||||||
|
|
||||||
|
if( tsec->floorpic != texture )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
height += stairsize;
|
||||||
|
|
||||||
|
if( tsec->specialdata )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
sec = tsec;
|
||||||
|
secnum = newsecnum;
|
||||||
|
floor = ( floormove_t* )DoomLib::Z_Malloc( sizeof( *floor ), PU_LEVEL, 0 );
|
||||||
|
|
||||||
|
P_AddThinker( &floor->thinker );
|
||||||
|
|
||||||
|
sec->specialdata = floor;
|
||||||
|
floor->thinker.function.acp1 = ( actionf_p1 ) T_MoveFloor;
|
||||||
|
floor->direction = 1;
|
||||||
|
floor->sector = sec;
|
||||||
|
floor->speed = speed;
|
||||||
|
floor->floordestheight = height;
|
||||||
|
ok = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while( ok );
|
||||||
|
}
|
||||||
|
return rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -31,11 +31,11 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
qboolean P_GivePower(player_t*, int);
|
qboolean P_GivePower( player_t*, int );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,21 +47,27 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
//
|
//
|
||||||
// T_FireFlicker
|
// T_FireFlicker
|
||||||
//
|
//
|
||||||
void T_FireFlicker (fireflicker_t* flick)
|
void T_FireFlicker( fireflicker_t* flick )
|
||||||
{
|
{
|
||||||
int amount;
|
int amount;
|
||||||
|
|
||||||
if (--flick->count)
|
if( --flick->count )
|
||||||
return;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
amount = (P_Random()&3)*16;
|
amount = ( P_Random() & 3 ) * 16;
|
||||||
|
|
||||||
if (flick->sector->lightlevel - amount < flick->minlight)
|
if( flick->sector->lightlevel - amount < flick->minlight )
|
||||||
flick->sector->lightlevel = flick->minlight;
|
{
|
||||||
else
|
flick->sector->lightlevel = flick->minlight;
|
||||||
flick->sector->lightlevel = flick->maxlight - amount;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flick->sector->lightlevel = flick->maxlight - amount;
|
||||||
|
}
|
||||||
|
|
||||||
flick->count = 4;
|
flick->count = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,23 +75,23 @@ void T_FireFlicker (fireflicker_t* flick)
|
||||||
//
|
//
|
||||||
// P_SpawnFireFlicker
|
// P_SpawnFireFlicker
|
||||||
//
|
//
|
||||||
void P_SpawnFireFlicker (sector_t* sector)
|
void P_SpawnFireFlicker( sector_t* sector )
|
||||||
{
|
{
|
||||||
fireflicker_t* flick;
|
fireflicker_t* flick;
|
||||||
|
|
||||||
// Note that we are resetting sector attributes.
|
// Note that we are resetting sector attributes.
|
||||||
// Nothing special about it during gameplay.
|
// Nothing special about it during gameplay.
|
||||||
sector->special = 0;
|
sector->special = 0;
|
||||||
|
|
||||||
flick = (fireflicker_t*)DoomLib::Z_Malloc( sizeof(*flick), PU_LEVEL, 0);
|
flick = ( fireflicker_t* )DoomLib::Z_Malloc( sizeof( *flick ), PU_LEVEL, 0 );
|
||||||
|
|
||||||
P_AddThinker (&flick->thinker);
|
P_AddThinker( &flick->thinker );
|
||||||
|
|
||||||
flick->thinker.function.acp1 = (actionf_p1) T_FireFlicker;
|
flick->thinker.function.acp1 = ( actionf_p1 ) T_FireFlicker;
|
||||||
flick->sector = sector;
|
flick->sector = sector;
|
||||||
flick->maxlight = sector->lightlevel;
|
flick->maxlight = sector->lightlevel;
|
||||||
flick->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel)+16;
|
flick->minlight = P_FindMinSurroundingLight( sector, sector->lightlevel ) + 16;
|
||||||
flick->count = 4;
|
flick->count = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,21 +105,23 @@ void P_SpawnFireFlicker (sector_t* sector)
|
||||||
// T_LightFlash
|
// T_LightFlash
|
||||||
// Do flashing lights.
|
// Do flashing lights.
|
||||||
//
|
//
|
||||||
void T_LightFlash (lightflash_t* flash)
|
void T_LightFlash( lightflash_t* flash )
|
||||||
{
|
{
|
||||||
if (--flash->count)
|
if( --flash->count )
|
||||||
return;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (flash->sector->lightlevel == flash->maxlight)
|
if( flash->sector->lightlevel == flash->maxlight )
|
||||||
{
|
{
|
||||||
flash-> sector->lightlevel = flash->minlight;
|
flash-> sector->lightlevel = flash->minlight;
|
||||||
flash->count = (P_Random()&flash->mintime)+1;
|
flash->count = ( P_Random()&flash->mintime ) + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flash-> sector->lightlevel = flash->maxlight;
|
flash-> sector->lightlevel = flash->maxlight;
|
||||||
flash->count = (P_Random()&flash->maxtime)+1;
|
flash->count = ( P_Random()&flash->maxtime ) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,25 +133,25 @@ void T_LightFlash (lightflash_t* flash)
|
||||||
// After the map has been loaded, scan each sector
|
// After the map has been loaded, scan each sector
|
||||||
// for specials that spawn thinkers
|
// for specials that spawn thinkers
|
||||||
//
|
//
|
||||||
void P_SpawnLightFlash (sector_t* sector)
|
void P_SpawnLightFlash( sector_t* sector )
|
||||||
{
|
{
|
||||||
lightflash_t* flash;
|
lightflash_t* flash;
|
||||||
|
|
||||||
// nothing special about it during gameplay
|
// nothing special about it during gameplay
|
||||||
sector->special = 0;
|
sector->special = 0;
|
||||||
|
|
||||||
flash = (lightflash_t*)DoomLib::Z_Malloc( sizeof(*flash), PU_LEVEL, 0);
|
flash = ( lightflash_t* )DoomLib::Z_Malloc( sizeof( *flash ), PU_LEVEL, 0 );
|
||||||
|
|
||||||
P_AddThinker (&flash->thinker);
|
P_AddThinker( &flash->thinker );
|
||||||
|
|
||||||
flash->thinker.function.acp1 = (actionf_p1) T_LightFlash;
|
flash->thinker.function.acp1 = ( actionf_p1 ) T_LightFlash;
|
||||||
flash->sector = sector;
|
flash->sector = sector;
|
||||||
flash->maxlight = sector->lightlevel;
|
flash->maxlight = sector->lightlevel;
|
||||||
|
|
||||||
flash->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel);
|
flash->minlight = P_FindMinSurroundingLight( sector, sector->lightlevel );
|
||||||
flash->maxtime = 64;
|
flash->maxtime = 64;
|
||||||
flash->mintime = 7;
|
flash->mintime = 7;
|
||||||
flash->count = (P_Random()&flash->maxtime)+1;
|
flash->count = ( P_Random()&flash->maxtime ) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,21 +164,23 @@ void P_SpawnLightFlash (sector_t* sector)
|
||||||
//
|
//
|
||||||
// T_StrobeFlash
|
// T_StrobeFlash
|
||||||
//
|
//
|
||||||
void T_StrobeFlash (strobe_t* flash)
|
void T_StrobeFlash( strobe_t* flash )
|
||||||
{
|
{
|
||||||
if (--flash->count)
|
if( --flash->count )
|
||||||
return;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (flash->sector->lightlevel == flash->minlight)
|
if( flash->sector->lightlevel == flash->minlight )
|
||||||
{
|
{
|
||||||
flash-> sector->lightlevel = flash->maxlight;
|
flash-> sector->lightlevel = flash->maxlight;
|
||||||
flash->count = flash->brighttime;
|
flash->count = flash->brighttime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flash-> sector->lightlevel = flash->minlight;
|
flash-> sector->lightlevel = flash->minlight;
|
||||||
flash->count =flash->darktime;
|
flash->count = flash->darktime;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,49 +197,57 @@ P_SpawnStrobeFlash
|
||||||
int fastOrSlow,
|
int fastOrSlow,
|
||||||
int inSync )
|
int inSync )
|
||||||
{
|
{
|
||||||
strobe_t* flash;
|
strobe_t* flash;
|
||||||
|
|
||||||
flash = (strobe_t*)DoomLib::Z_Malloc( sizeof(*flash), PU_LEVEL, 0);
|
flash = ( strobe_t* )DoomLib::Z_Malloc( sizeof( *flash ), PU_LEVEL, 0 );
|
||||||
|
|
||||||
P_AddThinker (&flash->thinker);
|
P_AddThinker( &flash->thinker );
|
||||||
|
|
||||||
flash->sector = sector;
|
flash->sector = sector;
|
||||||
flash->darktime = fastOrSlow;
|
flash->darktime = fastOrSlow;
|
||||||
flash->brighttime = STROBEBRIGHT;
|
flash->brighttime = STROBEBRIGHT;
|
||||||
flash->thinker.function.acp1 = (actionf_p1) T_StrobeFlash;
|
flash->thinker.function.acp1 = ( actionf_p1 ) T_StrobeFlash;
|
||||||
flash->maxlight = sector->lightlevel;
|
flash->maxlight = sector->lightlevel;
|
||||||
flash->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
|
flash->minlight = P_FindMinSurroundingLight( sector, sector->lightlevel );
|
||||||
|
|
||||||
if (flash->minlight == flash->maxlight)
|
if( flash->minlight == flash->maxlight )
|
||||||
flash->minlight = 0;
|
{
|
||||||
|
flash->minlight = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// nothing special about it during gameplay
|
// nothing special about it during gameplay
|
||||||
sector->special = 0;
|
sector->special = 0;
|
||||||
|
|
||||||
if (!inSync)
|
if( !inSync )
|
||||||
flash->count = (P_Random()&7)+1;
|
{
|
||||||
else
|
flash->count = ( P_Random() & 7 ) + 1;
|
||||||
flash->count = 1;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flash->count = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Start strobing lights (usually from a trigger)
|
// Start strobing lights (usually from a trigger)
|
||||||
//
|
//
|
||||||
void EV_StartLightStrobing(line_t* line)
|
void EV_StartLightStrobing( line_t* line )
|
||||||
{
|
{
|
||||||
int secnum;
|
int secnum;
|
||||||
sector_t* sec;
|
sector_t* sec;
|
||||||
|
|
||||||
secnum = -1;
|
secnum = -1;
|
||||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||||
{
|
{
|
||||||
sec = &::g->sectors[secnum];
|
sec = &::g->sectors[secnum];
|
||||||
if (sec->specialdata)
|
if( sec->specialdata )
|
||||||
continue;
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
P_SpawnStrobeFlash (sec,SLOWDARK, 0);
|
P_SpawnStrobeFlash( sec, SLOWDARK, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,34 +255,38 @@ void EV_StartLightStrobing(line_t* line)
|
||||||
//
|
//
|
||||||
// TURN LINE'S TAG LIGHTS OFF
|
// TURN LINE'S TAG LIGHTS OFF
|
||||||
//
|
//
|
||||||
void EV_TurnTagLightsOff(line_t* line)
|
void EV_TurnTagLightsOff( line_t* line )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
int min;
|
int min;
|
||||||
sector_t* sector;
|
sector_t* sector;
|
||||||
sector_t* tsec;
|
sector_t* tsec;
|
||||||
line_t* templine;
|
line_t* templine;
|
||||||
|
|
||||||
sector = ::g->sectors;
|
sector = ::g->sectors;
|
||||||
|
|
||||||
for (j = 0;j < ::g->numsectors; j++, sector++)
|
for( j = 0; j < ::g->numsectors; j++, sector++ )
|
||||||
{
|
|
||||||
if (sector->tag == line->tag)
|
|
||||||
{
|
{
|
||||||
min = sector->lightlevel;
|
if( sector->tag == line->tag )
|
||||||
for (i = 0;i < sector->linecount; i++)
|
{
|
||||||
{
|
min = sector->lightlevel;
|
||||||
templine = sector->lines[i];
|
for( i = 0; i < sector->linecount; i++ )
|
||||||
tsec = getNextSector(templine,sector);
|
{
|
||||||
if (!tsec)
|
templine = sector->lines[i];
|
||||||
continue;
|
tsec = getNextSector( templine, sector );
|
||||||
if (tsec->lightlevel < min)
|
if( !tsec )
|
||||||
min = tsec->lightlevel;
|
{
|
||||||
}
|
continue;
|
||||||
sector->lightlevel = min;
|
}
|
||||||
|
if( tsec->lightlevel < min )
|
||||||
|
{
|
||||||
|
min = tsec->lightlevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sector->lightlevel = min;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -276,38 +298,42 @@ EV_LightTurnOn
|
||||||
( line_t* line,
|
( line_t* line,
|
||||||
int bright )
|
int bright )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
sector_t* sector;
|
sector_t* sector;
|
||||||
sector_t* temp;
|
sector_t* temp;
|
||||||
line_t* templine;
|
line_t* templine;
|
||||||
|
|
||||||
sector = ::g->sectors;
|
sector = ::g->sectors;
|
||||||
|
|
||||||
for (i = 0; i < ::g->numsectors; i++, sector++)
|
for( i = 0; i < ::g->numsectors; i++, sector++ )
|
||||||
{
|
|
||||||
if (sector->tag == line->tag)
|
|
||||||
{
|
{
|
||||||
// bright = 0 means to search
|
if( sector->tag == line->tag )
|
||||||
// for highest light level
|
|
||||||
// surrounding sector
|
|
||||||
if (!bright)
|
|
||||||
{
|
|
||||||
for (j = 0;j < sector->linecount; j++)
|
|
||||||
{
|
{
|
||||||
templine = sector->lines[j];
|
// bright = 0 means to search
|
||||||
temp = getNextSector(templine,sector);
|
// for highest light level
|
||||||
|
// surrounding sector
|
||||||
|
if( !bright )
|
||||||
|
{
|
||||||
|
for( j = 0; j < sector->linecount; j++ )
|
||||||
|
{
|
||||||
|
templine = sector->lines[j];
|
||||||
|
temp = getNextSector( templine, sector );
|
||||||
|
|
||||||
if (!temp)
|
if( !temp )
|
||||||
continue;
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (temp->lightlevel > bright)
|
if( temp->lightlevel > bright )
|
||||||
bright = temp->lightlevel;
|
{
|
||||||
|
bright = temp->lightlevel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sector-> lightlevel = bright;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
sector-> lightlevel = bright;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -315,48 +341,48 @@ EV_LightTurnOn
|
||||||
// Spawn glowing light
|
// Spawn glowing light
|
||||||
//
|
//
|
||||||
|
|
||||||
void T_Glow(glow_t* g)
|
void T_Glow( glow_t* g )
|
||||||
{
|
{
|
||||||
switch(g->direction)
|
switch( g->direction )
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
// DOWN
|
|
||||||
g->sector->lightlevel -= GLOWSPEED;
|
|
||||||
if (g->sector->lightlevel <= g->minlight)
|
|
||||||
{
|
{
|
||||||
g->sector->lightlevel += GLOWSPEED;
|
case -1:
|
||||||
g->direction = 1;
|
// DOWN
|
||||||
}
|
g->sector->lightlevel -= GLOWSPEED;
|
||||||
break;
|
if( g->sector->lightlevel <= g->minlight )
|
||||||
|
{
|
||||||
|
g->sector->lightlevel += GLOWSPEED;
|
||||||
|
g->direction = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// UP
|
// UP
|
||||||
g->sector->lightlevel += GLOWSPEED;
|
g->sector->lightlevel += GLOWSPEED;
|
||||||
if (g->sector->lightlevel >= g->maxlight)
|
if( g->sector->lightlevel >= g->maxlight )
|
||||||
{
|
{
|
||||||
g->sector->lightlevel -= GLOWSPEED;
|
g->sector->lightlevel -= GLOWSPEED;
|
||||||
g->direction = -1;
|
g->direction = -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void P_SpawnGlowingLight(sector_t* sector)
|
void P_SpawnGlowingLight( sector_t* sector )
|
||||||
{
|
{
|
||||||
glow_t* g;
|
glow_t* g;
|
||||||
|
|
||||||
g = (glow_t*)DoomLib::Z_Malloc( sizeof(*g), PU_LEVEL, 0);
|
g = ( glow_t* )DoomLib::Z_Malloc( sizeof( *g ), PU_LEVEL, 0 );
|
||||||
|
|
||||||
P_AddThinker(&g->thinker);
|
P_AddThinker( &g->thinker );
|
||||||
|
|
||||||
g->sector = sector;
|
g->sector = sector;
|
||||||
g->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel);
|
g->minlight = P_FindMinSurroundingLight( sector, sector->lightlevel );
|
||||||
g->maxlight = sector->lightlevel;
|
g->maxlight = sector->lightlevel;
|
||||||
g->thinker.function.acp1 = (actionf_p1) T_Glow;
|
g->thinker.function.acp1 = ( actionf_p1 ) T_Glow;
|
||||||
g->direction = -1;
|
g->direction = -1;
|
||||||
|
|
||||||
sector->special = 0;
|
sector->special = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#define __P_LOCAL__
|
#define __P_LOCAL__
|
||||||
|
|
||||||
#ifndef __R_LOCAL__
|
#ifndef __R_LOCAL__
|
||||||
#include "r_local.h"
|
#include "r_local.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FLOATSPEED (FRACUNIT*4)
|
#define FLOATSPEED (FRACUNIT*4)
|
||||||
|
@ -76,23 +76,23 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
extern thinker_t thinkercap;
|
extern thinker_t thinkercap;
|
||||||
|
|
||||||
|
|
||||||
void P_InitThinkers (void);
|
void P_InitThinkers( void );
|
||||||
void P_AddThinker (thinker_t* thinker);
|
void P_AddThinker( thinker_t* thinker );
|
||||||
void P_RemoveThinker (thinker_t* thinker);
|
void P_RemoveThinker( thinker_t* thinker );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_PSPR
|
// P_PSPR
|
||||||
//
|
//
|
||||||
void P_SetupPsprites (player_t* curplayer);
|
void P_SetupPsprites( player_t* curplayer );
|
||||||
void P_MovePsprites (player_t* curplayer);
|
void P_MovePsprites( player_t* curplayer );
|
||||||
void P_DropWeapon (player_t* player);
|
void P_DropWeapon( player_t* player );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_USER
|
// P_USER
|
||||||
//
|
//
|
||||||
void P_PlayerThink (player_t* player);
|
void P_PlayerThink( player_t* player );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -110,7 +110,7 @@ extern int iquehead;
|
||||||
extern int iquetail;
|
extern int iquetail;
|
||||||
|
|
||||||
|
|
||||||
void P_RespawnSpecials (void);
|
void P_RespawnSpecials( void );
|
||||||
|
|
||||||
mobj_t*
|
mobj_t*
|
||||||
P_SpawnMobj
|
P_SpawnMobj
|
||||||
|
@ -119,20 +119,20 @@ P_SpawnMobj
|
||||||
fixed_t z,
|
fixed_t z,
|
||||||
mobjtype_t type );
|
mobjtype_t type );
|
||||||
|
|
||||||
void P_RemoveMobj (mobj_t* th);
|
void P_RemoveMobj( mobj_t* th );
|
||||||
qboolean P_SetMobjState (mobj_t* mobj, statenum_t state);
|
qboolean P_SetMobjState( mobj_t* mobj, statenum_t state );
|
||||||
void P_MobjThinker (mobj_t* mobj);
|
void P_MobjThinker( mobj_t* mobj );
|
||||||
|
|
||||||
void P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z);
|
void P_SpawnPuff( fixed_t x, fixed_t y, fixed_t z );
|
||||||
void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
|
void P_SpawnBlood( fixed_t x, fixed_t y, fixed_t z, int damage );
|
||||||
mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type);
|
mobj_t* P_SpawnMissile( mobj_t* source, mobj_t* dest, mobjtype_t type );
|
||||||
void P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type);
|
void P_SpawnPlayerMissile( mobj_t* source, mobjtype_t type );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_ENEMY
|
// P_ENEMY
|
||||||
//
|
//
|
||||||
void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
|
void P_NoiseAlert( mobj_t* target, mobj_t* emmiter );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -140,21 +140,22 @@ void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
|
||||||
//
|
//
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
fixed_t x;
|
fixed_t x;
|
||||||
fixed_t y;
|
fixed_t y;
|
||||||
fixed_t dx;
|
fixed_t dx;
|
||||||
fixed_t dy;
|
fixed_t dy;
|
||||||
|
|
||||||
} divline_t;
|
} divline_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
fixed_t frac; // along trace line
|
fixed_t frac; // along trace line
|
||||||
qboolean isaline;
|
qboolean isaline;
|
||||||
union {
|
union
|
||||||
mobj_t* thing;
|
{
|
||||||
line_t* line;
|
mobj_t* thing;
|
||||||
} d;
|
line_t* line;
|
||||||
|
} d;
|
||||||
} intercept_t;
|
} intercept_t;
|
||||||
|
|
||||||
#define MAXINTERCEPTS 128
|
#define MAXINTERCEPTS 128
|
||||||
|
@ -162,24 +163,24 @@ typedef struct
|
||||||
extern intercept_t intercepts[MAXINTERCEPTS];
|
extern intercept_t intercepts[MAXINTERCEPTS];
|
||||||
extern intercept_t* intercept_p;
|
extern intercept_t* intercept_p;
|
||||||
|
|
||||||
typedef qboolean (*traverser_t) (intercept_t *in);
|
typedef qboolean( *traverser_t )( intercept_t* in );
|
||||||
|
|
||||||
fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
|
fixed_t P_AproxDistance( fixed_t dx, fixed_t dy );
|
||||||
int P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
|
int P_PointOnLineSide( fixed_t x, fixed_t y, line_t* line );
|
||||||
int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
|
int P_PointOnDivlineSide( fixed_t x, fixed_t y, divline_t* line );
|
||||||
void P_MakeDivline (line_t* li, divline_t* dl);
|
void P_MakeDivline( line_t* li, divline_t* dl );
|
||||||
fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
|
fixed_t P_InterceptVector( divline_t* v2, divline_t* v1 );
|
||||||
int P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
|
int P_BoxOnLineSide( fixed_t* tmbox, line_t* ld );
|
||||||
|
|
||||||
extern fixed_t opentop;
|
extern fixed_t opentop;
|
||||||
extern fixed_t openbottom;
|
extern fixed_t openbottom;
|
||||||
extern fixed_t openrange;
|
extern fixed_t openrange;
|
||||||
extern fixed_t lowfloor;
|
extern fixed_t lowfloor;
|
||||||
|
|
||||||
void P_LineOpening (line_t* linedef);
|
void P_LineOpening( line_t* linedef );
|
||||||
|
|
||||||
qboolean P_BlockLinesIterator (int x, int y, qboolean(*func)(line_t*) );
|
qboolean P_BlockLinesIterator( int x, int y, qboolean( *func )( line_t* ) );
|
||||||
qboolean P_BlockThingsIterator (int x, int y, qboolean(*func)(mobj_t*) );
|
qboolean P_BlockThingsIterator( int x, int y, qboolean( *func )( mobj_t* ) );
|
||||||
|
|
||||||
#define PT_ADDLINES 1
|
#define PT_ADDLINES 1
|
||||||
#define PT_ADDTHINGS 2
|
#define PT_ADDTHINGS 2
|
||||||
|
@ -194,10 +195,10 @@ P_PathTraverse
|
||||||
fixed_t x2,
|
fixed_t x2,
|
||||||
fixed_t y2,
|
fixed_t y2,
|
||||||
int flags,
|
int flags,
|
||||||
qboolean (*trav) (intercept_t *));
|
qboolean( *trav )( intercept_t* ) );
|
||||||
|
|
||||||
void P_UnsetThingPosition (mobj_t* thing);
|
void P_UnsetThingPosition( mobj_t* thing );
|
||||||
void P_SetThingPosition (mobj_t* thing);
|
void P_SetThingPosition( mobj_t* thing );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -213,14 +214,14 @@ extern fixed_t tmceilingz;
|
||||||
|
|
||||||
extern line_t* ceilingline;
|
extern line_t* ceilingline;
|
||||||
|
|
||||||
qboolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
|
qboolean P_CheckPosition( mobj_t* thing, fixed_t x, fixed_t y );
|
||||||
qboolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
|
qboolean P_TryMove( mobj_t* thing, fixed_t x, fixed_t y );
|
||||||
qboolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
|
qboolean P_TeleportMove( mobj_t* thing, fixed_t x, fixed_t y );
|
||||||
void P_SlideMove (mobj_t* mo);
|
void P_SlideMove( mobj_t* mo );
|
||||||
qboolean P_CheckSight (mobj_t* t1, mobj_t* t2);
|
qboolean P_CheckSight( mobj_t* t1, mobj_t* t2 );
|
||||||
void P_UseLines (player_t* player);
|
void P_UseLines( player_t* player );
|
||||||
|
|
||||||
qboolean P_ChangeSector (sector_t* sector, qboolean crunch);
|
qboolean P_ChangeSector( sector_t* sector, qboolean crunch );
|
||||||
|
|
||||||
extern mobj_t* linetarget; // who got hit (or NULL)
|
extern mobj_t* linetarget; // who got hit (or NULL)
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -48,7 +48,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,89 +122,89 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
//
|
//
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
// Call P_SpecialThing when touched.
|
// Call P_SpecialThing when touched.
|
||||||
MF_SPECIAL = 1,
|
MF_SPECIAL = 1,
|
||||||
// Blocks.
|
// Blocks.
|
||||||
MF_SOLID = 2,
|
MF_SOLID = 2,
|
||||||
// Can be hit.
|
// Can be hit.
|
||||||
MF_SHOOTABLE = 4,
|
MF_SHOOTABLE = 4,
|
||||||
// Don't use the sector links (invisible but touchable).
|
// Don't use the sector links (invisible but touchable).
|
||||||
MF_NOSECTOR = 8,
|
MF_NOSECTOR = 8,
|
||||||
// Don't use the blocklinks (inert but displayable)
|
// Don't use the blocklinks (inert but displayable)
|
||||||
MF_NOBLOCKMAP = 16,
|
MF_NOBLOCKMAP = 16,
|
||||||
|
|
||||||
// Not to be activated by sound, deaf monster.
|
// Not to be activated by sound, deaf monster.
|
||||||
MF_AMBUSH = 32,
|
MF_AMBUSH = 32,
|
||||||
// Will try to attack right back.
|
// Will try to attack right back.
|
||||||
MF_JUSTHIT = 64,
|
MF_JUSTHIT = 64,
|
||||||
// Will take at least one step before attacking.
|
// Will take at least one step before attacking.
|
||||||
MF_JUSTATTACKED = 128,
|
MF_JUSTATTACKED = 128,
|
||||||
// On level spawning (initial position),
|
// On level spawning (initial position),
|
||||||
// hang from ceiling instead of stand on floor.
|
// hang from ceiling instead of stand on floor.
|
||||||
MF_SPAWNCEILING = 256,
|
MF_SPAWNCEILING = 256,
|
||||||
// Don't apply gravity (every tic),
|
// Don't apply gravity (every tic),
|
||||||
// that is, object will float, keeping current height
|
// that is, object will float, keeping current height
|
||||||
// or changing it actively.
|
// or changing it actively.
|
||||||
MF_NOGRAVITY = 512,
|
MF_NOGRAVITY = 512,
|
||||||
|
|
||||||
// Movement flags.
|
// Movement flags.
|
||||||
// This allows jumps from high places.
|
// This allows jumps from high places.
|
||||||
MF_DROPOFF = 0x400,
|
MF_DROPOFF = 0x400,
|
||||||
// For players, will pick up items.
|
// For players, will pick up items.
|
||||||
MF_PICKUP = 0x800,
|
MF_PICKUP = 0x800,
|
||||||
// Player cheat. ???
|
// Player cheat. ???
|
||||||
MF_NOCLIP = 0x1000,
|
MF_NOCLIP = 0x1000,
|
||||||
// Player: keep info about sliding along walls.
|
// Player: keep info about sliding along walls.
|
||||||
MF_SLIDE = 0x2000,
|
MF_SLIDE = 0x2000,
|
||||||
// Allow moves to any height, no gravity.
|
// Allow moves to any height, no gravity.
|
||||||
// For active floaters, e.g. cacodemons, pain elementals.
|
// For active floaters, e.g. cacodemons, pain elementals.
|
||||||
MF_FLOAT = 0x4000,
|
MF_FLOAT = 0x4000,
|
||||||
// Don't cross lines
|
// Don't cross lines
|
||||||
// ??? or look at heights on teleport.
|
// ??? or look at heights on teleport.
|
||||||
MF_TELEPORT = 0x8000,
|
MF_TELEPORT = 0x8000,
|
||||||
// Don't hit same species, explode on block.
|
// Don't hit same species, explode on block.
|
||||||
// Player missiles as well as fireballs of various kinds.
|
// Player missiles as well as fireballs of various kinds.
|
||||||
MF_MISSILE = 0x10000,
|
MF_MISSILE = 0x10000,
|
||||||
// Dropped by a demon, not level spawned.
|
// Dropped by a demon, not level spawned.
|
||||||
// E.g. ammo clips dropped by dying former humans.
|
// E.g. ammo clips dropped by dying former humans.
|
||||||
MF_DROPPED = 0x20000,
|
MF_DROPPED = 0x20000,
|
||||||
// Use fuzzy draw (shadow demons or spectres),
|
// Use fuzzy draw (shadow demons or spectres),
|
||||||
// temporary player invisibility powerup.
|
// temporary player invisibility powerup.
|
||||||
MF_SHADOW = 0x40000,
|
MF_SHADOW = 0x40000,
|
||||||
// Flag: don't bleed when shot (use puff),
|
// Flag: don't bleed when shot (use puff),
|
||||||
// barrels and shootable furniture shall not bleed.
|
// barrels and shootable furniture shall not bleed.
|
||||||
MF_NOBLOOD = 0x80000,
|
MF_NOBLOOD = 0x80000,
|
||||||
// Don't stop moving halfway off a step,
|
// Don't stop moving halfway off a step,
|
||||||
// that is, have dead bodies slide down all the way.
|
// that is, have dead bodies slide down all the way.
|
||||||
MF_CORPSE = 0x100000,
|
MF_CORPSE = 0x100000,
|
||||||
// Floating to a height for a move, ???
|
// Floating to a height for a move, ???
|
||||||
// don't auto float to target's height.
|
// don't auto float to target's height.
|
||||||
MF_INFLOAT = 0x200000,
|
MF_INFLOAT = 0x200000,
|
||||||
|
|
||||||
// On kill, count this enemy object
|
// On kill, count this enemy object
|
||||||
// towards intermission kill total.
|
// towards intermission kill total.
|
||||||
// Happy gathering.
|
// Happy gathering.
|
||||||
MF_COUNTKILL = 0x400000,
|
MF_COUNTKILL = 0x400000,
|
||||||
|
|
||||||
// On picking up, count this item object
|
// On picking up, count this item object
|
||||||
// towards intermission item total.
|
// towards intermission item total.
|
||||||
MF_COUNTITEM = 0x800000,
|
MF_COUNTITEM = 0x800000,
|
||||||
|
|
||||||
// Special handling: skull in flight.
|
// Special handling: skull in flight.
|
||||||
// Neither a cacodemon nor a missile.
|
// Neither a cacodemon nor a missile.
|
||||||
MF_SKULLFLY = 0x1000000,
|
MF_SKULLFLY = 0x1000000,
|
||||||
|
|
||||||
// Don't spawn this object
|
// Don't spawn this object
|
||||||
// in death match mode (e.g. key cards).
|
// in death match mode (e.g. key cards).
|
||||||
MF_NOTDMATCH = 0x2000000,
|
MF_NOTDMATCH = 0x2000000,
|
||||||
|
|
||||||
// Player sprites in multiplayer modes are modified
|
// Player sprites in multiplayer modes are modified
|
||||||
// using an internal color lookup table for re-indexing.
|
// using an internal color lookup table for re-indexing.
|
||||||
// If 0x4 0x8 or 0xc,
|
// If 0x4 0x8 or 0xc,
|
||||||
// use a translation table for player colormaps
|
// use a translation table for player colormaps
|
||||||
MF_TRANSLATION = 0xc000000,
|
MF_TRANSLATION = 0xc000000,
|
||||||
// Hmm ???.
|
// Hmm ???.
|
||||||
MF_TRANSSHIFT = 26
|
MF_TRANSSHIFT = 26
|
||||||
|
|
||||||
} mobjflag_t;
|
} mobjflag_t;
|
||||||
|
|
||||||
|
@ -212,82 +212,82 @@ typedef enum
|
||||||
// Map Object definition.
|
// Map Object definition.
|
||||||
struct mobj_t
|
struct mobj_t
|
||||||
{
|
{
|
||||||
// List: thinker links.
|
// List: thinker links.
|
||||||
thinker_t thinker;
|
thinker_t thinker;
|
||||||
|
|
||||||
// Info for drawing: position.
|
// Info for drawing: position.
|
||||||
fixed_t x;
|
fixed_t x;
|
||||||
fixed_t y;
|
fixed_t y;
|
||||||
fixed_t z;
|
fixed_t z;
|
||||||
|
|
||||||
// More list: links in sector (if needed)
|
// More list: links in sector (if needed)
|
||||||
mobj_t* snext;
|
mobj_t* snext;
|
||||||
mobj_t* sprev;
|
mobj_t* sprev;
|
||||||
|
|
||||||
//More drawing info: to determine current sprite.
|
//More drawing info: to determine current sprite.
|
||||||
angle_t angle; // orientation
|
angle_t angle; // orientation
|
||||||
spritenum_t sprite; // used to find patch_t and flip value
|
spritenum_t sprite; // used to find patch_t and flip value
|
||||||
int frame; // might be ORed with FF_FULLBRIGHT
|
int frame; // might be ORed with FF_FULLBRIGHT
|
||||||
|
|
||||||
// Interaction info, by BLOCKMAP.
|
// Interaction info, by BLOCKMAP.
|
||||||
// Links in blocks (if needed).
|
// Links in blocks (if needed).
|
||||||
mobj_t* bnext;
|
mobj_t* bnext;
|
||||||
mobj_t* bprev;
|
mobj_t* bprev;
|
||||||
|
|
||||||
struct subsector_s* subsector;
|
struct subsector_s* subsector;
|
||||||
|
|
||||||
// The closest interval over all contacted Sectors.
|
// The closest interval over all contacted Sectors.
|
||||||
fixed_t floorz;
|
fixed_t floorz;
|
||||||
fixed_t ceilingz;
|
fixed_t ceilingz;
|
||||||
|
|
||||||
// For movement checking.
|
// For movement checking.
|
||||||
fixed_t radius;
|
fixed_t radius;
|
||||||
fixed_t height;
|
fixed_t height;
|
||||||
|
|
||||||
// Momentums, used to update position.
|
// Momentums, used to update position.
|
||||||
fixed_t momx;
|
fixed_t momx;
|
||||||
fixed_t momy;
|
fixed_t momy;
|
||||||
fixed_t momz;
|
fixed_t momz;
|
||||||
|
|
||||||
// If == validcount, already checked.
|
// If == validcount, already checked.
|
||||||
int validcount;
|
int validcount;
|
||||||
|
|
||||||
mobjtype_t type;
|
mobjtype_t type;
|
||||||
const mobjinfo_t* info; // &mobjinfo[mobj->type]
|
const mobjinfo_t* info; // &mobjinfo[mobj->type]
|
||||||
|
|
||||||
int tics; // state tic counter
|
int tics; // state tic counter
|
||||||
const state_t* state;
|
const state_t* state;
|
||||||
int flags;
|
int flags;
|
||||||
int health;
|
int health;
|
||||||
|
|
||||||
// Movement direction, movement generation (zig-zagging).
|
// Movement direction, movement generation (zig-zagging).
|
||||||
int movedir; // 0-7
|
int movedir; // 0-7
|
||||||
int movecount; // when 0, select a new dir
|
int movecount; // when 0, select a new dir
|
||||||
|
|
||||||
// Thing being chased/attacked (or NULL),
|
// Thing being chased/attacked (or NULL),
|
||||||
// also the originator for missiles.
|
// also the originator for missiles.
|
||||||
mobj_t* target;
|
mobj_t* target;
|
||||||
|
|
||||||
// Reaction time: if non 0, don't attack yet.
|
// Reaction time: if non 0, don't attack yet.
|
||||||
// Used by player to freeze a bit after teleporting.
|
// Used by player to freeze a bit after teleporting.
|
||||||
int reactiontime;
|
int reactiontime;
|
||||||
|
|
||||||
// If >0, the target will be chased
|
// If >0, the target will be chased
|
||||||
// no matter what (even if shot)
|
// no matter what (even if shot)
|
||||||
int threshold;
|
int threshold;
|
||||||
|
|
||||||
// Additional info record for player avatars only.
|
// Additional info record for player avatars only.
|
||||||
// Only valid if type == MT_PLAYER
|
// Only valid if type == MT_PLAYER
|
||||||
struct player_s* player;
|
struct player_s* player;
|
||||||
|
|
||||||
// Player number last looked for.
|
// Player number last looked for.
|
||||||
int lastlook;
|
int lastlook;
|
||||||
|
|
||||||
// For nightmare respawn.
|
// For nightmare respawn.
|
||||||
mapthing_t spawnpoint;
|
mapthing_t spawnpoint;
|
||||||
|
|
||||||
// Thing being chased/attacked for tracers.
|
// Thing being chased/attacked for tracers.
|
||||||
mobj_t* tracer;
|
mobj_t* tracer;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -53,85 +53,89 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
//
|
//
|
||||||
// Move a plat up and down
|
// Move a plat up and down
|
||||||
//
|
//
|
||||||
void T_PlatRaise(plat_t* plat)
|
void T_PlatRaise( plat_t* plat )
|
||||||
{
|
{
|
||||||
result_e res;
|
result_e res;
|
||||||
|
|
||||||
switch(plat->status)
|
switch( plat->status )
|
||||||
{
|
|
||||||
case up:
|
|
||||||
res = T_MovePlane(plat->sector,
|
|
||||||
plat->speed,
|
|
||||||
plat->high,
|
|
||||||
plat->crush,0,1);
|
|
||||||
|
|
||||||
if (plat->type == raiseAndChange
|
|
||||||
|| plat->type == raiseToNearestAndChange)
|
|
||||||
{
|
{
|
||||||
if (!(::g->leveltime&7))
|
case up:
|
||||||
S_StartSound( &plat->sector->soundorg,
|
res = T_MovePlane( plat->sector,
|
||||||
sfx_stnmov);
|
plat->speed,
|
||||||
|
plat->high,
|
||||||
|
plat->crush, 0, 1 );
|
||||||
|
|
||||||
|
if( plat->type == raiseAndChange
|
||||||
|
|| plat->type == raiseToNearestAndChange )
|
||||||
|
{
|
||||||
|
if( !( ::g->leveltime & 7 ) )
|
||||||
|
S_StartSound( &plat->sector->soundorg,
|
||||||
|
sfx_stnmov );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( res == crushed && ( !plat->crush ) )
|
||||||
|
{
|
||||||
|
plat->count = plat->wait;
|
||||||
|
plat->status = down;
|
||||||
|
S_StartSound( &plat->sector->soundorg,
|
||||||
|
sfx_pstart );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( res == pastdest )
|
||||||
|
{
|
||||||
|
plat->count = plat->wait;
|
||||||
|
plat->status = waiting;
|
||||||
|
S_StartSound( &plat->sector->soundorg,
|
||||||
|
sfx_pstop );
|
||||||
|
|
||||||
|
switch( plat->type )
|
||||||
|
{
|
||||||
|
case blazeDWUS:
|
||||||
|
case downWaitUpStay:
|
||||||
|
P_RemoveActivePlat( plat );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case raiseAndChange:
|
||||||
|
case raiseToNearestAndChange:
|
||||||
|
P_RemoveActivePlat( plat );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case down:
|
||||||
|
res = T_MovePlane( plat->sector, plat->speed, plat->low, false, 0, -1 );
|
||||||
|
|
||||||
|
if( res == pastdest )
|
||||||
|
{
|
||||||
|
plat->count = plat->wait;
|
||||||
|
plat->status = waiting;
|
||||||
|
S_StartSound( &plat->sector->soundorg, sfx_pstop );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case waiting:
|
||||||
|
if( !--plat->count )
|
||||||
|
{
|
||||||
|
if( plat->sector->floorheight == plat->low )
|
||||||
|
{
|
||||||
|
plat->status = up;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plat->status = down;
|
||||||
|
}
|
||||||
|
S_StartSound( &plat->sector->soundorg, sfx_pstart );
|
||||||
|
}
|
||||||
|
case in_stasis:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (res == crushed && (!plat->crush))
|
|
||||||
{
|
|
||||||
plat->count = plat->wait;
|
|
||||||
plat->status = down;
|
|
||||||
S_StartSound( &plat->sector->soundorg,
|
|
||||||
sfx_pstart);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (res == pastdest)
|
|
||||||
{
|
|
||||||
plat->count = plat->wait;
|
|
||||||
plat->status = waiting;
|
|
||||||
S_StartSound( &plat->sector->soundorg,
|
|
||||||
sfx_pstop);
|
|
||||||
|
|
||||||
switch(plat->type)
|
|
||||||
{
|
|
||||||
case blazeDWUS:
|
|
||||||
case downWaitUpStay:
|
|
||||||
P_RemoveActivePlat(plat);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case raiseAndChange:
|
|
||||||
case raiseToNearestAndChange:
|
|
||||||
P_RemoveActivePlat(plat);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case down:
|
|
||||||
res = T_MovePlane(plat->sector,plat->speed,plat->low,false,0,-1);
|
|
||||||
|
|
||||||
if (res == pastdest)
|
|
||||||
{
|
|
||||||
plat->count = plat->wait;
|
|
||||||
plat->status = waiting;
|
|
||||||
S_StartSound( &plat->sector->soundorg,sfx_pstop);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case waiting:
|
|
||||||
if (!--plat->count)
|
|
||||||
{
|
|
||||||
if (plat->sector->floorheight == plat->low)
|
|
||||||
plat->status = up;
|
|
||||||
else
|
|
||||||
plat->status = down;
|
|
||||||
S_StartSound( &plat->sector->soundorg,sfx_pstart);
|
|
||||||
}
|
|
||||||
case in_stasis:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,175 +149,185 @@ EV_DoPlat
|
||||||
plattype_e type,
|
plattype_e type,
|
||||||
int amount )
|
int amount )
|
||||||
{
|
{
|
||||||
plat_t* plat;
|
plat_t* plat;
|
||||||
int secnum;
|
int secnum;
|
||||||
int rtn;
|
int rtn;
|
||||||
sector_t* sec;
|
sector_t* sec;
|
||||||
|
|
||||||
secnum = -1;
|
secnum = -1;
|
||||||
rtn = 0;
|
rtn = 0;
|
||||||
|
|
||||||
|
|
||||||
// Activate all <type> plats that are in_stasis
|
// Activate all <type> plats that are in_stasis
|
||||||
switch(type)
|
switch( type )
|
||||||
{
|
|
||||||
case perpetualRaise:
|
|
||||||
P_ActivateInStasis(line->tag);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
|
||||||
{
|
|
||||||
sec = &::g->sectors[secnum];
|
|
||||||
|
|
||||||
if (sec->specialdata)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Find lowest & highest floors around sector
|
|
||||||
rtn = 1;
|
|
||||||
plat = (plat_t*)DoomLib::Z_Malloc( sizeof(*plat), PU_LEVEL, 0);
|
|
||||||
P_AddThinker(&plat->thinker);
|
|
||||||
|
|
||||||
plat->type = type;
|
|
||||||
plat->sector = sec;
|
|
||||||
plat->sector->specialdata = plat;
|
|
||||||
plat->thinker.function.acp1 = (actionf_p1) T_PlatRaise;
|
|
||||||
plat->crush = false;
|
|
||||||
plat->tag = line->tag;
|
|
||||||
|
|
||||||
switch(type)
|
|
||||||
{
|
{
|
||||||
case raiseToNearestAndChange:
|
case perpetualRaise:
|
||||||
plat->speed = PLATSPEED/2;
|
P_ActivateInStasis( line->tag );
|
||||||
sec->floorpic = ::g->sides[line->sidenum[0]].sector->floorpic;
|
break;
|
||||||
plat->high = P_FindNextHighestFloor(sec,sec->floorheight);
|
|
||||||
plat->wait = 0;
|
|
||||||
plat->status = up;
|
|
||||||
// NO MORE DAMAGE, IF APPLICABLE
|
|
||||||
sec->special = 0;
|
|
||||||
|
|
||||||
S_StartSound( &sec->soundorg,sfx_stnmov);
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case raiseAndChange:
|
|
||||||
plat->speed = PLATSPEED/2;
|
|
||||||
sec->floorpic = ::g->sides[line->sidenum[0]].sector->floorpic;
|
|
||||||
plat->high = sec->floorheight + amount*FRACUNIT;
|
|
||||||
plat->wait = 0;
|
|
||||||
plat->status = up;
|
|
||||||
|
|
||||||
S_StartSound( &sec->soundorg,sfx_stnmov);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case downWaitUpStay:
|
|
||||||
plat->speed = PLATSPEED * 4;
|
|
||||||
plat->low = P_FindLowestFloorSurrounding(sec);
|
|
||||||
|
|
||||||
if (plat->low > sec->floorheight)
|
|
||||||
plat->low = sec->floorheight;
|
|
||||||
|
|
||||||
plat->high = sec->floorheight;
|
|
||||||
plat->wait = TICRATE*PLATWAIT;
|
|
||||||
plat->status = down;
|
|
||||||
S_StartSound( &sec->soundorg,sfx_pstart);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case blazeDWUS:
|
|
||||||
plat->speed = PLATSPEED * 8;
|
|
||||||
plat->low = P_FindLowestFloorSurrounding(sec);
|
|
||||||
|
|
||||||
if (plat->low > sec->floorheight)
|
|
||||||
plat->low = sec->floorheight;
|
|
||||||
|
|
||||||
plat->high = sec->floorheight;
|
|
||||||
plat->wait = TICRATE*PLATWAIT;
|
|
||||||
plat->status = down;
|
|
||||||
S_StartSound( &sec->soundorg,sfx_pstart);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case perpetualRaise:
|
|
||||||
plat->speed = PLATSPEED;
|
|
||||||
plat->low = P_FindLowestFloorSurrounding(sec);
|
|
||||||
|
|
||||||
if (plat->low > sec->floorheight)
|
|
||||||
plat->low = sec->floorheight;
|
|
||||||
|
|
||||||
plat->high = P_FindHighestFloorSurrounding(sec);
|
|
||||||
|
|
||||||
if (plat->high < sec->floorheight)
|
|
||||||
plat->high = sec->floorheight;
|
|
||||||
|
|
||||||
plat->wait = TICRATE*PLATWAIT;
|
|
||||||
plat->status = (plat_e)(P_Random()&1);
|
|
||||||
|
|
||||||
S_StartSound( &sec->soundorg,sfx_pstart);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
P_AddActivePlat(plat);
|
|
||||||
}
|
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||||
return rtn;
|
{
|
||||||
|
sec = &::g->sectors[secnum];
|
||||||
|
|
||||||
|
if( sec->specialdata )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find lowest & highest floors around sector
|
||||||
|
rtn = 1;
|
||||||
|
plat = ( plat_t* )DoomLib::Z_Malloc( sizeof( *plat ), PU_LEVEL, 0 );
|
||||||
|
P_AddThinker( &plat->thinker );
|
||||||
|
|
||||||
|
plat->type = type;
|
||||||
|
plat->sector = sec;
|
||||||
|
plat->sector->specialdata = plat;
|
||||||
|
plat->thinker.function.acp1 = ( actionf_p1 ) T_PlatRaise;
|
||||||
|
plat->crush = false;
|
||||||
|
plat->tag = line->tag;
|
||||||
|
|
||||||
|
switch( type )
|
||||||
|
{
|
||||||
|
case raiseToNearestAndChange:
|
||||||
|
plat->speed = PLATSPEED / 2;
|
||||||
|
sec->floorpic = ::g->sides[line->sidenum[0]].sector->floorpic;
|
||||||
|
plat->high = P_FindNextHighestFloor( sec, sec->floorheight );
|
||||||
|
plat->wait = 0;
|
||||||
|
plat->status = up;
|
||||||
|
// NO MORE DAMAGE, IF APPLICABLE
|
||||||
|
sec->special = 0;
|
||||||
|
|
||||||
|
S_StartSound( &sec->soundorg, sfx_stnmov );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case raiseAndChange:
|
||||||
|
plat->speed = PLATSPEED / 2;
|
||||||
|
sec->floorpic = ::g->sides[line->sidenum[0]].sector->floorpic;
|
||||||
|
plat->high = sec->floorheight + amount * FRACUNIT;
|
||||||
|
plat->wait = 0;
|
||||||
|
plat->status = up;
|
||||||
|
|
||||||
|
S_StartSound( &sec->soundorg, sfx_stnmov );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case downWaitUpStay:
|
||||||
|
plat->speed = PLATSPEED * 4;
|
||||||
|
plat->low = P_FindLowestFloorSurrounding( sec );
|
||||||
|
|
||||||
|
if( plat->low > sec->floorheight )
|
||||||
|
{
|
||||||
|
plat->low = sec->floorheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
plat->high = sec->floorheight;
|
||||||
|
plat->wait = TICRATE * PLATWAIT;
|
||||||
|
plat->status = down;
|
||||||
|
S_StartSound( &sec->soundorg, sfx_pstart );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case blazeDWUS:
|
||||||
|
plat->speed = PLATSPEED * 8;
|
||||||
|
plat->low = P_FindLowestFloorSurrounding( sec );
|
||||||
|
|
||||||
|
if( plat->low > sec->floorheight )
|
||||||
|
{
|
||||||
|
plat->low = sec->floorheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
plat->high = sec->floorheight;
|
||||||
|
plat->wait = TICRATE * PLATWAIT;
|
||||||
|
plat->status = down;
|
||||||
|
S_StartSound( &sec->soundorg, sfx_pstart );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case perpetualRaise:
|
||||||
|
plat->speed = PLATSPEED;
|
||||||
|
plat->low = P_FindLowestFloorSurrounding( sec );
|
||||||
|
|
||||||
|
if( plat->low > sec->floorheight )
|
||||||
|
{
|
||||||
|
plat->low = sec->floorheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
plat->high = P_FindHighestFloorSurrounding( sec );
|
||||||
|
|
||||||
|
if( plat->high < sec->floorheight )
|
||||||
|
{
|
||||||
|
plat->high = sec->floorheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
plat->wait = TICRATE * PLATWAIT;
|
||||||
|
plat->status = ( plat_e )( P_Random() & 1 );
|
||||||
|
|
||||||
|
S_StartSound( &sec->soundorg, sfx_pstart );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
P_AddActivePlat( plat );
|
||||||
|
}
|
||||||
|
return rtn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void P_ActivateInStasis(int tag)
|
void P_ActivateInStasis( int tag )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0;i < MAXPLATS;i++)
|
for( i = 0; i < MAXPLATS; i++ )
|
||||||
if (::g->activeplats[i]
|
if( ::g->activeplats[i]
|
||||||
&& (::g->activeplats[i])->tag == tag
|
&& ( ::g->activeplats[i] )->tag == tag
|
||||||
&& (::g->activeplats[i])->status == in_stasis)
|
&& ( ::g->activeplats[i] )->status == in_stasis )
|
||||||
{
|
{
|
||||||
(::g->activeplats[i])->status = (::g->activeplats[i])->oldstatus;
|
( ::g->activeplats[i] )->status = ( ::g->activeplats[i] )->oldstatus;
|
||||||
(::g->activeplats[i])->thinker.function.acp1
|
( ::g->activeplats[i] )->thinker.function.acp1
|
||||||
= (actionf_p1) T_PlatRaise;
|
= ( actionf_p1 ) T_PlatRaise;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EV_StopPlat(line_t* line)
|
void EV_StopPlat( line_t* line )
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 0;j < MAXPLATS;j++)
|
for( j = 0; j < MAXPLATS; j++ )
|
||||||
if (::g->activeplats[j]
|
if( ::g->activeplats[j]
|
||||||
&& ((::g->activeplats[j])->status != in_stasis)
|
&& ( ( ::g->activeplats[j] )->status != in_stasis )
|
||||||
&& ((::g->activeplats[j])->tag == line->tag))
|
&& ( ( ::g->activeplats[j] )->tag == line->tag ) )
|
||||||
{
|
{
|
||||||
(::g->activeplats[j])->oldstatus = (::g->activeplats[j])->status;
|
( ::g->activeplats[j] )->oldstatus = ( ::g->activeplats[j] )->status;
|
||||||
(::g->activeplats[j])->status = in_stasis;
|
( ::g->activeplats[j] )->status = in_stasis;
|
||||||
(::g->activeplats[j])->thinker.function.acv = (actionf_v)NULL;
|
( ::g->activeplats[j] )->thinker.function.acv = ( actionf_v )NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void P_AddActivePlat(plat_t* plat)
|
void P_AddActivePlat( plat_t* plat )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0;i < MAXPLATS;i++)
|
for( i = 0; i < MAXPLATS; i++ )
|
||||||
if (::g->activeplats[i] == NULL)
|
if( ::g->activeplats[i] == NULL )
|
||||||
{
|
{
|
||||||
::g->activeplats[i] = plat;
|
::g->activeplats[i] = plat;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
I_Error ("P_AddActivePlat: no more plats!");
|
I_Error( "P_AddActivePlat: no more plats!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void P_RemoveActivePlat(plat_t* plat)
|
void P_RemoveActivePlat( plat_t* plat )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0;i < MAXPLATS;i++)
|
for( i = 0; i < MAXPLATS; i++ )
|
||||||
if (plat == ::g->activeplats[i])
|
if( plat == ::g->activeplats[i] )
|
||||||
{
|
{
|
||||||
(::g->activeplats[i])->sector->specialdata = NULL;
|
( ::g->activeplats[i] )->sector->specialdata = NULL;
|
||||||
P_RemoveThinker(&(::g->activeplats[i])->thinker);
|
P_RemoveThinker( &( ::g->activeplats[i] )->thinker );
|
||||||
::g->activeplats[i] = NULL;
|
::g->activeplats[i] = NULL;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
I_Error ("P_RemoveActivePlat: can't find plat!");
|
I_Error( "P_RemoveActivePlat: can't find plat!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -45,7 +45,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,18 +65,18 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
//
|
//
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
ps_weapon,
|
ps_weapon,
|
||||||
ps_flash,
|
ps_flash,
|
||||||
NUMPSPRITES
|
NUMPSPRITES
|
||||||
|
|
||||||
} psprnum_t;
|
} psprnum_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
const state_t* state; // a NULL state means not active
|
const state_t* state; // a NULL state means not active
|
||||||
int tics;
|
int tics;
|
||||||
fixed_t sx;
|
fixed_t sx;
|
||||||
fixed_t sy;
|
fixed_t sy;
|
||||||
|
|
||||||
} pspdef_t;
|
} pspdef_t;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -31,20 +31,20 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Persistent storage/archiving.
|
// Persistent storage/archiving.
|
||||||
// These are the load / save game routines.
|
// These are the load / save game routines.
|
||||||
void P_ArchivePlayers (void);
|
void P_ArchivePlayers( void );
|
||||||
void P_UnArchivePlayers (void);
|
void P_UnArchivePlayers( void );
|
||||||
void P_ArchiveWorld (void);
|
void P_ArchiveWorld( void );
|
||||||
void P_UnArchiveWorld (void);
|
void P_UnArchiveWorld( void );
|
||||||
void P_ArchiveThinkers (void);
|
void P_ArchiveThinkers( void );
|
||||||
void P_UnArchiveThinkers (void);
|
void P_UnArchiveThinkers( void );
|
||||||
void P_ArchiveSpecials (void);
|
void P_ArchiveSpecials( void );
|
||||||
void P_UnArchiveSpecials (void);
|
void P_UnArchiveSpecials( void );
|
||||||
|
|
||||||
extern byte* save_p;
|
extern byte* save_p;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
|
|
||||||
|
|
||||||
void P_SpawnMapThing (mapthing_t* mthing);
|
void P_SpawnMapThing( mapthing_t* mthing );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -97,7 +97,7 @@ void P_SpawnMapThing (mapthing_t* mthing);
|
||||||
//
|
//
|
||||||
// P_LoadVertexes
|
// P_LoadVertexes
|
||||||
//
|
//
|
||||||
void P_LoadVertexes (int lump)
|
void P_LoadVertexes( int lump )
|
||||||
{
|
{
|
||||||
byte* data;
|
byte* data;
|
||||||
int i;
|
int i;
|
||||||
|
@ -106,28 +106,28 @@ void P_LoadVertexes (int lump)
|
||||||
|
|
||||||
// Determine number of lumps:
|
// Determine number of lumps:
|
||||||
// total lump length / vertex record length.
|
// total lump length / vertex record length.
|
||||||
::g->numvertexes = W_LumpLength (lump) / sizeof(mapvertex_t);
|
::g->numvertexes = W_LumpLength( lump ) / sizeof( mapvertex_t );
|
||||||
|
|
||||||
// Allocate zone memory for buffer.
|
// Allocate zone memory for buffer.
|
||||||
// ::g->vertexes = (vertex_t*)Z_Malloc (::g->numvertexes*sizeof(vertex_t),PU_LEVEL,0);
|
// ::g->vertexes = (vertex_t*)Z_Malloc (::g->numvertexes*sizeof(vertex_t),PU_LEVEL,0);
|
||||||
if (MallocForLump( lump, ::g->numvertexes*sizeof(vertex_t ), ::g->vertexes, PU_LEVEL_SHARED ))
|
if( MallocForLump( lump, ::g->numvertexes * sizeof( vertex_t ), ::g->vertexes, PU_LEVEL_SHARED ) )
|
||||||
{
|
{
|
||||||
// Load data into cache.
|
// Load data into cache.
|
||||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
data = ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||||
|
|
||||||
ml = (mapvertex_t *)data;
|
ml = ( mapvertex_t* )data;
|
||||||
li = ::g->vertexes;
|
li = ::g->vertexes;
|
||||||
|
|
||||||
// Copy and convert vertex coordinates,
|
// Copy and convert vertex coordinates,
|
||||||
// internal representation as fixed.
|
// internal representation as fixed.
|
||||||
for (i=0 ; i < ::g->numvertexes ; i++, li++, ml++)
|
for( i = 0 ; i < ::g->numvertexes ; i++, li++, ml++ )
|
||||||
{
|
{
|
||||||
li->x = SHORT(ml->x)<<FRACBITS;
|
li->x = SHORT( ml->x ) << FRACBITS;
|
||||||
li->y = SHORT(ml->y)<<FRACBITS;
|
li->y = SHORT( ml->y ) << FRACBITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free buffer memory.
|
// Free buffer memory.
|
||||||
Z_Free(data);
|
Z_Free( data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ void P_LoadVertexes (int lump)
|
||||||
//
|
//
|
||||||
// P_LoadSegs
|
// P_LoadSegs
|
||||||
//
|
//
|
||||||
void P_LoadSegs (int lump)
|
void P_LoadSegs( int lump )
|
||||||
{
|
{
|
||||||
byte* data;
|
byte* data;
|
||||||
int i;
|
int i;
|
||||||
|
@ -146,36 +146,40 @@ void P_LoadSegs (int lump)
|
||||||
int psetup_linedef;
|
int psetup_linedef;
|
||||||
int side;
|
int side;
|
||||||
|
|
||||||
::g->numsegs = W_LumpLength (lump) / sizeof(mapseg_t);
|
::g->numsegs = W_LumpLength( lump ) / sizeof( mapseg_t );
|
||||||
// ::g->segs = (seg_t*)Z_Malloc (::g->numsegs*sizeof(seg_t),PU_LEVEL,0);
|
// ::g->segs = (seg_t*)Z_Malloc (::g->numsegs*sizeof(seg_t),PU_LEVEL,0);
|
||||||
|
|
||||||
if (MallocForLump( lump, ::g->numsegs*sizeof(seg_t), ::g->segs, PU_LEVEL_SHARED ))
|
if( MallocForLump( lump, ::g->numsegs * sizeof( seg_t ), ::g->segs, PU_LEVEL_SHARED ) )
|
||||||
{
|
{
|
||||||
memset (::g->segs, 0, ::g->numsegs*sizeof(seg_t));
|
memset( ::g->segs, 0, ::g->numsegs * sizeof( seg_t ) );
|
||||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
data = ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||||
|
|
||||||
ml = (mapseg_t *)data;
|
ml = ( mapseg_t* )data;
|
||||||
li = ::g->segs;
|
li = ::g->segs;
|
||||||
for (i=0 ; i < ::g->numsegs ; i++, li++, ml++)
|
for( i = 0 ; i < ::g->numsegs ; i++, li++, ml++ )
|
||||||
{
|
{
|
||||||
li->v1 = &::g->vertexes[SHORT(ml->v1)];
|
li->v1 = &::g->vertexes[SHORT( ml->v1 )];
|
||||||
li->v2 = &::g->vertexes[SHORT(ml->v2)];
|
li->v2 = &::g->vertexes[SHORT( ml->v2 )];
|
||||||
|
|
||||||
li->angle = (SHORT(ml->angle))<<16;
|
li->angle = ( SHORT( ml->angle ) ) << 16;
|
||||||
li->offset = (SHORT(ml->offset))<<16;
|
li->offset = ( SHORT( ml->offset ) ) << 16;
|
||||||
psetup_linedef = SHORT(ml->linedef);
|
psetup_linedef = SHORT( ml->linedef );
|
||||||
ldef = &::g->lines[psetup_linedef];
|
ldef = &::g->lines[psetup_linedef];
|
||||||
li->linedef = ldef;
|
li->linedef = ldef;
|
||||||
side = SHORT(ml->side);
|
side = SHORT( ml->side );
|
||||||
li->sidedef = &::g->sides[ldef->sidenum[side]];
|
li->sidedef = &::g->sides[ldef->sidenum[side]];
|
||||||
li->frontsector = ::g->sides[ldef->sidenum[side]].sector;
|
li->frontsector = ::g->sides[ldef->sidenum[side]].sector;
|
||||||
if (ldef-> flags & ML_TWOSIDED)
|
if( ldef-> flags & ML_TWOSIDED )
|
||||||
li->backsector = ::g->sides[ldef->sidenum[side^1]].sector;
|
{
|
||||||
|
li->backsector = ::g->sides[ldef->sidenum[side ^ 1]].sector;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
li->backsector = 0;
|
li->backsector = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(data);
|
Z_Free( data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,30 +187,30 @@ void P_LoadSegs (int lump)
|
||||||
//
|
//
|
||||||
// P_LoadSubsectors
|
// P_LoadSubsectors
|
||||||
//
|
//
|
||||||
void P_LoadSubsectors (int lump)
|
void P_LoadSubsectors( int lump )
|
||||||
{
|
{
|
||||||
byte* data;
|
byte* data;
|
||||||
int i;
|
int i;
|
||||||
mapsubsector_t* ms;
|
mapsubsector_t* ms;
|
||||||
subsector_t* ss;
|
subsector_t* ss;
|
||||||
|
|
||||||
::g->numsubsectors = W_LumpLength (lump) / sizeof(mapsubsector_t);
|
::g->numsubsectors = W_LumpLength( lump ) / sizeof( mapsubsector_t );
|
||||||
|
|
||||||
if (MallocForLump( lump, ::g->numsubsectors*sizeof(subsector_t), ::g->subsectors, PU_LEVEL_SHARED ))
|
if( MallocForLump( lump, ::g->numsubsectors * sizeof( subsector_t ), ::g->subsectors, PU_LEVEL_SHARED ) )
|
||||||
{
|
{
|
||||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
data = ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||||
|
|
||||||
ms = (mapsubsector_t *)data;
|
ms = ( mapsubsector_t* )data;
|
||||||
memset (::g->subsectors,0, ::g->numsubsectors*sizeof(subsector_t));
|
memset( ::g->subsectors, 0, ::g->numsubsectors * sizeof( subsector_t ) );
|
||||||
ss = ::g->subsectors;
|
ss = ::g->subsectors;
|
||||||
|
|
||||||
for (i=0 ; i < ::g->numsubsectors ; i++, ss++, ms++)
|
for( i = 0 ; i < ::g->numsubsectors ; i++, ss++, ms++ )
|
||||||
{
|
{
|
||||||
ss->numlines = SHORT(ms->numsegs);
|
ss->numlines = SHORT( ms->numsegs );
|
||||||
ss->firstline = SHORT(ms->firstseg);
|
ss->firstline = SHORT( ms->firstseg );
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(data);
|
Z_Free( data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,65 +219,65 @@ void P_LoadSubsectors (int lump)
|
||||||
//
|
//
|
||||||
// P_LoadSectors
|
// P_LoadSectors
|
||||||
//
|
//
|
||||||
void P_LoadSectors (int lump)
|
void P_LoadSectors( int lump )
|
||||||
{
|
{
|
||||||
byte* data;
|
byte* data;
|
||||||
int i;
|
int i;
|
||||||
mapsector_t* ms;
|
mapsector_t* ms;
|
||||||
sector_t* ss;
|
sector_t* ss;
|
||||||
|
|
||||||
::g->numsectors = W_LumpLength (lump) / sizeof(mapsector_t);
|
::g->numsectors = W_LumpLength( lump ) / sizeof( mapsector_t );
|
||||||
|
|
||||||
::g->sectors = (sector_t*)Z_Malloc( ::g->numsectors*sizeof(sector_t), PU_LEVEL, NULL );
|
::g->sectors = ( sector_t* )Z_Malloc( ::g->numsectors * sizeof( sector_t ), PU_LEVEL, NULL );
|
||||||
memset (::g->sectors, 0, ::g->numsectors*sizeof(sector_t));
|
memset( ::g->sectors, 0, ::g->numsectors * sizeof( sector_t ) );
|
||||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
data = ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||||
|
|
||||||
ms = (mapsector_t *)data;
|
ms = ( mapsector_t* )data;
|
||||||
ss = ::g->sectors;
|
ss = ::g->sectors;
|
||||||
for (i=0 ; i < ::g->numsectors ; i++, ss++, ms++)
|
for( i = 0 ; i < ::g->numsectors ; i++, ss++, ms++ )
|
||||||
{
|
{
|
||||||
ss->floorheight = SHORT(ms->floorheight)<<FRACBITS;
|
ss->floorheight = SHORT( ms->floorheight ) << FRACBITS;
|
||||||
ss->ceilingheight = SHORT(ms->ceilingheight)<<FRACBITS;
|
ss->ceilingheight = SHORT( ms->ceilingheight ) << FRACBITS;
|
||||||
ss->floorpic = R_FlatNumForName(ms->floorpic);
|
ss->floorpic = R_FlatNumForName( ms->floorpic );
|
||||||
ss->ceilingpic = R_FlatNumForName(ms->ceilingpic);
|
ss->ceilingpic = R_FlatNumForName( ms->ceilingpic );
|
||||||
ss->lightlevel = SHORT(ms->lightlevel);
|
ss->lightlevel = SHORT( ms->lightlevel );
|
||||||
ss->special = SHORT(ms->special);
|
ss->special = SHORT( ms->special );
|
||||||
ss->tag = SHORT(ms->tag);
|
ss->tag = SHORT( ms->tag );
|
||||||
ss->thinglist = NULL;
|
ss->thinglist = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(data);
|
Z_Free( data );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (MallocForLump( lump, ::g->numsectors*sizeof(sector_t), (void**)&::g->sectors, PU_LEVEL_SHARED ))
|
if (MallocForLump( lump, ::g->numsectors*sizeof(sector_t), (void**)&::g->sectors, PU_LEVEL_SHARED ))
|
||||||
{
|
|
||||||
memset (::g->sectors, 0, ::g->numsectors*sizeof(sector_t));
|
|
||||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
|
||||||
|
|
||||||
ms = (mapsector_t *)data;
|
|
||||||
ss = ::g->sectors;
|
|
||||||
for (i=0 ; i < ::g->numsectors ; i++, ss++, ms++)
|
|
||||||
{
|
{
|
||||||
ss->floorheight = SHORT(ms->floorheight)<<FRACBITS;
|
memset (::g->sectors, 0, ::g->numsectors*sizeof(sector_t));
|
||||||
ss->ceilingheight = SHORT(ms->ceilingheight)<<FRACBITS;
|
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
||||||
ss->floorpic = R_FlatNumForName(ms->floorpic);
|
|
||||||
ss->ceilingpic = R_FlatNumForName(ms->ceilingpic);
|
|
||||||
ss->lightlevel = SHORT(ms->lightlevel);
|
|
||||||
ss->special = SHORT(ms->special);
|
|
||||||
ss->tag = SHORT(ms->tag);
|
|
||||||
ss->thinglist = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
DoomLib::Z_Free(data);
|
ms = (mapsector_t *)data;
|
||||||
}
|
ss = ::g->sectors;
|
||||||
*/
|
for (i=0 ; i < ::g->numsectors ; i++, ss++, ms++)
|
||||||
|
{
|
||||||
|
ss->floorheight = SHORT(ms->floorheight)<<FRACBITS;
|
||||||
|
ss->ceilingheight = SHORT(ms->ceilingheight)<<FRACBITS;
|
||||||
|
ss->floorpic = R_FlatNumForName(ms->floorpic);
|
||||||
|
ss->ceilingpic = R_FlatNumForName(ms->ceilingpic);
|
||||||
|
ss->lightlevel = SHORT(ms->lightlevel);
|
||||||
|
ss->special = SHORT(ms->special);
|
||||||
|
ss->tag = SHORT(ms->tag);
|
||||||
|
ss->thinglist = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
DoomLib::Z_Free(data);
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_LoadNodes
|
// P_LoadNodes
|
||||||
//
|
//
|
||||||
void P_LoadNodes (int lump)
|
void P_LoadNodes( int lump )
|
||||||
{
|
{
|
||||||
byte* data;
|
byte* data;
|
||||||
int i;
|
int i;
|
||||||
|
@ -282,29 +286,31 @@ void P_LoadNodes (int lump)
|
||||||
mapnode_t* mn;
|
mapnode_t* mn;
|
||||||
node_t* no;
|
node_t* no;
|
||||||
|
|
||||||
::g->numnodes = W_LumpLength (lump) / sizeof(mapnode_t);
|
::g->numnodes = W_LumpLength( lump ) / sizeof( mapnode_t );
|
||||||
if (MallocForLump( lump, ::g->numnodes*sizeof(node_t), ::g->nodes, PU_LEVEL_SHARED ))
|
if( MallocForLump( lump, ::g->numnodes * sizeof( node_t ), ::g->nodes, PU_LEVEL_SHARED ) )
|
||||||
{
|
{
|
||||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
data = ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||||
|
|
||||||
mn = (mapnode_t *)data;
|
mn = ( mapnode_t* )data;
|
||||||
no = ::g->nodes;
|
no = ::g->nodes;
|
||||||
|
|
||||||
for (i=0 ; i < ::g->numnodes ; i++, no++, mn++)
|
for( i = 0 ; i < ::g->numnodes ; i++, no++, mn++ )
|
||||||
{
|
{
|
||||||
no->x = SHORT(mn->x)<<FRACBITS;
|
no->x = SHORT( mn->x ) << FRACBITS;
|
||||||
no->y = SHORT(mn->y)<<FRACBITS;
|
no->y = SHORT( mn->y ) << FRACBITS;
|
||||||
no->dx = SHORT(mn->dx)<<FRACBITS;
|
no->dx = SHORT( mn->dx ) << FRACBITS;
|
||||||
no->dy = SHORT(mn->dy)<<FRACBITS;
|
no->dy = SHORT( mn->dy ) << FRACBITS;
|
||||||
for (j=0 ; j<2 ; j++)
|
for( j = 0 ; j < 2 ; j++ )
|
||||||
{
|
{
|
||||||
no->children[j] = SHORT(mn->children[j]);
|
no->children[j] = SHORT( mn->children[j] );
|
||||||
for (k=0 ; k<4 ; k++)
|
for( k = 0 ; k < 4 ; k++ )
|
||||||
no->bbox[j][k] = SHORT(mn->bbox[j][k])<<FRACBITS;
|
{
|
||||||
|
no->bbox[j][k] = SHORT( mn->bbox[j][k] ) << FRACBITS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(data);
|
Z_Free( data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +318,7 @@ void P_LoadNodes (int lump)
|
||||||
//
|
//
|
||||||
// P_LoadThings
|
// P_LoadThings
|
||||||
//
|
//
|
||||||
void P_LoadThings (int lump)
|
void P_LoadThings( int lump )
|
||||||
{
|
{
|
||||||
byte* data;
|
byte* data;
|
||||||
int i;
|
int i;
|
||||||
|
@ -320,47 +326,49 @@ void P_LoadThings (int lump)
|
||||||
int numthings;
|
int numthings;
|
||||||
qboolean spawn;
|
qboolean spawn;
|
||||||
|
|
||||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
data = ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||||
numthings = (W_LumpLength (lump) / sizeof(mapthing_t));
|
numthings = ( W_LumpLength( lump ) / sizeof( mapthing_t ) );
|
||||||
|
|
||||||
mt = (mapthing_t *)data;
|
mt = ( mapthing_t* )data;
|
||||||
for (i=0 ; i<numthings ; i++, mt++)
|
for( i = 0 ; i < numthings ; i++, mt++ )
|
||||||
{
|
{
|
||||||
spawn = true;
|
spawn = true;
|
||||||
|
|
||||||
// Do not spawn cool, new monsters if !commercial
|
// Do not spawn cool, new monsters if !commercial
|
||||||
if ( ::g->gamemode != commercial)
|
if( ::g->gamemode != commercial )
|
||||||
{
|
{
|
||||||
switch(mt->type)
|
switch( mt->type )
|
||||||
{
|
{
|
||||||
case 68: // Arachnotron
|
case 68: // Arachnotron
|
||||||
case 64: // Archvile
|
case 64: // Archvile
|
||||||
case 88: // Boss Brain
|
case 88: // Boss Brain
|
||||||
case 89: // Boss Shooter
|
case 89: // Boss Shooter
|
||||||
case 69: // Hell Knight
|
case 69: // Hell Knight
|
||||||
case 67: // Mancubus
|
case 67: // Mancubus
|
||||||
case 71: // Pain Elemental
|
case 71: // Pain Elemental
|
||||||
case 65: // Former Human Commando
|
case 65: // Former Human Commando
|
||||||
case 66: // Revenant
|
case 66: // Revenant
|
||||||
case 84: // Wolf SS
|
case 84: // Wolf SS
|
||||||
spawn = false;
|
spawn = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (spawn == false)
|
if( spawn == false )
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Do spawn all other stuff.
|
// Do spawn all other stuff.
|
||||||
mt->x = SHORT(mt->x);
|
mt->x = SHORT( mt->x );
|
||||||
mt->y = SHORT(mt->y);
|
mt->y = SHORT( mt->y );
|
||||||
mt->angle = SHORT(mt->angle);
|
mt->angle = SHORT( mt->angle );
|
||||||
mt->type = SHORT(mt->type);
|
mt->type = SHORT( mt->type );
|
||||||
mt->options = SHORT(mt->options);
|
mt->options = SHORT( mt->options );
|
||||||
|
|
||||||
P_SpawnMapThing (mt);
|
P_SpawnMapThing( mt );
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(data);
|
Z_Free( data );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -368,7 +376,7 @@ void P_LoadThings (int lump)
|
||||||
// P_LoadLineDefs
|
// P_LoadLineDefs
|
||||||
// Also counts secret ::g->lines for intermissions.
|
// Also counts secret ::g->lines for intermissions.
|
||||||
//
|
//
|
||||||
void P_LoadLineDefs (int lump)
|
void P_LoadLineDefs( int lump )
|
||||||
{
|
{
|
||||||
byte* data;
|
byte* data;
|
||||||
int i;
|
int i;
|
||||||
|
@ -377,37 +385,45 @@ void P_LoadLineDefs (int lump)
|
||||||
vertex_t* v1;
|
vertex_t* v1;
|
||||||
vertex_t* v2;
|
vertex_t* v2;
|
||||||
|
|
||||||
::g->numlines = W_LumpLength (lump) / sizeof(maplinedef_t);
|
::g->numlines = W_LumpLength( lump ) / sizeof( maplinedef_t );
|
||||||
if (MallocForLump( lump, ::g->numlines*sizeof(line_t), ::g->lines, PU_LEVEL_SHARED ))
|
if( MallocForLump( lump, ::g->numlines * sizeof( line_t ), ::g->lines, PU_LEVEL_SHARED ) )
|
||||||
{
|
{
|
||||||
memset (::g->lines, 0, ::g->numlines*sizeof(line_t));
|
memset( ::g->lines, 0, ::g->numlines * sizeof( line_t ) );
|
||||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
data = ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||||
|
|
||||||
mld = (maplinedef_t *)data;
|
mld = ( maplinedef_t* )data;
|
||||||
ld = ::g->lines;
|
ld = ::g->lines;
|
||||||
for (i=0 ; i < ::g->numlines ; i++, mld++, ld++)
|
for( i = 0 ; i < ::g->numlines ; i++, mld++, ld++ )
|
||||||
{
|
{
|
||||||
ld->flags = SHORT(mld->flags);
|
ld->flags = SHORT( mld->flags );
|
||||||
ld->special = SHORT(mld->special);
|
ld->special = SHORT( mld->special );
|
||||||
ld->tag = SHORT(mld->tag);
|
ld->tag = SHORT( mld->tag );
|
||||||
v1 = ld->v1 = &::g->vertexes[SHORT(mld->v1)];
|
v1 = ld->v1 = &::g->vertexes[SHORT( mld->v1 )];
|
||||||
v2 = ld->v2 = &::g->vertexes[SHORT(mld->v2)];
|
v2 = ld->v2 = &::g->vertexes[SHORT( mld->v2 )];
|
||||||
ld->dx = v2->x - v1->x;
|
ld->dx = v2->x - v1->x;
|
||||||
ld->dy = v2->y - v1->y;
|
ld->dy = v2->y - v1->y;
|
||||||
|
|
||||||
if (!ld->dx)
|
if( !ld->dx )
|
||||||
|
{
|
||||||
ld->slopetype = ST_VERTICAL;
|
ld->slopetype = ST_VERTICAL;
|
||||||
else if (!ld->dy)
|
}
|
||||||
|
else if( !ld->dy )
|
||||||
|
{
|
||||||
ld->slopetype = ST_HORIZONTAL;
|
ld->slopetype = ST_HORIZONTAL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (FixedDiv (ld->dy , ld->dx) > 0)
|
if( FixedDiv( ld->dy , ld->dx ) > 0 )
|
||||||
|
{
|
||||||
ld->slopetype = ST_POSITIVE;
|
ld->slopetype = ST_POSITIVE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ld->slopetype = ST_NEGATIVE;
|
ld->slopetype = ST_NEGATIVE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v1->x < v2->x)
|
if( v1->x < v2->x )
|
||||||
{
|
{
|
||||||
ld->bbox[BOXLEFT] = v1->x;
|
ld->bbox[BOXLEFT] = v1->x;
|
||||||
ld->bbox[BOXRIGHT] = v2->x;
|
ld->bbox[BOXRIGHT] = v2->x;
|
||||||
|
@ -418,7 +434,7 @@ void P_LoadLineDefs (int lump)
|
||||||
ld->bbox[BOXRIGHT] = v1->x;
|
ld->bbox[BOXRIGHT] = v1->x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v1->y < v2->y)
|
if( v1->y < v2->y )
|
||||||
{
|
{
|
||||||
ld->bbox[BOXBOTTOM] = v1->y;
|
ld->bbox[BOXBOTTOM] = v1->y;
|
||||||
ld->bbox[BOXTOP] = v2->y;
|
ld->bbox[BOXTOP] = v2->y;
|
||||||
|
@ -429,21 +445,29 @@ void P_LoadLineDefs (int lump)
|
||||||
ld->bbox[BOXTOP] = v1->y;
|
ld->bbox[BOXTOP] = v1->y;
|
||||||
}
|
}
|
||||||
|
|
||||||
ld->sidenum[0] = SHORT(mld->sidenum[0]);
|
ld->sidenum[0] = SHORT( mld->sidenum[0] );
|
||||||
ld->sidenum[1] = SHORT(mld->sidenum[1]);
|
ld->sidenum[1] = SHORT( mld->sidenum[1] );
|
||||||
|
|
||||||
if (ld->sidenum[0] != -1)
|
if( ld->sidenum[0] != -1 )
|
||||||
|
{
|
||||||
ld->frontsector = ::g->sides[ld->sidenum[0]].sector;
|
ld->frontsector = ::g->sides[ld->sidenum[0]].sector;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ld->frontsector = 0;
|
ld->frontsector = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (ld->sidenum[1] != -1)
|
if( ld->sidenum[1] != -1 )
|
||||||
|
{
|
||||||
ld->backsector = ::g->sides[ld->sidenum[1]].sector;
|
ld->backsector = ::g->sides[ld->sidenum[1]].sector;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ld->backsector = 0;
|
ld->backsector = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(data);
|
Z_Free( data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,32 +475,32 @@ void P_LoadLineDefs (int lump)
|
||||||
//
|
//
|
||||||
// P_LoadSideDefs
|
// P_LoadSideDefs
|
||||||
//
|
//
|
||||||
void P_LoadSideDefs (int lump)
|
void P_LoadSideDefs( int lump )
|
||||||
{
|
{
|
||||||
byte* data;
|
byte* data;
|
||||||
int i;
|
int i;
|
||||||
mapsidedef_t* msd;
|
mapsidedef_t* msd;
|
||||||
side_t* sd;
|
side_t* sd;
|
||||||
|
|
||||||
::g->numsides = W_LumpLength (lump) / sizeof(mapsidedef_t);
|
::g->numsides = W_LumpLength( lump ) / sizeof( mapsidedef_t );
|
||||||
if (MallocForLump( lump, ::g->numsides*sizeof(side_t), ::g->sides, PU_LEVEL_SHARED))
|
if( MallocForLump( lump, ::g->numsides * sizeof( side_t ), ::g->sides, PU_LEVEL_SHARED ) )
|
||||||
{
|
{
|
||||||
memset (::g->sides, 0, ::g->numsides*sizeof(side_t));
|
memset( ::g->sides, 0, ::g->numsides * sizeof( side_t ) );
|
||||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
data = ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||||
|
|
||||||
msd = (mapsidedef_t *)data;
|
msd = ( mapsidedef_t* )data;
|
||||||
sd = ::g->sides;
|
sd = ::g->sides;
|
||||||
for (i=0 ; i < ::g->numsides ; i++, msd++, sd++)
|
for( i = 0 ; i < ::g->numsides ; i++, msd++, sd++ )
|
||||||
{
|
{
|
||||||
sd->textureoffset = SHORT(msd->textureoffset)<<FRACBITS;
|
sd->textureoffset = SHORT( msd->textureoffset ) << FRACBITS;
|
||||||
sd->rowoffset = SHORT(msd->rowoffset)<<FRACBITS;
|
sd->rowoffset = SHORT( msd->rowoffset ) << FRACBITS;
|
||||||
sd->toptexture = R_TextureNumForName(msd->toptexture);
|
sd->toptexture = R_TextureNumForName( msd->toptexture );
|
||||||
sd->bottomtexture = R_TextureNumForName(msd->bottomtexture);
|
sd->bottomtexture = R_TextureNumForName( msd->bottomtexture );
|
||||||
sd->midtexture = R_TextureNumForName(msd->midtexture);
|
sd->midtexture = R_TextureNumForName( msd->midtexture );
|
||||||
sd->sector = &::g->sectors[SHORT(msd->sector)];
|
sd->sector = &::g->sectors[SHORT( msd->sector )];
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(data);
|
Z_Free( data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,34 +508,38 @@ void P_LoadSideDefs (int lump)
|
||||||
//
|
//
|
||||||
// P_LoadBlockMap
|
// P_LoadBlockMap
|
||||||
//
|
//
|
||||||
void P_LoadBlockMap (int lump)
|
void P_LoadBlockMap( int lump )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
bool firstTime = false;
|
bool firstTime = false;
|
||||||
if (!lumpcache[lump]) { // SMF - solution for double endian conversion issue
|
if( !lumpcache[lump] ) // SMF - solution for double endian conversion issue
|
||||||
|
{
|
||||||
firstTime = true;
|
firstTime = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
::g->blockmaplump = (short*)W_CacheLumpNum (lump,PU_LEVEL_SHARED); // ALAN: This is initialized somewhere else as shared...
|
::g->blockmaplump = ( short* )W_CacheLumpNum( lump, PU_LEVEL_SHARED ); // ALAN: This is initialized somewhere else as shared...
|
||||||
::g->blockmap = ::g->blockmaplump+4;
|
::g->blockmap = ::g->blockmaplump + 4;
|
||||||
count = W_LumpLength (lump)/2;
|
count = W_LumpLength( lump ) / 2;
|
||||||
|
|
||||||
if ( firstTime ) { // SMF
|
if( firstTime ) // SMF
|
||||||
for (i=0 ; i<count ; i++)
|
{
|
||||||
::g->blockmaplump[i] = SHORT(::g->blockmaplump[i]);
|
for( i = 0 ; i < count ; i++ )
|
||||||
|
{
|
||||||
|
::g->blockmaplump[i] = SHORT( ::g->blockmaplump[i] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
::g->bmaporgx = ( ::g->blockmaplump[0] )<<FRACBITS;
|
::g->bmaporgx = ( ::g->blockmaplump[0] ) << FRACBITS;
|
||||||
::g->bmaporgy = ( ::g->blockmaplump[1] )<<FRACBITS;
|
::g->bmaporgy = ( ::g->blockmaplump[1] ) << FRACBITS;
|
||||||
::g->bmapwidth = ( ::g->blockmaplump[2] );
|
::g->bmapwidth = ( ::g->blockmaplump[2] );
|
||||||
::g->bmapheight = ( ::g->blockmaplump[3] );
|
::g->bmapheight = ( ::g->blockmaplump[3] );
|
||||||
|
|
||||||
// clear out mobj chains
|
// clear out mobj chains
|
||||||
count = sizeof(*::g->blocklinks)* ::g->bmapwidth*::g->bmapheight;
|
count = sizeof( *::g->blocklinks )* ::g->bmapwidth*::g->bmapheight;
|
||||||
::g->blocklinks = (mobj_t**)Z_Malloc (count,PU_LEVEL, 0);
|
::g->blocklinks = ( mobj_t** )Z_Malloc( count, PU_LEVEL, 0 );
|
||||||
memset (::g->blocklinks, 0, count);
|
memset( ::g->blocklinks, 0, count );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -521,7 +549,7 @@ void P_LoadBlockMap (int lump)
|
||||||
// Builds sector line lists and subsector sector numbers.
|
// Builds sector line lists and subsector sector numbers.
|
||||||
// Finds block bounding boxes for ::g->sectors.
|
// Finds block bounding boxes for ::g->sectors.
|
||||||
//
|
//
|
||||||
void P_GroupLines (void)
|
void P_GroupLines( void )
|
||||||
{
|
{
|
||||||
line_t** linebuffer;
|
line_t** linebuffer;
|
||||||
int i;
|
int i;
|
||||||
|
@ -537,7 +565,7 @@ void P_GroupLines (void)
|
||||||
|
|
||||||
// look up sector number for each subsector
|
// look up sector number for each subsector
|
||||||
ss = ::g->subsectors;
|
ss = ::g->subsectors;
|
||||||
for (i=0 ; i < ::g->numsubsectors ; i++, ss++)
|
for( i = 0 ; i < ::g->numsubsectors ; i++, ss++ )
|
||||||
{
|
{
|
||||||
seg = &::g->segs[ss->firstline];
|
seg = &::g->segs[ss->firstline];
|
||||||
ss->sector = seg->sidedef->sector;
|
ss->sector = seg->sidedef->sector;
|
||||||
|
@ -546,12 +574,12 @@ void P_GroupLines (void)
|
||||||
// count number of ::g->lines in each sector
|
// count number of ::g->lines in each sector
|
||||||
li = ::g->lines;
|
li = ::g->lines;
|
||||||
total = 0;
|
total = 0;
|
||||||
for (i=0 ; i < ::g->numlines ; i++, li++)
|
for( i = 0 ; i < ::g->numlines ; i++, li++ )
|
||||||
{
|
{
|
||||||
total++;
|
total++;
|
||||||
li->frontsector->linecount++;
|
li->frontsector->linecount++;
|
||||||
|
|
||||||
if (li->backsector && li->backsector != li->frontsector)
|
if( li->backsector && li->backsector != li->frontsector )
|
||||||
{
|
{
|
||||||
li->backsector->linecount++;
|
li->backsector->linecount++;
|
||||||
total++;
|
total++;
|
||||||
|
@ -559,45 +587,47 @@ void P_GroupLines (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// build line tables for each sector
|
// build line tables for each sector
|
||||||
linebuffer = (line_t**)Z_Malloc (total*sizeof(line_t*), PU_LEVEL, 0);
|
linebuffer = ( line_t** )Z_Malloc( total * sizeof( line_t* ), PU_LEVEL, 0 );
|
||||||
sector = ::g->sectors;
|
sector = ::g->sectors;
|
||||||
for (i=0 ; i < ::g->numsectors ; i++, sector++)
|
for( i = 0 ; i < ::g->numsectors ; i++, sector++ )
|
||||||
{
|
{
|
||||||
M_ClearBox (bbox);
|
M_ClearBox( bbox );
|
||||||
sector->lines = linebuffer;
|
sector->lines = linebuffer;
|
||||||
li = ::g->lines;
|
li = ::g->lines;
|
||||||
for (j=0 ; j < ::g->numlines ; j++, li++)
|
for( j = 0 ; j < ::g->numlines ; j++, li++ )
|
||||||
{
|
{
|
||||||
if (li->frontsector == sector || li->backsector == sector)
|
if( li->frontsector == sector || li->backsector == sector )
|
||||||
{
|
{
|
||||||
*linebuffer++ = li;
|
*linebuffer++ = li;
|
||||||
M_AddToBox (bbox, li->v1->x, li->v1->y);
|
M_AddToBox( bbox, li->v1->x, li->v1->y );
|
||||||
M_AddToBox (bbox, li->v2->x, li->v2->y);
|
M_AddToBox( bbox, li->v2->x, li->v2->y );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (linebuffer - sector->lines != sector->linecount)
|
if( linebuffer - sector->lines != sector->linecount )
|
||||||
I_Error ("P_GroupLines: miscounted");
|
{
|
||||||
|
I_Error( "P_GroupLines: miscounted" );
|
||||||
|
}
|
||||||
|
|
||||||
// set the degenmobj_t to the middle of the bounding box
|
// set the degenmobj_t to the middle of the bounding box
|
||||||
sector->soundorg.x = (bbox[BOXRIGHT]+bbox[BOXLEFT])/2;
|
sector->soundorg.x = ( bbox[BOXRIGHT] + bbox[BOXLEFT] ) / 2;
|
||||||
sector->soundorg.y = (bbox[BOXTOP]+bbox[BOXBOTTOM])/2;
|
sector->soundorg.y = ( bbox[BOXTOP] + bbox[BOXBOTTOM] ) / 2;
|
||||||
|
|
||||||
// adjust bounding box to map blocks
|
// adjust bounding box to map blocks
|
||||||
block = (bbox[BOXTOP]-::g->bmaporgy+MAXRADIUS)>>MAPBLOCKSHIFT;
|
block = ( bbox[BOXTOP] -::g->bmaporgy + MAXRADIUS ) >> MAPBLOCKSHIFT;
|
||||||
block = block >= ::g->bmapheight ? ::g->bmapheight-1 : block;
|
block = block >= ::g->bmapheight ? ::g->bmapheight - 1 : block;
|
||||||
sector->blockbox[BOXTOP]=block;
|
sector->blockbox[BOXTOP] = block;
|
||||||
|
|
||||||
block = (bbox[BOXBOTTOM]-::g->bmaporgy-MAXRADIUS)>>MAPBLOCKSHIFT;
|
block = ( bbox[BOXBOTTOM] -::g->bmaporgy - MAXRADIUS ) >> MAPBLOCKSHIFT;
|
||||||
block = block < 0 ? 0 : block;
|
block = block < 0 ? 0 : block;
|
||||||
sector->blockbox[BOXBOTTOM]=block;
|
sector->blockbox[BOXBOTTOM] = block;
|
||||||
|
|
||||||
block = (bbox[BOXRIGHT]-::g->bmaporgx+MAXRADIUS)>>MAPBLOCKSHIFT;
|
block = ( bbox[BOXRIGHT] -::g->bmaporgx + MAXRADIUS ) >> MAPBLOCKSHIFT;
|
||||||
block = block >= ::g->bmapwidth ? ::g->bmapwidth-1 : block;
|
block = block >= ::g->bmapwidth ? ::g->bmapwidth - 1 : block;
|
||||||
sector->blockbox[BOXRIGHT]=block;
|
sector->blockbox[BOXRIGHT] = block;
|
||||||
|
|
||||||
block = (bbox[BOXLEFT]-::g->bmaporgx-MAXRADIUS)>>MAPBLOCKSHIFT;
|
block = ( bbox[BOXLEFT] -::g->bmaporgx - MAXRADIUS ) >> MAPBLOCKSHIFT;
|
||||||
block = block < 0 ? 0 : block;
|
block = block < 0 ? 0 : block;
|
||||||
sector->blockbox[BOXLEFT]=block;
|
sector->blockbox[BOXLEFT] = block;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -609,9 +639,9 @@ void P_GroupLines (void)
|
||||||
void
|
void
|
||||||
P_SetupLevel
|
P_SetupLevel
|
||||||
( int episode,
|
( int episode,
|
||||||
int map,
|
int map,
|
||||||
int playermask,
|
int playermask,
|
||||||
skill_t skill)
|
skill_t skill )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char lumpname[9];
|
char lumpname[9];
|
||||||
|
@ -619,10 +649,10 @@ P_SetupLevel
|
||||||
|
|
||||||
::g->totalkills = ::g->totalitems = ::g->totalsecret = ::g->wminfo.maxfrags = 0;
|
::g->totalkills = ::g->totalitems = ::g->totalsecret = ::g->wminfo.maxfrags = 0;
|
||||||
::g->wminfo.partime = 180;
|
::g->wminfo.partime = 180;
|
||||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
for( i = 0 ; i < MAXPLAYERS ; i++ )
|
||||||
{
|
{
|
||||||
::g->players[i].killcount = ::g->players[i].secretcount
|
::g->players[i].killcount = ::g->players[i].secretcount
|
||||||
= ::g->players[i].itemcount = 0;
|
= ::g->players[i].itemcount = 0;
|
||||||
|
|
||||||
::g->players[i].chainsawKills = 0;
|
::g->players[i].chainsawKills = 0;
|
||||||
::g->players[i].berserkKills = 0;
|
::g->players[i].berserkKills = 0;
|
||||||
|
@ -633,32 +663,36 @@ P_SetupLevel
|
||||||
::g->players[::g->consoleplayer].viewz = 1;
|
::g->players[::g->consoleplayer].viewz = 1;
|
||||||
|
|
||||||
// Make sure all sounds are stopped before Z_FreeTags.
|
// Make sure all sounds are stopped before Z_FreeTags.
|
||||||
S_Start ();
|
S_Start();
|
||||||
|
|
||||||
Z_FreeTags( PU_LEVEL, PU_PURGELEVEL-1 );
|
Z_FreeTags( PU_LEVEL, PU_PURGELEVEL - 1 );
|
||||||
|
|
||||||
// UNUSED W_Profile ();
|
// UNUSED W_Profile ();
|
||||||
P_InitThinkers ();
|
P_InitThinkers();
|
||||||
|
|
||||||
// if working with a devlopment map, reload it
|
// if working with a devlopment map, reload it
|
||||||
// W_Reload ();
|
// W_Reload ();
|
||||||
|
|
||||||
// DHM - NERVE :: Update the cached asset pointers in case the wad files were reloaded
|
// DHM - NERVE :: Update the cached asset pointers in case the wad files were reloaded
|
||||||
{
|
{
|
||||||
void ST_loadData(void);
|
void ST_loadData( void );
|
||||||
ST_loadData();
|
ST_loadData();
|
||||||
|
|
||||||
void HU_Init(void);
|
void HU_Init( void );
|
||||||
HU_Init();
|
HU_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// find map name
|
// find map name
|
||||||
if ( ::g->gamemode == commercial)
|
if( ::g->gamemode == commercial )
|
||||||
{
|
{
|
||||||
if (map<10)
|
if( map < 10 )
|
||||||
sprintf (lumpname, "map0%i", map % 100);
|
{
|
||||||
|
sprintf( lumpname, "map0%i", map % 100 );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sprintf (lumpname, "map%i", map % 100);
|
{
|
||||||
|
sprintf( lumpname, "map%i", map % 100 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -669,40 +703,40 @@ P_SetupLevel
|
||||||
lumpname[4] = 0;
|
lumpname[4] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
lumpnum = W_GetNumForName (lumpname);
|
lumpnum = W_GetNumForName( lumpname );
|
||||||
|
|
||||||
::g->leveltime = 0;
|
::g->leveltime = 0;
|
||||||
|
|
||||||
// note: most of this ordering is important
|
// note: most of this ordering is important
|
||||||
P_LoadBlockMap (lumpnum+ML_BLOCKMAP);
|
P_LoadBlockMap( lumpnum + ML_BLOCKMAP );
|
||||||
P_LoadVertexes (lumpnum+ML_VERTEXES);
|
P_LoadVertexes( lumpnum + ML_VERTEXES );
|
||||||
P_LoadSectors (lumpnum+ML_SECTORS);
|
P_LoadSectors( lumpnum + ML_SECTORS );
|
||||||
P_LoadSideDefs (lumpnum+ML_SIDEDEFS);
|
P_LoadSideDefs( lumpnum + ML_SIDEDEFS );
|
||||||
|
|
||||||
P_LoadLineDefs (lumpnum+ML_LINEDEFS);
|
P_LoadLineDefs( lumpnum + ML_LINEDEFS );
|
||||||
P_LoadSubsectors (lumpnum+ML_SSECTORS);
|
P_LoadSubsectors( lumpnum + ML_SSECTORS );
|
||||||
P_LoadNodes (lumpnum+ML_NODES);
|
P_LoadNodes( lumpnum + ML_NODES );
|
||||||
P_LoadSegs (lumpnum+ML_SEGS);
|
P_LoadSegs( lumpnum + ML_SEGS );
|
||||||
|
|
||||||
::g->rejectmatrix = (byte*)W_CacheLumpNum (lumpnum+ML_REJECT,PU_LEVEL);
|
::g->rejectmatrix = ( byte* )W_CacheLumpNum( lumpnum + ML_REJECT, PU_LEVEL );
|
||||||
|
|
||||||
P_GroupLines ();
|
P_GroupLines();
|
||||||
|
|
||||||
::g->bodyqueslot = 0;
|
::g->bodyqueslot = 0;
|
||||||
::g->deathmatch_p = ::g->deathmatchstarts;
|
::g->deathmatch_p = ::g->deathmatchstarts;
|
||||||
P_LoadThings (lumpnum+ML_THINGS);
|
P_LoadThings( lumpnum + ML_THINGS );
|
||||||
|
|
||||||
// if ::g->deathmatch, randomly spawn the active ::g->players
|
// if ::g->deathmatch, randomly spawn the active ::g->players
|
||||||
if (::g->deathmatch)
|
if( ::g->deathmatch )
|
||||||
{
|
{
|
||||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
for( i = 0 ; i < MAXPLAYERS ; i++ )
|
||||||
if (::g->playeringame[i])
|
if( ::g->playeringame[i] )
|
||||||
{
|
{
|
||||||
// DHM - Nerve :: In deathmatch, reset every player at match start
|
// DHM - Nerve :: In deathmatch, reset every player at match start
|
||||||
::g->players[i].playerstate = PST_REBORN;
|
::g->players[i].playerstate = PST_REBORN;
|
||||||
|
|
||||||
::g->players[i].mo = NULL;
|
::g->players[i].mo = NULL;
|
||||||
G_DeathMatchSpawnPlayer (i);
|
G_DeathMatchSpawnPlayer( i );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -711,14 +745,16 @@ P_SetupLevel
|
||||||
::g->iquehead = ::g->iquetail = 0;
|
::g->iquehead = ::g->iquetail = 0;
|
||||||
|
|
||||||
// set up world state
|
// set up world state
|
||||||
P_SpawnSpecials ();
|
P_SpawnSpecials();
|
||||||
|
|
||||||
// build subsector connect matrix
|
// build subsector connect matrix
|
||||||
// UNUSED P_ConnectSubsectors ();
|
// UNUSED P_ConnectSubsectors ();
|
||||||
|
|
||||||
// preload graphics
|
// preload graphics
|
||||||
if (::g->precache)
|
if( ::g->precache )
|
||||||
R_PrecacheLevel ();
|
{
|
||||||
|
R_PrecacheLevel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -726,11 +762,11 @@ P_SetupLevel
|
||||||
//
|
//
|
||||||
// P_Init
|
// P_Init
|
||||||
//
|
//
|
||||||
void P_Init (void)
|
void P_Init( void )
|
||||||
{
|
{
|
||||||
P_InitSwitchList ();
|
P_InitSwitchList();
|
||||||
P_InitPicAnims ();
|
P_InitPicAnims();
|
||||||
R_InitSprites (sprnames);
|
R_InitSprites( sprnames );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,10 +41,10 @@ P_SetupLevel
|
||||||
( int episode,
|
( int episode,
|
||||||
int map,
|
int map,
|
||||||
int playermask,
|
int playermask,
|
||||||
skill_t skill);
|
skill_t skill );
|
||||||
|
|
||||||
// Called by startup code.
|
// Called by startup code.
|
||||||
void P_Init (void);
|
void P_Init( void );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -55,45 +55,57 @@ P_DivlineSide
|
||||||
fixed_t y,
|
fixed_t y,
|
||||||
divline_t* node )
|
divline_t* node )
|
||||||
{
|
{
|
||||||
fixed_t dx;
|
fixed_t dx;
|
||||||
fixed_t dy;
|
fixed_t dy;
|
||||||
fixed_t left;
|
fixed_t left;
|
||||||
fixed_t right;
|
fixed_t right;
|
||||||
|
|
||||||
if (!node->dx)
|
if( !node->dx )
|
||||||
{
|
{
|
||||||
if (x==node->x)
|
if( x == node->x )
|
||||||
return 2;
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (x <= node->x)
|
if( x <= node->x )
|
||||||
return node->dy > 0;
|
{
|
||||||
|
return node->dy > 0;
|
||||||
|
}
|
||||||
|
|
||||||
return node->dy < 0;
|
return node->dy < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!node->dy)
|
if( !node->dy )
|
||||||
{
|
{
|
||||||
if (x==node->y)
|
if( x == node->y )
|
||||||
return 2;
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (y <= node->y)
|
if( y <= node->y )
|
||||||
return node->dx < 0;
|
{
|
||||||
|
return node->dx < 0;
|
||||||
|
}
|
||||||
|
|
||||||
return node->dx > 0;
|
return node->dx > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dx = (x - node->x);
|
dx = ( x - node->x );
|
||||||
dy = (y - node->y);
|
dy = ( y - node->y );
|
||||||
|
|
||||||
left = (node->dy>>FRACBITS) * (dx>>FRACBITS);
|
left = ( node->dy >> FRACBITS ) * ( dx >> FRACBITS );
|
||||||
right = (dy>>FRACBITS) * (node->dx>>FRACBITS);
|
right = ( dy >> FRACBITS ) * ( node->dx >> FRACBITS );
|
||||||
|
|
||||||
if (right < left)
|
if( right < left )
|
||||||
return 0; // front side
|
{
|
||||||
|
return 0; // front side
|
||||||
|
}
|
||||||
|
|
||||||
if (left == right)
|
if( left == right )
|
||||||
return 2;
|
{
|
||||||
return 1; // back side
|
return 2;
|
||||||
|
}
|
||||||
|
return 1; // back side
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,21 +120,23 @@ P_InterceptVector2
|
||||||
( divline_t* v2,
|
( divline_t* v2,
|
||||||
divline_t* v1 )
|
divline_t* v1 )
|
||||||
{
|
{
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
fixed_t num;
|
fixed_t num;
|
||||||
fixed_t den;
|
fixed_t den;
|
||||||
|
|
||||||
den = FixedMul (v1->dy>>8,v2->dx) - FixedMul(v1->dx>>8,v2->dy);
|
den = FixedMul( v1->dy >> 8, v2->dx ) - FixedMul( v1->dx >> 8, v2->dy );
|
||||||
|
|
||||||
if (den == 0)
|
if( den == 0 )
|
||||||
return 0;
|
{
|
||||||
// I_Error ("P_InterceptVector: parallel");
|
return 0;
|
||||||
|
}
|
||||||
|
// I_Error ("P_InterceptVector: parallel");
|
||||||
|
|
||||||
num = FixedMul ( (v1->x - v2->x)>>8 ,v1->dy) +
|
num = FixedMul( ( v1->x - v2->x ) >> 8 , v1->dy ) +
|
||||||
FixedMul ( (v2->y - v1->y)>>8 , v1->dx);
|
FixedMul( ( v2->y - v1->y ) >> 8 , v1->dx );
|
||||||
frac = FixedDiv (num , den);
|
frac = FixedDiv( num , den );
|
||||||
|
|
||||||
return frac;
|
return frac;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -130,119 +144,145 @@ P_InterceptVector2
|
||||||
// Returns true
|
// Returns true
|
||||||
// if ::g->strace crosses the given subsector successfully.
|
// if ::g->strace crosses the given subsector successfully.
|
||||||
//
|
//
|
||||||
qboolean P_CrossSubsector (int num)
|
qboolean P_CrossSubsector( int num )
|
||||||
{
|
{
|
||||||
seg_t* seg;
|
seg_t* seg;
|
||||||
line_t* line;
|
line_t* line;
|
||||||
int s1;
|
int s1;
|
||||||
int s2;
|
int s2;
|
||||||
int count;
|
int count;
|
||||||
subsector_t* sub;
|
subsector_t* sub;
|
||||||
sector_t* front;
|
sector_t* front;
|
||||||
sector_t* back;
|
sector_t* back;
|
||||||
fixed_t psight_opentop;
|
fixed_t psight_opentop;
|
||||||
fixed_t psight_openbottom;
|
fixed_t psight_openbottom;
|
||||||
divline_t divl;
|
divline_t divl;
|
||||||
vertex_t* v1;
|
vertex_t* v1;
|
||||||
vertex_t* v2;
|
vertex_t* v2;
|
||||||
fixed_t frac;
|
fixed_t frac;
|
||||||
fixed_t slope;
|
fixed_t slope;
|
||||||
|
|
||||||
#ifdef RANGECHECK
|
#ifdef RANGECHECK
|
||||||
if (num>=::g->numsubsectors)
|
if( num >=::g->numsubsectors )
|
||||||
I_Error ("P_CrossSubsector: ss %i with numss = %i",
|
I_Error( "P_CrossSubsector: ss %i with numss = %i",
|
||||||
num,
|
num,
|
||||||
::g->numsubsectors);
|
::g->numsubsectors );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sub = &::g->subsectors[num];
|
sub = &::g->subsectors[num];
|
||||||
|
|
||||||
// check ::g->lines
|
// check ::g->lines
|
||||||
count = sub->numlines;
|
count = sub->numlines;
|
||||||
seg = &::g->segs[sub->firstline];
|
seg = &::g->segs[sub->firstline];
|
||||||
|
|
||||||
for ( ; count ; seg++, count--)
|
for( ; count ; seg++, count-- )
|
||||||
{
|
|
||||||
line = seg->linedef;
|
|
||||||
|
|
||||||
// allready checked other side?
|
|
||||||
if (line->validcount == ::g->validcount)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
line->validcount = ::g->validcount;
|
|
||||||
|
|
||||||
v1 = line->v1;
|
|
||||||
v2 = line->v2;
|
|
||||||
s1 = P_DivlineSide (v1->x,v1->y, &::g->strace);
|
|
||||||
s2 = P_DivlineSide (v2->x, v2->y, &::g->strace);
|
|
||||||
|
|
||||||
// line isn't crossed?
|
|
||||||
if (s1 == s2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
divl.x = v1->x;
|
|
||||||
divl.y = v1->y;
|
|
||||||
divl.dx = v2->x - v1->x;
|
|
||||||
divl.dy = v2->y - v1->y;
|
|
||||||
s1 = P_DivlineSide (::g->strace.x, ::g->strace.y, &divl);
|
|
||||||
s2 = P_DivlineSide (::g->t2x, ::g->t2y, &divl);
|
|
||||||
|
|
||||||
// line isn't crossed?
|
|
||||||
if (s1 == s2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// stop because it is not two sided anyway
|
|
||||||
// might do this after updating validcount?
|
|
||||||
if ( !(line->flags & ML_TWOSIDED) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// crosses a two sided line
|
|
||||||
front = seg->frontsector;
|
|
||||||
back = seg->backsector;
|
|
||||||
|
|
||||||
// no wall to block sight with?
|
|
||||||
if (front->floorheight == back->floorheight
|
|
||||||
&& front->ceilingheight == back->ceilingheight)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// possible occluder
|
|
||||||
// because of ceiling height differences
|
|
||||||
if (front->ceilingheight < back->ceilingheight)
|
|
||||||
psight_opentop = front->ceilingheight;
|
|
||||||
else
|
|
||||||
psight_opentop = back->ceilingheight;
|
|
||||||
|
|
||||||
// because of ceiling height differences
|
|
||||||
if (front->floorheight > back->floorheight)
|
|
||||||
psight_openbottom = front->floorheight;
|
|
||||||
else
|
|
||||||
psight_openbottom = back->floorheight;
|
|
||||||
|
|
||||||
// quick test for totally closed doors
|
|
||||||
if (psight_openbottom >= psight_opentop)
|
|
||||||
return false; // stop
|
|
||||||
|
|
||||||
frac = P_InterceptVector2 (&::g->strace, &divl);
|
|
||||||
|
|
||||||
if (front->floorheight != back->floorheight)
|
|
||||||
{
|
{
|
||||||
slope = FixedDiv (psight_openbottom - ::g->sightzstart , frac);
|
line = seg->linedef;
|
||||||
if (slope > ::g->bottomslope)
|
|
||||||
::g->bottomslope = slope;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (front->ceilingheight != back->ceilingheight)
|
// allready checked other side?
|
||||||
{
|
if( line->validcount == ::g->validcount )
|
||||||
slope = FixedDiv (psight_opentop - ::g->sightzstart , frac);
|
{
|
||||||
if (slope < ::g->topslope)
|
continue;
|
||||||
::g->topslope = slope;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (::g->topslope <= ::g->bottomslope)
|
line->validcount = ::g->validcount;
|
||||||
return false; // stop
|
|
||||||
}
|
v1 = line->v1;
|
||||||
// passed the subsector ok
|
v2 = line->v2;
|
||||||
return true;
|
s1 = P_DivlineSide( v1->x, v1->y, &::g->strace );
|
||||||
|
s2 = P_DivlineSide( v2->x, v2->y, &::g->strace );
|
||||||
|
|
||||||
|
// line isn't crossed?
|
||||||
|
if( s1 == s2 )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
divl.x = v1->x;
|
||||||
|
divl.y = v1->y;
|
||||||
|
divl.dx = v2->x - v1->x;
|
||||||
|
divl.dy = v2->y - v1->y;
|
||||||
|
s1 = P_DivlineSide( ::g->strace.x, ::g->strace.y, &divl );
|
||||||
|
s2 = P_DivlineSide( ::g->t2x, ::g->t2y, &divl );
|
||||||
|
|
||||||
|
// line isn't crossed?
|
||||||
|
if( s1 == s2 )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// stop because it is not two sided anyway
|
||||||
|
// might do this after updating validcount?
|
||||||
|
if( !( line->flags & ML_TWOSIDED ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// crosses a two sided line
|
||||||
|
front = seg->frontsector;
|
||||||
|
back = seg->backsector;
|
||||||
|
|
||||||
|
// no wall to block sight with?
|
||||||
|
if( front->floorheight == back->floorheight
|
||||||
|
&& front->ceilingheight == back->ceilingheight )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// possible occluder
|
||||||
|
// because of ceiling height differences
|
||||||
|
if( front->ceilingheight < back->ceilingheight )
|
||||||
|
{
|
||||||
|
psight_opentop = front->ceilingheight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
psight_opentop = back->ceilingheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// because of ceiling height differences
|
||||||
|
if( front->floorheight > back->floorheight )
|
||||||
|
{
|
||||||
|
psight_openbottom = front->floorheight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
psight_openbottom = back->floorheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// quick test for totally closed doors
|
||||||
|
if( psight_openbottom >= psight_opentop )
|
||||||
|
{
|
||||||
|
return false; // stop
|
||||||
|
}
|
||||||
|
|
||||||
|
frac = P_InterceptVector2( &::g->strace, &divl );
|
||||||
|
|
||||||
|
if( front->floorheight != back->floorheight )
|
||||||
|
{
|
||||||
|
slope = FixedDiv( psight_openbottom - ::g->sightzstart , frac );
|
||||||
|
if( slope > ::g->bottomslope )
|
||||||
|
{
|
||||||
|
::g->bottomslope = slope;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( front->ceilingheight != back->ceilingheight )
|
||||||
|
{
|
||||||
|
slope = FixedDiv( psight_opentop - ::g->sightzstart , frac );
|
||||||
|
if( slope < ::g->topslope )
|
||||||
|
{
|
||||||
|
::g->topslope = slope;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ::g->topslope <= ::g->bottomslope )
|
||||||
|
{
|
||||||
|
return false; // stop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// passed the subsector ok
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,39 +292,47 @@ qboolean P_CrossSubsector (int num)
|
||||||
// Returns true
|
// Returns true
|
||||||
// if ::g->strace crosses the given node successfully.
|
// if ::g->strace crosses the given node successfully.
|
||||||
//
|
//
|
||||||
qboolean P_CrossBSPNode (int bspnum)
|
qboolean P_CrossBSPNode( int bspnum )
|
||||||
{
|
{
|
||||||
node_t* bsp;
|
node_t* bsp;
|
||||||
int side;
|
int side;
|
||||||
|
|
||||||
if (bspnum & NF_SUBSECTOR)
|
if( bspnum & NF_SUBSECTOR )
|
||||||
{
|
{
|
||||||
if (bspnum == -1)
|
if( bspnum == -1 )
|
||||||
return P_CrossSubsector (0);
|
{
|
||||||
else
|
return P_CrossSubsector( 0 );
|
||||||
return P_CrossSubsector (bspnum&(~NF_SUBSECTOR));
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
return P_CrossSubsector( bspnum & ( ~NF_SUBSECTOR ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bsp = &::g->nodes[bspnum];
|
bsp = &::g->nodes[bspnum];
|
||||||
|
|
||||||
// decide which side the start point is on
|
// decide which side the start point is on
|
||||||
side = P_DivlineSide (::g->strace.x, ::g->strace.y, (divline_t *)bsp);
|
side = P_DivlineSide( ::g->strace.x, ::g->strace.y, ( divline_t* )bsp );
|
||||||
if (side == 2)
|
if( side == 2 )
|
||||||
side = 0; // an "on" should cross both ::g->sides
|
{
|
||||||
|
side = 0; // an "on" should cross both ::g->sides
|
||||||
|
}
|
||||||
|
|
||||||
// cross the starting side
|
// cross the starting side
|
||||||
if (!P_CrossBSPNode (bsp->children[side]) )
|
if( !P_CrossBSPNode( bsp->children[side] ) )
|
||||||
return false;
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// the partition plane is crossed here
|
// the partition plane is crossed here
|
||||||
if (side == P_DivlineSide (::g->t2x, ::g->t2y,(divline_t *)bsp))
|
if( side == P_DivlineSide( ::g->t2x, ::g->t2y, ( divline_t* )bsp ) )
|
||||||
{
|
{
|
||||||
// the line doesn't touch the other side
|
// the line doesn't touch the other side
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cross the ending side
|
// cross the ending side
|
||||||
return P_CrossBSPNode (bsp->children[side^1]);
|
return P_CrossBSPNode( bsp->children[side ^ 1] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -299,49 +347,49 @@ P_CheckSight
|
||||||
( mobj_t* t1,
|
( mobj_t* t1,
|
||||||
mobj_t* t2 )
|
mobj_t* t2 )
|
||||||
{
|
{
|
||||||
int s1;
|
int s1;
|
||||||
int s2;
|
int s2;
|
||||||
int pnum;
|
int pnum;
|
||||||
int bytenum;
|
int bytenum;
|
||||||
int bitnum;
|
int bitnum;
|
||||||
|
|
||||||
// First check for trivial rejection.
|
// First check for trivial rejection.
|
||||||
|
|
||||||
// Determine subsector entries in REJECT table.
|
// Determine subsector entries in REJECT table.
|
||||||
s1 = (t1->subsector->sector - ::g->sectors);
|
s1 = ( t1->subsector->sector - ::g->sectors );
|
||||||
s2 = (t2->subsector->sector - ::g->sectors);
|
s2 = ( t2->subsector->sector - ::g->sectors );
|
||||||
pnum = s1*::g->numsectors + s2;
|
pnum = s1*::g->numsectors + s2;
|
||||||
bytenum = pnum>>3;
|
bytenum = pnum >> 3;
|
||||||
bitnum = 1 << (pnum&7);
|
bitnum = 1 << ( pnum & 7 );
|
||||||
|
|
||||||
// Check in REJECT table.
|
// Check in REJECT table.
|
||||||
if (::g->rejectmatrix[bytenum]&bitnum)
|
if( ::g->rejectmatrix[bytenum]&bitnum )
|
||||||
{
|
{
|
||||||
::g->sightcounts[0]++;
|
::g->sightcounts[0]++;
|
||||||
|
|
||||||
// can't possibly be connected
|
// can't possibly be connected
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// An unobstructed LOS is possible.
|
// An unobstructed LOS is possible.
|
||||||
// Now look from eyes of t1 to any part of t2.
|
// Now look from eyes of t1 to any part of t2.
|
||||||
::g->sightcounts[1]++;
|
::g->sightcounts[1]++;
|
||||||
|
|
||||||
::g->validcount++;
|
::g->validcount++;
|
||||||
|
|
||||||
::g->sightzstart = t1->z + t1->height - (t1->height>>2);
|
::g->sightzstart = t1->z + t1->height - ( t1->height >> 2 );
|
||||||
::g->topslope = (t2->z+t2->height) - ::g->sightzstart;
|
::g->topslope = ( t2->z + t2->height ) - ::g->sightzstart;
|
||||||
::g->bottomslope = (t2->z) - ::g->sightzstart;
|
::g->bottomslope = ( t2->z ) - ::g->sightzstart;
|
||||||
|
|
||||||
::g->strace.x = t1->x;
|
::g->strace.x = t1->x;
|
||||||
::g->strace.y = t1->y;
|
::g->strace.y = t1->y;
|
||||||
::g->t2x = t2->x;
|
::g->t2x = t2->x;
|
||||||
::g->t2y = t2->y;
|
::g->t2y = t2->y;
|
||||||
::g->strace.dx = t2->x - t1->x;
|
::g->strace.dx = t2->x - t1->x;
|
||||||
::g->strace.dy = t2->y - t1->y;
|
::g->strace.dy = t2->y - t1->y;
|
||||||
|
|
||||||
// the head node is the last node output
|
// the head node is the last node output
|
||||||
return P_CrossBSPNode (::g->numnodes-1);
|
return P_CrossBSPNode( ::g->numnodes - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -42,13 +42,13 @@ extern int levelTimeCount;
|
||||||
|
|
||||||
|
|
||||||
// at game start
|
// at game start
|
||||||
void P_InitPicAnims (void);
|
void P_InitPicAnims( void );
|
||||||
|
|
||||||
// at map load
|
// at map load
|
||||||
void P_SpawnSpecials (void);
|
void P_SpawnSpecials( void );
|
||||||
|
|
||||||
// every tic
|
// every tic
|
||||||
void P_UpdateSpecials (void);
|
void P_UpdateSpecials( void );
|
||||||
|
|
||||||
// when needed
|
// when needed
|
||||||
qboolean
|
qboolean
|
||||||
|
@ -68,7 +68,7 @@ P_CrossSpecialLine
|
||||||
int side,
|
int side,
|
||||||
mobj_t* thing );
|
mobj_t* thing );
|
||||||
|
|
||||||
void P_PlayerInSpecialSector (player_t* player);
|
void P_PlayerInSpecialSector( player_t* player );
|
||||||
|
|
||||||
int
|
int
|
||||||
twoSided
|
twoSided
|
||||||
|
@ -87,16 +87,16 @@ getSide
|
||||||
int line,
|
int line,
|
||||||
int side );
|
int side );
|
||||||
|
|
||||||
fixed_t P_FindLowestFloorSurrounding(sector_t* sec);
|
fixed_t P_FindLowestFloorSurrounding( sector_t* sec );
|
||||||
fixed_t P_FindHighestFloorSurrounding(sector_t* sec);
|
fixed_t P_FindHighestFloorSurrounding( sector_t* sec );
|
||||||
|
|
||||||
fixed_t
|
fixed_t
|
||||||
P_FindNextHighestFloor
|
P_FindNextHighestFloor
|
||||||
( sector_t* sec,
|
( sector_t* sec,
|
||||||
int currentheight );
|
int currentheight );
|
||||||
|
|
||||||
fixed_t P_FindLowestCeilingSurrounding(sector_t* sec);
|
fixed_t P_FindLowestCeilingSurrounding( sector_t* sec );
|
||||||
fixed_t P_FindHighestCeilingSurrounding(sector_t* sec);
|
fixed_t P_FindHighestCeilingSurrounding( sector_t* sec );
|
||||||
|
|
||||||
int
|
int
|
||||||
P_FindSectorFromLineTag
|
P_FindSectorFromLineTag
|
||||||
|
@ -117,7 +117,7 @@ getNextSector
|
||||||
//
|
//
|
||||||
// SPECIAL
|
// SPECIAL
|
||||||
//
|
//
|
||||||
int EV_DoDonut(line_t* line);
|
int EV_DoDonut( line_t* line );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,11 +126,11 @@ int EV_DoDonut(line_t* line);
|
||||||
//
|
//
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
thinker_t thinker;
|
thinker_t thinker;
|
||||||
sector_t* sector;
|
sector_t* sector;
|
||||||
int count;
|
int count;
|
||||||
int maxlight;
|
int maxlight;
|
||||||
int minlight;
|
int minlight;
|
||||||
|
|
||||||
} fireflicker_t;
|
} fireflicker_t;
|
||||||
|
|
||||||
|
@ -138,13 +138,13 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
thinker_t thinker;
|
thinker_t thinker;
|
||||||
sector_t* sector;
|
sector_t* sector;
|
||||||
int count;
|
int count;
|
||||||
int maxlight;
|
int maxlight;
|
||||||
int minlight;
|
int minlight;
|
||||||
int maxtime;
|
int maxtime;
|
||||||
int mintime;
|
int mintime;
|
||||||
|
|
||||||
} lightflash_t;
|
} lightflash_t;
|
||||||
|
|
||||||
|
@ -152,13 +152,13 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
thinker_t thinker;
|
thinker_t thinker;
|
||||||
sector_t* sector;
|
sector_t* sector;
|
||||||
int count;
|
int count;
|
||||||
int minlight;
|
int minlight;
|
||||||
int maxlight;
|
int maxlight;
|
||||||
int darktime;
|
int darktime;
|
||||||
int brighttime;
|
int brighttime;
|
||||||
|
|
||||||
} strobe_t;
|
} strobe_t;
|
||||||
|
|
||||||
|
@ -167,11 +167,11 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
thinker_t thinker;
|
thinker_t thinker;
|
||||||
sector_t* sector;
|
sector_t* sector;
|
||||||
int minlight;
|
int minlight;
|
||||||
int maxlight;
|
int maxlight;
|
||||||
int direction;
|
int direction;
|
||||||
|
|
||||||
} glow_t;
|
} glow_t;
|
||||||
|
|
||||||
|
@ -181,11 +181,11 @@ typedef struct
|
||||||
#define FASTDARK 15
|
#define FASTDARK 15
|
||||||
#define SLOWDARK 35
|
#define SLOWDARK 35
|
||||||
|
|
||||||
void T_FireFlicker (fireflicker_t* flick);
|
void T_FireFlicker( fireflicker_t* flick );
|
||||||
void P_SpawnFireFlicker (sector_t* sector);
|
void P_SpawnFireFlicker( sector_t* sector );
|
||||||
void T_LightFlash (lightflash_t* flash);
|
void T_LightFlash( lightflash_t* flash );
|
||||||
void P_SpawnLightFlash (sector_t* sector);
|
void P_SpawnLightFlash( sector_t* sector );
|
||||||
void T_StrobeFlash (strobe_t* flash);
|
void T_StrobeFlash( strobe_t* flash );
|
||||||
|
|
||||||
void
|
void
|
||||||
P_SpawnStrobeFlash
|
P_SpawnStrobeFlash
|
||||||
|
@ -193,16 +193,16 @@ P_SpawnStrobeFlash
|
||||||
int fastOrSlow,
|
int fastOrSlow,
|
||||||
int inSync );
|
int inSync );
|
||||||
|
|
||||||
void EV_StartLightStrobing(line_t* line);
|
void EV_StartLightStrobing( line_t* line );
|
||||||
void EV_TurnTagLightsOff(line_t* line);
|
void EV_TurnTagLightsOff( line_t* line );
|
||||||
|
|
||||||
void
|
void
|
||||||
EV_LightTurnOn
|
EV_LightTurnOn
|
||||||
( line_t* line,
|
( line_t* line,
|
||||||
int bright );
|
int bright );
|
||||||
|
|
||||||
void T_Glow(glow_t* g);
|
void T_Glow( glow_t* g );
|
||||||
void P_SpawnGlowingLight(sector_t* sector);
|
void P_SpawnGlowingLight( sector_t* sector );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,44 +212,45 @@ void P_SpawnGlowingLight(sector_t* sector);
|
||||||
//
|
//
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char name1[9];
|
char name1[9];
|
||||||
char name2[9];
|
char name2[9];
|
||||||
short episode;
|
short episode;
|
||||||
|
|
||||||
} switchlist_t;
|
} switchlist_t;
|
||||||
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
top,
|
top,
|
||||||
middle,
|
middle,
|
||||||
bottom
|
bottom
|
||||||
|
|
||||||
} bwhere_e;
|
} bwhere_e;
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
line_t* line;
|
line_t* line;
|
||||||
bwhere_e where;
|
bwhere_e where;
|
||||||
int btexture;
|
int btexture;
|
||||||
int btimer;
|
int btimer;
|
||||||
union {
|
union
|
||||||
mobj_t * soundorg;
|
{
|
||||||
degenmobj_t * degensoundorg;
|
mobj_t* soundorg;
|
||||||
|
degenmobj_t* degensoundorg;
|
||||||
};
|
};
|
||||||
} button_t;
|
} button_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// max # of wall switches in a level
|
// max # of wall switches in a level
|
||||||
#define MAXSWITCHES 50
|
#define MAXSWITCHES 50
|
||||||
|
|
||||||
// 4 players, 4 buttons each at once, max.
|
// 4 players, 4 buttons each at once, max.
|
||||||
#define MAXBUTTONS 16
|
#define MAXBUTTONS 16
|
||||||
|
|
||||||
// 1 second, in ticks.
|
// 1 second, in ticks.
|
||||||
#define BUTTONTIME TICRATE
|
#define BUTTONTIME TICRATE
|
||||||
|
|
||||||
extern button_t buttonlist[MAXBUTTONS];
|
extern button_t buttonlist[MAXBUTTONS];
|
||||||
|
@ -259,7 +260,7 @@ P_ChangeSwitchTexture
|
||||||
( line_t* line,
|
( line_t* line,
|
||||||
int useAgain );
|
int useAgain );
|
||||||
|
|
||||||
void P_InitSwitchList(void);
|
void P_InitSwitchList( void );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -267,10 +268,10 @@ void P_InitSwitchList(void);
|
||||||
//
|
//
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
up,
|
up,
|
||||||
down,
|
down,
|
||||||
waiting,
|
waiting,
|
||||||
in_stasis
|
in_stasis
|
||||||
|
|
||||||
} plat_e;
|
} plat_e;
|
||||||
|
|
||||||
|
@ -278,11 +279,11 @@ typedef enum
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
perpetualRaise,
|
perpetualRaise,
|
||||||
downWaitUpStay,
|
downWaitUpStay,
|
||||||
raiseAndChange,
|
raiseAndChange,
|
||||||
raiseToNearestAndChange,
|
raiseToNearestAndChange,
|
||||||
blazeDWUS
|
blazeDWUS
|
||||||
|
|
||||||
} plattype_e;
|
} plattype_e;
|
||||||
|
|
||||||
|
@ -290,18 +291,18 @@ typedef enum
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
thinker_t thinker;
|
thinker_t thinker;
|
||||||
sector_t* sector;
|
sector_t* sector;
|
||||||
fixed_t speed;
|
fixed_t speed;
|
||||||
fixed_t low;
|
fixed_t low;
|
||||||
fixed_t high;
|
fixed_t high;
|
||||||
int wait;
|
int wait;
|
||||||
int count;
|
int count;
|
||||||
plat_e status;
|
plat_e status;
|
||||||
plat_e oldstatus;
|
plat_e oldstatus;
|
||||||
qboolean crush;
|
qboolean crush;
|
||||||
int tag;
|
int tag;
|
||||||
plattype_e type;
|
plattype_e type;
|
||||||
|
|
||||||
} plat_t;
|
} plat_t;
|
||||||
|
|
||||||
|
@ -314,7 +315,7 @@ typedef struct
|
||||||
|
|
||||||
extern plat_t* activeplats[MAXPLATS];
|
extern plat_t* activeplats[MAXPLATS];
|
||||||
|
|
||||||
void T_PlatRaise(plat_t* plat);
|
void T_PlatRaise( plat_t* plat );
|
||||||
|
|
||||||
int
|
int
|
||||||
EV_DoPlat
|
EV_DoPlat
|
||||||
|
@ -322,10 +323,10 @@ EV_DoPlat
|
||||||
plattype_e type,
|
plattype_e type,
|
||||||
int amount );
|
int amount );
|
||||||
|
|
||||||
void P_AddActivePlat(plat_t* plat);
|
void P_AddActivePlat( plat_t* plat );
|
||||||
void P_RemoveActivePlat(plat_t* plat);
|
void P_RemoveActivePlat( plat_t* plat );
|
||||||
void EV_StopPlat(line_t* line);
|
void EV_StopPlat( line_t* line );
|
||||||
void P_ActivateInStasis(int tag);
|
void P_ActivateInStasis( int tag );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -333,14 +334,14 @@ void P_ActivateInStasis(int tag);
|
||||||
//
|
//
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
normal,
|
normal,
|
||||||
close30ThenOpen,
|
close30ThenOpen,
|
||||||
closed,
|
closed,
|
||||||
opened,
|
opened,
|
||||||
raiseIn5Mins,
|
raiseIn5Mins,
|
||||||
blazeRaise,
|
blazeRaise,
|
||||||
blazeOpen,
|
blazeOpen,
|
||||||
blazeClose
|
blazeClose
|
||||||
|
|
||||||
} vldoor_e;
|
} vldoor_e;
|
||||||
|
|
||||||
|
@ -348,20 +349,20 @@ typedef enum
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
thinker_t thinker;
|
thinker_t thinker;
|
||||||
vldoor_e type;
|
vldoor_e type;
|
||||||
sector_t* sector;
|
sector_t* sector;
|
||||||
fixed_t topheight;
|
fixed_t topheight;
|
||||||
fixed_t speed;
|
fixed_t speed;
|
||||||
|
|
||||||
// 1 = up, 0 = waiting at top, -1 = down
|
// 1 = up, 0 = waiting at top, -1 = down
|
||||||
int direction;
|
int direction;
|
||||||
|
|
||||||
// tics to wait at the top
|
// tics to wait at the top
|
||||||
int topwait;
|
int topwait;
|
||||||
// (keep in case a door going down is reset)
|
// (keep in case a door going down is reset)
|
||||||
// when it reaches 0, start going down
|
// when it reaches 0, start going down
|
||||||
int topcountdown;
|
int topcountdown;
|
||||||
|
|
||||||
} vldoor_t;
|
} vldoor_t;
|
||||||
|
|
||||||
|
@ -386,8 +387,8 @@ EV_DoLockedDoor
|
||||||
vldoor_e type,
|
vldoor_e type,
|
||||||
mobj_t* thing );
|
mobj_t* thing );
|
||||||
|
|
||||||
void T_VerticalDoor (vldoor_t* door);
|
void T_VerticalDoor( vldoor_t* door );
|
||||||
void P_SpawnDoorCloseIn30 (sector_t* sec);
|
void P_SpawnDoorCloseIn30( sector_t* sec );
|
||||||
|
|
||||||
void
|
void
|
||||||
P_SpawnDoorRaiseIn5Mins
|
P_SpawnDoorRaiseIn5Mins
|
||||||
|
@ -402,9 +403,9 @@ P_SpawnDoorRaiseIn5Mins
|
||||||
//
|
//
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
sd_opening,
|
sd_opening,
|
||||||
sd_waiting,
|
sd_waiting,
|
||||||
sd_closing
|
sd_closing
|
||||||
|
|
||||||
} sd_e;
|
} sd_e;
|
||||||
|
|
||||||
|
@ -412,9 +413,9 @@ typedef enum
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
sdt_openOnly,
|
sdt_openOnly,
|
||||||
sdt_closeOnly,
|
sdt_closeOnly,
|
||||||
sdt_openAndClose
|
sdt_openAndClose
|
||||||
|
|
||||||
} sdt_e;
|
} sdt_e;
|
||||||
|
|
||||||
|
@ -423,15 +424,15 @@ typedef enum
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
thinker_t thinker;
|
thinker_t thinker;
|
||||||
sdt_e type;
|
sdt_e type;
|
||||||
line_t* line;
|
line_t* line;
|
||||||
int frame;
|
int frame;
|
||||||
int whichDoorIndex;
|
int whichDoorIndex;
|
||||||
int timer;
|
int timer;
|
||||||
sector_t* frontsector;
|
sector_t* frontsector;
|
||||||
sector_t* backsector;
|
sector_t* backsector;
|
||||||
sd_e status;
|
sd_e status;
|
||||||
|
|
||||||
} slidedoor_t;
|
} slidedoor_t;
|
||||||
|
|
||||||
|
@ -439,14 +440,14 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char frontFrame1[9];
|
char frontFrame1[9];
|
||||||
char frontFrame2[9];
|
char frontFrame2[9];
|
||||||
char frontFrame3[9];
|
char frontFrame3[9];
|
||||||
char frontFrame4[9];
|
char frontFrame4[9];
|
||||||
char backFrame1[9];
|
char backFrame1[9];
|
||||||
char backFrame2[9];
|
char backFrame2[9];
|
||||||
char backFrame3[9];
|
char backFrame3[9];
|
||||||
char backFrame4[9];
|
char backFrame4[9];
|
||||||
|
|
||||||
} slidename_t;
|
} slidename_t;
|
||||||
|
|
||||||
|
@ -454,8 +455,8 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int frontFrames[4];
|
int frontFrames[4];
|
||||||
int backFrames[4];
|
int backFrames[4];
|
||||||
|
|
||||||
} slideframe_t;
|
} slideframe_t;
|
||||||
|
|
||||||
|
@ -470,7 +471,7 @@ typedef struct
|
||||||
// how many diff. types of anims
|
// how many diff. types of anims
|
||||||
#define MAXSLIDEDOORS 5
|
#define MAXSLIDEDOORS 5
|
||||||
|
|
||||||
void P_InitSlidingDoorFrames(void);
|
void P_InitSlidingDoorFrames( void );
|
||||||
|
|
||||||
void
|
void
|
||||||
EV_SlidingDoor
|
EV_SlidingDoor
|
||||||
|
@ -485,12 +486,12 @@ EV_SlidingDoor
|
||||||
//
|
//
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
lowerToFloor,
|
lowerToFloor,
|
||||||
raiseToHighest,
|
raiseToHighest,
|
||||||
lowerAndCrush,
|
lowerAndCrush,
|
||||||
crushAndRaise,
|
crushAndRaise,
|
||||||
fastCrushAndRaise,
|
fastCrushAndRaise,
|
||||||
silentCrushAndRaise
|
silentCrushAndRaise
|
||||||
|
|
||||||
} ceiling_e;
|
} ceiling_e;
|
||||||
|
|
||||||
|
@ -498,20 +499,20 @@ typedef enum
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
thinker_t thinker;
|
thinker_t thinker;
|
||||||
ceiling_e type;
|
ceiling_e type;
|
||||||
sector_t* sector;
|
sector_t* sector;
|
||||||
fixed_t bottomheight;
|
fixed_t bottomheight;
|
||||||
fixed_t topheight;
|
fixed_t topheight;
|
||||||
fixed_t speed;
|
fixed_t speed;
|
||||||
qboolean crush;
|
qboolean crush;
|
||||||
|
|
||||||
// 1 = up, 0 = waiting, -1 = down
|
// 1 = up, 0 = waiting, -1 = down
|
||||||
int direction;
|
int direction;
|
||||||
|
|
||||||
// ID
|
// ID
|
||||||
int tag;
|
int tag;
|
||||||
int olddirection;
|
int olddirection;
|
||||||
|
|
||||||
} ceiling_t;
|
} ceiling_t;
|
||||||
|
|
||||||
|
@ -530,11 +531,11 @@ EV_DoCeiling
|
||||||
( line_t* line,
|
( line_t* line,
|
||||||
ceiling_e type );
|
ceiling_e type );
|
||||||
|
|
||||||
void T_MoveCeiling (ceiling_t* ceiling);
|
void T_MoveCeiling( ceiling_t* ceiling );
|
||||||
void P_AddActiveCeiling(ceiling_t* c);
|
void P_AddActiveCeiling( ceiling_t* c );
|
||||||
void P_RemoveActiveCeiling(ceiling_t* c);
|
void P_RemoveActiveCeiling( ceiling_t* c );
|
||||||
int EV_CeilingCrushStop(line_t* line);
|
int EV_CeilingCrushStop( line_t* line );
|
||||||
void P_ActivateInStasisCeiling(line_t* line);
|
void P_ActivateInStasisCeiling( line_t* line );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -542,36 +543,36 @@ void P_ActivateInStasisCeiling(line_t* line);
|
||||||
//
|
//
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
// lower floor to highest surrounding floor
|
// lower floor to highest surrounding floor
|
||||||
lowerFloor,
|
lowerFloor,
|
||||||
|
|
||||||
// lower floor to lowest surrounding floor
|
// lower floor to lowest surrounding floor
|
||||||
lowerFloorToLowest,
|
lowerFloorToLowest,
|
||||||
|
|
||||||
// lower floor to highest surrounding floor VERY FAST
|
// lower floor to highest surrounding floor VERY FAST
|
||||||
turboLower,
|
turboLower,
|
||||||
|
|
||||||
// raise floor to lowest surrounding CEILING
|
// raise floor to lowest surrounding CEILING
|
||||||
raiseFloor,
|
raiseFloor,
|
||||||
|
|
||||||
// raise floor to next highest surrounding floor
|
// raise floor to next highest surrounding floor
|
||||||
raiseFloorToNearest,
|
raiseFloorToNearest,
|
||||||
|
|
||||||
// raise floor to shortest height texture around it
|
// raise floor to shortest height texture around it
|
||||||
raiseToTexture,
|
raiseToTexture,
|
||||||
|
|
||||||
// lower floor to lowest surrounding floor
|
// lower floor to lowest surrounding floor
|
||||||
// and change floorpic
|
// and change floorpic
|
||||||
lowerAndChange,
|
lowerAndChange,
|
||||||
|
|
||||||
raiseFloor24,
|
raiseFloor24,
|
||||||
raiseFloor24AndChange,
|
raiseFloor24AndChange,
|
||||||
raiseFloorCrush,
|
raiseFloorCrush,
|
||||||
|
|
||||||
// raise to next highest floor, turbo-speed
|
// raise to next highest floor, turbo-speed
|
||||||
raiseFloorTurbo,
|
raiseFloorTurbo,
|
||||||
donutRaise,
|
donutRaise,
|
||||||
raiseFloor512
|
raiseFloor512
|
||||||
|
|
||||||
} floor_e;
|
} floor_e;
|
||||||
|
|
||||||
|
@ -580,8 +581,8 @@ typedef enum
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
build8, // slowly build by 8
|
build8, // slowly build by 8
|
||||||
turbo16 // quickly build by 16
|
turbo16 // quickly build by 16
|
||||||
|
|
||||||
} stair_e;
|
} stair_e;
|
||||||
|
|
||||||
|
@ -589,15 +590,15 @@ typedef enum
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
thinker_t thinker;
|
thinker_t thinker;
|
||||||
floor_e type;
|
floor_e type;
|
||||||
qboolean crush;
|
qboolean crush;
|
||||||
sector_t* sector;
|
sector_t* sector;
|
||||||
int direction;
|
int direction;
|
||||||
int newspecial;
|
int newspecial;
|
||||||
short texture;
|
short texture;
|
||||||
fixed_t floordestheight;
|
fixed_t floordestheight;
|
||||||
fixed_t speed;
|
fixed_t speed;
|
||||||
|
|
||||||
} floormove_t;
|
} floormove_t;
|
||||||
|
|
||||||
|
@ -607,9 +608,9 @@ typedef struct
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
ok,
|
ok,
|
||||||
crushed,
|
crushed,
|
||||||
pastdest
|
pastdest
|
||||||
|
|
||||||
} result_e;
|
} result_e;
|
||||||
|
|
||||||
|
@ -632,7 +633,7 @@ EV_DoFloor
|
||||||
( line_t* line,
|
( line_t* line,
|
||||||
floor_e floortype );
|
floor_e floortype );
|
||||||
|
|
||||||
void T_MoveFloor( floormove_t* floor);
|
void T_MoveFloor( floormove_t* floor );
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_TELEPT
|
// P_TELEPT
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -55,84 +55,100 @@ EV_Teleport
|
||||||
int side,
|
int side,
|
||||||
mobj_t* thing )
|
mobj_t* thing )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int tag;
|
int tag;
|
||||||
mobj_t* m;
|
mobj_t* m;
|
||||||
mobj_t* fog;
|
mobj_t* fog;
|
||||||
unsigned an;
|
unsigned an;
|
||||||
thinker_t* thinker;
|
thinker_t* thinker;
|
||||||
sector_t* sector;
|
sector_t* sector;
|
||||||
fixed_t oldx;
|
fixed_t oldx;
|
||||||
fixed_t oldy;
|
fixed_t oldy;
|
||||||
fixed_t oldz;
|
fixed_t oldz;
|
||||||
|
|
||||||
// don't teleport missiles
|
// don't teleport missiles
|
||||||
if (thing->flags & MF_MISSILE)
|
if( thing->flags & MF_MISSILE )
|
||||||
return 0;
|
|
||||||
|
|
||||||
// Don't teleport if hit back of line,
|
|
||||||
// so you can get out of teleporter.
|
|
||||||
if (side == 1)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
|
||||||
tag = line->tag;
|
|
||||||
for (i = 0; i < ::g->numsectors; i++)
|
|
||||||
{
|
|
||||||
if (::g->sectors[ i ].tag == tag )
|
|
||||||
{
|
{
|
||||||
thinker = ::g->thinkercap.next;
|
return 0;
|
||||||
for (thinker = ::g->thinkercap.next;
|
|
||||||
thinker != &::g->thinkercap;
|
|
||||||
thinker = thinker->next)
|
|
||||||
{
|
|
||||||
// not a mobj
|
|
||||||
if (thinker->function.acp1 != (actionf_p1)P_MobjThinker)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
m = (mobj_t *)thinker;
|
|
||||||
|
|
||||||
// not a teleportman
|
|
||||||
if (m->type != MT_TELEPORTMAN )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
sector = m->subsector->sector;
|
|
||||||
// wrong sector
|
|
||||||
if (sector-::g->sectors != i )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
oldx = thing->x;
|
|
||||||
oldy = thing->y;
|
|
||||||
oldz = thing->z;
|
|
||||||
|
|
||||||
if (!P_TeleportMove (thing, m->x, m->y))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
thing->z = thing->floorz; //fixme: not needed?
|
|
||||||
if (thing->player)
|
|
||||||
thing->player->viewz = thing->z+thing->player->viewheight;
|
|
||||||
|
|
||||||
// spawn teleport fog at source and destination
|
|
||||||
fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG);
|
|
||||||
S_StartSound (fog, sfx_telept);
|
|
||||||
an = m->angle >> ANGLETOFINESHIFT;
|
|
||||||
fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an]
|
|
||||||
, thing->z, MT_TFOG);
|
|
||||||
|
|
||||||
// emit sound, where?
|
|
||||||
S_StartSound (fog, sfx_telept);
|
|
||||||
|
|
||||||
// don't move for a bit
|
|
||||||
if (thing->player)
|
|
||||||
thing->reactiontime = 18;
|
|
||||||
|
|
||||||
thing->angle = m->angle;
|
|
||||||
thing->momx = thing->momy = thing->momz = 0;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return 0;
|
// Don't teleport if hit back of line,
|
||||||
|
// so you can get out of teleporter.
|
||||||
|
if( side == 1 )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tag = line->tag;
|
||||||
|
for( i = 0; i < ::g->numsectors; i++ )
|
||||||
|
{
|
||||||
|
if( ::g->sectors[ i ].tag == tag )
|
||||||
|
{
|
||||||
|
thinker = ::g->thinkercap.next;
|
||||||
|
for( thinker = ::g->thinkercap.next;
|
||||||
|
thinker != &::g->thinkercap;
|
||||||
|
thinker = thinker->next )
|
||||||
|
{
|
||||||
|
// not a mobj
|
||||||
|
if( thinker->function.acp1 != ( actionf_p1 )P_MobjThinker )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
m = ( mobj_t* )thinker;
|
||||||
|
|
||||||
|
// not a teleportman
|
||||||
|
if( m->type != MT_TELEPORTMAN )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
sector = m->subsector->sector;
|
||||||
|
// wrong sector
|
||||||
|
if( sector -::g->sectors != i )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
oldx = thing->x;
|
||||||
|
oldy = thing->y;
|
||||||
|
oldz = thing->z;
|
||||||
|
|
||||||
|
if( !P_TeleportMove( thing, m->x, m->y ) )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
thing->z = thing->floorz; //fixme: not needed?
|
||||||
|
if( thing->player )
|
||||||
|
{
|
||||||
|
thing->player->viewz = thing->z + thing->player->viewheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// spawn teleport fog at source and destination
|
||||||
|
fog = P_SpawnMobj( oldx, oldy, oldz, MT_TFOG );
|
||||||
|
S_StartSound( fog, sfx_telept );
|
||||||
|
an = m->angle >> ANGLETOFINESHIFT;
|
||||||
|
fog = P_SpawnMobj( m->x + 20 * finecosine[an], m->y + 20 * finesine[an]
|
||||||
|
, thing->z, MT_TFOG );
|
||||||
|
|
||||||
|
// emit sound, where?
|
||||||
|
S_StartSound( fog, sfx_telept );
|
||||||
|
|
||||||
|
// don't move for a bit
|
||||||
|
if( thing->player )
|
||||||
|
{
|
||||||
|
thing->reactiontime = 18;
|
||||||
|
}
|
||||||
|
|
||||||
|
thing->angle = m->angle;
|
||||||
|
thing->momx = thing->momy = thing->momz = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,9 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
//
|
//
|
||||||
// P_InitThinkers
|
// P_InitThinkers
|
||||||
//
|
//
|
||||||
void P_InitThinkers (void)
|
void P_InitThinkers( void )
|
||||||
{
|
{
|
||||||
::g->thinkercap.prev = ::g->thinkercap.next = &::g->thinkercap;
|
::g->thinkercap.prev = ::g->thinkercap.next = &::g->thinkercap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,12 +64,12 @@ void P_InitThinkers (void)
|
||||||
// P_AddThinker
|
// P_AddThinker
|
||||||
// Adds a new thinker at the end of the list.
|
// Adds a new thinker at the end of the list.
|
||||||
//
|
//
|
||||||
void P_AddThinker (thinker_t* thinker)
|
void P_AddThinker( thinker_t* thinker )
|
||||||
{
|
{
|
||||||
::g->thinkercap.prev->next = thinker;
|
::g->thinkercap.prev->next = thinker;
|
||||||
thinker->next = &::g->thinkercap;
|
thinker->next = &::g->thinkercap;
|
||||||
thinker->prev = ::g->thinkercap.prev;
|
thinker->prev = ::g->thinkercap.prev;
|
||||||
::g->thinkercap.prev = thinker;
|
::g->thinkercap.prev = thinker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,10 +79,10 @@ void P_AddThinker (thinker_t* thinker)
|
||||||
// Deallocation is lazy -- it will not actually be freed
|
// Deallocation is lazy -- it will not actually be freed
|
||||||
// until its thinking turn comes up.
|
// until its thinking turn comes up.
|
||||||
//
|
//
|
||||||
void P_RemoveThinker (thinker_t* thinker)
|
void P_RemoveThinker( thinker_t* thinker )
|
||||||
{
|
{
|
||||||
// FIXME: NOP.
|
// FIXME: NOP.
|
||||||
thinker->function.acv = (actionf_v)(-1);
|
thinker->function.acv = ( actionf_v )( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ void P_RemoveThinker (thinker_t* thinker)
|
||||||
// P_AllocateThinker
|
// P_AllocateThinker
|
||||||
// Allocates memory and adds a new thinker at the end of the list.
|
// Allocates memory and adds a new thinker at the end of the list.
|
||||||
//
|
//
|
||||||
void P_AllocateThinker (thinker_t* thinker)
|
void P_AllocateThinker( thinker_t* thinker )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,27 +100,29 @@ void P_AllocateThinker (thinker_t* thinker)
|
||||||
//
|
//
|
||||||
// P_RunThinkers
|
// P_RunThinkers
|
||||||
//
|
//
|
||||||
void P_RunThinkers (void)
|
void P_RunThinkers( void )
|
||||||
{
|
{
|
||||||
thinker_t* currentthinker;
|
thinker_t* currentthinker;
|
||||||
|
|
||||||
currentthinker = ::g->thinkercap.next;
|
currentthinker = ::g->thinkercap.next;
|
||||||
while (currentthinker != &::g->thinkercap)
|
while( currentthinker != &::g->thinkercap )
|
||||||
{
|
{
|
||||||
if ( currentthinker->function.acv == (actionf_v)(-1) )
|
if( currentthinker->function.acv == ( actionf_v )( -1 ) )
|
||||||
{
|
{
|
||||||
// time to remove it
|
// time to remove it
|
||||||
currentthinker->next->prev = currentthinker->prev;
|
currentthinker->next->prev = currentthinker->prev;
|
||||||
currentthinker->prev->next = currentthinker->next;
|
currentthinker->prev->next = currentthinker->next;
|
||||||
Z_Free(currentthinker);
|
Z_Free( currentthinker );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (currentthinker->function.acp1)
|
if( currentthinker->function.acp1 )
|
||||||
currentthinker->function.acp1 ((mobj_t*)currentthinker);
|
{
|
||||||
}
|
currentthinker->function.acp1( ( mobj_t* )currentthinker );
|
||||||
currentthinker = currentthinker->next;
|
}
|
||||||
}
|
}
|
||||||
|
currentthinker = currentthinker->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,40 +132,45 @@ void P_RunThinkers (void)
|
||||||
//
|
//
|
||||||
extern byte demoversion;
|
extern byte demoversion;
|
||||||
|
|
||||||
void P_Ticker (void)
|
void P_Ticker( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// run the tic
|
// run the tic
|
||||||
if (::g->paused)
|
if( ::g->paused )
|
||||||
return;
|
{
|
||||||
|
|
||||||
// don't think during wipe
|
|
||||||
if ( !::g->netgame && (!::g->demoplayback || demoversion == VERSION ) && ::g->wipe ) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pause if in menu and at least one tic has been run
|
// don't think during wipe
|
||||||
if ( !::g->netgame
|
if( !::g->netgame && ( !::g->demoplayback || demoversion == VERSION ) && ::g->wipe )
|
||||||
&& ::g->menuactive
|
{
|
||||||
&& !::g->demoplayback
|
return;
|
||||||
&& ::g->players[::g->consoleplayer].viewz != 1)
|
}
|
||||||
{
|
|
||||||
return;
|
// pause if in menu and at least one tic has been run
|
||||||
}
|
if( !::g->netgame
|
||||||
|
&& ::g->menuactive
|
||||||
|
&& !::g->demoplayback
|
||||||
|
&& ::g->players[::g->consoleplayer].viewz != 1 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i=0 ; i<MAXPLAYERS ; i++) {
|
for( i = 0 ; i < MAXPLAYERS ; i++ )
|
||||||
if (::g->playeringame[i]) {
|
{
|
||||||
P_PlayerThink (&::g->players[i]);
|
if( ::g->playeringame[i] )
|
||||||
|
{
|
||||||
|
P_PlayerThink( &::g->players[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
P_RunThinkers ();
|
P_RunThinkers();
|
||||||
P_UpdateSpecials ();
|
P_UpdateSpecials();
|
||||||
P_RespawnSpecials ();
|
P_RespawnSpecials();
|
||||||
|
|
||||||
// for par times
|
// for par times
|
||||||
::g->leveltime++;
|
::g->leveltime++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,14 +31,14 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Called by C_Ticker,
|
// Called by C_Ticker,
|
||||||
// can call G_PlayerExited.
|
// can call G_PlayerExited.
|
||||||
// Carries out all thinking of monsters and players.
|
// Carries out all thinking of monsters and players.
|
||||||
void P_Ticker (void);
|
void P_Ticker( void );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,13 +57,13 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
void
|
void
|
||||||
P_Thrust
|
P_Thrust
|
||||||
( player_t* player,
|
( player_t* player,
|
||||||
angle_t angle,
|
angle_t angle,
|
||||||
fixed_t move )
|
fixed_t move )
|
||||||
{
|
{
|
||||||
angle >>= ANGLETOFINESHIFT;
|
angle >>= ANGLETOFINESHIFT;
|
||||||
|
|
||||||
player->mo->momx += FixedMul(move,finecosine[angle]);
|
player->mo->momx += FixedMul( move, finecosine[angle] );
|
||||||
player->mo->momy += FixedMul(move,finesine[angle]);
|
player->mo->momy += FixedMul( move, finesine[angle] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ P_Thrust
|
||||||
// P_CalcHeight
|
// P_CalcHeight
|
||||||
// Calculate the walking / running height adjustment
|
// Calculate the walking / running height adjustment
|
||||||
//
|
//
|
||||||
void P_CalcHeight (player_t* player)
|
void P_CalcHeight( player_t* player )
|
||||||
{
|
{
|
||||||
int angle;
|
int angle;
|
||||||
fixed_t bob;
|
fixed_t bob;
|
||||||
|
@ -85,60 +85,70 @@ void P_CalcHeight (player_t* player)
|
||||||
// Note: a LUT allows for effects
|
// Note: a LUT allows for effects
|
||||||
// like a ramp with low health.
|
// like a ramp with low health.
|
||||||
player->bob =
|
player->bob =
|
||||||
FixedMul (player->mo->momx, player->mo->momx)
|
FixedMul( player->mo->momx, player->mo->momx )
|
||||||
+ FixedMul (player->mo->momy,player->mo->momy);
|
+ FixedMul( player->mo->momy, player->mo->momy );
|
||||||
|
|
||||||
player->bob >>= 2;
|
player->bob >>= 2;
|
||||||
|
|
||||||
// DHM - NERVE :: player bob reduced by 25%, MAXBOB reduced by 25% as well
|
// DHM - NERVE :: player bob reduced by 25%, MAXBOB reduced by 25% as well
|
||||||
player->bob = (fixed_t)( (float)(player->bob) * 0.75f );
|
player->bob = ( fixed_t )( ( float )( player->bob ) * 0.75f );
|
||||||
if (player->bob>MAXBOB)
|
if( player->bob > MAXBOB )
|
||||||
|
{
|
||||||
player->bob = MAXBOB;
|
player->bob = MAXBOB;
|
||||||
|
}
|
||||||
|
|
||||||
if ((player->cheats & CF_NOMOMENTUM) || !::g->onground)
|
if( ( player->cheats & CF_NOMOMENTUM ) || !::g->onground )
|
||||||
{
|
{
|
||||||
player->viewz = player->mo->z + VIEWHEIGHT;
|
player->viewz = player->mo->z + VIEWHEIGHT;
|
||||||
|
|
||||||
if (player->viewz > player->mo->ceilingz-4*FRACUNIT)
|
if( player->viewz > player->mo->ceilingz - 4 * FRACUNIT )
|
||||||
player->viewz = player->mo->ceilingz-4*FRACUNIT;
|
{
|
||||||
|
player->viewz = player->mo->ceilingz - 4 * FRACUNIT;
|
||||||
|
}
|
||||||
|
|
||||||
player->viewz = player->mo->z + player->viewheight;
|
player->viewz = player->mo->z + player->viewheight;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
angle = (FINEANGLES/20*::g->leveltime)&FINEMASK;
|
angle = ( FINEANGLES / 20 *::g->leveltime )&FINEMASK;
|
||||||
bob = FixedMul ( player->bob/2, finesine[angle]);
|
bob = FixedMul( player->bob / 2, finesine[angle] );
|
||||||
|
|
||||||
|
|
||||||
// move ::g->viewheight
|
// move ::g->viewheight
|
||||||
if (player->playerstate == PST_LIVE)
|
if( player->playerstate == PST_LIVE )
|
||||||
{
|
{
|
||||||
player->viewheight += player->deltaviewheight;
|
player->viewheight += player->deltaviewheight;
|
||||||
|
|
||||||
if (player->viewheight > VIEWHEIGHT)
|
if( player->viewheight > VIEWHEIGHT )
|
||||||
{
|
{
|
||||||
player->viewheight = VIEWHEIGHT;
|
player->viewheight = VIEWHEIGHT;
|
||||||
player->deltaviewheight = 0;
|
player->deltaviewheight = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->viewheight < VIEWHEIGHT/2)
|
if( player->viewheight < VIEWHEIGHT / 2 )
|
||||||
{
|
{
|
||||||
player->viewheight = VIEWHEIGHT/2;
|
player->viewheight = VIEWHEIGHT / 2;
|
||||||
if (player->deltaviewheight <= 0)
|
if( player->deltaviewheight <= 0 )
|
||||||
|
{
|
||||||
player->deltaviewheight = 1;
|
player->deltaviewheight = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->deltaviewheight)
|
if( player->deltaviewheight )
|
||||||
{
|
{
|
||||||
player->deltaviewheight += FRACUNIT/4;
|
player->deltaviewheight += FRACUNIT / 4;
|
||||||
if (!player->deltaviewheight)
|
if( !player->deltaviewheight )
|
||||||
|
{
|
||||||
player->deltaviewheight = 1;
|
player->deltaviewheight = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player->viewz = player->mo->z + player->viewheight + bob;
|
player->viewz = player->mo->z + player->viewheight + bob;
|
||||||
|
|
||||||
if (player->viewz > player->mo->ceilingz-4*FRACUNIT)
|
if( player->viewz > player->mo->ceilingz - 4 * FRACUNIT )
|
||||||
player->viewz = player->mo->ceilingz-4*FRACUNIT;
|
{
|
||||||
|
player->viewz = player->mo->ceilingz - 4 * FRACUNIT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,28 +156,32 @@ void P_CalcHeight (player_t* player)
|
||||||
//
|
//
|
||||||
// P_MovePlayer
|
// P_MovePlayer
|
||||||
//
|
//
|
||||||
void P_MovePlayer (player_t* player)
|
void P_MovePlayer( player_t* player )
|
||||||
{
|
{
|
||||||
ticcmd_t* cmd;
|
ticcmd_t* cmd;
|
||||||
|
|
||||||
cmd = &player->cmd;
|
cmd = &player->cmd;
|
||||||
|
|
||||||
player->mo->angle += (cmd->angleturn<<16);
|
player->mo->angle += ( cmd->angleturn << 16 );
|
||||||
|
|
||||||
// Do not let the player control movement
|
// Do not let the player control movement
|
||||||
// if not ::g->onground.
|
// if not ::g->onground.
|
||||||
::g->onground = (player->mo->z <= player->mo->floorz);
|
::g->onground = ( player->mo->z <= player->mo->floorz );
|
||||||
|
|
||||||
if (cmd->forwardmove && ::g->onground)
|
if( cmd->forwardmove && ::g->onground )
|
||||||
P_Thrust (player, player->mo->angle, cmd->forwardmove*2048);
|
|
||||||
|
|
||||||
if (cmd->sidemove && ::g->onground)
|
|
||||||
P_Thrust (player, player->mo->angle-ANG90, cmd->sidemove*2048);
|
|
||||||
|
|
||||||
if ( (cmd->forwardmove || cmd->sidemove)
|
|
||||||
&& player->mo->state == &::g->states[S_PLAY] )
|
|
||||||
{
|
{
|
||||||
P_SetMobjState (player->mo, S_PLAY_RUN1);
|
P_Thrust( player, player->mo->angle, cmd->forwardmove * 2048 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( cmd->sidemove && ::g->onground )
|
||||||
|
{
|
||||||
|
P_Thrust( player, player->mo->angle - ANG90, cmd->sidemove * 2048 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( cmd->forwardmove || cmd->sidemove )
|
||||||
|
&& player->mo->state == &::g->states[S_PLAY] )
|
||||||
|
{
|
||||||
|
P_SetMobjState( player->mo, S_PLAY_RUN1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,53 +194,67 @@ void P_MovePlayer (player_t* player)
|
||||||
//
|
//
|
||||||
extern byte demoversion;
|
extern byte demoversion;
|
||||||
|
|
||||||
void P_DeathThink (player_t* player)
|
void P_DeathThink( player_t* player )
|
||||||
{
|
{
|
||||||
angle_t angle;
|
angle_t angle;
|
||||||
angle_t delta;
|
angle_t delta;
|
||||||
|
|
||||||
P_MovePsprites (player);
|
P_MovePsprites( player );
|
||||||
|
|
||||||
// fall to the ground
|
// fall to the ground
|
||||||
if (player->viewheight > 6*FRACUNIT)
|
if( player->viewheight > 6 * FRACUNIT )
|
||||||
|
{
|
||||||
player->viewheight -= FRACUNIT;
|
player->viewheight -= FRACUNIT;
|
||||||
|
}
|
||||||
|
|
||||||
if (player->viewheight < 6*FRACUNIT)
|
if( player->viewheight < 6 * FRACUNIT )
|
||||||
player->viewheight = 6*FRACUNIT;
|
{
|
||||||
|
player->viewheight = 6 * FRACUNIT;
|
||||||
|
}
|
||||||
|
|
||||||
player->deltaviewheight = 0;
|
player->deltaviewheight = 0;
|
||||||
::g->onground = (player->mo->z <= player->mo->floorz);
|
::g->onground = ( player->mo->z <= player->mo->floorz );
|
||||||
P_CalcHeight (player);
|
P_CalcHeight( player );
|
||||||
|
|
||||||
if (player->attacker && player->attacker != player->mo)
|
if( player->attacker && player->attacker != player->mo )
|
||||||
{
|
{
|
||||||
angle = R_PointToAngle2 (player->mo->x,
|
angle = R_PointToAngle2( player->mo->x,
|
||||||
player->mo->y,
|
player->mo->y,
|
||||||
player->attacker->x,
|
player->attacker->x,
|
||||||
player->attacker->y);
|
player->attacker->y );
|
||||||
|
|
||||||
delta = angle - player->mo->angle;
|
delta = angle - player->mo->angle;
|
||||||
|
|
||||||
if (delta < ANG5 || delta > (unsigned)-ANG5)
|
if( delta < ANG5 || delta > ( unsigned ) - ANG5 )
|
||||||
{
|
{
|
||||||
// Looking at killer,
|
// Looking at killer,
|
||||||
// so fade damage flash down.
|
// so fade damage flash down.
|
||||||
player->mo->angle = angle;
|
player->mo->angle = angle;
|
||||||
|
|
||||||
if (player->damagecount)
|
if( player->damagecount )
|
||||||
|
{
|
||||||
player->damagecount--;
|
player->damagecount--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (delta < ANG180)
|
else if( delta < ANG180 )
|
||||||
|
{
|
||||||
player->mo->angle += ANG5;
|
player->mo->angle += ANG5;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
player->mo->angle -= ANG5;
|
player->mo->angle -= ANG5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (player->damagecount)
|
else if( player->damagecount )
|
||||||
|
{
|
||||||
player->damagecount--;
|
player->damagecount--;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (player->cmd.buttons & BT_USE)
|
if( player->cmd.buttons & BT_USE )
|
||||||
|
{
|
||||||
player->playerstate = PST_REBORN;
|
player->playerstate = PST_REBORN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,216 +262,261 @@ void P_DeathThink (player_t* player)
|
||||||
//
|
//
|
||||||
// P_PlayerThink
|
// P_PlayerThink
|
||||||
//
|
//
|
||||||
void P_PlayerThink (player_t* player)
|
void P_PlayerThink( player_t* player )
|
||||||
{
|
{
|
||||||
ticcmd_t* cmd;
|
ticcmd_t* cmd;
|
||||||
weapontype_t newweapon = wp_fist;
|
weapontype_t newweapon = wp_fist;
|
||||||
|
|
||||||
// fixme: do this in the cheat code
|
// fixme: do this in the cheat code
|
||||||
if (player->cheats & CF_NOCLIP)
|
if( player->cheats & CF_NOCLIP )
|
||||||
|
{
|
||||||
player->mo->flags |= MF_NOCLIP;
|
player->mo->flags |= MF_NOCLIP;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
player->mo->flags &= ~MF_NOCLIP;
|
player->mo->flags &= ~MF_NOCLIP;
|
||||||
|
}
|
||||||
|
|
||||||
// chain saw run forward
|
// chain saw run forward
|
||||||
cmd = &player->cmd;
|
cmd = &player->cmd;
|
||||||
if (player->mo->flags & MF_JUSTATTACKED)
|
if( player->mo->flags & MF_JUSTATTACKED )
|
||||||
{
|
{
|
||||||
cmd->angleturn = 0;
|
cmd->angleturn = 0;
|
||||||
cmd->forwardmove = 0xc800/512;
|
cmd->forwardmove = 0xc800 / 512;
|
||||||
cmd->sidemove = 0;
|
cmd->sidemove = 0;
|
||||||
player->mo->flags &= ~MF_JUSTATTACKED;
|
player->mo->flags &= ~MF_JUSTATTACKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (player->playerstate == PST_DEAD)
|
if( player->playerstate == PST_DEAD )
|
||||||
{
|
{
|
||||||
P_DeathThink (player);
|
P_DeathThink( player );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move around.
|
// Move around.
|
||||||
// Reactiontime is used to prevent movement
|
// Reactiontime is used to prevent movement
|
||||||
// for a bit after a teleport.
|
// for a bit after a teleport.
|
||||||
if (player->mo->reactiontime)
|
if( player->mo->reactiontime )
|
||||||
|
{
|
||||||
player->mo->reactiontime--;
|
player->mo->reactiontime--;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
P_MovePlayer (player);
|
{
|
||||||
|
P_MovePlayer( player );
|
||||||
|
}
|
||||||
|
|
||||||
P_CalcHeight (player);
|
P_CalcHeight( player );
|
||||||
|
|
||||||
if (player->mo->subsector->sector->special)
|
if( player->mo->subsector->sector->special )
|
||||||
P_PlayerInSpecialSector (player);
|
{
|
||||||
|
P_PlayerInSpecialSector( player );
|
||||||
|
}
|
||||||
|
|
||||||
// Check for weapon change.
|
// Check for weapon change.
|
||||||
|
|
||||||
// A special event has no other buttons.
|
// A special event has no other buttons.
|
||||||
if (cmd->buttons & BT_SPECIAL)
|
if( cmd->buttons & BT_SPECIAL )
|
||||||
cmd->buttons = 0;
|
|
||||||
|
|
||||||
if (::g->demoplayback && demoversion < VERSION )
|
|
||||||
{
|
{
|
||||||
if ( cmd->buttons & BT_CHANGE)
|
cmd->buttons = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ::g->demoplayback && demoversion < VERSION )
|
||||||
|
{
|
||||||
|
if( cmd->buttons & BT_CHANGE )
|
||||||
{
|
{
|
||||||
// The actual changing of the weapon is done
|
// The actual changing of the weapon is done
|
||||||
// when the weapon psprite can do it
|
// when the weapon psprite can do it
|
||||||
// (read: not in the middle of an attack).
|
// (read: not in the middle of an attack).
|
||||||
newweapon = (weapontype_t)((cmd->buttons&BT_WEAPONMASK)>>BT_WEAPONSHIFT);
|
newweapon = ( weapontype_t )( ( cmd->buttons & BT_WEAPONMASK ) >> BT_WEAPONSHIFT );
|
||||||
|
|
||||||
if (newweapon == wp_fist
|
if( newweapon == wp_fist
|
||||||
&& player->weaponowned[wp_chainsaw]
|
&& player->weaponowned[wp_chainsaw]
|
||||||
&& !(player->readyweapon == wp_chainsaw
|
&& !( player->readyweapon == wp_chainsaw
|
||||||
&& player->powers[pw_strength]))
|
&& player->powers[pw_strength] ) )
|
||||||
{
|
{
|
||||||
newweapon = wp_chainsaw;
|
newweapon = wp_chainsaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (::g->gamemode == commercial)
|
if( ( ::g->gamemode == commercial )
|
||||||
&& newweapon == wp_shotgun
|
&& newweapon == wp_shotgun
|
||||||
&& player->weaponowned[wp_supershotgun]
|
&& player->weaponowned[wp_supershotgun]
|
||||||
&& player->readyweapon != wp_supershotgun)
|
&& player->readyweapon != wp_supershotgun )
|
||||||
{
|
{
|
||||||
newweapon = wp_supershotgun;
|
newweapon = wp_supershotgun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (player->weaponowned[newweapon]
|
if( player->weaponowned[newweapon]
|
||||||
&& newweapon != player->readyweapon)
|
&& newweapon != player->readyweapon )
|
||||||
{
|
{
|
||||||
// Do not go to plasma or BFG in shareware,
|
// Do not go to plasma or BFG in shareware,
|
||||||
// even if cheated.
|
// even if cheated.
|
||||||
if ((newweapon != wp_plasma
|
if( ( newweapon != wp_plasma
|
||||||
&& newweapon != wp_bfg)
|
&& newweapon != wp_bfg )
|
||||||
|| (::g->gamemode != shareware) )
|
|| ( ::g->gamemode != shareware ) )
|
||||||
{
|
{
|
||||||
player->pendingweapon = newweapon;
|
player->pendingweapon = newweapon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( cmd->buttons & BT_CHANGE )
|
else if( cmd->buttons & BT_CHANGE )
|
||||||
{
|
{
|
||||||
int k, which;
|
int k, which;
|
||||||
// The actual changing of the weapon is done
|
// The actual changing of the weapon is done
|
||||||
// when the weapon psprite can do it
|
// when the weapon psprite can do it
|
||||||
// (read: not in the middle of an attack).
|
// (read: not in the middle of an attack).
|
||||||
which = ((cmd->buttons&BT_WEAPONMASK)>>BT_WEAPONSHIFT);
|
which = ( ( cmd->buttons & BT_WEAPONMASK ) >> BT_WEAPONSHIFT );
|
||||||
|
|
||||||
if ( cmd->nextPrevWeapon > 0) {
|
if( cmd->nextPrevWeapon > 0 )
|
||||||
|
{
|
||||||
newweapon = player->readyweapon;
|
newweapon = player->readyweapon;
|
||||||
|
|
||||||
for ( k = 0; k < NUMWEAPONS; ++k)
|
for( k = 0; k < NUMWEAPONS; ++k )
|
||||||
{
|
{
|
||||||
newweapon = (weapontype_t)( (cmd->nextPrevWeapon - 1) ? (newweapon + 1) : (newweapon - 1));
|
newweapon = ( weapontype_t )( ( cmd->nextPrevWeapon - 1 ) ? ( newweapon + 1 ) : ( newweapon - 1 ) );
|
||||||
|
|
||||||
if (newweapon == wp_nochange)
|
if( newweapon == wp_nochange )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
weapontype_t maxweapon = (::g->gamemode == retail) ? wp_chainsaw : wp_supershotgun;
|
weapontype_t maxweapon = ( ::g->gamemode == retail ) ? wp_chainsaw : wp_supershotgun;
|
||||||
|
|
||||||
if (newweapon < 0)
|
if( newweapon < 0 )
|
||||||
|
{
|
||||||
newweapon = maxweapon;
|
newweapon = maxweapon;
|
||||||
|
}
|
||||||
|
|
||||||
if (newweapon > maxweapon)
|
if( newweapon > maxweapon )
|
||||||
|
{
|
||||||
newweapon = wp_fist;
|
newweapon = wp_fist;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (player->weaponowned[newweapon] && newweapon != player->readyweapon)
|
if( player->weaponowned[newweapon] && newweapon != player->readyweapon )
|
||||||
{
|
{
|
||||||
player->pendingweapon = newweapon;
|
player->pendingweapon = newweapon;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
|
|
||||||
newweapon = (weapontype_t)((cmd->buttons&BT_WEAPONMASK)>>BT_WEAPONSHIFT);
|
newweapon = ( weapontype_t )( ( cmd->buttons & BT_WEAPONMASK ) >> BT_WEAPONSHIFT );
|
||||||
|
|
||||||
if (newweapon == wp_fist
|
if( newweapon == wp_fist
|
||||||
&& player->weaponowned[wp_chainsaw]
|
&& player->weaponowned[wp_chainsaw]
|
||||||
&& !(player->readyweapon == wp_chainsaw
|
&& !( player->readyweapon == wp_chainsaw
|
||||||
&& player->powers[pw_strength]))
|
&& player->powers[pw_strength] ) )
|
||||||
{
|
{
|
||||||
newweapon = wp_chainsaw;
|
newweapon = wp_chainsaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (::g->gamemode == commercial)
|
if( ( ::g->gamemode == commercial )
|
||||||
&& newweapon == wp_shotgun
|
&& newweapon == wp_shotgun
|
||||||
&& player->weaponowned[wp_supershotgun]
|
&& player->weaponowned[wp_supershotgun]
|
||||||
&& player->readyweapon != wp_supershotgun)
|
&& player->readyweapon != wp_supershotgun )
|
||||||
{
|
{
|
||||||
newweapon = wp_supershotgun;
|
newweapon = wp_supershotgun;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( player->weaponowned[ newweapon ] && newweapon != player->readyweapon ) {
|
if( player->weaponowned[ newweapon ] && newweapon != player->readyweapon )
|
||||||
|
{
|
||||||
player->pendingweapon = newweapon;
|
player->pendingweapon = newweapon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for use
|
// check for use
|
||||||
if (cmd->buttons & BT_USE)
|
if( cmd->buttons & BT_USE )
|
||||||
{
|
{
|
||||||
if (!player->usedown)
|
if( !player->usedown )
|
||||||
{
|
{
|
||||||
P_UseLines (player);
|
P_UseLines( player );
|
||||||
player->usedown = true;
|
player->usedown = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
player->usedown = false;
|
player->usedown = false;
|
||||||
|
}
|
||||||
|
|
||||||
// cycle psprites
|
// cycle psprites
|
||||||
P_MovePsprites (player);
|
P_MovePsprites( player );
|
||||||
|
|
||||||
// Counters, time dependend power ups.
|
// Counters, time dependend power ups.
|
||||||
|
|
||||||
// Strength counts up to diminish fade.
|
// Strength counts up to diminish fade.
|
||||||
if (player->powers[pw_strength])
|
if( player->powers[pw_strength] )
|
||||||
|
{
|
||||||
player->powers[pw_strength]++;
|
player->powers[pw_strength]++;
|
||||||
|
}
|
||||||
|
|
||||||
if (player->powers[pw_invulnerability])
|
if( player->powers[pw_invulnerability] )
|
||||||
|
{
|
||||||
player->powers[pw_invulnerability]--;
|
player->powers[pw_invulnerability]--;
|
||||||
|
}
|
||||||
|
|
||||||
if (player->powers[pw_invisibility])
|
if( player->powers[pw_invisibility] )
|
||||||
if (! --player->powers[pw_invisibility] )
|
if( ! --player->powers[pw_invisibility] )
|
||||||
|
{
|
||||||
player->mo->flags &= ~MF_SHADOW;
|
player->mo->flags &= ~MF_SHADOW;
|
||||||
|
}
|
||||||
|
|
||||||
if (player->powers[pw_infrared])
|
if( player->powers[pw_infrared] )
|
||||||
|
{
|
||||||
player->powers[pw_infrared]--;
|
player->powers[pw_infrared]--;
|
||||||
|
}
|
||||||
|
|
||||||
if (player->powers[pw_ironfeet])
|
if( player->powers[pw_ironfeet] )
|
||||||
|
{
|
||||||
player->powers[pw_ironfeet]--;
|
player->powers[pw_ironfeet]--;
|
||||||
|
}
|
||||||
|
|
||||||
if (player->damagecount)
|
if( player->damagecount )
|
||||||
|
{
|
||||||
player->damagecount--;
|
player->damagecount--;
|
||||||
|
}
|
||||||
|
|
||||||
if (player->bonuscount)
|
if( player->bonuscount )
|
||||||
|
{
|
||||||
player->bonuscount--;
|
player->bonuscount--;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Handling ::g->colormaps.
|
// Handling ::g->colormaps.
|
||||||
if (player->powers[pw_invulnerability])
|
if( player->powers[pw_invulnerability] )
|
||||||
{
|
{
|
||||||
if (player->powers[pw_invulnerability] > 4*32
|
if( player->powers[pw_invulnerability] > 4 * 32
|
||||||
|| (player->powers[pw_invulnerability]&8) )
|
|| ( player->powers[pw_invulnerability] & 8 ) )
|
||||||
|
{
|
||||||
player->fixedcolormap = INVERSECOLORMAP;
|
player->fixedcolormap = INVERSECOLORMAP;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
player->fixedcolormap = 0;
|
player->fixedcolormap = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (player->powers[pw_infrared])
|
else if( player->powers[pw_infrared] )
|
||||||
{
|
{
|
||||||
if (player->powers[pw_infrared] > 4*32
|
if( player->powers[pw_infrared] > 4 * 32
|
||||||
|| (player->powers[pw_infrared]&8) )
|
|| ( player->powers[pw_infrared] & 8 ) )
|
||||||
{
|
{
|
||||||
// almost full bright
|
// almost full bright
|
||||||
player->fixedcolormap = 1;
|
player->fixedcolormap = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
player->fixedcolormap = 0;
|
player->fixedcolormap = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
player->fixedcolormap = 0;
|
player->fixedcolormap = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,9 @@ R_StoreWallRange
|
||||||
//
|
//
|
||||||
// R_ClearDrawSegs
|
// R_ClearDrawSegs
|
||||||
//
|
//
|
||||||
void R_ClearDrawSegs (void)
|
void R_ClearDrawSegs( void )
|
||||||
{
|
{
|
||||||
::g->ds_p = ::g->drawsegs;
|
::g->ds_p = ::g->drawsegs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,83 +93,87 @@ R_ClipSolidWallSegment
|
||||||
( int first,
|
( int first,
|
||||||
int last )
|
int last )
|
||||||
{
|
{
|
||||||
cliprange_t* next;
|
cliprange_t* next;
|
||||||
cliprange_t* start;
|
cliprange_t* start;
|
||||||
|
|
||||||
// Find the first range that touches the range
|
// Find the first range that touches the range
|
||||||
// (adjacent pixels are touching).
|
// (adjacent pixels are touching).
|
||||||
start = ::g->solidsegs;
|
start = ::g->solidsegs;
|
||||||
while (start->last < first-1)
|
while( start->last < first - 1 )
|
||||||
|
{
|
||||||
start++;
|
start++;
|
||||||
|
|
||||||
if (first < start->first)
|
|
||||||
{
|
|
||||||
if (last < start->first-1)
|
|
||||||
{
|
|
||||||
// Post is entirely visible (above start),
|
|
||||||
// so insert a new clippost.
|
|
||||||
R_StoreWallRange (first, last);
|
|
||||||
next = ::g->newend;
|
|
||||||
::g->newend++;
|
|
||||||
|
|
||||||
while (next != start)
|
|
||||||
{
|
|
||||||
*next = *(next-1);
|
|
||||||
next--;
|
|
||||||
}
|
|
||||||
next->first = first;
|
|
||||||
next->last = last;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is a fragment above *start.
|
if( first < start->first )
|
||||||
R_StoreWallRange (first, start->first - 1);
|
|
||||||
// Now adjust the clip size.
|
|
||||||
start->first = first;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bottom contained in start?
|
|
||||||
if (last <= start->last)
|
|
||||||
return;
|
|
||||||
|
|
||||||
next = start;
|
|
||||||
while (last >= (next+1)->first-1)
|
|
||||||
{
|
|
||||||
// There is a fragment between two posts.
|
|
||||||
R_StoreWallRange (next->last + 1, (next+1)->first - 1);
|
|
||||||
next++;
|
|
||||||
|
|
||||||
if (last <= next->last)
|
|
||||||
{
|
{
|
||||||
// Bottom is contained in next.
|
if( last < start->first - 1 )
|
||||||
// Adjust the clip size.
|
{
|
||||||
start->last = next->last;
|
// Post is entirely visible (above start),
|
||||||
goto crunch;
|
// so insert a new clippost.
|
||||||
|
R_StoreWallRange( first, last );
|
||||||
|
next = ::g->newend;
|
||||||
|
::g->newend++;
|
||||||
|
|
||||||
|
while( next != start )
|
||||||
|
{
|
||||||
|
*next = *( next - 1 );
|
||||||
|
next--;
|
||||||
|
}
|
||||||
|
next->first = first;
|
||||||
|
next->last = last;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// There is a fragment above *start.
|
||||||
|
R_StoreWallRange( first, start->first - 1 );
|
||||||
|
// Now adjust the clip size.
|
||||||
|
start->first = first;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// There is a fragment after *next.
|
// Bottom contained in start?
|
||||||
R_StoreWallRange (next->last + 1, last);
|
if( last <= start->last )
|
||||||
// Adjust the clip size.
|
{
|
||||||
start->last = last;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Remove start+1 to next from the clip list,
|
next = start;
|
||||||
// because start now covers their area.
|
while( last >= ( next + 1 )->first - 1 )
|
||||||
crunch:
|
{
|
||||||
if (next == start)
|
// There is a fragment between two posts.
|
||||||
{
|
R_StoreWallRange( next->last + 1, ( next + 1 )->first - 1 );
|
||||||
// Post just extended past the bottom of one post.
|
next++;
|
||||||
return;
|
|
||||||
}
|
if( last <= next->last )
|
||||||
|
{
|
||||||
|
// Bottom is contained in next.
|
||||||
|
// Adjust the clip size.
|
||||||
|
start->last = next->last;
|
||||||
|
goto crunch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// There is a fragment after *next.
|
||||||
|
R_StoreWallRange( next->last + 1, last );
|
||||||
|
// Adjust the clip size.
|
||||||
|
start->last = last;
|
||||||
|
|
||||||
|
// Remove start+1 to next from the clip list,
|
||||||
|
// because start now covers their area.
|
||||||
|
crunch:
|
||||||
|
if( next == start )
|
||||||
|
{
|
||||||
|
// Post just extended past the bottom of one post.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
while (next++ != ::g->newend)
|
while( next++ != ::g->newend )
|
||||||
{
|
{
|
||||||
// Remove a post.
|
// Remove a post.
|
||||||
*++start = *next;
|
*++start = *next;
|
||||||
}
|
}
|
||||||
|
|
||||||
::g->newend = start+1;
|
::g->newend = start + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -186,43 +190,49 @@ R_ClipPassWallSegment
|
||||||
( int first,
|
( int first,
|
||||||
int last )
|
int last )
|
||||||
{
|
{
|
||||||
cliprange_t* start;
|
cliprange_t* start;
|
||||||
|
|
||||||
// Find the first range that touches the range
|
// Find the first range that touches the range
|
||||||
// (adjacent pixels are touching).
|
// (adjacent pixels are touching).
|
||||||
start = ::g->solidsegs;
|
start = ::g->solidsegs;
|
||||||
while (start->last < first-1)
|
while( start->last < first - 1 )
|
||||||
start++;
|
|
||||||
|
|
||||||
if (first < start->first)
|
|
||||||
{
|
|
||||||
if (last < start->first-1)
|
|
||||||
{
|
{
|
||||||
// Post is entirely visible (above start).
|
start++;
|
||||||
R_StoreWallRange (first, last);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is a fragment above *start.
|
if( first < start->first )
|
||||||
R_StoreWallRange (first, start->first - 1);
|
{
|
||||||
}
|
if( last < start->first - 1 )
|
||||||
|
{
|
||||||
|
// Post is entirely visible (above start).
|
||||||
|
R_StoreWallRange( first, last );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Bottom contained in start?
|
// There is a fragment above *start.
|
||||||
if (last <= start->last)
|
R_StoreWallRange( first, start->first - 1 );
|
||||||
return;
|
}
|
||||||
|
|
||||||
while (last >= (start+1)->first-1)
|
// Bottom contained in start?
|
||||||
{
|
if( last <= start->last )
|
||||||
// There is a fragment between two posts.
|
{
|
||||||
R_StoreWallRange (start->last + 1, (start+1)->first - 1);
|
return;
|
||||||
start++;
|
}
|
||||||
|
|
||||||
if (last <= start->last)
|
while( last >= ( start + 1 )->first - 1 )
|
||||||
return;
|
{
|
||||||
}
|
// There is a fragment between two posts.
|
||||||
|
R_StoreWallRange( start->last + 1, ( start + 1 )->first - 1 );
|
||||||
|
start++;
|
||||||
|
|
||||||
// There is a fragment after *next.
|
if( last <= start->last )
|
||||||
R_StoreWallRange (start->last + 1, last);
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// There is a fragment after *next.
|
||||||
|
R_StoreWallRange( start->last + 1, last );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -230,13 +240,13 @@ R_ClipPassWallSegment
|
||||||
//
|
//
|
||||||
// R_ClearClipSegs
|
// R_ClearClipSegs
|
||||||
//
|
//
|
||||||
void R_ClearClipSegs (void)
|
void R_ClearClipSegs( void )
|
||||||
{
|
{
|
||||||
::g->solidsegs[0].first = -0x7fffffff;
|
::g->solidsegs[0].first = -0x7fffffff;
|
||||||
::g->solidsegs[0].last = -1;
|
::g->solidsegs[0].last = -1;
|
||||||
::g->solidsegs[1].first = ::g->viewwidth;
|
::g->solidsegs[1].first = ::g->viewwidth;
|
||||||
::g->solidsegs[1].last = 0x7fffffff;
|
::g->solidsegs[1].last = 0x7fffffff;
|
||||||
::g->newend = ::g->solidsegs+2;
|
::g->newend = ::g->solidsegs + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -244,104 +254,118 @@ void R_ClearClipSegs (void)
|
||||||
// Clips the given segment
|
// Clips the given segment
|
||||||
// and adds any visible pieces to the line list.
|
// and adds any visible pieces to the line list.
|
||||||
//
|
//
|
||||||
void R_AddLine (seg_t* line)
|
void R_AddLine( seg_t* line )
|
||||||
{
|
{
|
||||||
int x1;
|
int x1;
|
||||||
int x2;
|
int x2;
|
||||||
angle_t angle1;
|
angle_t angle1;
|
||||||
angle_t angle2;
|
angle_t angle2;
|
||||||
angle_t span;
|
angle_t span;
|
||||||
angle_t tspan;
|
angle_t tspan;
|
||||||
|
|
||||||
::g->curline = line;
|
::g->curline = line;
|
||||||
|
|
||||||
// OPTIMIZE: quickly reject orthogonal back ::g->sides.
|
// OPTIMIZE: quickly reject orthogonal back ::g->sides.
|
||||||
angle1 = R_PointToAngle (line->v1->x, line->v1->y);
|
angle1 = R_PointToAngle( line->v1->x, line->v1->y );
|
||||||
angle2 = R_PointToAngle (line->v2->x, line->v2->y);
|
angle2 = R_PointToAngle( line->v2->x, line->v2->y );
|
||||||
|
|
||||||
// Clip to view edges.
|
// Clip to view edges.
|
||||||
// OPTIMIZE: make constant out of 2*::g->clipangle (FIELDOFVIEW).
|
// OPTIMIZE: make constant out of 2*::g->clipangle (FIELDOFVIEW).
|
||||||
span = angle1 - angle2;
|
span = angle1 - angle2;
|
||||||
|
|
||||||
// Back side? I.e. backface culling?
|
// Back side? I.e. backface culling?
|
||||||
if (span >= ANG180)
|
if( span >= ANG180 )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
extern angle_t GetViewAngle();
|
extern angle_t GetViewAngle();
|
||||||
// Global angle needed by segcalc.
|
// Global angle needed by segcalc.
|
||||||
::g->rw_angle1 = angle1;
|
::g->rw_angle1 = angle1;
|
||||||
angle1 -= GetViewAngle();
|
angle1 -= GetViewAngle();
|
||||||
angle2 -= GetViewAngle();
|
angle2 -= GetViewAngle();
|
||||||
|
|
||||||
tspan = angle1 + ::g->clipangle;
|
tspan = angle1 + ::g->clipangle;
|
||||||
if (tspan > 2*::g->clipangle)
|
if( tspan > 2 *::g->clipangle )
|
||||||
{
|
{
|
||||||
tspan -= 2*::g->clipangle;
|
tspan -= 2 *::g->clipangle;
|
||||||
|
|
||||||
// Totally off the left edge?
|
// Totally off the left edge?
|
||||||
if (tspan >= span)
|
if( tspan >= span )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
angle1 = ::g->clipangle;
|
angle1 = ::g->clipangle;
|
||||||
}
|
}
|
||||||
tspan = ::g->clipangle - angle2;
|
tspan = ::g->clipangle - angle2;
|
||||||
if (tspan > 2*::g->clipangle)
|
if( tspan > 2 *::g->clipangle )
|
||||||
{
|
{
|
||||||
tspan -= 2*::g->clipangle;
|
tspan -= 2 *::g->clipangle;
|
||||||
|
|
||||||
// Totally off the left edge?
|
// Totally off the left edge?
|
||||||
if (tspan >= span)
|
if( tspan >= span )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
angle2 = -::g->clipangle; // ALANHACK UNSIGNED
|
angle2 = -::g->clipangle; // ALANHACK UNSIGNED
|
||||||
}
|
}
|
||||||
|
|
||||||
// The seg is in the view range,
|
// The seg is in the view range,
|
||||||
// but not necessarily visible.
|
// but not necessarily visible.
|
||||||
angle1 = (angle1+ANG90)>>ANGLETOFINESHIFT;
|
angle1 = ( angle1 + ANG90 ) >> ANGLETOFINESHIFT;
|
||||||
angle2 = (angle2+ANG90)>>ANGLETOFINESHIFT;
|
angle2 = ( angle2 + ANG90 ) >> ANGLETOFINESHIFT;
|
||||||
x1 = ::g->viewangletox[angle1];
|
x1 = ::g->viewangletox[angle1];
|
||||||
x2 = ::g->viewangletox[angle2];
|
x2 = ::g->viewangletox[angle2];
|
||||||
|
|
||||||
// Does not cross a pixel?
|
// Does not cross a pixel?
|
||||||
if (x1 == x2)
|
if( x1 == x2 )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
::g->backsector = line->backsector;
|
::g->backsector = line->backsector;
|
||||||
|
|
||||||
// Single sided line?
|
// Single sided line?
|
||||||
if (!::g->backsector)
|
if( !::g->backsector )
|
||||||
|
{
|
||||||
goto clipsolid;
|
goto clipsolid;
|
||||||
|
}
|
||||||
|
|
||||||
// Closed door.
|
// Closed door.
|
||||||
if (::g->backsector->ceilingheight <= ::g->frontsector->floorheight
|
if( ::g->backsector->ceilingheight <= ::g->frontsector->floorheight
|
||||||
|| ::g->backsector->floorheight >= ::g->frontsector->ceilingheight)
|
|| ::g->backsector->floorheight >= ::g->frontsector->ceilingheight )
|
||||||
|
{
|
||||||
goto clipsolid;
|
goto clipsolid;
|
||||||
|
}
|
||||||
|
|
||||||
// Window.
|
// Window.
|
||||||
if (::g->backsector->ceilingheight != ::g->frontsector->ceilingheight
|
if( ::g->backsector->ceilingheight != ::g->frontsector->ceilingheight
|
||||||
|| ::g->backsector->floorheight != ::g->frontsector->floorheight)
|
|| ::g->backsector->floorheight != ::g->frontsector->floorheight )
|
||||||
|
{
|
||||||
goto clippass;
|
goto clippass;
|
||||||
|
}
|
||||||
|
|
||||||
// Reject empty ::g->lines used for triggers
|
// Reject empty ::g->lines used for triggers
|
||||||
// and special ::g->events.
|
// and special ::g->events.
|
||||||
// Identical floor and ceiling on both ::g->sides,
|
// Identical floor and ceiling on both ::g->sides,
|
||||||
// identical light levels on both ::g->sides,
|
// identical light levels on both ::g->sides,
|
||||||
// and no middle texture.
|
// and no middle texture.
|
||||||
if (::g->backsector->ceilingpic == ::g->frontsector->ceilingpic
|
if( ::g->backsector->ceilingpic == ::g->frontsector->ceilingpic
|
||||||
&& ::g->backsector->floorpic == ::g->frontsector->floorpic
|
&& ::g->backsector->floorpic == ::g->frontsector->floorpic
|
||||||
&& ::g->backsector->lightlevel == ::g->frontsector->lightlevel
|
&& ::g->backsector->lightlevel == ::g->frontsector->lightlevel
|
||||||
&& ::g->curline->sidedef->midtexture == 0)
|
&& ::g->curline->sidedef->midtexture == 0 )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
clippass:
|
clippass:
|
||||||
R_ClipPassWallSegment (x1, x2-1);
|
R_ClipPassWallSegment( x1, x2 - 1 );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
clipsolid:
|
clipsolid:
|
||||||
R_ClipSolidWallSegment (x1, x2-1);
|
R_ClipSolidWallSegment( x1, x2 - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -353,114 +377,139 @@ void R_AddLine (seg_t* line)
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
qboolean R_CheckBBox (fixed_t* bspcoord)
|
qboolean R_CheckBBox( fixed_t* bspcoord )
|
||||||
{
|
{
|
||||||
int boxx;
|
int boxx;
|
||||||
int boxy;
|
int boxy;
|
||||||
int boxpos;
|
int boxpos;
|
||||||
|
|
||||||
fixed_t x1;
|
fixed_t x1;
|
||||||
fixed_t y1;
|
fixed_t y1;
|
||||||
fixed_t x2;
|
fixed_t x2;
|
||||||
fixed_t y2;
|
fixed_t y2;
|
||||||
|
|
||||||
angle_t angle1;
|
angle_t angle1;
|
||||||
angle_t angle2;
|
angle_t angle2;
|
||||||
angle_t span;
|
angle_t span;
|
||||||
angle_t tspan;
|
angle_t tspan;
|
||||||
|
|
||||||
cliprange_t* start;
|
cliprange_t* start;
|
||||||
|
|
||||||
int sx1;
|
int sx1;
|
||||||
int sx2;
|
int sx2;
|
||||||
|
|
||||||
extern fixed_t GetViewX(); extern fixed_t GetViewY();
|
extern fixed_t GetViewX();
|
||||||
// Find the corners of the box
|
extern fixed_t GetViewY();
|
||||||
// that define the edges from current viewpoint.
|
// Find the corners of the box
|
||||||
if (GetViewX() <= bspcoord[BOXLEFT])
|
// that define the edges from current viewpoint.
|
||||||
boxx = 0;
|
if( GetViewX() <= bspcoord[BOXLEFT] )
|
||||||
else if (GetViewX() < bspcoord[BOXRIGHT])
|
{
|
||||||
boxx = 1;
|
boxx = 0;
|
||||||
else
|
}
|
||||||
boxx = 2;
|
else if( GetViewX() < bspcoord[BOXRIGHT] )
|
||||||
|
{
|
||||||
|
boxx = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
boxx = 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (GetViewY() >= bspcoord[BOXTOP])
|
if( GetViewY() >= bspcoord[BOXTOP] )
|
||||||
boxy = 0;
|
{
|
||||||
else if (GetViewY() > bspcoord[BOXBOTTOM])
|
boxy = 0;
|
||||||
boxy = 1;
|
}
|
||||||
else
|
else if( GetViewY() > bspcoord[BOXBOTTOM] )
|
||||||
boxy = 2;
|
{
|
||||||
|
boxy = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
boxy = 2;
|
||||||
|
}
|
||||||
|
|
||||||
boxpos = (boxy<<2)+boxx;
|
boxpos = ( boxy << 2 ) + boxx;
|
||||||
if (boxpos == 5)
|
if( boxpos == 5 )
|
||||||
return true;
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
x1 = bspcoord[::g->checkcoord[boxpos][0]];
|
x1 = bspcoord[::g->checkcoord[boxpos][0]];
|
||||||
y1 = bspcoord[::g->checkcoord[boxpos][1]];
|
y1 = bspcoord[::g->checkcoord[boxpos][1]];
|
||||||
x2 = bspcoord[::g->checkcoord[boxpos][2]];
|
x2 = bspcoord[::g->checkcoord[boxpos][2]];
|
||||||
y2 = bspcoord[::g->checkcoord[boxpos][3]];
|
y2 = bspcoord[::g->checkcoord[boxpos][3]];
|
||||||
|
|
||||||
// check clip list for an open space
|
// check clip list for an open space
|
||||||
extern angle_t GetViewAngle();
|
extern angle_t GetViewAngle();
|
||||||
angle1 = R_PointToAngle (x1, y1) - GetViewAngle();
|
angle1 = R_PointToAngle( x1, y1 ) - GetViewAngle();
|
||||||
angle2 = R_PointToAngle (x2, y2) - GetViewAngle();
|
angle2 = R_PointToAngle( x2, y2 ) - GetViewAngle();
|
||||||
|
|
||||||
span = angle1 - angle2;
|
span = angle1 - angle2;
|
||||||
|
|
||||||
|
// Sitting on a line?
|
||||||
|
if( span >= ANG180 )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
tspan = angle1 + ::g->clipangle;
|
||||||
|
|
||||||
|
if( tspan > 2 *::g->clipangle )
|
||||||
|
{
|
||||||
|
tspan -= 2 *::g->clipangle;
|
||||||
|
|
||||||
|
// Totally off the left edge?
|
||||||
|
if( tspan >= span )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
angle1 = ::g->clipangle;
|
||||||
|
}
|
||||||
|
tspan = ::g->clipangle - angle2;
|
||||||
|
if( tspan > 2 *::g->clipangle )
|
||||||
|
{
|
||||||
|
tspan -= 2 *::g->clipangle;
|
||||||
|
|
||||||
|
// Totally off the left edge?
|
||||||
|
if( tspan >= span )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
angle2 = -::g->clipangle;// ALANHACK UNSIGNED
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Find the first clippost
|
||||||
|
// that touches the source post
|
||||||
|
// (adjacent pixels are touching).
|
||||||
|
angle1 = ( angle1 + ANG90 ) >> ANGLETOFINESHIFT;
|
||||||
|
angle2 = ( angle2 + ANG90 ) >> ANGLETOFINESHIFT;
|
||||||
|
sx1 = ::g->viewangletox[angle1];
|
||||||
|
sx2 = ::g->viewangletox[angle2];
|
||||||
|
|
||||||
|
// Does not cross a pixel.
|
||||||
|
if( sx1 == sx2 )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
sx2--;
|
||||||
|
|
||||||
|
start = ::g->solidsegs;
|
||||||
|
while( start->last < sx2 )
|
||||||
|
{
|
||||||
|
start++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( sx1 >= start->first
|
||||||
|
&& sx2 <= start->last )
|
||||||
|
{
|
||||||
|
// The clippost contains the new span.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Sitting on a line?
|
|
||||||
if (span >= ANG180)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
tspan = angle1 + ::g->clipangle;
|
|
||||||
|
|
||||||
if (tspan > 2*::g->clipangle)
|
|
||||||
{
|
|
||||||
tspan -= 2*::g->clipangle;
|
|
||||||
|
|
||||||
// Totally off the left edge?
|
|
||||||
if (tspan >= span)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
angle1 = ::g->clipangle;
|
|
||||||
}
|
|
||||||
tspan = ::g->clipangle - angle2;
|
|
||||||
if (tspan > 2*::g->clipangle)
|
|
||||||
{
|
|
||||||
tspan -= 2*::g->clipangle;
|
|
||||||
|
|
||||||
// Totally off the left edge?
|
|
||||||
if (tspan >= span)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
angle2 = -::g->clipangle;// ALANHACK UNSIGNED
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Find the first clippost
|
|
||||||
// that touches the source post
|
|
||||||
// (adjacent pixels are touching).
|
|
||||||
angle1 = (angle1+ANG90)>>ANGLETOFINESHIFT;
|
|
||||||
angle2 = (angle2+ANG90)>>ANGLETOFINESHIFT;
|
|
||||||
sx1 = ::g->viewangletox[angle1];
|
|
||||||
sx2 = ::g->viewangletox[angle2];
|
|
||||||
|
|
||||||
// Does not cross a pixel.
|
|
||||||
if (sx1 == sx2)
|
|
||||||
return false;
|
|
||||||
sx2--;
|
|
||||||
|
|
||||||
start = ::g->solidsegs;
|
|
||||||
while (start->last < sx2)
|
|
||||||
start++;
|
|
||||||
|
|
||||||
if (sx1 >= start->first
|
|
||||||
&& sx2 <= start->last)
|
|
||||||
{
|
|
||||||
// The clippost contains the new span.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -471,51 +520,55 @@ qboolean R_CheckBBox (fixed_t* bspcoord)
|
||||||
// Add ::g->sprites of things in sector.
|
// Add ::g->sprites of things in sector.
|
||||||
// Draw one or more line segments.
|
// Draw one or more line segments.
|
||||||
//
|
//
|
||||||
void R_Subsector (int num)
|
void R_Subsector( int num )
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
seg_t* line;
|
seg_t* line;
|
||||||
subsector_t* sub;
|
subsector_t* sub;
|
||||||
|
|
||||||
#ifdef RANGECHECK
|
#ifdef RANGECHECK
|
||||||
if (num>=::g->numsubsectors)
|
if( num >=::g->numsubsectors )
|
||||||
I_Error ("R_Subsector: ss %i with numss = %i",
|
I_Error( "R_Subsector: ss %i with numss = %i",
|
||||||
num,
|
num,
|
||||||
::g->numsubsectors);
|
::g->numsubsectors );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
::g->sscount++;
|
::g->sscount++;
|
||||||
sub = &::g->subsectors[num];
|
sub = &::g->subsectors[num];
|
||||||
::g->frontsector = sub->sector;
|
::g->frontsector = sub->sector;
|
||||||
count = sub->numlines;
|
count = sub->numlines;
|
||||||
line = &::g->segs[sub->firstline];
|
line = &::g->segs[sub->firstline];
|
||||||
|
|
||||||
if (::g->frontsector->floorheight < ::g->viewz)
|
if( ::g->frontsector->floorheight < ::g->viewz )
|
||||||
{
|
{
|
||||||
::g->floorplane = R_FindPlane (::g->frontsector->floorheight,
|
::g->floorplane = R_FindPlane( ::g->frontsector->floorheight,
|
||||||
::g->frontsector->floorpic,
|
::g->frontsector->floorpic,
|
||||||
::g->frontsector->lightlevel);
|
::g->frontsector->lightlevel );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
::g->floorplane = NULL;
|
::g->floorplane = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (::g->frontsector->ceilingheight > ::g->viewz
|
if( ::g->frontsector->ceilingheight > ::g->viewz
|
||||||
|| ::g->frontsector->ceilingpic == ::g->skyflatnum)
|
|| ::g->frontsector->ceilingpic == ::g->skyflatnum )
|
||||||
{
|
{
|
||||||
::g->ceilingplane = R_FindPlane (::g->frontsector->ceilingheight,
|
::g->ceilingplane = R_FindPlane( ::g->frontsector->ceilingheight,
|
||||||
::g->frontsector->ceilingpic,
|
::g->frontsector->ceilingpic,
|
||||||
::g->frontsector->lightlevel);
|
::g->frontsector->lightlevel );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
::g->ceilingplane = NULL;
|
::g->ceilingplane = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
R_AddSprites (::g->frontsector);
|
R_AddSprites( ::g->frontsector );
|
||||||
|
|
||||||
while (count--)
|
while( count-- )
|
||||||
{
|
{
|
||||||
R_AddLine (line);
|
R_AddLine( line );
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -526,33 +579,40 @@ void R_Subsector (int num)
|
||||||
// Renders all ::g->subsectors below a given node,
|
// Renders all ::g->subsectors below a given node,
|
||||||
// traversing subtree recursively.
|
// traversing subtree recursively.
|
||||||
// Just call with BSP root.
|
// Just call with BSP root.
|
||||||
void R_RenderBSPNode (int bspnum)
|
void R_RenderBSPNode( int bspnum )
|
||||||
{
|
{
|
||||||
node_t* bsp;
|
node_t* bsp;
|
||||||
int side;
|
int side;
|
||||||
|
|
||||||
// Found a subsector?
|
// Found a subsector?
|
||||||
if (bspnum & NF_SUBSECTOR)
|
if( bspnum & NF_SUBSECTOR )
|
||||||
{
|
{
|
||||||
if (bspnum == -1)
|
if( bspnum == -1 )
|
||||||
R_Subsector (0);
|
{
|
||||||
else
|
R_Subsector( 0 );
|
||||||
R_Subsector (bspnum&(~NF_SUBSECTOR));
|
}
|
||||||
return;
|
else
|
||||||
}
|
{
|
||||||
|
R_Subsector( bspnum & ( ~NF_SUBSECTOR ) );
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bsp = &::g->nodes[bspnum];
|
bsp = &::g->nodes[bspnum];
|
||||||
|
|
||||||
extern fixed_t GetViewX(); extern fixed_t GetViewY();
|
extern fixed_t GetViewX();
|
||||||
// Decide which side the view point is on.
|
extern fixed_t GetViewY();
|
||||||
side = R_PointOnSide (GetViewX(), GetViewY(), bsp);
|
// Decide which side the view point is on.
|
||||||
|
side = R_PointOnSide( GetViewX(), GetViewY(), bsp );
|
||||||
|
|
||||||
// Recursively divide front space.
|
// Recursively divide front space.
|
||||||
R_RenderBSPNode (bsp->children[side]);
|
R_RenderBSPNode( bsp->children[side] );
|
||||||
|
|
||||||
// Possibly divide back space.
|
// Possibly divide back space.
|
||||||
if (R_CheckBBox (bsp->bbox[side^1]))
|
if( R_CheckBBox( bsp->bbox[side ^ 1] ) )
|
||||||
R_RenderBSPNode (bsp->children[side^1]);
|
{
|
||||||
|
R_RenderBSPNode( bsp->children[side ^ 1] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#define __R_BSP__
|
#define __R_BSP__
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,15 +59,15 @@ extern lighttable_t** vscalelight;
|
||||||
extern lighttable_t** dscalelight;
|
extern lighttable_t** dscalelight;
|
||||||
|
|
||||||
|
|
||||||
typedef void (*drawfunc_t) (int start, int stop);
|
typedef void ( *drawfunc_t )( int start, int stop );
|
||||||
|
|
||||||
|
|
||||||
// BSP?
|
// BSP?
|
||||||
void R_ClearClipSegs (void);
|
void R_ClearClipSegs( void );
|
||||||
void R_ClearDrawSegs (void);
|
void R_ClearDrawSegs( void );
|
||||||
|
|
||||||
|
|
||||||
void R_RenderBSPNode (int bspnum);
|
void R_RenderBSPNode( int bspnum );
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
#include "r_state.h"
|
#include "r_state.h"
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Retrieve column data for span blitting.
|
// Retrieve column data for span blitting.
|
||||||
|
@ -44,20 +44,20 @@ R_GetColumn
|
||||||
|
|
||||||
|
|
||||||
// I/O, setting up the stuff.
|
// I/O, setting up the stuff.
|
||||||
void R_InitData (void);
|
void R_InitData( void );
|
||||||
void R_PrecacheLevel (void);
|
void R_PrecacheLevel( void );
|
||||||
|
|
||||||
|
|
||||||
// Retrieval.
|
// Retrieval.
|
||||||
// Floor/ceiling opaque texture tiles,
|
// Floor/ceiling opaque texture tiles,
|
||||||
// lookup by name. For animation?
|
// lookup by name. For animation?
|
||||||
int R_FlatNumForName ( const char* name);
|
int R_FlatNumForName( const char* name );
|
||||||
|
|
||||||
|
|
||||||
// Called by P_Ticker for switches and animations,
|
// Called by P_Ticker for switches and animations,
|
||||||
// returns the texture number for the texture name.
|
// returns the texture number for the texture name.
|
||||||
int R_TextureNumForName (const char *name);
|
int R_TextureNumForName( const char* name );
|
||||||
int R_CheckTextureNumForName ( const char *name);
|
int R_CheckTextureNumForName( const char* name );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,8 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
//
|
//
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
fixed_t x;
|
fixed_t x;
|
||||||
fixed_t y;
|
fixed_t y;
|
||||||
|
|
||||||
} vertex_t;
|
} vertex_t;
|
||||||
|
|
||||||
|
@ -87,10 +87,10 @@ struct line_s;
|
||||||
// updated.
|
// updated.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
thinker_t thinker; // not used for anything
|
thinker_t thinker; // not used for anything
|
||||||
fixed_t x;
|
fixed_t x;
|
||||||
fixed_t y;
|
fixed_t y;
|
||||||
fixed_t z;
|
fixed_t z;
|
||||||
|
|
||||||
} degenmobj_t;
|
} degenmobj_t;
|
||||||
|
|
||||||
|
@ -100,37 +100,37 @@ typedef struct
|
||||||
//
|
//
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
fixed_t floorheight;
|
fixed_t floorheight;
|
||||||
fixed_t ceilingheight;
|
fixed_t ceilingheight;
|
||||||
short floorpic;
|
short floorpic;
|
||||||
short ceilingpic;
|
short ceilingpic;
|
||||||
short lightlevel;
|
short lightlevel;
|
||||||
short special;
|
short special;
|
||||||
short tag;
|
short tag;
|
||||||
|
|
||||||
// 0 = untraversed, 1,2 = sndlines -1
|
// 0 = untraversed, 1,2 = sndlines -1
|
||||||
int soundtraversed;
|
int soundtraversed;
|
||||||
|
|
||||||
// thing that made a sound (or null)
|
// thing that made a sound (or null)
|
||||||
mobj_t* soundtarget;
|
mobj_t* soundtarget;
|
||||||
|
|
||||||
// mapblock bounding box for height changes
|
// mapblock bounding box for height changes
|
||||||
int blockbox[4];
|
int blockbox[4];
|
||||||
|
|
||||||
// origin for any sounds played by the sector
|
// origin for any sounds played by the sector
|
||||||
degenmobj_t soundorg;
|
degenmobj_t soundorg;
|
||||||
|
|
||||||
// if == validcount, already checked
|
// if == validcount, already checked
|
||||||
int validcount;
|
int validcount;
|
||||||
|
|
||||||
// list of mobjs in sector
|
// list of mobjs in sector
|
||||||
mobj_t* thinglist;
|
mobj_t* thinglist;
|
||||||
|
|
||||||
// thinker_t for reversable actions
|
// thinker_t for reversable actions
|
||||||
void* specialdata;
|
void* specialdata;
|
||||||
|
|
||||||
int linecount;
|
int linecount;
|
||||||
struct line_s** lines; // [linecount] size
|
struct line_s** lines; // [linecount] size
|
||||||
|
|
||||||
} sector_t;
|
} sector_t;
|
||||||
|
|
||||||
|
@ -143,20 +143,20 @@ typedef struct
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// add this to the calculated texture column
|
// add this to the calculated texture column
|
||||||
fixed_t textureoffset;
|
fixed_t textureoffset;
|
||||||
|
|
||||||
// add this to the calculated texture top
|
// add this to the calculated texture top
|
||||||
fixed_t rowoffset;
|
fixed_t rowoffset;
|
||||||
|
|
||||||
// Texture indices.
|
// Texture indices.
|
||||||
// We do not maintain names here.
|
// We do not maintain names here.
|
||||||
short toptexture;
|
short toptexture;
|
||||||
short bottomtexture;
|
short bottomtexture;
|
||||||
short midtexture;
|
short midtexture;
|
||||||
|
|
||||||
// Sector the SideDef is facing.
|
// Sector the SideDef is facing.
|
||||||
sector_t* sector;
|
sector_t* sector;
|
||||||
|
|
||||||
} side_t;
|
} side_t;
|
||||||
|
|
||||||
|
@ -167,10 +167,10 @@ typedef struct
|
||||||
//
|
//
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
ST_HORIZONTAL,
|
ST_HORIZONTAL,
|
||||||
ST_VERTICAL,
|
ST_VERTICAL,
|
||||||
ST_POSITIVE,
|
ST_POSITIVE,
|
||||||
ST_NEGATIVE
|
ST_NEGATIVE
|
||||||
|
|
||||||
} slopetype_t;
|
} slopetype_t;
|
||||||
|
|
||||||
|
@ -178,40 +178,40 @@ typedef enum
|
||||||
|
|
||||||
typedef struct line_s
|
typedef struct line_s
|
||||||
{
|
{
|
||||||
// Vertices, from v1 to v2.
|
// Vertices, from v1 to v2.
|
||||||
vertex_t* v1;
|
vertex_t* v1;
|
||||||
vertex_t* v2;
|
vertex_t* v2;
|
||||||
|
|
||||||
// Precalculated v2 - v1 for side checking.
|
// Precalculated v2 - v1 for side checking.
|
||||||
fixed_t dx;
|
fixed_t dx;
|
||||||
fixed_t dy;
|
fixed_t dy;
|
||||||
|
|
||||||
// Animation related.
|
// Animation related.
|
||||||
short flags;
|
short flags;
|
||||||
short special;
|
short special;
|
||||||
short tag;
|
short tag;
|
||||||
|
|
||||||
// Visual appearance: SideDefs.
|
// Visual appearance: SideDefs.
|
||||||
// sidenum[1] will be -1 if one sided
|
// sidenum[1] will be -1 if one sided
|
||||||
short sidenum[2];
|
short sidenum[2];
|
||||||
|
|
||||||
// Neat. Another bounding box, for the extent
|
// Neat. Another bounding box, for the extent
|
||||||
// of the LineDef.
|
// of the LineDef.
|
||||||
fixed_t bbox[4];
|
fixed_t bbox[4];
|
||||||
|
|
||||||
// To aid move clipping.
|
// To aid move clipping.
|
||||||
slopetype_t slopetype;
|
slopetype_t slopetype;
|
||||||
|
|
||||||
// Front and back sector.
|
// Front and back sector.
|
||||||
// Note: redundant? Can be retrieved from SideDefs.
|
// Note: redundant? Can be retrieved from SideDefs.
|
||||||
sector_t* frontsector;
|
sector_t* frontsector;
|
||||||
sector_t* backsector;
|
sector_t* backsector;
|
||||||
|
|
||||||
// if == validcount, already checked
|
// if == validcount, already checked
|
||||||
int validcount;
|
int validcount;
|
||||||
|
|
||||||
// thinker_t for reversable actions
|
// thinker_t for reversable actions
|
||||||
void* specialdata;
|
void* specialdata;
|
||||||
} line_t;
|
} line_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -226,9 +226,9 @@ typedef struct line_s
|
||||||
//
|
//
|
||||||
typedef struct subsector_s
|
typedef struct subsector_s
|
||||||
{
|
{
|
||||||
sector_t* sector;
|
sector_t* sector;
|
||||||
short numlines;
|
short numlines;
|
||||||
short firstline;
|
short firstline;
|
||||||
|
|
||||||
} subsector_t;
|
} subsector_t;
|
||||||
|
|
||||||
|
@ -239,21 +239,21 @@ typedef struct subsector_s
|
||||||
//
|
//
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
vertex_t* v1;
|
vertex_t* v1;
|
||||||
vertex_t* v2;
|
vertex_t* v2;
|
||||||
|
|
||||||
fixed_t offset;
|
fixed_t offset;
|
||||||
|
|
||||||
angle_t angle;
|
angle_t angle;
|
||||||
|
|
||||||
side_t* sidedef;
|
side_t* sidedef;
|
||||||
line_t* linedef;
|
line_t* linedef;
|
||||||
|
|
||||||
// Sector references.
|
// Sector references.
|
||||||
// Could be retrieved from linedef, too.
|
// Could be retrieved from linedef, too.
|
||||||
// backsector is NULL for one sided lines
|
// backsector is NULL for one sided lines
|
||||||
sector_t* frontsector;
|
sector_t* frontsector;
|
||||||
sector_t* backsector;
|
sector_t* backsector;
|
||||||
|
|
||||||
} seg_t;
|
} seg_t;
|
||||||
|
|
||||||
|
@ -264,17 +264,17 @@ typedef struct
|
||||||
//
|
//
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// Partition line.
|
// Partition line.
|
||||||
fixed_t x;
|
fixed_t x;
|
||||||
fixed_t y;
|
fixed_t y;
|
||||||
fixed_t dx;
|
fixed_t dx;
|
||||||
fixed_t dy;
|
fixed_t dy;
|
||||||
|
|
||||||
// Bounding box for each child.
|
// Bounding box for each child.
|
||||||
fixed_t bbox[2][4];
|
fixed_t bbox[2][4];
|
||||||
|
|
||||||
// If NF_SUBSECTOR its a subsector.
|
// If NF_SUBSECTOR its a subsector.
|
||||||
unsigned short children[2];
|
unsigned short children[2];
|
||||||
|
|
||||||
} node_t;
|
} node_t;
|
||||||
|
|
||||||
|
@ -284,8 +284,8 @@ typedef struct
|
||||||
// posts are runs of non masked source pixels
|
// posts are runs of non masked source pixels
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
byte topdelta; // -1 is the last post in a column
|
byte topdelta; // -1 is the last post in a column
|
||||||
byte length; // length data bytes follows
|
byte length; // length data bytes follows
|
||||||
} post_t;
|
} post_t;
|
||||||
|
|
||||||
// postColumn_t is a list of 0 or more post_t, (byte)-1 terminated
|
// postColumn_t is a list of 0 or more post_t, (byte)-1 terminated
|
||||||
|
@ -321,28 +321,28 @@ typedef byte lighttable_t;
|
||||||
//
|
//
|
||||||
typedef struct drawseg_s
|
typedef struct drawseg_s
|
||||||
{
|
{
|
||||||
seg_t* curline;
|
seg_t* curline;
|
||||||
int x1;
|
int x1;
|
||||||
int x2;
|
int x2;
|
||||||
|
|
||||||
fixed_t scale1;
|
fixed_t scale1;
|
||||||
fixed_t scale2;
|
fixed_t scale2;
|
||||||
fixed_t scalestep;
|
fixed_t scalestep;
|
||||||
|
|
||||||
// 0=none, 1=bottom, 2=top, 3=both
|
// 0=none, 1=bottom, 2=top, 3=both
|
||||||
int silhouette;
|
int silhouette;
|
||||||
|
|
||||||
// do not clip sprites above this
|
// do not clip sprites above this
|
||||||
fixed_t bsilheight;
|
fixed_t bsilheight;
|
||||||
|
|
||||||
// do not clip sprites below this
|
// do not clip sprites below this
|
||||||
fixed_t tsilheight;
|
fixed_t tsilheight;
|
||||||
|
|
||||||
// Pointers to lists for sprite clipping,
|
// Pointers to lists for sprite clipping,
|
||||||
// all three adjusted so [x1] is first value.
|
// all three adjusted so [x1] is first value.
|
||||||
short* sprtopclip;
|
short* sprtopclip;
|
||||||
short* sprbottomclip;
|
short* sprbottomclip;
|
||||||
short* maskedtexturecol;
|
short* maskedtexturecol;
|
||||||
|
|
||||||
} drawseg_t;
|
} drawseg_t;
|
||||||
|
|
||||||
|
@ -355,12 +355,12 @@ typedef struct drawseg_s
|
||||||
// of patches.
|
// of patches.
|
||||||
struct patch_t
|
struct patch_t
|
||||||
{
|
{
|
||||||
short width; // bounding box size
|
short width; // bounding box size
|
||||||
short height;
|
short height;
|
||||||
short leftoffset; // pixels to the left of origin
|
short leftoffset; // pixels to the left of origin
|
||||||
short topoffset; // pixels below the origin
|
short topoffset; // pixels below the origin
|
||||||
int columnofs[8]; // only [width] used
|
int columnofs[8]; // only [width] used
|
||||||
// the [0] is &columnofs[width]
|
// the [0] is &columnofs[width]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -376,37 +376,37 @@ typedef struct vissprite_s
|
||||||
{
|
{
|
||||||
int suck; //Compiler opt fix...wtf
|
int suck; //Compiler opt fix...wtf
|
||||||
|
|
||||||
// Doubly linked list.
|
// Doubly linked list.
|
||||||
struct vissprite_s* prev;
|
struct vissprite_s* prev;
|
||||||
struct vissprite_s* next;
|
struct vissprite_s* next;
|
||||||
|
|
||||||
int x1;
|
int x1;
|
||||||
int x2;
|
int x2;
|
||||||
|
|
||||||
// for line side calculation
|
// for line side calculation
|
||||||
fixed_t gx;
|
fixed_t gx;
|
||||||
fixed_t gy;
|
fixed_t gy;
|
||||||
|
|
||||||
// global bottom / top for silhouette clipping
|
// global bottom / top for silhouette clipping
|
||||||
fixed_t gz;
|
fixed_t gz;
|
||||||
fixed_t gzt;
|
fixed_t gzt;
|
||||||
|
|
||||||
// horizontal position of x1
|
// horizontal position of x1
|
||||||
fixed_t startfrac;
|
fixed_t startfrac;
|
||||||
|
|
||||||
fixed_t scale;
|
fixed_t scale;
|
||||||
|
|
||||||
// negative if flipped
|
// negative if flipped
|
||||||
fixed_t xiscale;
|
fixed_t xiscale;
|
||||||
|
|
||||||
fixed_t texturemid;
|
fixed_t texturemid;
|
||||||
int patch;
|
int patch;
|
||||||
|
|
||||||
// for color translation and shadow draw,
|
// for color translation and shadow draw,
|
||||||
// maxbright frames as well
|
// maxbright frames as well
|
||||||
lighttable_t* colormap;
|
lighttable_t* colormap;
|
||||||
|
|
||||||
int mobjflags;
|
int mobjflags;
|
||||||
} vissprite_t;
|
} vissprite_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -427,16 +427,16 @@ typedef struct vissprite_s
|
||||||
//
|
//
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// If false use 0 for any position.
|
// If false use 0 for any position.
|
||||||
// Note: as eight entries are available,
|
// Note: as eight entries are available,
|
||||||
// we might as well insert the same name eight times.
|
// we might as well insert the same name eight times.
|
||||||
qboolean rotate;
|
qboolean rotate;
|
||||||
|
|
||||||
// Lump to use for view angles 0-7.
|
// Lump to use for view angles 0-7.
|
||||||
short lump[8];
|
short lump[8];
|
||||||
|
|
||||||
// Flip bit (1 = flip) to use for view angles 0-7.
|
// Flip bit (1 = flip) to use for view angles 0-7.
|
||||||
byte flip[8];
|
byte flip[8];
|
||||||
|
|
||||||
} spriteframe_t;
|
} spriteframe_t;
|
||||||
|
|
||||||
|
@ -448,8 +448,8 @@ typedef struct
|
||||||
//
|
//
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int numframes;
|
int numframes;
|
||||||
spriteframe_t* spriteframes;
|
spriteframe_t* spriteframes;
|
||||||
|
|
||||||
} spritedef_t;
|
} spritedef_t;
|
||||||
|
|
||||||
|
@ -460,30 +460,30 @@ typedef struct
|
||||||
//
|
//
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
fixed_t height;
|
fixed_t height;
|
||||||
int picnum;
|
int picnum;
|
||||||
int lightlevel;
|
int lightlevel;
|
||||||
int minx;
|
int minx;
|
||||||
int maxx;
|
int maxx;
|
||||||
|
|
||||||
// leave pads for [minx-1]/[maxx+1]
|
// leave pads for [minx-1]/[maxx+1]
|
||||||
int nervePad1;
|
int nervePad1;
|
||||||
int nervePad2;
|
int nervePad2;
|
||||||
byte nervePad3;
|
byte nervePad3;
|
||||||
byte nervePad4;
|
byte nervePad4;
|
||||||
byte nervePad5;
|
byte nervePad5;
|
||||||
|
|
||||||
byte pad1;
|
byte pad1;
|
||||||
// Here lies the rub for all
|
// Here lies the rub for all
|
||||||
// dynamic resize/change of resolution.
|
// dynamic resize/change of resolution.
|
||||||
//unsigned short top[65535]; // [SCREENWIDTH];
|
//unsigned short top[65535]; // [SCREENWIDTH];
|
||||||
unsigned short top[SCREENWIDTH];
|
unsigned short top[SCREENWIDTH];
|
||||||
byte pad2;
|
byte pad2;
|
||||||
byte pad3;
|
byte pad3;
|
||||||
// See above.
|
// See above.
|
||||||
//unsigned short bottom[65535]; // [SCREENWIDTH];
|
//unsigned short bottom[65535]; // [SCREENWIDTH];
|
||||||
unsigned short bottom[SCREENWIDTH];
|
unsigned short bottom[SCREENWIDTH];
|
||||||
byte pad4;
|
byte pad4;
|
||||||
|
|
||||||
} visplane_t;
|
} visplane_t;
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue