mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-06-02 01:31:45 +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)
|
||||
#endif
|
||||
|
||||
struct SplitscreenData {
|
||||
struct SplitscreenData
|
||||
{
|
||||
int PLAYERCOUNT;
|
||||
int globalSkill;
|
||||
int globalEpisode;
|
||||
|
@ -55,7 +56,7 @@ struct SplitscreenData {
|
|||
int globalFragLimit;
|
||||
};
|
||||
|
||||
void DL_InitNetworking( DoomInterface *pdi );
|
||||
void DL_InitNetworking( DoomInterface* pdi );
|
||||
|
||||
extern int PLAYERCOUNT;
|
||||
extern bool globalNetworking;
|
||||
|
@ -68,7 +69,8 @@ extern int globalNeedUpsell;
|
|||
extern bool globalPauseTime;
|
||||
|
||||
|
||||
enum MenuStates{
|
||||
enum MenuStates
|
||||
{
|
||||
MENU_NONE,
|
||||
MENU_XBOX_SYSTEM,
|
||||
MENU_PAUSE,
|
||||
|
@ -90,10 +92,11 @@ enum MenuStates{
|
|||
MENU_COUNT
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int maxPing;
|
||||
|
||||
const wchar_t * image;
|
||||
const wchar_t* image;
|
||||
} PingImage_t;
|
||||
|
||||
extern PingImage_t pingsImages[];
|
||||
|
|
|
@ -71,10 +71,10 @@ typedef unsigned int dword;
|
|||
// DG: provide MAXINT seems to be available on MSVC but not MinGW,
|
||||
// so use the standard defines from limits.h
|
||||
#ifndef MAXINT
|
||||
#define MAXINT INT_MAX
|
||||
#define MAXINT INT_MAX
|
||||
#endif
|
||||
|
||||
#ifndef MININT
|
||||
#define MININT INT_MIN
|
||||
#define MININT INT_MIN
|
||||
#endif
|
||||
// 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.
|
||||
qboolean AM_Responder (event_t* ev);
|
||||
qboolean AM_Responder( event_t* ev );
|
||||
|
||||
// Called by main loop.
|
||||
void AM_Ticker (void);
|
||||
void AM_Ticker( void );
|
||||
|
||||
// Called by main loop,
|
||||
// called instead of view drawer if automap active.
|
||||
void AM_Drawer (void);
|
||||
void AM_Drawer( void );
|
||||
|
||||
// Called to force the automap to quit
|
||||
// if the level is completed while it is up.
|
||||
void AM_Stop (void);
|
||||
void AM_Stop( void );
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -26,267 +26,291 @@ 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 //
|
||||
::g->cheating = 0;
|
||||
::g->grid = 0;
|
||||
::g->leveljuststarted = 1; // kluge until AM_LevelInit() is called
|
||||
::g->automapactive = false;
|
||||
::g->finit_width = SCREENWIDTH;
|
||||
::g->finit_height = SCREENHEIGHT - (32 * GLOBAL_IMAGE_SCALER);
|
||||
::g->scale_mtof = (fixed_t)INITSCALEMTOF;
|
||||
::g->markpointnum = 0; // next point to be assigned
|
||||
::g->followplayer = 1; // specifies whether to follow the player around
|
||||
::g->stopped = true;
|
||||
::g->lastlevel = -1;
|
||||
::g->lastepisode = -1;
|
||||
::g->cheatstate=0;
|
||||
::g->bigstate=0;
|
||||
::g->nexttic = 0;
|
||||
::g->litelevelscnt = 0;
|
||||
::g->cheating = 0;
|
||||
::g->grid = 0;
|
||||
::g->leveljuststarted = 1; // kluge until AM_LevelInit() is called
|
||||
::g->automapactive = false;
|
||||
::g->finit_width = SCREENWIDTH;
|
||||
::g->finit_height = SCREENHEIGHT - ( 32 * GLOBAL_IMAGE_SCALER );
|
||||
::g->scale_mtof = ( fixed_t )INITSCALEMTOF;
|
||||
::g->markpointnum = 0; // next point to be assigned
|
||||
::g->followplayer = 1; // specifies whether to follow the player around
|
||||
::g->stopped = true;
|
||||
::g->lastlevel = -1;
|
||||
::g->lastepisode = -1;
|
||||
::g->cheatstate = 0;
|
||||
::g->bigstate = 0;
|
||||
::g->nexttic = 0;
|
||||
::g->litelevelscnt = 0;
|
||||
// am_map.constructs end //
|
||||
// doomstat.constructs begin //
|
||||
::g->gamemode = indetermined;
|
||||
::g->gamemission = doom;
|
||||
::g->language = english;
|
||||
::g->gamemode = indetermined;
|
||||
::g->gamemission = doom;
|
||||
::g->language = english;
|
||||
// doomstat.constructs end //
|
||||
// d_main.constructs begin //
|
||||
::g->singletics = false; // debug flag to cancel adaptiveness
|
||||
::g->oldgamestate = (gamestate_t)-1;
|
||||
::g->wipegamestate = GS_DEMOSCREEN;
|
||||
::g->viewactivestate = false;
|
||||
::g->menuactivestate = false;
|
||||
::g->inhelpscreensstate = false;
|
||||
::g->fullscreen = false;
|
||||
::g->wipe = false;
|
||||
::g->wipedone = true;
|
||||
::g->singletics = false; // debug flag to cancel adaptiveness
|
||||
::g->oldgamestate = ( gamestate_t ) - 1;
|
||||
::g->wipegamestate = GS_DEMOSCREEN;
|
||||
::g->viewactivestate = false;
|
||||
::g->menuactivestate = false;
|
||||
::g->inhelpscreensstate = false;
|
||||
::g->fullscreen = false;
|
||||
::g->wipe = false;
|
||||
::g->wipedone = true;
|
||||
// d_main.constructs end //
|
||||
// d_net.constructs begin //
|
||||
doomcom_t temp_doomcom = {
|
||||
doomcom_t temp_doomcom =
|
||||
{
|
||||
0
|
||||
};
|
||||
memcpy( &::g->doomcom, &temp_doomcom, sizeof(temp_doomcom) );
|
||||
memcpy( &::g->doomcom, &temp_doomcom, sizeof( temp_doomcom ) );
|
||||
// d_net.constructs end //
|
||||
// f_wipe.constructs begin //
|
||||
::g->go = 0;
|
||||
::g->go = 0;
|
||||
// f_wipe.constructs end //
|
||||
// g_game.constructs begin //
|
||||
::g->precache = true; // if true, load all graphics at start
|
||||
fixed_t temp_forwardmove[2] = {
|
||||
0x19, 0x32
|
||||
::g->precache = true; // if true, load all graphics at start
|
||||
fixed_t temp_forwardmove[2] =
|
||||
{
|
||||
0x19, 0x32
|
||||
};
|
||||
memcpy( ::g->forwardmove, temp_forwardmove, sizeof(temp_forwardmove) );
|
||||
fixed_t temp_sidemove[2] = {
|
||||
0x18, 0x28
|
||||
memcpy( ::g->forwardmove, temp_forwardmove, sizeof( temp_forwardmove ) );
|
||||
fixed_t temp_sidemove[2] =
|
||||
{
|
||||
0x18, 0x28
|
||||
};
|
||||
memcpy( ::g->sidemove, temp_sidemove, sizeof(temp_sidemove) );
|
||||
fixed_t temp_angleturn[3] = {
|
||||
640, 1280, 320 // + slow turn
|
||||
memcpy( ::g->sidemove, temp_sidemove, sizeof( temp_sidemove ) );
|
||||
fixed_t temp_angleturn[3] =
|
||||
{
|
||||
640, 1280, 320 // + slow turn
|
||||
};
|
||||
memcpy( ::g->angleturn, temp_angleturn, sizeof(temp_angleturn) );
|
||||
::g->mousebuttons = &::g->mousearray[1]; // allow [-1]
|
||||
::g->joybuttons = &::g->joyarray[1]; // allow [-1]
|
||||
memcpy( ::g->angleturn, temp_angleturn, sizeof( temp_angleturn ) );
|
||||
::g->mousebuttons = &::g->mousearray[1]; // allow [-1]
|
||||
::g->joybuttons = &::g->joyarray[1]; // allow [-1]
|
||||
// g_game.constructs end //
|
||||
// hu_lib.constructs begin //
|
||||
::g->lastautomapactive = true;
|
||||
::g->lastautomapactive = true;
|
||||
// hu_lib.constructs end //
|
||||
// hu_stuff.constructs begin //
|
||||
::g->always_off = false;
|
||||
::g->headsupactive = false;
|
||||
::g->head = 0;
|
||||
::g->tail = 0;
|
||||
::g->shiftdown = false;
|
||||
::g->altdown = false;
|
||||
::g->num_nobrainers = 0;
|
||||
::g->always_off = false;
|
||||
::g->headsupactive = false;
|
||||
::g->head = 0;
|
||||
::g->tail = 0;
|
||||
::g->shiftdown = false;
|
||||
::g->altdown = false;
|
||||
::g->num_nobrainers = 0;
|
||||
// hu_stuff.constructs end //
|
||||
// i_input.constructs begin //
|
||||
// i_input.constructs end //
|
||||
// i_system.constructs begin //
|
||||
::g->mb_used = 2;
|
||||
::g->current_time = 0;
|
||||
::g->mb_used = 2;
|
||||
::g->current_time = 0;
|
||||
// i_system.constructs end //
|
||||
// m_cheat.constructs begin //
|
||||
::g->firsttime = 1;
|
||||
::g->usedcheatbuffer = 0;
|
||||
::g->firsttime = 1;
|
||||
::g->usedcheatbuffer = 0;
|
||||
// m_cheat.constructs end //
|
||||
// m_menu.constructs begin //
|
||||
|
||||
menuitem_t temp_QuitMenu[3] = {
|
||||
{1,"M_ACPT", M_ExitGame,'a'},
|
||||
{1,"M_CAN", M_CancelExit,'c'},
|
||||
{1,"M_CHG", M_GameSelection,'g'}
|
||||
menuitem_t temp_QuitMenu[3] =
|
||||
{
|
||||
{1, "M_ACPT", M_ExitGame, 'a'},
|
||||
{1, "M_CAN", M_CancelExit, 'c'},
|
||||
{1, "M_CHG", M_GameSelection, 'g'}
|
||||
};
|
||||
memcpy( ::g->QuitMenu, temp_QuitMenu, sizeof(temp_QuitMenu) );
|
||||
menu_t temp_QuitDef = {
|
||||
memcpy( ::g->QuitMenu, temp_QuitMenu, sizeof( temp_QuitMenu ) );
|
||||
menu_t temp_QuitDef =
|
||||
{
|
||||
qut_end, // # of menu items
|
||||
&::g->MainDef, // previous menu
|
||||
::g->QuitMenu, // menuitem_t ->
|
||||
M_DrawQuit, // drawing routine ->
|
||||
48,63, // x,y
|
||||
48, 63, // x,y
|
||||
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_OPTION",M_Options,'o'},
|
||||
{1,"M_LOADG",M_LoadGame,'l'},
|
||||
{1,"M_SAVEG",M_SaveGame,'m'},
|
||||
{1, "M_NGAME", M_NewGame, 'n'},
|
||||
{1, "M_OPTION", M_Options, 'o'},
|
||||
{1, "M_LOADG", M_LoadGame, 'l'},
|
||||
{1, "M_SAVEG", M_SaveGame, 'm'},
|
||||
// Another hickup with Special edition.
|
||||
//{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) );
|
||||
menu_t temp_MainDef = {
|
||||
memcpy( &::g->MainMenu, temp_MainMenu, sizeof( temp_MainMenu ) );
|
||||
menu_t temp_MainDef =
|
||||
{
|
||||
main_end,
|
||||
NULL,
|
||||
::g->MainMenu,
|
||||
M_DrawMainMenu,
|
||||
97,64,
|
||||
97, 64,
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
memcpy( &::g->MainDef, &temp_MainDef, sizeof(temp_MainDef) );
|
||||
menuitem_t temp_EpisodeMenu[4] = {
|
||||
{1,"M_EPI1", M_Episode,'k'},
|
||||
{1,"M_EPI2", M_Episode,'t'},
|
||||
{1,"M_EPI3", M_Episode,'i'},
|
||||
{1,"M_EPI4", M_Episode,'t'}
|
||||
memcpy( &::g->MainDef, &temp_MainDef, sizeof( temp_MainDef ) );
|
||||
menuitem_t temp_EpisodeMenu[4] =
|
||||
{
|
||||
{1, "M_EPI1", M_Episode, 'k'},
|
||||
{1, "M_EPI2", M_Episode, 't'},
|
||||
{1, "M_EPI3", M_Episode, 'i'},
|
||||
{1, "M_EPI4", M_Episode, 't'}
|
||||
};
|
||||
memcpy( ::g->EpisodeMenu, temp_EpisodeMenu, sizeof(temp_EpisodeMenu) );
|
||||
menu_t temp_EpiDef = {
|
||||
memcpy( ::g->EpisodeMenu, temp_EpisodeMenu, sizeof( temp_EpisodeMenu ) );
|
||||
menu_t temp_EpiDef =
|
||||
{
|
||||
ep_end, // # of menu items
|
||||
&::g->MainDef, // previous menu
|
||||
::g->EpisodeMenu, // menuitem_t ->
|
||||
M_DrawEpisode, // drawing routine ->
|
||||
48,63, // x,y
|
||||
48, 63, // x,y
|
||||
ep1 // lastOn
|
||||
};
|
||||
memcpy( &::g->EpiDef, &temp_EpiDef, sizeof(temp_EpiDef) );
|
||||
memcpy( &::g->EpiDef, &temp_EpiDef, sizeof( temp_EpiDef ) );
|
||||
|
||||
menuitem_t temp_ExpansionMenu[2] = {
|
||||
{1,"M_EPI1", M_Expansion,'h'},
|
||||
{1,"M_EPI2", M_Expansion,'n'},
|
||||
menuitem_t temp_ExpansionMenu[2] =
|
||||
{
|
||||
{1, "M_EPI1", M_Expansion, 'h'},
|
||||
{1, "M_EPI2", M_Expansion, 'n'},
|
||||
};
|
||||
memcpy( ::g->ExpansionMenu, temp_ExpansionMenu, sizeof(temp_ExpansionMenu) );
|
||||
menu_t temp_ExpDef = {
|
||||
memcpy( ::g->ExpansionMenu, temp_ExpansionMenu, sizeof( temp_ExpansionMenu ) );
|
||||
menu_t temp_ExpDef =
|
||||
{
|
||||
ex_end, // # of menu items
|
||||
&::g->MainDef, // previous menu
|
||||
::g->ExpansionMenu, // menuitem_t ->
|
||||
M_DrawEpisode, // drawing routine ->
|
||||
48,63, // x,y
|
||||
48, 63, // x,y
|
||||
ex1 // lastOn
|
||||
};
|
||||
memcpy( &::g->ExpDef, &temp_ExpDef, sizeof(temp_ExpDef) );
|
||||
memcpy( &::g->ExpDef, &temp_ExpDef, sizeof( temp_ExpDef ) );
|
||||
|
||||
menuitem_t temp_LoadExpMenu[2] = {
|
||||
{1,"M_EPI1", M_LoadExpansion,'h'},
|
||||
{1,"M_EPI2", M_LoadExpansion,'n'},
|
||||
menuitem_t temp_LoadExpMenu[2] =
|
||||
{
|
||||
{1, "M_EPI1", M_LoadExpansion, 'h'},
|
||||
{1, "M_EPI2", M_LoadExpansion, 'n'},
|
||||
};
|
||||
memcpy( ::g->LoadExpMenu, temp_LoadExpMenu, sizeof(temp_LoadExpMenu) );
|
||||
menu_t temp_LoadExpDef = {
|
||||
memcpy( ::g->LoadExpMenu, temp_LoadExpMenu, sizeof( temp_LoadExpMenu ) );
|
||||
menu_t temp_LoadExpDef =
|
||||
{
|
||||
ex_end, // # of menu items
|
||||
&::g->MainDef, // previous menu
|
||||
::g->LoadExpMenu, // menuitem_t ->
|
||||
M_DrawEpisode, // drawing routine ->
|
||||
48,63, // x,y
|
||||
48, 63, // x,y
|
||||
ex1 // lastOn
|
||||
};
|
||||
memcpy( &::g->LoadExpDef, &temp_LoadExpDef, sizeof(temp_LoadExpDef) );
|
||||
memcpy( &::g->LoadExpDef, &temp_LoadExpDef, sizeof( temp_LoadExpDef ) );
|
||||
|
||||
menuitem_t temp_NewGameMenu[5] = {
|
||||
{1,"M_JKILL", M_ChooseSkill, 'i'},
|
||||
{1,"M_ROUGH", M_ChooseSkill, 'h'},
|
||||
{1,"M_HURT", M_ChooseSkill, 'h'},
|
||||
{1,"M_ULTRA", M_ChooseSkill, 'u'},
|
||||
{1,"M_NMARE", M_ChooseSkill, 'n'}
|
||||
menuitem_t temp_NewGameMenu[5] =
|
||||
{
|
||||
{1, "M_JKILL", M_ChooseSkill, 'i'},
|
||||
{1, "M_ROUGH", M_ChooseSkill, 'h'},
|
||||
{1, "M_HURT", M_ChooseSkill, 'h'},
|
||||
{1, "M_ULTRA", M_ChooseSkill, 'u'},
|
||||
{1, "M_NMARE", M_ChooseSkill, 'n'}
|
||||
};
|
||||
memcpy( ::g->NewGameMenu, temp_NewGameMenu, sizeof(temp_NewGameMenu) );
|
||||
menu_t temp_NewDef = {
|
||||
memcpy( ::g->NewGameMenu, temp_NewGameMenu, sizeof( temp_NewGameMenu ) );
|
||||
menu_t temp_NewDef =
|
||||
{
|
||||
newg_end, // # of menu items
|
||||
&::g->EpiDef, // previous menu
|
||||
::g->NewGameMenu, // menuitem_t ->
|
||||
M_DrawNewGame, // drawing routine ->
|
||||
48,63, // x,y
|
||||
48, 63, // x,y
|
||||
hurtme // lastOn
|
||||
};
|
||||
memcpy( &::g->NewDef, &temp_NewDef, sizeof(temp_NewDef) );
|
||||
menuitem_t temp_OptionsMenu[8] = {
|
||||
{1,"M_GDHIGH", M_FullScreen,'f'},
|
||||
{1,"M_SCRNSZ", M_ChangeGPad,'m'},
|
||||
{1,"M_MESSG", M_ChangeMessages,'m'},
|
||||
memcpy( &::g->NewDef, &temp_NewDef, sizeof( temp_NewDef ) );
|
||||
menuitem_t temp_OptionsMenu[8] =
|
||||
{
|
||||
{1, "M_GDHIGH", M_FullScreen, 'f'},
|
||||
{1, "M_SCRNSZ", M_ChangeGPad, 'm'},
|
||||
{1, "M_MESSG", M_ChangeMessages, 'm'},
|
||||
//{1,"M_DETAIL", M_ChangeDetail,'g'},
|
||||
//{2,"M_SCRNSZ", M_SizeDisplay,'s'},
|
||||
{-1,"",0},
|
||||
{2,"M_MSENS", M_ChangeSensitivity,'m'},
|
||||
{-1,"",0},
|
||||
{1,"M_SVOL", M_Sound,'s'}
|
||||
{ -1, "", 0},
|
||||
{2, "M_MSENS", M_ChangeSensitivity, 'm'},
|
||||
{ -1, "", 0},
|
||||
{1, "M_SVOL", M_Sound, 's'}
|
||||
};
|
||||
memcpy( ::g->OptionsMenu, temp_OptionsMenu, sizeof(temp_OptionsMenu) );
|
||||
menu_t temp_OptionsDef = {
|
||||
memcpy( ::g->OptionsMenu, temp_OptionsMenu, sizeof( temp_OptionsMenu ) );
|
||||
menu_t temp_OptionsDef =
|
||||
{
|
||||
opt_end,
|
||||
&::g->MainDef,
|
||||
::g->OptionsMenu,
|
||||
M_DrawOptions,
|
||||
60,37,
|
||||
60, 37,
|
||||
0
|
||||
};
|
||||
memcpy( &::g->OptionsDef, &temp_OptionsDef, sizeof(temp_OptionsDef) );
|
||||
menuitem_t temp_SoundMenu[4] = {
|
||||
{2,"M_SFXVOL",M_SfxVol,'s'},
|
||||
{-1,"",0},
|
||||
{2,"M_MUSVOL",M_MusicVol,'m'},
|
||||
{-1,"",0}
|
||||
memcpy( &::g->OptionsDef, &temp_OptionsDef, sizeof( temp_OptionsDef ) );
|
||||
menuitem_t temp_SoundMenu[4] =
|
||||
{
|
||||
{2, "M_SFXVOL", M_SfxVol, 's'},
|
||||
{ -1, "", 0},
|
||||
{2, "M_MUSVOL", M_MusicVol, 'm'},
|
||||
{ -1, "", 0}
|
||||
};
|
||||
memcpy( ::g->SoundMenu, temp_SoundMenu, sizeof(temp_SoundMenu) );
|
||||
menu_t temp_SoundDef = {
|
||||
memcpy( ::g->SoundMenu, temp_SoundMenu, sizeof( temp_SoundMenu ) );
|
||||
menu_t temp_SoundDef =
|
||||
{
|
||||
sound_end,
|
||||
&::g->OptionsDef,
|
||||
::g->SoundMenu,
|
||||
M_DrawSound,
|
||||
80,64,
|
||||
80, 64,
|
||||
0
|
||||
};
|
||||
memcpy( &::g->SoundDef, &temp_SoundDef, sizeof(temp_SoundDef) );
|
||||
menuitem_t temp_LoadMenu[6] = {
|
||||
{1,"", M_LoadSelect,'1'},
|
||||
{1,"", M_LoadSelect,'2'},
|
||||
{1,"", M_LoadSelect,'3'},
|
||||
{1,"", M_LoadSelect,'4'},
|
||||
{1,"", M_LoadSelect,'5'},
|
||||
{1,"", M_LoadSelect,'6'}
|
||||
memcpy( &::g->SoundDef, &temp_SoundDef, sizeof( temp_SoundDef ) );
|
||||
menuitem_t temp_LoadMenu[6] =
|
||||
{
|
||||
{1, "", M_LoadSelect, '1'},
|
||||
{1, "", M_LoadSelect, '2'},
|
||||
{1, "", M_LoadSelect, '3'},
|
||||
{1, "", M_LoadSelect, '4'},
|
||||
{1, "", M_LoadSelect, '5'},
|
||||
{1, "", M_LoadSelect, '6'}
|
||||
};
|
||||
memcpy( ::g->LoadMenu, temp_LoadMenu, sizeof(temp_LoadMenu) );
|
||||
menu_t temp_LoadDef = {
|
||||
memcpy( ::g->LoadMenu, temp_LoadMenu, sizeof( temp_LoadMenu ) );
|
||||
menu_t temp_LoadDef =
|
||||
{
|
||||
load_end,
|
||||
&::g->MainDef,
|
||||
::g->LoadMenu,
|
||||
M_DrawLoad,
|
||||
80,54,
|
||||
80, 54,
|
||||
0
|
||||
};
|
||||
memcpy( &::g->LoadDef, &temp_LoadDef, sizeof(temp_LoadDef) );
|
||||
menuitem_t temp_SaveMenu[6] = {
|
||||
{1,"", M_SaveSelect,'1'},
|
||||
{1,"", M_SaveSelect,'2'},
|
||||
{1,"", M_SaveSelect,'3'},
|
||||
{1,"", M_SaveSelect,'4'},
|
||||
{1,"", M_SaveSelect,'5'},
|
||||
{1,"", M_SaveSelect,'6'}
|
||||
memcpy( &::g->LoadDef, &temp_LoadDef, sizeof( temp_LoadDef ) );
|
||||
menuitem_t temp_SaveMenu[6] =
|
||||
{
|
||||
{1, "", M_SaveSelect, '1'},
|
||||
{1, "", M_SaveSelect, '2'},
|
||||
{1, "", M_SaveSelect, '3'},
|
||||
{1, "", M_SaveSelect, '4'},
|
||||
{1, "", M_SaveSelect, '5'},
|
||||
{1, "", M_SaveSelect, '6'}
|
||||
};
|
||||
memcpy( ::g->SaveMenu, temp_SaveMenu, sizeof(temp_SaveMenu) );
|
||||
menu_t temp_SaveDef = {
|
||||
memcpy( ::g->SaveMenu, temp_SaveMenu, sizeof( temp_SaveMenu ) );
|
||||
menu_t temp_SaveDef =
|
||||
{
|
||||
load_end,
|
||||
&::g->MainDef,
|
||||
::g->SaveMenu,
|
||||
M_DrawSave,
|
||||
80,54,
|
||||
80, 54,
|
||||
0
|
||||
};
|
||||
memcpy( &::g->SaveDef, &temp_SaveDef, sizeof(temp_SaveDef) );
|
||||
int temp_quitsounds[8] = {
|
||||
memcpy( &::g->SaveDef, &temp_SaveDef, sizeof( temp_SaveDef ) );
|
||||
int temp_quitsounds[8] =
|
||||
{
|
||||
sfx_pldeth,
|
||||
sfx_dmpain,
|
||||
sfx_popain,
|
||||
|
@ -296,8 +320,9 @@ int temp_quitsounds[8] = {
|
|||
sfx_posit3,
|
||||
sfx_sgtatk
|
||||
};
|
||||
memcpy( ::g->quitsounds, temp_quitsounds, sizeof(temp_quitsounds) );
|
||||
int temp_quitsounds2[8] = {
|
||||
memcpy( ::g->quitsounds, temp_quitsounds, sizeof( temp_quitsounds ) );
|
||||
int temp_quitsounds2[8] =
|
||||
{
|
||||
sfx_vilact,
|
||||
sfx_getpow,
|
||||
sfx_boscub,
|
||||
|
@ -307,59 +332,60 @@ int temp_quitsounds2[8] = {
|
|||
sfx_bspact,
|
||||
sfx_sgtatk
|
||||
};
|
||||
memcpy( ::g->quitsounds2, temp_quitsounds2, sizeof(temp_quitsounds2) );
|
||||
::g->joywait = 0;
|
||||
::g->mousewait = 0;
|
||||
::g->mmenu_mousey = 0;
|
||||
::g->lasty = 0;
|
||||
::g->mmenu_mousex = 0;
|
||||
::g->lastx = 0;
|
||||
memcpy( ::g->quitsounds2, temp_quitsounds2, sizeof( temp_quitsounds2 ) );
|
||||
::g->joywait = 0;
|
||||
::g->mousewait = 0;
|
||||
::g->mmenu_mousey = 0;
|
||||
::g->lasty = 0;
|
||||
::g->mmenu_mousex = 0;
|
||||
::g->lastx = 0;
|
||||
// m_menu.constructs end //
|
||||
// m_misc.constructs begin //
|
||||
::g->g_pszSaveFile = "\\save.dat";
|
||||
::g->g_pszImagePath = "d:\\saveimage.xbx";
|
||||
::g->g_pszImageMeta = "saveimage.xbx";
|
||||
extern const char* const temp_chat_macros[];
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
::g->g_pszSaveFile = "\\save.dat";
|
||||
::g->g_pszImagePath = "d:\\saveimage.xbx";
|
||||
::g->g_pszImageMeta = "saveimage.xbx";
|
||||
extern const char* const temp_chat_macros[];
|
||||
for( int i = 0; i < 10; i++ )
|
||||
{
|
||||
chat_macros[i] = temp_chat_macros[i];
|
||||
}
|
||||
default_t temp_defaults[35] = {
|
||||
default_t( "mouse_sensitivity",&::g->mouseSensitivity, 7 ),
|
||||
}
|
||||
default_t temp_defaults[35] =
|
||||
{
|
||||
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_left",&::g->key_left, KEY_LEFTARROW ),
|
||||
default_t( "key_up",&::g->key_up, KEY_UPARROW ),
|
||||
default_t( "key_down",&::g->key_down, KEY_DOWNARROW ),
|
||||
default_t( "key_strafeleft",&::g->key_strafeleft, ',' ),
|
||||
default_t( "key_straferight",&::g->key_straferight, '.' ),
|
||||
default_t( "key_right", &::g->key_right, KEY_RIGHTARROW ),
|
||||
default_t( "key_left", &::g->key_left, KEY_LEFTARROW ),
|
||||
default_t( "key_up", &::g->key_up, KEY_UPARROW ),
|
||||
default_t( "key_down", &::g->key_down, KEY_DOWNARROW ),
|
||||
default_t( "key_strafeleft", &::g->key_strafeleft, ',' ),
|
||||
default_t( "key_straferight", &::g->key_straferight, '.' ),
|
||||
|
||||
default_t( "key_fire",&::g->key_fire, KEY_RCTRL ),
|
||||
default_t( "key_use",&::g->key_use, ' ' ),
|
||||
default_t( "key_strafe",&::g->key_strafe, KEY_RALT ),
|
||||
default_t( "key_speed",&::g->key_speed, KEY_RSHIFT ),
|
||||
default_t( "key_fire", &::g->key_fire, KEY_RCTRL ),
|
||||
default_t( "key_use", &::g->key_use, ' ' ),
|
||||
default_t( "key_strafe", &::g->key_strafe, KEY_RALT ),
|
||||
default_t( "key_speed", &::g->key_speed, KEY_RSHIFT ),
|
||||
|
||||
default_t( "use_mouse",&::g->usemouse, 1 ),
|
||||
default_t( "mouseb_fire",&::g->mousebfire,0 ),
|
||||
default_t( "mouseb_strafe",&::g->mousebstrafe,1 ),
|
||||
default_t( "mouseb_forward",&::g->mousebforward,2 ),
|
||||
default_t( "use_mouse", &::g->usemouse, 1 ),
|
||||
default_t( "mouseb_fire", &::g->mousebfire, 0 ),
|
||||
default_t( "mouseb_strafe", &::g->mousebstrafe, 1 ),
|
||||
default_t( "mouseb_forward", &::g->mousebforward, 2 ),
|
||||
|
||||
default_t( "use_joystick",&::g->usejoystick, 0 ),
|
||||
default_t( "joyb_fire",&::g->joybfire,0 ),
|
||||
default_t( "joyb_strafe",&::g->joybstrafe,1 ),
|
||||
default_t( "joyb_use",&::g->joybuse,3 ),
|
||||
default_t( "joyb_speed",&::g->joybspeed,2 ),
|
||||
default_t( "use_joystick", &::g->usejoystick, 0 ),
|
||||
default_t( "joyb_fire", &::g->joybfire, 0 ),
|
||||
default_t( "joyb_strafe", &::g->joybstrafe, 1 ),
|
||||
default_t( "joyb_use", &::g->joybuse, 3 ),
|
||||
default_t( "joyb_speed", &::g->joybspeed, 2 ),
|
||||
|
||||
default_t( "screenblocks",&::g->screenblocks, 10 ),
|
||||
default_t( "detaillevel",&::g->detailLevel, 0 ),
|
||||
default_t( "screenblocks", &::g->screenblocks, 10 ),
|
||||
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( "chatmacro1", &::g->chat_macros[1], HUSTR_CHATMACRO1 ),
|
||||
|
@ -373,50 +399,53 @@ default_t temp_defaults[35] = {
|
|||
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_random.constructs begin //
|
||||
::g->rndindex = 0;
|
||||
::g->prndindex = 0;
|
||||
::g->rndindex = 0;
|
||||
::g->prndindex = 0;
|
||||
// m_random.constructs end //
|
||||
// p_enemy.constructs begin //
|
||||
::g->TRACEANGLE = 0xc000000;
|
||||
::g->easy = 0;
|
||||
::g->TRACEANGLE = 0xc000000;
|
||||
::g->easy = 0;
|
||||
// p_enemy.constructs end //
|
||||
// r_bsp.constructs begin //
|
||||
int temp_checkcoord[12][4] = {
|
||||
{3,0,2,1},
|
||||
{3,0,2,0},
|
||||
{3,1,2,0},
|
||||
int temp_checkcoord[12][4] =
|
||||
{
|
||||
{3, 0, 2, 1},
|
||||
{3, 0, 2, 0},
|
||||
{3, 1, 2, 0},
|
||||
{0},
|
||||
{2,0,2,1},
|
||||
{0,0,0,0},
|
||||
{3,1,3,0},
|
||||
{2, 0, 2, 1},
|
||||
{0, 0, 0, 0},
|
||||
{3, 1, 3, 0},
|
||||
{0},
|
||||
{2,0,3,1},
|
||||
{2,1,3,1},
|
||||
{2,1,3,0}
|
||||
{2, 0, 3, 1},
|
||||
{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_draw.constructs begin //
|
||||
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
|
||||
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
|
||||
};
|
||||
memcpy( ::g->fuzzoffset, temp_fuzzoffset, sizeof(temp_fuzzoffset) );
|
||||
::g->fuzzpos = 0;
|
||||
memcpy( ::g->fuzzoffset, temp_fuzzoffset, sizeof( temp_fuzzoffset ) );
|
||||
::g->fuzzpos = 0;
|
||||
// r_draw.constructs end //
|
||||
// r_main.constructs begin //
|
||||
::g->validcount = 1;
|
||||
::g->validcount = 1;
|
||||
// r_main.constructs end //
|
||||
// sounds.constructs begin //
|
||||
musicinfo_t temp_S_music[80] = {
|
||||
musicinfo_t temp_S_music[80] =
|
||||
{
|
||||
{ 0 },
|
||||
{ "e1m1", 0 },
|
||||
{ "e1m2", 0 },
|
||||
|
@ -486,55 +515,56 @@ musicinfo_t temp_S_music[80] = {
|
|||
{ "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 //
|
||||
// st_stuff.constructs begin //
|
||||
::g->veryfirsttime = 1;
|
||||
::g->st_msgcounter=0;
|
||||
::g->st_oldhealth = -1;
|
||||
::g->st_facecount = 0;
|
||||
::g->st_faceindex = 0;
|
||||
::g->oldhealth = -1;
|
||||
::g->lastattackdown = -1;
|
||||
::g->priority = 0;
|
||||
::g->largeammo = 1994; // means "n/a"
|
||||
::g->st_palette = 0;
|
||||
::g->st_stopped = true;
|
||||
::g->veryfirsttime = 1;
|
||||
::g->st_msgcounter = 0;
|
||||
::g->st_oldhealth = -1;
|
||||
::g->st_facecount = 0;
|
||||
::g->st_faceindex = 0;
|
||||
::g->oldhealth = -1;
|
||||
::g->lastattackdown = -1;
|
||||
::g->priority = 0;
|
||||
::g->largeammo = 1994; // means "n/a"
|
||||
::g->st_palette = 0;
|
||||
::g->st_stopped = true;
|
||||
// st_stuff.constructs end //
|
||||
// s_sound.constructs begin //
|
||||
::g->mus_playing=0;
|
||||
::g->mus_playing = 0;
|
||||
// s_sound.constructs end //
|
||||
// wi_stuff.constructs begin //
|
||||
int temp_NUMANIMS[NUMEPISODES] = {
|
||||
sizeof(epsd0animinfo)/sizeof(anim_t),
|
||||
sizeof(epsd1animinfo)/sizeof(anim_t),
|
||||
sizeof(epsd2animinfo)/sizeof(anim_t)
|
||||
int temp_NUMANIMS[NUMEPISODES] =
|
||||
{
|
||||
sizeof( epsd0animinfo ) / sizeof( anim_t ),
|
||||
sizeof( epsd1animinfo ) / sizeof( anim_t ),
|
||||
sizeof( epsd2animinfo ) / sizeof( anim_t )
|
||||
};
|
||||
memcpy( ::g->NUMANIMS, temp_NUMANIMS, sizeof(temp_NUMANIMS) );
|
||||
::g->snl_pointeron = false;
|
||||
extern const anim_t temp_epsd0animinfo[10];
|
||||
extern const anim_t temp_epsd1animinfo[9];
|
||||
extern const anim_t temp_epsd2animinfo[6];
|
||||
memcpy(::g->epsd0animinfo, temp_epsd0animinfo, sizeof(temp_epsd0animinfo));
|
||||
memcpy(::g->epsd1animinfo, temp_epsd1animinfo, sizeof(temp_epsd1animinfo));
|
||||
memcpy(::g->epsd2animinfo, temp_epsd2animinfo, sizeof(temp_epsd2animinfo));
|
||||
wi_stuff_anims[0] = ::g->epsd0animinfo;
|
||||
wi_stuff_anims[1] = ::g->epsd1animinfo;
|
||||
wi_stuff_anims[2] = ::g->epsd2animinfo;
|
||||
memcpy( ::g->NUMANIMS, temp_NUMANIMS, sizeof( temp_NUMANIMS ) );
|
||||
::g->snl_pointeron = false;
|
||||
extern const anim_t temp_epsd0animinfo[10];
|
||||
extern const anim_t temp_epsd1animinfo[9];
|
||||
extern const anim_t temp_epsd2animinfo[6];
|
||||
memcpy( ::g->epsd0animinfo, temp_epsd0animinfo, sizeof( temp_epsd0animinfo ) );
|
||||
memcpy( ::g->epsd1animinfo, temp_epsd1animinfo, sizeof( temp_epsd1animinfo ) );
|
||||
memcpy( ::g->epsd2animinfo, temp_epsd2animinfo, sizeof( temp_epsd2animinfo ) );
|
||||
wi_stuff_anims[0] = ::g->epsd0animinfo;
|
||||
wi_stuff_anims[1] = ::g->epsd1animinfo;
|
||||
wi_stuff_anims[2] = ::g->epsd2animinfo;
|
||||
// wi_stuff.constructs end //
|
||||
// z_zone.constructs begin //
|
||||
::g->zones[NUM_ZONES] = NULL;
|
||||
::g->NumAlloc = 0;
|
||||
::g->zones[NUM_ZONES] = NULL;
|
||||
::g->NumAlloc = 0;
|
||||
// z_zone.constructs end //
|
||||
// info constructs begin //
|
||||
extern const state_t tempStates[NUMSTATES];
|
||||
memcpy(::g->states, tempStates, sizeof(tempStates));
|
||||
extern const state_t tempStates[NUMSTATES];
|
||||
memcpy( ::g->states, tempStates, sizeof( tempStates ) );
|
||||
// info constructs end //
|
||||
// p_local begin //
|
||||
::g->rejectmatrix = NULL;
|
||||
::g->rejectmatrix = NULL;
|
||||
// p_local end //
|
||||
// r_data begin //]
|
||||
::g->s_numtextures = 0;
|
||||
::g->s_numtextures = 0;
|
||||
// r_data end //
|
||||
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ typedef enum
|
|||
// If true, the next 3 bits hold weapon num.
|
||||
BT_CHANGE = 4,
|
||||
// The 3bit weapon mask and shift, convenience.
|
||||
BT_WEAPONMASK = (8+16+32),
|
||||
BT_WEAPONMASK = ( 8 + 16 + 32 ),
|
||||
BT_WEAPONSHIFT = 3,
|
||||
|
||||
// Pause the game.
|
||||
|
@ -101,7 +101,7 @@ typedef enum
|
|||
|
||||
// Savegame slot numbers
|
||||
// occupy the second byte of buttons.
|
||||
BTS_SAVEMASK = (4+8+16),
|
||||
BTS_SAVEMASK = ( 4 + 8 + 16 ),
|
||||
BTS_SAVESHIFT = 2,
|
||||
|
||||
} buttoncode_t;
|
||||
|
|
|
@ -29,7 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "Precompiled.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "d_items.h"
|
||||
#pragma implementation "d_items.h"
|
||||
#endif
|
||||
#include "d_items.h"
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "doomdef.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -87,13 +87,13 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// calls all ?_Responder, ?_Ticker, and ?_Drawer,
|
||||
// calls I_GetTime, I_StartFrame, and I_StartTic
|
||||
//
|
||||
void D_DoomLoop (void);
|
||||
void D_DoomLoop( void );
|
||||
|
||||
void R_ExecuteSetViewSize (void);
|
||||
void D_CheckNetGame (void);
|
||||
void R_ExecuteSetViewSize( void );
|
||||
void D_CheckNetGame( void );
|
||||
bool D_PollNetworkStart();
|
||||
void D_ProcessEvents (void);
|
||||
void D_DoAdvanceDemo (void);
|
||||
void D_ProcessEvents( void );
|
||||
void D_DoAdvanceDemo( void );
|
||||
|
||||
const char* wadfiles[MAXWADFILES] =
|
||||
{
|
||||
|
@ -114,10 +114,10 @@ const char* extraWad = 0;
|
|||
// D_PostEvent
|
||||
// Called by the I/O functions when input is detected
|
||||
//
|
||||
void D_PostEvent (event_t* ev)
|
||||
void D_PostEvent( event_t* ev )
|
||||
{
|
||||
::g->events[::g->eventhead] = *ev;
|
||||
::g->eventhead = (++::g->eventhead)&(MAXEVENTS-1);
|
||||
::g->eventhead = ( ++::g->eventhead ) & ( MAXEVENTS - 1 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -125,21 +125,25 @@ void D_PostEvent (event_t* ev)
|
|||
// D_ProcessEvents
|
||||
// Send all the ::g->events of the given timestamp down the responder chain
|
||||
//
|
||||
void D_ProcessEvents (void)
|
||||
void D_ProcessEvents( void )
|
||||
{
|
||||
event_t* ev;
|
||||
|
||||
// IF STORE DEMO, DO NOT ACCEPT INPUT
|
||||
if ( ( ::g->gamemode == commercial )
|
||||
&& (W_CheckNumForName("map01")<0) )
|
||||
if( ( ::g->gamemode == commercial )
|
||||
&& ( W_CheckNumForName( "map01" ) < 0 ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for ( ; ::g->eventtail != ::g->eventhead ; ::g->eventtail = (++::g->eventtail)&(MAXEVENTS-1) )
|
||||
for( ; ::g->eventtail != ::g->eventhead ; ::g->eventtail = ( ++::g->eventtail ) & ( MAXEVENTS - 1 ) )
|
||||
{
|
||||
ev = &::g->events[::g->eventtail];
|
||||
if (M_Responder (ev))
|
||||
if( M_Responder( ev ) )
|
||||
{
|
||||
continue; // menu ate the event
|
||||
G_Responder (ev);
|
||||
}
|
||||
G_Responder( ev );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,13 +164,14 @@ void D_Wipe()
|
|||
nowtime = I_GetTime();
|
||||
tics = nowtime - ::g->wipestart;
|
||||
|
||||
if (tics != 0)
|
||||
if( tics != 0 )
|
||||
{
|
||||
::g->wipestart = nowtime;
|
||||
::g->wipedone = wipe_ScreenWipe( 0, 0, SCREENWIDTH, SCREENHEIGHT, tics );
|
||||
|
||||
// DHM - Nerve :: Demo recording :: Stop large hitch on first frame after the wipe
|
||||
if ( ::g->wipedone ) {
|
||||
if( ::g->wipedone )
|
||||
{
|
||||
::g->oldtrt_entertics = nowtime / ::g->ticdup;
|
||||
::g->gametime = nowtime;
|
||||
::g->wipe = false;
|
||||
|
@ -176,93 +181,115 @@ void D_Wipe()
|
|||
}
|
||||
|
||||
|
||||
void D_Display (void)
|
||||
void D_Display( void )
|
||||
{
|
||||
qboolean redrawsbar;
|
||||
|
||||
if (::g->nodrawers)
|
||||
if( ::g->nodrawers )
|
||||
{
|
||||
return; // for comparative timing / profiling
|
||||
}
|
||||
|
||||
redrawsbar = false;
|
||||
|
||||
// change the view size if needed
|
||||
if (::g->setsizeneeded)
|
||||
if( ::g->setsizeneeded )
|
||||
{
|
||||
R_ExecuteSetViewSize();
|
||||
::g->oldgamestate = (gamestate_t)-1; // force background redraw
|
||||
::g->oldgamestate = ( gamestate_t ) - 1; // force background redraw
|
||||
::g->borderdrawcount = 3;
|
||||
}
|
||||
|
||||
// save the current screen if about to ::g->wipe
|
||||
if (::g->gamestate != ::g->wipegamestate)
|
||||
if( ::g->gamestate != ::g->wipegamestate )
|
||||
{
|
||||
::g->wipe = true;
|
||||
wipe_StartScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);
|
||||
wipe_StartScreen( 0, 0, SCREENWIDTH, SCREENHEIGHT );
|
||||
}
|
||||
else
|
||||
{
|
||||
::g->wipe = false;
|
||||
}
|
||||
|
||||
if (::g->gamestate == GS_LEVEL && ::g->gametic)
|
||||
if( ::g->gamestate == GS_LEVEL && ::g->gametic )
|
||||
{
|
||||
HU_Erase();
|
||||
}
|
||||
|
||||
// do buffered drawing
|
||||
switch (::g->gamestate)
|
||||
switch( ::g->gamestate )
|
||||
{
|
||||
case GS_LEVEL:
|
||||
if (!::g->gametic)
|
||||
if( !::g->gametic )
|
||||
{
|
||||
break;
|
||||
if (::g->automapactive)
|
||||
AM_Drawer ();
|
||||
if (::g->wipe || (::g->viewheight != 200 * GLOBAL_IMAGE_SCALER && ::g->fullscreen) )
|
||||
}
|
||||
if( ::g->automapactive )
|
||||
{
|
||||
AM_Drawer();
|
||||
}
|
||||
if( ::g->wipe || ( ::g->viewheight != 200 * GLOBAL_IMAGE_SCALER && ::g->fullscreen ) )
|
||||
{
|
||||
redrawsbar = true;
|
||||
if (::g->inhelpscreensstate && !::g->inhelpscreens)
|
||||
}
|
||||
if( ::g->inhelpscreensstate && !::g->inhelpscreens )
|
||||
{
|
||||
redrawsbar = true; // just put away the help screen
|
||||
ST_Drawer ( ::g->viewheight == 200 * GLOBAL_IMAGE_SCALER, redrawsbar );
|
||||
}
|
||||
ST_Drawer( ::g->viewheight == 200 * GLOBAL_IMAGE_SCALER, redrawsbar );
|
||||
::g->fullscreen = ::g->viewheight == 200 * GLOBAL_IMAGE_SCALER;
|
||||
break;
|
||||
|
||||
case GS_INTERMISSION:
|
||||
WI_Drawer ();
|
||||
WI_Drawer();
|
||||
break;
|
||||
|
||||
case GS_FINALE:
|
||||
F_Drawer ();
|
||||
F_Drawer();
|
||||
break;
|
||||
|
||||
case GS_DEMOSCREEN:
|
||||
D_PageDrawer ();
|
||||
D_PageDrawer();
|
||||
break;
|
||||
}
|
||||
|
||||
// draw buffered stuff to screen
|
||||
I_UpdateNoBlit ();
|
||||
I_UpdateNoBlit();
|
||||
|
||||
// draw the view directly
|
||||
if (::g->gamestate == GS_LEVEL && !::g->automapactive && ::g->gametic)
|
||||
R_RenderPlayerView (&::g->players[::g->displayplayer]);
|
||||
if( ::g->gamestate == GS_LEVEL && !::g->automapactive && ::g->gametic )
|
||||
{
|
||||
R_RenderPlayerView( &::g->players[::g->displayplayer] );
|
||||
}
|
||||
|
||||
if (::g->gamestate == GS_LEVEL && ::g->gametic)
|
||||
HU_Drawer ();
|
||||
if( ::g->gamestate == GS_LEVEL && ::g->gametic )
|
||||
{
|
||||
HU_Drawer();
|
||||
}
|
||||
|
||||
// clean up border stuff
|
||||
if (::g->gamestate != ::g->oldgamestate && ::g->gamestate != GS_LEVEL)
|
||||
I_SetPalette ((byte*)W_CacheLumpName ("PLAYPAL",PU_CACHE_SHARED));
|
||||
if( ::g->gamestate != ::g->oldgamestate && ::g->gamestate != GS_LEVEL )
|
||||
{
|
||||
I_SetPalette( ( byte* )W_CacheLumpName( "PLAYPAL", PU_CACHE_SHARED ) );
|
||||
}
|
||||
|
||||
// see if the border needs to be initially drawn
|
||||
if (::g->gamestate == GS_LEVEL && ::g->oldgamestate != GS_LEVEL)
|
||||
if( ::g->gamestate == GS_LEVEL && ::g->oldgamestate != GS_LEVEL )
|
||||
{
|
||||
::g->viewactivestate = false; // view was not active
|
||||
R_FillBackScreen (); // draw the pattern into the back screen
|
||||
R_FillBackScreen(); // draw the pattern into the back screen
|
||||
}
|
||||
|
||||
// see if the border needs to be updated to the screen
|
||||
if (::g->gamestate == GS_LEVEL && !::g->automapactive && ::g->scaledviewwidth != (320 * GLOBAL_IMAGE_SCALER) )
|
||||
if( ::g->gamestate == GS_LEVEL && !::g->automapactive && ::g->scaledviewwidth != ( 320 * GLOBAL_IMAGE_SCALER ) )
|
||||
{
|
||||
if( ::g->menuactive || ::g->menuactivestate || !::g->viewactivestate )
|
||||
{
|
||||
if (::g->menuactive || ::g->menuactivestate || !::g->viewactivestate)
|
||||
::g->borderdrawcount = 3;
|
||||
if (::g->borderdrawcount)
|
||||
}
|
||||
if( ::g->borderdrawcount )
|
||||
{
|
||||
R_DrawViewBorder (); // erase old menu stuff
|
||||
R_DrawViewBorder(); // erase old menu stuff
|
||||
::g->borderdrawcount--;
|
||||
}
|
||||
|
||||
|
@ -274,7 +301,7 @@ void D_Display (void)
|
|||
::g->oldgamestate = ::g->wipegamestate = ::g->gamestate;
|
||||
|
||||
// draw pause pic
|
||||
/*
|
||||
/*
|
||||
if (::g->paused)
|
||||
{
|
||||
if (::g->automapactive)
|
||||
|
@ -284,23 +311,23 @@ void D_Display (void)
|
|||
V_DrawPatchDirect(::g->viewwindowx+(ORIGINAL_WIDTH-68)/2,
|
||||
y,0,(patch_t*)W_CacheLumpName ("M_PAUSE", PU_CACHE_SHARED));
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
// menus go directly to the screen
|
||||
M_Drawer (); // menu is drawn even on top of everything
|
||||
NetUpdate ( NULL ); // send out any new accumulation
|
||||
M_Drawer(); // menu is drawn even on top of everything
|
||||
NetUpdate( NULL ); // send out any new accumulation
|
||||
|
||||
// normal update
|
||||
if (!::g->wipe)
|
||||
if( !::g->wipe )
|
||||
{
|
||||
I_FinishUpdate (); // page flip or blit buffer
|
||||
I_FinishUpdate(); // page flip or blit buffer
|
||||
return;
|
||||
}
|
||||
|
||||
// \ update
|
||||
wipe_EndScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);
|
||||
wipe_EndScreen( 0, 0, SCREENWIDTH, SCREENHEIGHT );
|
||||
|
||||
::g->wipestart = I_GetTime () - 1;
|
||||
::g->wipestart = I_GetTime() - 1;
|
||||
|
||||
D_Wipe(); // initialize g->wipedone
|
||||
}
|
||||
|
@ -309,15 +336,17 @@ void D_Display (void)
|
|||
|
||||
void D_RunFrame( bool Sounds )
|
||||
{
|
||||
if (Sounds) {
|
||||
if( Sounds )
|
||||
{
|
||||
// move positional sounds
|
||||
S_UpdateSounds (::g->players[::g->consoleplayer].mo);
|
||||
S_UpdateSounds( ::g->players[::g->consoleplayer].mo );
|
||||
}
|
||||
|
||||
// Update display, next frame, with current state.
|
||||
D_Display ();
|
||||
D_Display();
|
||||
|
||||
if (Sounds) {
|
||||
if( Sounds )
|
||||
{
|
||||
// Update sound output.
|
||||
I_SubmitSound();
|
||||
}
|
||||
|
@ -328,10 +357,10 @@ void D_RunFrame( bool Sounds )
|
|||
//
|
||||
// D_DoomLoop
|
||||
//
|
||||
void D_DoomLoop (void)
|
||||
void D_DoomLoop( void )
|
||||
{
|
||||
// DHM - Not used
|
||||
/*
|
||||
/*
|
||||
if (M_CheckParm ("-debugfile"))
|
||||
{
|
||||
char filename[20];
|
||||
|
@ -347,7 +376,7 @@ void D_DoomLoop (void)
|
|||
TryRunTics();
|
||||
D_RunFrame( true );
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -361,10 +390,12 @@ void D_DoomLoop (void)
|
|||
// D_PageTicker
|
||||
// Handles timing for warped ::g->projection
|
||||
//
|
||||
void D_PageTicker (void)
|
||||
void D_PageTicker( void )
|
||||
{
|
||||
if (--::g->pagetic < 0)
|
||||
D_AdvanceDemo ();
|
||||
if( --::g->pagetic < 0 )
|
||||
{
|
||||
D_AdvanceDemo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -372,9 +403,9 @@ void D_PageTicker (void)
|
|||
//
|
||||
// D_PageDrawer
|
||||
//
|
||||
void D_PageDrawer (void)
|
||||
void D_PageDrawer( void )
|
||||
{
|
||||
V_DrawPatch (0,0, 0, (patch_t*)W_CacheLumpName(::g->pagename, PU_CACHE_SHARED));
|
||||
V_DrawPatch( 0, 0, 0, ( patch_t* )W_CacheLumpName( ::g->pagename, PU_CACHE_SHARED ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -382,7 +413,7 @@ void D_PageDrawer (void)
|
|||
// D_AdvanceDemo
|
||||
// Called after each demo or intro ::g->demosequence finishes
|
||||
//
|
||||
void D_AdvanceDemo (void)
|
||||
void D_AdvanceDemo( void )
|
||||
{
|
||||
::g->advancedemo = true;
|
||||
}
|
||||
|
@ -392,7 +423,7 @@ void D_AdvanceDemo (void)
|
|||
// This cycles through the demo sequences.
|
||||
// FIXME - version dependend demo numbers?
|
||||
//
|
||||
void D_DoAdvanceDemo (void)
|
||||
void D_DoAdvanceDemo( void )
|
||||
{
|
||||
::g->players[::g->consoleplayer].playerstate = PST_LIVE; // not reborn
|
||||
::g->advancedemo = false;
|
||||
|
@ -400,55 +431,67 @@ void D_DoAdvanceDemo (void)
|
|||
::g->paused = false;
|
||||
::g->gameaction = ga_nothing;
|
||||
|
||||
if ( ::g->gamemode == retail )
|
||||
::g->demosequence = (::g->demosequence+1)%8;
|
||||
if( ::g->gamemode == retail )
|
||||
{
|
||||
::g->demosequence = ( ::g->demosequence + 1 ) % 8;
|
||||
}
|
||||
else
|
||||
::g->demosequence = (::g->demosequence+1)%6;
|
||||
{
|
||||
::g->demosequence = ( ::g->demosequence + 1 ) % 6;
|
||||
}
|
||||
|
||||
switch (::g->demosequence)
|
||||
switch( ::g->demosequence )
|
||||
{
|
||||
case 0:
|
||||
if ( ::g->gamemode == commercial )
|
||||
if( ::g->gamemode == commercial )
|
||||
{
|
||||
::g->pagetic = 35 * 11;
|
||||
}
|
||||
else
|
||||
{
|
||||
::g->pagetic = 8 * TICRATE;
|
||||
}
|
||||
|
||||
::g->gamestate = GS_DEMOSCREEN;
|
||||
::g->pagename = (char *)"INTERPIC";
|
||||
::g->pagename = ( char* )"INTERPIC";
|
||||
|
||||
if ( ::g->gamemode == commercial )
|
||||
S_StartMusic(mus_dm2ttl);
|
||||
if( ::g->gamemode == commercial )
|
||||
{
|
||||
S_StartMusic( mus_dm2ttl );
|
||||
}
|
||||
else
|
||||
S_StartMusic (mus_intro);
|
||||
{
|
||||
S_StartMusic( mus_intro );
|
||||
}
|
||||
|
||||
break;
|
||||
case 1:
|
||||
G_DeferedPlayDemo ("demo1");
|
||||
G_DeferedPlayDemo( "demo1" );
|
||||
break;
|
||||
case 2:
|
||||
::g->pagetic = 3 * TICRATE;
|
||||
::g->gamestate = GS_DEMOSCREEN;
|
||||
::g->pagename = (char *)"INTERPIC";
|
||||
::g->pagename = ( char* )"INTERPIC";
|
||||
break;
|
||||
case 3:
|
||||
G_DeferedPlayDemo ("demo2");
|
||||
G_DeferedPlayDemo( "demo2" );
|
||||
break;
|
||||
case 4:
|
||||
::g->pagetic = 3 * TICRATE;
|
||||
::g->gamestate = GS_DEMOSCREEN;
|
||||
::g->pagename = (char *)"INTERPIC";
|
||||
::g->pagename = ( char* )"INTERPIC";
|
||||
break;
|
||||
case 5:
|
||||
G_DeferedPlayDemo ("demo3");
|
||||
G_DeferedPlayDemo( "demo3" );
|
||||
break;
|
||||
// THE DEFINITIVE DOOM Special Edition demo
|
||||
case 6:
|
||||
::g->pagetic = 3 * TICRATE;
|
||||
::g->gamestate = GS_DEMOSCREEN;
|
||||
::g->pagename = (char *)"INTERPIC";
|
||||
::g->pagename = ( char* )"INTERPIC";
|
||||
break;
|
||||
case 7:
|
||||
G_DeferedPlayDemo ("demo4");
|
||||
G_DeferedPlayDemo( "demo4" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -458,11 +501,11 @@ void D_DoAdvanceDemo (void)
|
|||
//
|
||||
// D_StartTitle
|
||||
//
|
||||
void D_StartTitle (void)
|
||||
void D_StartTitle( void )
|
||||
{
|
||||
::g->gameaction = ga_nothing;
|
||||
::g->demosequence = -1;
|
||||
D_AdvanceDemo ();
|
||||
D_AdvanceDemo();
|
||||
}
|
||||
|
||||
|
||||
|
@ -473,20 +516,23 @@ void D_StartTitle (void)
|
|||
//
|
||||
// D_AddExtraWadFile
|
||||
//
|
||||
void D_SetExtraWadFile( const char *file ) {
|
||||
void D_SetExtraWadFile( const char* file )
|
||||
{
|
||||
extraWad = file;
|
||||
}
|
||||
|
||||
//
|
||||
// D_AddFile
|
||||
//
|
||||
void D_AddFile (const char *file)
|
||||
void D_AddFile( const char* file )
|
||||
{
|
||||
int numwadfiles;
|
||||
|
||||
for (numwadfiles = 0 ; wadfiles[numwadfiles] ; numwadfiles++)
|
||||
if (file == wadfiles[numwadfiles])
|
||||
for( numwadfiles = 0 ; wadfiles[numwadfiles] ; numwadfiles++ )
|
||||
if( file == wadfiles[numwadfiles] )
|
||||
{
|
||||
return;
|
||||
}
|
||||
;
|
||||
wadfiles[numwadfiles] = file;
|
||||
}
|
||||
|
@ -498,20 +544,23 @@ void D_AddFile (const char *file)
|
|||
// should be executed (notably loading PWAD's).
|
||||
//
|
||||
|
||||
void IdentifyVersion (void)
|
||||
void IdentifyVersion( void )
|
||||
{
|
||||
W_FreeWadFiles();
|
||||
|
||||
const ExpansionData * expansion = DoomLib::GetCurrentExpansion();
|
||||
const ExpansionData* expansion = DoomLib::GetCurrentExpansion();
|
||||
::g->gamemode = expansion->gameMode;
|
||||
::g->gamemission = expansion->pack_type;
|
||||
|
||||
|
||||
if( expansion->type == ExpansionData::PWAD ) {
|
||||
if( expansion->type == ExpansionData::PWAD )
|
||||
{
|
||||
D_AddFile( expansion->iWadFilename );
|
||||
D_AddFile( expansion->pWadFilename );
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
D_AddFile( expansion->iWadFilename );
|
||||
}
|
||||
|
||||
|
@ -521,7 +570,7 @@ void IdentifyVersion (void)
|
|||
//
|
||||
// Find a Response File
|
||||
//
|
||||
void FindResponseFile (void)
|
||||
void FindResponseFile( void )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -530,106 +579,116 @@ void FindResponseFile (void)
|
|||
// D_DoomMain
|
||||
//
|
||||
|
||||
void D_DoomMain (void)
|
||||
void D_DoomMain( void )
|
||||
{
|
||||
int p;
|
||||
char file[256];
|
||||
|
||||
|
||||
FindResponseFile ();
|
||||
FindResponseFile();
|
||||
|
||||
IdentifyVersion ();
|
||||
IdentifyVersion();
|
||||
|
||||
setbuf (stdout, NULL);
|
||||
setbuf( stdout, NULL );
|
||||
::g->modifiedgame = false;
|
||||
|
||||
// TODO: Networking
|
||||
//const bool isDeathmatch = gameLocal->GetMatchParms().GetGameType() == GAME_TYPE_PVP;
|
||||
const bool isDeathmatch = false;
|
||||
|
||||
::g->nomonsters = M_CheckParm ("-nomonsters") || isDeathmatch;
|
||||
::g->respawnparm = M_CheckParm ("-respawn");
|
||||
::g->fastparm = M_CheckParm ("-fast");
|
||||
::g->devparm = M_CheckParm ("-devparm");
|
||||
if (M_CheckParm ("-altdeath") || isDeathmatch)
|
||||
::g->nomonsters = M_CheckParm( "-nomonsters" ) || isDeathmatch;
|
||||
::g->respawnparm = M_CheckParm( "-respawn" );
|
||||
::g->fastparm = M_CheckParm( "-fast" );
|
||||
::g->devparm = M_CheckParm( "-devparm" );
|
||||
if( M_CheckParm( "-altdeath" ) || isDeathmatch )
|
||||
{
|
||||
::g->deathmatch = 2;
|
||||
else if (M_CheckParm ("-deathmatch"))
|
||||
}
|
||||
else if( M_CheckParm( "-deathmatch" ) )
|
||||
{
|
||||
::g->deathmatch = 1;
|
||||
}
|
||||
|
||||
switch ( ::g->gamemode )
|
||||
switch( ::g->gamemode )
|
||||
{
|
||||
case retail:
|
||||
sprintf (::g->title,
|
||||
sprintf( ::g->title,
|
||||
" "
|
||||
"The Ultimate DOOM Startup v%i.%i"
|
||||
" ",
|
||||
VERSION/100,VERSION%100);
|
||||
VERSION / 100, VERSION % 100 );
|
||||
break;
|
||||
case shareware:
|
||||
sprintf (::g->title,
|
||||
sprintf( ::g->title,
|
||||
" "
|
||||
"DOOM Shareware Startup v%i.%i"
|
||||
" ",
|
||||
VERSION/100,VERSION%100);
|
||||
VERSION / 100, VERSION % 100 );
|
||||
break;
|
||||
case registered:
|
||||
sprintf (::g->title,
|
||||
sprintf( ::g->title,
|
||||
" "
|
||||
"DOOM Registered Startup v%i.%i"
|
||||
" ",
|
||||
VERSION/100,VERSION%100);
|
||||
VERSION / 100, VERSION % 100 );
|
||||
break;
|
||||
case commercial:
|
||||
sprintf (::g->title,
|
||||
sprintf( ::g->title,
|
||||
" "
|
||||
"DOOM 2: Hell on Earth v%i.%i"
|
||||
" ",
|
||||
VERSION/100,VERSION%100);
|
||||
VERSION / 100, VERSION % 100 );
|
||||
break;
|
||||
default:
|
||||
sprintf (::g->title,
|
||||
sprintf( ::g->title,
|
||||
" "
|
||||
"Public DOOM - v%i.%i"
|
||||
" ",
|
||||
VERSION/100,VERSION%100);
|
||||
VERSION / 100, VERSION % 100 );
|
||||
break;
|
||||
}
|
||||
|
||||
I_Printf ("%s\n",::g->title);
|
||||
I_Printf( "%s\n", ::g->title );
|
||||
|
||||
if (::g->devparm)
|
||||
I_Printf(D_DEVSTR);
|
||||
|
||||
if (M_CheckParm("-cdrom"))
|
||||
if( ::g->devparm )
|
||||
{
|
||||
I_Printf(D_CDROM);
|
||||
I_Printf( D_DEVSTR );
|
||||
}
|
||||
|
||||
if( M_CheckParm( "-cdrom" ) )
|
||||
{
|
||||
I_Printf( D_CDROM );
|
||||
//c++ mkdir("c:\\doomdata",0);
|
||||
strcpy (::g->basedefault,"c:/doomdata/default.cfg");
|
||||
strcpy( ::g->basedefault, "c:/doomdata/default.cfg" );
|
||||
}
|
||||
|
||||
// add any files specified on the command line with -file ::g->wadfile
|
||||
// to the wad list
|
||||
//
|
||||
p = M_CheckParm ("-file");
|
||||
if (p)
|
||||
p = M_CheckParm( "-file" );
|
||||
if( p )
|
||||
{
|
||||
// the parms after p are ::g->wadfile/lump names,
|
||||
// until end of parms or another - preceded parm
|
||||
::g->modifiedgame = true; // homebrew levels
|
||||
while (++p != ::g->myargc && ::g->myargv[p][0] != '-')
|
||||
D_AddFile (::g->myargv[p]);
|
||||
while( ++p != ::g->myargc && ::g->myargv[p][0] != '-' )
|
||||
{
|
||||
D_AddFile( ::g->myargv[p] );
|
||||
}
|
||||
}
|
||||
|
||||
p = M_CheckParm ("-playdemo");
|
||||
p = M_CheckParm( "-playdemo" );
|
||||
|
||||
if (!p)
|
||||
p = M_CheckParm ("-timedemo");
|
||||
|
||||
if (p && p < ::g->myargc-1)
|
||||
if( !p )
|
||||
{
|
||||
sprintf (file,"d:\\%s.lmp", ::g->myargv[p+1]);
|
||||
D_AddFile (file);
|
||||
I_Printf("Playing demo %s.lmp.\n",::g->myargv[p+1]);
|
||||
p = M_CheckParm( "-timedemo" );
|
||||
}
|
||||
|
||||
if( p && p < ::g->myargc - 1 )
|
||||
{
|
||||
sprintf( file, "d:\\%s.lmp", ::g->myargv[p + 1] );
|
||||
D_AddFile( file );
|
||||
I_Printf( "Playing demo %s.lmp.\n", ::g->myargv[p + 1] );
|
||||
}
|
||||
|
||||
// get skill / episode / map from defaults
|
||||
|
@ -638,32 +697,35 @@ void D_DoomMain (void)
|
|||
::g->startmap = 1;
|
||||
::g->autostart = false;
|
||||
|
||||
if ( DoomLib::matchParms.gameEpisode != GAME_EPISODE_UNKNOWN ) {
|
||||
if( DoomLib::matchParms.gameEpisode != GAME_EPISODE_UNKNOWN )
|
||||
{
|
||||
::g->startepisode = DoomLib::matchParms.gameEpisode;
|
||||
::g->autostart = 1;
|
||||
}
|
||||
|
||||
if ( DoomLib::matchParms.gameMap != -1 ) {
|
||||
if( DoomLib::matchParms.gameMap != -1 )
|
||||
{
|
||||
::g->startmap = DoomLib::matchParms.gameMap;
|
||||
::g->autostart = 1;
|
||||
}
|
||||
|
||||
if ( DoomLib::matchParms.gameSkill != -1) {
|
||||
::g->startskill = (skill_t)DoomLib::matchParms.gameSkill;
|
||||
if( DoomLib::matchParms.gameSkill != -1 )
|
||||
{
|
||||
::g->startskill = ( skill_t )DoomLib::matchParms.gameSkill;
|
||||
}
|
||||
|
||||
// get skill / episode / map from cmdline
|
||||
p = M_CheckParm ("-skill");
|
||||
if (p && p < ::g->myargc-1)
|
||||
p = M_CheckParm( "-skill" );
|
||||
if( p && p < ::g->myargc - 1 )
|
||||
{
|
||||
::g->startskill = (skill_t)(::g->myargv[p+1][0]-'1');
|
||||
::g->startskill = ( skill_t )( ::g->myargv[p + 1][0] - '1' );
|
||||
::g->autostart = true;
|
||||
}
|
||||
|
||||
p = M_CheckParm ("-episode");
|
||||
if (p && p < ::g->myargc-1)
|
||||
p = M_CheckParm( "-episode" );
|
||||
if( p && p < ::g->myargc - 1 )
|
||||
{
|
||||
::g->startepisode = ::g->myargv[p+1][0]-'0';
|
||||
::g->startepisode = ::g->myargv[p + 1][0] - '0';
|
||||
::g->startmap = 1;
|
||||
::g->autostart = true;
|
||||
}
|
||||
|
@ -674,77 +736,85 @@ void D_DoomMain (void)
|
|||
// TODO: Networking
|
||||
//const int timeLimit = gameLocal->GetMatchParms().GetTimeLimit();
|
||||
const int timeLimit = 0;
|
||||
if (timeLimit != 0 && ::g->deathmatch)
|
||||
if( timeLimit != 0 && ::g->deathmatch )
|
||||
{
|
||||
int time;
|
||||
//time = atoi(::g->myargv[p+1]);
|
||||
time = timeLimit;
|
||||
I_Printf("Levels will end after %d minute",time);
|
||||
if (time>1)
|
||||
I_Printf("s");
|
||||
I_Printf(".\n");
|
||||
I_Printf( "Levels will end after %d minute", time );
|
||||
if( time > 1 )
|
||||
{
|
||||
I_Printf( "s" );
|
||||
}
|
||||
I_Printf( ".\n" );
|
||||
}
|
||||
|
||||
p = M_CheckParm ("-avg");
|
||||
if (p && p < ::g->myargc-1 && ::g->deathmatch)
|
||||
I_Printf("Austin Virtual Gaming: Levels will end after 20 minutes\n");
|
||||
|
||||
p = M_CheckParm ("-warp");
|
||||
if (p && p < ::g->myargc-1)
|
||||
p = M_CheckParm( "-avg" );
|
||||
if( p && p < ::g->myargc - 1 && ::g->deathmatch )
|
||||
{
|
||||
if (::g->gamemode == commercial)
|
||||
::g->startmap = atoi (::g->myargv[p+1]);
|
||||
I_Printf( "Austin Virtual Gaming: Levels will end after 20 minutes\n" );
|
||||
}
|
||||
|
||||
p = M_CheckParm( "-warp" );
|
||||
if( p && p < ::g->myargc - 1 )
|
||||
{
|
||||
if( ::g->gamemode == commercial )
|
||||
{
|
||||
::g->startmap = atoi( ::g->myargv[p + 1] );
|
||||
}
|
||||
else
|
||||
{
|
||||
::g->startepisode = ::g->myargv[p+1][0]-'0';
|
||||
::g->startmap = ::g->myargv[p+2][0]-'0';
|
||||
::g->startepisode = ::g->myargv[p + 1][0] - '0';
|
||||
::g->startmap = ::g->myargv[p + 2][0] - '0';
|
||||
}
|
||||
::g->autostart = true;
|
||||
}
|
||||
|
||||
I_Printf ("Z_Init: Init zone memory allocation daemon. \n");
|
||||
Z_Init ();
|
||||
I_Printf( "Z_Init: Init zone memory allocation daemon. \n" );
|
||||
Z_Init();
|
||||
|
||||
// init subsystems
|
||||
I_Printf ("V_Init: allocate ::g->screens.\n");
|
||||
V_Init ();
|
||||
I_Printf( "V_Init: allocate ::g->screens.\n" );
|
||||
V_Init();
|
||||
|
||||
I_Printf ("M_LoadDefaults: Load system defaults.\n");
|
||||
M_LoadDefaults (); // load before initing other systems
|
||||
I_Printf( "M_LoadDefaults: Load system defaults.\n" );
|
||||
M_LoadDefaults(); // load before initing other systems
|
||||
|
||||
I_Printf ("W_Init: Init WADfiles.\n");
|
||||
W_InitMultipleFiles (wadfiles);
|
||||
I_Printf( "W_Init: Init WADfiles.\n" );
|
||||
W_InitMultipleFiles( wadfiles );
|
||||
|
||||
|
||||
// Check for -file in shareware
|
||||
if (::g->modifiedgame)
|
||||
if( ::g->modifiedgame )
|
||||
{
|
||||
// These are the lumps that will be checked in IWAD,
|
||||
// if any one is not present, execution will be aborted.
|
||||
char name[23][16]=
|
||||
char name[23][16] =
|
||||
{
|
||||
"e2m1","e2m2","e2m3","e2m4","e2m5","e2m6","e2m7","e2m8","e2m9",
|
||||
"e3m1","e3m3","e3m3","e3m4","e3m5","e3m6","e3m7","e3m8","e3m9",
|
||||
"dphoof","bfgga0","heada1","cybra1","spida1d1"
|
||||
"e2m1", "e2m2", "e2m3", "e2m4", "e2m5", "e2m6", "e2m7", "e2m8", "e2m9",
|
||||
"e3m1", "e3m3", "e3m3", "e3m4", "e3m5", "e3m6", "e3m7", "e3m8", "e3m9",
|
||||
"dphoof", "bfgga0", "heada1", "cybra1", "spida1d1"
|
||||
};
|
||||
int i;
|
||||
|
||||
if ( ::g->gamemode == shareware)
|
||||
I_Error("\nYou cannot -file with the shareware "
|
||||
"version. Register!");
|
||||
if( ::g->gamemode == shareware )
|
||||
I_Error( "\nYou cannot -file with the shareware "
|
||||
"version. Register!" );
|
||||
|
||||
// Check for fake IWAD with right name,
|
||||
// but w/o all the lumps of the registered version.
|
||||
if (::g->gamemode == registered)
|
||||
for (i = 0;i < 23; i++)
|
||||
if (W_CheckNumForName(name[i])<0)
|
||||
I_Error("\nThis is not the registered version.");
|
||||
if( ::g->gamemode == registered )
|
||||
for( i = 0; i < 23; i++ )
|
||||
if( W_CheckNumForName( name[i] ) < 0 )
|
||||
{
|
||||
I_Error( "\nThis is not the registered version." );
|
||||
}
|
||||
}
|
||||
|
||||
// Iff additonal PWAD files are used, print modified banner
|
||||
if (::g->modifiedgame)
|
||||
if( ::g->modifiedgame )
|
||||
{
|
||||
/*m*/I_Printf (
|
||||
/*m*/I_Printf(
|
||||
"===========================================================================\n"
|
||||
"ATTENTION: This version of DOOM has been modified. If you would like to\n"
|
||||
"get a copy of the original game, call 1-800-IDGAMES or see the readme file.\n"
|
||||
|
@ -752,16 +822,16 @@ void D_DoomMain (void)
|
|||
" press enter to continue\n"
|
||||
"===========================================================================\n"
|
||||
);
|
||||
getchar ();
|
||||
getchar();
|
||||
}
|
||||
|
||||
|
||||
// Check and print which version is executed.
|
||||
switch ( ::g->gamemode )
|
||||
switch( ::g->gamemode )
|
||||
{
|
||||
case shareware:
|
||||
case indetermined:
|
||||
I_Printf (
|
||||
I_Printf(
|
||||
"===========================================================================\n"
|
||||
" Shareware!\n"
|
||||
"===========================================================================\n"
|
||||
|
@ -770,7 +840,7 @@ void D_DoomMain (void)
|
|||
case registered:
|
||||
case retail:
|
||||
case commercial:
|
||||
I_Printf (
|
||||
I_Printf(
|
||||
"===========================================================================\n"
|
||||
" Commercial product - do not distribute!\n"
|
||||
" Please report software piracy to the SPA: 1-800-388-PIR8\n"
|
||||
|
@ -783,81 +853,90 @@ void D_DoomMain (void)
|
|||
break;
|
||||
}
|
||||
|
||||
I_Printf ("M_Init: Init miscellaneous info.\n");
|
||||
M_Init ();
|
||||
I_Printf( "M_Init: Init miscellaneous info.\n" );
|
||||
M_Init();
|
||||
|
||||
I_Printf ("R_Init: Init DOOM refresh daemon - ");
|
||||
R_Init ();
|
||||
I_Printf( "R_Init: Init DOOM refresh daemon - " );
|
||||
R_Init();
|
||||
|
||||
I_Printf ("\nP_Init: Init Playloop state.\n");
|
||||
P_Init ();
|
||||
I_Printf( "\nP_Init: Init Playloop state.\n" );
|
||||
P_Init();
|
||||
|
||||
I_Printf ("I_Init: Setting up machine state.\n");
|
||||
I_Init ();
|
||||
I_Printf( "I_Init: Setting up machine state.\n" );
|
||||
I_Init();
|
||||
|
||||
I_Printf ("D_CheckNetGame: Checking network game status.\n");
|
||||
D_CheckNetGame ();
|
||||
I_Printf( "D_CheckNetGame: Checking network game status.\n" );
|
||||
D_CheckNetGame();
|
||||
}
|
||||
|
||||
bool D_DoomMainPoll(void)
|
||||
bool D_DoomMainPoll( void )
|
||||
{
|
||||
int p;
|
||||
char file[256];
|
||||
|
||||
if (D_PollNetworkStart() == false)
|
||||
if( D_PollNetworkStart() == false )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
I_Printf( "S_Init: Setting up sound.\n" );
|
||||
S_Init( s_volume_sound.GetInteger(), s_volume_midi.GetInteger() );
|
||||
|
||||
I_Printf ("HU_Init: Setting up heads up display.\n");
|
||||
HU_Init ();
|
||||
I_Printf( "HU_Init: Setting up heads up display.\n" );
|
||||
HU_Init();
|
||||
|
||||
I_Printf ("ST_Init: Init status bar.\n");
|
||||
ST_Init ();
|
||||
I_Printf( "ST_Init: Init status bar.\n" );
|
||||
ST_Init();
|
||||
|
||||
// start the apropriate game based on parms
|
||||
p = M_CheckParm ("-record");
|
||||
p = M_CheckParm( "-record" );
|
||||
|
||||
if (p && p < ::g->myargc-1)
|
||||
if( p && p < ::g->myargc - 1 )
|
||||
{
|
||||
G_RecordDemo (::g->myargv[p+1]);
|
||||
G_RecordDemo( ::g->myargv[p + 1] );
|
||||
::g->autostart = true;
|
||||
}
|
||||
|
||||
p = M_CheckParm ("-playdemo");
|
||||
if (p && p < ::g->myargc-1)
|
||||
p = M_CheckParm( "-playdemo" );
|
||||
if( p && p < ::g->myargc - 1 )
|
||||
{
|
||||
//::g->singledemo = true; // quit after one demo
|
||||
G_DeferedPlayDemo (::g->myargv[p+1]);
|
||||
G_DeferedPlayDemo( ::g->myargv[p + 1] );
|
||||
//D_DoomLoop (); // never returns
|
||||
}
|
||||
|
||||
p = M_CheckParm ("-timedemo");
|
||||
if (p && p < ::g->myargc-1)
|
||||
p = M_CheckParm( "-timedemo" );
|
||||
if( p && p < ::g->myargc - 1 )
|
||||
{
|
||||
G_TimeDemo ("nukage1");//::g->myargv[p+1]);
|
||||
D_DoomLoop (); // never returns
|
||||
G_TimeDemo( "nukage1" ); //::g->myargv[p+1]);
|
||||
D_DoomLoop(); // never returns
|
||||
}
|
||||
|
||||
p = M_CheckParm ("-loadgame");
|
||||
if (p && p < ::g->myargc-1)
|
||||
p = M_CheckParm( "-loadgame" );
|
||||
if( p && p < ::g->myargc - 1 )
|
||||
{
|
||||
if (M_CheckParm("-cdrom"))
|
||||
sprintf(file, "c:\\doomdata\\" SAVEGAMENAME "%c.dsg",::g->myargv[p+1][0]);
|
||||
if( M_CheckParm( "-cdrom" ) )
|
||||
{
|
||||
sprintf( file, "c:\\doomdata\\" SAVEGAMENAME "%c.dsg", ::g->myargv[p + 1][0] );
|
||||
}
|
||||
else
|
||||
sprintf(file, SAVEGAMENAME "%c.dsg",::g->myargv[p+1][0]);
|
||||
G_LoadGame (file);
|
||||
{
|
||||
sprintf( file, SAVEGAMENAME "%c.dsg", ::g->myargv[p + 1][0] );
|
||||
}
|
||||
G_LoadGame( file );
|
||||
}
|
||||
|
||||
|
||||
if ( ::g->gameaction != ga_loadgame && ::g->gameaction != ga_playdemo )
|
||||
if( ::g->gameaction != ga_loadgame && ::g->gameaction != ga_playdemo )
|
||||
{
|
||||
if (::g->autostart || ::g->netgame ) {
|
||||
G_InitNew (::g->startskill, ::g->startepisode, ::g->startmap );
|
||||
} else if( ::g->gameaction != ga_newgame) {
|
||||
D_StartTitle (); // start up intro loop
|
||||
if( ::g->autostart || ::g->netgame )
|
||||
{
|
||||
G_InitNew( ::g->startskill, ::g->startepisode, ::g->startmap );
|
||||
}
|
||||
else if( ::g->gameaction != ga_newgame )
|
||||
{
|
||||
D_StartTitle(); // start up intro loop
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "d_event.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
extern const char* extraWad;
|
||||
|
@ -40,8 +40,8 @@ extern const char* extraWad;
|
|||
#define MAXWADFILES 20
|
||||
extern const char* wadfiles[MAXWADFILES];
|
||||
|
||||
void D_AddExtraWadFile( const char *file );
|
||||
void D_AddFile ( const char *file);
|
||||
void D_AddExtraWadFile( 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.
|
||||
// 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.
|
||||
void D_PostEvent (event_t* ev);
|
||||
void D_PostEvent( event_t* ev );
|
||||
|
||||
|
||||
|
||||
//
|
||||
// BASE LEVEL
|
||||
//
|
||||
void D_PageTicker (void);
|
||||
void D_PageDrawer (void);
|
||||
void D_AdvanceDemo (void);
|
||||
void D_StartTitle (void);
|
||||
void D_PageTicker( void );
|
||||
void D_PageDrawer( void );
|
||||
void D_AdvanceDemo( void );
|
||||
void D_StartTitle( void );
|
||||
|
||||
//#define R_OK 0x01
|
||||
//#define X_OK 0x02
|
||||
//#define W_OK 0x04
|
||||
int access(char* name, int val);
|
||||
int access( char* name, int val );
|
||||
|
||||
|
||||
#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__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -138,14 +138,14 @@ struct doomcom_t
|
|||
class idUserCmdMgr;
|
||||
|
||||
// Create any new ticcmds and broadcast to other players.
|
||||
void NetUpdate ( idUserCmdMgr * userCmdMgr );
|
||||
void NetUpdate( idUserCmdMgr* userCmdMgr );
|
||||
|
||||
// Broadcasts special packets to other players
|
||||
// to notify of game exit
|
||||
void D_QuitNetGame (void);
|
||||
void D_QuitNetGame( void );
|
||||
|
||||
//? how many ticks to run?
|
||||
bool TryRunTics (void);
|
||||
bool TryRunTics( void );
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -47,7 +47,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "d_ticcmd.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
//
|
||||
|
@ -41,9 +41,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// action functions cleanly.
|
||||
//
|
||||
struct mobj_t;
|
||||
typedef void (*actionf_v)();
|
||||
typedef void (*actionf_p1)( mobj_t* );
|
||||
typedef void (*actionf_p2)( void*, void* );
|
||||
typedef void ( *actionf_v )();
|
||||
typedef void ( *actionf_p1 )( mobj_t* );
|
||||
typedef void ( *actionf_p2 )( void*, void* );
|
||||
|
||||
typedef union
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "doomtype.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
// The data sampled per tick (single player)
|
||||
|
|
|
@ -29,7 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "Precompiled.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "doomdef.h"
|
||||
#pragma implementation "doomdef.h"
|
||||
#endif
|
||||
#include "doomdef.h"
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ typedef enum
|
|||
// If rangecheck is undefined,
|
||||
// most parameter validation debugging code will not be compiled
|
||||
#ifdef _DEBUG
|
||||
#define RANGECHECK
|
||||
#define RANGECHECK
|
||||
#endif
|
||||
|
||||
// Do or do not use external soundserver.
|
||||
|
@ -244,10 +244,10 @@ typedef enum
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
INVULNTICS = (30*TICRATE),
|
||||
INVISTICS = (60*TICRATE),
|
||||
INFRATICS = (120*TICRATE),
|
||||
IRONTICS = (60*TICRATE)
|
||||
INVULNTICS = ( 30 * TICRATE ),
|
||||
INVISTICS = ( 60 * TICRATE ),
|
||||
INFRATICS = ( 120 * TICRATE ),
|
||||
IRONTICS = ( 60 * TICRATE )
|
||||
|
||||
} powerduration_t;
|
||||
|
||||
|
@ -338,7 +338,7 @@ typedef enum
|
|||
|
||||
|
||||
#ifndef _WIN32
|
||||
#define MAX_PATH 260
|
||||
#define MAX_PATH 260
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -55,13 +55,15 @@ static char* mpArgVPtr[4][10];
|
|||
|
||||
static bool drawFullScreen = false;
|
||||
|
||||
DoomInterface::DoomInterface() {
|
||||
DoomInterface::DoomInterface()
|
||||
{
|
||||
numplayers = 0;
|
||||
bFinished[0] = bFinished[1] = bFinished[2] = bFinished[3] = false;
|
||||
lastTicRun = 0;
|
||||
}
|
||||
|
||||
DoomInterface::~DoomInterface() {
|
||||
DoomInterface::~DoomInterface()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,85 +76,101 @@ void DoomInterface::Startup( int playerscount, bool multiplayer )
|
|||
globalNetworking = multiplayer;
|
||||
lastTicRun = 0;
|
||||
|
||||
if (DoomLib::Z_Malloc == NULL) {
|
||||
if( DoomLib::Z_Malloc == NULL )
|
||||
{
|
||||
DoomLib::Z_Malloc = Z_Malloc;
|
||||
}
|
||||
|
||||
// Splitscreen
|
||||
if ( !multiplayer && playerscount > 1 ) {
|
||||
if( !multiplayer && playerscount > 1 )
|
||||
{
|
||||
localdargc += 2; // for the '-net' and the console number
|
||||
localdargc += playerscount;
|
||||
}
|
||||
|
||||
if ( multiplayer ) {
|
||||
if( multiplayer )
|
||||
{
|
||||
// Force online games to 1 local player for now.
|
||||
// TODO: We should support local splitscreen and online.
|
||||
numplayers = 1;
|
||||
}
|
||||
|
||||
// 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;
|
||||
DoomLib::InitGlobals( NULL );
|
||||
|
||||
if ( globalNetworking ) {
|
||||
if( globalNetworking )
|
||||
{
|
||||
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( "\n" );
|
||||
DoomLib::InitGame(mpArgc[i], mpArgVPtr[i] );
|
||||
} else {
|
||||
DoomLib::InitGame(localdargc, (char **)dargv[i] );
|
||||
DoomLib::InitGame( mpArgc[i], mpArgVPtr[i] );
|
||||
}
|
||||
else
|
||||
{
|
||||
DoomLib::InitGame( localdargc, ( char** )dargv[i] );
|
||||
}
|
||||
|
||||
if( DoomLib::skipToLoad ) {
|
||||
if( DoomLib::skipToLoad )
|
||||
{
|
||||
G_LoadGame( DoomLib::loadGamePath );
|
||||
DoomLib::skipToLoad = false;
|
||||
::g->menuactive = 0;
|
||||
}
|
||||
|
||||
if( DoomLib::skipToNew ) {
|
||||
if( DoomLib::skipToNew )
|
||||
{
|
||||
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;
|
||||
::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;
|
||||
bool bAllFinished = true;
|
||||
|
||||
if ( !globalNetworking || ( lastTicRun < iTime ) ) {
|
||||
if( !globalNetworking || ( lastTicRun < iTime ) )
|
||||
{
|
||||
|
||||
drawFullScreen = false;
|
||||
|
||||
DoomLib::SetPlayer( 0 );
|
||||
DoomLib::PollNetwork();
|
||||
|
||||
for (i = 0; i < numplayers; ++i)
|
||||
for( i = 0; i < numplayers; ++i )
|
||||
{
|
||||
DoomLib::SetPlayer( i );
|
||||
|
||||
I_SetTime( iTime );
|
||||
|
||||
if (bFinished[i] == false) {
|
||||
if( bFinished[i] == false )
|
||||
{
|
||||
bAllFinished = false;
|
||||
bFinished[i] = DoomLib::Poll();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (::g->wipedone) {
|
||||
if ( !waitingForWipe ) {
|
||||
if( ::g->wipedone )
|
||||
{
|
||||
if( !waitingForWipe )
|
||||
{
|
||||
const bool didRunTic = DoomLib::Tic( userCmdMgr );
|
||||
if ( didRunTic == false ) {
|
||||
if( didRunTic == false )
|
||||
{
|
||||
//printf( "Skipping tic and yielding because not enough time has passed.\n" );
|
||||
|
||||
// Give lower priority threads a chance to run.
|
||||
|
@ -161,18 +179,20 @@ bool DoomInterface::Frame( int iTime, idUserCmdMgr * userCmdMgr )
|
|||
}
|
||||
DoomLib::Frame();
|
||||
}
|
||||
if (::g->wipe) {
|
||||
if( ::g->wipe )
|
||||
{
|
||||
DoomLib::Wipe();
|
||||
// Draw the menus over the wipe.
|
||||
M_Drawer();
|
||||
}
|
||||
|
||||
if( ::g->gamestate != GS_LEVEL && GetNumPlayers() > 2 ) {
|
||||
if( ::g->gamestate != GS_LEVEL && GetNumPlayers() > 2 )
|
||||
{
|
||||
drawFullScreen = true;
|
||||
}
|
||||
}
|
||||
|
||||
DoomLib::SetPlayer(-1);
|
||||
DoomLib::SetPlayer( -1 );
|
||||
}
|
||||
|
||||
DoomLib::SetPlayer( 0 );
|
||||
|
@ -181,7 +201,9 @@ bool DoomInterface::Frame( int iTime, idUserCmdMgr * userCmdMgr )
|
|||
DoomLib::SetPlayer( -1 );
|
||||
|
||||
lastTicRun = iTime;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
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 DoomInterface::Shutdown() {
|
||||
void DoomInterface::Shutdown()
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i=0; i < numplayers; i++ ) {
|
||||
for( i = 0; i < numplayers; i++ )
|
||||
{
|
||||
DoomLib::SetPlayer( i );
|
||||
D_QuitNetGame();
|
||||
}
|
||||
|
@ -201,7 +225,8 @@ void DoomInterface::Shutdown() {
|
|||
// Shutdown local network state
|
||||
I_ShutdownNetwork();
|
||||
|
||||
for ( i=0; i < numplayers; i++ ) {
|
||||
for( i = 0; i < numplayers; i++ )
|
||||
{
|
||||
DoomLib::SetPlayer( i );
|
||||
DoomLib::Shutdown();
|
||||
}
|
||||
|
@ -213,11 +238,14 @@ void DoomInterface::Shutdown() {
|
|||
|
||||
qboolean G_CheckDemoStatus();
|
||||
|
||||
void DoomInterface::QuitCurrentGame() {
|
||||
for ( int i = 0; i < numplayers; i++ ) {
|
||||
void DoomInterface::QuitCurrentGame()
|
||||
{
|
||||
for( int i = 0; i < numplayers; i++ )
|
||||
{
|
||||
DoomLib::SetPlayer( i );
|
||||
|
||||
if(::g->netgame) {
|
||||
if( ::g->netgame )
|
||||
{
|
||||
// Shut down networking
|
||||
D_QuitNetGame();
|
||||
}
|
||||
|
@ -241,12 +269,15 @@ void DoomInterface::QuitCurrentGame() {
|
|||
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 );
|
||||
|
||||
if(::g->netgame) {
|
||||
if( ::g->netgame )
|
||||
{
|
||||
D_QuitNetGame();
|
||||
}
|
||||
|
||||
|
@ -264,40 +295,47 @@ void DoomInterface::EndDMGame() {
|
|||
}
|
||||
|
||||
//static
|
||||
int DoomInterface::CurrentPlayer() {
|
||||
int DoomInterface::CurrentPlayer()
|
||||
{
|
||||
return DoomLib::GetPlayer();
|
||||
}
|
||||
|
||||
int DoomInterface::GetNumPlayers() const {
|
||||
int DoomInterface::GetNumPlayers() const
|
||||
{
|
||||
return numplayers;
|
||||
}
|
||||
|
||||
#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 );
|
||||
}
|
||||
#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];
|
||||
}
|
||||
|
||||
mpArgc[localPlayerIndex] = playerCount+5;
|
||||
mpArgc[localPlayerIndex] = playerCount + 5;
|
||||
|
||||
strcpy(mpArgV[localPlayerIndex][0], "doomlauncher");
|
||||
strcpy(mpArgV[localPlayerIndex][1], "-dup");
|
||||
strcpy(mpArgV[localPlayerIndex][2], "1");
|
||||
strcpy(mpArgV[localPlayerIndex][3], "-net");
|
||||
strcpy( mpArgV[localPlayerIndex][0], "doomlauncher" );
|
||||
strcpy( mpArgV[localPlayerIndex][1], "-dup" );
|
||||
strcpy( mpArgV[localPlayerIndex][2], "1" );
|
||||
strcpy( mpArgV[localPlayerIndex][3], "-net" );
|
||||
|
||||
sprintf(mpArgV[localPlayerIndex][4], "%d", localPlayer);
|
||||
strcpy(mpArgV[localPlayerIndex][5], playerAddresses[localPlayer].c_str());
|
||||
sprintf( mpArgV[localPlayerIndex][4], "%d", localPlayer );
|
||||
strcpy( mpArgV[localPlayerIndex][5], playerAddresses[localPlayer].c_str() );
|
||||
|
||||
int currentArg = 6;
|
||||
for(int i = 0; i < playerCount; i++) {
|
||||
if(i != localPlayer) {
|
||||
strcpy(mpArgV[localPlayerIndex][currentArg], playerAddresses[i].c_str());
|
||||
for( int i = 0; i < playerCount; i++ )
|
||||
{
|
||||
if( i != localPlayer )
|
||||
{
|
||||
strcpy( mpArgV[localPlayerIndex][currentArg], playerAddresses[i].c_str() );
|
||||
currentArg++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,10 +42,10 @@ public:
|
|||
DoomInterface();
|
||||
virtual ~DoomInterface();
|
||||
|
||||
typedef int ( *NoParamCallback)();
|
||||
typedef int ( *NoParamCallback )();
|
||||
|
||||
void Startup( int players, bool multiplayer = false );
|
||||
bool Frame( int time, idUserCmdMgr * userCmdMgr );
|
||||
bool Frame( int time, idUserCmdMgr* userCmdMgr );
|
||||
void Shutdown();
|
||||
void QuitCurrentGame();
|
||||
void EndDMGame();
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
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:
|
||||
int numplayers;
|
||||
|
@ -71,4 +71,4 @@ protected:
|
|||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -50,184 +50,219 @@ bool globalPauseTime = false;
|
|||
int PLAYERCOUNT = 1;
|
||||
|
||||
#ifdef _DEBUG
|
||||
bool debugOutput = true;
|
||||
bool debugOutput = true;
|
||||
#else
|
||||
bool debugOutput = false;
|
||||
bool debugOutput = false;
|
||||
#endif
|
||||
|
||||
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"
|
||||
};
|
||||
};
|
||||
|
||||
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"
|
||||
};
|
||||
};
|
||||
|
||||
static const char* Filter_Names[] = {
|
||||
static const char* Filter_Names[] =
|
||||
{
|
||||
"#str_friends", "#str_around", "#str_top15"
|
||||
};
|
||||
};
|
||||
|
||||
// Game-specific setup values.
|
||||
static const char * Doom_MapNames[] = {
|
||||
// Game-specific setup values.
|
||||
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",
|
||||
"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!",
|
||||
"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",
|
||||
"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",
|
||||
"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[] = {
|
||||
"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",
|
||||
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"
|
||||
};
|
||||
};
|
||||
|
||||
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"
|
||||
};
|
||||
};
|
||||
|
||||
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, commercial, pack_tnt, "FINAL DOOM: TNT EVILUTION", DOOMWADDIR"TNT.WAD", NULL, "base/textures/TNTICON.PNG" , TNT_MapNames },
|
||||
{ ExpansionData::IWAD, commercial, pack_plut, "FINAL DOOM: PLUTONIA EXPERIMENT", DOOMWADDIR"PLUTONIA.WAD", NULL, "base/textures/PLUTICON.PNG" , Plut_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 ];
|
||||
}
|
||||
}
|
||||
|
||||
void SetCurrentExpansion( int expansion ) {
|
||||
void SetCurrentExpansion( int expansion )
|
||||
{
|
||||
expansionDirty = true;
|
||||
expansionSelected = expansion;
|
||||
}
|
||||
}
|
||||
|
||||
void SetIdealExpansion( int expansion ) {
|
||||
void SetIdealExpansion( int expansion )
|
||||
{
|
||||
idealExpansion = expansion;
|
||||
}
|
||||
}
|
||||
|
||||
idStr currentMapName;
|
||||
idStr currentDifficulty;
|
||||
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; }
|
||||
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;
|
||||
int currentplayer = -1;
|
||||
|
||||
Globals *globaldata[4];
|
||||
Globals* globaldata[4];
|
||||
|
||||
//RecvFunc Recv;
|
||||
//SendFunc Send;
|
||||
//SendRemoteFunc SendRemote;
|
||||
//RecvFunc Recv;
|
||||
//SendFunc Send;
|
||||
//SendRemoteFunc SendRemote;
|
||||
|
||||
|
||||
bool Active = true;
|
||||
DoomInterface Interface;
|
||||
bool Active = true;
|
||||
DoomInterface Interface;
|
||||
|
||||
int idealExpansion = 0;
|
||||
int expansionSelected = 0;
|
||||
bool expansionDirty = true;
|
||||
int idealExpansion = 0;
|
||||
int expansionSelected = 0;
|
||||
bool expansionDirty = true;
|
||||
|
||||
bool skipToLoad = false;
|
||||
char loadGamePath[MAX_PATH];
|
||||
bool skipToLoad = false;
|
||||
char loadGamePath[MAX_PATH];
|
||||
|
||||
bool skipToNew = false;
|
||||
int chosenSkill = 0;
|
||||
int chosenEpisode = 1;
|
||||
bool skipToNew = false;
|
||||
int chosenSkill = 0;
|
||||
int chosenEpisode = 1;
|
||||
|
||||
idMatchParameters matchParms;
|
||||
idMatchParameters matchParms;
|
||||
|
||||
void * (*Z_Malloc)( int size, int tag, void* user ) = NULL;
|
||||
void (*Z_FreeTag)(int lowtag );
|
||||
void* ( *Z_Malloc )( int size, int tag, void* user ) = NULL;
|
||||
void ( *Z_FreeTag )( int lowtag );
|
||||
|
||||
idArray< idSysMutex, 4 > playerScreenMutexes;
|
||||
idArray< idSysMutex, 4 > playerScreenMutexes;
|
||||
|
||||
void ExitGame() {
|
||||
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 ) {
|
||||
}
|
||||
void ShowXToContinue( bool activate )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
DoomLib::GetGameSKU
|
||||
========================
|
||||
*/
|
||||
gameSKU_t GetGameSKU() {
|
||||
/*
|
||||
========================
|
||||
DoomLib::GetGameSKU
|
||||
========================
|
||||
*/
|
||||
gameSKU_t GetGameSKU()
|
||||
{
|
||||
|
||||
if ( common->GetCurrentGame() == DOOM_CLASSIC ) {
|
||||
if( common->GetCurrentGame() == DOOM_CLASSIC )
|
||||
{
|
||||
return GAME_SKU_DOOM1_BFG;
|
||||
} else if ( common->GetCurrentGame() == DOOM2_CLASSIC ) {
|
||||
}
|
||||
else if( common->GetCurrentGame() == DOOM2_CLASSIC )
|
||||
{
|
||||
return GAME_SKU_DOOM2_BFG;
|
||||
}
|
||||
|
||||
assert( false && "Invalid basepath" );
|
||||
return GAME_SKU_DCC;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
DoomLib::ActivateGame
|
||||
========================
|
||||
*/
|
||||
void ActivateGame() {
|
||||
/*
|
||||
========================
|
||||
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);
|
||||
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() ) {
|
||||
/*
|
||||
========================
|
||||
DoomLib::HandleEndMatch
|
||||
========================
|
||||
*/
|
||||
void HandleEndMatch()
|
||||
{
|
||||
if( session->GetGameLobbyBase().IsHost() )
|
||||
{
|
||||
ShowXToContinue( false );
|
||||
session->EndMatch();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -242,24 +277,28 @@ extern void I_ShutdownGraphics();
|
|||
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;
|
||||
}
|
||||
|
||||
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->InitGlobals();
|
||||
|
||||
}
|
||||
|
||||
void *DoomLib::GetGlobalData( int player ) {
|
||||
void* DoomLib::GetGlobalData( int player )
|
||||
{
|
||||
return globaldata[player];
|
||||
}
|
||||
|
||||
void DoomLib::InitControlRemap() {
|
||||
void DoomLib::InitControlRemap()
|
||||
{
|
||||
|
||||
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;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( ::g->menuactive && key == K_JOY2 ) {
|
||||
if( ::g->menuactive && key == K_JOY2 )
|
||||
{
|
||||
return K_BACKSPACE;
|
||||
}
|
||||
|
||||
return (keyNum_t)classicRemap[ key ];
|
||||
return ( keyNum_t )classicRemap[ key ];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -312,8 +356,8 @@ bool DoomLib::Poll()
|
|||
return D_DoomMainPoll();
|
||||
}
|
||||
|
||||
bool TryRunTics( idUserCmdMgr * userCmdMgr );
|
||||
bool DoomLib::Tic( idUserCmdMgr * userCmdMgr )
|
||||
bool TryRunTics( idUserCmdMgr* userCmdMgr );
|
||||
bool DoomLib::Tic( idUserCmdMgr* 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.
|
||||
// Just be careful, because the player's screen data is updated in many different
|
||||
// places.
|
||||
if ( 0 <= currentplayer && currentplayer <= 4 ) {
|
||||
if( 0 <= currentplayer && currentplayer <= 4 )
|
||||
{
|
||||
idScopedCriticalSection crit( playerScreenMutexes[currentplayer] );
|
||||
|
||||
D_RunFrame( true );
|
||||
|
@ -343,7 +388,7 @@ void DoomLib::Frame( int realoffset, int buffer )
|
|||
|
||||
void DoomLib::Draw()
|
||||
{
|
||||
R_RenderPlayerView (&::g->players[::g->displayplayer]);
|
||||
R_RenderPlayerView( &::g->players[::g->displayplayer] );
|
||||
}
|
||||
|
||||
angle_t GetViewAngle()
|
||||
|
@ -354,8 +399,8 @@ angle_t GetViewAngle()
|
|||
void SetViewAngle( angle_t ang )
|
||||
{
|
||||
g->viewangle = ang;
|
||||
::g->viewxoffset = (finesine[g->viewangle>>ANGLETOFINESHIFT]*::g->realoffset) >> 8;
|
||||
::g->viewyoffset = (finecosine[g->viewangle>>ANGLETOFINESHIFT]*::g->realoffset) >> 8;
|
||||
::g->viewxoffset = ( finesine[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;
|
||||
}
|
||||
|
||||
void DoomLib::Shutdown() {
|
||||
void DoomLib::Shutdown()
|
||||
{
|
||||
//D_QuitNetGame ();
|
||||
I_ShutdownSound();
|
||||
I_ShutdownGraphics();
|
||||
|
@ -389,12 +435,14 @@ void DoomLib::Shutdown() {
|
|||
W_Shutdown();
|
||||
|
||||
// De-allocate the zone memory (never happened in original doom, until quit)
|
||||
if ( ::g->mainzone ) {
|
||||
if( ::g->mainzone )
|
||||
{
|
||||
free( ::g->mainzone );
|
||||
}
|
||||
|
||||
// Delete the globals
|
||||
if ( globaldata[currentplayer] ) {
|
||||
if( globaldata[currentplayer] )
|
||||
{
|
||||
delete globaldata[currentplayer];
|
||||
globaldata[currentplayer] = NULL;
|
||||
}
|
||||
|
@ -405,13 +453,16 @@ void DoomLib::SetPlayer( int id )
|
|||
{
|
||||
currentplayer = id;
|
||||
|
||||
if ( id < 0 || id >= MAX_PLAYERS ) {
|
||||
if( id < 0 || id >= MAX_PLAYERS )
|
||||
{
|
||||
g = NULL;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
|
||||
// Big Fucking hack.
|
||||
if( globalNetworking && session->GetGameLobbyBase().GetMatchParms().matchFlags | MATCH_ONLINE ) {
|
||||
if( globalNetworking && session->GetGameLobbyBase().GetMatchParms().matchFlags | MATCH_ONLINE )
|
||||
{
|
||||
currentplayer = 0;
|
||||
}
|
||||
|
||||
|
@ -433,18 +484,20 @@ int DoomLib::GetPlayer()
|
|||
return currentplayer;
|
||||
}
|
||||
|
||||
byte DoomLib::BuildSourceDest( int toNode ) {
|
||||
byte DoomLib::BuildSourceDest( int toNode )
|
||||
{
|
||||
byte sourceDest = 0;
|
||||
sourceDest |= ::g->consoleplayer << 2;
|
||||
sourceDest |= RemoteNodeToPlayerIndex( toNode );
|
||||
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;
|
||||
|
||||
*source = PlayerIndexToRemoteNode( src );
|
||||
|
@ -453,14 +506,16 @@ void DoomLib::GetSourceDest( byte sourceDest, int* source, int* dest ) {
|
|||
*dest = PlayerIndexToRemoteNode( dst );
|
||||
}
|
||||
|
||||
int nodeMap[4][4] = {
|
||||
int nodeMap[4][4] =
|
||||
{
|
||||
{0, 1, 2, 3}, //Player 0
|
||||
{1, 0, 2, 3}, //Player 1
|
||||
{2, 0, 1, 3}, //Player 2
|
||||
{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
|
||||
|
||||
/*
|
||||
|
@ -479,14 +534,16 @@ int DoomLib::RemoteNodeToPlayerIndex( int node ) {
|
|||
|
||||
}
|
||||
|
||||
int indexMap[4][4] = {
|
||||
int indexMap[4][4] =
|
||||
{
|
||||
{0, 1, 2, 3}, //Player 0
|
||||
{1, 0, 2, 3}, //Player 1
|
||||
{1, 2, 0, 3}, //Player 2
|
||||
{1, 2, 3, 0} //Player 3
|
||||
};
|
||||
|
||||
int DoomLib::PlayerIndexToRemoteNode( int index ) {
|
||||
int DoomLib::PlayerIndexToRemoteNode( int index )
|
||||
{
|
||||
/*int player = ::g->consoleplayer;
|
||||
if( index == 0 ) {
|
||||
return player;
|
||||
|
@ -498,14 +555,17 @@ int DoomLib::PlayerIndexToRemoteNode( int index ) {
|
|||
return indexMap[::g->consoleplayer][index];
|
||||
}
|
||||
|
||||
void I_Error (const char *error, ...);
|
||||
void I_Error( const char* error, ... );
|
||||
extern bool useTech5Packets;
|
||||
|
||||
void DoomLib::PollNetwork() {
|
||||
void DoomLib::PollNetwork()
|
||||
{
|
||||
#if 0
|
||||
if ( !useTech5Packets ) {
|
||||
if( !useTech5Packets )
|
||||
{
|
||||
|
||||
if ( !globalNetworking ) {
|
||||
if( !globalNetworking )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -514,15 +574,17 @@ void DoomLib::PollNetwork() {
|
|||
socklen_t fromlen;
|
||||
doomdata_t sw;
|
||||
|
||||
while(1) {
|
||||
while( 1 )
|
||||
{
|
||||
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);
|
||||
|
||||
if ( receivedSize < 0 )
|
||||
if( receivedSize < 0 )
|
||||
{
|
||||
int err = sys_net_errno;
|
||||
if (err != SYS_NET_EWOULDBLOCK ) {
|
||||
I_Error ("GetPacket: %d", err );
|
||||
if( err != SYS_NET_EWOULDBLOCK )
|
||||
{
|
||||
I_Error( "GetPacket: %d", err );
|
||||
//I_Printf ("GetPacket: %s",strerror(errno));
|
||||
}
|
||||
return;
|
||||
|
@ -535,21 +597,24 @@ void DoomLib::PollNetwork() {
|
|||
GetSourceDest( sw.sourceDest, &source, &dest );
|
||||
|
||||
//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
|
||||
}
|
||||
|
||||
void DoomLib::SendNetwork() {
|
||||
void DoomLib::SendNetwork()
|
||||
{
|
||||
|
||||
if ( !globalNetworking ) {
|
||||
if( !globalNetworking )
|
||||
{
|
||||
return;
|
||||
}
|
||||
//DoomLib::SendRemote();
|
||||
}
|
||||
|
||||
void DoomLib::RunSound() {
|
||||
void DoomLib::RunSound()
|
||||
{
|
||||
|
||||
I_ProcessSoundEvents();
|
||||
}
|
||||
|
|
|
@ -63,7 +63,8 @@ struct rumble_t
|
|||
|
||||
};
|
||||
|
||||
enum gameSKU_t {
|
||||
enum gameSKU_t
|
||||
{
|
||||
GAME_SKU_DCC = 0, // Doom Classic Complete
|
||||
GAME_SKU_DOOM1_BFG, // Doom 1 Ran from BFG
|
||||
GAME_SKU_DOOM2_BFG, // Doom 2 Ran from BFG
|
||||
|
@ -75,16 +76,17 @@ enum gameSKU_t {
|
|||
ExpansionData
|
||||
================================================================================================
|
||||
*/
|
||||
struct ExpansionData {
|
||||
struct ExpansionData
|
||||
{
|
||||
|
||||
enum { IWAD = 0, PWAD = 1 } type;
|
||||
GameMode_t gameMode;
|
||||
GameMission_t pack_type;
|
||||
const char * expansionName;
|
||||
const char * iWadFilename;
|
||||
const char * pWadFilename;
|
||||
const char * saveImageFile;
|
||||
const char ** mapNames;
|
||||
const char* expansionName;
|
||||
const char* iWadFilename;
|
||||
const char* pWadFilename;
|
||||
const char* saveImageFile;
|
||||
const char** mapNames;
|
||||
|
||||
|
||||
};
|
||||
|
@ -93,75 +95,75 @@ struct ExpansionData {
|
|||
|
||||
namespace DoomLib
|
||||
{
|
||||
//typedef int ( *RecvFunc)( char* buff, DWORD *numRecv );
|
||||
//typedef int ( *SendFunc)( const char* buff, DWORD size, sockaddr_in *target, int toNode );
|
||||
//typedef int ( *SendRemoteFunc)();
|
||||
//typedef int ( *RecvFunc)( char* buff, DWORD *numRecv );
|
||||
//typedef int ( *SendFunc)( const char* buff, DWORD size, sockaddr_in *target, int toNode );
|
||||
//typedef int ( *SendRemoteFunc)();
|
||||
|
||||
void InitGlobals( void *ptr = NULL );
|
||||
void InitGame( int argc, char ** argv );
|
||||
void InitControlRemap();
|
||||
keyNum_t RemapControl( keyNum_t key );
|
||||
bool Poll();
|
||||
bool Tic( idUserCmdMgr * userCmdMgr );
|
||||
void Wipe();
|
||||
void Frame( int realoffset = 0, int buffer = 0 );
|
||||
void Draw();
|
||||
void Shutdown();
|
||||
void InitGlobals( void* ptr = NULL );
|
||||
void InitGame( int argc, char** argv );
|
||||
void InitControlRemap();
|
||||
keyNum_t RemapControl( keyNum_t key );
|
||||
bool Poll();
|
||||
bool Tic( idUserCmdMgr* userCmdMgr );
|
||||
void Wipe();
|
||||
void Frame( int realoffset = 0, int buffer = 0 );
|
||||
void Draw();
|
||||
void Shutdown();
|
||||
|
||||
//void SetNetworking( RecvFunc rf, SendFunc sf, SendRemoteFunc sendRemote );
|
||||
//void SetNetworking( RecvFunc rf, SendFunc sf, SendRemoteFunc sendRemote );
|
||||
|
||||
void SetPlayer( int id );
|
||||
int GetPlayer();
|
||||
void SetPlayer( int id );
|
||||
int GetPlayer();
|
||||
|
||||
byte BuildSourceDest( int toNode );
|
||||
void GetSourceDest( byte sourceDest, int* source, int* dest );
|
||||
byte BuildSourceDest( int toNode );
|
||||
void GetSourceDest( byte sourceDest, int* source, int* dest );
|
||||
|
||||
int RemoteNodeToPlayerIndex( int node );
|
||||
int PlayerIndexToRemoteNode( int index );
|
||||
int RemoteNodeToPlayerIndex( int node );
|
||||
int PlayerIndexToRemoteNode( int index );
|
||||
|
||||
void PollNetwork();
|
||||
void SendNetwork();
|
||||
void PollNetwork();
|
||||
void SendNetwork();
|
||||
|
||||
void *GetGlobalData( int player );
|
||||
void* GetGlobalData( int player );
|
||||
|
||||
void RunSound();
|
||||
void RunSound();
|
||||
|
||||
//extern RecvFunc Recv;
|
||||
//extern SendFunc Send;
|
||||
//extern SendRemoteFunc SendRemote;
|
||||
//extern RecvFunc Recv;
|
||||
//extern SendFunc Send;
|
||||
//extern SendRemoteFunc SendRemote;
|
||||
|
||||
extern void* (*Z_Malloc)( int size, int tag, void* user );
|
||||
extern void (*Z_FreeTag)(int lowtag );
|
||||
extern void* ( *Z_Malloc )( int size, int tag, void* user );
|
||||
extern void ( *Z_FreeTag )( int lowtag );
|
||||
|
||||
extern DoomInterface Interface;
|
||||
extern int idealExpansion;
|
||||
extern int expansionSelected;
|
||||
extern bool expansionDirty;
|
||||
extern DoomInterface Interface;
|
||||
extern int idealExpansion;
|
||||
extern int expansionSelected;
|
||||
extern bool expansionDirty;
|
||||
|
||||
extern bool skipToLoad;
|
||||
extern char loadGamePath[MAX_PATH];
|
||||
extern bool skipToLoad;
|
||||
extern char loadGamePath[MAX_PATH];
|
||||
|
||||
extern bool skipToNew;
|
||||
extern int chosenSkill;
|
||||
extern int chosenEpisode;
|
||||
extern bool skipToNew;
|
||||
extern int chosenSkill;
|
||||
extern int chosenEpisode;
|
||||
|
||||
extern idMatchParameters matchParms;
|
||||
extern idMatchParameters matchParms;
|
||||
|
||||
const ExpansionData * GetCurrentExpansion();
|
||||
void SetCurrentExpansion( int expansion );
|
||||
const ExpansionData* GetCurrentExpansion();
|
||||
void SetCurrentExpansion( int expansion );
|
||||
|
||||
void SetIdealExpansion( int expansion );
|
||||
void SetIdealExpansion( int expansion );
|
||||
|
||||
void SetCurrentMapName( idStr name );
|
||||
const idStr & GetCurrentMapName();
|
||||
void SetCurrentDifficulty( idStr name );
|
||||
const idStr & GetCurrentDifficulty();
|
||||
void SetCurrentMapName( idStr name );
|
||||
const idStr& GetCurrentMapName();
|
||||
void SetCurrentDifficulty( idStr name );
|
||||
const idStr& GetCurrentDifficulty();
|
||||
|
||||
void ActivateGame();
|
||||
void ExitGame();
|
||||
void ShowXToContinue( bool activate );
|
||||
gameSKU_t GetGameSKU();
|
||||
void HandleEndMatch();
|
||||
void ActivateGame();
|
||||
void ExitGame();
|
||||
void ShowXToContinue( bool activate );
|
||||
gameSKU_t GetGameSKU();
|
||||
void HandleEndMatch();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "doomstat.h"
|
||||
#pragma implementation "doomstat.h"
|
||||
#endif
|
||||
#include "doomstat.h"
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -29,14 +29,14 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "Precompiled.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "dstrings.h"
|
||||
#pragma implementation "dstrings.h"
|
||||
#endif
|
||||
#include "dstrings.h"
|
||||
|
||||
#include "globaldata.h"
|
||||
|
||||
|
||||
const char* endmsg[NUM_QUITMESSAGES+1]=
|
||||
const char* endmsg[NUM_QUITMESSAGES + 1] =
|
||||
{
|
||||
// DOOM1
|
||||
QUITMSG,
|
||||
|
|
|
@ -90,15 +90,15 @@ const char* t6text = T6TEXT;
|
|||
const char* finaletext;
|
||||
const char* finaleflat;
|
||||
|
||||
void F_StartCast (void);
|
||||
void F_CastTicker (void);
|
||||
qboolean F_CastResponder (event_t *ev);
|
||||
void F_CastDrawer (void);
|
||||
void F_StartCast( void );
|
||||
void F_CastTicker( void );
|
||||
qboolean F_CastResponder( event_t* ev );
|
||||
void F_CastDrawer( void );
|
||||
|
||||
//
|
||||
// F_StartFinale
|
||||
//
|
||||
void F_StartFinale (void)
|
||||
void F_StartFinale( void )
|
||||
{
|
||||
::g->gameaction = ga_nothing;
|
||||
::g->gamestate = GS_FINALE;
|
||||
|
@ -108,13 +108,16 @@ void F_StartFinale (void)
|
|||
// Check for end of episode/mission
|
||||
bool endOfMission = false;
|
||||
|
||||
if ( ( ::g->gamemission == doom || ::g->gamemission == doom2 || ::g->gamemission == pack_tnt || ::g->gamemission == pack_plut ) && ::g->gamemap == 30 ) {
|
||||
if( ( ::g->gamemission == doom || ::g->gamemission == doom2 || ::g->gamemission == pack_tnt || ::g->gamemission == pack_plut ) && ::g->gamemap == 30 )
|
||||
{
|
||||
endOfMission = true;
|
||||
}
|
||||
else if ( ::g->gamemission == pack_nerve && ::g->gamemap == 8 ) {
|
||||
else if( ::g->gamemission == pack_nerve && ::g->gamemap == 8 )
|
||||
{
|
||||
endOfMission = true;
|
||||
}
|
||||
else if ( ::g->gamemission == pack_master && ::g->gamemap == 21 ) {
|
||||
else if( ::g->gamemission == pack_master && ::g->gamemap == 21 )
|
||||
{
|
||||
endOfMission = true;
|
||||
}
|
||||
|
||||
|
@ -123,7 +126,7 @@ void F_StartFinale (void)
|
|||
// Okay - IWAD dependend stuff.
|
||||
// This has been changed severly, and
|
||||
// some stuff might have changed in the process.
|
||||
switch ( ::g->gamemode )
|
||||
switch( ::g->gamemode )
|
||||
{
|
||||
|
||||
// DOOM 1 - E1, E3 or E4, but each nine missions
|
||||
|
@ -131,9 +134,9 @@ void F_StartFinale (void)
|
|||
case registered:
|
||||
case retail:
|
||||
{
|
||||
S_ChangeMusic(mus_victor, true);
|
||||
S_ChangeMusic( mus_victor, true );
|
||||
|
||||
switch (::g->gameepisode)
|
||||
switch( ::g->gameepisode )
|
||||
{
|
||||
case 1:
|
||||
finaleflat = "FLOOR4_8";
|
||||
|
@ -161,10 +164,11 @@ void F_StartFinale (void)
|
|||
// DOOM II and missions packs with E1, M34
|
||||
case commercial:
|
||||
{
|
||||
S_ChangeMusic(mus_read_m, true);
|
||||
S_ChangeMusic( mus_read_m, true );
|
||||
|
||||
if ( ::g->gamemission == doom2 || ::g->gamemission == pack_tnt || ::g->gamemission == pack_plut ) {
|
||||
switch (::g->gamemap)
|
||||
if( ::g->gamemission == doom2 || ::g->gamemission == pack_tnt || ::g->gamemission == pack_plut )
|
||||
{
|
||||
switch( ::g->gamemap )
|
||||
{
|
||||
case 6:
|
||||
finaleflat = "SLIME16";
|
||||
|
@ -194,16 +198,21 @@ void F_StartFinale (void)
|
|||
// Ouch.
|
||||
break;
|
||||
}
|
||||
} else if( ::g->gamemission == pack_master ) {
|
||||
switch (::g->gamemap)
|
||||
}
|
||||
else if( ::g->gamemission == pack_master )
|
||||
{
|
||||
switch( ::g->gamemap )
|
||||
{
|
||||
case 21:
|
||||
finaleflat = "SLIME16";
|
||||
finaletext = c8Text;
|
||||
break;
|
||||
}
|
||||
} else if ( ::g->gamemission == pack_nerve ) {
|
||||
switch( ::g->gamemap ){
|
||||
}
|
||||
else if( ::g->gamemission == pack_nerve )
|
||||
{
|
||||
switch( ::g->gamemap )
|
||||
{
|
||||
case 8:
|
||||
finaleflat = "SLIME16";
|
||||
finaletext = c7text;
|
||||
|
@ -216,7 +225,7 @@ void F_StartFinale (void)
|
|||
|
||||
// Indeterminate.
|
||||
default:
|
||||
S_ChangeMusic(mus_read_m, true);
|
||||
S_ChangeMusic( mus_read_m, true );
|
||||
finaleflat = "F_SKY1"; // Not used anywhere else.
|
||||
finaletext = c1text; // FIXME - other text, music?
|
||||
break;
|
||||
|
@ -229,15 +238,18 @@ void F_StartFinale (void)
|
|||
|
||||
bool finaleButtonPressed = false;
|
||||
bool startButtonPressed = false;
|
||||
qboolean F_Responder (event_t *event)
|
||||
qboolean F_Responder( event_t* event )
|
||||
{
|
||||
if( !common->IsMultiplayer() && event->type == ev_keydown && event->data1 == KEY_ESCAPE ) {
|
||||
if( !common->IsMultiplayer() && event->type == ev_keydown && event->data1 == KEY_ESCAPE )
|
||||
{
|
||||
startButtonPressed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (::g->finalestage == 2)
|
||||
return F_CastResponder (event);
|
||||
if( ::g->finalestage == 2 )
|
||||
{
|
||||
return F_CastResponder( event );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -246,42 +258,53 @@ qboolean F_Responder (event_t *event)
|
|||
//
|
||||
// F_Ticker
|
||||
//
|
||||
void F_Ticker (void)
|
||||
void F_Ticker( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
// check for skipping
|
||||
if ( (::g->gamemode == commercial) && ( ::g->finalecount > 50) )
|
||||
if( ( ::g->gamemode == commercial ) && ( ::g->finalecount > 50 ) )
|
||||
{
|
||||
// go on to the next level
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
if (::g->players[i].cmd.buttons)
|
||||
for( i = 0 ; i < MAXPLAYERS ; i++ )
|
||||
if( ::g->players[i].cmd.buttons )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if ( finaleButtonPressed || i < MAXPLAYERS)
|
||||
if( finaleButtonPressed || i < MAXPLAYERS )
|
||||
{
|
||||
bool castStarted = false;
|
||||
if( ::g->gamemission == doom2 || ::g->gamemission == pack_plut || ::g->gamemission == pack_tnt ) {
|
||||
if (::g->gamemap == 30) {
|
||||
F_StartCast ();
|
||||
if( ::g->gamemission == doom2 || ::g->gamemission == pack_plut || ::g->gamemission == pack_tnt )
|
||||
{
|
||||
if( ::g->gamemap == 30 )
|
||||
{
|
||||
F_StartCast();
|
||||
castStarted = true;
|
||||
}
|
||||
|
||||
} else if( ::g->gamemission == pack_master ) {
|
||||
if( :: g->gamemap == 21 ) {
|
||||
F_StartCast ();
|
||||
}
|
||||
else if( ::g->gamemission == pack_master )
|
||||
{
|
||||
if( :: g->gamemap == 21 )
|
||||
{
|
||||
F_StartCast();
|
||||
castStarted = true;
|
||||
}
|
||||
|
||||
} else if( ::g->gamemission == pack_nerve ) {
|
||||
if( :: g->gamemap == 8 ) {
|
||||
F_StartCast ();
|
||||
}
|
||||
else if( ::g->gamemission == pack_nerve )
|
||||
{
|
||||
if( :: g->gamemap == 8 )
|
||||
{
|
||||
F_StartCast();
|
||||
castStarted = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( castStarted == false ) {
|
||||
if( castStarted == false )
|
||||
{
|
||||
::g->gameaction = ga_worlddone;
|
||||
}
|
||||
}
|
||||
|
@ -293,28 +316,32 @@ void F_Ticker (void)
|
|||
::g->finalecount++;
|
||||
finaleButtonPressed = false;
|
||||
|
||||
if (::g->finalestage == 2)
|
||||
if( ::g->finalestage == 2 )
|
||||
{
|
||||
F_CastTicker ();
|
||||
F_CastTicker();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ::g->gamemode == commercial) {
|
||||
if( ::g->gamemode == commercial )
|
||||
{
|
||||
startButtonPressed = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if( SkipTheText && ( ::g->finalecount > 50) ) {
|
||||
::g->finalecount = static_cast<int>(strlen(finaletext)) * TEXTSPEED + TEXTWAIT;
|
||||
if( SkipTheText && ( ::g->finalecount > 50 ) )
|
||||
{
|
||||
::g->finalecount = static_cast<int>( strlen( finaletext ) ) * TEXTSPEED + TEXTWAIT;
|
||||
}
|
||||
|
||||
if (!::g->finalestage && ::g->finalecount > static_cast<int>(strlen(finaletext)) * TEXTSPEED + TEXTWAIT)
|
||||
if( !::g->finalestage && ::g->finalecount > static_cast<int>( strlen( finaletext ) ) * TEXTSPEED + TEXTWAIT )
|
||||
{
|
||||
::g->finalecount = 0;
|
||||
::g->finalestage = 1;
|
||||
::g->wipegamestate = (gamestate_t)-1; // force a wipe
|
||||
if (::g->gameepisode == 3)
|
||||
S_StartMusic (mus_bunny);
|
||||
::g->wipegamestate = ( gamestate_t ) - 1; // force a wipe
|
||||
if( ::g->gameepisode == 3 )
|
||||
{
|
||||
S_StartMusic( mus_bunny );
|
||||
}
|
||||
}
|
||||
|
||||
startButtonPressed = false;
|
||||
|
@ -330,74 +357,81 @@ void F_Ticker (void)
|
|||
#include "hu_stuff.h"
|
||||
|
||||
|
||||
void F_TextWrite (void)
|
||||
void F_TextWrite( void )
|
||||
{
|
||||
byte* src;
|
||||
byte* dest;
|
||||
|
||||
int x,y,w;
|
||||
int x, y, w;
|
||||
int count;
|
||||
const char* ch;
|
||||
int c;
|
||||
int cx;
|
||||
int cy;
|
||||
|
||||
if(::g->finalecount == 60 ) {
|
||||
if( ::g->finalecount == 60 )
|
||||
{
|
||||
DoomLib::ShowXToContinue( true );
|
||||
}
|
||||
|
||||
// erase the entire screen to a tiled background
|
||||
src = (byte*)W_CacheLumpName ( finaleflat , PU_CACHE_SHARED);
|
||||
src = ( byte* )W_CacheLumpName( finaleflat , PU_CACHE_SHARED );
|
||||
dest = ::g->screens[0];
|
||||
|
||||
for (y=0 ; y<SCREENHEIGHT ; y++)
|
||||
for( y = 0 ; y < SCREENHEIGHT ; y++ )
|
||||
{
|
||||
for (x=0 ; x<SCREENWIDTH/64 ; x++)
|
||||
for( x = 0 ; x < SCREENWIDTH / 64 ; x++ )
|
||||
{
|
||||
memcpy (dest, src+((y&63)<<6), 64);
|
||||
memcpy( dest, src + ( ( y & 63 ) << 6 ), 64 );
|
||||
dest += 64;
|
||||
}
|
||||
if (SCREENWIDTH&63)
|
||||
if( SCREENWIDTH & 63 )
|
||||
{
|
||||
memcpy (dest, src+((y&63)<<6), SCREENWIDTH&63);
|
||||
dest += (SCREENWIDTH&63);
|
||||
memcpy( dest, src + ( ( y & 63 ) << 6 ), SCREENWIDTH & 63 );
|
||||
dest += ( SCREENWIDTH & 63 );
|
||||
}
|
||||
}
|
||||
|
||||
V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
|
||||
V_MarkRect( 0, 0, SCREENWIDTH, SCREENHEIGHT );
|
||||
|
||||
// draw some of the text onto the screen
|
||||
cx = 10;
|
||||
cy = 10;
|
||||
ch = finaletext;
|
||||
|
||||
count = (::g->finalecount - 10)/TEXTSPEED;
|
||||
if (count < 0)
|
||||
count = ( ::g->finalecount - 10 ) / TEXTSPEED;
|
||||
if( count < 0 )
|
||||
{
|
||||
count = 0;
|
||||
for ( ; count ; count-- )
|
||||
}
|
||||
for( ; count ; count-- )
|
||||
{
|
||||
c = *ch++;
|
||||
if (!c)
|
||||
if( !c )
|
||||
{
|
||||
break;
|
||||
if (c == '\n')
|
||||
}
|
||||
if( c == '\n' )
|
||||
{
|
||||
cx = 10;
|
||||
cy += 11;
|
||||
continue;
|
||||
}
|
||||
|
||||
c = toupper(c) - HU_FONTSTART;
|
||||
if (c < 0 || c> HU_FONTSIZE)
|
||||
c = toupper( c ) - HU_FONTSTART;
|
||||
if( c < 0 || c > HU_FONTSIZE )
|
||||
{
|
||||
cx += 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
w = SHORT (::g->hu_font[c]->width);
|
||||
if (cx+w > SCREENWIDTH)
|
||||
w = SHORT( ::g->hu_font[c]->width );
|
||||
if( cx + w > SCREENWIDTH )
|
||||
{
|
||||
break;
|
||||
V_DrawPatch(cx, cy, 0, ::g->hu_font[c]);
|
||||
cx+=w;
|
||||
}
|
||||
V_DrawPatch( cx, cy, 0, ::g->hu_font[c] );
|
||||
cx += w;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -428,7 +462,7 @@ castinfo_t castorder[] =
|
|||
{CC_CYBER, MT_CYBORG},
|
||||
{CC_HERO, MT_PLAYER},
|
||||
|
||||
{NULL,(mobjtype_t)0}
|
||||
{NULL, ( mobjtype_t )0}
|
||||
};
|
||||
|
||||
|
||||
|
@ -438,10 +472,11 @@ castinfo_t castorder[] =
|
|||
//
|
||||
|
||||
|
||||
void F_StartCast (void)
|
||||
void F_StartCast( void )
|
||||
{
|
||||
if ( ::g->finalestage != 2 ) {
|
||||
::g->wipegamestate = (gamestate_t)-1; // force a screen wipe
|
||||
if( ::g->finalestage != 2 )
|
||||
{
|
||||
::g->wipegamestate = ( gamestate_t ) - 1; // force a screen wipe
|
||||
::g->castnum = 0;
|
||||
::g->caststate = &::g->states[mobjinfo[castorder[::g->castnum].type].seestate];
|
||||
::g->casttics = ::g->caststate->tics;
|
||||
|
@ -450,7 +485,7 @@ void F_StartCast (void)
|
|||
::g->castframes = 0;
|
||||
::g->castonmelee = 0;
|
||||
::g->castattacking = false;
|
||||
S_ChangeMusic(mus_evil, true);
|
||||
S_ChangeMusic( mus_evil, true );
|
||||
|
||||
::g->caststartmenu = ::g->finalecount + 50;
|
||||
}
|
||||
|
@ -460,101 +495,152 @@ void F_StartCast (void)
|
|||
//
|
||||
// F_CastTicker
|
||||
//
|
||||
void F_CastTicker (void)
|
||||
void F_CastTicker( void )
|
||||
{
|
||||
int st;
|
||||
int sfx;
|
||||
|
||||
if( ::g->finalecount == ::g->caststartmenu ) {
|
||||
if( ::g->finalecount == ::g->caststartmenu )
|
||||
{
|
||||
DoomLib::ShowXToContinue( true );
|
||||
}
|
||||
|
||||
if (--::g->casttics > 0)
|
||||
if( --::g->casttics > 0 )
|
||||
{
|
||||
return; // not time to change state yet
|
||||
}
|
||||
|
||||
if (::g->caststate->tics == -1 || ::g->caststate->nextstate == S_NULL)
|
||||
if( ::g->caststate->tics == -1 || ::g->caststate->nextstate == S_NULL )
|
||||
{
|
||||
// switch from deathstate to next monster
|
||||
::g->castnum++;
|
||||
::g->castdeath = false;
|
||||
if (castorder[::g->castnum].name == NULL)
|
||||
if( castorder[::g->castnum].name == NULL )
|
||||
{
|
||||
::g->castnum = 0;
|
||||
if (mobjinfo[castorder[::g->castnum].type].seesound)
|
||||
S_StartSound (NULL, mobjinfo[castorder[::g->castnum].type].seesound);
|
||||
}
|
||||
if( mobjinfo[castorder[::g->castnum].type].seesound )
|
||||
{
|
||||
S_StartSound( NULL, mobjinfo[castorder[::g->castnum].type].seesound );
|
||||
}
|
||||
::g->caststate = &::g->states[mobjinfo[castorder[::g->castnum].type].seestate];
|
||||
::g->castframes = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// just advance to next state in animation
|
||||
if (::g->caststate == &::g->states[S_PLAY_ATK1])
|
||||
if( ::g->caststate == &::g->states[S_PLAY_ATK1] )
|
||||
{
|
||||
goto stopattack; // Oh, gross hack!
|
||||
}
|
||||
st = ::g->caststate->nextstate;
|
||||
::g->caststate = &::g->states[st];
|
||||
::g->castframes++;
|
||||
|
||||
// sound hacks....
|
||||
switch (st)
|
||||
switch( st )
|
||||
{
|
||||
case S_PLAY_ATK1: sfx = sfx_dshtgn; break;
|
||||
case S_POSS_ATK2: sfx = sfx_pistol; break;
|
||||
case S_SPOS_ATK2: sfx = sfx_shotgn; break;
|
||||
case S_VILE_ATK2: sfx = sfx_vilatk; break;
|
||||
case S_SKEL_FIST2: sfx = sfx_skeswg; break;
|
||||
case S_SKEL_FIST4: sfx = sfx_skepch; break;
|
||||
case S_SKEL_MISS2: sfx = sfx_skeatk; break;
|
||||
case S_PLAY_ATK1:
|
||||
sfx = sfx_dshtgn;
|
||||
break;
|
||||
case S_POSS_ATK2:
|
||||
sfx = sfx_pistol;
|
||||
break;
|
||||
case S_SPOS_ATK2:
|
||||
sfx = sfx_shotgn;
|
||||
break;
|
||||
case S_VILE_ATK2:
|
||||
sfx = sfx_vilatk;
|
||||
break;
|
||||
case S_SKEL_FIST2:
|
||||
sfx = sfx_skeswg;
|
||||
break;
|
||||
case S_SKEL_FIST4:
|
||||
sfx = sfx_skepch;
|
||||
break;
|
||||
case S_SKEL_MISS2:
|
||||
sfx = sfx_skeatk;
|
||||
break;
|
||||
case S_FATT_ATK8:
|
||||
case S_FATT_ATK5:
|
||||
case S_FATT_ATK2: sfx = sfx_firsht; break;
|
||||
case S_FATT_ATK2:
|
||||
sfx = sfx_firsht;
|
||||
break;
|
||||
case S_CPOS_ATK2:
|
||||
case S_CPOS_ATK3:
|
||||
case S_CPOS_ATK4: sfx = sfx_shotgn; break;
|
||||
case S_TROO_ATK3: sfx = sfx_claw; break;
|
||||
case S_SARG_ATK2: sfx = sfx_sgtatk; break;
|
||||
case S_CPOS_ATK4:
|
||||
sfx = sfx_shotgn;
|
||||
break;
|
||||
case S_TROO_ATK3:
|
||||
sfx = sfx_claw;
|
||||
break;
|
||||
case S_SARG_ATK2:
|
||||
sfx = sfx_sgtatk;
|
||||
break;
|
||||
case S_BOSS_ATK2:
|
||||
case S_BOS2_ATK2:
|
||||
case S_HEAD_ATK2: sfx = sfx_firsht; break;
|
||||
case S_SKULL_ATK2: sfx = sfx_sklatk; break;
|
||||
case S_HEAD_ATK2:
|
||||
sfx = sfx_firsht;
|
||||
break;
|
||||
case S_SKULL_ATK2:
|
||||
sfx = sfx_sklatk;
|
||||
break;
|
||||
case S_SPID_ATK2:
|
||||
case S_SPID_ATK3: sfx = sfx_shotgn; break;
|
||||
case S_BSPI_ATK2: sfx = sfx_plasma; break;
|
||||
case S_SPID_ATK3:
|
||||
sfx = sfx_shotgn;
|
||||
break;
|
||||
case S_BSPI_ATK2:
|
||||
sfx = sfx_plasma;
|
||||
break;
|
||||
case S_CYBER_ATK2:
|
||||
case S_CYBER_ATK4:
|
||||
case S_CYBER_ATK6: sfx = sfx_rlaunc; break;
|
||||
case S_PAIN_ATK3: sfx = sfx_sklatk; break;
|
||||
default: sfx = 0; break;
|
||||
case S_CYBER_ATK6:
|
||||
sfx = sfx_rlaunc;
|
||||
break;
|
||||
case S_PAIN_ATK3:
|
||||
sfx = sfx_sklatk;
|
||||
break;
|
||||
default:
|
||||
sfx = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (sfx)
|
||||
S_StartSound (NULL, sfx);
|
||||
if( sfx )
|
||||
{
|
||||
S_StartSound( NULL, sfx );
|
||||
}
|
||||
}
|
||||
|
||||
if (::g->castframes == 12)
|
||||
if( ::g->castframes == 12 )
|
||||
{
|
||||
// go into attack frame
|
||||
::g->castattacking = true;
|
||||
if (::g->castonmelee)
|
||||
::g->caststate=&::g->states[mobjinfo[castorder[::g->castnum].type].meleestate];
|
||||
else
|
||||
::g->caststate=&::g->states[mobjinfo[castorder[::g->castnum].type].missilestate];
|
||||
::g->castonmelee ^= 1;
|
||||
if (::g->caststate == &::g->states[S_NULL])
|
||||
if( ::g->castonmelee )
|
||||
{
|
||||
if (::g->castonmelee)
|
||||
::g->caststate=
|
||||
::g->caststate = &::g->states[mobjinfo[castorder[::g->castnum].type].meleestate];
|
||||
}
|
||||
else
|
||||
{
|
||||
::g->caststate = &::g->states[mobjinfo[castorder[::g->castnum].type].missilestate];
|
||||
}
|
||||
::g->castonmelee ^= 1;
|
||||
if( ::g->caststate == &::g->states[S_NULL] )
|
||||
{
|
||||
if( ::g->castonmelee )
|
||||
::g->caststate =
|
||||
&::g->states[mobjinfo[castorder[::g->castnum].type].meleestate];
|
||||
else
|
||||
::g->caststate=
|
||||
::g->caststate =
|
||||
&::g->states[mobjinfo[castorder[::g->castnum].type].missilestate];
|
||||
}
|
||||
}
|
||||
|
||||
if (::g->castattacking)
|
||||
if( ::g->castattacking )
|
||||
{
|
||||
if (::g->castframes == 24
|
||||
if( ::g->castframes == 24
|
||||
|| ::g->caststate == &::g->states[mobjinfo[castorder[::g->castnum].type].seestate] )
|
||||
{
|
||||
stopattack:
|
||||
stopattack:
|
||||
::g->castattacking = false;
|
||||
::g->castframes = 0;
|
||||
::g->caststate = &::g->states[mobjinfo[castorder[::g->castnum].type].seestate];
|
||||
|
@ -562,8 +648,10 @@ void F_CastTicker (void)
|
|||
}
|
||||
|
||||
::g->casttics = ::g->caststate->tics;
|
||||
if (::g->casttics == -1)
|
||||
if( ::g->casttics == -1 )
|
||||
{
|
||||
::g->casttics = 15;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -571,13 +659,17 @@ void F_CastTicker (void)
|
|||
// F_CastResponder
|
||||
//
|
||||
|
||||
qboolean F_CastResponder (event_t* ev)
|
||||
qboolean F_CastResponder( event_t* ev )
|
||||
{
|
||||
if (ev->type != ev_keydown)
|
||||
if( ev->type != ev_keydown )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (::g->castdeath)
|
||||
if( ::g->castdeath )
|
||||
{
|
||||
return true; // already in dying frames
|
||||
}
|
||||
|
||||
// go into death frame
|
||||
::g->castdeath = true;
|
||||
|
@ -585,14 +677,16 @@ qboolean F_CastResponder (event_t* ev)
|
|||
::g->casttics = ::g->caststate->tics;
|
||||
::g->castframes = 0;
|
||||
::g->castattacking = false;
|
||||
if (mobjinfo[castorder[::g->castnum].type].deathsound)
|
||||
S_StartSound (NULL, mobjinfo[castorder[::g->castnum].type].deathsound);
|
||||
if( mobjinfo[castorder[::g->castnum].type].deathsound )
|
||||
{
|
||||
S_StartSound( NULL, mobjinfo[castorder[::g->castnum].type].deathsound );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void F_CastPrint (const char* text)
|
||||
void F_CastPrint( const char* text )
|
||||
{
|
||||
const char* ch;
|
||||
int c;
|
||||
|
@ -604,40 +698,44 @@ void F_CastPrint (const char* text)
|
|||
ch = text;
|
||||
width = 0;
|
||||
|
||||
while (ch)
|
||||
while( ch )
|
||||
{
|
||||
c = *ch++;
|
||||
if (!c)
|
||||
if( !c )
|
||||
{
|
||||
break;
|
||||
c = toupper(c) - HU_FONTSTART;
|
||||
if (c < 0 || c> HU_FONTSIZE)
|
||||
}
|
||||
c = toupper( c ) - HU_FONTSTART;
|
||||
if( c < 0 || c > HU_FONTSIZE )
|
||||
{
|
||||
width += 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
w = SHORT (::g->hu_font[c]->width);
|
||||
w = SHORT( ::g->hu_font[c]->width );
|
||||
width += w;
|
||||
}
|
||||
|
||||
// draw it
|
||||
cx = 160-width/2;
|
||||
cx = 160 - width / 2;
|
||||
ch = text;
|
||||
while (ch)
|
||||
while( ch )
|
||||
{
|
||||
c = *ch++;
|
||||
if (!c)
|
||||
if( !c )
|
||||
{
|
||||
break;
|
||||
c = toupper(c) - HU_FONTSTART;
|
||||
if (c < 0 || c> HU_FONTSIZE)
|
||||
}
|
||||
c = toupper( c ) - HU_FONTSTART;
|
||||
if( c < 0 || c > HU_FONTSIZE )
|
||||
{
|
||||
cx += 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
w = SHORT (::g->hu_font[c]->width);
|
||||
V_DrawPatch(cx, 180, 0, ::g->hu_font[c]);
|
||||
cx+=w;
|
||||
w = SHORT( ::g->hu_font[c]->width );
|
||||
V_DrawPatch( cx, 180, 0, ::g->hu_font[c] );
|
||||
cx += w;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -646,9 +744,9 @@ void F_CastPrint (const char* text)
|
|||
//
|
||||
// F_CastDrawer
|
||||
//
|
||||
void V_DrawPatchFlipped (int x, int y, int scrn, patch_t *patch);
|
||||
void V_DrawPatchFlipped( int x, int y, int scrn, patch_t* patch );
|
||||
|
||||
void F_CastDrawer (void)
|
||||
void F_CastDrawer( void )
|
||||
{
|
||||
spritedef_t* sprdef;
|
||||
spriteframe_t* sprframe;
|
||||
|
@ -657,21 +755,25 @@ void F_CastDrawer (void)
|
|||
patch_t* patch;
|
||||
|
||||
// erase the entire screen to a background
|
||||
V_DrawPatch (0,0,0, (patch_t*)W_CacheLumpName ("BOSSBACK", PU_CACHE_SHARED));
|
||||
V_DrawPatch( 0, 0, 0, ( patch_t* )W_CacheLumpName( "BOSSBACK", PU_CACHE_SHARED ) );
|
||||
|
||||
F_CastPrint (castorder[::g->castnum].name);
|
||||
F_CastPrint( castorder[::g->castnum].name );
|
||||
|
||||
// draw the current frame in the middle of the screen
|
||||
sprdef = &::g->sprites[::g->caststate->sprite];
|
||||
sprframe = &sprdef->spriteframes[ ::g->caststate->frame & FF_FRAMEMASK];
|
||||
lump = sprframe->lump[0];
|
||||
flip = (qboolean)sprframe->flip[0];
|
||||
flip = ( qboolean )sprframe->flip[0];
|
||||
|
||||
patch = (patch_t*)W_CacheLumpNum (lump+::g->firstspritelump, PU_CACHE_SHARED);
|
||||
if (flip)
|
||||
V_DrawPatchFlipped (160,170,0,patch);
|
||||
patch = ( patch_t* )W_CacheLumpNum( lump +::g->firstspritelump, PU_CACHE_SHARED );
|
||||
if( flip )
|
||||
{
|
||||
V_DrawPatchFlipped( 160, 170, 0, patch );
|
||||
}
|
||||
else
|
||||
V_DrawPatch (160,170,0,patch);
|
||||
{
|
||||
V_DrawPatch( 160, 170, 0, patch );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -679,39 +781,42 @@ void F_CastDrawer (void)
|
|||
// F_DrawPatchCol
|
||||
//
|
||||
void
|
||||
F_DrawPatchCol( int x, patch_t* patch, int col ) {
|
||||
F_DrawPatchCol( int x, patch_t* patch, int col )
|
||||
{
|
||||
postColumn_t* column;
|
||||
byte* source;
|
||||
int count;
|
||||
|
||||
column = (postColumn_t *)((byte *)patch + LONG(patch->columnofs[col]));
|
||||
column = ( postColumn_t* )( ( byte* )patch + LONG( patch->columnofs[col] ) );
|
||||
|
||||
int destx = x;
|
||||
int desty = 0;
|
||||
|
||||
// step through the posts in a column
|
||||
while (column->topdelta != 0xff )
|
||||
while( column->topdelta != 0xff )
|
||||
{
|
||||
source = (byte *)column + 3;
|
||||
source = ( byte* )column + 3;
|
||||
desty = column->topdelta;
|
||||
count = column->length;
|
||||
|
||||
while (count--)
|
||||
while( count-- )
|
||||
{
|
||||
int scaledx, scaledy;
|
||||
scaledx = destx * GLOBAL_IMAGE_SCALER;
|
||||
scaledy = desty * GLOBAL_IMAGE_SCALER;
|
||||
byte src = *source++;
|
||||
|
||||
for ( int i = 0; i < GLOBAL_IMAGE_SCALER; i++ ) {
|
||||
for ( int j = 0; j < GLOBAL_IMAGE_SCALER; j++ ) {
|
||||
for( int i = 0; i < GLOBAL_IMAGE_SCALER; i++ )
|
||||
{
|
||||
for( int j = 0; j < GLOBAL_IMAGE_SCALER; j++ )
|
||||
{
|
||||
::g->screens[0][( scaledx + j ) + ( scaledy + i ) * SCREENWIDTH] = src;
|
||||
}
|
||||
}
|
||||
|
||||
desty++;
|
||||
}
|
||||
column = (postColumn_t *)( (byte *)column + column->length + 4 );
|
||||
column = ( postColumn_t* )( ( byte* )column + column->length + 4 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -719,7 +824,7 @@ F_DrawPatchCol( int x, patch_t* patch, int col ) {
|
|||
//
|
||||
// F_BunnyScroll
|
||||
//
|
||||
void F_BunnyScroll (void)
|
||||
void F_BunnyScroll( void )
|
||||
{
|
||||
int scrolled;
|
||||
int x;
|
||||
|
@ -729,84 +834,98 @@ void F_BunnyScroll (void)
|
|||
char name[name_len];
|
||||
int stage;
|
||||
|
||||
p1 = (patch_t*)W_CacheLumpName ("PFUB2", PU_LEVEL_SHARED);
|
||||
p2 = (patch_t*)W_CacheLumpName ("PFUB1", PU_LEVEL_SHARED);
|
||||
p1 = ( patch_t* )W_CacheLumpName( "PFUB2", PU_LEVEL_SHARED );
|
||||
p2 = ( patch_t* )W_CacheLumpName( "PFUB1", PU_LEVEL_SHARED );
|
||||
|
||||
V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
|
||||
V_MarkRect( 0, 0, SCREENWIDTH, SCREENHEIGHT );
|
||||
|
||||
scrolled = 320 - (::g->finalecount-230)/2;
|
||||
if (scrolled > 320)
|
||||
scrolled = 320;
|
||||
if (scrolled < 0)
|
||||
scrolled = 0;
|
||||
|
||||
for ( x=0 ; x<ORIGINAL_WIDTH ; x++)
|
||||
scrolled = 320 - ( ::g->finalecount - 230 ) / 2;
|
||||
if( scrolled > 320 )
|
||||
{
|
||||
if (x+scrolled < 320)
|
||||
F_DrawPatchCol (x, p1, x+scrolled);
|
||||
else
|
||||
F_DrawPatchCol (x, p2, x+scrolled - 320);
|
||||
scrolled = 320;
|
||||
}
|
||||
if( scrolled < 0 )
|
||||
{
|
||||
scrolled = 0;
|
||||
}
|
||||
|
||||
if (::g->finalecount < 1130)
|
||||
return;
|
||||
if (::g->finalecount < 1180)
|
||||
for( x = 0 ; x < ORIGINAL_WIDTH ; x++ )
|
||||
{
|
||||
V_DrawPatch ((ORIGINAL_WIDTH-13*8)/2,
|
||||
(ORIGINAL_HEIGHT-8*8)/2,0, (patch_t*)W_CacheLumpName ("END0",PU_CACHE_SHARED));
|
||||
if( x + scrolled < 320 )
|
||||
{
|
||||
F_DrawPatchCol( x, p1, x + scrolled );
|
||||
}
|
||||
else
|
||||
{
|
||||
F_DrawPatchCol( x, p2, x + scrolled - 320 );
|
||||
}
|
||||
}
|
||||
|
||||
if( ::g->finalecount < 1130 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if( ::g->finalecount < 1180 )
|
||||
{
|
||||
V_DrawPatch( ( ORIGINAL_WIDTH - 13 * 8 ) / 2,
|
||||
( ORIGINAL_HEIGHT - 8 * 8 ) / 2, 0, ( patch_t* )W_CacheLumpName( "END0", PU_CACHE_SHARED ) );
|
||||
::g->laststage = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
stage = (::g->finalecount-1180) / 5;
|
||||
if (stage > 6)
|
||||
stage = 6;
|
||||
if (stage > ::g->laststage)
|
||||
stage = ( ::g->finalecount - 1180 ) / 5;
|
||||
if( stage > 6 )
|
||||
{
|
||||
S_StartSound (NULL, sfx_pistol);
|
||||
stage = 6;
|
||||
}
|
||||
if( stage > ::g->laststage )
|
||||
{
|
||||
S_StartSound( NULL, sfx_pistol );
|
||||
::g->laststage = stage;
|
||||
}
|
||||
|
||||
snprintf(name, name_len, "END%i", stage);
|
||||
V_DrawPatch ((ORIGINAL_WIDTH-13*8)/2, (ORIGINAL_HEIGHT-8*8)/2,0, (patch_t*)W_CacheLumpName (name,PU_CACHE_SHARED));
|
||||
snprintf( name, name_len, "END%i", stage );
|
||||
V_DrawPatch( ( ORIGINAL_WIDTH - 13 * 8 ) / 2, ( ORIGINAL_HEIGHT - 8 * 8 ) / 2, 0, ( patch_t* )W_CacheLumpName( name, PU_CACHE_SHARED ) );
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// F_Drawer
|
||||
//
|
||||
void F_Drawer (void)
|
||||
void F_Drawer( void )
|
||||
{
|
||||
if (::g->finalestage == 2)
|
||||
if( ::g->finalestage == 2 )
|
||||
{
|
||||
F_CastDrawer ();
|
||||
F_CastDrawer();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!::g->finalestage)
|
||||
F_TextWrite ();
|
||||
if( !::g->finalestage )
|
||||
{
|
||||
F_TextWrite();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (::g->gameepisode)
|
||||
switch( ::g->gameepisode )
|
||||
{
|
||||
case 1:
|
||||
if ( ::g->gamemode == retail )
|
||||
V_DrawPatch (0,0,0,
|
||||
(patch_t*)W_CacheLumpName("CREDIT",PU_CACHE_SHARED));
|
||||
if( ::g->gamemode == retail )
|
||||
V_DrawPatch( 0, 0, 0,
|
||||
( patch_t* )W_CacheLumpName( "CREDIT", PU_CACHE_SHARED ) );
|
||||
else
|
||||
V_DrawPatch (0,0,0,
|
||||
(patch_t*)W_CacheLumpName("HELP2",PU_CACHE_SHARED));
|
||||
V_DrawPatch( 0, 0, 0,
|
||||
( patch_t* )W_CacheLumpName( "HELP2", PU_CACHE_SHARED ) );
|
||||
break;
|
||||
case 2:
|
||||
V_DrawPatch(0,0,0,
|
||||
(patch_t*)W_CacheLumpName("VICTORY2",PU_CACHE_SHARED));
|
||||
V_DrawPatch( 0, 0, 0,
|
||||
( patch_t* )W_CacheLumpName( "VICTORY2", PU_CACHE_SHARED ) );
|
||||
break;
|
||||
case 3:
|
||||
F_BunnyScroll ();
|
||||
F_BunnyScroll();
|
||||
break;
|
||||
case 4:
|
||||
V_DrawPatch (0,0,0,
|
||||
(patch_t*)W_CacheLumpName("ENDPIC",PU_CACHE_SHARED));
|
||||
V_DrawPatch( 0, 0, 0,
|
||||
( patch_t* )W_CacheLumpName( "ENDPIC", PU_CACHE_SHARED ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,16 +37,16 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//
|
||||
|
||||
// Called by main loop.
|
||||
qboolean F_Responder (event_t* ev);
|
||||
qboolean F_Responder( event_t* ev );
|
||||
|
||||
// Called by main loop.
|
||||
void F_Ticker (void);
|
||||
void F_Ticker( void );
|
||||
|
||||
// Called by main loop.
|
||||
void F_Drawer (void);
|
||||
void F_Drawer( void );
|
||||
|
||||
|
||||
void F_StartFinale (void);
|
||||
void F_StartFinale( void );
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -57,11 +57,13 @@ wipe_shittyColMajorXform
|
|||
//dest = (short*) DoomLib::Z_Malloc(width*height*2, PU_STATIC, 0 );
|
||||
dest = new short[ width * height ];
|
||||
|
||||
for(y=0;y<height;y++)
|
||||
for(x=0;x<width;x++)
|
||||
dest[x*height+y] = array[y*width+x];
|
||||
for( y = 0; y < height; y++ )
|
||||
for( x = 0; x < 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);
|
||||
delete[] dest;
|
||||
|
@ -77,35 +79,40 @@ wipe_initMelt
|
|||
int i, r;
|
||||
|
||||
// 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)
|
||||
// to have stuff in column-major format
|
||||
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_start, width / 2, height );
|
||||
wipe_shittyColMajorXform( ( short* )::g->wipe_scr_end, width / 2, height );
|
||||
|
||||
// setup initial column positions
|
||||
// (::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;
|
||||
else if (::g->wipe_y[i] == -16)
|
||||
}
|
||||
else if( ::g->wipe_y[i] == -16 )
|
||||
{
|
||||
::g->wipe_y[i] = -15;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wipe_doMelt( int width, int height, int ticks ) {
|
||||
int wipe_doMelt( int width, int height, int ticks )
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int dy;
|
||||
|
@ -115,43 +122,47 @@ int wipe_doMelt( int width, int height, int ticks ) {
|
|||
short* d;
|
||||
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]++;
|
||||
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];
|
||||
}
|
||||
|
||||
s = &((short *)::g->wipe_scr_end)[i*height+::g->wipe_y[i]];
|
||||
d = &((short *)::g->wipe_scr)[::g->wipe_y[i]*width+i];
|
||||
s = &( ( short* )::g->wipe_scr_end )[i * height +::g->wipe_y[i]];
|
||||
d = &( ( short* )::g->wipe_scr )[::g->wipe_y[i] * width + i];
|
||||
|
||||
idx = 0;
|
||||
for (j=dy;j;j--)
|
||||
for( j = dy; j; j-- )
|
||||
{
|
||||
d[idx] = *(s++);
|
||||
d[idx] = *( s++ );
|
||||
idx += width;
|
||||
}
|
||||
|
||||
::g->wipe_y[i] += dy;
|
||||
|
||||
s = &((short *)::g->wipe_scr_start)[i*height];
|
||||
d = &((short *)::g->wipe_scr)[::g->wipe_y[i]*width+i];
|
||||
s = &( ( short* )::g->wipe_scr_start )[i * height];
|
||||
d = &( ( short* )::g->wipe_scr )[::g->wipe_y[i] * width + i];
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -169,7 +180,7 @@ wipe_exitMelt
|
|||
int height,
|
||||
int ticks )
|
||||
{
|
||||
Z_Free(::g->wipe_y);
|
||||
Z_Free( ::g->wipe_y );
|
||||
::g->wipe_y = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
@ -182,7 +193,7 @@ wipe_StartScreen
|
|||
int height )
|
||||
{
|
||||
::g->wipe_scr_start = ::g->screens[2];
|
||||
I_ReadScreen(::g->wipe_scr_start);
|
||||
I_ReadScreen( ::g->wipe_scr_start );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -194,8 +205,8 @@ wipe_EndScreen
|
|||
int height )
|
||||
{
|
||||
::g->wipe_scr_end = ::g->screens[3];
|
||||
I_ReadScreen(::g->wipe_scr_end);
|
||||
V_DrawBlock(x, y, 0, width, height, ::g->wipe_scr_start); // restore start scr.
|
||||
I_ReadScreen( ::g->wipe_scr_end );
|
||||
V_DrawBlock( x, y, 0, width, height, ::g->wipe_scr_start ); // restore start scr.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -210,24 +221,24 @@ wipe_ScreenWipe
|
|||
int rc;
|
||||
|
||||
// initial stuff
|
||||
if (!::g->go)
|
||||
if( !::g->go )
|
||||
{
|
||||
::g->go = 1;
|
||||
::g->wipe_scr = ::g->screens[0];
|
||||
|
||||
wipe_initMelt(width, height, ticks);
|
||||
wipe_initMelt( width, height, ticks );
|
||||
}
|
||||
|
||||
// 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
|
||||
if (rc)
|
||||
if( rc )
|
||||
{
|
||||
::g->go = 0;
|
||||
wipe_exitMelt(width, height, ticks);
|
||||
wipe_exitMelt( width, height, ticks );
|
||||
}
|
||||
|
||||
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
|
||||
//
|
||||
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.
|
||||
// A normal game starts at map 1,
|
||||
// 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,
|
||||
// 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.
|
||||
void G_SaveGame (int slot, char* description);
|
||||
void G_SaveGame( int slot, char* description );
|
||||
|
||||
// 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_TimeDemo (const char* name);
|
||||
qboolean G_CheckDemoStatus (void);
|
||||
void G_PlayDemo( char* name );
|
||||
void G_TimeDemo( const char* name );
|
||||
qboolean G_CheckDemoStatus( void );
|
||||
|
||||
void G_ExitLevel (void);
|
||||
void G_SecretExitLevel (void);
|
||||
void G_ExitLevel( void );
|
||||
void G_SecretExitLevel( void );
|
||||
|
||||
void G_WorldDone (void);
|
||||
void G_WorldDone( void );
|
||||
|
||||
void G_Ticker (void);
|
||||
qboolean G_Responder (event_t* ev);
|
||||
void G_Ticker( void );
|
||||
qboolean G_Responder( event_t* ev );
|
||||
|
||||
void G_ScreenShot (void);
|
||||
void G_ScreenShot( void );
|
||||
|
||||
#define MAXDEMOSIZE 512 * 1024
|
||||
#define SAVEGAMESIZE 256 * 1024 + MAXDEMOSIZE
|
||||
|
|
|
@ -34,63 +34,63 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//
|
||||
// PROTOTYPES
|
||||
//
|
||||
void M_NewGame(int choice);
|
||||
void M_Episode(int choice);
|
||||
void M_Expansion(int choice);
|
||||
void M_ChooseSkill(int choice);
|
||||
void M_LoadGame(int choice);
|
||||
void M_LoadExpansion(int choice);
|
||||
void M_SaveGame(int choice);
|
||||
void M_Options(int choice);
|
||||
void M_EndGame(int choice);
|
||||
void M_ReadThis(int choice);
|
||||
void M_ReadThis2(int choice);
|
||||
void M_QuitDOOM(int choice);
|
||||
void M_ExitGame(int choice);
|
||||
void M_GameSelection(int choice);
|
||||
void M_CancelExit(int choice);
|
||||
void M_NewGame( int choice );
|
||||
void M_Episode( int choice );
|
||||
void M_Expansion( int choice );
|
||||
void M_ChooseSkill( int choice );
|
||||
void M_LoadGame( int choice );
|
||||
void M_LoadExpansion( int choice );
|
||||
void M_SaveGame( int choice );
|
||||
void M_Options( int choice );
|
||||
void M_EndGame( int choice );
|
||||
void M_ReadThis( int choice );
|
||||
void M_ReadThis2( int choice );
|
||||
void M_QuitDOOM( int choice );
|
||||
void M_ExitGame( int choice );
|
||||
void M_GameSelection( int choice );
|
||||
void M_CancelExit( int choice );
|
||||
|
||||
void M_ChangeMessages(int choice);
|
||||
void M_ChangeGPad(int choice);
|
||||
void M_FullScreen(int choice);
|
||||
void M_ChangeSensitivity(int choice);
|
||||
void M_SfxVol(int choice);
|
||||
void M_MusicVol(int choice);
|
||||
void M_ChangeDetail(int choice);
|
||||
void M_SizeDisplay(int choice);
|
||||
void M_StartGame(int choice);
|
||||
void M_Sound(int choice);
|
||||
void M_ChangeMessages( int choice );
|
||||
void M_ChangeGPad( int choice );
|
||||
void M_FullScreen( int choice );
|
||||
void M_ChangeSensitivity( int choice );
|
||||
void M_SfxVol( int choice );
|
||||
void M_MusicVol( int choice );
|
||||
void M_ChangeDetail( int choice );
|
||||
void M_SizeDisplay( int choice );
|
||||
void M_StartGame( int choice );
|
||||
void M_Sound( int choice );
|
||||
|
||||
void M_FinishReadThis(int choice);
|
||||
void M_LoadSelect(int choice);
|
||||
void M_SaveSelect(int choice);
|
||||
void M_ReadSaveStrings(void);
|
||||
void M_QuickSave(void);
|
||||
void M_QuickLoad(void);
|
||||
void M_FinishReadThis( int choice );
|
||||
void M_LoadSelect( int choice );
|
||||
void M_SaveSelect( int choice );
|
||||
void M_ReadSaveStrings( void );
|
||||
void M_QuickSave( void );
|
||||
void M_QuickLoad( void );
|
||||
|
||||
void M_DrawMainMenu(void);
|
||||
void M_DrawQuit(void);
|
||||
void M_DrawReadThis1(void);
|
||||
void M_DrawReadThis2(void);
|
||||
void M_DrawNewGame(void);
|
||||
void M_DrawEpisode(void);
|
||||
void M_DrawOptions(void);
|
||||
void M_DrawSound(void);
|
||||
void M_DrawLoad(void);
|
||||
void M_DrawSave(void);
|
||||
void M_DrawMainMenu( void );
|
||||
void M_DrawQuit( void );
|
||||
void M_DrawReadThis1( void );
|
||||
void M_DrawReadThis2( void );
|
||||
void M_DrawNewGame( void );
|
||||
void M_DrawEpisode( void );
|
||||
void M_DrawOptions( void );
|
||||
void M_DrawSound( void );
|
||||
void M_DrawLoad( void );
|
||||
void M_DrawSave( void );
|
||||
|
||||
void M_DrawSaveLoadBorder(int x,int y);
|
||||
void M_SetupNextMenu(menu_t *menudef);
|
||||
void M_DrawThermo(int x,int y,int thermWidth,int thermDot);
|
||||
void M_DrawEmptyCell(menu_t *menu,int item);
|
||||
void M_DrawSelCell(menu_t *menu,int item);
|
||||
void M_WriteText(int x, int y, const char *string);
|
||||
int M_StringWidth(const char *string);
|
||||
int M_StringHeight(const char *string);
|
||||
void M_StartControlPanel(void);
|
||||
void M_StartMessage(const char *string,messageRoutine_t routine,qboolean input);
|
||||
void M_StopMessage(void);
|
||||
void M_ClearMenus (void);
|
||||
void M_DrawSaveLoadBorder( int x, int y );
|
||||
void M_SetupNextMenu( menu_t* menudef );
|
||||
void M_DrawThermo( int x, int y, int thermWidth, int thermDot );
|
||||
void M_DrawEmptyCell( menu_t* menu, int item );
|
||||
void M_DrawSelCell( menu_t* menu, int item );
|
||||
void M_WriteText( int x, int y, const char* string );
|
||||
int M_StringWidth( const char* string );
|
||||
int M_StringHeight( const char* string );
|
||||
void M_StartControlPanel( void );
|
||||
void M_StartMessage( const char* string, messageRoutine_t routine, qboolean input );
|
||||
void M_StopMessage( void );
|
||||
void M_ClearMenus( void );
|
||||
|
||||
extern const anim_t temp_epsd0animinfo[10];
|
||||
extern const anim_t temp_epsd1animinfo[9];
|
||||
|
@ -102,5 +102,5 @@ void Globals::InitGlobals()
|
|||
#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 "structs.h"
|
||||
|
||||
struct Globals {
|
||||
struct Globals
|
||||
{
|
||||
void InitGlobals();
|
||||
#include "vars.h"
|
||||
};
|
||||
|
||||
extern Globals *g;
|
||||
extern Globals* g;
|
||||
|
||||
#define GLOBAL( type, name ) type name
|
||||
#define GLOBAL_ARRAY( type, name, count ) type name[count]
|
||||
|
||||
extern void localCalculateAchievements(bool epComplete);
|
||||
extern void localCalculateAchievements( bool epComplete );
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -43,11 +43,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// 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->l[0] = 0;
|
||||
|
@ -66,7 +66,7 @@ HUlib_initTextLine
|
|||
t->y = y;
|
||||
t->f = f;
|
||||
t->sc = sc;
|
||||
HUlib_clearTextLine(t);
|
||||
HUlib_clearTextLine( t );
|
||||
}
|
||||
|
||||
qboolean
|
||||
|
@ -75,8 +75,10 @@ HUlib_addCharToTextLine
|
|||
char ch )
|
||||
{
|
||||
|
||||
if (t->len == HU_MAXLINELENGTH)
|
||||
if( t->len == HU_MAXLINELENGTH )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
t->l[t->len++] = ch;
|
||||
|
@ -87,10 +89,13 @@ HUlib_addCharToTextLine
|
|||
|
||||
}
|
||||
|
||||
qboolean HUlib_delCharFromTextLine(hu_textline_t* t)
|
||||
qboolean HUlib_delCharFromTextLine( hu_textline_t* t )
|
||||
{
|
||||
|
||||
if (!t->len) return false;
|
||||
if( !t->len )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
t->l[--t->len] = 0;
|
||||
|
@ -113,38 +118,42 @@ HUlib_drawTextLine
|
|||
|
||||
// draw the new stuff
|
||||
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 = toupper( l->l[i] );
|
||||
if( c != ' '
|
||||
&& c >= l->sc
|
||||
&& c <= '_')
|
||||
&& c <= '_' )
|
||||
{
|
||||
w = SHORT( l->f[c - l->sc]->width );
|
||||
if( x + w > SCREENWIDTH )
|
||||
{
|
||||
w = SHORT(l->f[c - l->sc]->width);
|
||||
if (x+w > SCREENWIDTH)
|
||||
break;
|
||||
V_DrawPatchDirect(x, l->y, FG, l->f[c - l->sc]);
|
||||
}
|
||||
V_DrawPatchDirect( x, l->y, FG, l->f[c - l->sc] );
|
||||
x += w;
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 4;
|
||||
if (x >= SCREENWIDTH)
|
||||
if( x >= SCREENWIDTH )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// draw the cursor if requested
|
||||
if (drawcursor
|
||||
&& x + SHORT(l->f['_' - l->sc]->width) <= SCREENWIDTH)
|
||||
if( drawcursor
|
||||
&& 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
|
||||
void HUlib_eraseTextLine(hu_textline_t* l)
|
||||
void HUlib_eraseTextLine( hu_textline_t* l )
|
||||
{
|
||||
int lh;
|
||||
int y;
|
||||
|
@ -154,25 +163,30 @@ void HUlib_eraseTextLine(hu_textline_t* l)
|
|||
// and the text must either need updating or refreshing
|
||||
// (because of a recent change back from the automap)
|
||||
|
||||
if (!::g->automapactive &&
|
||||
::g->viewwindowx && l->needsupdate)
|
||||
if( !::g->automapactive &&
|
||||
::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)
|
||||
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)
|
||||
R_VideoErase(yoffset, SCREENWIDTH); // erase entire line
|
||||
if( y < ::g->viewwindowy || y >= ::g->viewwindowy + ::g->viewheight )
|
||||
{
|
||||
R_VideoErase( yoffset, SCREENWIDTH ); // erase entire line
|
||||
}
|
||||
else
|
||||
{
|
||||
R_VideoErase(yoffset, ::g->viewwindowx); // erase left border
|
||||
R_VideoErase(yoffset + ::g->viewwindowx + ::g->viewwidth, ::g->viewwindowx);
|
||||
R_VideoErase( yoffset, ::g->viewwindowx ); // erase left border
|
||||
R_VideoErase( yoffset + ::g->viewwindowx + ::g->viewwidth, ::g->viewwindowx );
|
||||
// erase right border
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
::g->lastautomapactive = ::g->automapactive;
|
||||
if (l->needsupdate) l->needsupdate--;
|
||||
if( l->needsupdate )
|
||||
{
|
||||
l->needsupdate--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -193,26 +207,30 @@ HUlib_initSText
|
|||
s->on = on;
|
||||
s->laston = true;
|
||||
s->cl = 0;
|
||||
for (i=0;i<h;i++)
|
||||
HUlib_initTextLine(&s->l[i],
|
||||
x, y - i*(SHORT(font[0]->height)+1),
|
||||
font, startchar);
|
||||
for( i = 0; i < h; i++ )
|
||||
HUlib_initTextLine( &s->l[i],
|
||||
x, y - i * ( SHORT( font[0]->height ) + 1 ),
|
||||
font, startchar );
|
||||
|
||||
}
|
||||
|
||||
void HUlib_addLineToSText(hu_stext_t* s)
|
||||
void HUlib_addLineToSText( hu_stext_t* s )
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
// add a clear line
|
||||
if (++s->cl == s->h)
|
||||
if( ++s->cl == s->h )
|
||||
{
|
||||
s->cl = 0;
|
||||
HUlib_clearTextLine(&s->l[s->cl]);
|
||||
}
|
||||
HUlib_clearTextLine( &s->l[s->cl] );
|
||||
|
||||
// everything needs updating
|
||||
for (i=0 ; i<s->h ; i++)
|
||||
for( i = 0 ; i < s->h ; i++ )
|
||||
{
|
||||
s->l[i].needsupdate = 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -222,48 +240,58 @@ HUlib_addMessageToSText
|
|||
const char* prefix,
|
||||
const char* msg )
|
||||
{
|
||||
HUlib_addLineToSText(s);
|
||||
if (prefix)
|
||||
while (*prefix)
|
||||
HUlib_addCharToTextLine(&s->l[s->cl], *(prefix++));
|
||||
HUlib_addLineToSText( s );
|
||||
if( prefix )
|
||||
while( *prefix )
|
||||
{
|
||||
HUlib_addCharToTextLine( &s->l[s->cl], *( prefix++ ) );
|
||||
}
|
||||
|
||||
while (*msg)
|
||||
HUlib_addCharToTextLine(&s->l[s->cl], *(msg++));
|
||||
while( *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;
|
||||
hu_textline_t *l;
|
||||
hu_textline_t* l;
|
||||
|
||||
if (!*s->on)
|
||||
if( !*s->on )
|
||||
{
|
||||
return; // if not on, don't draw
|
||||
}
|
||||
|
||||
// draw everything
|
||||
for (i=0 ; i<s->h ; i++)
|
||||
for( i = 0 ; i < s->h ; i++ )
|
||||
{
|
||||
idx = s->cl - i;
|
||||
if (idx < 0)
|
||||
if( idx < 0 )
|
||||
{
|
||||
idx += s->h; // handle queue of ::g->lines
|
||||
}
|
||||
|
||||
l = &s->l[idx];
|
||||
|
||||
// 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;
|
||||
|
||||
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]);
|
||||
}
|
||||
HUlib_eraseTextLine( &s->l[i] );
|
||||
}
|
||||
s->laston = *s->on;
|
||||
|
||||
|
@ -281,28 +309,32 @@ HUlib_initIText
|
|||
it->lm = 0; // default left margin is start of text
|
||||
it->on = on;
|
||||
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
|
||||
void HUlib_delCharFromIText(hu_itext_t* it)
|
||||
void HUlib_delCharFromIText( hu_itext_t* it )
|
||||
{
|
||||
if (it->l.len != it->lm)
|
||||
HUlib_delCharFromTextLine(&it->l);
|
||||
if( it->l.len != it->lm )
|
||||
{
|
||||
HUlib_delCharFromTextLine( &it->l );
|
||||
}
|
||||
}
|
||||
|
||||
void HUlib_eraseLineFromIText(hu_itext_t* it)
|
||||
void HUlib_eraseLineFromIText( hu_itext_t* it )
|
||||
{
|
||||
while (it->lm != it->l.len)
|
||||
HUlib_delCharFromTextLine(&it->l);
|
||||
while( it->lm != it->l.len )
|
||||
{
|
||||
HUlib_delCharFromTextLine( &it->l );
|
||||
}
|
||||
}
|
||||
|
||||
// Resets left margin as well
|
||||
void HUlib_resetIText(hu_itext_t* it)
|
||||
void HUlib_resetIText( hu_itext_t* it )
|
||||
{
|
||||
it->lm = 0;
|
||||
HUlib_clearTextLine(&it->l);
|
||||
HUlib_clearTextLine( &it->l );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -310,8 +342,10 @@ HUlib_addPrefixToIText
|
|||
( hu_itext_t* it,
|
||||
char* str )
|
||||
{
|
||||
while (*str)
|
||||
HUlib_addCharToTextLine(&it->l, *(str++));
|
||||
while( *str )
|
||||
{
|
||||
HUlib_addCharToTextLine( &it->l, *( str++ ) );
|
||||
}
|
||||
it->lm = it->l.len;
|
||||
}
|
||||
|
||||
|
@ -323,35 +357,43 @@ HUlib_keyInIText
|
|||
unsigned char ch )
|
||||
{
|
||||
|
||||
if (ch >= ' ' && ch <= '_')
|
||||
HUlib_addCharToTextLine(&it->l, (char) ch);
|
||||
else
|
||||
if (ch == KEY_BACKSPACE)
|
||||
HUlib_delCharFromIText(it);
|
||||
else
|
||||
if (ch != KEY_ENTER)
|
||||
if( ch >= ' ' && ch <= '_' )
|
||||
{
|
||||
HUlib_addCharToTextLine( &it->l, ( char ) ch );
|
||||
}
|
||||
else if( ch == KEY_BACKSPACE )
|
||||
{
|
||||
HUlib_delCharFromIText( it );
|
||||
}
|
||||
else if( ch != KEY_ENTER )
|
||||
{
|
||||
return false; // did not eat 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
|
||||
}
|
||||
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);
|
||||
}
|
||||
HUlib_eraseTextLine( &it->l );
|
||||
it->laston = *it->on;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ typedef struct
|
|||
|
||||
patch_t** f; // font
|
||||
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
|
||||
|
||||
// whether this line needs to be udpated
|
||||
|
@ -99,28 +99,28 @@ typedef struct
|
|||
//
|
||||
|
||||
// initializes heads-up widget library
|
||||
void HUlib_init(void);
|
||||
void HUlib_init( void );
|
||||
|
||||
//
|
||||
// textline code
|
||||
//
|
||||
|
||||
// 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
|
||||
qboolean HUlib_addCharToTextLine(hu_textline_t *t, char ch);
|
||||
qboolean HUlib_addCharToTextLine( hu_textline_t* t, char ch );
|
||||
|
||||
// returns success
|
||||
qboolean HUlib_delCharFromTextLine(hu_textline_t *t);
|
||||
qboolean HUlib_delCharFromTextLine( hu_textline_t* t );
|
||||
|
||||
// draws tline
|
||||
void HUlib_drawTextLine(hu_textline_t *l, qboolean drawcursor);
|
||||
void HUlib_drawTextLine( hu_textline_t* l, qboolean drawcursor );
|
||||
|
||||
// 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 );
|
||||
|
||||
// add a new line
|
||||
void HUlib_addLineToSText(hu_stext_t* s);
|
||||
void HUlib_addLineToSText( hu_stext_t* s );
|
||||
|
||||
// ?
|
||||
void
|
||||
|
@ -149,10 +149,10 @@ HUlib_addMessageToSText
|
|||
const char* msg );
|
||||
|
||||
// draws stext
|
||||
void HUlib_drawSText(hu_stext_t* s);
|
||||
void HUlib_drawSText( hu_stext_t* s );
|
||||
|
||||
// erases all stext lines
|
||||
void HUlib_eraseSText(hu_stext_t* s);
|
||||
void HUlib_eraseSText( hu_stext_t* s );
|
||||
|
||||
// Input Text Line widget routines
|
||||
void
|
||||
|
@ -165,13 +165,13 @@ HUlib_initIText
|
|||
qboolean* on );
|
||||
|
||||
// enforces left margin
|
||||
void HUlib_delCharFromIText(hu_itext_t* it);
|
||||
void HUlib_delCharFromIText( hu_itext_t* it );
|
||||
|
||||
// enforces left margin
|
||||
void HUlib_eraseLineFromIText(hu_itext_t* it);
|
||||
void HUlib_eraseLineFromIText( hu_itext_t* it );
|
||||
|
||||
// resets line and left margin
|
||||
void HUlib_resetIText(hu_itext_t* it);
|
||||
void HUlib_resetIText( hu_itext_t* it );
|
||||
|
||||
// left of left-margin
|
||||
void
|
||||
|
@ -185,10 +185,10 @@ HUlib_keyInIText
|
|||
( hu_itext_t* it,
|
||||
unsigned char ch );
|
||||
|
||||
void HUlib_drawIText(hu_itext_t* it);
|
||||
void HUlib_drawIText( hu_itext_t* it );
|
||||
|
||||
// erases all itext lines
|
||||
void HUlib_eraseIText(hu_itext_t* it);
|
||||
void HUlib_eraseIText( hu_itext_t* it );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -225,8 +225,8 @@ const char* mapnamesp[] =
|
|||
PHUSTR_32
|
||||
};
|
||||
|
||||
// TNT WAD map names.
|
||||
const char *mapnamest[] =
|
||||
// TNT WAD map names.
|
||||
const char* mapnamest[] =
|
||||
{
|
||||
THUSTR_1,
|
||||
THUSTR_2,
|
||||
|
@ -309,12 +309,12 @@ const char english_shiftxform[] =
|
|||
'{', '|', '}', '~', 127
|
||||
};
|
||||
|
||||
char ForeignTranslation(unsigned char ch)
|
||||
char ForeignTranslation( unsigned char ch )
|
||||
{
|
||||
return ch;
|
||||
}
|
||||
|
||||
void HU_Init(void)
|
||||
void HU_Init( void )
|
||||
{
|
||||
|
||||
int i;
|
||||
|
@ -326,27 +326,29 @@ void HU_Init(void)
|
|||
|
||||
// load the heads-up font
|
||||
j = HU_FONTSTART;
|
||||
for (i=0;i<HU_FONTSIZE;i++)
|
||||
for( i = 0; i < HU_FONTSIZE; i++ )
|
||||
{
|
||||
snprintf(buffer, buffer_len, "STCFN%03d", j++);
|
||||
::g->hu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC_SHARED);
|
||||
snprintf( buffer, buffer_len, "STCFN%03d", j++ );
|
||||
::g->hu_font[i] = ( patch_t* ) W_CacheLumpName( buffer, PU_STATIC_SHARED );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void HU_Stop(void)
|
||||
void HU_Stop( void )
|
||||
{
|
||||
::g->headsupactive = false;
|
||||
}
|
||||
|
||||
void HU_Start(void)
|
||||
void HU_Start( void )
|
||||
{
|
||||
|
||||
int i;
|
||||
const char* s;
|
||||
|
||||
if (::g->headsupactive)
|
||||
if( ::g->headsupactive )
|
||||
{
|
||||
HU_Stop();
|
||||
}
|
||||
|
||||
::g->plr = &::g->players[::g->consoleplayer];
|
||||
::g->message_on = false;
|
||||
|
@ -355,18 +357,18 @@ void HU_Start(void)
|
|||
::g->chat_on = false;
|
||||
|
||||
// create the message widget
|
||||
HUlib_initSText(&::g->w_message,
|
||||
HUlib_initSText( &::g->w_message,
|
||||
HU_MSGX, HU_MSGY, HU_MSGHEIGHT,
|
||||
::g->hu_font,
|
||||
HU_FONTSTART, &::g->message_on);
|
||||
HU_FONTSTART, &::g->message_on );
|
||||
|
||||
// create the map title widget
|
||||
HUlib_initTextLine(&::g->w_title,
|
||||
HUlib_initTextLine( &::g->w_title,
|
||||
HU_TITLEX, HU_TITLEY,
|
||||
::g->hu_font,
|
||||
HU_FONTSTART);
|
||||
HU_FONTSTART );
|
||||
|
||||
switch ( ::g->gamemode )
|
||||
switch( ::g->gamemode )
|
||||
{
|
||||
case shareware:
|
||||
case registered:
|
||||
|
@ -375,14 +377,18 @@ void HU_Start(void)
|
|||
break;
|
||||
case commercial:
|
||||
default:
|
||||
if( DoomLib::expansionSelected == 5 ) {
|
||||
if( DoomLib::expansionSelected == 5 )
|
||||
{
|
||||
int map = ::g->gamemap;
|
||||
if( ::g->gamemap > 9 ) {
|
||||
if( ::g->gamemap > 9 )
|
||||
{
|
||||
map = 0;
|
||||
}
|
||||
|
||||
s = DoomLib::GetCurrentExpansion()->mapNames[ map - 1 ];
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
s = DoomLib::GetCurrentExpansion()->mapNames[ ::g->gamemap - 1 ];
|
||||
}
|
||||
|
||||
|
@ -390,59 +396,65 @@ void HU_Start(void)
|
|||
break;
|
||||
}
|
||||
|
||||
while (*s)
|
||||
HUlib_addCharToTextLine(&::g->w_title, *(s++));
|
||||
while( *s )
|
||||
{
|
||||
HUlib_addCharToTextLine( &::g->w_title, *( s++ ) );
|
||||
}
|
||||
|
||||
// create the chat widget
|
||||
HUlib_initIText(&::g->w_chat,
|
||||
HUlib_initIText( &::g->w_chat,
|
||||
HU_INPUTX, HU_INPUTY,
|
||||
::g->hu_font,
|
||||
HU_FONTSTART, &::g->chat_on);
|
||||
HU_FONTSTART, &::g->chat_on );
|
||||
|
||||
// create the inputbuffer widgets
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
HUlib_initIText(&::g->w_inputbuffer[i], 0, 0, 0, 0, &::g->always_off);
|
||||
for( i = 0 ; i < MAXPLAYERS ; i++ )
|
||||
{
|
||||
HUlib_initIText( &::g->w_inputbuffer[i], 0, 0, 0, 0, &::g->always_off );
|
||||
}
|
||||
|
||||
::g->headsupactive = true;
|
||||
|
||||
}
|
||||
|
||||
void HU_Drawer(void)
|
||||
void HU_Drawer( void )
|
||||
{
|
||||
|
||||
HUlib_drawSText(&::g->w_message);
|
||||
HUlib_drawIText(&::g->w_chat);
|
||||
if (::g->automapactive)
|
||||
HUlib_drawTextLine(&::g->w_title, false);
|
||||
HUlib_drawSText( &::g->w_message );
|
||||
HUlib_drawIText( &::g->w_chat );
|
||||
if( ::g->automapactive )
|
||||
{
|
||||
HUlib_drawTextLine( &::g->w_title, false );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void HU_Erase(void)
|
||||
void HU_Erase( void )
|
||||
{
|
||||
|
||||
HUlib_eraseSText(&::g->w_message);
|
||||
HUlib_eraseIText(&::g->w_chat);
|
||||
HUlib_eraseTextLine(&::g->w_title);
|
||||
HUlib_eraseSText( &::g->w_message );
|
||||
HUlib_eraseIText( &::g->w_chat );
|
||||
HUlib_eraseTextLine( &::g->w_title );
|
||||
|
||||
}
|
||||
|
||||
void HU_Ticker(void)
|
||||
void HU_Ticker( void )
|
||||
{
|
||||
// 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_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
|
||||
if ((::g->plr->message && !::g->message_nottobefuckedwith)
|
||||
|| (::g->plr->message && ::g->message_dontfuckwithme))
|
||||
if( ( ::g->plr->message && !::g->message_nottobefuckedwith )
|
||||
|| ( ::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->message_on = true;
|
||||
::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;
|
||||
}
|
||||
else
|
||||
{
|
||||
::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;
|
||||
|
||||
if (::g->head != ::g->tail)
|
||||
if( ::g->head != ::g->tail )
|
||||
{
|
||||
c = ::g->chatchars[::g->tail];
|
||||
::g->tail = (::g->tail + 1) & (QUEUESIZE-1);
|
||||
::g->tail = ( ::g->tail + 1 ) & ( QUEUESIZE - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -486,7 +498,7 @@ char HU_dequeueChatChar(void)
|
|||
return c;
|
||||
}
|
||||
|
||||
qboolean HU_Responder(event_t *ev)
|
||||
qboolean HU_Responder( event_t* ev )
|
||||
{
|
||||
|
||||
const char* macromessage;
|
||||
|
@ -505,120 +517,142 @@ qboolean HU_Responder(event_t *ev)
|
|||
|
||||
|
||||
numplayers = 0;
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
for( i = 0 ; i < MAXPLAYERS ; i++ )
|
||||
{
|
||||
numplayers += ::g->playeringame[i];
|
||||
}
|
||||
|
||||
if (ev->data1 == KEY_RSHIFT)
|
||||
if( ev->data1 == KEY_RSHIFT )
|
||||
{
|
||||
::g->shiftdown = ev->type == ev_keydown;
|
||||
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;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ev->type != ev_keydown)
|
||||
return false;
|
||||
|
||||
if (!::g->chat_on)
|
||||
if( ev->type != ev_keydown )
|
||||
{
|
||||
if (ev->data1 == HU_MSGREFRESH)
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !::g->chat_on )
|
||||
{
|
||||
if( ev->data1 == HU_MSGREFRESH )
|
||||
{
|
||||
::g->message_on = true;
|
||||
::g->message_counter = HU_MSGTIMEOUT;
|
||||
eatkey = true;
|
||||
}
|
||||
else if (::g->netgame && ev->data1 == HU_INPUTTOGGLE)
|
||||
else if( ::g->netgame && ev->data1 == HU_INPUTTOGGLE )
|
||||
{
|
||||
eatkey = ::g->chat_on = true;
|
||||
HUlib_resetIText(&::g->w_chat);
|
||||
HU_queueChatChar(HU_BROADCAST);
|
||||
HUlib_resetIText( &::g->w_chat );
|
||||
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;
|
||||
HUlib_resetIText(&::g->w_chat);
|
||||
HU_queueChatChar(i+1);
|
||||
HUlib_resetIText( &::g->w_chat );
|
||||
HU_queueChatChar( i + 1 );
|
||||
break;
|
||||
}
|
||||
else if (i == ::g->consoleplayer)
|
||||
else if( i == ::g->consoleplayer )
|
||||
{
|
||||
::g->num_nobrainers++;
|
||||
if (::g->num_nobrainers < 3)
|
||||
if( ::g->num_nobrainers < 3 )
|
||||
{
|
||||
::g->plr->message = HUSTR_TALKTOSELF1;
|
||||
else if (::g->num_nobrainers < 6)
|
||||
}
|
||||
else if( ::g->num_nobrainers < 6 )
|
||||
{
|
||||
::g->plr->message = HUSTR_TALKTOSELF2;
|
||||
else if (::g->num_nobrainers < 9)
|
||||
}
|
||||
else if( ::g->num_nobrainers < 9 )
|
||||
{
|
||||
::g->plr->message = HUSTR_TALKTOSELF3;
|
||||
else if (::g->num_nobrainers < 32)
|
||||
}
|
||||
else if( ::g->num_nobrainers < 32 )
|
||||
{
|
||||
::g->plr->message = HUSTR_TALKTOSELF4;
|
||||
}
|
||||
else
|
||||
{
|
||||
::g->plr->message = HUSTR_TALKTOSELF5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
c = ev->data1;
|
||||
// send a macro
|
||||
if (::g->altdown)
|
||||
if( ::g->altdown )
|
||||
{
|
||||
c = c - '0';
|
||||
if (c > 9)
|
||||
if( c > 9 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// I_PrintfE( "got here\n");
|
||||
macromessage = temp_chat_macros[c];
|
||||
|
||||
// kill last message with a '\n'
|
||||
HU_queueChatChar(KEY_ENTER); // DEBUG!!!
|
||||
HU_queueChatChar( KEY_ENTER ); // DEBUG!!!
|
||||
|
||||
// send the macro message
|
||||
while (*macromessage)
|
||||
HU_queueChatChar(*macromessage++);
|
||||
HU_queueChatChar(KEY_ENTER);
|
||||
while( *macromessage )
|
||||
{
|
||||
HU_queueChatChar( *macromessage++ );
|
||||
}
|
||||
HU_queueChatChar( KEY_ENTER );
|
||||
|
||||
// leave chat mode and notify that it was sent
|
||||
::g->chat_on = false;
|
||||
strcpy(::g->lastmessage, temp_chat_macros[c]);
|
||||
strcpy( ::g->lastmessage, temp_chat_macros[c] );
|
||||
::g->plr->message = ::g->lastmessage;
|
||||
eatkey = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (::g->shiftdown || (c >= 'a' && c <= 'z'))
|
||||
if( ::g->shiftdown || ( c >= 'a' && c <= 'z' ) )
|
||||
{
|
||||
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
|
||||
HU_queueChatChar(c);
|
||||
HU_queueChatChar( c );
|
||||
|
||||
// sprintf(buf, "KEY: %d => %d", ev->data1, c);
|
||||
// ::g->plr->message = buf;
|
||||
}
|
||||
if (c == KEY_ENTER)
|
||||
if( c == KEY_ENTER )
|
||||
{
|
||||
::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;
|
||||
}
|
||||
}
|
||||
else if (c == KEY_ESCAPE)
|
||||
else if( c == KEY_ESCAPE )
|
||||
{
|
||||
::g->chat_on = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return eatkey;
|
||||
|
||||
|
|
|
@ -55,15 +55,15 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// HEADS UP TEXT
|
||||
//
|
||||
|
||||
void HU_Init(void);
|
||||
void HU_Start(void);
|
||||
void HU_Init( void );
|
||||
void HU_Start( void );
|
||||
|
||||
qboolean HU_Responder(event_t* ev);
|
||||
qboolean HU_Responder( event_t* ev );
|
||||
|
||||
void HU_Ticker(void);
|
||||
void HU_Drawer(void);
|
||||
char HU_dequeueChatChar(void);
|
||||
void HU_Erase(void);
|
||||
void HU_Ticker( void );
|
||||
void HU_Drawer( void );
|
||||
char HU_dequeueChatChar( void );
|
||||
void HU_Erase( void );
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -53,27 +53,35 @@ extern int PLAYERCOUNT;
|
|||
|
||||
#define NUM_BUTTONS 4
|
||||
|
||||
static bool Cheat_God() {
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
||||
static bool Cheat_God()
|
||||
{
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
::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->health = 100;
|
||||
::g->plyr->message = STSTR_DQDON;
|
||||
}
|
||||
else
|
||||
{
|
||||
::g->plyr->message = STSTR_DQDOFF;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "g_game.h"
|
||||
static bool Cheat_NextLevel() {
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
||||
static bool Cheat_NextLevel()
|
||||
{
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
G_ExitLevel();
|
||||
|
@ -81,8 +89,10 @@ static bool Cheat_NextLevel() {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool Cheat_GiveAll() {
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
||||
static bool Cheat_GiveAll()
|
||||
{
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -90,39 +100,53 @@ static bool Cheat_GiveAll() {
|
|||
::g->plyr->armortype = 2;
|
||||
|
||||
int i;
|
||||
for (i=0;i<NUMWEAPONS;i++)
|
||||
for( i = 0; i < NUMWEAPONS; i++ )
|
||||
{
|
||||
::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];
|
||||
}
|
||||
|
||||
for (i=0;i<NUMCARDS;i++)
|
||||
for( i = 0; i < NUMCARDS; i++ )
|
||||
{
|
||||
::g->plyr->cards[i] = true;
|
||||
}
|
||||
|
||||
::g->plyr->message = STSTR_KFAADDED;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool Cheat_GiveAmmo() {
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
||||
static bool Cheat_GiveAmmo()
|
||||
{
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
::g->plyr->armorpoints = 200;
|
||||
::g->plyr->armortype = 2;
|
||||
|
||||
int i;
|
||||
for (i=0;i<NUMWEAPONS;i++)
|
||||
for( i = 0; i < NUMWEAPONS; i++ )
|
||||
{
|
||||
::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->message = STSTR_KFAADDED;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool Cheat_Choppers() {
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
||||
static bool Cheat_Choppers()
|
||||
{
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
::g->plyr->weaponowned[wp_chainsaw] = true;
|
||||
|
@ -130,21 +154,30 @@ static bool Cheat_Choppers() {
|
|||
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 ) {
|
||||
if (!::g->plyr->powers[i])
|
||||
P_GivePower( ::g->plyr, i);
|
||||
else if (i!=pw_strength)
|
||||
static void TogglePowerUp( int i )
|
||||
{
|
||||
if( !::g->plyr->powers[i] )
|
||||
{
|
||||
P_GivePower( ::g->plyr, i );
|
||||
}
|
||||
else if( i != pw_strength )
|
||||
{
|
||||
::g->plyr->powers[i] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
::g->plyr->powers[i] = 0;
|
||||
}
|
||||
|
||||
::g->plyr->message = STSTR_BEHOLDX;
|
||||
}
|
||||
|
||||
static bool Cheat_GiveInvul() {
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
||||
static bool Cheat_GiveInvul()
|
||||
{
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -152,8 +185,10 @@ static bool Cheat_GiveInvul() {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool Cheat_GiveBerserk() {
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
||||
static bool Cheat_GiveBerserk()
|
||||
{
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -161,8 +196,10 @@ static bool Cheat_GiveBerserk() {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool Cheat_GiveBlur() {
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
||||
static bool Cheat_GiveBlur()
|
||||
{
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -170,8 +207,10 @@ static bool Cheat_GiveBlur() {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool Cheat_GiveRad() {
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
||||
static bool Cheat_GiveRad()
|
||||
{
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -179,8 +218,10 @@ static bool Cheat_GiveRad() {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool Cheat_GiveMap() {
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
||||
static bool Cheat_GiveMap()
|
||||
{
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -188,8 +229,10 @@ static bool Cheat_GiveMap() {
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool Cheat_GiveLight() {
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame ) {
|
||||
static bool Cheat_GiveLight()
|
||||
{
|
||||
if( PLAYERCOUNT != 1 || ::g->netgame )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -201,20 +244,21 @@ static bool Cheat_GiveLight() {
|
|||
|
||||
#ifndef __PS3__
|
||||
|
||||
static bool tracking = false;
|
||||
static int currentCode[NUM_BUTTONS];
|
||||
static int currentCheatLength;
|
||||
static bool tracking = false;
|
||||
static int currentCode[NUM_BUTTONS];
|
||||
static int currentCheatLength;
|
||||
|
||||
#endif
|
||||
|
||||
typedef bool(*cheat_command)(void);
|
||||
typedef bool( *cheat_command )( void );
|
||||
struct cheatcode_t
|
||||
{
|
||||
int code[NUM_BUTTONS];
|
||||
cheat_command function;
|
||||
};
|
||||
|
||||
static cheatcode_t codes[] = {
|
||||
static cheatcode_t codes[] =
|
||||
{
|
||||
{ {0, 1, 1, 0}, Cheat_God }, // a b b a
|
||||
{ {0, 0, 1, 1}, Cheat_NextLevel }, // a a b b
|
||||
{ {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
|
||||
};
|
||||
|
||||
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
|
||||
tracking = true;
|
||||
currentCheatLength = 0;
|
||||
|
@ -239,25 +284,32 @@ void BeginTrackingCheat() {
|
|||
#endif
|
||||
}
|
||||
|
||||
void EndTrackingCheat() {
|
||||
void EndTrackingCheat()
|
||||
{
|
||||
#if ALLOW_CHEATS
|
||||
tracking = false;
|
||||
#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( tracking && !::g->netgame ) {
|
||||
if( tracking && !::g->netgame )
|
||||
{
|
||||
|
||||
currentCode[ currentCheatLength++ ] = button;
|
||||
|
||||
if( currentCheatLength == NUM_BUTTONS ) {
|
||||
for( int i = 0; i < numberOfCodes; ++i) {
|
||||
if( memcmp( &codes[i].code[0], ¤tCode[0], sizeof(currentCode) ) == 0 ) {
|
||||
if(codes[i].function()) {
|
||||
S_StartSound(0, sfx_cybsit);
|
||||
if( currentCheatLength == NUM_BUTTONS )
|
||||
{
|
||||
for( int i = 0; i < numberOfCodes; ++i )
|
||||
{
|
||||
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,29 +339,31 @@ 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;
|
||||
float y = x - 127;
|
||||
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;
|
||||
|
||||
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->data1 = e->data2 = e->data3 = 0;
|
||||
|
||||
switch(::g->mouseEvents[n].type) {
|
||||
switch( ::g->mouseEvents[n].type )
|
||||
{
|
||||
case IETAxis:
|
||||
switch (::g->mouseEvents[n].action)
|
||||
switch( ::g->mouseEvents[n].action )
|
||||
{
|
||||
case M_DELTAX:
|
||||
e->data2 = ::g->mouseEvents[n].data;
|
||||
|
@ -326,7 +380,8 @@ int I_ReturnMouseInputEvent( const int n, event_t* e) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int I_PollJoystickInputEvents( controller_t *con ) {
|
||||
int I_PollJoystickInputEvents( controller_t* con )
|
||||
{
|
||||
int numEvents = 0;
|
||||
|
||||
return numEvents;
|
||||
|
@ -335,11 +390,11 @@ int I_PollJoystickInputEvents( controller_t *con ) {
|
|||
//
|
||||
// Translates the key currently in X_event
|
||||
//
|
||||
static int xlatekey(int key)
|
||||
static int xlatekey( int key )
|
||||
{
|
||||
int rc = KEY_F1;
|
||||
|
||||
switch (key)
|
||||
switch( key )
|
||||
{
|
||||
case 0: // A
|
||||
//rc = KEY_ENTER;
|
||||
|
@ -349,10 +404,12 @@ static int xlatekey(int key)
|
|||
rc = '1';
|
||||
break;
|
||||
case 1: // B
|
||||
if( ::g->menuactive ) {
|
||||
if( ::g->menuactive )
|
||||
{
|
||||
rc = KEY_BACKSPACE;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
rc = '2';
|
||||
}
|
||||
break;
|
||||
|
@ -373,37 +430,45 @@ static int xlatekey(int key)
|
|||
rc = KEY_RCTRL;
|
||||
break;
|
||||
case 8: // Up
|
||||
if( ::g->menuactive ) {
|
||||
if( ::g->menuactive )
|
||||
{
|
||||
rc = KEY_UPARROW;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
//rc = KEY_ENTER;
|
||||
rc = '3';
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if( ::g->menuactive ) {
|
||||
if( ::g->menuactive )
|
||||
{
|
||||
rc = KEY_DOWNARROW;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
//rc = KEY_TAB;
|
||||
rc = '5';
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
if( ::g->menuactive ) {
|
||||
if( ::g->menuactive )
|
||||
{
|
||||
rc = KEY_UPARROW;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
//rc = '1';
|
||||
rc = '6';
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
if( ::g->menuactive ) {
|
||||
if( ::g->menuactive )
|
||||
{
|
||||
rc = KEY_DOWNARROW;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
//rc = '2';
|
||||
rc = '4';
|
||||
}
|
||||
|
@ -422,23 +487,24 @@ static int xlatekey(int key)
|
|||
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;
|
||||
|
||||
switch(::g->joyEvents[n].type)
|
||||
switch( ::g->joyEvents[n].type )
|
||||
{
|
||||
case IETAxis:
|
||||
e->type = ev_joystick;//ev_mouse;
|
||||
switch (::g->joyEvents[n].action)
|
||||
switch( ::g->joyEvents[n].action )
|
||||
{
|
||||
case J_DELTAX:
|
||||
/*
|
||||
/*
|
||||
if (::g->joyEvents[n].data < 0)
|
||||
e->data2 = -1;
|
||||
else if (::g->joyEvents[n].data > 0)
|
||||
e->data2 = 1;
|
||||
*/
|
||||
*/
|
||||
e->data2 = ::g->joyEvents[n].data;
|
||||
break;
|
||||
case J_DELTAY:
|
||||
|
@ -449,11 +515,15 @@ int I_ReturnJoystickInputEvent( const int n, event_t* e) {
|
|||
return 1;
|
||||
case IETButtonAnalog:
|
||||
case IETButtonDigital:
|
||||
if (::g->joyEvents[n].data)
|
||||
if( ::g->joyEvents[n].data )
|
||||
{
|
||||
e->type = ev_keydown;
|
||||
}
|
||||
else
|
||||
{
|
||||
e->type = ev_keyup;
|
||||
e->data1 = xlatekey(::g->joyEvents[n].action);
|
||||
}
|
||||
e->data1 = xlatekey( ::g->joyEvents[n].action );
|
||||
return 1;
|
||||
|
||||
case IETNone:
|
||||
|
@ -463,9 +533,10 @@ int I_ReturnJoystickInputEvent( const int n, event_t* e) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void I_EndJoystickInputEvents() {
|
||||
void I_EndJoystickInputEvents()
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 18; i++)
|
||||
for( i = 0; i < 18; i++ )
|
||||
{
|
||||
::g->joyEvents[i].type = IETNone;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "doomstat.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "i_net.h"
|
||||
#pragma implementation "i_net.h"
|
||||
#endif
|
||||
#include "i_net.h"
|
||||
|
||||
|
@ -54,6 +54,6 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// For some odd reason...
|
||||
|
||||
|
||||
void NetSend (void);
|
||||
qboolean NetListen (void);
|
||||
void NetSend( void );
|
||||
qboolean NetListen( void );
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -39,8 +39,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// Called by D_DoomMain.
|
||||
|
||||
|
||||
void I_InitNetwork (void);
|
||||
void I_NetCmd (void);
|
||||
void I_InitNetwork( void );
|
||||
void I_NetCmd( void );
|
||||
|
||||
// DHM - Nerve
|
||||
void I_ShutdownNetwork();
|
||||
|
|
|
@ -48,33 +48,36 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "doomlib.h"
|
||||
|
||||
void NetSend (void);
|
||||
qboolean NetListen (void);
|
||||
void NetSend( void );
|
||||
qboolean NetListen( void );
|
||||
|
||||
namespace {
|
||||
bool IsValidSocket( int socketDescriptor );
|
||||
int GetLastSocketError();
|
||||
namespace
|
||||
{
|
||||
bool IsValidSocket( int socketDescriptor );
|
||||
int GetLastSocketError();
|
||||
|
||||
|
||||
|
||||
/*
|
||||
========================
|
||||
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.
|
||||
========================
|
||||
*/
|
||||
bool IsValidSocket( int socketDescriptor ) {
|
||||
/*
|
||||
========================
|
||||
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.
|
||||
========================
|
||||
*/
|
||||
bool IsValidSocket( int socketDescriptor )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
Returns the last error reported by the platform's socket library.
|
||||
========================
|
||||
*/
|
||||
int GetLastSocketError() {
|
||||
/*
|
||||
========================
|
||||
Returns the last error reported by the platform's socket library.
|
||||
========================
|
||||
*/
|
||||
int GetLastSocketError()
|
||||
{
|
||||
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?
|
||||
|
||||
|
||||
unsigned long GetServerIP() {
|
||||
unsigned long GetServerIP()
|
||||
{
|
||||
//return ::g->sendaddress[::g->doomcom.consoleplayer].sin_addr.s_addr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void (*netget) (void);
|
||||
void (*netsend) (void);
|
||||
void ( *netget )( void );
|
||||
void ( *netsend )( void );
|
||||
|
||||
|
||||
//
|
||||
// UDPsocket
|
||||
//
|
||||
int UDPsocket (void)
|
||||
int UDPsocket( void )
|
||||
{
|
||||
//int s;
|
||||
|
||||
|
@ -122,7 +126,7 @@ void BindToLocalPort( int s, int port )
|
|||
//
|
||||
// PacketSend
|
||||
//
|
||||
void PacketSend (void)
|
||||
void PacketSend( void )
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -131,12 +135,12 @@ void PacketSend (void)
|
|||
//
|
||||
// PacketGet
|
||||
//
|
||||
void PacketGet (void)
|
||||
void PacketGet( void )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static int I_TrySetupNetwork(void)
|
||||
static int I_TrySetupNetwork( void )
|
||||
{
|
||||
// DHM - Moved to Session
|
||||
return 1;
|
||||
|
@ -145,7 +149,7 @@ static int I_TrySetupNetwork(void)
|
|||
//
|
||||
// I_InitNetwork
|
||||
//
|
||||
void I_InitNetwork (void)
|
||||
void I_InitNetwork( void )
|
||||
{
|
||||
//qboolean trueval = true;
|
||||
int i;
|
||||
|
@ -153,37 +157,47 @@ void I_InitNetwork (void)
|
|||
//int a = 0;
|
||||
// struct hostent* hostentry; // host information entry
|
||||
|
||||
memset (&::g->doomcom, 0, sizeof(::g->doomcom) );
|
||||
memset( &::g->doomcom, 0, sizeof( ::g->doomcom ) );
|
||||
|
||||
// set up for network
|
||||
i = M_CheckParm ("-dup");
|
||||
if (i && i< ::g->myargc-1)
|
||||
i = M_CheckParm( "-dup" );
|
||||
if( i && i < ::g->myargc - 1 )
|
||||
{
|
||||
::g->doomcom.ticdup = ::g->myargv[i + 1][0] - '0';
|
||||
if( ::g->doomcom.ticdup < 1 )
|
||||
{
|
||||
::g->doomcom.ticdup = ::g->myargv[i+1][0]-'0';
|
||||
if (::g->doomcom.ticdup < 1)
|
||||
::g->doomcom.ticdup = 1;
|
||||
if (::g->doomcom.ticdup > 9)
|
||||
}
|
||||
if( ::g->doomcom.ticdup > 9 )
|
||||
{
|
||||
::g->doomcom.ticdup = 9;
|
||||
}
|
||||
}
|
||||
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]);
|
||||
I_Printf ("using alternate port %i\n",DOOMPORT);
|
||||
::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] );
|
||||
I_Printf( "using alternate port %i\n", DOOMPORT );
|
||||
}
|
||||
|
||||
// parse network game options,
|
||||
// -net <::g->consoleplayer> <host> <host> ...
|
||||
i = M_CheckParm ("-net");
|
||||
if (!i || !I_TrySetupNetwork())
|
||||
i = M_CheckParm( "-net" );
|
||||
if( !i || !I_TrySetupNetwork() )
|
||||
{
|
||||
// single player game
|
||||
::g->netgame = false;
|
||||
|
@ -207,30 +221,34 @@ void I_InitNetwork (void)
|
|||
// skip the console number
|
||||
++i;
|
||||
::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_port = htons(DOOMPORT);
|
||||
::g->sendaddress[::g->doomcom.numnodes].sin_port = htons( DOOMPORT );
|
||||
|
||||
// Pull out the port number.
|
||||
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;
|
||||
|
||||
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 ) );
|
||||
|
||||
::g->sendaddress[::g->doomcom.numnodes].sin_port = htons( atoi( portOnly.c_str() ) );
|
||||
|
||||
ipOnly = ipAddressWithPort.substr( 0, colonPosition );
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assume the address doesn't include a port.
|
||||
ipOnly = ipAddressWithPort;
|
||||
}
|
||||
|
||||
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() );
|
||||
session->QuitMatch();
|
||||
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;
|
||||
}
|
||||
|
||||
if ( globalNetworking ) {
|
||||
if( globalNetworking )
|
||||
{
|
||||
// Setup sockets
|
||||
::g->insocket = UDPsocket ();
|
||||
BindToLocalPort (::g->insocket,htons(DOOMPORT));
|
||||
::g->insocket = UDPsocket();
|
||||
BindToLocalPort( ::g->insocket, htons( DOOMPORT ) );
|
||||
|
||||
// PS3 call to enable non-blocking 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() );
|
||||
}
|
||||
|
@ -260,11 +279,12 @@ void I_InitNetwork (void)
|
|||
}
|
||||
|
||||
// DHM - Nerve
|
||||
void I_ShutdownNetwork() {
|
||||
void I_ShutdownNetwork()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void I_NetCmd (void)
|
||||
void I_NetCmd( void )
|
||||
{
|
||||
//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.
|
||||
#ifdef SNDSERV
|
||||
#include <stdio.h>
|
||||
extern FILE* sndserver;
|
||||
extern char* sndserver_filename;
|
||||
#include <stdio.h>
|
||||
extern FILE* sndserver;
|
||||
extern char* sndserver_filename;
|
||||
#endif
|
||||
|
||||
#include "doomstat.h"
|
||||
|
@ -48,11 +48,11 @@ void I_InitSound();
|
|||
void I_InitSoundHardware( int numOutputChannels_, int channelMask );
|
||||
|
||||
// ... update sound buffer and audio device at runtime...
|
||||
void I_UpdateSound(void);
|
||||
void I_SubmitSound(void);
|
||||
void I_UpdateSound( void );
|
||||
void I_SubmitSound( void );
|
||||
|
||||
// ... shut down and relase at program termination.
|
||||
void I_ShutdownSound(void);
|
||||
void I_ShutdownSound( void );
|
||||
void I_ShutdownSoundHardware();
|
||||
|
||||
//
|
||||
|
@ -63,20 +63,20 @@ void I_ShutdownSoundHardware();
|
|||
void I_SetChannels();
|
||||
|
||||
// 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.
|
||||
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.
|
||||
void I_StopSound(int handle, int player = -1);
|
||||
void I_StopSound( int handle, int player = -1 );
|
||||
|
||||
// Called by S_*() functions
|
||||
// to see if a channel is still playing.
|
||||
// Returns 0 if no longer playing, 1 if playing.
|
||||
int I_SoundIsPlaying(int handle);
|
||||
int I_SoundIsPlaying( int handle );
|
||||
|
||||
// Updates the volume, separation,
|
||||
// and pitch of a sound channel.
|
||||
|
@ -86,28 +86,28 @@ void I_SetSfxVolume( int );
|
|||
//
|
||||
// MUSIC I/O
|
||||
//
|
||||
void I_InitMusic(void);
|
||||
void I_ShutdownMusic(void);
|
||||
void I_InitMusic( void );
|
||||
void I_ShutdownMusic( void );
|
||||
// Volume.
|
||||
void I_SetMusicVolume(int volume);
|
||||
void I_SetMusicVolume( int volume );
|
||||
// PAUSE game handling.
|
||||
void I_PauseSong(int handle);
|
||||
void I_ResumeSong(int handle);
|
||||
void I_PauseSong( int handle );
|
||||
void I_ResumeSong( int handle );
|
||||
// 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.
|
||||
// plays a song, and when the song is done,
|
||||
// starts playing it again in an endless loop.
|
||||
// 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.
|
||||
void I_StopSong(int handle);
|
||||
void I_StopSong( int handle );
|
||||
// See above (register), then think backwards
|
||||
void I_UnRegisterSong(int handle);
|
||||
void I_UnRegisterSong( int handle );
|
||||
// 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
|
||||
|
||||
|
|
|
@ -79,36 +79,40 @@ int totalBufferSize;
|
|||
bool waitingForMusic;
|
||||
bool musicReady;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
} vec3_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
vec3_t OrientTop;
|
||||
vec3_t OrientFront;
|
||||
vec3_t Position;
|
||||
} doomListener_t;
|
||||
|
||||
typedef struct tagActiveSound_t {
|
||||
typedef struct tagActiveSound_t
|
||||
{
|
||||
ALuint alSourceVoice;
|
||||
int id;
|
||||
int valid;
|
||||
int start;
|
||||
int player;
|
||||
bool localSound;
|
||||
mobj_t *originator;
|
||||
mobj_t* originator;
|
||||
} activeSound_t;
|
||||
|
||||
// cheap little struct to hold a sound
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int vol;
|
||||
int player;
|
||||
int pitch;
|
||||
int priority;
|
||||
mobj_t *originator;
|
||||
mobj_t *listener;
|
||||
mobj_t* originator;
|
||||
mobj_t* listener;
|
||||
} soundEvent_t;
|
||||
|
||||
// array of all the possible sounds
|
||||
|
@ -149,7 +153,7 @@ getsfx
|
|||
// This function loads the sound data from the WAD lump,
|
||||
// for single sound.
|
||||
//
|
||||
void* getsfx ( const char* sfxname, int* len )
|
||||
void* getsfx( const char* sfxname, int* len )
|
||||
{
|
||||
unsigned char* sfx;
|
||||
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 ( W_CheckNumForName( name ) == -1 )
|
||||
if( W_CheckNumForName( name ) == -1 )
|
||||
{
|
||||
sfxlump = W_GetNumForName( "dspistol" );
|
||||
}
|
||||
else
|
||||
{
|
||||
sfxlump = W_GetNumForName( name );
|
||||
}
|
||||
|
||||
// Sound lump headers are 8 bytes.
|
||||
const int SOUND_LUMP_HEADER_SIZE_IN_BYTES = 8;
|
||||
|
||||
size = W_LumpLength( sfxlump ) - SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
||||
|
||||
sfx = (unsigned char*)W_CacheLumpNum( sfxlump, PU_CACHE_SHARED );
|
||||
const unsigned char * sfxSampleStart = sfx + SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
||||
sfx = ( unsigned char* )W_CacheLumpNum( sfxlump, PU_CACHE_SHARED );
|
||||
const unsigned char* sfxSampleStart = sfx + SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
||||
|
||||
// Allocate from zone memory.
|
||||
//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
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
for( int i = 0; i < size; i++ )
|
||||
{
|
||||
sfxmem[i] = sfxSampleStart[i];// * scale;
|
||||
}
|
||||
|
||||
|
@ -199,7 +208,7 @@ void* getsfx ( const char* sfxname, int* len )
|
|||
*len = size;
|
||||
|
||||
// Return allocated padded data.
|
||||
return (void *) (sfxmem);
|
||||
return ( void* )( sfxmem );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -219,7 +228,7 @@ I_SetSfxVolume
|
|||
*/
|
||||
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.
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
@ -264,13 +274,15 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
|||
int oldest = 0, oldestnum = -1;
|
||||
|
||||
// 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.
|
||||
for ( i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||
for( i = 0; i < NUM_SOUNDBUFFERS; 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 );
|
||||
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
|
||||
for ( i = 0; i < NUM_SOUNDBUFFERS; i++ ) {
|
||||
for( i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||
{
|
||||
sound = &activeSounds[i];
|
||||
|
||||
if ( !sound->valid )
|
||||
if( !sound->valid )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !oldest || oldest > sound->start ) {
|
||||
if( !oldest || oldest > sound->start )
|
||||
{
|
||||
oldestnum = i;
|
||||
oldest = sound->start;
|
||||
}
|
||||
|
||||
ALint sourceState;
|
||||
alGetSourcei( sound->alSourceVoice, AL_SOURCE_STATE, &sourceState );
|
||||
if ( sourceState == AL_STOPPED ) {
|
||||
if( sourceState == AL_STOPPED )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// none found, so use the oldest one
|
||||
if ( i == NUM_SOUNDBUFFERS ) {
|
||||
if( i == NUM_SOUNDBUFFERS )
|
||||
{
|
||||
i = oldestnum;
|
||||
sound = &activeSounds[i];
|
||||
}
|
||||
|
@ -305,7 +323,8 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
|||
alSourceStop( sound->alSourceVoice );
|
||||
|
||||
// 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, 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 );
|
||||
|
||||
// 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
|
||||
ALfloat x = 0.f;
|
||||
ALfloat y = 0.f;
|
||||
ALfloat z = 0.f;
|
||||
if ( origin ) {
|
||||
if ( origin == listener_origin ) {
|
||||
if( origin )
|
||||
{
|
||||
if( origin == listener_origin )
|
||||
{
|
||||
sound->localSound = true;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
sound->localSound = false;
|
||||
x = (ALfloat)(origin->x >> FRACBITS);
|
||||
z = (ALfloat)(origin->y >> FRACBITS);
|
||||
x = ( ALfloat )( origin->x >> FRACBITS );
|
||||
z = ( ALfloat )( origin->y >> FRACBITS );
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
sound->localSound = true;
|
||||
}
|
||||
if ( sound->localSound ) {
|
||||
if( sound->localSound )
|
||||
{
|
||||
x = doom_Listener.Position.x;
|
||||
z = doom_Listener.Position.z;
|
||||
}
|
||||
|
@ -356,8 +382,10 @@ I_ProcessSoundEvents
|
|||
*/
|
||||
void I_ProcessSoundEvents( void )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
|
@ -370,19 +398,24 @@ void I_ProcessSoundEvents( void )
|
|||
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
|
||||
if( ::g->gamestate != GS_LEVEL && DoomLib::GetPlayer() != 0 ) {
|
||||
if( ::g->gamestate != GS_LEVEL && DoomLib::GetPlayer() != 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 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
|
||||
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 );
|
||||
} else {
|
||||
if( soundEvents[ id ].vol < vol ) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if( soundEvents[ id ].vol < vol )
|
||||
{
|
||||
soundEvents[ id ].player = DoomLib::GetPlayer();
|
||||
soundEvents[ id ].pitch = pitch;
|
||||
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
|
||||
======================
|
||||
*/
|
||||
void I_StopSound ( int handle, int player )
|
||||
void I_StopSound( int handle, int player )
|
||||
{
|
||||
// You need the handle returned by StartSound.
|
||||
// Would be looping all channels,
|
||||
|
@ -408,15 +441,20 @@ void I_StopSound ( int handle, int player )
|
|||
int i;
|
||||
activeSound_t* sound = 0;
|
||||
|
||||
for ( i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
||||
for( i = 0; i < NUM_SOUNDBUFFERS; ++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;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ( i == NUM_SOUNDBUFFERS )
|
||||
if( i == NUM_SOUNDBUFFERS )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop the sound
|
||||
alSourceStop( sound->alSourceVoice );
|
||||
|
@ -432,21 +470,26 @@ I_SoundIsPlaying
|
|||
*/
|
||||
int I_SoundIsPlaying( int handle )
|
||||
{
|
||||
if ( !soundHardwareInitialized ) {
|
||||
if( !soundHardwareInitialized )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i;
|
||||
activeSound_t* sound;
|
||||
|
||||
for ( i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
||||
for( i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||
{
|
||||
sound = &activeSounds[i];
|
||||
if ( !sound->valid || sound->id != handle )
|
||||
if( !sound->valid || sound->id != handle )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ALint sourceState;
|
||||
alGetSourcei( sound->alSourceVoice, AL_SOURCE_STATE, &sourceState );
|
||||
if ( sourceState == AL_PLAYING ) {
|
||||
if( sourceState == AL_PLAYING )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -463,13 +506,15 @@ I_UpdateSound
|
|||
// channels and update sound positions.
|
||||
void I_UpdateSound( void )
|
||||
{
|
||||
if ( !soundHardwareInitialized ) {
|
||||
if( !soundHardwareInitialized )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Update listener orientation and position
|
||||
mobj_t *playerObj = ::g->players[0].mo;
|
||||
if ( playerObj ) {
|
||||
mobj_t* playerObj = ::g->players[0].mo;
|
||||
if( playerObj )
|
||||
{
|
||||
angle_t pAngle = playerObj->angle;
|
||||
fixed_t fx, fz;
|
||||
|
||||
|
@ -478,13 +523,15 @@ void I_UpdateSound( void )
|
|||
fx = finecosine[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.z = (float)(fz) / 65535.f;
|
||||
doom_Listener.Position.x = (float)(playerObj->x >> FRACBITS);
|
||||
doom_Listener.OrientFront.z = ( float )( fz ) / 65535.f;
|
||||
doom_Listener.Position.x = ( float )( playerObj->x >> FRACBITS );
|
||||
doom_Listener.Position.y = 0.f;
|
||||
doom_Listener.Position.z = (float)(playerObj->y >> FRACBITS);
|
||||
} else {
|
||||
doom_Listener.Position.z = ( float )( playerObj->y >> FRACBITS );
|
||||
}
|
||||
else
|
||||
{
|
||||
doom_Listener.OrientFront.x = 0.f;
|
||||
doom_Listener.OrientFront.y = 0.f;
|
||||
doom_Listener.OrientFront.z = 1.f;
|
||||
|
@ -496,30 +543,37 @@ void I_UpdateSound( void )
|
|||
|
||||
ALfloat listenerOrientation[] = { doom_Listener.OrientFront.x, doom_Listener.OrientFront.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 );
|
||||
alListener3f( AL_POSITION, doom_Listener.Position.x, doom_Listener.Position.y, doom_Listener.Position.z );
|
||||
|
||||
// Update playing source voice positions
|
||||
int i;
|
||||
activeSound_t* sound;
|
||||
for ( i=0; i < NUM_SOUNDBUFFERS; i++ ) {
|
||||
for( i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||
{
|
||||
sound = &activeSounds[i];
|
||||
|
||||
if ( !sound->valid ) {
|
||||
if( !sound->valid )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ALint sourceState;
|
||||
alGetSourcei( sound->alSourceVoice, AL_SOURCE_STATE, &sourceState );
|
||||
if ( sourceState == AL_PLAYING ) {
|
||||
if ( sound->localSound ) {
|
||||
if( sourceState == AL_PLAYING )
|
||||
{
|
||||
if( sound->localSound )
|
||||
{
|
||||
alSource3f( sound->alSourceVoice, AL_POSITION, doom_Listener.Position.x,
|
||||
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 z = (ALfloat)(sound->originator->y >> FRACBITS);
|
||||
ALfloat z = ( ALfloat )( sound->originator->y >> FRACBITS );
|
||||
|
||||
alSource3f( sound->alSourceVoice, AL_POSITION, x, y, z );
|
||||
}
|
||||
|
@ -546,12 +600,15 @@ void I_ShutdownSound( void )
|
|||
int done = 0;
|
||||
int i;
|
||||
|
||||
if ( S_initialized ) {
|
||||
if( S_initialized )
|
||||
{
|
||||
// Stop all sounds
|
||||
for ( i = 0; i < NUM_SOUNDBUFFERS; i++ ) {
|
||||
activeSound_t * sound = &activeSounds[i];
|
||||
for( i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||
{
|
||||
activeSound_t* sound = &activeSounds[i];
|
||||
|
||||
if ( !sound ) {
|
||||
if( !sound )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -559,8 +616,10 @@ void I_ShutdownSound( void )
|
|||
}
|
||||
|
||||
// Free allocated sound memory
|
||||
for ( i = 1; i < NUMSFX; i++ ) {
|
||||
if ( S_sfx[i].data && !(S_sfx[i].link) ) {
|
||||
for( i = 1; i < NUMSFX; i++ )
|
||||
{
|
||||
if( S_sfx[i].data && !( S_sfx[i].link ) )
|
||||
{
|
||||
free( S_sfx[i].data );
|
||||
}
|
||||
}
|
||||
|
@ -584,13 +643,15 @@ void I_InitSoundHardware( int numOutputChannels_, int channelMask )
|
|||
::numOutputChannels = numOutputChannels_;
|
||||
|
||||
// Initialize source voices
|
||||
for ( int i = 0; i < NUM_SOUNDBUFFERS; i++ ) {
|
||||
for( int i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||
{
|
||||
I_InitSoundChannel( i, numOutputChannels );
|
||||
}
|
||||
|
||||
// Create OpenAL buffers for all sounds
|
||||
for ( int i = 1; i < NUMSFX; i++ ) {
|
||||
alGenBuffers( (ALuint)1, &alBuffers[i] );
|
||||
for( int i = 1; i < NUMSFX; i++ )
|
||||
{
|
||||
alGenBuffers( ( ALuint )1, &alBuffers[i] );
|
||||
}
|
||||
|
||||
I_InitMusic();
|
||||
|
@ -613,14 +674,17 @@ void I_ShutdownSoundHardware()
|
|||
I_ShutdownMusic();
|
||||
|
||||
// Delete all source voices
|
||||
for ( int i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
||||
activeSound_t * sound = &activeSounds[i];
|
||||
for( int i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||
{
|
||||
activeSound_t* sound = &activeSounds[i];
|
||||
|
||||
if ( !sound ) {
|
||||
if( !sound )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( sound->alSourceVoice ) {
|
||||
if( sound->alSourceVoice )
|
||||
{
|
||||
alSourceStop( sound->alSourceVoice );
|
||||
alSourcei( sound->alSourceVoice, AL_BUFFER, 0 );
|
||||
alDeleteSources( 1, &sound->alSourceVoice );
|
||||
|
@ -628,7 +692,8 @@ void I_ShutdownSoundHardware()
|
|||
}
|
||||
|
||||
// Delete OpenAL buffers for all sounds
|
||||
for ( int i = 0; i < NUMSFX; i++ ) {
|
||||
for( int i = 0; i < NUMSFX; i++ )
|
||||
{
|
||||
alDeleteBuffers( 1, &alBuffers[i] );
|
||||
}
|
||||
}
|
||||
|
@ -640,9 +705,9 @@ I_InitSoundChannel
|
|||
*/
|
||||
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 );
|
||||
alSourcef( soundchannel->alSourceVoice, AL_LOOPING, AL_FALSE );
|
||||
|
@ -658,7 +723,8 @@ I_InitSound
|
|||
*/
|
||||
void I_InitSound()
|
||||
{
|
||||
if ( S_initialized == 0 ) {
|
||||
if( S_initialized == 0 )
|
||||
{
|
||||
// Set up listener parameters
|
||||
doom_Listener.OrientFront.x = 0.f;
|
||||
doom_Listener.OrientFront.y = 0.f;
|
||||
|
@ -672,18 +738,23 @@ void I_InitSound()
|
|||
doom_Listener.Position.y = 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.
|
||||
if ( !S_sfx[i].link ) {
|
||||
if( !S_sfx[i].link )
|
||||
{
|
||||
// Load data from WAD file.
|
||||
S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] );
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Previously loaded already?
|
||||
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 ) {
|
||||
alBufferData( alBuffers[i], SFX_SAMPLETYPE, (byte*)S_sfx[i].data, lengths[i], SFX_RATE );
|
||||
if( S_sfx[i].data )
|
||||
{
|
||||
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
|
||||
// for other players, but it can't be outside the game
|
||||
// frame like the soundEvents are.
|
||||
if ( DoomLib::GetPlayer() == 0 ) {
|
||||
if( DoomLib::GetPlayer() == 0 )
|
||||
{
|
||||
// Do 3D positioning of sounds
|
||||
I_UpdateSound();
|
||||
|
||||
|
@ -724,7 +796,7 @@ I_SetMusicVolume
|
|||
*/
|
||||
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 )
|
||||
{
|
||||
if ( !Music_initialized ) {
|
||||
if( !Music_initialized )
|
||||
{
|
||||
// Initialize Timidity
|
||||
Timidity_Init( MIDI_RATE, MIDI_FORMAT, MIDI_CHANNELS, MIDI_RATE, "classicmusic/gravis.cfg" );
|
||||
|
||||
|
@ -743,12 +816,12 @@ void I_InitMusic( void )
|
|||
waitingForMusic = false;
|
||||
musicReady = false;
|
||||
|
||||
alGenSources( (ALuint)1, &alMusicSourceVoice );
|
||||
alGenSources( ( ALuint )1, &alMusicSourceVoice );
|
||||
|
||||
alSourcef( alMusicSourceVoice, AL_PITCH, 1.f );
|
||||
alSourcef( alMusicSourceVoice, AL_LOOPING, AL_TRUE );
|
||||
|
||||
alGenBuffers( (ALuint)1, &alMusicBuffer );
|
||||
alGenBuffers( ( ALuint )1, &alMusicBuffer );
|
||||
|
||||
Music_initialized = true;
|
||||
}
|
||||
|
@ -761,18 +834,22 @@ I_ShutdownMusic
|
|||
*/
|
||||
void I_ShutdownMusic( void )
|
||||
{
|
||||
if ( Music_initialized ) {
|
||||
if ( alMusicSourceVoice ) {
|
||||
if( Music_initialized )
|
||||
{
|
||||
if( alMusicSourceVoice )
|
||||
{
|
||||
I_StopSong( 0 );
|
||||
alSourcei( alMusicSourceVoice, AL_BUFFER, 0 );
|
||||
alDeleteSources( 1, &alMusicSourceVoice );
|
||||
}
|
||||
|
||||
if ( alMusicBuffer ) {
|
||||
if( alMusicBuffer )
|
||||
{
|
||||
alDeleteBuffers( 1, &alMusicBuffer );
|
||||
}
|
||||
|
||||
if ( musicBuffer ) {
|
||||
if( musicBuffer )
|
||||
{
|
||||
free( musicBuffer );
|
||||
musicBuffer = NULL;
|
||||
}
|
||||
|
@ -787,11 +864,12 @@ void I_ShutdownMusic( void )
|
|||
Music_initialized = false;
|
||||
}
|
||||
|
||||
int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len);
|
||||
int Mus2Midi( unsigned char* bytes, unsigned char* out, int* len );
|
||||
|
||||
namespace {
|
||||
const int MaxMidiConversionSize = 1024 * 1024;
|
||||
unsigned char midiConversionBuffer[MaxMidiConversionSize];
|
||||
namespace
|
||||
{
|
||||
const int MaxMidiConversionSize = 1024 * 1024;
|
||||
unsigned char midiConversionBuffer[MaxMidiConversionSize];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -799,20 +877,21 @@ namespace {
|
|||
I_LoadSong
|
||||
======================
|
||||
*/
|
||||
void I_LoadSong( const char * songname )
|
||||
void I_LoadSong( const char* songname )
|
||||
{
|
||||
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;
|
||||
Mus2Midi( musFile, midiConversionBuffer, &length );
|
||||
|
||||
doomMusic = Timidity_LoadSongMem( midiConversionBuffer, length );
|
||||
|
||||
if ( doomMusic ) {
|
||||
musicBuffer = (byte *)malloc( MIDI_CHANNELS * MIDI_FORMAT_BYTES * doomMusic->samples );
|
||||
if( doomMusic )
|
||||
{
|
||||
musicBuffer = ( byte* )malloc( MIDI_CHANNELS * MIDI_FORMAT_BYTES * doomMusic->samples );
|
||||
totalBufferSize = doomMusic->samples * MIDI_CHANNELS * MIDI_FORMAT_BYTES;
|
||||
Timidity_Start( doomMusic );
|
||||
|
||||
|
@ -820,10 +899,12 @@ void I_LoadSong( const char * songname )
|
|||
int num_bytes = 0;
|
||||
int offset = 0;
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
rc = Timidity_PlaySome( musicBuffer + offset, MIDI_RATE, &num_bytes );
|
||||
offset += num_bytes;
|
||||
} while ( rc != RC_TUNE_END );
|
||||
}
|
||||
while( rc != RC_TUNE_END );
|
||||
|
||||
Timidity_Stop();
|
||||
Timidity_FreeSong( doomMusic );
|
||||
|
@ -837,16 +918,18 @@ void I_LoadSong( const char * songname )
|
|||
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;
|
||||
}
|
||||
|
||||
I_StopSong( 0 );
|
||||
|
||||
// Clear old state
|
||||
if ( musicBuffer ) {
|
||||
if( musicBuffer )
|
||||
{
|
||||
free( musicBuffer );
|
||||
musicBuffer = 0;
|
||||
}
|
||||
|
@ -855,7 +938,8 @@ void I_PlaySong( const char *songname, int looping )
|
|||
I_LoadSong( songname );
|
||||
waitingForMusic = true;
|
||||
|
||||
if ( DoomLib::GetPlayer() >= 0 ) {
|
||||
if( DoomLib::GetPlayer() >= 0 )
|
||||
{
|
||||
::g->mus_looping = looping;
|
||||
}
|
||||
}
|
||||
|
@ -867,18 +951,23 @@ I_UpdateMusic
|
|||
*/
|
||||
void I_UpdateMusic( void )
|
||||
{
|
||||
if ( !Music_initialized ) {
|
||||
if( !Music_initialized )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( alMusicSourceVoice ) {
|
||||
if( alMusicSourceVoice )
|
||||
{
|
||||
// Set the volume
|
||||
alSourcef( alMusicSourceVoice, AL_GAIN, x_MusicVolume * GLOBAL_VOLUME_MULTIPLIER );
|
||||
}
|
||||
|
||||
if ( waitingForMusic ) {
|
||||
if ( musicReady && alMusicSourceVoice ) {
|
||||
if ( musicBuffer ) {
|
||||
if( waitingForMusic )
|
||||
{
|
||||
if( musicReady && alMusicSourceVoice )
|
||||
{
|
||||
if( musicBuffer )
|
||||
{
|
||||
alSourcei( alMusicSourceVoice, AL_BUFFER, 0 );
|
||||
alBufferData( alMusicBuffer, MIDI_SAMPLETYPE, musicBuffer, totalBufferSize, MIDI_RATE );
|
||||
alSourcei( alMusicSourceVoice, AL_BUFFER, alMusicBuffer );
|
||||
|
@ -895,9 +984,10 @@ void I_UpdateMusic( void )
|
|||
I_PauseSong
|
||||
======================
|
||||
*/
|
||||
void I_PauseSong ( int handle )
|
||||
void I_PauseSong( int handle )
|
||||
{
|
||||
if ( !Music_initialized || !alMusicSourceVoice ) {
|
||||
if( !Music_initialized || !alMusicSourceVoice )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -909,9 +999,10 @@ void I_PauseSong ( int handle )
|
|||
I_ResumeSong
|
||||
======================
|
||||
*/
|
||||
void I_ResumeSong ( int handle )
|
||||
void I_ResumeSong( int handle )
|
||||
{
|
||||
if ( !Music_initialized || !alMusicSourceVoice ) {
|
||||
if( !Music_initialized || !alMusicSourceVoice )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -925,7 +1016,8 @@ I_StopSong
|
|||
*/
|
||||
void I_StopSong( int handle )
|
||||
{
|
||||
if ( !Music_initialized || !alMusicSourceVoice ) {
|
||||
if( !Music_initialized || !alMusicSourceVoice )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,83 +35,89 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "w_wad.h"
|
||||
|
||||
// Init at program start...
|
||||
void I_InitSound(){}
|
||||
void I_InitSoundHardware( int numOutputChannels_, int channelMask ){}
|
||||
void I_InitSound() {}
|
||||
void I_InitSoundHardware( int numOutputChannels_, int channelMask ) {}
|
||||
|
||||
// ... update sound buffer and audio device at runtime...
|
||||
void I_UpdateSound(void){}
|
||||
void I_SubmitSound(void){}
|
||||
void I_UpdateSound( void ) {}
|
||||
void I_SubmitSound( void ) {}
|
||||
|
||||
// ... shut down and relase at program termination.
|
||||
void I_ShutdownSound(void){}
|
||||
void I_ShutdownSoundHardware(){}
|
||||
void I_ShutdownSound( void ) {}
|
||||
void I_ShutdownSoundHardware() {}
|
||||
|
||||
//
|
||||
// SFX I/O
|
||||
//
|
||||
|
||||
// Initialize channels?
|
||||
void I_SetChannels(){}
|
||||
void I_SetChannels() {}
|
||||
|
||||
// Get raw data lump index for sound descriptor.
|
||||
int I_GetSfxLumpNum (sfxinfo_t* sfxinfo )
|
||||
int I_GetSfxLumpNum( sfxinfo_t* sfxinfo )
|
||||
{
|
||||
char namebuf[9];
|
||||
sprintf(namebuf, "ds%s", sfxinfo->name);
|
||||
return W_GetNumForName(namebuf);
|
||||
sprintf( namebuf, "ds%s", sfxinfo->name );
|
||||
return W_GetNumForName( namebuf );
|
||||
}
|
||||
|
||||
void I_ProcessSoundEvents( void ){}
|
||||
void I_ProcessSoundEvents( void ) {}
|
||||
|
||||
// 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 )
|
||||
{ return 0; }
|
||||
int I_StartSound( int id, mobj_t* origin, mobj_t* listener_origin, int vol, int pitch, int priority )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Stops a sound channel.
|
||||
void I_StopSound(int handle, int player){}
|
||||
void I_StopSound( int handle, int player ) {}
|
||||
|
||||
// Called by S_*() functions
|
||||
// to see if a channel is still playing.
|
||||
// Returns 0 if no longer playing, 1 if playing.
|
||||
int I_SoundIsPlaying(int handle)
|
||||
{ return 0; }
|
||||
int I_SoundIsPlaying( int handle )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Updates the volume, separation,
|
||||
// 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
|
||||
//
|
||||
void I_InitMusic(void){}
|
||||
void I_InitMusic( void ) {}
|
||||
|
||||
void I_ShutdownMusic(void){}
|
||||
void I_ShutdownMusic( void ) {}
|
||||
|
||||
// Volume.
|
||||
void I_SetMusicVolume(int volume){}
|
||||
void I_SetMusicVolume( int volume ) {}
|
||||
|
||||
// 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.
|
||||
int I_RegisterSong(void *data, int length)
|
||||
{ return 0; }
|
||||
int I_RegisterSong( void* data, int length )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Called by anything that wishes to start music.
|
||||
// plays a song, and when the song is done,
|
||||
// starts playing it again in an endless loop.
|
||||
// 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.
|
||||
void I_StopSong(int handle){}
|
||||
void I_StopSong( int handle ) {}
|
||||
|
||||
// See above (register), then think backwards
|
||||
void I_UnRegisterSong(int handle){}
|
||||
void I_UnRegisterSong( int handle ) {}
|
||||
|
||||
// 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"
|
||||
|
||||
#ifdef _MSC_VER // DG: xaudio can only be used with MSVC
|
||||
#include <xaudio2.h>
|
||||
#include <x3daudio.h>
|
||||
#include <xaudio2.h>
|
||||
#include <x3daudio.h>
|
||||
#endif // DG end
|
||||
|
||||
#pragma warning ( disable : 4244 )
|
||||
|
||||
#define MIDI_CHANNELS 2
|
||||
#if 1
|
||||
#define MIDI_RATE 22050
|
||||
#define MIDI_SAMPLETYPE XAUDIOSAMPLETYPE_8BITPCM
|
||||
#define MIDI_FORMAT AUDIO_U8
|
||||
#define MIDI_FORMAT_BYTES 1
|
||||
#define MIDI_RATE 22050
|
||||
#define MIDI_SAMPLETYPE XAUDIOSAMPLETYPE_8BITPCM
|
||||
#define MIDI_FORMAT AUDIO_U8
|
||||
#define MIDI_FORMAT_BYTES 1
|
||||
#else
|
||||
#define MIDI_RATE 48000
|
||||
#define MIDI_SAMPLETYPE XAUDIOSAMPLETYPE_16BITPCM
|
||||
#define MIDI_FORMAT AUDIO_S16MSB
|
||||
#define MIDI_FORMAT_BYTES 2
|
||||
#define MIDI_RATE 48000
|
||||
#define MIDI_SAMPLETYPE XAUDIOSAMPLETYPE_16BITPCM
|
||||
#define MIDI_FORMAT AUDIO_S16MSB
|
||||
#define MIDI_FORMAT_BYTES 2
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER // DG: xaudio can only be used with MSVC
|
||||
IXAudio2SourceVoice* pMusicSourceVoice;
|
||||
IXAudio2SourceVoice* pMusicSourceVoice;
|
||||
#endif
|
||||
|
||||
MidiSong* doomMusic;
|
||||
|
@ -90,7 +90,8 @@ bool waitingForMusic;
|
|||
bool musicReady;
|
||||
|
||||
|
||||
typedef struct tagActiveSound_t {
|
||||
typedef struct tagActiveSound_t
|
||||
{
|
||||
IXAudio2SourceVoice* m_pSourceVoice; // Source voice
|
||||
X3DAUDIO_DSP_SETTINGS m_DSPSettings;
|
||||
X3DAUDIO_EMITTER m_Emitter;
|
||||
|
@ -100,18 +101,19 @@ typedef struct tagActiveSound_t {
|
|||
int start;
|
||||
int player;
|
||||
bool localSound;
|
||||
mobj_t *originator;
|
||||
mobj_t* originator;
|
||||
} activeSound_t;
|
||||
|
||||
|
||||
// cheap little struct to hold a sound
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int vol;
|
||||
int player;
|
||||
int pitch;
|
||||
int priority;
|
||||
mobj_t *originator;
|
||||
mobj_t *listener;
|
||||
mobj_t* originator;
|
||||
mobj_t* listener;
|
||||
} soundEvent_t;
|
||||
|
||||
// array of all the possible sounds
|
||||
|
@ -139,9 +141,9 @@ static bool soundHardwareInitialized = false;
|
|||
|
||||
// DG: xaudio can only be used with MSVC
|
||||
#ifdef _MSC_VER
|
||||
X3DAUDIO_HANDLE X3DAudioInstance;
|
||||
X3DAUDIO_HANDLE X3DAudioInstance;
|
||||
|
||||
X3DAUDIO_LISTENER doom_Listener;
|
||||
X3DAUDIO_LISTENER doom_Listener;
|
||||
#endif
|
||||
|
||||
//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,
|
||||
// for single sound.
|
||||
//
|
||||
void* getsfx ( const char* sfxname, int* len )
|
||||
void* getsfx( const char* sfxname, int* len )
|
||||
{
|
||||
unsigned char* sfx;
|
||||
unsigned char* sfxmem;
|
||||
|
@ -169,36 +171,43 @@ void* getsfx ( const char* sfxname, int* len )
|
|||
|
||||
// Get the sound data from the WAD, allocate lump
|
||||
// in zone memory.
|
||||
sprintf(name, "ds%s", sfxname);
|
||||
sprintf( name, "ds%s", sfxname );
|
||||
|
||||
// Scale down the plasma gun, it clips
|
||||
if ( strcmp( sfxname, "plasma" ) == 0 ) {
|
||||
if( strcmp( sfxname, "plasma" ) == 0 )
|
||||
{
|
||||
scale = 0.75f;
|
||||
}
|
||||
if ( strcmp( sfxname, "itemup" ) == 0 ) {
|
||||
if( strcmp( sfxname, "itemup" ) == 0 )
|
||||
{
|
||||
scale = 1.333f;
|
||||
}
|
||||
|
||||
// If sound requested is not found in current WAD, use pistol as default
|
||||
if ( W_CheckNumForName(name) == -1 )
|
||||
sfxlump = W_GetNumForName("dspistol");
|
||||
if( W_CheckNumForName( name ) == -1 )
|
||||
{
|
||||
sfxlump = W_GetNumForName( "dspistol" );
|
||||
}
|
||||
else
|
||||
sfxlump = W_GetNumForName(name);
|
||||
{
|
||||
sfxlump = W_GetNumForName( name );
|
||||
}
|
||||
|
||||
// Sound lump headers are 8 bytes.
|
||||
const int SOUND_LUMP_HEADER_SIZE_IN_BYTES = 8;
|
||||
|
||||
size = W_LumpLength( sfxlump ) - SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
||||
|
||||
sfx = (unsigned char*)W_CacheLumpNum( sfxlump, PU_CACHE_SHARED );
|
||||
const unsigned char * sfxSampleStart = sfx + SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
||||
sfx = ( unsigned char* )W_CacheLumpNum( sfxlump, PU_CACHE_SHARED );
|
||||
const unsigned char* sfxSampleStart = sfx + SOUND_LUMP_HEADER_SIZE_IN_BYTES;
|
||||
|
||||
// Allocate from zone memory.
|
||||
//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
|
||||
for ( int i=0; i<size; i++ ) {
|
||||
for( int i = 0; i < size; i++ )
|
||||
{
|
||||
sfxmem[i] = sfxSampleStart[i];// * scale;
|
||||
}
|
||||
|
||||
|
@ -209,7 +218,7 @@ void* getsfx ( const char* sfxname, int* len )
|
|||
*len = size;
|
||||
|
||||
// Return allocated padded data.
|
||||
return (void *) (sfxmem);
|
||||
return ( void* )( sfxmem );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -217,7 +226,8 @@ void* getsfx ( const char* sfxname, int* len )
|
|||
I_SetChannels
|
||||
======================
|
||||
*/
|
||||
void I_SetChannels() {
|
||||
void I_SetChannels()
|
||||
{
|
||||
// Original Doom set up lookup tables here
|
||||
}
|
||||
|
||||
|
@ -226,8 +236,9 @@ void I_SetChannels() {
|
|||
I_SetSfxVolume
|
||||
======================
|
||||
*/
|
||||
void I_SetSfxVolume(int volume) {
|
||||
x_SoundVolume = ((float)volume / 15.f) * GLOBAL_VOLUME_MULTIPLIER;
|
||||
void I_SetSfxVolume( int volume )
|
||||
{
|
||||
x_SoundVolume = ( ( float )volume / 15.f ) * GLOBAL_VOLUME_MULTIPLIER;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -239,11 +250,11 @@ I_GetSfxLumpNum
|
|||
// Retrieve the raw data lump index
|
||||
// for a given SFX name.
|
||||
//
|
||||
int I_GetSfxLumpNum(sfxinfo_t* sfx)
|
||||
int I_GetSfxLumpNum( sfxinfo_t* sfx )
|
||||
{
|
||||
char namebuf[9];
|
||||
sprintf(namebuf, "ds%s", sfx->name);
|
||||
return W_GetNumForName(namebuf);
|
||||
sprintf( namebuf, "ds%s", sfx->name );
|
||||
return W_GetNumForName( namebuf );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -261,8 +272,10 @@ I_StartSound2
|
|||
// priority, it is ignored.
|
||||
// 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 ) {
|
||||
if ( !soundHardwareInitialized ) {
|
||||
int I_StartSound2( int id, int player, mobj_t* origin, mobj_t* listener_origin, int pitch, int priority )
|
||||
{
|
||||
if( !soundHardwareInitialized )
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -272,13 +285,15 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
|||
int oldest = 0, oldestnum = -1;
|
||||
|
||||
// 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.
|
||||
for (i=0 ; i < NUM_SOUNDBUFFERS ; i++)
|
||||
for( i = 0 ; i < NUM_SOUNDBUFFERS ; 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 );
|
||||
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
|
||||
for (i = 0; i < NUM_SOUNDBUFFERS; ++i) {
|
||||
for( i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||
{
|
||||
sound = &activeSounds[i];
|
||||
|
||||
if (!sound->valid)
|
||||
if( !sound->valid )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!oldest || oldest > sound->start) {
|
||||
if( !oldest || oldest > sound->start )
|
||||
{
|
||||
oldestnum = i;
|
||||
oldest = sound->start;
|
||||
}
|
||||
|
||||
sound->m_pSourceVoice->GetState( &state );
|
||||
if ( state.BuffersQueued == 0 ) {
|
||||
if( state.BuffersQueued == 0 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// none found, so use the oldest one
|
||||
if (i == NUM_SOUNDBUFFERS)
|
||||
if( i == NUM_SOUNDBUFFERS )
|
||||
{
|
||||
i = oldestnum;
|
||||
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 };
|
||||
Packet.Flags = XAUDIO2_END_OF_STREAM;
|
||||
Packet.AudioBytes = lengths[id];
|
||||
Packet.pAudioData = (BYTE*)S_sfx[id].data;
|
||||
Packet.pAudioData = ( BYTE* )S_sfx[id].data;
|
||||
Packet.PlayBegin = 0;
|
||||
Packet.PlayLength = 0;
|
||||
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 );
|
||||
|
||||
// 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
|
||||
if ( origin && origin != listener_origin ) {
|
||||
if( origin && origin != listener_origin )
|
||||
{
|
||||
// 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.z = (float)(origin->y >> FRACBITS);
|
||||
sound->m_Emitter.Position.z = ( float )( origin->y >> FRACBITS );
|
||||
|
||||
// Calculate 3D positioned speaker volumes
|
||||
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->localSound = false;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Local(or Global) sound, fixed speaker volumes
|
||||
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
|
||||
HRESULT hr;
|
||||
if( FAILED( hr = sound->m_pSourceVoice->SubmitSourceBuffer( &Packet ) ) ) {
|
||||
if( FAILED( hr = sound->m_pSourceVoice->SubmitSourceBuffer( &Packet ) ) )
|
||||
{
|
||||
int fail = 1;
|
||||
}
|
||||
|
||||
// Play the source voice
|
||||
if( FAILED( hr = sound->m_pSourceVoice->Start( 0 ) ) ) {
|
||||
if( FAILED( hr = sound->m_pSourceVoice->Start( 0 ) ) )
|
||||
{
|
||||
int fail = 1;
|
||||
}
|
||||
|
||||
|
@ -381,9 +406,12 @@ int I_StartSound2 ( int id, int player, mobj_t *origin, mobj_t *listener_origin,
|
|||
I_ProcessSoundEvents
|
||||
======================
|
||||
*/
|
||||
void I_ProcessSoundEvents() {
|
||||
for( int i = 0; i < 128; i++ ) {
|
||||
if( soundEvents[i].pitch ) {
|
||||
void I_ProcessSoundEvents()
|
||||
{
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
@ -395,19 +423,24 @@ void I_ProcessSoundEvents() {
|
|||
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
|
||||
if( ::g->gamestate != GS_LEVEL && DoomLib::GetPlayer() != 0 ) {
|
||||
if( ::g->gamestate != GS_LEVEL && DoomLib::GetPlayer() != 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 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
|
||||
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 );
|
||||
}
|
||||
else {
|
||||
if( soundEvents[ id ].vol < vol ) {
|
||||
else
|
||||
{
|
||||
if( soundEvents[ id ].vol < vol )
|
||||
{
|
||||
soundEvents[ id ].player = DoomLib::GetPlayer();
|
||||
soundEvents[ id ].pitch = pitch;
|
||||
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
|
||||
======================
|
||||
*/
|
||||
void I_StopSound (int handle, int player)
|
||||
void I_StopSound( int handle, int player )
|
||||
{
|
||||
// You need the handle returned by StartSound.
|
||||
// Would be looping all channels,
|
||||
|
@ -434,19 +467,24 @@ void I_StopSound (int handle, int player)
|
|||
int i;
|
||||
activeSound_t* sound = 0;
|
||||
|
||||
for (i = 0; i < NUM_SOUNDBUFFERS; ++i)
|
||||
for( i = 0; i < NUM_SOUNDBUFFERS; ++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;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == NUM_SOUNDBUFFERS)
|
||||
if( i == NUM_SOUNDBUFFERS )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// stop the sound
|
||||
if ( sound->m_pSourceVoice != NULL ) {
|
||||
if( sound->m_pSourceVoice != NULL )
|
||||
{
|
||||
sound->m_pSourceVoice->Stop( 0 );
|
||||
}
|
||||
|
||||
|
@ -459,8 +497,10 @@ void I_StopSound (int handle, int player)
|
|||
I_SoundIsPlaying
|
||||
======================
|
||||
*/
|
||||
int I_SoundIsPlaying(int handle) {
|
||||
if ( !soundHardwareInitialized ) {
|
||||
int I_SoundIsPlaying( int handle )
|
||||
{
|
||||
if( !soundHardwareInitialized )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -468,14 +508,17 @@ int I_SoundIsPlaying(int handle) {
|
|||
XAUDIO2_VOICE_STATE state;
|
||||
activeSound_t* sound;
|
||||
|
||||
for (i = 0; i < NUM_SOUNDBUFFERS; ++i)
|
||||
for( i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||
{
|
||||
sound = &activeSounds[i];
|
||||
if (!sound->valid || sound->id != handle)
|
||||
if( !sound->valid || sound->id != handle )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sound->m_pSourceVoice->GetState( &state );
|
||||
if ( state.BuffersQueued > 0 ) {
|
||||
if( state.BuffersQueued > 0 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -490,8 +533,10 @@ I_UpdateSound
|
|||
*/
|
||||
// Update Listener Position and go through all the
|
||||
// channels and update speaker volumes for 3D sound.
|
||||
void I_UpdateSound() {
|
||||
if ( !soundHardwareInitialized ) {
|
||||
void I_UpdateSound()
|
||||
{
|
||||
if( !soundHardwareInitialized )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -499,17 +544,20 @@ void I_UpdateSound() {
|
|||
XAUDIO2_VOICE_STATE state;
|
||||
activeSound_t* sound;
|
||||
|
||||
for ( i=0; i < NUM_SOUNDBUFFERS; i++ ) {
|
||||
for( i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||
{
|
||||
sound = &activeSounds[i];
|
||||
|
||||
if ( !sound->valid || sound->localSound ) {
|
||||
if( !sound->valid || sound->localSound )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sound->m_pSourceVoice->GetState( &state );
|
||||
|
||||
if ( state.BuffersQueued > 0 ) {
|
||||
mobj_t *playerObj = ::g->players[ sound->player ].mo;
|
||||
if( state.BuffersQueued > 0 )
|
||||
{
|
||||
mobj_t* playerObj = ::g->players[ sound->player ].mo;
|
||||
|
||||
// Update Listener Orientation and Position
|
||||
angle_t pAngle = playerObj->angle;
|
||||
|
@ -520,18 +568,18 @@ void I_UpdateSound() {
|
|||
fx = finecosine[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.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.z = (float)(playerObj->y >> FRACBITS);
|
||||
doom_Listener.Position.z = ( float )( playerObj->y >> FRACBITS );
|
||||
|
||||
// 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.z = (float)(sound->originator->y >> FRACBITS);
|
||||
sound->m_Emitter.Position.z = ( float )( sound->originator->y >> FRACBITS );
|
||||
|
||||
// Calculate 3D positioned speaker volumes
|
||||
DWORD dwCalculateFlags = X3DAUDIO_CALCULATE_MATRIX;
|
||||
|
@ -548,7 +596,8 @@ void I_UpdateSound() {
|
|||
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
|
||||
======================
|
||||
*/
|
||||
void I_ShutdownSound(void) {
|
||||
void I_ShutdownSound( void )
|
||||
{
|
||||
int done = 0;
|
||||
int i;
|
||||
|
||||
if ( S_initialized ) {
|
||||
if( S_initialized )
|
||||
{
|
||||
// Stop all sounds, but don't destroy the XAudio2 buffers.
|
||||
for ( i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
||||
activeSound_t * sound = &activeSounds[i];
|
||||
for( i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||
{
|
||||
activeSound_t* sound = &activeSounds[i];
|
||||
|
||||
if ( sound == NULL ) {
|
||||
if( sound == NULL )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
I_StopSound( sound->id, 0 );
|
||||
|
||||
if ( sound->m_pSourceVoice ) {
|
||||
if( sound->m_pSourceVoice )
|
||||
{
|
||||
sound->m_pSourceVoice->FlushSourceBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
for (i=1 ; i<NUMSFX ; i++) {
|
||||
if ( S_sfx[i].data && !(S_sfx[i].link) ) {
|
||||
for( i = 1 ; i < NUMSFX ; i++ )
|
||||
{
|
||||
if( S_sfx[i].data && !( S_sfx[i].link ) )
|
||||
{
|
||||
//Z_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.
|
||||
======================
|
||||
*/
|
||||
void I_InitSoundHardware( int numOutputChannels_, int channelMask ) {
|
||||
void I_InitSoundHardware( int numOutputChannels_, int channelMask )
|
||||
{
|
||||
::numOutputChannels = numOutputChannels_;
|
||||
|
||||
// Initialize the X3DAudio
|
||||
|
@ -608,7 +665,8 @@ void I_InitSoundHardware( int numOutputChannels_, int channelMask ) {
|
|||
// SpeedOfSound - not used by doomclassic
|
||||
X3DAudioInitialize( channelMask, 340.29f, X3DAudioInstance );
|
||||
|
||||
for ( int i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
||||
for( int i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||
{
|
||||
// Initialize source voices
|
||||
I_InitSoundChannel( i, numOutputChannels );
|
||||
}
|
||||
|
@ -627,26 +685,31 @@ Called from the tech4x shutdown code. Tears down Doom classic's
|
|||
sound channels.
|
||||
======================
|
||||
*/
|
||||
void I_ShutdownSoundHardware() {
|
||||
void I_ShutdownSoundHardware()
|
||||
{
|
||||
soundHardwareInitialized = false;
|
||||
|
||||
I_ShutdownMusic();
|
||||
|
||||
for ( int i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
||||
activeSound_t * sound = &activeSounds[i];
|
||||
for( int i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||
{
|
||||
activeSound_t* sound = &activeSounds[i];
|
||||
|
||||
if ( sound == NULL ) {
|
||||
if( sound == NULL )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( sound->m_pSourceVoice ) {
|
||||
if( sound->m_pSourceVoice )
|
||||
{
|
||||
sound->m_pSourceVoice->Stop();
|
||||
sound->m_pSourceVoice->FlushSourceBuffers();
|
||||
sound->m_pSourceVoice->DestroyVoice();
|
||||
sound->m_pSourceVoice = NULL;
|
||||
}
|
||||
|
||||
if ( sound->m_DSPSettings.pMatrixCoefficients ) {
|
||||
if( sound->m_DSPSettings.pMatrixCoefficients )
|
||||
{
|
||||
delete [] sound->m_DSPSettings.pMatrixCoefficients;
|
||||
sound->m_DSPSettings.pMatrixCoefficients = NULL;
|
||||
}
|
||||
|
@ -658,8 +721,9 @@ void I_ShutdownSoundHardware() {
|
|||
I_InitSoundChannel
|
||||
======================
|
||||
*/
|
||||
void I_InitSoundChannel( int channel, int numOutputChannels_ ) {
|
||||
activeSound_t *soundchannel = &activeSounds[ channel ];
|
||||
void I_InitSoundChannel( int channel, int numOutputChannels_ )
|
||||
{
|
||||
activeSound_t* soundchannel = &activeSounds[ channel ];
|
||||
|
||||
// RB: fixed non-aggregates cannot be initialized with initializer list
|
||||
#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.Position = 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
|
||||
// outer cone other than 0 causes
|
||||
// the emitter to act like a point emitter using the
|
||||
|
@ -718,7 +782,7 @@ void I_InitSoundChannel( int channel, int numOutputChannels_ ) {
|
|||
voiceFormat.wBitsPerSample = 8;
|
||||
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
|
||||
======================
|
||||
*/
|
||||
void I_InitSound() {
|
||||
void I_InitSound()
|
||||
{
|
||||
|
||||
if (S_initialized == 0) {
|
||||
if( S_initialized == 0 )
|
||||
{
|
||||
int i;
|
||||
|
||||
// RB: non-aggregates cannot be initialized with initializer list
|
||||
|
@ -749,10 +815,10 @@ void I_InitSound() {
|
|||
doom_Listener.Position = 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.
|
||||
if (!S_sfx[i].link)
|
||||
if( !S_sfx[i].link )
|
||||
{
|
||||
// Load data from WAD file.
|
||||
S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] );
|
||||
|
@ -761,7 +827,7 @@ void I_InitSound() {
|
|||
{
|
||||
// Previously loaded already?
|
||||
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
|
||||
======================
|
||||
*/
|
||||
void I_SubmitSound(void)
|
||||
void I_SubmitSound( void )
|
||||
{
|
||||
// Only do this for player 0, it will still handle positioning
|
||||
// for other players, but it can't be outside the game
|
||||
// frame like the soundEvents are.
|
||||
if ( DoomLib::GetPlayer() == 0 ) {
|
||||
if( DoomLib::GetPlayer() == 0 )
|
||||
{
|
||||
// Do 3D positioning of sounds
|
||||
I_UpdateSound();
|
||||
|
||||
|
@ -800,9 +867,9 @@ void I_SubmitSound(void)
|
|||
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
|
||||
======================
|
||||
*/
|
||||
void I_InitMusic(void)
|
||||
void I_InitMusic( void )
|
||||
{
|
||||
if ( !Music_initialized ) {
|
||||
if( !Music_initialized )
|
||||
{
|
||||
// Initialize Timidity
|
||||
Timidity_Init( MIDI_RATE, MIDI_FORMAT, MIDI_CHANNELS, MIDI_RATE, "classicmusic/gravis.cfg" );
|
||||
|
||||
|
@ -833,7 +901,7 @@ void I_InitMusic(void)
|
|||
voiceFormat.cbSize = 0;
|
||||
|
||||
// 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
|
||||
|
||||
Music_initialized = true;
|
||||
|
@ -845,31 +913,38 @@ void I_InitMusic(void)
|
|||
I_ShutdownMusic
|
||||
======================
|
||||
*/
|
||||
void I_ShutdownMusic(void)
|
||||
void I_ShutdownMusic( void )
|
||||
{
|
||||
I_StopSong( 0 );
|
||||
|
||||
if ( Music_initialized ) {
|
||||
if ( pMusicSourceVoice ) {
|
||||
if( Music_initialized )
|
||||
{
|
||||
if( pMusicSourceVoice )
|
||||
{
|
||||
pMusicSourceVoice->Stop();
|
||||
pMusicSourceVoice->FlushSourceBuffers();
|
||||
pMusicSourceVoice->DestroyVoice();
|
||||
pMusicSourceVoice = NULL;
|
||||
}
|
||||
|
||||
if ( hMusicThread ) {
|
||||
if( hMusicThread )
|
||||
{
|
||||
DWORD rc;
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
GetExitCodeThread( hMusicThread, &rc );
|
||||
if ( rc == STILL_ACTIVE ) {
|
||||
if( rc == STILL_ACTIVE )
|
||||
{
|
||||
Sleep( 1 );
|
||||
}
|
||||
} while( rc == STILL_ACTIVE );
|
||||
}
|
||||
while( rc == STILL_ACTIVE );
|
||||
|
||||
CloseHandle( hMusicThread );
|
||||
}
|
||||
if ( musicBuffer ) {
|
||||
if( musicBuffer )
|
||||
{
|
||||
free( musicBuffer );
|
||||
}
|
||||
|
||||
|
@ -887,11 +962,12 @@ void I_ShutdownMusic(void)
|
|||
Music_initialized = false;
|
||||
}
|
||||
|
||||
int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len);
|
||||
int Mus2Midi( unsigned char* bytes, unsigned char* out, int* len );
|
||||
|
||||
namespace {
|
||||
const int MaxMidiConversionSize = 1024 * 1024;
|
||||
unsigned char midiConversionBuffer[MaxMidiConversionSize];
|
||||
namespace
|
||||
{
|
||||
const int MaxMidiConversionSize = 1024 * 1024;
|
||||
unsigned char midiConversionBuffer[MaxMidiConversionSize];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -899,19 +975,21 @@ namespace {
|
|||
I_LoadSong
|
||||
======================
|
||||
*/
|
||||
DWORD WINAPI I_LoadSong( LPVOID songname ) {
|
||||
DWORD WINAPI I_LoadSong( LPVOID songname )
|
||||
{
|
||||
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;
|
||||
Mus2Midi( musFile, midiConversionBuffer, &length );
|
||||
|
||||
doomMusic = Timidity_LoadSongMem( midiConversionBuffer, length );
|
||||
|
||||
if ( doomMusic ) {
|
||||
musicBuffer = (byte *)malloc( MIDI_CHANNELS * MIDI_FORMAT_BYTES * doomMusic->samples );
|
||||
if( doomMusic )
|
||||
{
|
||||
musicBuffer = ( byte* )malloc( MIDI_CHANNELS * MIDI_FORMAT_BYTES * doomMusic->samples );
|
||||
totalBufferSize = doomMusic->samples * MIDI_CHANNELS * MIDI_FORMAT_BYTES;
|
||||
|
||||
Timidity_Start( doomMusic );
|
||||
|
@ -920,10 +998,12 @@ DWORD WINAPI I_LoadSong( LPVOID songname ) {
|
|||
int num_bytes = 0;
|
||||
int offset = 0;
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
rc = Timidity_PlaySome( musicBuffer + offset, MIDI_RATE, &num_bytes );
|
||||
offset += num_bytes;
|
||||
} while ( rc != RC_TUNE_END );
|
||||
}
|
||||
while( rc != RC_TUNE_END );
|
||||
|
||||
Timidity_Stop();
|
||||
Timidity_FreeSong( doomMusic );
|
||||
|
@ -939,13 +1019,15 @@ DWORD WINAPI I_LoadSong( LPVOID songname ) {
|
|||
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;
|
||||
}
|
||||
|
||||
if ( pMusicSourceVoice != NULL ) {
|
||||
if( pMusicSourceVoice != NULL )
|
||||
{
|
||||
// Stop the voice and flush packets before freeing the musicBuffer
|
||||
pMusicSourceVoice->Stop();
|
||||
pMusicSourceVoice->FlushSourceBuffers();
|
||||
|
@ -954,30 +1036,35 @@ void I_PlaySong( const char *songname, int looping)
|
|||
// Make sure voice is stopped before we free the buffer
|
||||
bool isStopped = false;
|
||||
int d = 0;
|
||||
while ( !isStopped ) {
|
||||
while( !isStopped )
|
||||
{
|
||||
XAUDIO2_VOICE_STATE test = {};
|
||||
|
||||
if ( pMusicSourceVoice != NULL ) {
|
||||
if( pMusicSourceVoice != NULL )
|
||||
{
|
||||
pMusicSourceVoice->GetState( &test );
|
||||
}
|
||||
|
||||
if ( test.pCurrentBufferContext == NULL && test.BuffersQueued == 0 ) {
|
||||
if( test.pCurrentBufferContext == NULL && test.BuffersQueued == 0 )
|
||||
{
|
||||
isStopped = true;
|
||||
}
|
||||
//I_Printf( "waiting to stop (%d)\n", d++ );
|
||||
}
|
||||
|
||||
// Clear old state
|
||||
if ( musicBuffer != NULL ) {
|
||||
if( musicBuffer != NULL )
|
||||
{
|
||||
free( musicBuffer );
|
||||
musicBuffer = NULL;
|
||||
}
|
||||
|
||||
musicReady = false;
|
||||
I_LoadSong( (LPVOID)songname );
|
||||
I_LoadSong( ( LPVOID )songname );
|
||||
waitingForMusic = true;
|
||||
|
||||
if ( DoomLib::GetPlayer() >= 0 ) {
|
||||
if( DoomLib::GetPlayer() >= 0 )
|
||||
{
|
||||
::g->mus_looping = looping;
|
||||
}
|
||||
}
|
||||
|
@ -987,21 +1074,26 @@ void I_PlaySong( const char *songname, int looping)
|
|||
I_UpdateMusic
|
||||
======================
|
||||
*/
|
||||
void I_UpdateMusic() {
|
||||
if ( !Music_initialized ) {
|
||||
void I_UpdateMusic()
|
||||
{
|
||||
if( !Music_initialized )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( waitingForMusic ) {
|
||||
if( waitingForMusic )
|
||||
{
|
||||
|
||||
if ( musicReady && pMusicSourceVoice != NULL ) {
|
||||
if( musicReady && pMusicSourceVoice != NULL )
|
||||
{
|
||||
|
||||
if ( musicBuffer ) {
|
||||
if( musicBuffer )
|
||||
{
|
||||
// Set up packet
|
||||
XAUDIO2_BUFFER Packet = { 0 };
|
||||
Packet.Flags = XAUDIO2_END_OF_STREAM;
|
||||
Packet.AudioBytes = totalBufferSize;
|
||||
Packet.pAudioData = (BYTE*)musicBuffer;
|
||||
Packet.pAudioData = ( BYTE* )musicBuffer;
|
||||
Packet.PlayBegin = 0;
|
||||
Packet.PlayLength = 0;
|
||||
Packet.LoopBegin = 0;
|
||||
|
@ -1011,12 +1103,14 @@ void I_UpdateMusic() {
|
|||
|
||||
// Submit packet
|
||||
HRESULT hr;
|
||||
if( FAILED( hr = pMusicSourceVoice->SubmitSourceBuffer( &Packet ) ) ) {
|
||||
if( FAILED( hr = pMusicSourceVoice->SubmitSourceBuffer( &Packet ) ) )
|
||||
{
|
||||
int fail = 1;
|
||||
}
|
||||
|
||||
// Play the source voice
|
||||
if( FAILED( hr = pMusicSourceVoice->Start( 0 ) ) ) {
|
||||
if( FAILED( hr = pMusicSourceVoice->Start( 0 ) ) )
|
||||
{
|
||||
int fail = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1025,7 +1119,8 @@ void I_UpdateMusic() {
|
|||
}
|
||||
}
|
||||
|
||||
if ( pMusicSourceVoice != NULL ) {
|
||||
if( pMusicSourceVoice != NULL )
|
||||
{
|
||||
// Set the volume
|
||||
pMusicSourceVoice->SetVolume( x_MusicVolume * GLOBAL_VOLUME_MULTIPLIER );
|
||||
}
|
||||
|
@ -1036,13 +1131,15 @@ void I_UpdateMusic() {
|
|||
I_PauseSong
|
||||
======================
|
||||
*/
|
||||
void I_PauseSong (int handle)
|
||||
void I_PauseSong( int handle )
|
||||
{
|
||||
if ( !Music_initialized ) {
|
||||
if( !Music_initialized )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( pMusicSourceVoice != NULL ) {
|
||||
if( pMusicSourceVoice != NULL )
|
||||
{
|
||||
// Stop the music source voice
|
||||
pMusicSourceVoice->Stop( 0 );
|
||||
}
|
||||
|
@ -1053,14 +1150,16 @@ void I_PauseSong (int handle)
|
|||
I_ResumeSong
|
||||
======================
|
||||
*/
|
||||
void I_ResumeSong (int handle)
|
||||
void I_ResumeSong( int handle )
|
||||
{
|
||||
if ( !Music_initialized ) {
|
||||
if( !Music_initialized )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop the music source voice
|
||||
if ( pMusicSourceVoice != NULL ) {
|
||||
if( pMusicSourceVoice != NULL )
|
||||
{
|
||||
pMusicSourceVoice->Start( 0 );
|
||||
}
|
||||
}
|
||||
|
@ -1070,14 +1169,16 @@ void I_ResumeSong (int handle)
|
|||
I_StopSong
|
||||
======================
|
||||
*/
|
||||
void I_StopSong(int handle)
|
||||
void I_StopSong( int handle )
|
||||
{
|
||||
if ( !Music_initialized ) {
|
||||
if( !Music_initialized )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop the music source voice
|
||||
if ( pMusicSourceVoice != NULL ) {
|
||||
if( pMusicSourceVoice != NULL )
|
||||
{
|
||||
pMusicSourceVoice->Stop( 0 );
|
||||
}
|
||||
}
|
||||
|
@ -1087,7 +1188,7 @@ void I_StopSong(int handle)
|
|||
I_UnRegisterSong
|
||||
======================
|
||||
*/
|
||||
void I_UnRegisterSong(int handle)
|
||||
void I_UnRegisterSong( int handle )
|
||||
{
|
||||
// does nothing
|
||||
}
|
||||
|
@ -1097,7 +1198,7 @@ void I_UnRegisterSong(int handle)
|
|||
I_RegisterSong
|
||||
======================
|
||||
*/
|
||||
int I_RegisterSong(void* data, int length)
|
||||
int I_RegisterSong( void* data, int length )
|
||||
{
|
||||
// does nothing
|
||||
return 0;
|
||||
|
|
|
@ -45,7 +45,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "g_game.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "i_system.h"
|
||||
#pragma implementation "i_system.h"
|
||||
#endif
|
||||
#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;
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
// returns time in 1/70th second tics
|
||||
//
|
||||
int I_GetTime (void)
|
||||
int I_GetTime( void )
|
||||
{
|
||||
return ::g->current_time;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ void I_SetTime( int time_in )
|
|||
//
|
||||
// I_Init
|
||||
//
|
||||
void I_Init (void)
|
||||
void I_Init( void )
|
||||
{
|
||||
I_InitSound();
|
||||
// I_InitGraphics();
|
||||
|
@ -95,12 +95,12 @@ void I_Init (void)
|
|||
//
|
||||
// I_Quit
|
||||
//
|
||||
void I_Quit (void)
|
||||
void I_Quit( void )
|
||||
{
|
||||
D_QuitNetGame ();
|
||||
D_QuitNetGame();
|
||||
I_ShutdownSound();
|
||||
I_ShutdownMusic();
|
||||
M_SaveDefaults ();
|
||||
M_SaveDefaults();
|
||||
I_ShutdownGraphics();
|
||||
// exit(0);
|
||||
|
||||
|
@ -108,17 +108,17 @@ void I_Quit (void)
|
|||
// throw;
|
||||
}
|
||||
|
||||
void I_WaitVBL(int count)
|
||||
void I_WaitVBL( int count )
|
||||
{
|
||||
// PS3 fixme
|
||||
//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
|
||||
//
|
||||
extern bool debugOutput;
|
||||
void I_Printf(const char* msg, ...)
|
||||
void I_Printf( const char* msg, ... )
|
||||
{
|
||||
char pmsg[1024];
|
||||
va_list argptr;
|
||||
|
||||
// Message first.
|
||||
if( debugOutput ) {
|
||||
va_start (argptr,msg);
|
||||
vsprintf (pmsg, msg, argptr);
|
||||
if( debugOutput )
|
||||
{
|
||||
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];
|
||||
va_list argptr;
|
||||
|
||||
// Message first.
|
||||
if( debugOutput ) {
|
||||
va_start (argptr,msg);
|
||||
vsprintf (pmsg, msg, argptr);
|
||||
if( debugOutput )
|
||||
{
|
||||
va_start( argptr, msg );
|
||||
vsprintf( pmsg, msg, argptr );
|
||||
|
||||
safeOutputDebug("ERROR: ");
|
||||
safeOutputDebug(pmsg);
|
||||
safeOutputDebug( "ERROR: " );
|
||||
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;
|
||||
char error_msg[ERROR_MSG_SIZE];
|
||||
va_list argptr;
|
||||
|
||||
// Message first.
|
||||
if( debugOutput ) {
|
||||
va_start (argptr,error);
|
||||
idStr::vsnPrintf (error_msg, ERROR_MSG_SIZE, error, argptr);
|
||||
if( debugOutput )
|
||||
{
|
||||
va_start( argptr, error );
|
||||
idStr::vsnPrintf( error_msg, ERROR_MSG_SIZE, error, argptr );
|
||||
|
||||
safeOutputDebug("Error: ");
|
||||
safeOutputDebug(error_msg);
|
||||
safeOutputDebug("\n");
|
||||
safeOutputDebug( "Error: " );
|
||||
safeOutputDebug( error_msg );
|
||||
safeOutputDebug( "\n" );
|
||||
|
||||
va_end (argptr);
|
||||
va_end( argptr );
|
||||
}
|
||||
|
||||
// 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"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
// Called by DoomMain.
|
||||
void I_Init (void);
|
||||
void I_Init( void );
|
||||
|
||||
// Called by D_DoomLoop,
|
||||
// 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).
|
||||
// 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.
|
||||
// This ticcmd will then be modified by the gameloop
|
||||
// for normal input.
|
||||
ticcmd_t* I_BaseTiccmd (void);
|
||||
ticcmd_t* I_BaseTiccmd( void );
|
||||
|
||||
|
||||
// Called by M_Responder when quit is selected.
|
||||
// Clean exit, displays sell blurb.
|
||||
void I_Quit (void);
|
||||
void I_Quit( void );
|
||||
|
||||
|
||||
void I_Error (const char *error, ...);
|
||||
void I_Printf(const char *error, ...);
|
||||
void I_PrintfE(const char *error, ...);
|
||||
void I_Error( const char* error, ... );
|
||||
void I_Printf( const char* error, ... );
|
||||
void I_PrintfE( const char* error, ... );
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,42 +34,42 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "d_event.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
// Called by D_DoomMain,
|
||||
// determines the hardware configuration
|
||||
// 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.
|
||||
void I_SetPalette (byte* palette);
|
||||
void I_SetPalette( byte* palette );
|
||||
|
||||
void I_UpdateNoBlit (void);
|
||||
void I_FinishUpdate (void);
|
||||
void I_UpdateNoBlit( void );
|
||||
void I_FinishUpdate( void );
|
||||
|
||||
// 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_EndRead (void);
|
||||
void I_BeginRead( void );
|
||||
void I_EndRead( void );
|
||||
|
||||
void I_InitInput (void);
|
||||
void I_InitInput( void );
|
||||
|
||||
void I_ShutdownInput() ;
|
||||
void I_InputFrame();
|
||||
|
||||
void I_UpdateControllerState(void);
|
||||
void I_UpdateControllerState( void );
|
||||
struct controller_t;
|
||||
int I_PollMouseInputEvents( controller_t * ) ;
|
||||
int I_ReturnMouseInputEvent( const int n, event_t* e);
|
||||
int I_PollJoystickInputEvents( controller_t * ) ;
|
||||
int I_ReturnJoystickInputEvent( const int n, event_t* e);
|
||||
int I_PollMouseInputEvents( controller_t* ) ;
|
||||
int I_ReturnMouseInputEvent( const int n, event_t* e );
|
||||
int I_PollJoystickInputEvents( controller_t* ) ;
|
||||
int I_ReturnJoystickInputEvent( const int n, event_t* e );
|
||||
void I_EndJoystickInputEvents();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -50,7 +50,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
|
||||
void I_ShutdownGraphics(void)
|
||||
void I_ShutdownGraphics( void )
|
||||
{
|
||||
// VVTODO: Shutdown Graphics
|
||||
}
|
||||
|
@ -60,22 +60,28 @@ void I_ShutdownGraphics(void)
|
|||
//
|
||||
// I_StartFrame
|
||||
//
|
||||
void I_StartFrame (void)
|
||||
void I_StartFrame( void )
|
||||
{
|
||||
// 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;
|
||||
if (fabs((float)in->data2) > fabs((float)out->data2))
|
||||
}
|
||||
if( fabs( ( float )in->data2 ) > fabs( ( float )out->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;
|
||||
}
|
||||
}
|
||||
|
||||
void I_GetEvents( controller_t *controller )
|
||||
void I_GetEvents( controller_t* controller )
|
||||
{
|
||||
event_t e_mouse, e_joystick;
|
||||
int numEvents;
|
||||
|
@ -86,48 +92,57 @@ void I_GetEvents( controller_t *controller )
|
|||
e_joystick.data1 = e_joystick.data2 = e_joystick.data3 = 0;
|
||||
|
||||
numEvents = I_PollMouseInputEvents( controller );
|
||||
if (numEvents)
|
||||
if( numEvents )
|
||||
{
|
||||
int i;
|
||||
event_t e;
|
||||
|
||||
// right thumb stick
|
||||
for (i = 0; i < numEvents; ++i)
|
||||
for( i = 0; i < numEvents; ++i )
|
||||
{
|
||||
I_ReturnMouseInputEvent(i, &e);
|
||||
if (e.type == ev_mouse)
|
||||
I_CombineMouseEvent(&e, &e_mouse);
|
||||
else if (e.type == ev_joystick)
|
||||
I_CombineMouseEvent(&e, &e_joystick);
|
||||
I_ReturnMouseInputEvent( i, &e );
|
||||
if( e.type == ev_mouse )
|
||||
{
|
||||
I_CombineMouseEvent( &e, &e_mouse );
|
||||
}
|
||||
else if( e.type == ev_joystick )
|
||||
{
|
||||
I_CombineMouseEvent( &e, &e_joystick );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
numEvents = I_PollJoystickInputEvents( controller );
|
||||
if (numEvents)
|
||||
if( numEvents )
|
||||
{
|
||||
int i;
|
||||
event_t e;
|
||||
for (i = 0; i < numEvents; ++i)
|
||||
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);
|
||||
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);
|
||||
D_PostEvent( &e_mouse );
|
||||
D_PostEvent( &e_joystick );
|
||||
}
|
||||
|
||||
//
|
||||
// I_UpdateNoBlit
|
||||
//
|
||||
void I_UpdateNoBlit (void)
|
||||
void I_UpdateNoBlit( void )
|
||||
{
|
||||
// what is this?
|
||||
}
|
||||
|
@ -135,7 +150,7 @@ void I_UpdateNoBlit (void)
|
|||
//
|
||||
// I_FinishUpdate
|
||||
//
|
||||
void I_FinishUpdate (void)
|
||||
void I_FinishUpdate( void )
|
||||
{
|
||||
// DHM - These buffers are not used
|
||||
}
|
||||
|
@ -144,18 +159,19 @@ void I_FinishUpdate (void)
|
|||
//
|
||||
// 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;
|
||||
|
||||
color |= (r & 255) << 24;
|
||||
color |= (g & 255) << 16;
|
||||
color |= (b & 255) << 8;
|
||||
color |= (a & 255);
|
||||
color |= ( r & 255 ) << 24;
|
||||
color |= ( g & 255 ) << 16;
|
||||
color |= ( b & 255 ) << 8;
|
||||
color |= ( a & 255 );
|
||||
|
||||
return color;
|
||||
}
|
||||
|
@ -163,19 +179,19 @@ inline unsigned int I_PackColor( unsigned int a, unsigned int r, unsigned int g,
|
|||
//
|
||||
// I_SetPalette
|
||||
//
|
||||
void I_SetPalette (byte* palette)
|
||||
void I_SetPalette( byte* palette )
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
// 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++];
|
||||
g = 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
|
@ -1159,14 +1159,15 @@ typedef struct
|
|||
// GCC 4.1 for PS3 gives the error "braces around scalar initializer"
|
||||
// for these actionf_p2s. So, let's make it not a scalar!
|
||||
// The second value of the struct will be initalized to 0.
|
||||
// struct {
|
||||
// struct {
|
||||
// actionf_p2 action; // <- this was left
|
||||
// int filler;
|
||||
// };
|
||||
// };
|
||||
#ifdef _MSC_VER
|
||||
actionf_p2 action;
|
||||
#else
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
actionf_p2 action;
|
||||
// int filler;
|
||||
};
|
||||
|
@ -1178,10 +1179,11 @@ typedef struct
|
|||
|
||||
extern const state_t tempStates[NUMSTATES];
|
||||
// RB: sprnames must be NULL-terminated
|
||||
extern const char * const sprnames[NUMSPRITES + 1];
|
||||
extern const char* const sprnames[NUMSPRITES + 1];
|
||||
// RB end
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
MT_PLAYER,
|
||||
MT_POSSESSED,
|
||||
MT_SHOTGUY,
|
||||
|
|
|
@ -42,15 +42,17 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// in the program's command line arguments.
|
||||
// Returns the argument number (1 to argc-1)
|
||||
// or 0 if not present
|
||||
int M_CheckParm (const char *check)
|
||||
int M_CheckParm( const char* check )
|
||||
{
|
||||
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 0;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ extern char** myargv;
|
|||
|
||||
// Returns the position of the given parameter
|
||||
// in the arg list (0 if not found).
|
||||
int M_CheckParm (const char* check);
|
||||
int M_CheckParm( const char* check );
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "m_bbox.h"
|
||||
#pragma implementation "m_bbox.h"
|
||||
#endif
|
||||
#include "m_bbox.h"
|
||||
|
||||
|
@ -39,7 +39,7 @@ 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[BOXBOTTOM] = box[BOXLEFT] = MAXINT;
|
||||
|
@ -51,14 +51,22 @@ M_AddToBox
|
|||
fixed_t x,
|
||||
fixed_t y )
|
||||
{
|
||||
if (x<box[BOXLEFT])
|
||||
if( x < box[BOXLEFT] )
|
||||
{
|
||||
box[BOXLEFT] = x;
|
||||
else if (x>box[BOXRIGHT])
|
||||
}
|
||||
else if( x > box[BOXRIGHT] )
|
||||
{
|
||||
box[BOXRIGHT] = x;
|
||||
if (y<box[BOXBOTTOM])
|
||||
}
|
||||
if( y < box[BOXBOTTOM] )
|
||||
{
|
||||
box[BOXBOTTOM] = y;
|
||||
else if (y>box[BOXTOP])
|
||||
}
|
||||
else if( y > box[BOXTOP] )
|
||||
{
|
||||
box[BOXTOP] = y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ enum
|
|||
}; // bbox coordinates
|
||||
|
||||
// Bounding box functions.
|
||||
void M_ClearBox (fixed_t* box);
|
||||
void M_ClearBox( fixed_t* box );
|
||||
|
||||
void
|
||||
M_AddToBox
|
||||
|
|
|
@ -50,39 +50,58 @@ cht_CheckCheat
|
|||
int i;
|
||||
int rc = 0;
|
||||
|
||||
if (::g->firsttime)
|
||||
if( ::g->firsttime )
|
||||
{
|
||||
::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;
|
||||
int isize = 0;
|
||||
while(cht->sequence[isize] != 0xff) cht->p[isize] = cht->sequence[isize];
|
||||
while( cht->sequence[isize] != 0xff )
|
||||
{
|
||||
cht->p[isize] = cht->sequence[isize];
|
||||
}
|
||||
cht->p[isize] = 0xff;
|
||||
::g->usedcheatbuffer += isize;
|
||||
::g->usedcheatbuffer ++;
|
||||
}
|
||||
|
||||
if (*cht->p == 0)
|
||||
*(cht->p++) = key;
|
||||
if( *cht->p == 0 )
|
||||
{
|
||||
*( cht->p++ ) = key;
|
||||
}
|
||||
else if
|
||||
(::g->cheat_xlate_table[(unsigned char)key] == *cht->p) cht->p++;
|
||||
( ::g->cheat_xlate_table[( unsigned char )key] == *cht->p )
|
||||
{
|
||||
cht->p++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int isize = 0;
|
||||
while(cht->sequence[isize] != 0xff) cht->p[isize] = cht->sequence[isize];
|
||||
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
|
||||
}
|
||||
else if( *cht->p == 0xff ) // end of sequence character
|
||||
{
|
||||
int isize = 0;
|
||||
while(cht->sequence[isize] != 0xff) cht->p[isize] = cht->sequence[isize];
|
||||
while( cht->sequence[isize] != 0xff )
|
||||
{
|
||||
cht->p[isize] = cht->sequence[isize];
|
||||
}
|
||||
cht->p[isize] = 0xff;
|
||||
rc = 1;
|
||||
}
|
||||
|
@ -98,27 +117,32 @@ cht_GetParam
|
|||
|
||||
|
||||
unsigned char pb[16];
|
||||
unsigned char *p;
|
||||
unsigned char* p;
|
||||
unsigned char c;
|
||||
|
||||
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;
|
||||
p = &pb[0];
|
||||
|
||||
while (*(p++) != 1);
|
||||
while( *( p++ ) != 1 );
|
||||
|
||||
do
|
||||
{
|
||||
c = *p;
|
||||
*(buffer++) = c;
|
||||
*(p++) = 0;
|
||||
*( buffer++ ) = c;
|
||||
*( p++ ) = 0;
|
||||
}
|
||||
while (c && *p!=0xff );
|
||||
while( c && *p != 0xff );
|
||||
|
||||
if (*p==0xff)
|
||||
if( *p == 0xff )
|
||||
{
|
||||
*buffer = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
struct 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;
|
||||
unsigned char* p;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "Precompiled.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "m_fixed.h"
|
||||
#pragma implementation "m_fixed.h"
|
||||
#endif
|
||||
#include "m_fixed.h"
|
||||
|
||||
|
@ -48,7 +48,7 @@ FixedMul
|
|||
( fixed_t a,
|
||||
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 b )
|
||||
{
|
||||
if ( (abs(a)>>14) >= abs(b))
|
||||
return (a^b)<0 ? MININT : MAXINT;
|
||||
return FixedDiv2 (a,b);
|
||||
if( ( abs( a ) >> 14 ) >= abs( b ) )
|
||||
{
|
||||
return ( a ^ b ) < 0 ? MININT : MAXINT;
|
||||
}
|
||||
return FixedDiv2( a, b );
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,16 +78,18 @@ FixedDiv2
|
|||
{
|
||||
#if 0
|
||||
long long c;
|
||||
c = ((long long)a<<16) / ((long long)b);
|
||||
return (fixed_t) c;
|
||||
c = ( ( long long )a << 16 ) / ( ( long long )b );
|
||||
return ( fixed_t ) c;
|
||||
#endif
|
||||
|
||||
double c;
|
||||
|
||||
c = ((double)a) / ((double)b) * FRACUNIT;
|
||||
c = ( ( double )a ) / ( ( double )b ) * FRACUNIT;
|
||||
|
||||
if (c >= 2147483648.0 || c < -2147483648.0)
|
||||
I_Error("FixedDiv: divide by zero");
|
||||
return (fixed_t) c;
|
||||
if( c >= 2147483648.0 || c < -2147483648.0 )
|
||||
{
|
||||
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__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -43,9 +43,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
typedef int fixed_t;
|
||||
|
||||
fixed_t FixedMul (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 FixedMul( fixed_t a, fixed_t b );
|
||||
fixed_t FixedDiv( 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,
|
||||
// this can resize the view and change game parameters.
|
||||
// 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,
|
||||
// only used for menu (skull cursor) animation.
|
||||
void M_Ticker (void);
|
||||
void M_Ticker( void );
|
||||
|
||||
// Called by main loop,
|
||||
// draws the menus directly into the screen buffer.
|
||||
void M_Drawer (void);
|
||||
void M_Drawer( void );
|
||||
|
||||
// Called by D_DoomMain,
|
||||
// loads the config file.
|
||||
void M_Init (void);
|
||||
void M_Init( void );
|
||||
|
||||
// Called by intro code to force menu up upon a keypress,
|
||||
// does nothing if menu is already up.
|
||||
void M_StartControlPanel (void);
|
||||
void M_StartControlPanel( void );
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -78,24 +78,30 @@ M_DrawText
|
|||
int c;
|
||||
int w;
|
||||
|
||||
while (*string)
|
||||
while( *string )
|
||||
{
|
||||
c = toupper(*string) - HU_FONTSTART;
|
||||
c = toupper( *string ) - HU_FONTSTART;
|
||||
string++;
|
||||
if (c < 0 || c> HU_FONTSIZE)
|
||||
if( c < 0 || c > HU_FONTSIZE )
|
||||
{
|
||||
x += 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
w = SHORT (::g->hu_font[c]->width);
|
||||
if (x+w > SCREENWIDTH)
|
||||
w = SHORT( ::g->hu_font[c]->width );
|
||||
if( x + w > SCREENWIDTH )
|
||||
{
|
||||
break;
|
||||
if (direct)
|
||||
V_DrawPatchDirect(x, y, 0, ::g->hu_font[c]);
|
||||
}
|
||||
if( direct )
|
||||
{
|
||||
V_DrawPatchDirect( x, y, 0, ::g->hu_font[c] );
|
||||
}
|
||||
else
|
||||
V_DrawPatch(x, y, 0, ::g->hu_font[c]);
|
||||
x+=w;
|
||||
{
|
||||
V_DrawPatch( x, y, 0, ::g->hu_font[c] );
|
||||
}
|
||||
x += w;
|
||||
}
|
||||
|
||||
return x;
|
||||
|
@ -105,21 +111,26 @@ M_DrawText
|
|||
//
|
||||
// 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;
|
||||
|
||||
handle = fileSystem->OpenFileWrite( name, "fs_savepath" );
|
||||
|
||||
if (handle == NULL )
|
||||
if( handle == NULL )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
count = handle->Write( source, length );
|
||||
fileSystem->CloseFile( handle );
|
||||
|
||||
if (count < length)
|
||||
if( count < length )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -128,24 +139,27 @@ bool M_WriteFile ( char const* name, void* source, int length ) {
|
|||
//
|
||||
// M_ReadFile
|
||||
//
|
||||
int M_ReadFile ( char const* name, byte** buffer ) {
|
||||
int M_ReadFile( char const* name, byte** buffer )
|
||||
{
|
||||
int count, length;
|
||||
idFile * handle = NULL;
|
||||
byte *buf;
|
||||
idFile* handle = NULL;
|
||||
byte* buf;
|
||||
|
||||
handle = fileSystem->OpenFileRead( name, false );
|
||||
|
||||
if (handle == NULL ) {
|
||||
I_Error ("Couldn't read file %s", name);
|
||||
if( handle == NULL )
|
||||
{
|
||||
I_Error( "Couldn't read file %s", name );
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
if (count < length ) {
|
||||
I_Error ("Couldn't read file %s", name);
|
||||
if( count < length )
|
||||
{
|
||||
I_Error( "Couldn't read file %s", name );
|
||||
}
|
||||
|
||||
fileSystem->CloseFile( handle );
|
||||
|
@ -209,9 +223,9 @@ extern const char* const temp_chat_macros[];
|
|||
//
|
||||
// M_SaveDefaults
|
||||
//
|
||||
void M_SaveDefaults (void)
|
||||
void M_SaveDefaults( void )
|
||||
{
|
||||
/*
|
||||
/*
|
||||
int i;
|
||||
int v;
|
||||
FILE* f;
|
||||
|
@ -234,7 +248,7 @@ void M_SaveDefaults (void)
|
|||
}
|
||||
|
||||
fclose (f);
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -242,7 +256,7 @@ void M_SaveDefaults (void)
|
|||
// M_LoadDefaults
|
||||
//
|
||||
|
||||
void M_LoadDefaults (void)
|
||||
void M_LoadDefaults( void )
|
||||
{
|
||||
int i;
|
||||
//int len;
|
||||
|
@ -254,21 +268,25 @@ void M_LoadDefaults (void)
|
|||
//qboolean isstring;
|
||||
|
||||
// set everything to base values
|
||||
::g->numdefaults = sizeof(::g->defaults)/sizeof(::g->defaults[0]);
|
||||
for (i=0 ; i < ::g->numdefaults ; i++)
|
||||
::g->numdefaults = sizeof( ::g->defaults ) / sizeof( ::g->defaults[0] );
|
||||
for( i = 0 ; i < ::g->numdefaults ; i++ )
|
||||
{
|
||||
*::g->defaults[i].location = ::g->defaults[i].defaultvalue;
|
||||
}
|
||||
|
||||
// check for a custom default file
|
||||
i = M_CheckParm ("-config");
|
||||
if (i && i < ::g->myargc-1)
|
||||
i = M_CheckParm( "-config" );
|
||||
if( i && i < ::g->myargc - 1 )
|
||||
{
|
||||
::g->defaultfile = ::g->myargv[i+1];
|
||||
I_Printf (" default file: %s\n",::g->defaultfile);
|
||||
::g->defaultfile = ::g->myargv[i + 1];
|
||||
I_Printf( " default file: %s\n", ::g->defaultfile );
|
||||
}
|
||||
else
|
||||
{
|
||||
::g->defaultfile = ::g->basedefault;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
// read the file in, overriding any set ::g->defaults
|
||||
f = f o pen (::g->defaultfile, "r");
|
||||
if (f)
|
||||
|
@ -306,7 +324,7 @@ void M_LoadDefaults (void)
|
|||
|
||||
fclose (f);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -335,9 +353,9 @@ WritePCXfile
|
|||
//
|
||||
// M_ScreenShot
|
||||
//
|
||||
void M_ScreenShot (void)
|
||||
void M_ScreenShot( void )
|
||||
{
|
||||
/*
|
||||
/*
|
||||
int i;
|
||||
byte* linear;
|
||||
char lbmname[12];
|
||||
|
@ -365,7 +383,7 @@ void M_ScreenShot (void)
|
|||
(byte*)W_CacheLumpName ("PLAYPAL",PU_CACHE_SHARED));
|
||||
|
||||
::g->players[::g->consoleplayer].message = "screen shot";
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,17 +41,17 @@ M_WriteFile
|
|||
int length );
|
||||
|
||||
int
|
||||
M_ReadFile
|
||||
( char const* name,
|
||||
M_ReadFile
|
||||
( char const* name,
|
||||
byte** buffer );
|
||||
|
||||
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_SaveDefaults (void);
|
||||
void M_LoadDefaults( void );
|
||||
void M_SaveDefaults( void );
|
||||
|
||||
|
||||
int
|
||||
|
|
|
@ -34,7 +34,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// M_Random
|
||||
// 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 ,
|
||||
95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188 ,
|
||||
|
@ -58,19 +59,19 @@ const unsigned char rndtable[256] = {
|
|||
|
||||
|
||||
// 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];
|
||||
}
|
||||
|
||||
int M_Random (void)
|
||||
int M_Random( void )
|
||||
{
|
||||
::g->rndindex = (::g->rndindex+1)&0xff;
|
||||
::g->rndindex = ( ::g->rndindex + 1 ) & 0xff;
|
||||
return rndtable[::g->rndindex];
|
||||
}
|
||||
|
||||
void M_ClearRandom (void)
|
||||
void M_ClearRandom( void )
|
||||
{
|
||||
::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,
|
||||
// from a lookup table.
|
||||
int M_Random (void);
|
||||
int M_Random( void );
|
||||
|
||||
// As M_Random, but used only by the play simulation.
|
||||
int P_Random (void);
|
||||
int P_Random( void );
|
||||
|
||||
// Fix randoms for demos.
|
||||
void M_ClearRandom (void);
|
||||
void M_ClearRandom( void );
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "m_swap.h"
|
||||
#pragma implementation "m_swap.h"
|
||||
#endif
|
||||
#include "m_swap.h"
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -42,20 +42,20 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//long SwapLONG(long);
|
||||
|
||||
// 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.
|
||||
return (x>>8) | (x<<8);
|
||||
return ( x >> 8 ) | ( x << 8 );
|
||||
}
|
||||
|
||||
// Swapping 32bit.
|
||||
inline unsigned long SwapLONG( unsigned long x)
|
||||
inline unsigned long SwapLONG( unsigned long x )
|
||||
{
|
||||
return
|
||||
(x>>24)
|
||||
| ((x>>8) & 0xff00)
|
||||
| ((x<<8) & 0xff0000)
|
||||
| (x<<24);
|
||||
( x >> 24 )
|
||||
| ( ( x >> 8 ) & 0xff00 )
|
||||
| ( ( x << 8 ) & 0xff0000 )
|
||||
| ( x << 24 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,15 +35,19 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
// reads a variable length integer
|
||||
unsigned long ReadVarLen( char* buffer ) {
|
||||
unsigned long ReadVarLen( char* buffer )
|
||||
{
|
||||
unsigned long value;
|
||||
byte c;
|
||||
|
||||
if ((value = *buffer++) & 0x80) {
|
||||
if( ( value = *buffer++ ) & 0x80 )
|
||||
{
|
||||
value &= 0x7f;
|
||||
do {
|
||||
value = (value << 7) + ((c = *buffer++) & 0x7f);
|
||||
} while (c & 0x80);
|
||||
do
|
||||
{
|
||||
value = ( value << 7 ) + ( ( c = *buffer++ ) & 0x7f );
|
||||
}
|
||||
while( c & 0x80 );
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -54,79 +58,85 @@ int WriteVarLen( long value, byte* out )
|
|||
long buffer, count = 0;
|
||||
|
||||
buffer = value & 0x7f;
|
||||
while ((value >>= 7) > 0) {
|
||||
while( ( value >>= 7 ) > 0 )
|
||||
{
|
||||
buffer <<= 8;
|
||||
buffer += 0x80;
|
||||
buffer += (value & 0x7f);
|
||||
buffer += ( value & 0x7f );
|
||||
}
|
||||
|
||||
while (1) {
|
||||
while( 1 )
|
||||
{
|
||||
++count;
|
||||
*out = (byte)buffer;
|
||||
*out = ( byte )buffer;
|
||||
++out;
|
||||
if (buffer & 0x80)
|
||||
if( buffer & 0x80 )
|
||||
{
|
||||
buffer >>= 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// 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;
|
||||
return buffer;
|
||||
}
|
||||
|
||||
unsigned char* WriteShort(void* b, unsigned short s)
|
||||
unsigned char* WriteShort( void* b, unsigned short s )
|
||||
{
|
||||
unsigned char* buffer = (unsigned char*)b;
|
||||
*buffer++ = (s >> 8);
|
||||
*buffer++ = (s & 0x00FF);
|
||||
unsigned char* buffer = ( unsigned char* )b;
|
||||
*buffer++ = ( s >> 8 );
|
||||
*buffer++ = ( s & 0x00FF );
|
||||
return buffer;
|
||||
}
|
||||
|
||||
unsigned char* WriteInt(void* b, unsigned int i)
|
||||
unsigned char* WriteInt( void* b, unsigned int i )
|
||||
{
|
||||
unsigned char* buffer = (unsigned char*)b;
|
||||
*buffer++ = (i & 0xff000000) >> 24;
|
||||
*buffer++ = (i & 0x00ff0000) >> 16;
|
||||
*buffer++ = (i & 0x0000ff00) >> 8;
|
||||
*buffer++ = (i & 0x000000ff);
|
||||
unsigned char* buffer = ( unsigned char* )b;
|
||||
*buffer++ = ( i & 0xff000000 ) >> 24;
|
||||
*buffer++ = ( i & 0x00ff0000 ) >> 16;
|
||||
*buffer++ = ( i & 0x0000ff00 ) >> 8;
|
||||
*buffer++ = ( i & 0x000000ff );
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// 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->length, 6);
|
||||
WriteShort(&header->format, format);
|
||||
WriteShort(&header->ntracks, track_count);
|
||||
WriteShort(&header->division, division);
|
||||
WriteInt( header->name, 'MThd' );
|
||||
WriteInt( &header->length, 6 );
|
||||
WriteShort( &header->format, format );
|
||||
WriteShort( &header->ntracks, track_count );
|
||||
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, 0xff); // sys command
|
||||
buffer = WriteShort(buffer, 0x5103); // command - set tempo
|
||||
buffer = WriteByte( buffer, 0x00 ); // delta time
|
||||
buffer = WriteByte( buffer, 0xff ); // sys command
|
||||
buffer = WriteShort( buffer, 0x5103 ); // command - set tempo
|
||||
|
||||
buffer = WriteByte(buffer, tempo & 0x000000ff);
|
||||
buffer = WriteByte(buffer, (tempo & 0x0000ff00) >> 8);
|
||||
buffer = WriteByte(buffer, (tempo & 0x00ff0000) >> 16);
|
||||
buffer = WriteByte( buffer, tempo & 0x000000ff );
|
||||
buffer = WriteByte( buffer, ( tempo & 0x0000ff00 ) >> 8 );
|
||||
buffer = WriteByte( buffer, ( tempo & 0x00ff0000 ) >> 16 );
|
||||
|
||||
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;
|
||||
if (max && *bytes_written > max)
|
||||
if( max && *bytes_written > max )
|
||||
{
|
||||
assert(0);
|
||||
assert( 0 );
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
@ -152,19 +162,21 @@ unsigned char MidiMap[] =
|
|||
};
|
||||
|
||||
// The MUS data is stored in little-endian.
|
||||
namespace {
|
||||
unsigned short LittleToNative( const unsigned short value ) {
|
||||
namespace
|
||||
{
|
||||
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
|
||||
MUSheader_t header;
|
||||
|
||||
// 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' )
|
||||
{
|
||||
return 0;
|
||||
|
@ -186,8 +198,8 @@ int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len)
|
|||
byte last_status = 0;
|
||||
|
||||
// read the mus header
|
||||
memcpy(&header, cur, sizeof(header));
|
||||
cur += sizeof(header);
|
||||
memcpy( &header, cur, sizeof( header ) );
|
||||
cur += sizeof( header );
|
||||
|
||||
header.scoreLen = LittleToNative( header.scoreLen );
|
||||
header.scoreStart = LittleToNative( header.scoreStart );
|
||||
|
@ -197,11 +209,14 @@ int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len)
|
|||
header.dummy = LittleToNative( header.dummy );
|
||||
|
||||
// only 15 supported
|
||||
if (header.channels > MIDI_MAXCHANNELS - 1)
|
||||
if( header.channels > MIDI_MAXCHANNELS - 1 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Map channel 15 to 9(percussions)
|
||||
for (temp = 0; temp < MIDI_MAXCHANNELS; ++temp) {
|
||||
for( temp = 0; temp < MIDI_MAXCHANNELS; ++temp )
|
||||
{
|
||||
channelMap[temp] = -1;
|
||||
channel_volume[temp] = 0x40;
|
||||
}
|
||||
|
@ -212,62 +227,66 @@ int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len)
|
|||
end = cur + header.scoreLen;
|
||||
|
||||
// Write out midi header
|
||||
Midi_CreateHeader(&midiHeader, 0, 1, 0x0059);
|
||||
Midi_UpdateBytesWritten(&bytes_written, MIDIHEADERSIZE, *len);
|
||||
memcpy(out, &midiHeader, MIDIHEADERSIZE); // cannot use sizeof(packs it to 16 bytes)
|
||||
Midi_CreateHeader( &midiHeader, 0, 1, 0x0059 );
|
||||
Midi_UpdateBytesWritten( &bytes_written, MIDIHEADERSIZE, *len );
|
||||
memcpy( out, &midiHeader, MIDIHEADERSIZE ); // cannot use sizeof(packs it to 16 bytes)
|
||||
out += MIDIHEADERSIZE;
|
||||
|
||||
// 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;
|
||||
out += sizeof(midiTrackHeader);
|
||||
out += sizeof( midiTrackHeader );
|
||||
|
||||
|
||||
// microseconds per quarter note(yikes)
|
||||
Midi_UpdateBytesWritten(&bytes_written, 7, *len);
|
||||
out = Midi_WriteTempo(out, 0x001aa309);
|
||||
Midi_UpdateBytesWritten( &bytes_written, 7, *len );
|
||||
out = Midi_WriteTempo( out, 0x001aa309 );
|
||||
|
||||
// Percussions channel starts out at full volume
|
||||
Midi_UpdateBytesWritten(&bytes_written, 4, *len);
|
||||
out = WriteByte(out, 0x00);
|
||||
out = WriteByte(out, 0xB9);
|
||||
out = WriteByte(out, 0x07);
|
||||
out = WriteByte(out, 127);
|
||||
Midi_UpdateBytesWritten( &bytes_written, 4, *len );
|
||||
out = WriteByte( out, 0x00 );
|
||||
out = WriteByte( out, 0xB9 );
|
||||
out = WriteByte( out, 0x07 );
|
||||
out = WriteByte( out, 127 );
|
||||
|
||||
// Main Loop
|
||||
while (cur < end) {
|
||||
while( cur < end )
|
||||
{
|
||||
byte channel;
|
||||
byte event;
|
||||
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;
|
||||
|
||||
// Read in current bit
|
||||
event = *cur++;
|
||||
channel = (event & 15); // current channel
|
||||
channel = ( event & 15 ); // current channel
|
||||
|
||||
// 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
|
||||
out_local = WriteByte(out_local, 0xB0 + currentChannel);
|
||||
out_local = WriteByte(out_local, 0x07);
|
||||
out_local = WriteByte(out_local, 127);
|
||||
out_local = WriteByte(out_local, 0x00);
|
||||
out_local = WriteByte( out_local, 0xB0 + currentChannel );
|
||||
out_local = WriteByte( out_local, 0x07 );
|
||||
out_local = WriteByte( out_local, 127 );
|
||||
out_local = WriteByte( out_local, 0x00 );
|
||||
|
||||
channelMap[channel] = currentChannel++;
|
||||
if (currentChannel == 9)
|
||||
if( currentChannel == 9 )
|
||||
{
|
||||
++currentChannel;
|
||||
}
|
||||
}
|
||||
|
||||
status = channelMap[channel];
|
||||
|
||||
// Handle ::g->events
|
||||
switch ((event & 122) >> 4)
|
||||
switch( ( event & 122 ) >> 4 )
|
||||
{
|
||||
default:
|
||||
assert(0);
|
||||
assert( 0 );
|
||||
break;
|
||||
case MUSEVENT_KEYOFF:
|
||||
status |= 0x80;
|
||||
|
@ -277,77 +296,89 @@ int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len)
|
|||
case MUSEVENT_KEYON:
|
||||
status |= 0x90;
|
||||
bit1 = *cur & 127;
|
||||
if (*cur++ & 128) // volume bit?
|
||||
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;
|
||||
bit1 = ( *cur & 1 ) >> 6;
|
||||
bit2 = ( *cur++ >> 1 ) & 127;
|
||||
break;
|
||||
case MUSEVENT_CHANNELMODE:
|
||||
status |= 0xB0;
|
||||
assert(*cur < sizeof(MidiMap) / sizeof(MidiMap[0]));
|
||||
assert( *cur < sizeof( MidiMap ) / sizeof( MidiMap[0] ) );
|
||||
bit1 = MidiMap[*cur++];
|
||||
bit2 = (*cur++ == 12) ? header.channels + 1 : 0x00;
|
||||
bit2 = ( *cur++ == 12 ) ? header.channels + 1 : 0x00;
|
||||
break;
|
||||
case MUSEVENT_CONTROLLERCHANGE:
|
||||
if (*cur == 0) {
|
||||
if( *cur == 0 )
|
||||
{
|
||||
cur++;
|
||||
status |= 0xC0;
|
||||
bit1 = *cur++;
|
||||
bitc = 1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
status |= 0xB0;
|
||||
assert(*cur < sizeof(MidiMap) / sizeof(MidiMap[0]));
|
||||
assert( *cur < sizeof( MidiMap ) / sizeof( MidiMap[0] ) );
|
||||
bit1 = MidiMap[*cur++];
|
||||
bit2 = *cur++;
|
||||
}
|
||||
break;
|
||||
case 5: // Unknown
|
||||
assert(0);
|
||||
assert( 0 );
|
||||
break;
|
||||
case MUSEVENT_END: // End
|
||||
status = 0xff;
|
||||
bit1 = 0x2f;
|
||||
bit2 = 0x00;
|
||||
assert(cur == end);
|
||||
assert( cur == end );
|
||||
break;
|
||||
case 7: // Unknown
|
||||
assert(0);
|
||||
assert( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
// Write it out
|
||||
out_local = WriteByte(out_local, status);
|
||||
out_local = WriteByte(out_local, bit1);
|
||||
if (bitc == 2)
|
||||
out_local = WriteByte(out_local, bit2);
|
||||
out_local = WriteByte( out_local, status );
|
||||
out_local = WriteByte( out_local, bit1 );
|
||||
if( bitc == 2 )
|
||||
{
|
||||
out_local = WriteByte( out_local, bit2 );
|
||||
}
|
||||
|
||||
|
||||
// Write out temp stuff
|
||||
if (out_local != temp_buffer)
|
||||
if( out_local != temp_buffer )
|
||||
{
|
||||
Midi_UpdateBytesWritten(&bytes_written, out_local - temp_buffer, *len);
|
||||
memcpy(out, temp_buffer, out_local - temp_buffer);
|
||||
Midi_UpdateBytesWritten( &bytes_written, out_local - temp_buffer, *len );
|
||||
memcpy( out, temp_buffer, out_local - temp_buffer );
|
||||
out += out_local - temp_buffer;
|
||||
}
|
||||
|
||||
if (event & 128) {
|
||||
if( event & 128 )
|
||||
{
|
||||
delta_time = 0;
|
||||
do {
|
||||
delta_time = delta_time * 128 + (*cur & 127);
|
||||
} while ((*cur++ & 128));
|
||||
} else {
|
||||
do
|
||||
{
|
||||
delta_time = delta_time * 128 + ( *cur & 127 );
|
||||
}
|
||||
while( ( *cur++ & 128 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
delta_time = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Write out track header
|
||||
WriteInt(midiTrackHeader.name, 'MTrk');
|
||||
WriteInt(&midiTrackHeader.length, out - midiTrackHeaderOut - sizeof(midiTrackHeader));
|
||||
memcpy(midiTrackHeaderOut, &midiTrackHeader, sizeof(midiTrackHeader));
|
||||
WriteInt( midiTrackHeader.name, 'MTrk' );
|
||||
WriteInt( &midiTrackHeader.length, out - midiTrackHeaderOut - sizeof( midiTrackHeader ) );
|
||||
memcpy( midiTrackHeaderOut, &midiTrackHeader, sizeof( midiTrackHeader ) );
|
||||
|
||||
// Store length written
|
||||
*len = bytes_written;
|
||||
|
|
|
@ -54,47 +54,47 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// T_MoveCeiling
|
||||
//
|
||||
|
||||
void T_MoveCeiling (ceiling_t* ceiling)
|
||||
void T_MoveCeiling( ceiling_t* ceiling )
|
||||
{
|
||||
result_e res;
|
||||
|
||||
switch(ceiling->direction)
|
||||
switch( ceiling->direction )
|
||||
{
|
||||
case 0:
|
||||
// IN STASIS
|
||||
break;
|
||||
case 1:
|
||||
// UP
|
||||
res = T_MovePlane(ceiling->sector,
|
||||
res = T_MovePlane( ceiling->sector,
|
||||
ceiling->speed,
|
||||
ceiling->topheight,
|
||||
false,1,ceiling->direction);
|
||||
false, 1, ceiling->direction );
|
||||
|
||||
if (!(::g->leveltime&7))
|
||||
if( !( ::g->leveltime & 7 ) )
|
||||
{
|
||||
switch(ceiling->type)
|
||||
switch( ceiling->type )
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
break;
|
||||
default:
|
||||
S_StartSound( &ceiling->sector->soundorg,
|
||||
sfx_stnmov);
|
||||
sfx_stnmov );
|
||||
// ?
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (res == pastdest)
|
||||
if( res == pastdest )
|
||||
{
|
||||
switch(ceiling->type)
|
||||
switch( ceiling->type )
|
||||
{
|
||||
case raiseToHighest:
|
||||
P_RemoveActiveCeiling(ceiling);
|
||||
P_RemoveActiveCeiling( ceiling );
|
||||
break;
|
||||
|
||||
case silentCrushAndRaise:
|
||||
S_StartSound( &ceiling->sector->soundorg,
|
||||
sfx_pstop);
|
||||
sfx_pstop );
|
||||
case fastCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
ceiling->direction = -1;
|
||||
|
@ -109,29 +109,30 @@ void T_MoveCeiling (ceiling_t* ceiling)
|
|||
|
||||
case -1:
|
||||
// DOWN
|
||||
res = T_MovePlane(ceiling->sector,
|
||||
res = T_MovePlane( ceiling->sector,
|
||||
ceiling->speed,
|
||||
ceiling->bottomheight,
|
||||
ceiling->crush,1,ceiling->direction);
|
||||
ceiling->crush, 1, ceiling->direction );
|
||||
|
||||
if (!(::g->leveltime&7))
|
||||
if( !( ::g->leveltime & 7 ) )
|
||||
{
|
||||
switch(ceiling->type)
|
||||
switch( ceiling->type )
|
||||
{
|
||||
case silentCrushAndRaise: break;
|
||||
case silentCrushAndRaise:
|
||||
break;
|
||||
default:
|
||||
S_StartSound( &ceiling->sector->soundorg,
|
||||
sfx_stnmov);
|
||||
sfx_stnmov );
|
||||
}
|
||||
}
|
||||
|
||||
if (res == pastdest)
|
||||
if( res == pastdest )
|
||||
{
|
||||
switch(ceiling->type)
|
||||
switch( ceiling->type )
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
S_StartSound( &ceiling->sector->soundorg,
|
||||
sfx_pstop);
|
||||
sfx_pstop );
|
||||
case crushAndRaise:
|
||||
ceiling->speed = CEILSPEED;
|
||||
case fastCrushAndRaise:
|
||||
|
@ -140,7 +141,7 @@ void T_MoveCeiling (ceiling_t* ceiling)
|
|||
|
||||
case lowerAndCrush:
|
||||
case lowerToFloor:
|
||||
P_RemoveActiveCeiling(ceiling);
|
||||
P_RemoveActiveCeiling( ceiling );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -149,9 +150,9 @@ void T_MoveCeiling (ceiling_t* ceiling)
|
|||
}
|
||||
else // ( res != pastdest )
|
||||
{
|
||||
if (res == crushed)
|
||||
if( res == crushed )
|
||||
{
|
||||
switch(ceiling->type)
|
||||
switch( ceiling->type )
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
|
@ -187,37 +188,39 @@ EV_DoCeiling
|
|||
rtn = 0;
|
||||
|
||||
// Reactivate in-stasis ceilings...for certain types.
|
||||
switch(type)
|
||||
switch( type )
|
||||
{
|
||||
case fastCrushAndRaise:
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
P_ActivateInStasisCeiling(line);
|
||||
P_ActivateInStasisCeiling( line );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
||||
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||
{
|
||||
sec = &::g->sectors[secnum];
|
||||
if (sec->specialdata)
|
||||
if( sec->specialdata )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// new door thinker
|
||||
rtn = 1;
|
||||
ceiling = (ceiling_t*)DoomLib::Z_Malloc(sizeof(*ceiling), PU_LEVEL, 0);
|
||||
P_AddThinker (&ceiling->thinker);
|
||||
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->thinker.function.acp1 = ( actionf_p1 )T_MoveCeiling;
|
||||
ceiling->sector = sec;
|
||||
ceiling->crush = false;
|
||||
|
||||
switch(type)
|
||||
switch( type )
|
||||
{
|
||||
case fastCrushAndRaise:
|
||||
ceiling->crush = true;
|
||||
ceiling->topheight = sec->ceilingheight;
|
||||
ceiling->bottomheight = sec->floorheight + (8*FRACUNIT);
|
||||
ceiling->bottomheight = sec->floorheight + ( 8 * FRACUNIT );
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED * 2;
|
||||
break;
|
||||
|
@ -229,14 +232,16 @@ EV_DoCeiling
|
|||
case lowerAndCrush:
|
||||
case lowerToFloor:
|
||||
ceiling->bottomheight = sec->floorheight;
|
||||
if (type != lowerToFloor)
|
||||
ceiling->bottomheight += 8*FRACUNIT;
|
||||
if( type != lowerToFloor )
|
||||
{
|
||||
ceiling->bottomheight += 8 * FRACUNIT;
|
||||
}
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
|
||||
case raiseToHighest:
|
||||
ceiling->topheight = P_FindHighestCeilingSurrounding(sec);
|
||||
ceiling->topheight = P_FindHighestCeilingSurrounding( sec );
|
||||
ceiling->direction = 1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
|
@ -244,7 +249,7 @@ EV_DoCeiling
|
|||
|
||||
ceiling->tag = sec->tag;
|
||||
ceiling->type = type;
|
||||
P_AddActiveCeiling(ceiling);
|
||||
P_AddActiveCeiling( ceiling );
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
@ -253,13 +258,13 @@ EV_DoCeiling
|
|||
//
|
||||
// Add an active ceiling
|
||||
//
|
||||
void P_AddActiveCeiling(ceiling_t* c)
|
||||
void P_AddActiveCeiling( ceiling_t* c )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAXCEILINGS;i++)
|
||||
for( i = 0; i < MAXCEILINGS; i++ )
|
||||
{
|
||||
if (::g->activeceilings[i] == NULL)
|
||||
if( ::g->activeceilings[i] == NULL )
|
||||
{
|
||||
::g->activeceilings[i] = c;
|
||||
return;
|
||||
|
@ -272,16 +277,16 @@ void P_AddActiveCeiling(ceiling_t* c)
|
|||
//
|
||||
// Remove a ceiling's thinker
|
||||
//
|
||||
void P_RemoveActiveCeiling(ceiling_t* c)
|
||||
void P_RemoveActiveCeiling( ceiling_t* c )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0;i < MAXCEILINGS;i++)
|
||||
for( i = 0; i < MAXCEILINGS; i++ )
|
||||
{
|
||||
if (::g->activeceilings[i] == c)
|
||||
if( ::g->activeceilings[i] == c )
|
||||
{
|
||||
::g->activeceilings[i]->sector->specialdata = NULL;
|
||||
P_RemoveThinker (&::g->activeceilings[i]->thinker);
|
||||
P_RemoveThinker( &::g->activeceilings[i]->thinker );
|
||||
::g->activeceilings[i] = NULL;
|
||||
break;
|
||||
}
|
||||
|
@ -293,19 +298,19 @@ void P_RemoveActiveCeiling(ceiling_t* c)
|
|||
//
|
||||
// Restart a ceiling that's in-stasis
|
||||
//
|
||||
void P_ActivateInStasisCeiling(line_t* line)
|
||||
void P_ActivateInStasisCeiling( line_t* line )
|
||||
{
|
||||
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))
|
||||
if( ::g->activeceilings[i]
|
||||
&& ( ::g->activeceilings[i]->tag == line->tag )
|
||||
&& ( ::g->activeceilings[i]->direction == 0 ) )
|
||||
{
|
||||
::g->activeceilings[i]->direction = ::g->activeceilings[i]->olddirection;
|
||||
::g->activeceilings[i]->thinker.function.acp1
|
||||
= (actionf_p1)T_MoveCeiling;
|
||||
= ( actionf_p1 )T_MoveCeiling;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -316,20 +321,20 @@ void P_ActivateInStasisCeiling(line_t* line)
|
|||
// EV_CeilingCrushStop
|
||||
// Stop a ceiling from crushing!
|
||||
//
|
||||
int EV_CeilingCrushStop(line_t *line)
|
||||
int EV_CeilingCrushStop( line_t* line )
|
||||
{
|
||||
int i;
|
||||
int rtn;
|
||||
|
||||
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))
|
||||
if( ::g->activeceilings[i]
|
||||
&& ( ::g->activeceilings[i]->tag == line->tag )
|
||||
&& ( ::g->activeceilings[i]->direction != 0 ) )
|
||||
{
|
||||
::g->activeceilings[i]->olddirection = ::g->activeceilings[i]->direction;
|
||||
::g->activeceilings[i]->thinker.function.acv = (actionf_v)NULL;
|
||||
::g->activeceilings[i]->thinker.function.acv = ( actionf_v )NULL;
|
||||
::g->activeceilings[i]->direction = 0; // in-stasis
|
||||
rtn = 1;
|
||||
}
|
||||
|
|
|
@ -55,34 +55,34 @@ extern bool globalNetworking;
|
|||
//
|
||||
// T_VerticalDoor
|
||||
//
|
||||
void T_VerticalDoor (vldoor_t* door)
|
||||
void T_VerticalDoor( vldoor_t* door )
|
||||
{
|
||||
result_e res;
|
||||
|
||||
switch(door->direction)
|
||||
switch( door->direction )
|
||||
{
|
||||
case 0:
|
||||
// WAITING
|
||||
if (!--door->topcountdown)
|
||||
if( !--door->topcountdown )
|
||||
{
|
||||
switch(door->type)
|
||||
switch( door->type )
|
||||
{
|
||||
case blazeRaise:
|
||||
door->direction = -1; // time to go back down
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_bdcls);
|
||||
sfx_bdcls );
|
||||
break;
|
||||
|
||||
case normal:
|
||||
door->direction = -1; // time to go back down
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_dorcls);
|
||||
sfx_dorcls );
|
||||
break;
|
||||
|
||||
case close30ThenOpen:
|
||||
door->direction = 1;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_doropn);
|
||||
sfx_doropn );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -93,15 +93,15 @@ void T_VerticalDoor (vldoor_t* door)
|
|||
|
||||
case 2:
|
||||
// INITIAL WAIT
|
||||
if (!--door->topcountdown)
|
||||
if( !--door->topcountdown )
|
||||
{
|
||||
switch(door->type)
|
||||
switch( door->type )
|
||||
{
|
||||
case raiseIn5Mins:
|
||||
door->direction = 1;
|
||||
door->type = normal;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_doropn);
|
||||
sfx_doropn );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -112,40 +112,40 @@ void T_VerticalDoor (vldoor_t* door)
|
|||
|
||||
case -1:
|
||||
// DOWN
|
||||
res = T_MovePlane(door->sector,
|
||||
res = T_MovePlane( door->sector,
|
||||
door->speed,
|
||||
door->sector->floorheight,
|
||||
false,1,door->direction);
|
||||
if (res == pastdest)
|
||||
false, 1, door->direction );
|
||||
if( res == pastdest )
|
||||
{
|
||||
switch(door->type)
|
||||
switch( door->type )
|
||||
{
|
||||
case blazeRaise:
|
||||
case blazeClose:
|
||||
door->sector->specialdata = NULL;
|
||||
P_RemoveThinker (&door->thinker); // unlink and free
|
||||
P_RemoveThinker( &door->thinker ); // unlink and free
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_bdcls);
|
||||
sfx_bdcls );
|
||||
break;
|
||||
|
||||
case normal:
|
||||
case closed:
|
||||
door->sector->specialdata = NULL;
|
||||
P_RemoveThinker (&door->thinker); // unlink and free
|
||||
P_RemoveThinker( &door->thinker ); // unlink and free
|
||||
break;
|
||||
|
||||
case close30ThenOpen:
|
||||
door->direction = 0;
|
||||
door->topcountdown = TICRATE*30;
|
||||
door->topcountdown = TICRATE * 30;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (res == crushed)
|
||||
else if( res == crushed )
|
||||
{
|
||||
switch(door->type)
|
||||
switch( door->type )
|
||||
{
|
||||
case blazeClose:
|
||||
case closed: // DO NOT GO BACK UP!
|
||||
|
@ -154,7 +154,7 @@ void T_VerticalDoor (vldoor_t* door)
|
|||
default:
|
||||
door->direction = 1;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_doropn);
|
||||
sfx_doropn );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -162,14 +162,14 @@ void T_VerticalDoor (vldoor_t* door)
|
|||
|
||||
case 1:
|
||||
// UP
|
||||
res = T_MovePlane(door->sector,
|
||||
res = T_MovePlane( door->sector,
|
||||
door->speed,
|
||||
door->topheight,
|
||||
false,1,door->direction);
|
||||
false, 1, door->direction );
|
||||
|
||||
if (res == pastdest)
|
||||
if( res == pastdest )
|
||||
{
|
||||
switch(door->type)
|
||||
switch( door->type )
|
||||
{
|
||||
case blazeRaise:
|
||||
case normal:
|
||||
|
@ -181,7 +181,7 @@ void T_VerticalDoor (vldoor_t* door)
|
|||
case blazeOpen:
|
||||
case opened:
|
||||
door->sector->specialdata = NULL;
|
||||
P_RemoveThinker (&door->thinker); // unlink and free
|
||||
P_RemoveThinker( &door->thinker ); // unlink and free
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -208,53 +208,67 @@ EV_DoLockedDoor
|
|||
|
||||
p = thing->player;
|
||||
|
||||
if (!p)
|
||||
if( !p )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(line->special)
|
||||
switch( line->special )
|
||||
{
|
||||
case 99: // Blue Lock
|
||||
case 133:
|
||||
if ( !p )
|
||||
if( !p )
|
||||
{
|
||||
return 0;
|
||||
if (!p->cards[it_bluecard] && !p->cards[it_blueskull])
|
||||
}
|
||||
if( !p->cards[it_bluecard] && !p->cards[it_blueskull] )
|
||||
{
|
||||
p->message = PD_BLUEO;
|
||||
if (p == &::g->players[::g->consoleplayer])
|
||||
S_StartSound(NULL,sfx_oof);
|
||||
if( p == &::g->players[::g->consoleplayer] )
|
||||
{
|
||||
S_StartSound( NULL, sfx_oof );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 134: // Red Lock
|
||||
case 135:
|
||||
if ( !p )
|
||||
if( !p )
|
||||
{
|
||||
return 0;
|
||||
if (!p->cards[it_redcard] && !p->cards[it_redskull])
|
||||
}
|
||||
if( !p->cards[it_redcard] && !p->cards[it_redskull] )
|
||||
{
|
||||
p->message = PD_REDO;
|
||||
if (p == &::g->players[::g->consoleplayer])
|
||||
S_StartSound(NULL,sfx_oof);
|
||||
if( p == &::g->players[::g->consoleplayer] )
|
||||
{
|
||||
S_StartSound( NULL, sfx_oof );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 136: // Yellow Lock
|
||||
case 137:
|
||||
if ( !p )
|
||||
if( !p )
|
||||
{
|
||||
return 0;
|
||||
if (!p->cards[it_yellowcard] &&
|
||||
!p->cards[it_yellowskull])
|
||||
}
|
||||
if( !p->cards[it_yellowcard] &&
|
||||
!p->cards[it_yellowskull] )
|
||||
{
|
||||
p->message = PD_YELLOWO;
|
||||
if (p == &::g->players[::g->consoleplayer])
|
||||
S_StartSound(NULL,sfx_oof);
|
||||
if( p == &::g->players[::g->consoleplayer] )
|
||||
{
|
||||
S_StartSound( NULL, sfx_oof );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return EV_DoDoor(line,type);
|
||||
return EV_DoDoor( line, type );
|
||||
}
|
||||
|
||||
|
||||
|
@ -263,77 +277,79 @@ EV_DoDoor
|
|||
( line_t* line,
|
||||
vldoor_e type )
|
||||
{
|
||||
int secnum,rtn;
|
||||
int secnum, rtn;
|
||||
sector_t* sec;
|
||||
vldoor_t* door;
|
||||
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
|
||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
||||
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||
{
|
||||
sec = &::g->sectors[secnum];
|
||||
if (sec->specialdata)
|
||||
if( sec->specialdata )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// new door thinker
|
||||
rtn = 1;
|
||||
door = (vldoor_t*)DoomLib::Z_Malloc(sizeof(*door), PU_LEVEL, 0);
|
||||
P_AddThinker (&door->thinker);
|
||||
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->thinker.function.acp1 = ( actionf_p1 ) T_VerticalDoor;
|
||||
door->sector = sec;
|
||||
door->type = type;
|
||||
door->topwait = VDOORWAIT;
|
||||
door->speed = VDOORSPEED;
|
||||
|
||||
switch(type)
|
||||
switch( type )
|
||||
{
|
||||
case blazeClose:
|
||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
||||
door->topheight -= 4*FRACUNIT;
|
||||
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||
door->topheight -= 4 * FRACUNIT;
|
||||
door->direction = -1;
|
||||
door->speed = VDOORSPEED * 4;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_bdcls);
|
||||
sfx_bdcls );
|
||||
break;
|
||||
|
||||
case closed:
|
||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
||||
door->topheight -= 4*FRACUNIT;
|
||||
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||
door->topheight -= 4 * FRACUNIT;
|
||||
door->direction = -1;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_dorcls);
|
||||
sfx_dorcls );
|
||||
break;
|
||||
|
||||
case close30ThenOpen:
|
||||
door->topheight = sec->ceilingheight;
|
||||
door->direction = -1;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_dorcls);
|
||||
sfx_dorcls );
|
||||
break;
|
||||
|
||||
case blazeRaise:
|
||||
case blazeOpen:
|
||||
door->direction = 1;
|
||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
||||
door->topheight -= 4*FRACUNIT;
|
||||
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||
door->topheight -= 4 * FRACUNIT;
|
||||
door->speed = VDOORSPEED * 4;
|
||||
if (door->topheight != sec->ceilingheight)
|
||||
if( door->topheight != sec->ceilingheight )
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_bdopn);
|
||||
sfx_bdopn );
|
||||
break;
|
||||
|
||||
case normal:
|
||||
case opened:
|
||||
door->direction = 1;
|
||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
||||
door->topheight -= 4*FRACUNIT;
|
||||
if (door->topheight != sec->ceilingheight)
|
||||
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||
door->topheight -= 4 * FRACUNIT;
|
||||
if( door->topheight != sec->ceilingheight )
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_doropn);
|
||||
sfx_doropn );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -364,72 +380,88 @@ EV_VerticalDoor
|
|||
// Check for locks
|
||||
player = thing->player;
|
||||
|
||||
switch(line->special)
|
||||
switch( line->special )
|
||||
{
|
||||
case 26: // Blue Lock
|
||||
case 32:
|
||||
if ( !player )
|
||||
if( !player )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player->cards[it_bluecard] && !player->cards[it_blueskull])
|
||||
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);
|
||||
if( globalNetworking || ( player == &::g->players[::g->consoleplayer] ) )
|
||||
{
|
||||
S_StartSound( player->mo, sfx_oof );
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 27: // Yellow Lock
|
||||
case 34:
|
||||
if ( !player )
|
||||
if( !player )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player->cards[it_yellowcard] &&
|
||||
!player->cards[it_yellowskull])
|
||||
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);
|
||||
if( globalNetworking || ( player == &::g->players[::g->consoleplayer] ) )
|
||||
{
|
||||
S_StartSound( player->mo, sfx_oof );
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 28: // Red Lock
|
||||
case 33:
|
||||
if ( !player )
|
||||
if( !player )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player->cards[it_redcard] && !player->cards[it_redskull])
|
||||
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);
|
||||
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;
|
||||
sec = ::g->sides[ line->sidenum[side ^ 1]] .sector;
|
||||
secnum = sec -::g->sectors;
|
||||
|
||||
if (sec->specialdata)
|
||||
if( sec->specialdata )
|
||||
{
|
||||
door = (vldoor_t*)sec->specialdata;
|
||||
switch(line->special)
|
||||
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)
|
||||
if( door->direction == -1 )
|
||||
{
|
||||
door->direction = 1; // go back up
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!thing->player)
|
||||
if( !thing->player )
|
||||
{
|
||||
return; // JDC: bad guys never close doors
|
||||
}
|
||||
|
||||
door->direction = -1; // start going down immediately
|
||||
}
|
||||
|
@ -438,37 +470,38 @@ EV_VerticalDoor
|
|||
}
|
||||
|
||||
// for proper sound
|
||||
if (globalNetworking || (player == &::g->players[::g->consoleplayer])) {
|
||||
switch(line->special)
|
||||
if( globalNetworking || ( player == &::g->players[::g->consoleplayer] ) )
|
||||
{
|
||||
switch( line->special )
|
||||
{
|
||||
case 117: // BLAZING DOOR RAISE
|
||||
case 118: // BLAZING DOOR OPEN
|
||||
S_StartSound( &sec->soundorg,sfx_bdopn);
|
||||
S_StartSound( &sec->soundorg, sfx_bdopn );
|
||||
break;
|
||||
|
||||
case 1: // NORMAL DOOR SOUND
|
||||
case 31:
|
||||
S_StartSound( &sec->soundorg,sfx_doropn);
|
||||
S_StartSound( &sec->soundorg, sfx_doropn );
|
||||
break;
|
||||
|
||||
default: // LOCKED DOOR SOUND
|
||||
S_StartSound( &sec->soundorg,sfx_doropn);
|
||||
S_StartSound( &sec->soundorg, sfx_doropn );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// new door thinker
|
||||
door = (vldoor_t*)DoomLib::Z_Malloc(sizeof(*door), PU_LEVEL, 0);
|
||||
P_AddThinker (&door->thinker);
|
||||
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->thinker.function.acp1 = ( actionf_p1 ) T_VerticalDoor;
|
||||
door->sector = sec;
|
||||
door->direction = 1;
|
||||
door->speed = VDOORSPEED;
|
||||
door->topwait = VDOORWAIT;
|
||||
|
||||
switch(line->special)
|
||||
switch( line->special )
|
||||
{
|
||||
case 1:
|
||||
case 26:
|
||||
|
@ -487,36 +520,36 @@ EV_VerticalDoor
|
|||
|
||||
case 117: // blazing door raise
|
||||
door->type = blazeRaise;
|
||||
door->speed = VDOORSPEED*4;
|
||||
door->speed = VDOORSPEED * 4;
|
||||
break;
|
||||
case 118: // blazing door open
|
||||
door->type = blazeOpen;
|
||||
line->special = 0;
|
||||
door->speed = VDOORSPEED*4;
|
||||
door->speed = VDOORSPEED * 4;
|
||||
break;
|
||||
}
|
||||
|
||||
// find the top and bottom of the movement range
|
||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
||||
door->topheight -= 4*FRACUNIT;
|
||||
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||
door->topheight -= 4 * FRACUNIT;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Spawn a door that closes after 30 seconds
|
||||
//
|
||||
void P_SpawnDoorCloseIn30 (sector_t* sec)
|
||||
void P_SpawnDoorCloseIn30( sector_t* sec )
|
||||
{
|
||||
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->special = 0;
|
||||
|
||||
door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor;
|
||||
door->thinker.function.acp1 = ( actionf_p1 )T_VerticalDoor;
|
||||
door->sector = sec;
|
||||
door->direction = 0;
|
||||
door->type = normal;
|
||||
|
@ -534,20 +567,20 @@ P_SpawnDoorRaiseIn5Mins
|
|||
{
|
||||
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->special = 0;
|
||||
|
||||
door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor;
|
||||
door->thinker.function.acp1 = ( actionf_p1 )T_VerticalDoor;
|
||||
door->sector = sec;
|
||||
door->direction = 2;
|
||||
door->type = raiseIn5Mins;
|
||||
door->speed = VDOORSPEED;
|
||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
||||
door->topheight -= 4*FRACUNIT;
|
||||
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||
door->topheight -= 4 * FRACUNIT;
|
||||
door->topwait = VDOORWAIT;
|
||||
door->topcountdown = 5 * 60 * TICRATE;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -62,23 +62,23 @@ T_MovePlane
|
|||
qboolean flag;
|
||||
fixed_t lastpos;
|
||||
|
||||
switch(floorOrCeiling)
|
||||
switch( floorOrCeiling )
|
||||
{
|
||||
case 0:
|
||||
// FLOOR
|
||||
switch(direction)
|
||||
switch( direction )
|
||||
{
|
||||
case -1:
|
||||
// DOWN
|
||||
if (sector->floorheight - speed < dest)
|
||||
if( sector->floorheight - speed < dest )
|
||||
{
|
||||
lastpos = sector->floorheight;
|
||||
sector->floorheight = dest;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
if (flag == true)
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
if( flag == true )
|
||||
{
|
||||
sector->floorheight =lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
sector->floorheight = lastpos;
|
||||
P_ChangeSector( sector, crush );
|
||||
//return crushed;
|
||||
}
|
||||
return pastdest;
|
||||
|
@ -87,11 +87,11 @@ T_MovePlane
|
|||
{
|
||||
lastpos = sector->floorheight;
|
||||
sector->floorheight -= speed;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
if (flag == true)
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
if( flag == true )
|
||||
{
|
||||
sector->floorheight = lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
P_ChangeSector( sector, crush );
|
||||
return crushed;
|
||||
}
|
||||
}
|
||||
|
@ -99,15 +99,15 @@ T_MovePlane
|
|||
|
||||
case 1:
|
||||
// UP
|
||||
if (sector->floorheight + speed > dest)
|
||||
if( sector->floorheight + speed > dest )
|
||||
{
|
||||
lastpos = sector->floorheight;
|
||||
sector->floorheight = dest;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
if (flag == true)
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
if( flag == true )
|
||||
{
|
||||
sector->floorheight = lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
P_ChangeSector( sector, crush );
|
||||
//return crushed;
|
||||
}
|
||||
return pastdest;
|
||||
|
@ -117,13 +117,15 @@ T_MovePlane
|
|||
// COULD GET CRUSHED
|
||||
lastpos = sector->floorheight;
|
||||
sector->floorheight += speed;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
if (flag == true)
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
if( flag == true )
|
||||
{
|
||||
if( crush == true )
|
||||
{
|
||||
if (crush == true)
|
||||
return crushed;
|
||||
}
|
||||
sector->floorheight = lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
P_ChangeSector( sector, crush );
|
||||
return crushed;
|
||||
}
|
||||
}
|
||||
|
@ -133,20 +135,20 @@ T_MovePlane
|
|||
|
||||
case 1:
|
||||
// CEILING
|
||||
switch(direction)
|
||||
switch( direction )
|
||||
{
|
||||
case -1:
|
||||
// DOWN
|
||||
if (sector->ceilingheight - speed < dest)
|
||||
if( sector->ceilingheight - speed < dest )
|
||||
{
|
||||
lastpos = sector->ceilingheight;
|
||||
sector->ceilingheight = dest;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
|
||||
if (flag == true)
|
||||
if( flag == true )
|
||||
{
|
||||
sector->ceilingheight = lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
P_ChangeSector( sector, crush );
|
||||
//return crushed;
|
||||
}
|
||||
return pastdest;
|
||||
|
@ -156,14 +158,16 @@ T_MovePlane
|
|||
// COULD GET CRUSHED
|
||||
lastpos = sector->ceilingheight;
|
||||
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;
|
||||
P_ChangeSector(sector,crush);
|
||||
P_ChangeSector( sector, crush );
|
||||
return crushed;
|
||||
}
|
||||
}
|
||||
|
@ -171,15 +175,15 @@ T_MovePlane
|
|||
|
||||
case 1:
|
||||
// UP
|
||||
if (sector->ceilingheight + speed > dest)
|
||||
if( sector->ceilingheight + speed > dest )
|
||||
{
|
||||
lastpos = sector->ceilingheight;
|
||||
sector->ceilingheight = dest;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
if (flag == true)
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
if( flag == true )
|
||||
{
|
||||
sector->ceilingheight = lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
P_ChangeSector( sector, crush );
|
||||
//return crushed;
|
||||
}
|
||||
return pastdest;
|
||||
|
@ -188,13 +192,13 @@ T_MovePlane
|
|||
{
|
||||
lastpos = sector->ceilingheight;
|
||||
sector->ceilingheight += speed;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
// UNUSED
|
||||
#if 0
|
||||
if (flag == true)
|
||||
if( flag == true )
|
||||
{
|
||||
sector->ceilingheight = lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
P_ChangeSector( sector, crush );
|
||||
return crushed;
|
||||
}
|
||||
#endif
|
||||
|
@ -211,26 +215,26 @@ T_MovePlane
|
|||
//
|
||||
// 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;
|
||||
|
||||
res = T_MovePlane(floor->sector,
|
||||
res = T_MovePlane( floor->sector,
|
||||
floor->speed,
|
||||
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,
|
||||
sfx_stnmov);
|
||||
sfx_stnmov );
|
||||
|
||||
if (res == pastdest)
|
||||
if( res == pastdest )
|
||||
{
|
||||
floor->sector->specialdata = NULL;
|
||||
|
||||
if (floor->direction == 1)
|
||||
if( floor->direction == 1 )
|
||||
{
|
||||
switch(floor->type)
|
||||
switch( floor->type )
|
||||
{
|
||||
case donutRaise:
|
||||
floor->sector->special = floor->newspecial;
|
||||
|
@ -239,9 +243,9 @@ void T_MoveFloor(floormove_t* floor)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (floor->direction == -1)
|
||||
else if( floor->direction == -1 )
|
||||
{
|
||||
switch(floor->type)
|
||||
switch( floor->type )
|
||||
{
|
||||
case lowerAndChange:
|
||||
floor->sector->special = floor->newspecial;
|
||||
|
@ -250,10 +254,10 @@ void T_MoveFloor(floormove_t* floor)
|
|||
break;
|
||||
}
|
||||
}
|
||||
P_RemoveThinker(&floor->thinker);
|
||||
P_RemoveThinker( &floor->thinker );
|
||||
|
||||
S_StartSound( &floor->sector->soundorg,
|
||||
sfx_pstop);
|
||||
sfx_pstop );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -274,31 +278,33 @@ EV_DoFloor
|
|||
|
||||
secnum = -1;
|
||||
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)
|
||||
if( sec->specialdata )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// new floor thinker
|
||||
rtn = 1;
|
||||
floor = (floormove_t*)DoomLib::Z_Malloc(sizeof(*floor), PU_LEVEL, 0);
|
||||
P_AddThinker (&floor->thinker);
|
||||
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->thinker.function.acp1 = ( actionf_p1 ) T_MoveFloor;
|
||||
floor->type = floortype;
|
||||
floor->crush = false;
|
||||
|
||||
switch(floortype)
|
||||
switch( floortype )
|
||||
{
|
||||
case lowerFloor:
|
||||
floor->direction = -1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindHighestFloorSurrounding(sec);
|
||||
P_FindHighestFloorSurrounding( sec );
|
||||
break;
|
||||
|
||||
case lowerFloorToLowest:
|
||||
|
@ -306,7 +312,7 @@ EV_DoFloor
|
|||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindLowestFloorSurrounding(sec);
|
||||
P_FindLowestFloorSurrounding( sec );
|
||||
break;
|
||||
|
||||
case turboLower:
|
||||
|
@ -314,9 +320,11 @@ EV_DoFloor
|
|||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED * 4;
|
||||
floor->floordestheight =
|
||||
P_FindHighestFloorSurrounding(sec);
|
||||
if (floor->floordestheight != sec->floorheight)
|
||||
floor->floordestheight += 8*FRACUNIT;
|
||||
P_FindHighestFloorSurrounding( sec );
|
||||
if( floor->floordestheight != sec->floorheight )
|
||||
{
|
||||
floor->floordestheight += 8 * FRACUNIT;
|
||||
}
|
||||
break;
|
||||
|
||||
case raiseFloorCrush:
|
||||
|
@ -326,19 +334,21 @@ EV_DoFloor
|
|||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindLowestCeilingSurrounding(sec);
|
||||
if (floor->floordestheight > sec->ceilingheight)
|
||||
P_FindLowestCeilingSurrounding( sec );
|
||||
if( floor->floordestheight > sec->ceilingheight )
|
||||
{
|
||||
floor->floordestheight = sec->ceilingheight;
|
||||
floor->floordestheight -= (8*FRACUNIT)*
|
||||
(floortype == raiseFloorCrush);
|
||||
}
|
||||
floor->floordestheight -= ( 8 * FRACUNIT ) *
|
||||
( floortype == raiseFloorCrush );
|
||||
break;
|
||||
|
||||
case raiseFloorTurbo:
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED*4;
|
||||
floor->speed = FLOORSPEED * 4;
|
||||
floor->floordestheight =
|
||||
P_FindNextHighestFloor(sec,sec->floorheight);
|
||||
P_FindNextHighestFloor( sec, sec->floorheight );
|
||||
break;
|
||||
|
||||
case raiseFloorToNearest:
|
||||
|
@ -346,7 +356,7 @@ EV_DoFloor
|
|||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindNextHighestFloor(sec,sec->floorheight);
|
||||
P_FindNextHighestFloor( sec, sec->floorheight );
|
||||
break;
|
||||
|
||||
case raiseFloor24:
|
||||
|
@ -382,20 +392,20 @@ EV_DoFloor
|
|||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
for (i = 0; i < sec->linecount; i++)
|
||||
for( i = 0; i < sec->linecount; i++ )
|
||||
{
|
||||
if (twoSided (secnum, i) )
|
||||
if( twoSided( secnum, i ) )
|
||||
{
|
||||
side = getSide(secnum,i,0);
|
||||
if (side->bottomtexture >= 0)
|
||||
if (::g->s_textureheight[side->bottomtexture] <
|
||||
minsize)
|
||||
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)
|
||||
side = getSide( secnum, i, 1 );
|
||||
if( side->bottomtexture >= 0 )
|
||||
if( ::g->s_textureheight[side->bottomtexture] <
|
||||
minsize )
|
||||
minsize =
|
||||
::g->s_textureheight[side->bottomtexture];
|
||||
}
|
||||
|
@ -410,18 +420,18 @@ EV_DoFloor
|
|||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindLowestFloorSurrounding(sec);
|
||||
P_FindLowestFloorSurrounding( sec );
|
||||
floor->texture = sec->floorpic;
|
||||
|
||||
for (i = 0; i < sec->linecount; i++)
|
||||
for( i = 0; i < sec->linecount; i++ )
|
||||
{
|
||||
if ( twoSided(secnum, i) )
|
||||
if( twoSided( secnum, i ) )
|
||||
{
|
||||
if (getSide(secnum,i,0)->sector-::g->sectors == secnum)
|
||||
if( getSide( secnum, i, 0 )->sector -::g->sectors == secnum )
|
||||
{
|
||||
sec = getSector(secnum,i,1);
|
||||
sec = getSector( secnum, i, 1 );
|
||||
|
||||
if (sec->floorheight == floor->floordestheight)
|
||||
if( sec->floorheight == floor->floordestheight )
|
||||
{
|
||||
floor->texture = sec->floorpic;
|
||||
floor->newspecial = sec->special;
|
||||
|
@ -430,9 +440,9 @@ EV_DoFloor
|
|||
}
|
||||
else
|
||||
{
|
||||
sec = getSector(secnum,i,0);
|
||||
sec = getSector( secnum, i, 0 );
|
||||
|
||||
if (sec->floorheight == floor->floordestheight)
|
||||
if( sec->floorheight == floor->floordestheight )
|
||||
{
|
||||
floor->texture = sec->floorpic;
|
||||
floor->newspecial = sec->special;
|
||||
|
@ -477,31 +487,33 @@ EV_BuildStairs
|
|||
|
||||
secnum = -1;
|
||||
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)
|
||||
if( sec->specialdata )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// new floor thinker
|
||||
rtn = 1;
|
||||
floor = (floormove_t*)DoomLib::Z_Malloc(sizeof(*floor), PU_LEVEL, 0);
|
||||
P_AddThinker (&floor->thinker);
|
||||
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->thinker.function.acp1 = ( actionf_p1 ) T_MoveFloor;
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
switch(type)
|
||||
switch( type )
|
||||
{
|
||||
case build8:
|
||||
speed = FLOORSPEED/4;
|
||||
stairsize = 8*FRACUNIT;
|
||||
speed = FLOORSPEED / 4;
|
||||
stairsize = 8 * FRACUNIT;
|
||||
break;
|
||||
case turbo16:
|
||||
speed = FLOORSPEED*4;
|
||||
stairsize = 16*FRACUNIT;
|
||||
speed = FLOORSPEED * 4;
|
||||
stairsize = 16 * FRACUNIT;
|
||||
break;
|
||||
}
|
||||
floor->speed = speed;
|
||||
|
@ -516,36 +528,44 @@ EV_BuildStairs
|
|||
do
|
||||
{
|
||||
ok = 0;
|
||||
for (i = 0;i < sec->linecount;i++)
|
||||
for( i = 0; i < sec->linecount; i++ )
|
||||
{
|
||||
if( !( ( sec->lines[i] )->flags & ML_TWOSIDED ) )
|
||||
{
|
||||
if ( !((sec->lines[i])->flags & ML_TWOSIDED) )
|
||||
continue;
|
||||
}
|
||||
|
||||
tsec = (sec->lines[i])->frontsector;
|
||||
newsecnum = tsec-::g->sectors;
|
||||
tsec = ( sec->lines[i] )->frontsector;
|
||||
newsecnum = tsec -::g->sectors;
|
||||
|
||||
if (secnum != newsecnum)
|
||||
if( secnum != newsecnum )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
tsec = (sec->lines[i])->backsector;
|
||||
tsec = ( sec->lines[i] )->backsector;
|
||||
newsecnum = tsec - ::g->sectors;
|
||||
|
||||
if (tsec->floorpic != texture)
|
||||
if( tsec->floorpic != texture )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
height += stairsize;
|
||||
|
||||
if (tsec->specialdata)
|
||||
if( tsec->specialdata )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sec = tsec;
|
||||
secnum = newsecnum;
|
||||
floor = (floormove_t*)DoomLib::Z_Malloc(sizeof(*floor), PU_LEVEL, 0);
|
||||
floor = ( floormove_t* )DoomLib::Z_Malloc( sizeof( *floor ), PU_LEVEL, 0 );
|
||||
|
||||
P_AddThinker (&floor->thinker);
|
||||
P_AddThinker( &floor->thinker );
|
||||
|
||||
sec->specialdata = floor;
|
||||
floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
|
||||
floor->thinker.function.acp1 = ( actionf_p1 ) T_MoveFloor;
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = speed;
|
||||
|
@ -553,7 +573,8 @@ EV_BuildStairs
|
|||
ok = 1;
|
||||
break;
|
||||
}
|
||||
} while(ok);
|
||||
}
|
||||
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__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
qboolean P_GivePower(player_t*, int);
|
||||
qboolean P_GivePower( player_t*, int );
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -47,19 +47,25 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//
|
||||
// T_FireFlicker
|
||||
//
|
||||
void T_FireFlicker (fireflicker_t* flick)
|
||||
void T_FireFlicker( fireflicker_t* flick )
|
||||
{
|
||||
int amount;
|
||||
|
||||
if (--flick->count)
|
||||
if( --flick->count )
|
||||
{
|
||||
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->maxlight - amount;
|
||||
}
|
||||
|
||||
flick->count = 4;
|
||||
}
|
||||
|
@ -69,7 +75,7 @@ void T_FireFlicker (fireflicker_t* flick)
|
|||
//
|
||||
// P_SpawnFireFlicker
|
||||
//
|
||||
void P_SpawnFireFlicker (sector_t* sector)
|
||||
void P_SpawnFireFlicker( sector_t* sector )
|
||||
{
|
||||
fireflicker_t* flick;
|
||||
|
||||
|
@ -77,14 +83,14 @@ void P_SpawnFireFlicker (sector_t* sector)
|
|||
// Nothing special about it during gameplay.
|
||||
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->maxlight = sector->lightlevel;
|
||||
flick->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel)+16;
|
||||
flick->minlight = P_FindMinSurroundingLight( sector, sector->lightlevel ) + 16;
|
||||
flick->count = 4;
|
||||
}
|
||||
|
||||
|
@ -99,20 +105,22 @@ void P_SpawnFireFlicker (sector_t* sector)
|
|||
// T_LightFlash
|
||||
// Do flashing lights.
|
||||
//
|
||||
void T_LightFlash (lightflash_t* flash)
|
||||
void T_LightFlash( lightflash_t* flash )
|
||||
{
|
||||
if (--flash->count)
|
||||
if( --flash->count )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (flash->sector->lightlevel == flash->maxlight)
|
||||
if( flash->sector->lightlevel == flash->maxlight )
|
||||
{
|
||||
flash-> sector->lightlevel = flash->minlight;
|
||||
flash->count = (P_Random()&flash->mintime)+1;
|
||||
flash->count = ( P_Random()&flash->mintime ) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
// for specials that spawn thinkers
|
||||
//
|
||||
void P_SpawnLightFlash (sector_t* sector)
|
||||
void P_SpawnLightFlash( sector_t* sector )
|
||||
{
|
||||
lightflash_t* flash;
|
||||
|
||||
// nothing special about it during gameplay
|
||||
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->maxlight = sector->lightlevel;
|
||||
|
||||
flash->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel);
|
||||
flash->minlight = P_FindMinSurroundingLight( sector, sector->lightlevel );
|
||||
flash->maxtime = 64;
|
||||
flash->mintime = 7;
|
||||
flash->count = (P_Random()&flash->maxtime)+1;
|
||||
flash->count = ( P_Random()&flash->maxtime ) + 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -156,12 +164,14 @@ void P_SpawnLightFlash (sector_t* sector)
|
|||
//
|
||||
// T_StrobeFlash
|
||||
//
|
||||
void T_StrobeFlash (strobe_t* flash)
|
||||
void T_StrobeFlash( strobe_t* flash )
|
||||
{
|
||||
if (--flash->count)
|
||||
if( --flash->count )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (flash->sector->lightlevel == flash->minlight)
|
||||
if( flash->sector->lightlevel == flash->minlight )
|
||||
{
|
||||
flash-> sector->lightlevel = flash->maxlight;
|
||||
flash->count = flash->brighttime;
|
||||
|
@ -169,7 +179,7 @@ void T_StrobeFlash (strobe_t* flash)
|
|||
else
|
||||
{
|
||||
flash-> sector->lightlevel = flash->minlight;
|
||||
flash->count =flash->darktime;
|
||||
flash->count = flash->darktime;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -189,46 +199,54 @@ P_SpawnStrobeFlash
|
|||
{
|
||||
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->darktime = fastOrSlow;
|
||||
flash->brighttime = STROBEBRIGHT;
|
||||
flash->thinker.function.acp1 = (actionf_p1) T_StrobeFlash;
|
||||
flash->thinker.function.acp1 = ( actionf_p1 ) T_StrobeFlash;
|
||||
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;
|
||||
}
|
||||
|
||||
// nothing special about it during gameplay
|
||||
sector->special = 0;
|
||||
|
||||
if (!inSync)
|
||||
flash->count = (P_Random()&7)+1;
|
||||
if( !inSync )
|
||||
{
|
||||
flash->count = ( P_Random() & 7 ) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
flash->count = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Start strobing lights (usually from a trigger)
|
||||
//
|
||||
void EV_StartLightStrobing(line_t* line)
|
||||
void EV_StartLightStrobing( line_t* line )
|
||||
{
|
||||
int secnum;
|
||||
sector_t* sec;
|
||||
|
||||
secnum = -1;
|
||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
||||
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||
{
|
||||
sec = &::g->sectors[secnum];
|
||||
if (sec->specialdata)
|
||||
if( sec->specialdata )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
P_SpawnStrobeFlash (sec,SLOWDARK, 0);
|
||||
P_SpawnStrobeFlash( sec, SLOWDARK, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,7 +255,7 @@ void EV_StartLightStrobing(line_t* line)
|
|||
//
|
||||
// TURN LINE'S TAG LIGHTS OFF
|
||||
//
|
||||
void EV_TurnTagLightsOff(line_t* line)
|
||||
void EV_TurnTagLightsOff( line_t* line )
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
@ -248,20 +266,24 @@ void EV_TurnTagLightsOff(line_t* line)
|
|||
|
||||
sector = ::g->sectors;
|
||||
|
||||
for (j = 0;j < ::g->numsectors; j++, sector++)
|
||||
for( j = 0; j < ::g->numsectors; j++, sector++ )
|
||||
{
|
||||
if (sector->tag == line->tag)
|
||||
if( sector->tag == line->tag )
|
||||
{
|
||||
min = sector->lightlevel;
|
||||
for (i = 0;i < sector->linecount; i++)
|
||||
for( i = 0; i < sector->linecount; i++ )
|
||||
{
|
||||
templine = sector->lines[i];
|
||||
tsec = getNextSector(templine,sector);
|
||||
if (!tsec)
|
||||
tsec = getNextSector( templine, sector );
|
||||
if( !tsec )
|
||||
{
|
||||
continue;
|
||||
if (tsec->lightlevel < min)
|
||||
}
|
||||
if( tsec->lightlevel < min )
|
||||
{
|
||||
min = tsec->lightlevel;
|
||||
}
|
||||
}
|
||||
sector->lightlevel = min;
|
||||
}
|
||||
}
|
||||
|
@ -284,27 +306,31 @@ EV_LightTurnOn
|
|||
|
||||
sector = ::g->sectors;
|
||||
|
||||
for (i = 0; i < ::g->numsectors; i++, sector++)
|
||||
for( i = 0; i < ::g->numsectors; i++, sector++ )
|
||||
{
|
||||
if (sector->tag == line->tag)
|
||||
if( sector->tag == line->tag )
|
||||
{
|
||||
// bright = 0 means to search
|
||||
// for highest light level
|
||||
// surrounding sector
|
||||
if (!bright)
|
||||
if( !bright )
|
||||
{
|
||||
for (j = 0;j < sector->linecount; j++)
|
||||
for( j = 0; j < sector->linecount; j++ )
|
||||
{
|
||||
templine = sector->lines[j];
|
||||
temp = getNextSector(templine,sector);
|
||||
temp = getNextSector( templine, sector );
|
||||
|
||||
if (!temp)
|
||||
if( !temp )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (temp->lightlevel > bright)
|
||||
if( temp->lightlevel > bright )
|
||||
{
|
||||
bright = temp->lightlevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
sector-> lightlevel = bright;
|
||||
}
|
||||
}
|
||||
|
@ -315,14 +341,14 @@ EV_LightTurnOn
|
|||
// 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)
|
||||
if( g->sector->lightlevel <= g->minlight )
|
||||
{
|
||||
g->sector->lightlevel += GLOWSPEED;
|
||||
g->direction = 1;
|
||||
|
@ -332,7 +358,7 @@ void T_Glow(glow_t* g)
|
|||
case 1:
|
||||
// UP
|
||||
g->sector->lightlevel += GLOWSPEED;
|
||||
if (g->sector->lightlevel >= g->maxlight)
|
||||
if( g->sector->lightlevel >= g->maxlight )
|
||||
{
|
||||
g->sector->lightlevel -= GLOWSPEED;
|
||||
g->direction = -1;
|
||||
|
@ -342,18 +368,18 @@ void T_Glow(glow_t* g)
|
|||
}
|
||||
|
||||
|
||||
void P_SpawnGlowingLight(sector_t* sector)
|
||||
void P_SpawnGlowingLight( sector_t* sector )
|
||||
{
|
||||
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->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel);
|
||||
g->minlight = P_FindMinSurroundingLight( sector, 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;
|
||||
|
||||
sector->special = 0;
|
||||
|
|
|
@ -30,7 +30,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define __P_LOCAL__
|
||||
|
||||
#ifndef __R_LOCAL__
|
||||
#include "r_local.h"
|
||||
#include "r_local.h"
|
||||
#endif
|
||||
|
||||
#define FLOATSPEED (FRACUNIT*4)
|
||||
|
@ -76,23 +76,23 @@ If you have questions concerning this license or the applicable additional terms
|
|||
extern thinker_t thinkercap;
|
||||
|
||||
|
||||
void P_InitThinkers (void);
|
||||
void P_AddThinker (thinker_t* thinker);
|
||||
void P_RemoveThinker (thinker_t* thinker);
|
||||
void P_InitThinkers( void );
|
||||
void P_AddThinker( thinker_t* thinker );
|
||||
void P_RemoveThinker( thinker_t* thinker );
|
||||
|
||||
|
||||
//
|
||||
// P_PSPR
|
||||
//
|
||||
void P_SetupPsprites (player_t* curplayer);
|
||||
void P_MovePsprites (player_t* curplayer);
|
||||
void P_DropWeapon (player_t* player);
|
||||
void P_SetupPsprites( player_t* curplayer );
|
||||
void P_MovePsprites( player_t* curplayer );
|
||||
void P_DropWeapon( player_t* player );
|
||||
|
||||
|
||||
//
|
||||
// P_USER
|
||||
//
|
||||
void P_PlayerThink (player_t* player);
|
||||
void P_PlayerThink( player_t* player );
|
||||
|
||||
|
||||
//
|
||||
|
@ -110,7 +110,7 @@ extern int iquehead;
|
|||
extern int iquetail;
|
||||
|
||||
|
||||
void P_RespawnSpecials (void);
|
||||
void P_RespawnSpecials( void );
|
||||
|
||||
mobj_t*
|
||||
P_SpawnMobj
|
||||
|
@ -119,20 +119,20 @@ P_SpawnMobj
|
|||
fixed_t z,
|
||||
mobjtype_t type );
|
||||
|
||||
void P_RemoveMobj (mobj_t* th);
|
||||
qboolean P_SetMobjState (mobj_t* mobj, statenum_t state);
|
||||
void P_MobjThinker (mobj_t* mobj);
|
||||
void P_RemoveMobj( mobj_t* th );
|
||||
qboolean P_SetMobjState( mobj_t* mobj, statenum_t state );
|
||||
void P_MobjThinker( mobj_t* mobj );
|
||||
|
||||
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);
|
||||
mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type);
|
||||
void P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type);
|
||||
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 );
|
||||
mobj_t* P_SpawnMissile( mobj_t* source, mobj_t* dest, mobjtype_t type );
|
||||
void P_SpawnPlayerMissile( mobj_t* source, mobjtype_t type );
|
||||
|
||||
|
||||
//
|
||||
// P_ENEMY
|
||||
//
|
||||
void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
|
||||
void P_NoiseAlert( mobj_t* target, mobj_t* emmiter );
|
||||
|
||||
|
||||
//
|
||||
|
@ -151,7 +151,8 @@ typedef struct
|
|||
{
|
||||
fixed_t frac; // along trace line
|
||||
qboolean isaline;
|
||||
union {
|
||||
union
|
||||
{
|
||||
mobj_t* thing;
|
||||
line_t* line;
|
||||
} d;
|
||||
|
@ -162,24 +163,24 @@ typedef struct
|
|||
extern intercept_t intercepts[MAXINTERCEPTS];
|
||||
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);
|
||||
int P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
|
||||
int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
|
||||
void P_MakeDivline (line_t* li, divline_t* dl);
|
||||
fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
|
||||
int P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
|
||||
fixed_t P_AproxDistance( fixed_t dx, fixed_t dy );
|
||||
int P_PointOnLineSide( fixed_t x, fixed_t y, line_t* line );
|
||||
int P_PointOnDivlineSide( fixed_t x, fixed_t y, divline_t* line );
|
||||
void P_MakeDivline( line_t* li, divline_t* dl );
|
||||
fixed_t P_InterceptVector( divline_t* v2, divline_t* v1 );
|
||||
int P_BoxOnLineSide( fixed_t* tmbox, line_t* ld );
|
||||
|
||||
extern fixed_t opentop;
|
||||
extern fixed_t openbottom;
|
||||
extern fixed_t openrange;
|
||||
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_BlockThingsIterator (int x, int y, qboolean(*func)(mobj_t*) );
|
||||
qboolean P_BlockLinesIterator( int x, int y, qboolean( *func )( line_t* ) );
|
||||
qboolean P_BlockThingsIterator( int x, int y, qboolean( *func )( mobj_t* ) );
|
||||
|
||||
#define PT_ADDLINES 1
|
||||
#define PT_ADDTHINGS 2
|
||||
|
@ -194,10 +195,10 @@ P_PathTraverse
|
|||
fixed_t x2,
|
||||
fixed_t y2,
|
||||
int flags,
|
||||
qboolean (*trav) (intercept_t *));
|
||||
qboolean( *trav )( intercept_t* ) );
|
||||
|
||||
void P_UnsetThingPosition (mobj_t* thing);
|
||||
void P_SetThingPosition (mobj_t* thing);
|
||||
void P_UnsetThingPosition( mobj_t* thing );
|
||||
void P_SetThingPosition( mobj_t* thing );
|
||||
|
||||
|
||||
//
|
||||
|
@ -213,14 +214,14 @@ extern fixed_t tmceilingz;
|
|||
|
||||
extern line_t* ceilingline;
|
||||
|
||||
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_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
|
||||
void P_SlideMove (mobj_t* mo);
|
||||
qboolean P_CheckSight (mobj_t* t1, mobj_t* t2);
|
||||
void P_UseLines (player_t* player);
|
||||
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_TeleportMove( mobj_t* thing, fixed_t x, fixed_t y );
|
||||
void P_SlideMove( mobj_t* mo );
|
||||
qboolean P_CheckSight( mobj_t* t1, mobj_t* t2 );
|
||||
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)
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -52,11 +52,13 @@ P_AproxDistance
|
|||
( fixed_t dx,
|
||||
fixed_t dy )
|
||||
{
|
||||
dx = abs(dx);
|
||||
dy = abs(dy);
|
||||
if (dx < dy)
|
||||
return dx+dy-(dx>>1);
|
||||
return dx+dy-(dy>>1);
|
||||
dx = abs( dx );
|
||||
dy = abs( dy );
|
||||
if( dx < dy )
|
||||
{
|
||||
return dx + dy - ( dx >> 1 );
|
||||
}
|
||||
return dx + dy - ( dy >> 1 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,29 +77,35 @@ P_PointOnLineSide
|
|||
fixed_t left;
|
||||
fixed_t right;
|
||||
|
||||
if (!line->dx)
|
||||
if( !line->dx )
|
||||
{
|
||||
if( x <= line->v1->x )
|
||||
{
|
||||
if (x <= line->v1->x)
|
||||
return line->dy > 0;
|
||||
}
|
||||
|
||||
return line->dy < 0;
|
||||
}
|
||||
if (!line->dy)
|
||||
if( !line->dy )
|
||||
{
|
||||
if( y <= line->v1->y )
|
||||
{
|
||||
if (y <= line->v1->y)
|
||||
return line->dx < 0;
|
||||
}
|
||||
|
||||
return line->dx > 0;
|
||||
}
|
||||
|
||||
dx = (x - line->v1->x);
|
||||
dy = (y - line->v1->y);
|
||||
dx = ( x - line->v1->x );
|
||||
dy = ( y - line->v1->y );
|
||||
|
||||
left = FixedMul ( line->dy>>FRACBITS , dx );
|
||||
right = FixedMul ( dy , line->dx>>FRACBITS );
|
||||
left = FixedMul( line->dy >> FRACBITS , dx );
|
||||
right = FixedMul( dy , line->dx >> FRACBITS );
|
||||
|
||||
if (right < left)
|
||||
if( right < left )
|
||||
{
|
||||
return 0; // front side
|
||||
}
|
||||
return 1; // back side
|
||||
}
|
||||
|
||||
|
@ -116,12 +124,12 @@ P_BoxOnLineSide
|
|||
int p1 = 0;
|
||||
int p2 = 0;
|
||||
|
||||
switch (ld->slopetype)
|
||||
switch( ld->slopetype )
|
||||
{
|
||||
case ST_HORIZONTAL:
|
||||
p1 = tmbox[BOXTOP] > ld->v1->y;
|
||||
p2 = tmbox[BOXBOTTOM] > ld->v1->y;
|
||||
if (ld->dx < 0)
|
||||
if( ld->dx < 0 )
|
||||
{
|
||||
p1 ^= 1;
|
||||
p2 ^= 1;
|
||||
|
@ -131,7 +139,7 @@ P_BoxOnLineSide
|
|||
case ST_VERTICAL:
|
||||
p1 = tmbox[BOXRIGHT] < ld->v1->x;
|
||||
p2 = tmbox[BOXLEFT] < ld->v1->x;
|
||||
if (ld->dy < 0)
|
||||
if( ld->dy < 0 )
|
||||
{
|
||||
p1 ^= 1;
|
||||
p2 ^= 1;
|
||||
|
@ -139,18 +147,20 @@ P_BoxOnLineSide
|
|||
break;
|
||||
|
||||
case ST_POSITIVE:
|
||||
p1 = P_PointOnLineSide (tmbox[BOXLEFT], tmbox[BOXTOP], ld);
|
||||
p2 = P_PointOnLineSide (tmbox[BOXRIGHT], tmbox[BOXBOTTOM], ld);
|
||||
p1 = P_PointOnLineSide( tmbox[BOXLEFT], tmbox[BOXTOP], ld );
|
||||
p2 = P_PointOnLineSide( tmbox[BOXRIGHT], tmbox[BOXBOTTOM], ld );
|
||||
break;
|
||||
|
||||
case ST_NEGATIVE:
|
||||
p1 = P_PointOnLineSide (tmbox[BOXRIGHT], tmbox[BOXTOP], ld);
|
||||
p2 = P_PointOnLineSide (tmbox[BOXLEFT], tmbox[BOXBOTTOM], ld);
|
||||
p1 = P_PointOnLineSide( tmbox[BOXRIGHT], tmbox[BOXTOP], ld );
|
||||
p2 = P_PointOnLineSide( tmbox[BOXLEFT], tmbox[BOXBOTTOM], ld );
|
||||
break;
|
||||
}
|
||||
|
||||
if (p1 == p2)
|
||||
if( p1 == p2 )
|
||||
{
|
||||
return p1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -170,37 +180,45 @@ P_PointOnDivlineSide
|
|||
fixed_t left;
|
||||
fixed_t right;
|
||||
|
||||
if (!line->dx)
|
||||
if( !line->dx )
|
||||
{
|
||||
if( x <= line->x )
|
||||
{
|
||||
if (x <= line->x)
|
||||
return line->dy > 0;
|
||||
}
|
||||
|
||||
return line->dy < 0;
|
||||
}
|
||||
if (!line->dy)
|
||||
if( !line->dy )
|
||||
{
|
||||
if( y <= line->y )
|
||||
{
|
||||
if (y <= line->y)
|
||||
return line->dx < 0;
|
||||
}
|
||||
|
||||
return line->dx > 0;
|
||||
}
|
||||
|
||||
dx = (x - line->x);
|
||||
dy = (y - line->y);
|
||||
dx = ( x - line->x );
|
||||
dy = ( y - line->y );
|
||||
|
||||
// try to quickly decide by looking at sign bits
|
||||
if ( (line->dy ^ line->dx ^ dx ^ dy)&0x80000000 )
|
||||
if( ( line->dy ^ line->dx ^ dx ^ dy ) & 0x80000000 )
|
||||
{
|
||||
if( ( line->dy ^ dx ) & 0x80000000 )
|
||||
{
|
||||
if ( (line->dy ^ dx) & 0x80000000 )
|
||||
return 1; // (left is negative)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
left = FixedMul ( line->dy>>8, dx>>8 );
|
||||
right = FixedMul ( dy>>8 , line->dx>>8 );
|
||||
left = FixedMul( line->dy >> 8, dx >> 8 );
|
||||
right = FixedMul( dy >> 8 , line->dx >> 8 );
|
||||
|
||||
if (right < left)
|
||||
if( right < left )
|
||||
{
|
||||
return 0; // front side
|
||||
}
|
||||
return 1; // back side
|
||||
}
|
||||
|
||||
|
@ -239,17 +257,19 @@ P_InterceptVector
|
|||
fixed_t num;
|
||||
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");
|
||||
|
||||
num =
|
||||
FixedMul ( (v1->x - v2->x)>>8 ,v1->dy )
|
||||
+FixedMul ( (v2->y - v1->y)>>8, v1->dx );
|
||||
FixedMul( ( v1->x - v2->x ) >> 8 , v1->dy )
|
||||
+ FixedMul( ( v2->y - v1->y ) >> 8, v1->dx );
|
||||
|
||||
frac = FixedDiv (num , den);
|
||||
frac = FixedDiv( num , den );
|
||||
|
||||
return frac;
|
||||
#else // UNUSED, float debug.
|
||||
|
@ -265,24 +285,26 @@ P_InterceptVector
|
|||
float v2dx;
|
||||
float v2dy;
|
||||
|
||||
v1x = (float)v1->x/FRACUNIT;
|
||||
v1y = (float)v1->y/FRACUNIT;
|
||||
v1dx = (float)v1->dx/FRACUNIT;
|
||||
v1dy = (float)v1->dy/FRACUNIT;
|
||||
v2x = (float)v2->x/FRACUNIT;
|
||||
v2y = (float)v2->y/FRACUNIT;
|
||||
v2dx = (float)v2->dx/FRACUNIT;
|
||||
v2dy = (float)v2->dy/FRACUNIT;
|
||||
v1x = ( float )v1->x / FRACUNIT;
|
||||
v1y = ( float )v1->y / FRACUNIT;
|
||||
v1dx = ( float )v1->dx / FRACUNIT;
|
||||
v1dy = ( float )v1->dy / FRACUNIT;
|
||||
v2x = ( float )v2->x / FRACUNIT;
|
||||
v2y = ( float )v2->y / FRACUNIT;
|
||||
v2dx = ( float )v2->dx / FRACUNIT;
|
||||
v2dy = ( float )v2->dy / FRACUNIT;
|
||||
|
||||
den = v1dy*v2dx - v1dx*v2dy;
|
||||
den = v1dy * v2dx - v1dx * v2dy;
|
||||
|
||||
if (den == 0)
|
||||
if( den == 0 )
|
||||
{
|
||||
return 0; // parallel
|
||||
}
|
||||
|
||||
num = (v1x - v2x)*v1dy + (v2y - v1y)*v1dx;
|
||||
num = ( v1x - v2x ) * v1dy + ( v2y - v1y ) * v1dx;
|
||||
frac = num / den;
|
||||
|
||||
return frac*FRACUNIT;
|
||||
return frac * FRACUNIT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -295,12 +317,12 @@ P_InterceptVector
|
|||
//
|
||||
|
||||
|
||||
void P_LineOpening (line_t* maputil_linedef)
|
||||
void P_LineOpening( line_t* maputil_linedef )
|
||||
{
|
||||
sector_t* front;
|
||||
sector_t* back;
|
||||
|
||||
if (maputil_linedef->sidenum[1] == -1)
|
||||
if( maputil_linedef->sidenum[1] == -1 )
|
||||
{
|
||||
// single sided line
|
||||
::g->openrange = 0;
|
||||
|
@ -310,12 +332,16 @@ void P_LineOpening (line_t* maputil_linedef)
|
|||
front = maputil_linedef->frontsector;
|
||||
back = maputil_linedef->backsector;
|
||||
|
||||
if (front->ceilingheight < back->ceilingheight)
|
||||
if( front->ceilingheight < back->ceilingheight )
|
||||
{
|
||||
::g->opentop = front->ceilingheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
::g->opentop = back->ceilingheight;
|
||||
}
|
||||
|
||||
if (front->floorheight > back->floorheight)
|
||||
if( front->floorheight > back->floorheight )
|
||||
{
|
||||
::g->openbottom = front->floorheight;
|
||||
::g->lowfloor = back->floorheight;
|
||||
|
@ -342,42 +368,52 @@ void P_LineOpening (line_t* maputil_linedef)
|
|||
// lookups maintaining lists ot things inside
|
||||
// these structures need to be updated.
|
||||
//
|
||||
void P_UnsetThingPosition (mobj_t* thing)
|
||||
void P_UnsetThingPosition( mobj_t* thing )
|
||||
{
|
||||
int blockx;
|
||||
int blocky;
|
||||
|
||||
if ( ! (thing->flags & MF_NOSECTOR) )
|
||||
if( !( thing->flags & MF_NOSECTOR ) )
|
||||
{
|
||||
// inert things don't need to be in blockmap?
|
||||
// unlink from subsector
|
||||
if (thing->snext)
|
||||
if( thing->snext )
|
||||
{
|
||||
thing->snext->sprev = thing->sprev;
|
||||
|
||||
if (thing->sprev)
|
||||
thing->sprev->snext = thing->snext;
|
||||
else
|
||||
thing->subsector->sector->thinglist = thing->snext;
|
||||
}
|
||||
|
||||
if ( ! (thing->flags & MF_NOBLOCKMAP) )
|
||||
if( thing->sprev )
|
||||
{
|
||||
thing->sprev->snext = thing->snext;
|
||||
}
|
||||
else
|
||||
{
|
||||
thing->subsector->sector->thinglist = thing->snext;
|
||||
}
|
||||
}
|
||||
|
||||
if( !( thing->flags & MF_NOBLOCKMAP ) )
|
||||
{
|
||||
// inert things don't need to be in ::g->blockmap
|
||||
// unlink from block map
|
||||
if (thing->bnext)
|
||||
if( thing->bnext )
|
||||
{
|
||||
thing->bnext->bprev = thing->bprev;
|
||||
}
|
||||
|
||||
if (thing->bprev)
|
||||
if( thing->bprev )
|
||||
{
|
||||
thing->bprev->bnext = thing->bnext;
|
||||
}
|
||||
else
|
||||
{
|
||||
blockx = (thing->x - ::g->bmaporgx)>>MAPBLOCKSHIFT;
|
||||
blocky = (thing->y - ::g->bmaporgy)>>MAPBLOCKSHIFT;
|
||||
blockx = ( thing->x - ::g->bmaporgx ) >> MAPBLOCKSHIFT;
|
||||
blocky = ( thing->y - ::g->bmaporgy ) >> MAPBLOCKSHIFT;
|
||||
|
||||
if (blockx>=0 && blockx < ::g->bmapwidth
|
||||
&& blocky>=0 && blocky < ::g->bmapheight)
|
||||
if( blockx >= 0 && blockx < ::g->bmapwidth
|
||||
&& blocky >= 0 && blocky < ::g->bmapheight )
|
||||
{
|
||||
::g->blocklinks[blocky*::g->bmapwidth+blockx] = thing->bnext;
|
||||
::g->blocklinks[blocky*::g->bmapwidth + blockx] = thing->bnext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -391,7 +427,7 @@ void P_UnsetThingPosition (mobj_t* thing)
|
|||
// Sets thing->subsector properly
|
||||
//
|
||||
void
|
||||
P_SetThingPosition (mobj_t* thing)
|
||||
P_SetThingPosition( mobj_t* thing )
|
||||
{
|
||||
subsector_t* ss;
|
||||
sector_t* sec;
|
||||
|
@ -401,10 +437,10 @@ P_SetThingPosition (mobj_t* thing)
|
|||
|
||||
|
||||
// link into subsector
|
||||
ss = R_PointInSubsector (thing->x,thing->y);
|
||||
ss = R_PointInSubsector( thing->x, thing->y );
|
||||
thing->subsector = ss;
|
||||
|
||||
if ( ! (thing->flags & MF_NOSECTOR) )
|
||||
if( !( thing->flags & MF_NOSECTOR ) )
|
||||
{
|
||||
// invisible things don't go into the sector links
|
||||
sec = ss->sector;
|
||||
|
@ -412,30 +448,34 @@ P_SetThingPosition (mobj_t* thing)
|
|||
thing->sprev = NULL;
|
||||
thing->snext = sec->thinglist;
|
||||
|
||||
if (sec->thinglist)
|
||||
if( sec->thinglist )
|
||||
{
|
||||
sec->thinglist->sprev = thing;
|
||||
}
|
||||
|
||||
sec->thinglist = thing;
|
||||
}
|
||||
|
||||
|
||||
// link into ::g->blockmap
|
||||
if ( ! (thing->flags & MF_NOBLOCKMAP) )
|
||||
if( !( thing->flags & MF_NOBLOCKMAP ) )
|
||||
{
|
||||
// inert things don't need to be in ::g->blockmap
|
||||
blockx = (thing->x - ::g->bmaporgx)>>MAPBLOCKSHIFT;
|
||||
blocky = (thing->y - ::g->bmaporgy)>>MAPBLOCKSHIFT;
|
||||
blockx = ( thing->x - ::g->bmaporgx ) >> MAPBLOCKSHIFT;
|
||||
blocky = ( thing->y - ::g->bmaporgy ) >> MAPBLOCKSHIFT;
|
||||
|
||||
if (blockx>=0
|
||||
if( blockx >= 0
|
||||
&& blockx < ::g->bmapwidth
|
||||
&& blocky>=0
|
||||
&& blocky < ::g->bmapheight)
|
||||
&& blocky >= 0
|
||||
&& blocky < ::g->bmapheight )
|
||||
{
|
||||
link = &::g->blocklinks[blocky*::g->bmapwidth+blockx];
|
||||
link = &::g->blocklinks[blocky*::g->bmapwidth + blockx];
|
||||
thing->bprev = NULL;
|
||||
thing->bnext = *link;
|
||||
if (*link)
|
||||
(*link)->bprev = thing;
|
||||
if( *link )
|
||||
{
|
||||
( *link )->bprev = thing;
|
||||
}
|
||||
|
||||
*link = thing;
|
||||
}
|
||||
|
@ -470,36 +510,40 @@ qboolean
|
|||
P_BlockLinesIterator
|
||||
( int x,
|
||||
int y,
|
||||
qboolean(*func)(line_t*) )
|
||||
qboolean( *func )( line_t* ) )
|
||||
{
|
||||
int offset;
|
||||
short* list;
|
||||
line_t* ld;
|
||||
|
||||
if (x<0
|
||||
|| y<0
|
||||
|| x>=::g->bmapwidth
|
||||
|| y>=::g->bmapheight)
|
||||
if( x < 0
|
||||
|| y < 0
|
||||
|| x >=::g->bmapwidth
|
||||
|| y >=::g->bmapheight )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
offset = y*::g->bmapwidth+x;
|
||||
offset = y*::g->bmapwidth + x;
|
||||
|
||||
offset = *(::g->blockmap+offset);
|
||||
offset = *( ::g->blockmap + offset );
|
||||
|
||||
for ( list = ::g->blockmaplump+offset ; *list != -1 ; list++)
|
||||
for( list = ::g->blockmaplump + offset ; *list != -1 ; list++ )
|
||||
{
|
||||
ld = &::g->lines[*list];
|
||||
|
||||
if (ld->validcount == ::g->validcount)
|
||||
if( ld->validcount == ::g->validcount )
|
||||
{
|
||||
continue; // line has already been checked
|
||||
}
|
||||
|
||||
ld->validcount = ::g->validcount;
|
||||
|
||||
if ( !func(ld) )
|
||||
if( !func( ld ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true; // everything was checked
|
||||
}
|
||||
|
||||
|
@ -511,26 +555,28 @@ qboolean
|
|||
P_BlockThingsIterator
|
||||
( int x,
|
||||
int y,
|
||||
qboolean(*func)(mobj_t*) )
|
||||
qboolean( *func )( mobj_t* ) )
|
||||
{
|
||||
mobj_t* mobj;
|
||||
|
||||
if ( x<0
|
||||
|| y<0
|
||||
|| x>=::g->bmapwidth
|
||||
|| y>=::g->bmapheight)
|
||||
if( x < 0
|
||||
|| y < 0
|
||||
|| x >=::g->bmapwidth
|
||||
|| y >=::g->bmapheight )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
for (mobj = ::g->blocklinks[y*::g->bmapwidth+x] ;
|
||||
for( mobj = ::g->blocklinks[y*::g->bmapwidth + x] ;
|
||||
mobj ;
|
||||
mobj = mobj->bnext)
|
||||
mobj = mobj->bnext )
|
||||
{
|
||||
if( !func( mobj ) )
|
||||
{
|
||||
if (!func( mobj ) )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -552,7 +598,7 @@ P_BlockThingsIterator
|
|||
// Returns true if ::g->earlyout and a solid line hit.
|
||||
//
|
||||
qboolean
|
||||
PIT_AddLineIntercepts (line_t* ld)
|
||||
PIT_AddLineIntercepts( line_t* ld )
|
||||
{
|
||||
int s1;
|
||||
int s2;
|
||||
|
@ -560,34 +606,38 @@ PIT_AddLineIntercepts (line_t* ld)
|
|||
divline_t dl;
|
||||
|
||||
// avoid precision problems with two routines
|
||||
if ( ::g->trace.dx > FRACUNIT*16
|
||||
|| ::g->trace.dy > FRACUNIT*16
|
||||
|| ::g->trace.dx < -FRACUNIT*16
|
||||
|| ::g->trace.dy < -FRACUNIT*16)
|
||||
if( ::g->trace.dx > FRACUNIT * 16
|
||||
|| ::g->trace.dy > FRACUNIT * 16
|
||||
|| ::g->trace.dx < -FRACUNIT * 16
|
||||
|| ::g->trace.dy < -FRACUNIT * 16 )
|
||||
{
|
||||
s1 = P_PointOnDivlineSide (ld->v1->x, ld->v1->y, &::g->trace);
|
||||
s2 = P_PointOnDivlineSide (ld->v2->x, ld->v2->y, &::g->trace);
|
||||
s1 = P_PointOnDivlineSide( ld->v1->x, ld->v1->y, &::g->trace );
|
||||
s2 = P_PointOnDivlineSide( ld->v2->x, ld->v2->y, &::g->trace );
|
||||
}
|
||||
else
|
||||
{
|
||||
s1 = P_PointOnLineSide (::g->trace.x, ::g->trace.y, ld);
|
||||
s2 = P_PointOnLineSide (::g->trace.x+::g->trace.dx, ::g->trace.y+::g->trace.dy, ld);
|
||||
s1 = P_PointOnLineSide( ::g->trace.x, ::g->trace.y, ld );
|
||||
s2 = P_PointOnLineSide( ::g->trace.x +::g->trace.dx, ::g->trace.y +::g->trace.dy, ld );
|
||||
}
|
||||
|
||||
if (s1 == s2)
|
||||
if( s1 == s2 )
|
||||
{
|
||||
return true; // line isn't crossed
|
||||
}
|
||||
|
||||
// hit the line
|
||||
P_MakeDivline (ld, &dl);
|
||||
frac = P_InterceptVector (&::g->trace, &dl);
|
||||
P_MakeDivline( ld, &dl );
|
||||
frac = P_InterceptVector( &::g->trace, &dl );
|
||||
|
||||
if (frac < 0)
|
||||
if( frac < 0 )
|
||||
{
|
||||
return true; // behind source
|
||||
}
|
||||
|
||||
// try to early out the check
|
||||
if (::g->earlyout
|
||||
if( ::g->earlyout
|
||||
&& frac < FRACUNIT
|
||||
&& !ld->backsector)
|
||||
&& !ld->backsector )
|
||||
{
|
||||
return false; // stop checking
|
||||
}
|
||||
|
@ -606,7 +656,7 @@ PIT_AddLineIntercepts (line_t* ld)
|
|||
//
|
||||
// PIT_AddThingIntercepts
|
||||
//
|
||||
qboolean PIT_AddThingIntercepts (mobj_t* thing)
|
||||
qboolean PIT_AddThingIntercepts( mobj_t* thing )
|
||||
{
|
||||
fixed_t x1;
|
||||
fixed_t y1;
|
||||
|
@ -622,10 +672,10 @@ qboolean PIT_AddThingIntercepts (mobj_t* thing)
|
|||
|
||||
fixed_t frac;
|
||||
|
||||
tracepositive = (::g->trace.dx ^ ::g->trace.dy)>0;
|
||||
tracepositive = ( ::g->trace.dx ^ ::g->trace.dy ) > 0;
|
||||
|
||||
// check a corner to corner crossection for hit
|
||||
if (tracepositive)
|
||||
if( tracepositive )
|
||||
{
|
||||
x1 = thing->x - thing->radius;
|
||||
y1 = thing->y + thing->radius;
|
||||
|
@ -642,21 +692,25 @@ qboolean PIT_AddThingIntercepts (mobj_t* thing)
|
|||
y2 = thing->y + thing->radius;
|
||||
}
|
||||
|
||||
s1 = P_PointOnDivlineSide (x1, y1, &::g->trace);
|
||||
s2 = P_PointOnDivlineSide (x2, y2, &::g->trace);
|
||||
s1 = P_PointOnDivlineSide( x1, y1, &::g->trace );
|
||||
s2 = P_PointOnDivlineSide( x2, y2, &::g->trace );
|
||||
|
||||
if (s1 == s2)
|
||||
if( s1 == s2 )
|
||||
{
|
||||
return true; // line isn't crossed
|
||||
}
|
||||
|
||||
dl.x = x1;
|
||||
dl.y = y1;
|
||||
dl.dx = x2-x1;
|
||||
dl.dy = y2-y1;
|
||||
dl.dx = x2 - x1;
|
||||
dl.dy = y2 - y1;
|
||||
|
||||
frac = P_InterceptVector (&::g->trace, &dl);
|
||||
frac = P_InterceptVector( &::g->trace, &dl );
|
||||
|
||||
if (frac < 0)
|
||||
if( frac < 0 )
|
||||
{
|
||||
return true; // behind source
|
||||
}
|
||||
|
||||
::g->intercept_p->frac = frac;
|
||||
::g->intercept_p->isaline = false;
|
||||
|
@ -686,35 +740,41 @@ P_TraverseIntercepts
|
|||
|
||||
in = 0; // shut up compiler warning
|
||||
|
||||
while (count--)
|
||||
while( count-- )
|
||||
{
|
||||
dist = MAXINT;
|
||||
for (scan = ::g->intercepts ; scan < ::g->intercept_p ; scan++)
|
||||
for( scan = ::g->intercepts ; scan < ::g->intercept_p ; scan++ )
|
||||
{
|
||||
if (scan->frac < dist)
|
||||
if( scan->frac < dist )
|
||||
{
|
||||
dist = scan->frac;
|
||||
in = scan;
|
||||
}
|
||||
}
|
||||
|
||||
if (dist > maxfrac)
|
||||
if( dist > maxfrac )
|
||||
{
|
||||
return true; // checked everything in range
|
||||
}
|
||||
|
||||
#if 0 // UNUSED
|
||||
{
|
||||
// don't check these yet, there may be others inserted
|
||||
in = scan = ::g->intercepts;
|
||||
for ( scan = ::g->intercepts ; scan<::g->intercept_p ; scan++)
|
||||
if (scan->frac > maxfrac)
|
||||
for( scan = ::g->intercepts ; scan <::g->intercept_p ; scan++ )
|
||||
if( scan->frac > maxfrac )
|
||||
{
|
||||
*in++ = *scan;
|
||||
}
|
||||
::g->intercept_p = in;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( !func (in) )
|
||||
if( !func( in ) )
|
||||
{
|
||||
return false; // don't bother going farther
|
||||
}
|
||||
|
||||
in->frac = MAXINT;
|
||||
}
|
||||
|
@ -739,7 +799,7 @@ P_PathTraverse
|
|||
fixed_t x2,
|
||||
fixed_t y2,
|
||||
int flags,
|
||||
qboolean (*trav) (intercept_t *))
|
||||
qboolean( *trav )( intercept_t* ) )
|
||||
{
|
||||
fixed_t xt1;
|
||||
fixed_t yt1;
|
||||
|
@ -767,11 +827,15 @@ P_PathTraverse
|
|||
::g->validcount++;
|
||||
::g->intercept_p = ::g->intercepts;
|
||||
|
||||
if ( ((x1-::g->bmaporgx)&(MAPBLOCKSIZE-1)) == 0)
|
||||
if( ( ( x1 -::g->bmaporgx ) & ( MAPBLOCKSIZE - 1 ) ) == 0 )
|
||||
{
|
||||
x1 += FRACUNIT; // don't side exactly on a line
|
||||
}
|
||||
|
||||
if ( ((y1-::g->bmaporgy)&(MAPBLOCKSIZE-1)) == 0)
|
||||
if( ( ( y1 -::g->bmaporgy ) & ( MAPBLOCKSIZE - 1 ) ) == 0 )
|
||||
{
|
||||
y1 += FRACUNIT; // don't side exactly on a line
|
||||
}
|
||||
|
||||
::g->trace.x = x1;
|
||||
::g->trace.y = y1;
|
||||
|
@ -780,55 +844,55 @@ P_PathTraverse
|
|||
|
||||
x1 -= ::g->bmaporgx;
|
||||
y1 -= ::g->bmaporgy;
|
||||
xt1 = x1>>MAPBLOCKSHIFT;
|
||||
yt1 = y1>>MAPBLOCKSHIFT;
|
||||
xt1 = x1 >> MAPBLOCKSHIFT;
|
||||
yt1 = y1 >> MAPBLOCKSHIFT;
|
||||
|
||||
x2 -= ::g->bmaporgx;
|
||||
y2 -= ::g->bmaporgy;
|
||||
xt2 = x2>>MAPBLOCKSHIFT;
|
||||
yt2 = y2>>MAPBLOCKSHIFT;
|
||||
xt2 = x2 >> MAPBLOCKSHIFT;
|
||||
yt2 = y2 >> MAPBLOCKSHIFT;
|
||||
|
||||
if (xt2 > xt1)
|
||||
if( xt2 > xt1 )
|
||||
{
|
||||
mapxstep = 1;
|
||||
partial = FRACUNIT - ((x1>>MAPBTOFRAC)&(FRACUNIT-1));
|
||||
ystep = FixedDiv (y2-y1,abs(x2-x1));
|
||||
partial = FRACUNIT - ( ( x1 >> MAPBTOFRAC ) & ( FRACUNIT - 1 ) );
|
||||
ystep = FixedDiv( y2 - y1, abs( x2 - x1 ) );
|
||||
}
|
||||
else if (xt2 < xt1)
|
||||
else if( xt2 < xt1 )
|
||||
{
|
||||
mapxstep = -1;
|
||||
partial = (x1>>MAPBTOFRAC)&(FRACUNIT-1);
|
||||
ystep = FixedDiv (y2-y1,abs(x2-x1));
|
||||
partial = ( x1 >> MAPBTOFRAC ) & ( FRACUNIT - 1 );
|
||||
ystep = FixedDiv( y2 - y1, abs( x2 - x1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mapxstep = 0;
|
||||
partial = FRACUNIT;
|
||||
ystep = 256*FRACUNIT;
|
||||
ystep = 256 * FRACUNIT;
|
||||
}
|
||||
|
||||
yintercept = (y1>>MAPBTOFRAC) + FixedMul (partial, ystep);
|
||||
yintercept = ( y1 >> MAPBTOFRAC ) + FixedMul( partial, ystep );
|
||||
|
||||
|
||||
if (yt2 > yt1)
|
||||
if( yt2 > yt1 )
|
||||
{
|
||||
mapystep = 1;
|
||||
partial = FRACUNIT - ((y1>>MAPBTOFRAC)&(FRACUNIT-1));
|
||||
xstep = FixedDiv (x2-x1,abs(y2-y1));
|
||||
partial = FRACUNIT - ( ( y1 >> MAPBTOFRAC ) & ( FRACUNIT - 1 ) );
|
||||
xstep = FixedDiv( x2 - x1, abs( y2 - y1 ) );
|
||||
}
|
||||
else if (yt2 < yt1)
|
||||
else if( yt2 < yt1 )
|
||||
{
|
||||
mapystep = -1;
|
||||
partial = (y1>>MAPBTOFRAC)&(FRACUNIT-1);
|
||||
xstep = FixedDiv (x2-x1,abs(y2-y1));
|
||||
partial = ( y1 >> MAPBTOFRAC ) & ( FRACUNIT - 1 );
|
||||
xstep = FixedDiv( x2 - x1, abs( y2 - y1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mapystep = 0;
|
||||
partial = FRACUNIT;
|
||||
xstep = 256*FRACUNIT;
|
||||
xstep = 256 * FRACUNIT;
|
||||
}
|
||||
xintercept = (x1>>MAPBTOFRAC) + FixedMul (partial, xstep);
|
||||
xintercept = ( x1 >> MAPBTOFRAC ) + FixedMul( partial, xstep );
|
||||
|
||||
// Step through map blocks.
|
||||
// Count is present to prevent a round off error
|
||||
|
@ -836,32 +900,36 @@ P_PathTraverse
|
|||
mapx = xt1;
|
||||
mapy = yt1;
|
||||
|
||||
for (count = 0 ; count < 64 ; count++)
|
||||
for( count = 0 ; count < 64 ; count++ )
|
||||
{
|
||||
if (flags & PT_ADDLINES)
|
||||
if( flags & PT_ADDLINES )
|
||||
{
|
||||
if( !P_BlockLinesIterator( mapx, mapy, PIT_AddLineIntercepts ) )
|
||||
{
|
||||
if (!P_BlockLinesIterator (mapx, mapy,PIT_AddLineIntercepts))
|
||||
return false; // early out
|
||||
}
|
||||
|
||||
if (flags & PT_ADDTHINGS)
|
||||
{
|
||||
if (!P_BlockThingsIterator (mapx, mapy,PIT_AddThingIntercepts))
|
||||
return false; // early out
|
||||
}
|
||||
|
||||
if (mapx == xt2
|
||||
&& mapy == yt2)
|
||||
if( flags & PT_ADDTHINGS )
|
||||
{
|
||||
if( !P_BlockThingsIterator( mapx, mapy, PIT_AddThingIntercepts ) )
|
||||
{
|
||||
return false; // early out
|
||||
}
|
||||
}
|
||||
|
||||
if( mapx == xt2
|
||||
&& mapy == yt2 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if ( (yintercept >> FRACBITS) == mapy)
|
||||
if( ( yintercept >> FRACBITS ) == mapy )
|
||||
{
|
||||
yintercept += ystep;
|
||||
mapx += mapxstep;
|
||||
}
|
||||
else if ( (xintercept >> FRACBITS) == mapx)
|
||||
else if( ( xintercept >> FRACBITS ) == mapx )
|
||||
{
|
||||
xintercept += xstep;
|
||||
mapy += mapystep;
|
||||
|
@ -869,7 +937,7 @@ P_PathTraverse
|
|||
|
||||
}
|
||||
// go through the sorted list
|
||||
return P_TraverseIntercepts ( trav, FRACUNIT );
|
||||
return P_TraverseIntercepts( trav, FRACUNIT );
|
||||
}
|
||||
|
||||
|
||||
|
|
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__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -53,53 +53,53 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//
|
||||
// Move a plat up and down
|
||||
//
|
||||
void T_PlatRaise(plat_t* plat)
|
||||
void T_PlatRaise( plat_t* plat )
|
||||
{
|
||||
result_e res;
|
||||
|
||||
switch(plat->status)
|
||||
switch( plat->status )
|
||||
{
|
||||
case up:
|
||||
res = T_MovePlane(plat->sector,
|
||||
res = T_MovePlane( plat->sector,
|
||||
plat->speed,
|
||||
plat->high,
|
||||
plat->crush,0,1);
|
||||
plat->crush, 0, 1 );
|
||||
|
||||
if (plat->type == raiseAndChange
|
||||
|| plat->type == raiseToNearestAndChange)
|
||||
if( plat->type == raiseAndChange
|
||||
|| plat->type == raiseToNearestAndChange )
|
||||
{
|
||||
if (!(::g->leveltime&7))
|
||||
if( !( ::g->leveltime & 7 ) )
|
||||
S_StartSound( &plat->sector->soundorg,
|
||||
sfx_stnmov);
|
||||
sfx_stnmov );
|
||||
}
|
||||
|
||||
|
||||
if (res == crushed && (!plat->crush))
|
||||
if( res == crushed && ( !plat->crush ) )
|
||||
{
|
||||
plat->count = plat->wait;
|
||||
plat->status = down;
|
||||
S_StartSound( &plat->sector->soundorg,
|
||||
sfx_pstart);
|
||||
sfx_pstart );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (res == pastdest)
|
||||
if( res == pastdest )
|
||||
{
|
||||
plat->count = plat->wait;
|
||||
plat->status = waiting;
|
||||
S_StartSound( &plat->sector->soundorg,
|
||||
sfx_pstop);
|
||||
sfx_pstop );
|
||||
|
||||
switch(plat->type)
|
||||
switch( plat->type )
|
||||
{
|
||||
case blazeDWUS:
|
||||
case downWaitUpStay:
|
||||
P_RemoveActivePlat(plat);
|
||||
P_RemoveActivePlat( plat );
|
||||
break;
|
||||
|
||||
case raiseAndChange:
|
||||
case raiseToNearestAndChange:
|
||||
P_RemoveActivePlat(plat);
|
||||
P_RemoveActivePlat( plat );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -110,24 +110,28 @@ void T_PlatRaise(plat_t* plat)
|
|||
break;
|
||||
|
||||
case down:
|
||||
res = T_MovePlane(plat->sector,plat->speed,plat->low,false,0,-1);
|
||||
res = T_MovePlane( plat->sector, plat->speed, plat->low, false, 0, -1 );
|
||||
|
||||
if (res == pastdest)
|
||||
if( res == pastdest )
|
||||
{
|
||||
plat->count = plat->wait;
|
||||
plat->status = waiting;
|
||||
S_StartSound( &plat->sector->soundorg,sfx_pstop);
|
||||
S_StartSound( &plat->sector->soundorg, sfx_pstop );
|
||||
}
|
||||
break;
|
||||
|
||||
case waiting:
|
||||
if (!--plat->count)
|
||||
if( !--plat->count )
|
||||
{
|
||||
if( plat->sector->floorheight == plat->low )
|
||||
{
|
||||
if (plat->sector->floorheight == plat->low)
|
||||
plat->status = up;
|
||||
}
|
||||
else
|
||||
{
|
||||
plat->status = down;
|
||||
S_StartSound( &plat->sector->soundorg,sfx_pstart);
|
||||
}
|
||||
S_StartSound( &plat->sector->soundorg, sfx_pstart );
|
||||
}
|
||||
case in_stasis:
|
||||
break;
|
||||
|
@ -155,165 +159,175 @@ EV_DoPlat
|
|||
|
||||
|
||||
// Activate all <type> plats that are in_stasis
|
||||
switch(type)
|
||||
switch( type )
|
||||
{
|
||||
case perpetualRaise:
|
||||
P_ActivateInStasis(line->tag);
|
||||
P_ActivateInStasis( line->tag );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
||||
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||
{
|
||||
sec = &::g->sectors[secnum];
|
||||
|
||||
if (sec->specialdata)
|
||||
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 = ( 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->thinker.function.acp1 = ( actionf_p1 ) T_PlatRaise;
|
||||
plat->crush = false;
|
||||
plat->tag = line->tag;
|
||||
|
||||
switch(type)
|
||||
switch( type )
|
||||
{
|
||||
case raiseToNearestAndChange:
|
||||
plat->speed = PLATSPEED/2;
|
||||
plat->speed = PLATSPEED / 2;
|
||||
sec->floorpic = ::g->sides[line->sidenum[0]].sector->floorpic;
|
||||
plat->high = P_FindNextHighestFloor(sec,sec->floorheight);
|
||||
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);
|
||||
S_StartSound( &sec->soundorg, sfx_stnmov );
|
||||
break;
|
||||
|
||||
case raiseAndChange:
|
||||
plat->speed = PLATSPEED/2;
|
||||
plat->speed = PLATSPEED / 2;
|
||||
sec->floorpic = ::g->sides[line->sidenum[0]].sector->floorpic;
|
||||
plat->high = sec->floorheight + amount*FRACUNIT;
|
||||
plat->high = sec->floorheight + amount * FRACUNIT;
|
||||
plat->wait = 0;
|
||||
plat->status = up;
|
||||
|
||||
S_StartSound( &sec->soundorg,sfx_stnmov);
|
||||
S_StartSound( &sec->soundorg, sfx_stnmov );
|
||||
break;
|
||||
|
||||
case downWaitUpStay:
|
||||
plat->speed = PLATSPEED * 4;
|
||||
plat->low = P_FindLowestFloorSurrounding(sec);
|
||||
plat->low = P_FindLowestFloorSurrounding( sec );
|
||||
|
||||
if (plat->low > sec->floorheight)
|
||||
if( plat->low > sec->floorheight )
|
||||
{
|
||||
plat->low = sec->floorheight;
|
||||
}
|
||||
|
||||
plat->high = sec->floorheight;
|
||||
plat->wait = TICRATE*PLATWAIT;
|
||||
plat->wait = TICRATE * PLATWAIT;
|
||||
plat->status = down;
|
||||
S_StartSound( &sec->soundorg,sfx_pstart);
|
||||
S_StartSound( &sec->soundorg, sfx_pstart );
|
||||
break;
|
||||
|
||||
case blazeDWUS:
|
||||
plat->speed = PLATSPEED * 8;
|
||||
plat->low = P_FindLowestFloorSurrounding(sec);
|
||||
plat->low = P_FindLowestFloorSurrounding( sec );
|
||||
|
||||
if (plat->low > sec->floorheight)
|
||||
if( plat->low > sec->floorheight )
|
||||
{
|
||||
plat->low = sec->floorheight;
|
||||
}
|
||||
|
||||
plat->high = sec->floorheight;
|
||||
plat->wait = TICRATE*PLATWAIT;
|
||||
plat->wait = TICRATE * PLATWAIT;
|
||||
plat->status = down;
|
||||
S_StartSound( &sec->soundorg,sfx_pstart);
|
||||
S_StartSound( &sec->soundorg, sfx_pstart );
|
||||
break;
|
||||
|
||||
case perpetualRaise:
|
||||
plat->speed = PLATSPEED;
|
||||
plat->low = P_FindLowestFloorSurrounding(sec);
|
||||
plat->low = P_FindLowestFloorSurrounding( sec );
|
||||
|
||||
if (plat->low > sec->floorheight)
|
||||
if( plat->low > sec->floorheight )
|
||||
{
|
||||
plat->low = sec->floorheight;
|
||||
}
|
||||
|
||||
plat->high = P_FindHighestFloorSurrounding(sec);
|
||||
plat->high = P_FindHighestFloorSurrounding( sec );
|
||||
|
||||
if (plat->high < sec->floorheight)
|
||||
if( plat->high < sec->floorheight )
|
||||
{
|
||||
plat->high = sec->floorheight;
|
||||
}
|
||||
|
||||
plat->wait = TICRATE*PLATWAIT;
|
||||
plat->status = (plat_e)(P_Random()&1);
|
||||
plat->wait = TICRATE * PLATWAIT;
|
||||
plat->status = ( plat_e )( P_Random() & 1 );
|
||||
|
||||
S_StartSound( &sec->soundorg,sfx_pstart);
|
||||
S_StartSound( &sec->soundorg, sfx_pstart );
|
||||
break;
|
||||
}
|
||||
P_AddActivePlat(plat);
|
||||
P_AddActivePlat( plat );
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void P_ActivateInStasis(int tag)
|
||||
void P_ActivateInStasis( int tag )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0;i < MAXPLATS;i++)
|
||||
if (::g->activeplats[i]
|
||||
&& (::g->activeplats[i])->tag == tag
|
||||
&& (::g->activeplats[i])->status == in_stasis)
|
||||
for( i = 0; i < MAXPLATS; i++ )
|
||||
if( ::g->activeplats[i]
|
||||
&& ( ::g->activeplats[i] )->tag == tag
|
||||
&& ( ::g->activeplats[i] )->status == in_stasis )
|
||||
{
|
||||
(::g->activeplats[i])->status = (::g->activeplats[i])->oldstatus;
|
||||
(::g->activeplats[i])->thinker.function.acp1
|
||||
= (actionf_p1) T_PlatRaise;
|
||||
( ::g->activeplats[i] )->status = ( ::g->activeplats[i] )->oldstatus;
|
||||
( ::g->activeplats[i] )->thinker.function.acp1
|
||||
= ( actionf_p1 ) T_PlatRaise;
|
||||
}
|
||||
}
|
||||
|
||||
void EV_StopPlat(line_t* line)
|
||||
void EV_StopPlat( line_t* line )
|
||||
{
|
||||
int j;
|
||||
|
||||
for (j = 0;j < MAXPLATS;j++)
|
||||
if (::g->activeplats[j]
|
||||
&& ((::g->activeplats[j])->status != in_stasis)
|
||||
&& ((::g->activeplats[j])->tag == line->tag))
|
||||
for( j = 0; j < MAXPLATS; j++ )
|
||||
if( ::g->activeplats[j]
|
||||
&& ( ( ::g->activeplats[j] )->status != in_stasis )
|
||||
&& ( ( ::g->activeplats[j] )->tag == line->tag ) )
|
||||
{
|
||||
(::g->activeplats[j])->oldstatus = (::g->activeplats[j])->status;
|
||||
(::g->activeplats[j])->status = in_stasis;
|
||||
(::g->activeplats[j])->thinker.function.acv = (actionf_v)NULL;
|
||||
( ::g->activeplats[j] )->oldstatus = ( ::g->activeplats[j] )->status;
|
||||
( ::g->activeplats[j] )->status = in_stasis;
|
||||
( ::g->activeplats[j] )->thinker.function.acv = ( actionf_v )NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void P_AddActivePlat(plat_t* plat)
|
||||
void P_AddActivePlat( plat_t* plat )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0;i < MAXPLATS;i++)
|
||||
if (::g->activeplats[i] == NULL)
|
||||
for( i = 0; i < MAXPLATS; i++ )
|
||||
if( ::g->activeplats[i] == NULL )
|
||||
{
|
||||
::g->activeplats[i] = plat;
|
||||
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;
|
||||
for (i = 0;i < MAXPLATS;i++)
|
||||
if (plat == ::g->activeplats[i])
|
||||
for( i = 0; i < MAXPLATS; i++ )
|
||||
if( plat == ::g->activeplats[i] )
|
||||
{
|
||||
(::g->activeplats[i])->sector->specialdata = NULL;
|
||||
P_RemoveThinker(&(::g->activeplats[i])->thinker);
|
||||
( ::g->activeplats[i] )->sector->specialdata = NULL;
|
||||
P_RemoveThinker( &( ::g->activeplats[i] )->thinker );
|
||||
::g->activeplats[i] = NULL;
|
||||
|
||||
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"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
|
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__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
// Persistent storage/archiving.
|
||||
// These are the load / save game routines.
|
||||
void P_ArchivePlayers (void);
|
||||
void P_UnArchivePlayers (void);
|
||||
void P_ArchiveWorld (void);
|
||||
void P_UnArchiveWorld (void);
|
||||
void P_ArchiveThinkers (void);
|
||||
void P_UnArchiveThinkers (void);
|
||||
void P_ArchiveSpecials (void);
|
||||
void P_UnArchiveSpecials (void);
|
||||
void P_ArchivePlayers( void );
|
||||
void P_UnArchivePlayers( void );
|
||||
void P_ArchiveWorld( void );
|
||||
void P_UnArchiveWorld( void );
|
||||
void P_ArchiveThinkers( void );
|
||||
void P_UnArchiveThinkers( void );
|
||||
void P_ArchiveSpecials( void );
|
||||
void P_UnArchiveSpecials( void );
|
||||
|
||||
extern byte* save_p;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#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
|
||||
//
|
||||
void P_LoadVertexes (int lump)
|
||||
void P_LoadVertexes( int lump )
|
||||
{
|
||||
byte* data;
|
||||
int i;
|
||||
|
@ -106,28 +106,28 @@ void P_LoadVertexes (int lump)
|
|||
|
||||
// Determine number of lumps:
|
||||
// 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.
|
||||
// ::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.
|
||||
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;
|
||||
|
||||
// Copy and convert vertex coordinates,
|
||||
// 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->y = SHORT(ml->y)<<FRACBITS;
|
||||
li->x = SHORT( ml->x ) << FRACBITS;
|
||||
li->y = SHORT( ml->y ) << FRACBITS;
|
||||
}
|
||||
|
||||
// Free buffer memory.
|
||||
Z_Free(data);
|
||||
Z_Free( data );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ void P_LoadVertexes (int lump)
|
|||
//
|
||||
// P_LoadSegs
|
||||
//
|
||||
void P_LoadSegs (int lump)
|
||||
void P_LoadSegs( int lump )
|
||||
{
|
||||
byte* data;
|
||||
int i;
|
||||
|
@ -146,36 +146,40 @@ void P_LoadSegs (int lump)
|
|||
int psetup_linedef;
|
||||
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);
|
||||
|
||||
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));
|
||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
||||
memset( ::g->segs, 0, ::g->numsegs * sizeof( seg_t ) );
|
||||
data = ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||
|
||||
ml = (mapseg_t *)data;
|
||||
ml = ( mapseg_t* )data;
|
||||
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->v2 = &::g->vertexes[SHORT(ml->v2)];
|
||||
li->v1 = &::g->vertexes[SHORT( ml->v1 )];
|
||||
li->v2 = &::g->vertexes[SHORT( ml->v2 )];
|
||||
|
||||
li->angle = (SHORT(ml->angle))<<16;
|
||||
li->offset = (SHORT(ml->offset))<<16;
|
||||
psetup_linedef = SHORT(ml->linedef);
|
||||
li->angle = ( SHORT( ml->angle ) ) << 16;
|
||||
li->offset = ( SHORT( ml->offset ) ) << 16;
|
||||
psetup_linedef = SHORT( ml->linedef );
|
||||
ldef = &::g->lines[psetup_linedef];
|
||||
li->linedef = ldef;
|
||||
side = SHORT(ml->side);
|
||||
side = SHORT( ml->side );
|
||||
li->sidedef = &::g->sides[ldef->sidenum[side]];
|
||||
li->frontsector = ::g->sides[ldef->sidenum[side]].sector;
|
||||
if (ldef-> flags & ML_TWOSIDED)
|
||||
li->backsector = ::g->sides[ldef->sidenum[side^1]].sector;
|
||||
if( ldef-> flags & ML_TWOSIDED )
|
||||
{
|
||||
li->backsector = ::g->sides[ldef->sidenum[side ^ 1]].sector;
|
||||
}
|
||||
else
|
||||
{
|
||||
li->backsector = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Z_Free(data);
|
||||
Z_Free( data );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,30 +187,30 @@ void P_LoadSegs (int lump)
|
|||
//
|
||||
// P_LoadSubsectors
|
||||
//
|
||||
void P_LoadSubsectors (int lump)
|
||||
void P_LoadSubsectors( int lump )
|
||||
{
|
||||
byte* data;
|
||||
int i;
|
||||
mapsubsector_t* ms;
|
||||
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;
|
||||
memset (::g->subsectors,0, ::g->numsubsectors*sizeof(subsector_t));
|
||||
ms = ( mapsubsector_t* )data;
|
||||
memset( ::g->subsectors, 0, ::g->numsubsectors * sizeof( subsector_t ) );
|
||||
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->firstline = SHORT(ms->firstseg);
|
||||
ss->numlines = SHORT( ms->numsegs );
|
||||
ss->firstline = SHORT( ms->firstseg );
|
||||
}
|
||||
|
||||
Z_Free(data);
|
||||
Z_Free( data );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,36 +219,36 @@ void P_LoadSubsectors (int lump)
|
|||
//
|
||||
// P_LoadSectors
|
||||
//
|
||||
void P_LoadSectors (int lump)
|
||||
void P_LoadSectors( int lump )
|
||||
{
|
||||
byte* data;
|
||||
int i;
|
||||
mapsector_t* ms;
|
||||
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 );
|
||||
memset (::g->sectors, 0, ::g->numsectors*sizeof(sector_t));
|
||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
||||
::g->sectors = ( sector_t* )Z_Malloc( ::g->numsectors * sizeof( sector_t ), PU_LEVEL, NULL );
|
||||
memset( ::g->sectors, 0, ::g->numsectors * sizeof( sector_t ) );
|
||||
data = ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||
|
||||
ms = (mapsector_t *)data;
|
||||
ms = ( mapsector_t* )data;
|
||||
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->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->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;
|
||||
}
|
||||
|
||||
Z_Free(data);
|
||||
Z_Free( data );
|
||||
|
||||
/*
|
||||
/*
|
||||
if (MallocForLump( lump, ::g->numsectors*sizeof(sector_t), (void**)&::g->sectors, PU_LEVEL_SHARED ))
|
||||
{
|
||||
memset (::g->sectors, 0, ::g->numsectors*sizeof(sector_t));
|
||||
|
@ -266,14 +270,14 @@ void P_LoadSectors (int lump)
|
|||
|
||||
DoomLib::Z_Free(data);
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// P_LoadNodes
|
||||
//
|
||||
void P_LoadNodes (int lump)
|
||||
void P_LoadNodes( int lump )
|
||||
{
|
||||
byte* data;
|
||||
int i;
|
||||
|
@ -282,29 +286,31 @@ void P_LoadNodes (int lump)
|
|||
mapnode_t* mn;
|
||||
node_t* no;
|
||||
|
||||
::g->numnodes = W_LumpLength (lump) / sizeof(mapnode_t);
|
||||
if (MallocForLump( lump, ::g->numnodes*sizeof(node_t), ::g->nodes, PU_LEVEL_SHARED ))
|
||||
::g->numnodes = W_LumpLength( lump ) / sizeof( mapnode_t );
|
||||
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;
|
||||
|
||||
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->y = SHORT(mn->y)<<FRACBITS;
|
||||
no->dx = SHORT(mn->dx)<<FRACBITS;
|
||||
no->dy = SHORT(mn->dy)<<FRACBITS;
|
||||
for (j=0 ; j<2 ; j++)
|
||||
no->x = SHORT( mn->x ) << FRACBITS;
|
||||
no->y = SHORT( mn->y ) << FRACBITS;
|
||||
no->dx = SHORT( mn->dx ) << FRACBITS;
|
||||
no->dy = SHORT( mn->dy ) << FRACBITS;
|
||||
for( j = 0 ; j < 2 ; j++ )
|
||||
{
|
||||
no->children[j] = SHORT(mn->children[j]);
|
||||
for (k=0 ; k<4 ; k++)
|
||||
no->bbox[j][k] = SHORT(mn->bbox[j][k])<<FRACBITS;
|
||||
no->children[j] = SHORT( mn->children[j] );
|
||||
for( k = 0 ; k < 4 ; k++ )
|
||||
{
|
||||
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
|
||||
//
|
||||
void P_LoadThings (int lump)
|
||||
void P_LoadThings( int lump )
|
||||
{
|
||||
byte* data;
|
||||
int i;
|
||||
|
@ -320,18 +326,18 @@ void P_LoadThings (int lump)
|
|||
int numthings;
|
||||
qboolean spawn;
|
||||
|
||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
||||
numthings = (W_LumpLength (lump) / sizeof(mapthing_t));
|
||||
data = ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||
numthings = ( W_LumpLength( lump ) / sizeof( mapthing_t ) );
|
||||
|
||||
mt = (mapthing_t *)data;
|
||||
for (i=0 ; i<numthings ; i++, mt++)
|
||||
mt = ( mapthing_t* )data;
|
||||
for( i = 0 ; i < numthings ; i++, mt++ )
|
||||
{
|
||||
spawn = true;
|
||||
|
||||
// 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 64: // Archvile
|
||||
|
@ -347,20 +353,22 @@ void P_LoadThings (int lump)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (spawn == false)
|
||||
if( spawn == false )
|
||||
{
|
||||
break;
|
||||
|
||||
// Do spawn all other stuff.
|
||||
mt->x = SHORT(mt->x);
|
||||
mt->y = SHORT(mt->y);
|
||||
mt->angle = SHORT(mt->angle);
|
||||
mt->type = SHORT(mt->type);
|
||||
mt->options = SHORT(mt->options);
|
||||
|
||||
P_SpawnMapThing (mt);
|
||||
}
|
||||
|
||||
Z_Free(data);
|
||||
// Do spawn all other stuff.
|
||||
mt->x = SHORT( mt->x );
|
||||
mt->y = SHORT( mt->y );
|
||||
mt->angle = SHORT( mt->angle );
|
||||
mt->type = SHORT( mt->type );
|
||||
mt->options = SHORT( mt->options );
|
||||
|
||||
P_SpawnMapThing( mt );
|
||||
}
|
||||
|
||||
Z_Free( data );
|
||||
}
|
||||
|
||||
|
||||
|
@ -368,7 +376,7 @@ void P_LoadThings (int lump)
|
|||
// P_LoadLineDefs
|
||||
// Also counts secret ::g->lines for intermissions.
|
||||
//
|
||||
void P_LoadLineDefs (int lump)
|
||||
void P_LoadLineDefs( int lump )
|
||||
{
|
||||
byte* data;
|
||||
int i;
|
||||
|
@ -377,37 +385,45 @@ void P_LoadLineDefs (int lump)
|
|||
vertex_t* v1;
|
||||
vertex_t* v2;
|
||||
|
||||
::g->numlines = W_LumpLength (lump) / sizeof(maplinedef_t);
|
||||
if (MallocForLump( lump, ::g->numlines*sizeof(line_t), ::g->lines, PU_LEVEL_SHARED ))
|
||||
::g->numlines = W_LumpLength( lump ) / sizeof( maplinedef_t );
|
||||
if( MallocForLump( lump, ::g->numlines * sizeof( line_t ), ::g->lines, PU_LEVEL_SHARED ) )
|
||||
{
|
||||
memset (::g->lines, 0, ::g->numlines*sizeof(line_t));
|
||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
||||
memset( ::g->lines, 0, ::g->numlines * sizeof( line_t ) );
|
||||
data = ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||
|
||||
mld = (maplinedef_t *)data;
|
||||
mld = ( maplinedef_t* )data;
|
||||
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->special = SHORT(mld->special);
|
||||
ld->tag = SHORT(mld->tag);
|
||||
v1 = ld->v1 = &::g->vertexes[SHORT(mld->v1)];
|
||||
v2 = ld->v2 = &::g->vertexes[SHORT(mld->v2)];
|
||||
ld->flags = SHORT( mld->flags );
|
||||
ld->special = SHORT( mld->special );
|
||||
ld->tag = SHORT( mld->tag );
|
||||
v1 = ld->v1 = &::g->vertexes[SHORT( mld->v1 )];
|
||||
v2 = ld->v2 = &::g->vertexes[SHORT( mld->v2 )];
|
||||
ld->dx = v2->x - v1->x;
|
||||
ld->dy = v2->y - v1->y;
|
||||
|
||||
if (!ld->dx)
|
||||
if( !ld->dx )
|
||||
{
|
||||
ld->slopetype = ST_VERTICAL;
|
||||
else if (!ld->dy)
|
||||
}
|
||||
else if( !ld->dy )
|
||||
{
|
||||
ld->slopetype = ST_HORIZONTAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FixedDiv (ld->dy , ld->dx) > 0)
|
||||
if( FixedDiv( ld->dy , ld->dx ) > 0 )
|
||||
{
|
||||
ld->slopetype = ST_POSITIVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ld->slopetype = ST_NEGATIVE;
|
||||
}
|
||||
}
|
||||
|
||||
if (v1->x < v2->x)
|
||||
if( v1->x < v2->x )
|
||||
{
|
||||
ld->bbox[BOXLEFT] = v1->x;
|
||||
ld->bbox[BOXRIGHT] = v2->x;
|
||||
|
@ -418,7 +434,7 @@ void P_LoadLineDefs (int lump)
|
|||
ld->bbox[BOXRIGHT] = v1->x;
|
||||
}
|
||||
|
||||
if (v1->y < v2->y)
|
||||
if( v1->y < v2->y )
|
||||
{
|
||||
ld->bbox[BOXBOTTOM] = v1->y;
|
||||
ld->bbox[BOXTOP] = v2->y;
|
||||
|
@ -429,21 +445,29 @@ void P_LoadLineDefs (int lump)
|
|||
ld->bbox[BOXTOP] = v1->y;
|
||||
}
|
||||
|
||||
ld->sidenum[0] = SHORT(mld->sidenum[0]);
|
||||
ld->sidenum[1] = SHORT(mld->sidenum[1]);
|
||||
ld->sidenum[0] = SHORT( mld->sidenum[0] );
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
ld->frontsector = 0;
|
||||
|
||||
if (ld->sidenum[1] != -1)
|
||||
ld->backsector = ::g->sides[ld->sidenum[1]].sector;
|
||||
else
|
||||
ld->backsector = 0;
|
||||
}
|
||||
|
||||
Z_Free(data);
|
||||
if( ld->sidenum[1] != -1 )
|
||||
{
|
||||
ld->backsector = ::g->sides[ld->sidenum[1]].sector;
|
||||
}
|
||||
else
|
||||
{
|
||||
ld->backsector = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Z_Free( data );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -451,32 +475,32 @@ void P_LoadLineDefs (int lump)
|
|||
//
|
||||
// P_LoadSideDefs
|
||||
//
|
||||
void P_LoadSideDefs (int lump)
|
||||
void P_LoadSideDefs( int lump )
|
||||
{
|
||||
byte* data;
|
||||
int i;
|
||||
mapsidedef_t* msd;
|
||||
side_t* sd;
|
||||
|
||||
::g->numsides = W_LumpLength (lump) / sizeof(mapsidedef_t);
|
||||
if (MallocForLump( lump, ::g->numsides*sizeof(side_t), ::g->sides, PU_LEVEL_SHARED))
|
||||
::g->numsides = W_LumpLength( lump ) / sizeof( mapsidedef_t );
|
||||
if( MallocForLump( lump, ::g->numsides * sizeof( side_t ), ::g->sides, PU_LEVEL_SHARED ) )
|
||||
{
|
||||
memset (::g->sides, 0, ::g->numsides*sizeof(side_t));
|
||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
||||
memset( ::g->sides, 0, ::g->numsides * sizeof( side_t ) );
|
||||
data = ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||
|
||||
msd = (mapsidedef_t *)data;
|
||||
msd = ( mapsidedef_t* )data;
|
||||
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->rowoffset = SHORT(msd->rowoffset)<<FRACBITS;
|
||||
sd->toptexture = R_TextureNumForName(msd->toptexture);
|
||||
sd->bottomtexture = R_TextureNumForName(msd->bottomtexture);
|
||||
sd->midtexture = R_TextureNumForName(msd->midtexture);
|
||||
sd->sector = &::g->sectors[SHORT(msd->sector)];
|
||||
sd->textureoffset = SHORT( msd->textureoffset ) << FRACBITS;
|
||||
sd->rowoffset = SHORT( msd->rowoffset ) << FRACBITS;
|
||||
sd->toptexture = R_TextureNumForName( msd->toptexture );
|
||||
sd->bottomtexture = R_TextureNumForName( msd->bottomtexture );
|
||||
sd->midtexture = R_TextureNumForName( msd->midtexture );
|
||||
sd->sector = &::g->sectors[SHORT( msd->sector )];
|
||||
}
|
||||
|
||||
Z_Free(data);
|
||||
Z_Free( data );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -484,34 +508,38 @@ void P_LoadSideDefs (int lump)
|
|||
//
|
||||
// P_LoadBlockMap
|
||||
//
|
||||
void P_LoadBlockMap (int lump)
|
||||
void P_LoadBlockMap( int lump )
|
||||
{
|
||||
int i;
|
||||
int count;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
::g->blockmaplump = (short*)W_CacheLumpNum (lump,PU_LEVEL_SHARED); // ALAN: This is initialized somewhere else as shared...
|
||||
::g->blockmap = ::g->blockmaplump+4;
|
||||
count = W_LumpLength (lump)/2;
|
||||
::g->blockmaplump = ( short* )W_CacheLumpNum( lump, PU_LEVEL_SHARED ); // ALAN: This is initialized somewhere else as shared...
|
||||
::g->blockmap = ::g->blockmaplump + 4;
|
||||
count = W_LumpLength( lump ) / 2;
|
||||
|
||||
if ( firstTime ) { // SMF
|
||||
for (i=0 ; i<count ; i++)
|
||||
::g->blockmaplump[i] = SHORT(::g->blockmaplump[i]);
|
||||
if( firstTime ) // SMF
|
||||
{
|
||||
for( i = 0 ; i < count ; i++ )
|
||||
{
|
||||
::g->blockmaplump[i] = SHORT( ::g->blockmaplump[i] );
|
||||
}
|
||||
}
|
||||
|
||||
::g->bmaporgx = ( ::g->blockmaplump[0] )<<FRACBITS;
|
||||
::g->bmaporgy = ( ::g->blockmaplump[1] )<<FRACBITS;
|
||||
::g->bmaporgx = ( ::g->blockmaplump[0] ) << FRACBITS;
|
||||
::g->bmaporgy = ( ::g->blockmaplump[1] ) << FRACBITS;
|
||||
::g->bmapwidth = ( ::g->blockmaplump[2] );
|
||||
::g->bmapheight = ( ::g->blockmaplump[3] );
|
||||
|
||||
// clear out mobj chains
|
||||
count = sizeof(*::g->blocklinks)* ::g->bmapwidth*::g->bmapheight;
|
||||
::g->blocklinks = (mobj_t**)Z_Malloc (count,PU_LEVEL, 0);
|
||||
memset (::g->blocklinks, 0, count);
|
||||
count = sizeof( *::g->blocklinks )* ::g->bmapwidth*::g->bmapheight;
|
||||
::g->blocklinks = ( mobj_t** )Z_Malloc( count, PU_LEVEL, 0 );
|
||||
memset( ::g->blocklinks, 0, count );
|
||||
}
|
||||
|
||||
|
||||
|
@ -521,7 +549,7 @@ void P_LoadBlockMap (int lump)
|
|||
// Builds sector line lists and subsector sector numbers.
|
||||
// Finds block bounding boxes for ::g->sectors.
|
||||
//
|
||||
void P_GroupLines (void)
|
||||
void P_GroupLines( void )
|
||||
{
|
||||
line_t** linebuffer;
|
||||
int i;
|
||||
|
@ -537,7 +565,7 @@ void P_GroupLines (void)
|
|||
|
||||
// look up sector number for each subsector
|
||||
ss = ::g->subsectors;
|
||||
for (i=0 ; i < ::g->numsubsectors ; i++, ss++)
|
||||
for( i = 0 ; i < ::g->numsubsectors ; i++, ss++ )
|
||||
{
|
||||
seg = &::g->segs[ss->firstline];
|
||||
ss->sector = seg->sidedef->sector;
|
||||
|
@ -546,12 +574,12 @@ void P_GroupLines (void)
|
|||
// count number of ::g->lines in each sector
|
||||
li = ::g->lines;
|
||||
total = 0;
|
||||
for (i=0 ; i < ::g->numlines ; i++, li++)
|
||||
for( i = 0 ; i < ::g->numlines ; i++, li++ )
|
||||
{
|
||||
total++;
|
||||
li->frontsector->linecount++;
|
||||
|
||||
if (li->backsector && li->backsector != li->frontsector)
|
||||
if( li->backsector && li->backsector != li->frontsector )
|
||||
{
|
||||
li->backsector->linecount++;
|
||||
total++;
|
||||
|
@ -559,45 +587,47 @@ void P_GroupLines (void)
|
|||
}
|
||||
|
||||
// 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;
|
||||
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;
|
||||
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;
|
||||
M_AddToBox (bbox, li->v1->x, li->v1->y);
|
||||
M_AddToBox (bbox, li->v2->x, li->v2->y);
|
||||
M_AddToBox( bbox, li->v1->x, li->v1->y );
|
||||
M_AddToBox( bbox, li->v2->x, li->v2->y );
|
||||
}
|
||||
}
|
||||
if (linebuffer - sector->lines != sector->linecount)
|
||||
I_Error ("P_GroupLines: miscounted");
|
||||
if( linebuffer - sector->lines != sector->linecount )
|
||||
{
|
||||
I_Error( "P_GroupLines: miscounted" );
|
||||
}
|
||||
|
||||
// set the degenmobj_t to the middle of the bounding box
|
||||
sector->soundorg.x = (bbox[BOXRIGHT]+bbox[BOXLEFT])/2;
|
||||
sector->soundorg.y = (bbox[BOXTOP]+bbox[BOXBOTTOM])/2;
|
||||
sector->soundorg.x = ( bbox[BOXRIGHT] + bbox[BOXLEFT] ) / 2;
|
||||
sector->soundorg.y = ( bbox[BOXTOP] + bbox[BOXBOTTOM] ) / 2;
|
||||
|
||||
// adjust bounding box to map blocks
|
||||
block = (bbox[BOXTOP]-::g->bmaporgy+MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
block = block >= ::g->bmapheight ? ::g->bmapheight-1 : block;
|
||||
sector->blockbox[BOXTOP]=block;
|
||||
block = ( bbox[BOXTOP] -::g->bmaporgy + MAXRADIUS ) >> MAPBLOCKSHIFT;
|
||||
block = block >= ::g->bmapheight ? ::g->bmapheight - 1 : block;
|
||||
sector->blockbox[BOXTOP] = block;
|
||||
|
||||
block = (bbox[BOXBOTTOM]-::g->bmaporgy-MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
block = ( bbox[BOXBOTTOM] -::g->bmaporgy - MAXRADIUS ) >> MAPBLOCKSHIFT;
|
||||
block = block < 0 ? 0 : block;
|
||||
sector->blockbox[BOXBOTTOM]=block;
|
||||
sector->blockbox[BOXBOTTOM] = block;
|
||||
|
||||
block = (bbox[BOXRIGHT]-::g->bmaporgx+MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
block = block >= ::g->bmapwidth ? ::g->bmapwidth-1 : block;
|
||||
sector->blockbox[BOXRIGHT]=block;
|
||||
block = ( bbox[BOXRIGHT] -::g->bmaporgx + MAXRADIUS ) >> MAPBLOCKSHIFT;
|
||||
block = block >= ::g->bmapwidth ? ::g->bmapwidth - 1 : block;
|
||||
sector->blockbox[BOXRIGHT] = block;
|
||||
|
||||
block = (bbox[BOXLEFT]-::g->bmaporgx-MAXRADIUS)>>MAPBLOCKSHIFT;
|
||||
block = ( bbox[BOXLEFT] -::g->bmaporgx - MAXRADIUS ) >> MAPBLOCKSHIFT;
|
||||
block = block < 0 ? 0 : block;
|
||||
sector->blockbox[BOXLEFT]=block;
|
||||
sector->blockbox[BOXLEFT] = block;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -611,7 +641,7 @@ P_SetupLevel
|
|||
( int episode,
|
||||
int map,
|
||||
int playermask,
|
||||
skill_t skill)
|
||||
skill_t skill )
|
||||
{
|
||||
int i;
|
||||
char lumpname[9];
|
||||
|
@ -619,7 +649,7 @@ P_SetupLevel
|
|||
|
||||
::g->totalkills = ::g->totalitems = ::g->totalsecret = ::g->wminfo.maxfrags = 0;
|
||||
::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].itemcount = 0;
|
||||
|
@ -633,32 +663,36 @@ P_SetupLevel
|
|||
::g->players[::g->consoleplayer].viewz = 1;
|
||||
|
||||
// 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 ();
|
||||
P_InitThinkers ();
|
||||
P_InitThinkers();
|
||||
|
||||
// if working with a devlopment map, reload it
|
||||
// W_Reload ();
|
||||
|
||||
// DHM - NERVE :: Update the cached asset pointers in case the wad files were reloaded
|
||||
{
|
||||
void ST_loadData(void);
|
||||
void ST_loadData( void );
|
||||
ST_loadData();
|
||||
|
||||
void HU_Init(void);
|
||||
void HU_Init( void );
|
||||
HU_Init();
|
||||
}
|
||||
|
||||
// find map name
|
||||
if ( ::g->gamemode == commercial)
|
||||
if( ::g->gamemode == commercial )
|
||||
{
|
||||
if (map<10)
|
||||
sprintf (lumpname, "map0%i", map % 100);
|
||||
if( map < 10 )
|
||||
{
|
||||
sprintf( lumpname, "map0%i", map % 100 );
|
||||
}
|
||||
else
|
||||
sprintf (lumpname, "map%i", map % 100);
|
||||
{
|
||||
sprintf( lumpname, "map%i", map % 100 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -669,40 +703,40 @@ P_SetupLevel
|
|||
lumpname[4] = 0;
|
||||
}
|
||||
|
||||
lumpnum = W_GetNumForName (lumpname);
|
||||
lumpnum = W_GetNumForName( lumpname );
|
||||
|
||||
::g->leveltime = 0;
|
||||
|
||||
// note: most of this ordering is important
|
||||
P_LoadBlockMap (lumpnum+ML_BLOCKMAP);
|
||||
P_LoadVertexes (lumpnum+ML_VERTEXES);
|
||||
P_LoadSectors (lumpnum+ML_SECTORS);
|
||||
P_LoadSideDefs (lumpnum+ML_SIDEDEFS);
|
||||
P_LoadBlockMap( lumpnum + ML_BLOCKMAP );
|
||||
P_LoadVertexes( lumpnum + ML_VERTEXES );
|
||||
P_LoadSectors( lumpnum + ML_SECTORS );
|
||||
P_LoadSideDefs( lumpnum + ML_SIDEDEFS );
|
||||
|
||||
P_LoadLineDefs (lumpnum+ML_LINEDEFS);
|
||||
P_LoadSubsectors (lumpnum+ML_SSECTORS);
|
||||
P_LoadNodes (lumpnum+ML_NODES);
|
||||
P_LoadSegs (lumpnum+ML_SEGS);
|
||||
P_LoadLineDefs( lumpnum + ML_LINEDEFS );
|
||||
P_LoadSubsectors( lumpnum + ML_SSECTORS );
|
||||
P_LoadNodes( lumpnum + ML_NODES );
|
||||
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->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)
|
||||
if( ::g->deathmatch )
|
||||
{
|
||||
for (i=0 ; i<MAXPLAYERS ; i++)
|
||||
if (::g->playeringame[i])
|
||||
for( i = 0 ; i < MAXPLAYERS ; i++ )
|
||||
if( ::g->playeringame[i] )
|
||||
{
|
||||
// DHM - Nerve :: In deathmatch, reset every player at match start
|
||||
::g->players[i].playerstate = PST_REBORN;
|
||||
|
||||
::g->players[i].mo = NULL;
|
||||
G_DeathMatchSpawnPlayer (i);
|
||||
G_DeathMatchSpawnPlayer( i );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -711,14 +745,16 @@ P_SetupLevel
|
|||
::g->iquehead = ::g->iquetail = 0;
|
||||
|
||||
// set up world state
|
||||
P_SpawnSpecials ();
|
||||
P_SpawnSpecials();
|
||||
|
||||
// build subsector connect matrix
|
||||
// UNUSED P_ConnectSubsectors ();
|
||||
|
||||
// preload graphics
|
||||
if (::g->precache)
|
||||
R_PrecacheLevel ();
|
||||
if( ::g->precache )
|
||||
{
|
||||
R_PrecacheLevel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -726,11 +762,11 @@ P_SetupLevel
|
|||
//
|
||||
// P_Init
|
||||
//
|
||||
void P_Init (void)
|
||||
void P_Init( void )
|
||||
{
|
||||
P_InitSwitchList ();
|
||||
P_InitPicAnims ();
|
||||
R_InitSprites (sprnames);
|
||||
P_InitSwitchList();
|
||||
P_InitPicAnims();
|
||||
R_InitSprites( sprnames );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -41,10 +41,10 @@ P_SetupLevel
|
|||
( int episode,
|
||||
int map,
|
||||
int playermask,
|
||||
skill_t skill);
|
||||
skill_t skill );
|
||||
|
||||
// Called by startup code.
|
||||
void P_Init (void);
|
||||
void P_Init( void );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -60,39 +60,51 @@ P_DivlineSide
|
|||
fixed_t left;
|
||||
fixed_t right;
|
||||
|
||||
if (!node->dx)
|
||||
if( !node->dx )
|
||||
{
|
||||
if( x == node->x )
|
||||
{
|
||||
if (x==node->x)
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (x <= node->x)
|
||||
if( x <= node->x )
|
||||
{
|
||||
return node->dy > 0;
|
||||
}
|
||||
|
||||
return node->dy < 0;
|
||||
}
|
||||
|
||||
if (!node->dy)
|
||||
if( !node->dy )
|
||||
{
|
||||
if( x == node->y )
|
||||
{
|
||||
if (x==node->y)
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (y <= node->y)
|
||||
if( y <= node->y )
|
||||
{
|
||||
return node->dx < 0;
|
||||
}
|
||||
|
||||
return node->dx > 0;
|
||||
}
|
||||
|
||||
dx = (x - node->x);
|
||||
dy = (y - node->y);
|
||||
dx = ( x - node->x );
|
||||
dy = ( y - node->y );
|
||||
|
||||
left = (node->dy>>FRACBITS) * (dx>>FRACBITS);
|
||||
right = (dy>>FRACBITS) * (node->dx>>FRACBITS);
|
||||
left = ( node->dy >> FRACBITS ) * ( dx >> FRACBITS );
|
||||
right = ( dy >> FRACBITS ) * ( node->dx >> FRACBITS );
|
||||
|
||||
if (right < left)
|
||||
if( right < left )
|
||||
{
|
||||
return 0; // front side
|
||||
}
|
||||
|
||||
if (left == right)
|
||||
if( left == right )
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
return 1; // back side
|
||||
}
|
||||
|
||||
|
@ -112,15 +124,17 @@ P_InterceptVector2
|
|||
fixed_t num;
|
||||
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");
|
||||
|
||||
num = FixedMul ( (v1->x - v2->x)>>8 ,v1->dy) +
|
||||
FixedMul ( (v2->y - v1->y)>>8 , v1->dx);
|
||||
frac = FixedDiv (num , den);
|
||||
num = FixedMul( ( v1->x - v2->x ) >> 8 , v1->dy ) +
|
||||
FixedMul( ( v2->y - v1->y ) >> 8 , v1->dx );
|
||||
frac = FixedDiv( num , den );
|
||||
|
||||
return frac;
|
||||
}
|
||||
|
@ -130,7 +144,7 @@ P_InterceptVector2
|
|||
// Returns true
|
||||
// if ::g->strace crosses the given subsector successfully.
|
||||
//
|
||||
qboolean P_CrossSubsector (int num)
|
||||
qboolean P_CrossSubsector( int num )
|
||||
{
|
||||
seg_t* seg;
|
||||
line_t* line;
|
||||
|
@ -149,10 +163,10 @@ qboolean P_CrossSubsector (int num)
|
|||
fixed_t slope;
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if (num>=::g->numsubsectors)
|
||||
I_Error ("P_CrossSubsector: ss %i with numss = %i",
|
||||
if( num >=::g->numsubsectors )
|
||||
I_Error( "P_CrossSubsector: ss %i with numss = %i",
|
||||
num,
|
||||
::g->numsubsectors);
|
||||
::g->numsubsectors );
|
||||
#endif
|
||||
|
||||
sub = &::g->subsectors[num];
|
||||
|
@ -161,86 +175,112 @@ qboolean P_CrossSubsector (int num)
|
|||
count = sub->numlines;
|
||||
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)
|
||||
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);
|
||||
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)
|
||||
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);
|
||||
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)
|
||||
if( s1 == s2 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// stop because it is not two sided anyway
|
||||
// might do this after updating validcount?
|
||||
if ( !(line->flags & ML_TWOSIDED) )
|
||||
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)
|
||||
if( front->floorheight == back->floorheight
|
||||
&& front->ceilingheight == back->ceilingheight )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// possible occluder
|
||||
// because of ceiling height differences
|
||||
if (front->ceilingheight < back->ceilingheight)
|
||||
if( front->ceilingheight < back->ceilingheight )
|
||||
{
|
||||
psight_opentop = front->ceilingheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
psight_opentop = back->ceilingheight;
|
||||
}
|
||||
|
||||
// because of ceiling height differences
|
||||
if (front->floorheight > back->floorheight)
|
||||
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)
|
||||
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 )
|
||||
{
|
||||
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)
|
||||
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
|
||||
// if ::g->strace crosses the given node successfully.
|
||||
//
|
||||
qboolean P_CrossBSPNode (int bspnum)
|
||||
qboolean P_CrossBSPNode( int bspnum )
|
||||
{
|
||||
node_t* bsp;
|
||||
int side;
|
||||
|
||||
if (bspnum & NF_SUBSECTOR)
|
||||
if( bspnum & NF_SUBSECTOR )
|
||||
{
|
||||
if (bspnum == -1)
|
||||
return P_CrossSubsector (0);
|
||||
if( bspnum == -1 )
|
||||
{
|
||||
return P_CrossSubsector( 0 );
|
||||
}
|
||||
else
|
||||
return P_CrossSubsector (bspnum&(~NF_SUBSECTOR));
|
||||
{
|
||||
return P_CrossSubsector( bspnum & ( ~NF_SUBSECTOR ) );
|
||||
}
|
||||
}
|
||||
|
||||
bsp = &::g->nodes[bspnum];
|
||||
|
||||
// decide which side the start point is on
|
||||
side = P_DivlineSide (::g->strace.x, ::g->strace.y, (divline_t *)bsp);
|
||||
if (side == 2)
|
||||
side = P_DivlineSide( ::g->strace.x, ::g->strace.y, ( divline_t* )bsp );
|
||||
if( side == 2 )
|
||||
{
|
||||
side = 0; // an "on" should cross both ::g->sides
|
||||
}
|
||||
|
||||
// cross the starting side
|
||||
if (!P_CrossBSPNode (bsp->children[side]) )
|
||||
if( !P_CrossBSPNode( bsp->children[side] ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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
|
||||
return true;
|
||||
}
|
||||
|
||||
// cross the ending side
|
||||
return P_CrossBSPNode (bsp->children[side^1]);
|
||||
return P_CrossBSPNode( bsp->children[side ^ 1] );
|
||||
}
|
||||
|
||||
|
||||
|
@ -308,14 +356,14 @@ P_CheckSight
|
|||
// First check for trivial rejection.
|
||||
|
||||
// Determine subsector entries in REJECT table.
|
||||
s1 = (t1->subsector->sector - ::g->sectors);
|
||||
s2 = (t2->subsector->sector - ::g->sectors);
|
||||
s1 = ( t1->subsector->sector - ::g->sectors );
|
||||
s2 = ( t2->subsector->sector - ::g->sectors );
|
||||
pnum = s1*::g->numsectors + s2;
|
||||
bytenum = pnum>>3;
|
||||
bitnum = 1 << (pnum&7);
|
||||
bytenum = pnum >> 3;
|
||||
bitnum = 1 << ( pnum & 7 );
|
||||
|
||||
// Check in REJECT table.
|
||||
if (::g->rejectmatrix[bytenum]&bitnum)
|
||||
if( ::g->rejectmatrix[bytenum]&bitnum )
|
||||
{
|
||||
::g->sightcounts[0]++;
|
||||
|
||||
|
@ -329,9 +377,9 @@ P_CheckSight
|
|||
|
||||
::g->validcount++;
|
||||
|
||||
::g->sightzstart = t1->z + t1->height - (t1->height>>2);
|
||||
::g->topslope = (t2->z+t2->height) - ::g->sightzstart;
|
||||
::g->bottomslope = (t2->z) - ::g->sightzstart;
|
||||
::g->sightzstart = t1->z + t1->height - ( t1->height >> 2 );
|
||||
::g->topslope = ( t2->z + t2->height ) - ::g->sightzstart;
|
||||
::g->bottomslope = ( t2->z ) - ::g->sightzstart;
|
||||
|
||||
::g->strace.x = t1->x;
|
||||
::g->strace.y = t1->y;
|
||||
|
@ -341,7 +389,7 @@ P_CheckSight
|
|||
::g->strace.dy = t2->y - t1->y;
|
||||
|
||||
// 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
|
||||
void P_InitPicAnims (void);
|
||||
void P_InitPicAnims( void );
|
||||
|
||||
// at map load
|
||||
void P_SpawnSpecials (void);
|
||||
void P_SpawnSpecials( void );
|
||||
|
||||
// every tic
|
||||
void P_UpdateSpecials (void);
|
||||
void P_UpdateSpecials( void );
|
||||
|
||||
// when needed
|
||||
qboolean
|
||||
|
@ -68,7 +68,7 @@ P_CrossSpecialLine
|
|||
int side,
|
||||
mobj_t* thing );
|
||||
|
||||
void P_PlayerInSpecialSector (player_t* player);
|
||||
void P_PlayerInSpecialSector( player_t* player );
|
||||
|
||||
int
|
||||
twoSided
|
||||
|
@ -87,16 +87,16 @@ getSide
|
|||
int line,
|
||||
int side );
|
||||
|
||||
fixed_t P_FindLowestFloorSurrounding(sector_t* sec);
|
||||
fixed_t P_FindHighestFloorSurrounding(sector_t* sec);
|
||||
fixed_t P_FindLowestFloorSurrounding( sector_t* sec );
|
||||
fixed_t P_FindHighestFloorSurrounding( sector_t* sec );
|
||||
|
||||
fixed_t
|
||||
P_FindNextHighestFloor
|
||||
( sector_t* sec,
|
||||
int currentheight );
|
||||
|
||||
fixed_t P_FindLowestCeilingSurrounding(sector_t* sec);
|
||||
fixed_t P_FindHighestCeilingSurrounding(sector_t* sec);
|
||||
fixed_t P_FindLowestCeilingSurrounding( sector_t* sec );
|
||||
fixed_t P_FindHighestCeilingSurrounding( sector_t* sec );
|
||||
|
||||
int
|
||||
P_FindSectorFromLineTag
|
||||
|
@ -117,7 +117,7 @@ getNextSector
|
|||
//
|
||||
// SPECIAL
|
||||
//
|
||||
int EV_DoDonut(line_t* line);
|
||||
int EV_DoDonut( line_t* line );
|
||||
|
||||
|
||||
|
||||
|
@ -181,11 +181,11 @@ typedef struct
|
|||
#define FASTDARK 15
|
||||
#define SLOWDARK 35
|
||||
|
||||
void T_FireFlicker (fireflicker_t* flick);
|
||||
void P_SpawnFireFlicker (sector_t* sector);
|
||||
void T_LightFlash (lightflash_t* flash);
|
||||
void P_SpawnLightFlash (sector_t* sector);
|
||||
void T_StrobeFlash (strobe_t* flash);
|
||||
void T_FireFlicker( fireflicker_t* flick );
|
||||
void P_SpawnFireFlicker( sector_t* sector );
|
||||
void T_LightFlash( lightflash_t* flash );
|
||||
void P_SpawnLightFlash( sector_t* sector );
|
||||
void T_StrobeFlash( strobe_t* flash );
|
||||
|
||||
void
|
||||
P_SpawnStrobeFlash
|
||||
|
@ -193,16 +193,16 @@ P_SpawnStrobeFlash
|
|||
int fastOrSlow,
|
||||
int inSync );
|
||||
|
||||
void EV_StartLightStrobing(line_t* line);
|
||||
void EV_TurnTagLightsOff(line_t* line);
|
||||
void EV_StartLightStrobing( line_t* line );
|
||||
void EV_TurnTagLightsOff( line_t* line );
|
||||
|
||||
void
|
||||
EV_LightTurnOn
|
||||
( line_t* line,
|
||||
int bright );
|
||||
|
||||
void T_Glow(glow_t* g);
|
||||
void P_SpawnGlowingLight(sector_t* sector);
|
||||
void T_Glow( glow_t* g );
|
||||
void P_SpawnGlowingLight( sector_t* sector );
|
||||
|
||||
|
||||
|
||||
|
@ -234,22 +234,23 @@ typedef struct
|
|||
bwhere_e where;
|
||||
int btexture;
|
||||
int btimer;
|
||||
union {
|
||||
mobj_t * soundorg;
|
||||
degenmobj_t * degensoundorg;
|
||||
union
|
||||
{
|
||||
mobj_t* soundorg;
|
||||
degenmobj_t* degensoundorg;
|
||||
};
|
||||
} button_t;
|
||||
|
||||
|
||||
|
||||
|
||||
// max # of wall switches in a level
|
||||
// max # of wall switches in a level
|
||||
#define MAXSWITCHES 50
|
||||
|
||||
// 4 players, 4 buttons each at once, max.
|
||||
// 4 players, 4 buttons each at once, max.
|
||||
#define MAXBUTTONS 16
|
||||
|
||||
// 1 second, in ticks.
|
||||
// 1 second, in ticks.
|
||||
#define BUTTONTIME TICRATE
|
||||
|
||||
extern button_t buttonlist[MAXBUTTONS];
|
||||
|
@ -259,7 +260,7 @@ P_ChangeSwitchTexture
|
|||
( line_t* line,
|
||||
int useAgain );
|
||||
|
||||
void P_InitSwitchList(void);
|
||||
void P_InitSwitchList( void );
|
||||
|
||||
|
||||
//
|
||||
|
@ -314,7 +315,7 @@ typedef struct
|
|||
|
||||
extern plat_t* activeplats[MAXPLATS];
|
||||
|
||||
void T_PlatRaise(plat_t* plat);
|
||||
void T_PlatRaise( plat_t* plat );
|
||||
|
||||
int
|
||||
EV_DoPlat
|
||||
|
@ -322,10 +323,10 @@ EV_DoPlat
|
|||
plattype_e type,
|
||||
int amount );
|
||||
|
||||
void P_AddActivePlat(plat_t* plat);
|
||||
void P_RemoveActivePlat(plat_t* plat);
|
||||
void EV_StopPlat(line_t* line);
|
||||
void P_ActivateInStasis(int tag);
|
||||
void P_AddActivePlat( plat_t* plat );
|
||||
void P_RemoveActivePlat( plat_t* plat );
|
||||
void EV_StopPlat( line_t* line );
|
||||
void P_ActivateInStasis( int tag );
|
||||
|
||||
|
||||
//
|
||||
|
@ -386,8 +387,8 @@ EV_DoLockedDoor
|
|||
vldoor_e type,
|
||||
mobj_t* thing );
|
||||
|
||||
void T_VerticalDoor (vldoor_t* door);
|
||||
void P_SpawnDoorCloseIn30 (sector_t* sec);
|
||||
void T_VerticalDoor( vldoor_t* door );
|
||||
void P_SpawnDoorCloseIn30( sector_t* sec );
|
||||
|
||||
void
|
||||
P_SpawnDoorRaiseIn5Mins
|
||||
|
@ -470,7 +471,7 @@ typedef struct
|
|||
// how many diff. types of anims
|
||||
#define MAXSLIDEDOORS 5
|
||||
|
||||
void P_InitSlidingDoorFrames(void);
|
||||
void P_InitSlidingDoorFrames( void );
|
||||
|
||||
void
|
||||
EV_SlidingDoor
|
||||
|
@ -530,11 +531,11 @@ EV_DoCeiling
|
|||
( line_t* line,
|
||||
ceiling_e type );
|
||||
|
||||
void T_MoveCeiling (ceiling_t* ceiling);
|
||||
void P_AddActiveCeiling(ceiling_t* c);
|
||||
void P_RemoveActiveCeiling(ceiling_t* c);
|
||||
int EV_CeilingCrushStop(line_t* line);
|
||||
void P_ActivateInStasisCeiling(line_t* line);
|
||||
void T_MoveCeiling( ceiling_t* ceiling );
|
||||
void P_AddActiveCeiling( ceiling_t* c );
|
||||
void P_RemoveActiveCeiling( ceiling_t* c );
|
||||
int EV_CeilingCrushStop( line_t* line );
|
||||
void P_ActivateInStasisCeiling( line_t* line );
|
||||
|
||||
|
||||
//
|
||||
|
@ -632,7 +633,7 @@ EV_DoFloor
|
|||
( line_t* line,
|
||||
floor_e floortype );
|
||||
|
||||
void T_MoveFloor( floormove_t* floor);
|
||||
void T_MoveFloor( floormove_t* floor );
|
||||
|
||||
//
|
||||
// P_TELEPT
|
||||
|
|
|
@ -105,7 +105,7 @@ const switchlist_t alphSwitchList[] =
|
|||
// P_InitSwitchList
|
||||
// Only called at game initialization.
|
||||
//
|
||||
void P_InitSwitchList(void)
|
||||
void P_InitSwitchList( void )
|
||||
{
|
||||
int i;
|
||||
int index;
|
||||
|
@ -113,36 +113,40 @@ void P_InitSwitchList(void)
|
|||
|
||||
episode = 1;
|
||||
|
||||
if (::g->gamemode == registered || ::g->gamemode == retail)
|
||||
if( ::g->gamemode == registered || ::g->gamemode == retail )
|
||||
{
|
||||
episode = 2;
|
||||
else if ( ::g->gamemode == commercial )
|
||||
}
|
||||
else if( ::g->gamemode == commercial )
|
||||
{
|
||||
episode = 3;
|
||||
}
|
||||
|
||||
for (index = 0,i = 0;i < MAXSWITCHES;i++)
|
||||
for( index = 0, i = 0; i < MAXSWITCHES; i++ )
|
||||
{
|
||||
if (!alphSwitchList[i].episode)
|
||||
if( !alphSwitchList[i].episode )
|
||||
{
|
||||
::g->numswitches = index/2;
|
||||
::g->numswitches = index / 2;
|
||||
::g->switchlist[index] = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (alphSwitchList[i].episode <= episode)
|
||||
if( alphSwitchList[i].episode <= episode )
|
||||
{
|
||||
#if 0 // UNUSED - debug?
|
||||
#if 0 // UNUSED - debug?
|
||||
int value;
|
||||
|
||||
if (R_CheckTextureNumForName(alphSwitchList[i].name1) < 0)
|
||||
if( R_CheckTextureNumForName( alphSwitchList[i].name1 ) < 0 )
|
||||
{
|
||||
I_Error("Can't find switch texture '%s'!",
|
||||
alphSwitchList[i].name1);
|
||||
I_Error( "Can't find switch texture '%s'!",
|
||||
alphSwitchList[i].name1 );
|
||||
continue;
|
||||
}
|
||||
|
||||
value = R_TextureNumForName(alphSwitchList[i].name1);
|
||||
#endif
|
||||
::g->switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name1);
|
||||
::g->switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name2);
|
||||
value = R_TextureNumForName( alphSwitchList[i].name1 );
|
||||
#endif
|
||||
::g->switchlist[index++] = R_TextureNumForName( alphSwitchList[i].name1 );
|
||||
::g->switchlist[index++] = R_TextureNumForName( alphSwitchList[i].name2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,10 +165,10 @@ P_StartButton
|
|||
int i;
|
||||
|
||||
// See if button is already pressed
|
||||
for (i = 0;i < MAXBUTTONS;i++)
|
||||
for( i = 0; i < MAXBUTTONS; i++ )
|
||||
{
|
||||
if (::g->buttonlist[i].btimer
|
||||
&& ::g->buttonlist[i].line == line)
|
||||
if( ::g->buttonlist[i].btimer
|
||||
&& ::g->buttonlist[i].line == line )
|
||||
{
|
||||
|
||||
return;
|
||||
|
@ -173,9 +177,9 @@ P_StartButton
|
|||
|
||||
|
||||
|
||||
for (i = 0;i < MAXBUTTONS;i++)
|
||||
for( i = 0; i < MAXBUTTONS; i++ )
|
||||
{
|
||||
if (!::g->buttonlist[i].btimer)
|
||||
if( !::g->buttonlist[i].btimer )
|
||||
{
|
||||
::g->buttonlist[i].line = line;
|
||||
::g->buttonlist[i].where = w;
|
||||
|
@ -186,7 +190,7 @@ P_StartButton
|
|||
}
|
||||
}
|
||||
|
||||
I_Error("P_StartButton: no button slots left!");
|
||||
I_Error( "P_StartButton: no button slots left!" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -208,8 +212,10 @@ P_ChangeSwitchTexture
|
|||
int i;
|
||||
int sound;
|
||||
|
||||
if (!useAgain)
|
||||
if( !useAgain )
|
||||
{
|
||||
line->special = 0;
|
||||
}
|
||||
|
||||
texTop = ::g->sides[line->sidenum[0]].toptexture;
|
||||
texMid = ::g->sides[line->sidenum[0]].midtexture;
|
||||
|
@ -218,42 +224,50 @@ P_ChangeSwitchTexture
|
|||
sound = sfx_swtchn;
|
||||
|
||||
// EXIT SWITCH?
|
||||
if (line->special == 11)
|
||||
if( line->special == 11 )
|
||||
{
|
||||
sound = sfx_swtchx;
|
||||
}
|
||||
|
||||
for (i = 0;i < ::g->numswitches*2;i++)
|
||||
for( i = 0; i < ::g->numswitches * 2; i++ )
|
||||
{
|
||||
if (::g->switchlist[i] == texTop)
|
||||
if( ::g->switchlist[i] == texTop )
|
||||
{
|
||||
S_StartSound(::g->buttonlist->soundorg,sound);
|
||||
::g->sides[line->sidenum[0]].toptexture = ::g->switchlist[i^1];
|
||||
S_StartSound( ::g->buttonlist->soundorg, sound );
|
||||
::g->sides[line->sidenum[0]].toptexture = ::g->switchlist[i ^ 1];
|
||||
|
||||
if (useAgain)
|
||||
P_StartButton(line,top,::g->switchlist[i],BUTTONTIME);
|
||||
if( useAgain )
|
||||
{
|
||||
P_StartButton( line, top, ::g->switchlist[i], BUTTONTIME );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (::g->switchlist[i] == texMid)
|
||||
if( ::g->switchlist[i] == texMid )
|
||||
{
|
||||
S_StartSound(::g->buttonlist->soundorg,sound);
|
||||
::g->sides[line->sidenum[0]].midtexture = ::g->switchlist[i^1];
|
||||
S_StartSound( ::g->buttonlist->soundorg, sound );
|
||||
::g->sides[line->sidenum[0]].midtexture = ::g->switchlist[i ^ 1];
|
||||
|
||||
if (useAgain)
|
||||
P_StartButton(line, middle,::g->switchlist[i],BUTTONTIME);
|
||||
if( useAgain )
|
||||
{
|
||||
P_StartButton( line, middle, ::g->switchlist[i], BUTTONTIME );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (::g->switchlist[i] == texBot)
|
||||
if( ::g->switchlist[i] == texBot )
|
||||
{
|
||||
S_StartSound(::g->buttonlist->soundorg,sound);
|
||||
::g->sides[line->sidenum[0]].bottomtexture = ::g->switchlist[i^1];
|
||||
S_StartSound( ::g->buttonlist->soundorg, sound );
|
||||
::g->sides[line->sidenum[0]].bottomtexture = ::g->switchlist[i ^ 1];
|
||||
|
||||
if (useAgain)
|
||||
P_StartButton(line, bottom,::g->switchlist[i],BUTTONTIME);
|
||||
if( useAgain )
|
||||
{
|
||||
P_StartButton( line, bottom, ::g->switchlist[i], BUTTONTIME );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -281,9 +295,9 @@ P_UseSpecialLine
|
|||
|
||||
// Err...
|
||||
// Use the back ::g->sides of VERY SPECIAL ::g->lines...
|
||||
if (side)
|
||||
if( side )
|
||||
{
|
||||
switch(line->special)
|
||||
switch( line->special )
|
||||
{
|
||||
case 124:
|
||||
// Sliding door open&close
|
||||
|
@ -298,13 +312,15 @@ P_UseSpecialLine
|
|||
|
||||
|
||||
// Switches that other things can activate.
|
||||
if (!thing->player)
|
||||
if( !thing->player )
|
||||
{
|
||||
// never open secret doors
|
||||
if (line->flags & ML_SECRET)
|
||||
if( line->flags & ML_SECRET )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch(line->special)
|
||||
switch( line->special )
|
||||
{
|
||||
case 1: // MANUAL DOOR RAISE
|
||||
case 32: // MANUAL BLUE
|
||||
|
@ -320,7 +336,7 @@ P_UseSpecialLine
|
|||
|
||||
|
||||
// do something
|
||||
switch (line->special)
|
||||
switch( line->special )
|
||||
{
|
||||
// MANUALS
|
||||
case 1: // Vertical Door
|
||||
|
@ -335,7 +351,7 @@ P_UseSpecialLine
|
|||
|
||||
case 117: // Blazing door raise
|
||||
case 118: // Blazing door open
|
||||
EV_VerticalDoor (line, thing);
|
||||
EV_VerticalDoor( line, thing );
|
||||
break;
|
||||
|
||||
//UNUSED - Door Slide Open&Close
|
||||
|
@ -346,157 +362,205 @@ P_UseSpecialLine
|
|||
// SWITCHES
|
||||
case 7:
|
||||
// Build Stairs
|
||||
if (EV_BuildStairs(line,build8))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_BuildStairs( line, build8 ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
// Change Donut
|
||||
if (EV_DoDonut(line))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoDonut( line ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 11:
|
||||
// Exit level
|
||||
// DHM - Nerve :: Not in deathmatch, stay in level until timelimit or fraglimit
|
||||
if ( !::g->deathmatch && ::g->gameaction != ga_completed ) {
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
G_ExitLevel ();
|
||||
if( !::g->deathmatch && ::g->gameaction != ga_completed )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
G_ExitLevel();
|
||||
}
|
||||
break;
|
||||
|
||||
case 14:
|
||||
// Raise Floor 32 and change texture
|
||||
if (EV_DoPlat(line,raiseAndChange,32))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoPlat( line, raiseAndChange, 32 ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 15:
|
||||
// Raise Floor 24 and change texture
|
||||
if (EV_DoPlat(line,raiseAndChange,24))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoPlat( line, raiseAndChange, 24 ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 18:
|
||||
// Raise Floor to next highest floor
|
||||
if (EV_DoFloor(line, raiseFloorToNearest))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoFloor( line, raiseFloorToNearest ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 20:
|
||||
// Raise Plat next highest floor and change texture
|
||||
if (EV_DoPlat(line,raiseToNearestAndChange,0))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoPlat( line, raiseToNearestAndChange, 0 ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 21:
|
||||
// PlatDownWaitUpStay
|
||||
if (EV_DoPlat(line,downWaitUpStay,0))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoPlat( line, downWaitUpStay, 0 ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 23:
|
||||
// Lower Floor to Lowest
|
||||
if (EV_DoFloor(line,lowerFloorToLowest))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoFloor( line, lowerFloorToLowest ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 29:
|
||||
// Raise Door
|
||||
if (EV_DoDoor(line,normal))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoDoor( line, normal ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 41:
|
||||
// Lower Ceiling to Floor
|
||||
if (EV_DoCeiling(line,lowerToFloor))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoCeiling( line, lowerToFloor ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 71:
|
||||
// Turbo Lower Floor
|
||||
if (EV_DoFloor(line,turboLower))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoFloor( line, turboLower ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 49:
|
||||
// Ceiling Crush And Raise
|
||||
if (EV_DoCeiling(line,crushAndRaise))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoCeiling( line, crushAndRaise ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 50:
|
||||
// Close Door
|
||||
if (EV_DoDoor(line,closed))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoDoor( line, closed ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 51:
|
||||
// Secret EXIT
|
||||
if ( !::g->deathmatch && ::g->gameaction != ga_completed ) {
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
G_SecretExitLevel ();
|
||||
if( !::g->deathmatch && ::g->gameaction != ga_completed )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
G_SecretExitLevel();
|
||||
}
|
||||
break;
|
||||
|
||||
case 55:
|
||||
// Raise Floor Crush
|
||||
if (EV_DoFloor(line,raiseFloorCrush))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoFloor( line, raiseFloorCrush ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 101:
|
||||
// Raise Floor
|
||||
if (EV_DoFloor(line,raiseFloor))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoFloor( line, raiseFloor ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 102:
|
||||
// Lower Floor to Surrounding floor height
|
||||
if (EV_DoFloor(line,lowerFloor))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoFloor( line, lowerFloor ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 103:
|
||||
// Open Door
|
||||
if (EV_DoDoor(line,opened))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoDoor( line, opened ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 111:
|
||||
// Blazing Door Raise (faster than TURBO!)
|
||||
if (EV_DoDoor (line,blazeRaise))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoDoor( line, blazeRaise ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 112:
|
||||
// Blazing Door Open (faster than TURBO!)
|
||||
if (EV_DoDoor (line,blazeOpen))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoDoor( line, blazeOpen ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 113:
|
||||
// Blazing Door Close (faster than TURBO!)
|
||||
if (EV_DoDoor (line,blazeClose))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoDoor( line, blazeClose ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 122:
|
||||
// Blazing PlatDownWaitUpStay
|
||||
if (EV_DoPlat(line,blazeDWUS,0))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoPlat( line, blazeDWUS, 0 ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 127:
|
||||
// Build Stairs Turbo 16
|
||||
if (EV_BuildStairs(line,turbo16))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_BuildStairs( line, turbo16 ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 131:
|
||||
// Raise Floor Turbo
|
||||
if (EV_DoFloor(line,raiseFloorTurbo))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoFloor( line, raiseFloorTurbo ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 133:
|
||||
|
@ -505,129 +569,171 @@ P_UseSpecialLine
|
|||
// BlzOpenDoor RED
|
||||
case 137:
|
||||
// BlzOpenDoor YELLOW
|
||||
if (EV_DoLockedDoor (line,blazeOpen,thing))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoLockedDoor( line, blazeOpen, thing ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 140:
|
||||
// Raise Floor 512
|
||||
if (EV_DoFloor(line,raiseFloor512))
|
||||
P_ChangeSwitchTexture(line,0);
|
||||
if( EV_DoFloor( line, raiseFloor512 ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
// BUTTONS
|
||||
case 42:
|
||||
// Close Door
|
||||
if (EV_DoDoor(line,closed))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoDoor( line, closed ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 43:
|
||||
// Lower Ceiling to Floor
|
||||
if (EV_DoCeiling(line,lowerToFloor))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoCeiling( line, lowerToFloor ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 45:
|
||||
// Lower Floor to Surrounding floor height
|
||||
if (EV_DoFloor(line,lowerFloor))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoFloor( line, lowerFloor ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 60:
|
||||
// Lower Floor to Lowest
|
||||
if (EV_DoFloor(line,lowerFloorToLowest))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoFloor( line, lowerFloorToLowest ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 61:
|
||||
// Open Door
|
||||
if (EV_DoDoor(line,opened))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoDoor( line, opened ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 62:
|
||||
// PlatDownWaitUpStay
|
||||
if (EV_DoPlat(line,downWaitUpStay,1))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoPlat( line, downWaitUpStay, 1 ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 63:
|
||||
// Raise Door
|
||||
if (EV_DoDoor(line,normal))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoDoor( line, normal ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 64:
|
||||
// Raise Floor to ceiling
|
||||
if (EV_DoFloor(line,raiseFloor))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoFloor( line, raiseFloor ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 66:
|
||||
// Raise Floor 24 and change texture
|
||||
if (EV_DoPlat(line,raiseAndChange,24))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoPlat( line, raiseAndChange, 24 ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 67:
|
||||
// Raise Floor 32 and change texture
|
||||
if (EV_DoPlat(line,raiseAndChange,32))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoPlat( line, raiseAndChange, 32 ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 65:
|
||||
// Raise Floor Crush
|
||||
if (EV_DoFloor(line,raiseFloorCrush))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoFloor( line, raiseFloorCrush ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 68:
|
||||
// Raise Plat to next highest floor and change texture
|
||||
if (EV_DoPlat(line,raiseToNearestAndChange,0))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoPlat( line, raiseToNearestAndChange, 0 ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 69:
|
||||
// Raise Floor to next highest floor
|
||||
if (EV_DoFloor(line, raiseFloorToNearest))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoFloor( line, raiseFloorToNearest ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 70:
|
||||
// Turbo Lower Floor
|
||||
if (EV_DoFloor(line,turboLower))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoFloor( line, turboLower ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 114:
|
||||
// Blazing Door Raise (faster than TURBO!)
|
||||
if (EV_DoDoor (line,blazeRaise))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoDoor( line, blazeRaise ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 115:
|
||||
// Blazing Door Open (faster than TURBO!)
|
||||
if (EV_DoDoor (line,blazeOpen))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoDoor( line, blazeOpen ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 116:
|
||||
// Blazing Door Close (faster than TURBO!)
|
||||
if (EV_DoDoor (line,blazeClose))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoDoor( line, blazeClose ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 123:
|
||||
// Blazing PlatDownWaitUpStay
|
||||
if (EV_DoPlat(line,blazeDWUS,0))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoPlat( line, blazeDWUS, 0 ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 132:
|
||||
// Raise Floor Turbo
|
||||
if (EV_DoFloor(line,raiseFloorTurbo))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoFloor( line, raiseFloorTurbo ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 99:
|
||||
|
@ -636,20 +742,22 @@ P_UseSpecialLine
|
|||
// BlzOpenDoor RED
|
||||
case 136:
|
||||
// BlzOpenDoor YELLOW
|
||||
if (EV_DoLockedDoor (line,blazeOpen,thing))
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
if( EV_DoLockedDoor( line, blazeOpen, thing ) )
|
||||
{
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case 138:
|
||||
// Light Turn On
|
||||
EV_LightTurnOn(line,255);
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
EV_LightTurnOn( line, 255 );
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
break;
|
||||
|
||||
case 139:
|
||||
// Light Turn Off
|
||||
EV_LightTurnOn(line,35);
|
||||
P_ChangeSwitchTexture(line,1);
|
||||
EV_LightTurnOn( line, 35 );
|
||||
P_ChangeSwitchTexture( line, 1 );
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -67,64 +67,80 @@ EV_Teleport
|
|||
fixed_t oldz;
|
||||
|
||||
// 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)
|
||||
if( side == 1 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
tag = line->tag;
|
||||
for (i = 0; i < ::g->numsectors; i++)
|
||||
for( i = 0; i < ::g->numsectors; i++ )
|
||||
{
|
||||
if (::g->sectors[ i ].tag == tag )
|
||||
if( ::g->sectors[ i ].tag == tag )
|
||||
{
|
||||
thinker = ::g->thinkercap.next;
|
||||
for (thinker = ::g->thinkercap.next;
|
||||
for( thinker = ::g->thinkercap.next;
|
||||
thinker != &::g->thinkercap;
|
||||
thinker = thinker->next)
|
||||
thinker = thinker->next )
|
||||
{
|
||||
// not a mobj
|
||||
if (thinker->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
if( thinker->function.acp1 != ( actionf_p1 )P_MobjThinker )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
m = (mobj_t *)thinker;
|
||||
m = ( mobj_t* )thinker;
|
||||
|
||||
// not a teleportman
|
||||
if (m->type != MT_TELEPORTMAN )
|
||||
if( m->type != MT_TELEPORTMAN )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sector = m->subsector->sector;
|
||||
// wrong sector
|
||||
if (sector-::g->sectors != i )
|
||||
if( sector -::g->sectors != i )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
oldx = thing->x;
|
||||
oldy = thing->y;
|
||||
oldz = thing->z;
|
||||
|
||||
if (!P_TeleportMove (thing, m->x, m->y))
|
||||
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;
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
S_StartSound( fog, sfx_telept );
|
||||
|
||||
// don't move for a bit
|
||||
if (thing->player)
|
||||
if( thing->player )
|
||||
{
|
||||
thing->reactiontime = 18;
|
||||
}
|
||||
|
||||
thing->angle = m->angle;
|
||||
thing->momx = thing->momy = thing->momz = 0;
|
||||
|
|
|
@ -52,7 +52,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//
|
||||
// P_InitThinkers
|
||||
//
|
||||
void P_InitThinkers (void)
|
||||
void P_InitThinkers( void )
|
||||
{
|
||||
::g->thinkercap.prev = ::g->thinkercap.next = &::g->thinkercap;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ void P_InitThinkers (void)
|
|||
// P_AddThinker
|
||||
// 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;
|
||||
thinker->next = &::g->thinkercap;
|
||||
|
@ -79,10 +79,10 @@ void P_AddThinker (thinker_t* thinker)
|
|||
// Deallocation is lazy -- it will not actually be freed
|
||||
// until its thinking turn comes up.
|
||||
//
|
||||
void P_RemoveThinker (thinker_t* thinker)
|
||||
void P_RemoveThinker( thinker_t* thinker )
|
||||
{
|
||||
// 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
|
||||
// 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,24 +100,26 @@ void P_AllocateThinker (thinker_t* thinker)
|
|||
//
|
||||
// P_RunThinkers
|
||||
//
|
||||
void P_RunThinkers (void)
|
||||
void P_RunThinkers( void )
|
||||
{
|
||||
thinker_t* currentthinker;
|
||||
|
||||
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
|
||||
currentthinker->next->prev = currentthinker->prev;
|
||||
currentthinker->prev->next = currentthinker->next;
|
||||
Z_Free(currentthinker);
|
||||
Z_Free( currentthinker );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentthinker->function.acp1)
|
||||
currentthinker->function.acp1 ((mobj_t*)currentthinker);
|
||||
if( currentthinker->function.acp1 )
|
||||
{
|
||||
currentthinker->function.acp1( ( mobj_t* )currentthinker );
|
||||
}
|
||||
}
|
||||
currentthinker = currentthinker->next;
|
||||
}
|
||||
|
@ -130,38 +132,43 @@ void P_RunThinkers (void)
|
|||
//
|
||||
extern byte demoversion;
|
||||
|
||||
void P_Ticker (void)
|
||||
void P_Ticker( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
// run the tic
|
||||
if (::g->paused)
|
||||
if( ::g->paused )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// don't think during wipe
|
||||
if ( !::g->netgame && (!::g->demoplayback || demoversion == VERSION ) && ::g->wipe ) {
|
||||
if( !::g->netgame && ( !::g->demoplayback || demoversion == VERSION ) && ::g->wipe )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// pause if in menu and at least one tic has been run
|
||||
if ( !::g->netgame
|
||||
if( !::g->netgame
|
||||
&& ::g->menuactive
|
||||
&& !::g->demoplayback
|
||||
&& ::g->players[::g->consoleplayer].viewz != 1)
|
||||
&& ::g->players[::g->consoleplayer].viewz != 1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (i=0 ; i<MAXPLAYERS ; i++) {
|
||||
if (::g->playeringame[i]) {
|
||||
P_PlayerThink (&::g->players[i]);
|
||||
for( i = 0 ; i < MAXPLAYERS ; i++ )
|
||||
{
|
||||
if( ::g->playeringame[i] )
|
||||
{
|
||||
P_PlayerThink( &::g->players[i] );
|
||||
}
|
||||
}
|
||||
|
||||
P_RunThinkers ();
|
||||
P_UpdateSpecials ();
|
||||
P_RespawnSpecials ();
|
||||
P_RunThinkers();
|
||||
P_UpdateSpecials();
|
||||
P_RespawnSpecials();
|
||||
|
||||
// for par times
|
||||
::g->leveltime++;
|
||||
|
|
|
@ -31,14 +31,14 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
// Called by C_Ticker,
|
||||
// can call G_PlayerExited.
|
||||
// Carries out all thinking of monsters and players.
|
||||
void P_Ticker (void);
|
||||
void P_Ticker( void );
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -62,8 +62,8 @@ P_Thrust
|
|||
{
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
|
||||
player->mo->momx += FixedMul(move,finecosine[angle]);
|
||||
player->mo->momy += FixedMul(move,finesine[angle]);
|
||||
player->mo->momx += FixedMul( move, finecosine[angle] );
|
||||
player->mo->momy += FixedMul( move, finesine[angle] );
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,7 +73,7 @@ P_Thrust
|
|||
// P_CalcHeight
|
||||
// Calculate the walking / running height adjustment
|
||||
//
|
||||
void P_CalcHeight (player_t* player)
|
||||
void P_CalcHeight( player_t* player )
|
||||
{
|
||||
int angle;
|
||||
fixed_t bob;
|
||||
|
@ -85,60 +85,70 @@ void P_CalcHeight (player_t* player)
|
|||
// Note: a LUT allows for effects
|
||||
// like a ramp with low health.
|
||||
player->bob =
|
||||
FixedMul (player->mo->momx, player->mo->momx)
|
||||
+ FixedMul (player->mo->momy,player->mo->momy);
|
||||
FixedMul( player->mo->momx, player->mo->momx )
|
||||
+ FixedMul( player->mo->momy, player->mo->momy );
|
||||
|
||||
player->bob >>= 2;
|
||||
|
||||
// DHM - NERVE :: player bob reduced by 25%, MAXBOB reduced by 25% as well
|
||||
player->bob = (fixed_t)( (float)(player->bob) * 0.75f );
|
||||
if (player->bob>MAXBOB)
|
||||
player->bob = ( fixed_t )( ( float )( player->bob ) * 0.75f );
|
||||
if( 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;
|
||||
|
||||
if (player->viewz > player->mo->ceilingz-4*FRACUNIT)
|
||||
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->z + player->viewheight;
|
||||
return;
|
||||
}
|
||||
|
||||
angle = (FINEANGLES/20*::g->leveltime)&FINEMASK;
|
||||
bob = FixedMul ( player->bob/2, finesine[angle]);
|
||||
angle = ( FINEANGLES / 20 *::g->leveltime )&FINEMASK;
|
||||
bob = FixedMul( player->bob / 2, finesine[angle] );
|
||||
|
||||
|
||||
// move ::g->viewheight
|
||||
if (player->playerstate == PST_LIVE)
|
||||
if( player->playerstate == PST_LIVE )
|
||||
{
|
||||
player->viewheight += player->deltaviewheight;
|
||||
|
||||
if (player->viewheight > VIEWHEIGHT)
|
||||
if( player->viewheight > VIEWHEIGHT )
|
||||
{
|
||||
player->viewheight = VIEWHEIGHT;
|
||||
player->deltaviewheight = 0;
|
||||
}
|
||||
|
||||
if (player->viewheight < VIEWHEIGHT/2)
|
||||
if( player->viewheight < VIEWHEIGHT / 2 )
|
||||
{
|
||||
player->viewheight = VIEWHEIGHT / 2;
|
||||
if( player->deltaviewheight <= 0 )
|
||||
{
|
||||
player->viewheight = VIEWHEIGHT/2;
|
||||
if (player->deltaviewheight <= 0)
|
||||
player->deltaviewheight = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (player->deltaviewheight)
|
||||
if( player->deltaviewheight )
|
||||
{
|
||||
player->deltaviewheight += FRACUNIT / 4;
|
||||
if( !player->deltaviewheight )
|
||||
{
|
||||
player->deltaviewheight += FRACUNIT/4;
|
||||
if (!player->deltaviewheight)
|
||||
player->deltaviewheight = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
player->viewz = player->mo->z + player->viewheight + bob;
|
||||
|
||||
if (player->viewz > player->mo->ceilingz-4*FRACUNIT)
|
||||
player->viewz = player->mo->ceilingz-4*FRACUNIT;
|
||||
if( 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
|
||||
//
|
||||
void P_MovePlayer (player_t* player)
|
||||
void P_MovePlayer( player_t* player )
|
||||
{
|
||||
ticcmd_t* cmd;
|
||||
|
||||
cmd = &player->cmd;
|
||||
|
||||
player->mo->angle += (cmd->angleturn<<16);
|
||||
player->mo->angle += ( cmd->angleturn << 16 );
|
||||
|
||||
// Do not let the player control movement
|
||||
// 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)
|
||||
P_Thrust (player, player->mo->angle, cmd->forwardmove*2048);
|
||||
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->sidemove && ::g->onground )
|
||||
{
|
||||
P_Thrust( player, player->mo->angle - ANG90, cmd->sidemove * 2048 );
|
||||
}
|
||||
|
||||
if ( (cmd->forwardmove || cmd->sidemove)
|
||||
if( ( cmd->forwardmove || cmd->sidemove )
|
||||
&& player->mo->state == &::g->states[S_PLAY] )
|
||||
{
|
||||
P_SetMobjState (player->mo, S_PLAY_RUN1);
|
||||
P_SetMobjState( player->mo, S_PLAY_RUN1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,53 +194,67 @@ void P_MovePlayer (player_t* player)
|
|||
//
|
||||
extern byte demoversion;
|
||||
|
||||
void P_DeathThink (player_t* player)
|
||||
void P_DeathThink( player_t* player )
|
||||
{
|
||||
angle_t angle;
|
||||
angle_t delta;
|
||||
|
||||
P_MovePsprites (player);
|
||||
P_MovePsprites( player );
|
||||
|
||||
// fall to the ground
|
||||
if (player->viewheight > 6*FRACUNIT)
|
||||
if( player->viewheight > 6 * FRACUNIT )
|
||||
{
|
||||
player->viewheight -= FRACUNIT;
|
||||
}
|
||||
|
||||
if (player->viewheight < 6*FRACUNIT)
|
||||
player->viewheight = 6*FRACUNIT;
|
||||
if( player->viewheight < 6 * FRACUNIT )
|
||||
{
|
||||
player->viewheight = 6 * FRACUNIT;
|
||||
}
|
||||
|
||||
player->deltaviewheight = 0;
|
||||
::g->onground = (player->mo->z <= player->mo->floorz);
|
||||
P_CalcHeight (player);
|
||||
::g->onground = ( player->mo->z <= player->mo->floorz );
|
||||
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->attacker->x,
|
||||
player->attacker->y);
|
||||
player->attacker->y );
|
||||
|
||||
delta = angle - player->mo->angle;
|
||||
|
||||
if (delta < ANG5 || delta > (unsigned)-ANG5)
|
||||
if( delta < ANG5 || delta > ( unsigned ) - ANG5 )
|
||||
{
|
||||
// Looking at killer,
|
||||
// so fade damage flash down.
|
||||
player->mo->angle = angle;
|
||||
|
||||
if (player->damagecount)
|
||||
if( player->damagecount )
|
||||
{
|
||||
player->damagecount--;
|
||||
}
|
||||
else if (delta < ANG180)
|
||||
}
|
||||
else if( delta < ANG180 )
|
||||
{
|
||||
player->mo->angle += ANG5;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->angle -= ANG5;
|
||||
}
|
||||
else if (player->damagecount)
|
||||
}
|
||||
else if( player->damagecount )
|
||||
{
|
||||
player->damagecount--;
|
||||
}
|
||||
|
||||
|
||||
if (player->cmd.buttons & BT_USE)
|
||||
if( player->cmd.buttons & BT_USE )
|
||||
{
|
||||
player->playerstate = PST_REBORN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -234,216 +262,261 @@ void P_DeathThink (player_t* player)
|
|||
//
|
||||
// P_PlayerThink
|
||||
//
|
||||
void P_PlayerThink (player_t* player)
|
||||
void P_PlayerThink( player_t* player )
|
||||
{
|
||||
ticcmd_t* cmd;
|
||||
weapontype_t newweapon = wp_fist;
|
||||
|
||||
// fixme: do this in the cheat code
|
||||
if (player->cheats & CF_NOCLIP)
|
||||
if( player->cheats & CF_NOCLIP )
|
||||
{
|
||||
player->mo->flags |= MF_NOCLIP;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->flags &= ~MF_NOCLIP;
|
||||
}
|
||||
|
||||
// chain saw run forward
|
||||
cmd = &player->cmd;
|
||||
if (player->mo->flags & MF_JUSTATTACKED)
|
||||
if( player->mo->flags & MF_JUSTATTACKED )
|
||||
{
|
||||
cmd->angleturn = 0;
|
||||
cmd->forwardmove = 0xc800/512;
|
||||
cmd->forwardmove = 0xc800 / 512;
|
||||
cmd->sidemove = 0;
|
||||
player->mo->flags &= ~MF_JUSTATTACKED;
|
||||
}
|
||||
|
||||
|
||||
if (player->playerstate == PST_DEAD)
|
||||
if( player->playerstate == PST_DEAD )
|
||||
{
|
||||
P_DeathThink (player);
|
||||
P_DeathThink( player );
|
||||
return;
|
||||
}
|
||||
|
||||
// Move around.
|
||||
// Reactiontime is used to prevent movement
|
||||
// for a bit after a teleport.
|
||||
if (player->mo->reactiontime)
|
||||
if( player->mo->reactiontime )
|
||||
{
|
||||
player->mo->reactiontime--;
|
||||
}
|
||||
else
|
||||
P_MovePlayer (player);
|
||||
{
|
||||
P_MovePlayer( player );
|
||||
}
|
||||
|
||||
P_CalcHeight (player);
|
||||
P_CalcHeight( player );
|
||||
|
||||
if (player->mo->subsector->sector->special)
|
||||
P_PlayerInSpecialSector (player);
|
||||
if( player->mo->subsector->sector->special )
|
||||
{
|
||||
P_PlayerInSpecialSector( player );
|
||||
}
|
||||
|
||||
// Check for weapon change.
|
||||
|
||||
// A special event has no other buttons.
|
||||
if (cmd->buttons & BT_SPECIAL)
|
||||
cmd->buttons = 0;
|
||||
|
||||
if (::g->demoplayback && demoversion < VERSION )
|
||||
if( cmd->buttons & BT_SPECIAL )
|
||||
{
|
||||
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
|
||||
// when the weapon psprite can do it
|
||||
// (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->readyweapon == wp_chainsaw
|
||||
&& player->powers[pw_strength]))
|
||||
&& !( player->readyweapon == wp_chainsaw
|
||||
&& player->powers[pw_strength] ) )
|
||||
{
|
||||
newweapon = wp_chainsaw;
|
||||
}
|
||||
|
||||
if ( (::g->gamemode == commercial)
|
||||
if( ( ::g->gamemode == commercial )
|
||||
&& newweapon == wp_shotgun
|
||||
&& player->weaponowned[wp_supershotgun]
|
||||
&& player->readyweapon != wp_supershotgun)
|
||||
&& player->readyweapon != wp_supershotgun )
|
||||
{
|
||||
newweapon = wp_supershotgun;
|
||||
}
|
||||
|
||||
|
||||
if (player->weaponowned[newweapon]
|
||||
&& newweapon != player->readyweapon)
|
||||
if( player->weaponowned[newweapon]
|
||||
&& newweapon != player->readyweapon )
|
||||
{
|
||||
// Do not go to plasma or BFG in shareware,
|
||||
// even if cheated.
|
||||
if ((newweapon != wp_plasma
|
||||
&& newweapon != wp_bfg)
|
||||
|| (::g->gamemode != shareware) )
|
||||
if( ( newweapon != wp_plasma
|
||||
&& newweapon != wp_bfg )
|
||||
|| ( ::g->gamemode != shareware ) )
|
||||
{
|
||||
player->pendingweapon = newweapon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( cmd->buttons & BT_CHANGE )
|
||||
else if( cmd->buttons & BT_CHANGE )
|
||||
{
|
||||
int k, which;
|
||||
// The actual changing of the weapon is done
|
||||
// when the weapon psprite can do it
|
||||
// (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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (newweapon > maxweapon)
|
||||
if( newweapon > maxweapon )
|
||||
{
|
||||
newweapon = wp_fist;
|
||||
}
|
||||
|
||||
|
||||
if (player->weaponowned[newweapon] && newweapon != player->readyweapon)
|
||||
if( player->weaponowned[newweapon] && newweapon != player->readyweapon )
|
||||
{
|
||||
player->pendingweapon = newweapon;
|
||||
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->readyweapon == wp_chainsaw
|
||||
&& player->powers[pw_strength]))
|
||||
&& !( player->readyweapon == wp_chainsaw
|
||||
&& player->powers[pw_strength] ) )
|
||||
{
|
||||
newweapon = wp_chainsaw;
|
||||
}
|
||||
|
||||
if ( (::g->gamemode == commercial)
|
||||
if( ( ::g->gamemode == commercial )
|
||||
&& newweapon == wp_shotgun
|
||||
&& player->weaponowned[wp_supershotgun]
|
||||
&& player->readyweapon != wp_supershotgun)
|
||||
&& player->readyweapon != wp_supershotgun )
|
||||
{
|
||||
newweapon = wp_supershotgun;
|
||||
}
|
||||
|
||||
if ( player->weaponowned[ newweapon ] && newweapon != player->readyweapon ) {
|
||||
if( player->weaponowned[ newweapon ] && newweapon != player->readyweapon )
|
||||
{
|
||||
player->pendingweapon = newweapon;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player->usedown = false;
|
||||
}
|
||||
|
||||
// cycle psprites
|
||||
P_MovePsprites (player);
|
||||
P_MovePsprites( player );
|
||||
|
||||
// Counters, time dependend power ups.
|
||||
|
||||
// Strength counts up to diminish fade.
|
||||
if (player->powers[pw_strength])
|
||||
if( player->powers[pw_strength] )
|
||||
{
|
||||
player->powers[pw_strength]++;
|
||||
}
|
||||
|
||||
if (player->powers[pw_invulnerability])
|
||||
if( 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;
|
||||
}
|
||||
|
||||
if (player->powers[pw_infrared])
|
||||
if( player->powers[pw_infrared] )
|
||||
{
|
||||
player->powers[pw_infrared]--;
|
||||
}
|
||||
|
||||
if (player->powers[pw_ironfeet])
|
||||
if( player->powers[pw_ironfeet] )
|
||||
{
|
||||
player->powers[pw_ironfeet]--;
|
||||
}
|
||||
|
||||
if (player->damagecount)
|
||||
if( player->damagecount )
|
||||
{
|
||||
player->damagecount--;
|
||||
}
|
||||
|
||||
if (player->bonuscount)
|
||||
if( player->bonuscount )
|
||||
{
|
||||
player->bonuscount--;
|
||||
}
|
||||
|
||||
|
||||
// Handling ::g->colormaps.
|
||||
if (player->powers[pw_invulnerability])
|
||||
if( player->powers[pw_invulnerability] )
|
||||
{
|
||||
if( player->powers[pw_invulnerability] > 4 * 32
|
||||
|| ( player->powers[pw_invulnerability] & 8 ) )
|
||||
{
|
||||
if (player->powers[pw_invulnerability] > 4*32
|
||||
|| (player->powers[pw_invulnerability]&8) )
|
||||
player->fixedcolormap = INVERSECOLORMAP;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->fixedcolormap = 0;
|
||||
}
|
||||
else if (player->powers[pw_infrared])
|
||||
}
|
||||
else if( player->powers[pw_infrared] )
|
||||
{
|
||||
if (player->powers[pw_infrared] > 4*32
|
||||
|| (player->powers[pw_infrared]&8) )
|
||||
if( player->powers[pw_infrared] > 4 * 32
|
||||
|| ( player->powers[pw_infrared] & 8 ) )
|
||||
{
|
||||
// almost full bright
|
||||
player->fixedcolormap = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->fixedcolormap = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player->fixedcolormap = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ R_StoreWallRange
|
|||
//
|
||||
// R_ClearDrawSegs
|
||||
//
|
||||
void R_ClearDrawSegs (void)
|
||||
void R_ClearDrawSegs( void )
|
||||
{
|
||||
::g->ds_p = ::g->drawsegs;
|
||||
}
|
||||
|
@ -99,22 +99,24 @@ R_ClipSolidWallSegment
|
|||
// Find the first range that touches the range
|
||||
// (adjacent pixels are touching).
|
||||
start = ::g->solidsegs;
|
||||
while (start->last < first-1)
|
||||
start++;
|
||||
|
||||
if (first < start->first)
|
||||
while( start->last < first - 1 )
|
||||
{
|
||||
if (last < start->first-1)
|
||||
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);
|
||||
R_StoreWallRange( first, last );
|
||||
next = ::g->newend;
|
||||
::g->newend++;
|
||||
|
||||
while (next != start)
|
||||
while( next != start )
|
||||
{
|
||||
*next = *(next-1);
|
||||
*next = *( next - 1 );
|
||||
next--;
|
||||
}
|
||||
next->first = first;
|
||||
|
@ -123,23 +125,25 @@ R_ClipSolidWallSegment
|
|||
}
|
||||
|
||||
// There is a fragment above *start.
|
||||
R_StoreWallRange (first, start->first - 1);
|
||||
R_StoreWallRange( first, start->first - 1 );
|
||||
// Now adjust the clip size.
|
||||
start->first = first;
|
||||
}
|
||||
|
||||
// Bottom contained in start?
|
||||
if (last <= start->last)
|
||||
if( last <= start->last )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
next = start;
|
||||
while (last >= (next+1)->first-1)
|
||||
while( last >= ( next + 1 )->first - 1 )
|
||||
{
|
||||
// There is a fragment between two posts.
|
||||
R_StoreWallRange (next->last + 1, (next+1)->first - 1);
|
||||
R_StoreWallRange( next->last + 1, ( next + 1 )->first - 1 );
|
||||
next++;
|
||||
|
||||
if (last <= next->last)
|
||||
if( last <= next->last )
|
||||
{
|
||||
// Bottom is contained in next.
|
||||
// Adjust the clip size.
|
||||
|
@ -149,27 +153,27 @@ R_ClipSolidWallSegment
|
|||
}
|
||||
|
||||
// There is a fragment after *next.
|
||||
R_StoreWallRange (next->last + 1, last);
|
||||
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)
|
||||
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.
|
||||
*++start = *next;
|
||||
}
|
||||
|
||||
::g->newend = start+1;
|
||||
::g->newend = start + 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -191,38 +195,44 @@ R_ClipPassWallSegment
|
|||
// Find the first range that touches the range
|
||||
// (adjacent pixels are touching).
|
||||
start = ::g->solidsegs;
|
||||
while (start->last < first-1)
|
||||
start++;
|
||||
|
||||
if (first < start->first)
|
||||
while( start->last < first - 1 )
|
||||
{
|
||||
if (last < start->first-1)
|
||||
start++;
|
||||
}
|
||||
|
||||
if( first < start->first )
|
||||
{
|
||||
if( last < start->first - 1 )
|
||||
{
|
||||
// Post is entirely visible (above start).
|
||||
R_StoreWallRange (first, last);
|
||||
R_StoreWallRange( first, last );
|
||||
return;
|
||||
}
|
||||
|
||||
// There is a fragment above *start.
|
||||
R_StoreWallRange (first, start->first - 1);
|
||||
R_StoreWallRange( first, start->first - 1 );
|
||||
}
|
||||
|
||||
// Bottom contained in start?
|
||||
if (last <= start->last)
|
||||
return;
|
||||
|
||||
while (last >= (start+1)->first-1)
|
||||
if( last <= start->last )
|
||||
{
|
||||
// There is a fragment between two posts.
|
||||
R_StoreWallRange (start->last + 1, (start+1)->first - 1);
|
||||
start++;
|
||||
|
||||
if (last <= start->last)
|
||||
return;
|
||||
}
|
||||
|
||||
while( last >= ( start + 1 )->first - 1 )
|
||||
{
|
||||
// There is a fragment between two posts.
|
||||
R_StoreWallRange( start->last + 1, ( start + 1 )->first - 1 );
|
||||
start++;
|
||||
|
||||
if( last <= start->last )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// There is a fragment after *next.
|
||||
R_StoreWallRange (start->last + 1, last);
|
||||
R_StoreWallRange( start->last + 1, last );
|
||||
}
|
||||
|
||||
|
||||
|
@ -230,13 +240,13 @@ R_ClipPassWallSegment
|
|||
//
|
||||
// R_ClearClipSegs
|
||||
//
|
||||
void R_ClearClipSegs (void)
|
||||
void R_ClearClipSegs( void )
|
||||
{
|
||||
::g->solidsegs[0].first = -0x7fffffff;
|
||||
::g->solidsegs[0].last = -1;
|
||||
::g->solidsegs[1].first = ::g->viewwidth;
|
||||
::g->solidsegs[1].last = 0x7fffffff;
|
||||
::g->newend = ::g->solidsegs+2;
|
||||
::g->newend = ::g->solidsegs + 2;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -244,7 +254,7 @@ void R_ClearClipSegs (void)
|
|||
// Clips the given segment
|
||||
// and adds any visible pieces to the line list.
|
||||
//
|
||||
void R_AddLine (seg_t* line)
|
||||
void R_AddLine( seg_t* line )
|
||||
{
|
||||
int x1;
|
||||
int x2;
|
||||
|
@ -256,16 +266,18 @@ void R_AddLine (seg_t* line)
|
|||
::g->curline = line;
|
||||
|
||||
// OPTIMIZE: quickly reject orthogonal back ::g->sides.
|
||||
angle1 = R_PointToAngle (line->v1->x, line->v1->y);
|
||||
angle2 = R_PointToAngle (line->v2->x, line->v2->y);
|
||||
angle1 = R_PointToAngle( line->v1->x, line->v1->y );
|
||||
angle2 = R_PointToAngle( line->v2->x, line->v2->y );
|
||||
|
||||
// Clip to view edges.
|
||||
// OPTIMIZE: make constant out of 2*::g->clipangle (FIELDOFVIEW).
|
||||
span = angle1 - angle2;
|
||||
|
||||
// Back side? I.e. backface culling?
|
||||
if (span >= ANG180)
|
||||
if( span >= ANG180 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
extern angle_t GetViewAngle();
|
||||
// Global angle needed by segcalc.
|
||||
|
@ -274,74 +286,86 @@ void R_AddLine (seg_t* line)
|
|||
angle2 -= GetViewAngle();
|
||||
|
||||
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?
|
||||
if (tspan >= span)
|
||||
if( tspan >= span )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
angle1 = ::g->clipangle;
|
||||
}
|
||||
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?
|
||||
if (tspan >= span)
|
||||
if( tspan >= span )
|
||||
{
|
||||
return;
|
||||
}
|
||||
angle2 = -::g->clipangle; // ALANHACK UNSIGNED
|
||||
}
|
||||
|
||||
// The seg is in the view range,
|
||||
// but not necessarily visible.
|
||||
angle1 = (angle1+ANG90)>>ANGLETOFINESHIFT;
|
||||
angle2 = (angle2+ANG90)>>ANGLETOFINESHIFT;
|
||||
angle1 = ( angle1 + ANG90 ) >> ANGLETOFINESHIFT;
|
||||
angle2 = ( angle2 + ANG90 ) >> ANGLETOFINESHIFT;
|
||||
x1 = ::g->viewangletox[angle1];
|
||||
x2 = ::g->viewangletox[angle2];
|
||||
|
||||
// Does not cross a pixel?
|
||||
if (x1 == x2)
|
||||
if( x1 == x2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
::g->backsector = line->backsector;
|
||||
|
||||
// Single sided line?
|
||||
if (!::g->backsector)
|
||||
if( !::g->backsector )
|
||||
{
|
||||
goto clipsolid;
|
||||
}
|
||||
|
||||
// Closed door.
|
||||
if (::g->backsector->ceilingheight <= ::g->frontsector->floorheight
|
||||
|| ::g->backsector->floorheight >= ::g->frontsector->ceilingheight)
|
||||
if( ::g->backsector->ceilingheight <= ::g->frontsector->floorheight
|
||||
|| ::g->backsector->floorheight >= ::g->frontsector->ceilingheight )
|
||||
{
|
||||
goto clipsolid;
|
||||
}
|
||||
|
||||
// Window.
|
||||
if (::g->backsector->ceilingheight != ::g->frontsector->ceilingheight
|
||||
|| ::g->backsector->floorheight != ::g->frontsector->floorheight)
|
||||
if( ::g->backsector->ceilingheight != ::g->frontsector->ceilingheight
|
||||
|| ::g->backsector->floorheight != ::g->frontsector->floorheight )
|
||||
{
|
||||
goto clippass;
|
||||
}
|
||||
|
||||
// Reject empty ::g->lines used for triggers
|
||||
// and special ::g->events.
|
||||
// Identical floor and ceiling on both ::g->sides,
|
||||
// identical light levels on both ::g->sides,
|
||||
// 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->lightlevel == ::g->frontsector->lightlevel
|
||||
&& ::g->curline->sidedef->midtexture == 0)
|
||||
&& ::g->curline->sidedef->midtexture == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
clippass:
|
||||
R_ClipPassWallSegment (x1, x2-1);
|
||||
clippass:
|
||||
R_ClipPassWallSegment( x1, x2 - 1 );
|
||||
return;
|
||||
|
||||
clipsolid:
|
||||
R_ClipSolidWallSegment (x1, x2-1);
|
||||
clipsolid:
|
||||
R_ClipSolidWallSegment( x1, x2 - 1 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -353,7 +377,7 @@ void R_AddLine (seg_t* line)
|
|||
//
|
||||
|
||||
|
||||
qboolean R_CheckBBox (fixed_t* bspcoord)
|
||||
qboolean R_CheckBBox( fixed_t* bspcoord )
|
||||
{
|
||||
int boxx;
|
||||
int boxy;
|
||||
|
@ -374,26 +398,41 @@ qboolean R_CheckBBox (fixed_t* bspcoord)
|
|||
int sx1;
|
||||
int sx2;
|
||||
|
||||
extern fixed_t GetViewX(); extern fixed_t GetViewY();
|
||||
extern fixed_t GetViewX();
|
||||
extern fixed_t GetViewY();
|
||||
// Find the corners of the box
|
||||
// that define the edges from current viewpoint.
|
||||
if (GetViewX() <= bspcoord[BOXLEFT])
|
||||
if( GetViewX() <= bspcoord[BOXLEFT] )
|
||||
{
|
||||
boxx = 0;
|
||||
else if (GetViewX() < bspcoord[BOXRIGHT])
|
||||
}
|
||||
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])
|
||||
}
|
||||
else if( GetViewY() > bspcoord[BOXBOTTOM] )
|
||||
{
|
||||
boxy = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
boxy = 2;
|
||||
}
|
||||
|
||||
boxpos = (boxy<<2)+boxx;
|
||||
if (boxpos == 5)
|
||||
boxpos = ( boxy << 2 ) + boxx;
|
||||
if( boxpos == 5 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
x1 = bspcoord[::g->checkcoord[boxpos][0]];
|
||||
y1 = bspcoord[::g->checkcoord[boxpos][1]];
|
||||
|
@ -402,35 +441,41 @@ qboolean R_CheckBBox (fixed_t* bspcoord)
|
|||
|
||||
// check clip list for an open space
|
||||
extern angle_t GetViewAngle();
|
||||
angle1 = R_PointToAngle (x1, y1) - GetViewAngle();
|
||||
angle2 = R_PointToAngle (x2, y2) - GetViewAngle();
|
||||
angle1 = R_PointToAngle( x1, y1 ) - GetViewAngle();
|
||||
angle2 = R_PointToAngle( x2, y2 ) - GetViewAngle();
|
||||
|
||||
span = angle1 - angle2;
|
||||
|
||||
// Sitting on a line?
|
||||
if (span >= ANG180)
|
||||
if( span >= ANG180 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
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?
|
||||
if (tspan >= span)
|
||||
if( tspan >= span )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
angle1 = ::g->clipangle;
|
||||
}
|
||||
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?
|
||||
if (tspan >= span)
|
||||
if( tspan >= span )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
angle2 = -::g->clipangle;// ALANHACK UNSIGNED
|
||||
}
|
||||
|
@ -439,22 +484,26 @@ qboolean R_CheckBBox (fixed_t* bspcoord)
|
|||
// Find the first clippost
|
||||
// that touches the source post
|
||||
// (adjacent pixels are touching).
|
||||
angle1 = (angle1+ANG90)>>ANGLETOFINESHIFT;
|
||||
angle2 = (angle2+ANG90)>>ANGLETOFINESHIFT;
|
||||
angle1 = ( angle1 + ANG90 ) >> ANGLETOFINESHIFT;
|
||||
angle2 = ( angle2 + ANG90 ) >> ANGLETOFINESHIFT;
|
||||
sx1 = ::g->viewangletox[angle1];
|
||||
sx2 = ::g->viewangletox[angle2];
|
||||
|
||||
// Does not cross a pixel.
|
||||
if (sx1 == sx2)
|
||||
if( sx1 == sx2 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
sx2--;
|
||||
|
||||
start = ::g->solidsegs;
|
||||
while (start->last < sx2)
|
||||
while( start->last < sx2 )
|
||||
{
|
||||
start++;
|
||||
}
|
||||
|
||||
if (sx1 >= start->first
|
||||
&& sx2 <= start->last)
|
||||
if( sx1 >= start->first
|
||||
&& sx2 <= start->last )
|
||||
{
|
||||
// The clippost contains the new span.
|
||||
return false;
|
||||
|
@ -471,17 +520,17 @@ qboolean R_CheckBBox (fixed_t* bspcoord)
|
|||
// Add ::g->sprites of things in sector.
|
||||
// Draw one or more line segments.
|
||||
//
|
||||
void R_Subsector (int num)
|
||||
void R_Subsector( int num )
|
||||
{
|
||||
int count;
|
||||
seg_t* line;
|
||||
subsector_t* sub;
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if (num>=::g->numsubsectors)
|
||||
I_Error ("R_Subsector: ss %i with numss = %i",
|
||||
if( num >=::g->numsubsectors )
|
||||
I_Error( "R_Subsector: ss %i with numss = %i",
|
||||
num,
|
||||
::g->numsubsectors);
|
||||
::g->numsubsectors );
|
||||
#endif
|
||||
|
||||
::g->sscount++;
|
||||
|
@ -490,30 +539,34 @@ void R_Subsector (int num)
|
|||
count = sub->numlines;
|
||||
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->lightlevel);
|
||||
::g->frontsector->lightlevel );
|
||||
}
|
||||
else
|
||||
{
|
||||
::g->floorplane = NULL;
|
||||
}
|
||||
|
||||
if (::g->frontsector->ceilingheight > ::g->viewz
|
||||
|| ::g->frontsector->ceilingpic == ::g->skyflatnum)
|
||||
if( ::g->frontsector->ceilingheight > ::g->viewz
|
||||
|| ::g->frontsector->ceilingpic == ::g->skyflatnum )
|
||||
{
|
||||
::g->ceilingplane = R_FindPlane (::g->frontsector->ceilingheight,
|
||||
::g->ceilingplane = R_FindPlane( ::g->frontsector->ceilingheight,
|
||||
::g->frontsector->ceilingpic,
|
||||
::g->frontsector->lightlevel);
|
||||
::g->frontsector->lightlevel );
|
||||
}
|
||||
else
|
||||
::g->ceilingplane = NULL;
|
||||
|
||||
R_AddSprites (::g->frontsector);
|
||||
|
||||
while (count--)
|
||||
{
|
||||
R_AddLine (line);
|
||||
::g->ceilingplane = NULL;
|
||||
}
|
||||
|
||||
R_AddSprites( ::g->frontsector );
|
||||
|
||||
while( count-- )
|
||||
{
|
||||
R_AddLine( line );
|
||||
line++;
|
||||
}
|
||||
}
|
||||
|
@ -526,33 +579,40 @@ void R_Subsector (int num)
|
|||
// Renders all ::g->subsectors below a given node,
|
||||
// traversing subtree recursively.
|
||||
// Just call with BSP root.
|
||||
void R_RenderBSPNode (int bspnum)
|
||||
void R_RenderBSPNode( int bspnum )
|
||||
{
|
||||
node_t* bsp;
|
||||
int side;
|
||||
|
||||
// Found a subsector?
|
||||
if (bspnum & NF_SUBSECTOR)
|
||||
if( bspnum & NF_SUBSECTOR )
|
||||
{
|
||||
if (bspnum == -1)
|
||||
R_Subsector (0);
|
||||
if( bspnum == -1 )
|
||||
{
|
||||
R_Subsector( 0 );
|
||||
}
|
||||
else
|
||||
R_Subsector (bspnum&(~NF_SUBSECTOR));
|
||||
{
|
||||
R_Subsector( bspnum & ( ~NF_SUBSECTOR ) );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
bsp = &::g->nodes[bspnum];
|
||||
|
||||
extern fixed_t GetViewX(); extern fixed_t GetViewY();
|
||||
extern fixed_t GetViewX();
|
||||
extern fixed_t GetViewY();
|
||||
// Decide which side the view point is on.
|
||||
side = R_PointOnSide (GetViewX(), GetViewY(), bsp);
|
||||
side = R_PointOnSide( GetViewX(), GetViewY(), bsp );
|
||||
|
||||
// Recursively divide front space.
|
||||
R_RenderBSPNode (bsp->children[side]);
|
||||
R_RenderBSPNode( bsp->children[side] );
|
||||
|
||||
// Possibly divide back space.
|
||||
if (R_CheckBBox (bsp->bbox[side^1]))
|
||||
R_RenderBSPNode (bsp->children[side^1]);
|
||||
if( R_CheckBBox( bsp->bbox[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__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -59,15 +59,15 @@ extern lighttable_t** vscalelight;
|
|||
extern lighttable_t** dscalelight;
|
||||
|
||||
|
||||
typedef void (*drawfunc_t) (int start, int stop);
|
||||
typedef void ( *drawfunc_t )( int start, int stop );
|
||||
|
||||
|
||||
// BSP?
|
||||
void R_ClearClipSegs (void);
|
||||
void R_ClearDrawSegs (void);
|
||||
void R_ClearClipSegs( void );
|
||||
void R_ClearDrawSegs( void );
|
||||
|
||||
|
||||
void R_RenderBSPNode (int bspnum);
|
||||
void R_RenderBSPNode( int bspnum );
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -44,7 +44,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "r_sky.h"
|
||||
|
||||
#ifdef LINUX
|
||||
#include <alloca.h>
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -130,27 +130,31 @@ R_DrawColumnInCache
|
|||
byte* source;
|
||||
byte* dest;
|
||||
|
||||
dest = (byte *)cache + 3;
|
||||
dest = ( byte* )cache + 3;
|
||||
|
||||
while (patch->topdelta != 0xff)
|
||||
while( patch->topdelta != 0xff )
|
||||
{
|
||||
source = (byte *)patch + 3;
|
||||
source = ( byte* )patch + 3;
|
||||
count = patch->length;
|
||||
position = originy + patch->topdelta;
|
||||
|
||||
if (position < 0)
|
||||
if( position < 0 )
|
||||
{
|
||||
count += position;
|
||||
position = 0;
|
||||
}
|
||||
|
||||
if (position + count > cacheheight)
|
||||
if( position + count > cacheheight )
|
||||
{
|
||||
count = cacheheight - position;
|
||||
}
|
||||
|
||||
if (count > 0)
|
||||
memcpy (cache + position, source, count);
|
||||
if( count > 0 )
|
||||
{
|
||||
memcpy( cache + position, source, count );
|
||||
}
|
||||
|
||||
patch = (postColumn_t *)( (byte *)patch + patch->length + 4);
|
||||
patch = ( postColumn_t* )( ( byte* )patch + patch->length + 4 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,7 +166,7 @@ R_DrawColumnInCache
|
|||
// the composite texture is created from the patches,
|
||||
// and each column is cached.
|
||||
//
|
||||
void R_GenerateComposite (int texnum)
|
||||
void R_GenerateComposite( int texnum )
|
||||
{
|
||||
byte* block;
|
||||
texture_t* texture;
|
||||
|
@ -178,9 +182,9 @@ void R_GenerateComposite (int texnum)
|
|||
|
||||
texture = ::g->s_textures[texnum];
|
||||
|
||||
block = (byte*)DoomLib::Z_Malloc (::g->s_texturecompositesize[texnum],
|
||||
block = ( byte* )DoomLib::Z_Malloc( ::g->s_texturecompositesize[texnum],
|
||||
PU_CACHE_SHARED,
|
||||
&::g->s_texturecomposite[texnum]);
|
||||
&::g->s_texturecomposite[texnum] );
|
||||
|
||||
collump = ::g->s_texturecolumnlump[texnum];
|
||||
colofs = ::g->s_texturecolumnofs[texnum];
|
||||
|
@ -188,34 +192,42 @@ void R_GenerateComposite (int texnum)
|
|||
// Composite the columns together.
|
||||
patch = texture->patches;
|
||||
|
||||
for (i=0 , patch = texture->patches;
|
||||
i<texture->patchcount;
|
||||
i++, patch++)
|
||||
for( i = 0 , patch = texture->patches;
|
||||
i < texture->patchcount;
|
||||
i++, patch++ )
|
||||
{
|
||||
realpatch = (patch_t*)W_CacheLumpNum (patch->patch, PU_CACHE_SHARED);
|
||||
realpatch = ( patch_t* )W_CacheLumpNum( patch->patch, PU_CACHE_SHARED );
|
||||
x1 = patch->originx;
|
||||
x2 = x1 + SHORT(realpatch->width);
|
||||
x2 = x1 + SHORT( realpatch->width );
|
||||
|
||||
if (x1<0)
|
||||
if( x1 < 0 )
|
||||
{
|
||||
x = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = x1;
|
||||
}
|
||||
|
||||
if (x2 > texture->width)
|
||||
if( x2 > texture->width )
|
||||
{
|
||||
x2 = texture->width;
|
||||
}
|
||||
|
||||
for ( ; x<x2 ; x++)
|
||||
for( ; x < x2 ; x++ )
|
||||
{
|
||||
// Column does not have multiple patches?
|
||||
if (collump[x] >= 0)
|
||||
if( collump[x] >= 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
patchcol = (postColumn_t *)((byte *)realpatch
|
||||
+ LONG(realpatch->columnofs[x-x1]));
|
||||
R_DrawColumnInCache (patchcol,
|
||||
patchcol = ( postColumn_t* )( ( byte* )realpatch
|
||||
+ LONG( realpatch->columnofs[x - x1] ) );
|
||||
R_DrawColumnInCache( patchcol,
|
||||
block + colofs[x],
|
||||
patch->originy,
|
||||
texture->height);
|
||||
texture->height );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -226,7 +238,7 @@ void R_GenerateComposite (int texnum)
|
|||
//
|
||||
// R_GenerateLookup
|
||||
//
|
||||
void R_GenerateLookup (int texnum)
|
||||
void R_GenerateLookup( int texnum )
|
||||
{
|
||||
texture_t* texture;
|
||||
texpatch_t* patch;
|
||||
|
@ -251,52 +263,58 @@ void R_GenerateLookup (int texnum)
|
|||
// that are covered by more than one patch.
|
||||
// Fill in the lump / offset, so columns
|
||||
// with only a single patch are all done.
|
||||
std::vector<byte> patchcount(texture->width, 0);
|
||||
std::vector<byte> patchcount( texture->width, 0 );
|
||||
patch = texture->patches;
|
||||
|
||||
for (i=0 , patch = texture->patches;
|
||||
i<texture->patchcount;
|
||||
i++, patch++)
|
||||
for( i = 0 , patch = texture->patches;
|
||||
i < texture->patchcount;
|
||||
i++, patch++ )
|
||||
{
|
||||
realpatch = (patch_t*)W_CacheLumpNum (patch->patch, PU_CACHE_SHARED);
|
||||
realpatch = ( patch_t* )W_CacheLumpNum( patch->patch, PU_CACHE_SHARED );
|
||||
x1 = patch->originx;
|
||||
x2 = x1 + SHORT(realpatch->width);
|
||||
x2 = x1 + SHORT( realpatch->width );
|
||||
|
||||
if (x1 < 0)
|
||||
if( x1 < 0 )
|
||||
{
|
||||
x = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = x1;
|
||||
}
|
||||
|
||||
if (x2 > texture->width)
|
||||
if( x2 > texture->width )
|
||||
{
|
||||
x2 = texture->width;
|
||||
for ( ; x<x2 ; x++)
|
||||
}
|
||||
for( ; x < x2 ; x++ )
|
||||
{
|
||||
patchcount[x]++;
|
||||
collump[x] = patch->patch;
|
||||
colofs[x] = LONG(realpatch->columnofs[x-x1])+3;
|
||||
colofs[x] = LONG( realpatch->columnofs[x - x1] ) + 3;
|
||||
}
|
||||
}
|
||||
|
||||
for (x=0 ; x<texture->width ; x++)
|
||||
for( x = 0 ; x < texture->width ; x++ )
|
||||
{
|
||||
if (!patchcount[x])
|
||||
if( !patchcount[x] )
|
||||
{
|
||||
I_Printf ("R_GenerateLookup: column without a patch (%s)\n",
|
||||
texture->name);
|
||||
I_Printf( "R_GenerateLookup: column without a patch (%s)\n",
|
||||
texture->name );
|
||||
return;
|
||||
}
|
||||
// I_Error ("R_GenerateLookup: column without a patch");
|
||||
|
||||
if (patchcount[x] > 1)
|
||||
if( patchcount[x] > 1 )
|
||||
{
|
||||
// Use the cached block.
|
||||
collump[x] = -1;
|
||||
colofs[x] = ::g->s_texturecompositesize[texnum];
|
||||
|
||||
if (::g->s_texturecompositesize[texnum] > 0x10000-texture->height)
|
||||
if( ::g->s_texturecompositesize[texnum] > 0x10000 - texture->height )
|
||||
{
|
||||
I_Error ("R_GenerateLookup: texture %i is >64k",
|
||||
texnum);
|
||||
I_Error( "R_GenerateLookup: texture %i is >64k",
|
||||
texnum );
|
||||
}
|
||||
|
||||
::g->s_texturecompositesize[texnum] += texture->height;
|
||||
|
@ -322,11 +340,15 @@ R_GetColumn
|
|||
lump = ::g->s_texturecolumnlump[tex][col];
|
||||
ofs = ::g->s_texturecolumnofs[tex][col];
|
||||
|
||||
if (lump > 0)
|
||||
return (byte *)W_CacheLumpNum(lump,PU_CACHE_SHARED)+ofs;
|
||||
if( lump > 0 )
|
||||
{
|
||||
return ( byte* )W_CacheLumpNum( lump, PU_CACHE_SHARED ) + ofs;
|
||||
}
|
||||
|
||||
if (!::g->s_texturecomposite[tex])
|
||||
R_GenerateComposite (tex);
|
||||
if( !::g->s_texturecomposite[tex] )
|
||||
{
|
||||
R_GenerateComposite( tex );
|
||||
}
|
||||
|
||||
return ::g->s_texturecomposite[tex] + ofs;
|
||||
}
|
||||
|
@ -339,7 +361,7 @@ R_GetColumn
|
|||
// Initializes the texture list
|
||||
// with the s_textures from the world map.
|
||||
//
|
||||
void R_InitTextures (void)
|
||||
void R_InitTextures( void )
|
||||
{
|
||||
maptexture_t* mtexture;
|
||||
texture_t* texture;
|
||||
|
@ -374,35 +396,35 @@ void R_InitTextures (void)
|
|||
|
||||
// Load the patch names from pnames.lmp.
|
||||
name[8] = 0;
|
||||
names = (char*)W_CacheLumpName ("PNAMES", PU_CACHE_SHARED);
|
||||
nummappatches = LONG ( *((int *)names) );
|
||||
name_p = names+4;
|
||||
names = ( char* )W_CacheLumpName( "PNAMES", PU_CACHE_SHARED );
|
||||
nummappatches = LONG( *( ( int* )names ) );
|
||||
name_p = names + 4;
|
||||
|
||||
std::vector<int> patchlookup(nummappatches);
|
||||
std::vector<int> patchlookup( nummappatches );
|
||||
|
||||
for (i=0 ; i<nummappatches ; i++)
|
||||
for( i = 0 ; i < nummappatches ; i++ )
|
||||
{
|
||||
strncpy (name,name_p+i*8, 8);
|
||||
patchlookup[i] = W_CheckNumForName (name);
|
||||
strncpy( name, name_p + i * 8, 8 );
|
||||
patchlookup[i] = W_CheckNumForName( name );
|
||||
}
|
||||
Z_Free(names);
|
||||
Z_Free( names );
|
||||
|
||||
if (::g->s_numtextures == 0)
|
||||
if( ::g->s_numtextures == 0 )
|
||||
{
|
||||
|
||||
// Load the map texture definitions from textures.lmp.
|
||||
// The data is contained in one or two lumps,
|
||||
// TEXTURE1 for shareware, plus TEXTURE2 for commercial.
|
||||
maptex = maptex1 = (int*)W_CacheLumpName ("TEXTURE1", PU_CACHE_SHARED); // ALAN: LOADTIME
|
||||
numtextures1 = LONG(*maptex);
|
||||
maxoff = W_LumpLength (W_GetNumForName ("TEXTURE1"));
|
||||
directory = maptex+1;
|
||||
maptex = maptex1 = ( int* )W_CacheLumpName( "TEXTURE1", PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||
numtextures1 = LONG( *maptex );
|
||||
maxoff = W_LumpLength( W_GetNumForName( "TEXTURE1" ) );
|
||||
directory = maptex + 1;
|
||||
|
||||
if (W_CheckNumForName ("TEXTURE2") != -1)
|
||||
if( W_CheckNumForName( "TEXTURE2" ) != -1 )
|
||||
{
|
||||
maptex2 = (int*)W_CacheLumpName ("TEXTURE2", PU_CACHE_SHARED); // ALAN: LOADTIME
|
||||
numtextures2 = LONG(*maptex2);
|
||||
maxoff2 = W_LumpLength (W_GetNumForName ("TEXTURE2"));
|
||||
maptex2 = ( int* )W_CacheLumpName( "TEXTURE2", PU_CACHE_SHARED ); // ALAN: LOADTIME
|
||||
numtextures2 = LONG( *maptex2 );
|
||||
maxoff2 = W_LumpLength( W_GetNumForName( "TEXTURE2" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -414,99 +436,115 @@ void R_InitTextures (void)
|
|||
|
||||
::g->s_numtextures = numtextures1 + numtextures2;
|
||||
|
||||
::g->s_textures = (texture_t**)DoomLib::Z_Malloc (::g->s_numtextures*sizeof(texture_t*), PU_STATIC_SHARED, 0);
|
||||
::g->s_texturecolumnlump = (short**)DoomLib::Z_Malloc (::g->s_numtextures*sizeof(short*), PU_STATIC_SHARED, 0);
|
||||
::g->s_texturecolumnofs = (unsigned short**)DoomLib::Z_Malloc (::g->s_numtextures*sizeof(unsigned short*), PU_STATIC_SHARED, 0);
|
||||
::g->s_texturewidthmask = (int*)DoomLib::Z_Malloc (::g->s_numtextures*4, PU_STATIC_SHARED, 0);
|
||||
::g->s_textureheight = (fixed_t*)DoomLib::Z_Malloc (::g->s_numtextures*4, PU_STATIC_SHARED, 0);
|
||||
::g->s_texturecomposite = (byte**)DoomLib::Z_Malloc (::g->s_numtextures*sizeof(byte*), PU_STATIC_SHARED, 0);
|
||||
::g->s_texturecompositesize = (int*)DoomLib::Z_Malloc (::g->s_numtextures*4, PU_STATIC_SHARED, 0);
|
||||
::g->s_textures = ( texture_t** )DoomLib::Z_Malloc( ::g->s_numtextures * sizeof( texture_t* ), PU_STATIC_SHARED, 0 );
|
||||
::g->s_texturecolumnlump = ( short** )DoomLib::Z_Malloc( ::g->s_numtextures * sizeof( short* ), PU_STATIC_SHARED, 0 );
|
||||
::g->s_texturecolumnofs = ( unsigned short** )DoomLib::Z_Malloc( ::g->s_numtextures * sizeof( unsigned short* ), PU_STATIC_SHARED, 0 );
|
||||
::g->s_texturewidthmask = ( int* )DoomLib::Z_Malloc( ::g->s_numtextures * 4, PU_STATIC_SHARED, 0 );
|
||||
::g->s_textureheight = ( fixed_t* )DoomLib::Z_Malloc( ::g->s_numtextures * 4, PU_STATIC_SHARED, 0 );
|
||||
::g->s_texturecomposite = ( byte** )DoomLib::Z_Malloc( ::g->s_numtextures * sizeof( byte* ), PU_STATIC_SHARED, 0 );
|
||||
::g->s_texturecompositesize = ( int* )DoomLib::Z_Malloc( ::g->s_numtextures * 4, PU_STATIC_SHARED, 0 );
|
||||
|
||||
totalwidth = 0;
|
||||
|
||||
// Really complex printing shit...
|
||||
temp1 = W_GetNumForName ("S_START"); // P_???????
|
||||
temp2 = W_GetNumForName ("S_END") - 1;
|
||||
temp3 = ((temp2-temp1+63)/64) + ((::g->s_numtextures+63)/64);
|
||||
I_Printf("[");
|
||||
for (i = 0; i < temp3; i++)
|
||||
I_Printf(" ");
|
||||
I_Printf(" ]");
|
||||
for (i = 0; i < temp3; i++)
|
||||
I_Printf("\x8");
|
||||
I_Printf("\x8\x8\x8\x8\x8\x8\x8\x8\x8\x8");
|
||||
|
||||
for (i=0 ; i < ::g->s_numtextures ; i++, directory++)
|
||||
temp1 = W_GetNumForName( "S_START" ); // P_???????
|
||||
temp2 = W_GetNumForName( "S_END" ) - 1;
|
||||
temp3 = ( ( temp2 - temp1 + 63 ) / 64 ) + ( ( ::g->s_numtextures + 63 ) / 64 );
|
||||
I_Printf( "[" );
|
||||
for( i = 0; i < temp3; i++ )
|
||||
{
|
||||
if (!(i&63))
|
||||
I_Printf (".");
|
||||
I_Printf( " " );
|
||||
}
|
||||
I_Printf( " ]" );
|
||||
for( i = 0; i < temp3; i++ )
|
||||
{
|
||||
I_Printf( "\x8" );
|
||||
}
|
||||
I_Printf( "\x8\x8\x8\x8\x8\x8\x8\x8\x8\x8" );
|
||||
|
||||
if (i == numtextures1)
|
||||
for( i = 0 ; i < ::g->s_numtextures ; i++, directory++ )
|
||||
{
|
||||
if( !( i & 63 ) )
|
||||
{
|
||||
I_Printf( "." );
|
||||
}
|
||||
|
||||
if( i == numtextures1 )
|
||||
{
|
||||
// Start looking in second texture file.
|
||||
maptex = maptex2;
|
||||
maxoff = maxoff2;
|
||||
directory = maptex+1;
|
||||
directory = maptex + 1;
|
||||
}
|
||||
|
||||
offset = LONG(*directory);
|
||||
offset = LONG( *directory );
|
||||
|
||||
if (offset > maxoff)
|
||||
I_Error ("R_InitTextures: bad texture directory");
|
||||
if( offset > maxoff )
|
||||
{
|
||||
I_Error( "R_InitTextures: bad texture directory" );
|
||||
}
|
||||
|
||||
mtexture = (maptexture_t *) ( (byte *)maptex + offset);
|
||||
mtexture = ( maptexture_t* )( ( byte* )maptex + offset );
|
||||
|
||||
texture = ::g->s_textures[i] = (texture_t*)DoomLib::Z_Malloc (sizeof(texture_t)
|
||||
+ sizeof(texpatch_t)*(SHORT(mtexture->patchcount)-1), PU_STATIC_SHARED, 0);
|
||||
texture = ::g->s_textures[i] = ( texture_t* )DoomLib::Z_Malloc( sizeof( texture_t )
|
||||
+ sizeof( texpatch_t ) * ( SHORT( mtexture->patchcount ) - 1 ), PU_STATIC_SHARED, 0 );
|
||||
|
||||
texture->width = SHORT(mtexture->width);
|
||||
texture->height = SHORT(mtexture->height);
|
||||
texture->patchcount = SHORT(mtexture->patchcount);
|
||||
texture->width = SHORT( mtexture->width );
|
||||
texture->height = SHORT( mtexture->height );
|
||||
texture->patchcount = SHORT( mtexture->patchcount );
|
||||
|
||||
memcpy (texture->name, mtexture->name, sizeof(texture->name));
|
||||
memcpy( texture->name, mtexture->name, sizeof( texture->name ) );
|
||||
mpatch = &mtexture->patches[0];
|
||||
patch = &texture->patches[0];
|
||||
|
||||
for (j=0 ; j<texture->patchcount ; j++, mpatch++, patch++)
|
||||
for( j = 0 ; j < texture->patchcount ; j++, mpatch++, patch++ )
|
||||
{
|
||||
patch->originx = SHORT(mpatch->originx);
|
||||
patch->originy = SHORT(mpatch->originy);
|
||||
patch->patch = patchlookup[SHORT(mpatch->patch)];
|
||||
if (patch->patch == -1)
|
||||
patch->originx = SHORT( mpatch->originx );
|
||||
patch->originy = SHORT( mpatch->originy );
|
||||
patch->patch = patchlookup[SHORT( mpatch->patch )];
|
||||
if( patch->patch == -1 )
|
||||
{
|
||||
I_Error ("R_InitTextures: Missing patch in texture %s",
|
||||
texture->name);
|
||||
I_Error( "R_InitTextures: Missing patch in texture %s",
|
||||
texture->name );
|
||||
}
|
||||
}
|
||||
::g->s_texturecolumnlump[i] = (short*)DoomLib::Z_Malloc (texture->width*2, PU_STATIC_SHARED,0);
|
||||
::g->s_texturecolumnofs[i] = (unsigned short*)DoomLib::Z_Malloc (texture->width*2, PU_STATIC_SHARED,0);
|
||||
::g->s_texturecolumnlump[i] = ( short* )DoomLib::Z_Malloc( texture->width * 2, PU_STATIC_SHARED, 0 );
|
||||
::g->s_texturecolumnofs[i] = ( unsigned short* )DoomLib::Z_Malloc( texture->width * 2, PU_STATIC_SHARED, 0 );
|
||||
|
||||
j = 1;
|
||||
while (j*2 <= texture->width)
|
||||
j<<=1;
|
||||
while( j * 2 <= texture->width )
|
||||
{
|
||||
j <<= 1;
|
||||
}
|
||||
|
||||
::g->s_texturewidthmask[i] = j-1;
|
||||
::g->s_textureheight[i] = texture->height<<FRACBITS;
|
||||
::g->s_texturewidthmask[i] = j - 1;
|
||||
::g->s_textureheight[i] = texture->height << FRACBITS;
|
||||
|
||||
totalwidth += texture->width;
|
||||
}
|
||||
|
||||
Z_Free(maptex1);
|
||||
if (maptex2)
|
||||
Z_Free(maptex2);
|
||||
Z_Free( maptex1 );
|
||||
if( maptex2 )
|
||||
{
|
||||
Z_Free( maptex2 );
|
||||
}
|
||||
|
||||
|
||||
// Precalculate whatever possible.
|
||||
for (i=0 ; i < ::g->s_numtextures ; i++)
|
||||
R_GenerateLookup (i);
|
||||
for( i = 0 ; i < ::g->s_numtextures ; i++ )
|
||||
{
|
||||
R_GenerateLookup( i );
|
||||
}
|
||||
}
|
||||
|
||||
// ALAN: These animations are done globally -- can it be shared?
|
||||
// Create translation table for global animation.
|
||||
::g->texturetranslation = (int*)DoomLib::Z_Malloc ((::g->s_numtextures+1)*4, PU_STATIC, 0);
|
||||
::g->texturetranslation = ( int* )DoomLib::Z_Malloc( ( ::g->s_numtextures + 1 ) * 4, PU_STATIC, 0 );
|
||||
|
||||
for (i=0 ; i < ::g->s_numtextures ; i++)
|
||||
for( i = 0 ; i < ::g->s_numtextures ; i++ )
|
||||
{
|
||||
::g->texturetranslation[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -514,19 +552,21 @@ void R_InitTextures (void)
|
|||
//
|
||||
// R_InitFlats
|
||||
//
|
||||
void R_InitFlats (void)
|
||||
void R_InitFlats( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
::g->firstflat = W_GetNumForName ("F_START") + 1;
|
||||
::g->lastflat = W_GetNumForName ("F_END") - 1;
|
||||
::g->firstflat = W_GetNumForName( "F_START" ) + 1;
|
||||
::g->lastflat = W_GetNumForName( "F_END" ) - 1;
|
||||
::g->numflats = ::g->lastflat - ::g->firstflat + 1;
|
||||
|
||||
// Create translation table for global animation.
|
||||
::g->flattranslation = (int*)DoomLib::Z_Malloc ((::g->numflats+1)*4, PU_STATIC, 0);
|
||||
::g->flattranslation = ( int* )DoomLib::Z_Malloc( ( ::g->numflats + 1 ) * 4, PU_STATIC, 0 );
|
||||
|
||||
for (i=0 ; i < ::g->numflats ; i++)
|
||||
for( i = 0 ; i < ::g->numflats ; i++ )
|
||||
{
|
||||
::g->flattranslation[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -536,28 +576,30 @@ void R_InitFlats (void)
|
|||
// so the sprite does not need to be cached completely
|
||||
// just for having the header info ready during rendering.
|
||||
//
|
||||
void R_InitSpriteLumps (void)
|
||||
void R_InitSpriteLumps( void )
|
||||
{
|
||||
int i;
|
||||
patch_t *patch;
|
||||
patch_t* patch;
|
||||
|
||||
::g->firstspritelump = W_GetNumForName ("S_START") + 1;
|
||||
::g->lastspritelump = W_GetNumForName ("S_END") - 1;
|
||||
::g->firstspritelump = W_GetNumForName( "S_START" ) + 1;
|
||||
::g->lastspritelump = W_GetNumForName( "S_END" ) - 1;
|
||||
|
||||
::g->numspritelumps = ::g->lastspritelump - ::g->firstspritelump + 1;
|
||||
::g->spritewidth = (fixed_t*)DoomLib::Z_Malloc (::g->numspritelumps*4, PU_STATIC, 0);
|
||||
::g->spriteoffset = (fixed_t*)DoomLib::Z_Malloc (::g->numspritelumps*4, PU_STATIC, 0);
|
||||
::g->spritetopoffset = (fixed_t*)DoomLib::Z_Malloc (::g->numspritelumps*4, PU_STATIC, 0);
|
||||
::g->spritewidth = ( fixed_t* )DoomLib::Z_Malloc( ::g->numspritelumps * 4, PU_STATIC, 0 );
|
||||
::g->spriteoffset = ( fixed_t* )DoomLib::Z_Malloc( ::g->numspritelumps * 4, PU_STATIC, 0 );
|
||||
::g->spritetopoffset = ( fixed_t* )DoomLib::Z_Malloc( ::g->numspritelumps * 4, PU_STATIC, 0 );
|
||||
|
||||
for (i=0 ; i< ::g->numspritelumps ; i++)
|
||||
for( i = 0 ; i < ::g->numspritelumps ; i++ )
|
||||
{
|
||||
if (!(i&63))
|
||||
I_Printf (".");
|
||||
if( !( i & 63 ) )
|
||||
{
|
||||
I_Printf( "." );
|
||||
}
|
||||
|
||||
patch = (patch_t*)W_CacheLumpNum (::g->firstspritelump+i, PU_CACHE_SHARED);
|
||||
::g->spritewidth[i] = SHORT(patch->width)<<FRACBITS;
|
||||
::g->spriteoffset[i] = SHORT(patch->leftoffset)<<FRACBITS;
|
||||
::g->spritetopoffset[i] = SHORT(patch->topoffset)<<FRACBITS;
|
||||
patch = ( patch_t* )W_CacheLumpNum( ::g->firstspritelump + i, PU_CACHE_SHARED );
|
||||
::g->spritewidth[i] = SHORT( patch->width ) << FRACBITS;
|
||||
::g->spriteoffset[i] = SHORT( patch->leftoffset ) << FRACBITS;
|
||||
::g->spritetopoffset[i] = SHORT( patch->topoffset ) << FRACBITS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -566,17 +608,17 @@ void R_InitSpriteLumps (void)
|
|||
//
|
||||
// R_InitColormaps
|
||||
//
|
||||
void R_InitColormaps (void)
|
||||
void R_InitColormaps( void )
|
||||
{
|
||||
int lump, length;
|
||||
|
||||
// Load in the light tables,
|
||||
// 256 byte align tables.
|
||||
lump = W_GetNumForName("COLORMAP");
|
||||
length = W_LumpLength (lump) + 255;
|
||||
::g->colormaps = (lighttable_t*)DoomLib::Z_Malloc (length, PU_STATIC, 0);
|
||||
::g->colormaps = (byte *)( ((intptr_t)::g->colormaps + 255)&~0xff);
|
||||
W_ReadLump (lump,::g->colormaps);
|
||||
lump = W_GetNumForName( "COLORMAP" );
|
||||
length = W_LumpLength( lump ) + 255;
|
||||
::g->colormaps = ( lighttable_t* )DoomLib::Z_Malloc( length, PU_STATIC, 0 );
|
||||
::g->colormaps = ( byte* )( ( ( intptr_t )::g->colormaps + 255 ) & ~0xff );
|
||||
W_ReadLump( lump, ::g->colormaps );
|
||||
}
|
||||
|
||||
|
||||
|
@ -587,16 +629,16 @@ void R_InitColormaps (void)
|
|||
// that will be used by all views
|
||||
// Must be called after W_Init.
|
||||
//
|
||||
void R_InitData (void)
|
||||
void R_InitData( void )
|
||||
{
|
||||
R_InitTextures ();
|
||||
I_Printf ("\nInitTextures");
|
||||
R_InitFlats ();
|
||||
I_Printf ("\nInitFlats");
|
||||
R_InitSpriteLumps ();
|
||||
I_Printf ("\nInitSprites");
|
||||
R_InitColormaps ();
|
||||
I_Printf ("\nInitColormaps");
|
||||
R_InitTextures();
|
||||
I_Printf( "\nInitTextures" );
|
||||
R_InitFlats();
|
||||
I_Printf( "\nInitFlats" );
|
||||
R_InitSpriteLumps();
|
||||
I_Printf( "\nInitSprites" );
|
||||
R_InitColormaps();
|
||||
I_Printf( "\nInitColormaps" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -605,18 +647,18 @@ void R_InitData (void)
|
|||
// R_FlatNumForName
|
||||
// Retrieval, get a flat number for a flat name.
|
||||
//
|
||||
int R_FlatNumForName (const char* name)
|
||||
int R_FlatNumForName( const char* name )
|
||||
{
|
||||
int i;
|
||||
char namet[9];
|
||||
|
||||
i = W_CheckNumForName (name);
|
||||
i = W_CheckNumForName( name );
|
||||
|
||||
if (i == -1)
|
||||
if( i == -1 )
|
||||
{
|
||||
namet[8] = 0;
|
||||
memcpy (namet, name,8);
|
||||
I_Error ("R_FlatNumForName: %s not found",namet);
|
||||
memcpy( namet, name, 8 );
|
||||
I_Error( "R_FlatNumForName: %s not found", namet );
|
||||
}
|
||||
return i - ::g->firstflat;
|
||||
}
|
||||
|
@ -629,17 +671,21 @@ int R_FlatNumForName (const char* name)
|
|||
// Check whether texture is available.
|
||||
// Filter out NoTexture indicator.
|
||||
//
|
||||
int R_CheckTextureNumForName (const char *name)
|
||||
int R_CheckTextureNumForName( const char* name )
|
||||
{
|
||||
int i;
|
||||
|
||||
// "NoTexture" marker.
|
||||
if (name[0] == '-')
|
||||
if( name[0] == '-' )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i=0 ; i < ::g->s_numtextures ; i++)
|
||||
if ( !idStr::Icmpn( ::g->s_textures[i]->name, name, 8 ) )
|
||||
for( i = 0 ; i < ::g->s_numtextures ; i++ )
|
||||
if( !idStr::Icmpn( ::g->s_textures[i]->name, name, 8 ) )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -651,16 +697,16 @@ int R_CheckTextureNumForName (const char *name)
|
|||
// Calls R_CheckTextureNumForName,
|
||||
// aborts with error message.
|
||||
//
|
||||
int R_TextureNumForName (const char* name)
|
||||
int R_TextureNumForName( const char* name )
|
||||
{
|
||||
int i;
|
||||
|
||||
i = R_CheckTextureNumForName (name);
|
||||
i = R_CheckTextureNumForName( name );
|
||||
|
||||
if (i==-1)
|
||||
if( i == -1 )
|
||||
{
|
||||
I_Error ("R_TextureNumForName: %s not found",
|
||||
name);
|
||||
I_Error( "R_TextureNumForName: %s not found",
|
||||
name );
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
@ -673,7 +719,7 @@ int R_TextureNumForName (const char* name)
|
|||
// Preloads all relevant graphics for the level.
|
||||
//
|
||||
|
||||
void R_PrecacheLevel (void)
|
||||
void R_PrecacheLevel( void )
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
@ -684,13 +730,15 @@ void R_PrecacheLevel (void)
|
|||
thinker_t* th;
|
||||
spriteframe_t* sf;
|
||||
|
||||
if (::g->demoplayback)
|
||||
if( ::g->demoplayback )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Precache flats.
|
||||
std::vector<char> flatpresent(::g->numflats, 0);
|
||||
std::vector<char> flatpresent( ::g->numflats, 0 );
|
||||
|
||||
for (i=0 ; i < ::g->numsectors ; i++)
|
||||
for( i = 0 ; i < ::g->numsectors ; i++ )
|
||||
{
|
||||
flatpresent[::g->sectors[i].floorpic] = 1;
|
||||
flatpresent[::g->sectors[i].ceilingpic] = 1;
|
||||
|
@ -698,20 +746,20 @@ void R_PrecacheLevel (void)
|
|||
|
||||
::g->flatmemory = 0;
|
||||
|
||||
for (i=0 ; i < ::g->numflats ; i++)
|
||||
for( i = 0 ; i < ::g->numflats ; i++ )
|
||||
{
|
||||
if (flatpresent[i])
|
||||
if( flatpresent[i] )
|
||||
{
|
||||
lump = ::g->firstflat + i;
|
||||
::g->flatmemory += lumpinfo[lump].size;
|
||||
W_CacheLumpNum(lump, PU_CACHE_SHARED);
|
||||
W_CacheLumpNum( lump, PU_CACHE_SHARED );
|
||||
}
|
||||
}
|
||||
|
||||
// Precache textures.
|
||||
std::vector<char> texturepresent(::g->s_numtextures, 0);
|
||||
std::vector<char> texturepresent( ::g->s_numtextures, 0 );
|
||||
|
||||
for (i=0 ; i < ::g->numsides ; i++)
|
||||
for( i = 0 ; i < ::g->numsides ; i++ )
|
||||
{
|
||||
texturepresent[::g->sides[i].toptexture] = 1;
|
||||
texturepresent[::g->sides[i].midtexture] = 1;
|
||||
|
@ -727,44 +775,50 @@ void R_PrecacheLevel (void)
|
|||
texturepresent[::g->skytexture] = 1;
|
||||
|
||||
::g->texturememory = 0;
|
||||
for (i=0 ; i < ::g->s_numtextures ; i++)
|
||||
for( i = 0 ; i < ::g->s_numtextures ; i++ )
|
||||
{
|
||||
if( !texturepresent[i] )
|
||||
{
|
||||
if (!texturepresent[i])
|
||||
continue;
|
||||
}
|
||||
|
||||
texture = ::g->s_textures[i];
|
||||
|
||||
for (j=0 ; j<texture->patchcount ; j++)
|
||||
for( j = 0 ; j < texture->patchcount ; j++ )
|
||||
{
|
||||
lump = texture->patches[j].patch;
|
||||
::g->texturememory += lumpinfo[lump].size;
|
||||
W_CacheLumpNum(lump , PU_CACHE_SHARED);
|
||||
W_CacheLumpNum( lump , PU_CACHE_SHARED );
|
||||
}
|
||||
}
|
||||
|
||||
// Precache ::g->sprites.
|
||||
std::vector<char> spritepresent(::g->numsprites, 0);
|
||||
std::vector<char> spritepresent( ::g->numsprites, 0 );
|
||||
|
||||
for (th = ::g->thinkercap.next ; th != &::g->thinkercap ; th=th->next)
|
||||
for( th = ::g->thinkercap.next ; th != &::g->thinkercap ; th = th->next )
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
spritepresent[((mobj_t *)th)->sprite] = 1;
|
||||
if( th->function.acp1 == ( actionf_p1 )P_MobjThinker )
|
||||
{
|
||||
spritepresent[( ( mobj_t* )th )->sprite] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
::g->spritememory = 0;
|
||||
for (i=0 ; i < ::g->numsprites ; i++)
|
||||
for( i = 0 ; i < ::g->numsprites ; i++ )
|
||||
{
|
||||
if( !spritepresent[i] )
|
||||
{
|
||||
if (!spritepresent[i])
|
||||
continue;
|
||||
}
|
||||
|
||||
for (j=0 ; j < ::g->sprites[i].numframes ; j++)
|
||||
for( j = 0 ; j < ::g->sprites[i].numframes ; j++ )
|
||||
{
|
||||
sf = &::g->sprites[i].spriteframes[j];
|
||||
for (k=0 ; k<8 ; k++)
|
||||
for( k = 0 ; k < 8 ; k++ )
|
||||
{
|
||||
lump = ::g->firstspritelump + sf->lump[k];
|
||||
::g->spritememory += lumpinfo[lump].size;
|
||||
W_CacheLumpNum(lump , PU_CACHE_SHARED);
|
||||
W_CacheLumpNum( lump , PU_CACHE_SHARED );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "r_state.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
// Retrieve column data for span blitting.
|
||||
|
@ -44,20 +44,20 @@ R_GetColumn
|
|||
|
||||
|
||||
// I/O, setting up the stuff.
|
||||
void R_InitData (void);
|
||||
void R_PrecacheLevel (void);
|
||||
void R_InitData( void );
|
||||
void R_PrecacheLevel( void );
|
||||
|
||||
|
||||
// Retrieval.
|
||||
// Floor/ceiling opaque texture tiles,
|
||||
// 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,
|
||||
// returns the texture number for the texture name.
|
||||
int R_TextureNumForName (const char *name);
|
||||
int R_CheckTextureNumForName ( const char *name);
|
||||
int R_TextureNumForName( const char* name );
|
||||
int R_CheckTextureNumForName( const char* name );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -83,8 +83,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// Thus a special case loop for very fast rendering can
|
||||
// be used. It has also been used with Wolfenstein 3D.
|
||||
//
|
||||
void R_DrawColumn ( lighttable_t * dc_colormap,
|
||||
byte * dc_source )
|
||||
void R_DrawColumn( lighttable_t* dc_colormap,
|
||||
byte* dc_source )
|
||||
{
|
||||
int count;
|
||||
byte* dest;
|
||||
|
@ -94,15 +94,18 @@ void R_DrawColumn ( lighttable_t * dc_colormap,
|
|||
count = ::g->dc_yh - ::g->dc_yl;
|
||||
|
||||
// Zero length, column does not exceed a pixel.
|
||||
if (count >= 0) {
|
||||
if( count >= 0 )
|
||||
{
|
||||
//return;
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if ((unsigned)::g->dc_x >= SCREENWIDTH
|
||||
#ifdef RANGECHECK
|
||||
if( ( unsigned )::g->dc_x >= SCREENWIDTH
|
||||
|| ::g->dc_yl < 0
|
||||
|| ::g->dc_yh >= SCREENHEIGHT)
|
||||
I_Error ("R_DrawColumn: %i to %i at %i", ::g->dc_yl, ::g->dc_yh, ::g->dc_x);
|
||||
#endif
|
||||
|| ::g->dc_yh >= SCREENHEIGHT )
|
||||
{
|
||||
I_Error( "R_DrawColumn: %i to %i at %i", ::g->dc_yl, ::g->dc_yh, ::g->dc_x );
|
||||
}
|
||||
#endif
|
||||
|
||||
// Framebuffer destination address.
|
||||
// Use ::g->ylookup LUT to avoid multiply with ScreenWidth.
|
||||
|
@ -112,7 +115,7 @@ void R_DrawColumn ( lighttable_t * dc_colormap,
|
|||
// Determine scaling,
|
||||
// which is the only mapping to be done.
|
||||
fracstep = ::g->dc_iscale;
|
||||
frac = ::g->dc_texturemid + (::g->dc_yl-::g->centery)*fracstep;
|
||||
frac = ::g->dc_texturemid + ( ::g->dc_yl -::g->centery ) * fracstep;
|
||||
|
||||
// Inner loop that does the actual texture mapping,
|
||||
// e.g. a DDA-lile scaling.
|
||||
|
@ -128,7 +131,8 @@ void R_DrawColumn ( lighttable_t * dc_colormap,
|
|||
|
||||
frac += fracstep;
|
||||
dest += SCREENWIDTH;
|
||||
} while (count--);
|
||||
}
|
||||
while( count-- );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,7 +141,7 @@ void R_DrawColumn ( lighttable_t * dc_colormap,
|
|||
// UNUSED.
|
||||
// Loop unrolled.
|
||||
#if 0
|
||||
void R_DrawColumn (void)
|
||||
void R_DrawColumn( void )
|
||||
{
|
||||
int count;
|
||||
byte* source;
|
||||
|
@ -156,35 +160,35 @@ void R_DrawColumn (void)
|
|||
colormap = ::g->dc_colormap;
|
||||
dest = ::g->ylookup[::g->dc_yl] + ::g->columnofs[::g->dc_x];
|
||||
|
||||
fracstep = ::g->dc_iscale<<9;
|
||||
frac = (::g->dc_texturemid + (::g->dc_yl-::g->centery)*::g->dc_iscale)<<9;
|
||||
fracstep = ::g->dc_iscale << 9;
|
||||
frac = ( ::g->dc_texturemid + ( ::g->dc_yl -::g->centery )*::g->dc_iscale ) << 9;
|
||||
|
||||
fracstep2 = fracstep+fracstep;
|
||||
fracstep3 = fracstep2+fracstep;
|
||||
fracstep4 = fracstep3+fracstep;
|
||||
fracstep2 = fracstep + fracstep;
|
||||
fracstep3 = fracstep2 + fracstep;
|
||||
fracstep4 = fracstep3 + fracstep;
|
||||
|
||||
while (count >= 8)
|
||||
while( count >= 8 )
|
||||
{
|
||||
dest[0] = colormap[source[frac>>25]];
|
||||
dest[SCREENWIDTH] = colormap[source[(frac+fracstep)>>25]];
|
||||
dest[SCREENWIDTH*2] = colormap[source[(frac+fracstep2)>>25]];
|
||||
dest[SCREENWIDTH*3] = colormap[source[(frac+fracstep3)>>25]];
|
||||
dest[0] = colormap[source[frac >> 25]];
|
||||
dest[SCREENWIDTH] = colormap[source[( frac + fracstep ) >> 25]];
|
||||
dest[SCREENWIDTH * 2] = colormap[source[( frac + fracstep2 ) >> 25]];
|
||||
dest[SCREENWIDTH * 3] = colormap[source[( frac + fracstep3 ) >> 25]];
|
||||
|
||||
frac += fracstep4;
|
||||
|
||||
dest[SCREENWIDTH*4] = colormap[source[frac>>25]];
|
||||
dest[SCREENWIDTH*5] = colormap[source[(frac+fracstep)>>25]];
|
||||
dest[SCREENWIDTH*6] = colormap[source[(frac+fracstep2)>>25]];
|
||||
dest[SCREENWIDTH*7] = colormap[source[(frac+fracstep3)>>25]];
|
||||
dest[SCREENWIDTH * 4] = colormap[source[frac >> 25]];
|
||||
dest[SCREENWIDTH * 5] = colormap[source[( frac + fracstep ) >> 25]];
|
||||
dest[SCREENWIDTH * 6] = colormap[source[( frac + fracstep2 ) >> 25]];
|
||||
dest[SCREENWIDTH * 7] = colormap[source[( frac + fracstep3 ) >> 25]];
|
||||
|
||||
frac += fracstep4;
|
||||
dest += SCREENWIDTH*8;
|
||||
dest += SCREENWIDTH * 8;
|
||||
count -= 8;
|
||||
}
|
||||
|
||||
while (count > 0)
|
||||
while( count > 0 )
|
||||
{
|
||||
*dest = colormap[source[frac>>25]];
|
||||
*dest = colormap[source[frac >> 25]];
|
||||
dest += SCREENWIDTH;
|
||||
frac += fracstep;
|
||||
count--;
|
||||
|
@ -193,8 +197,8 @@ void R_DrawColumn (void)
|
|||
#endif
|
||||
|
||||
|
||||
void R_DrawColumnLow ( lighttable_t * dc_colormap,
|
||||
byte * dc_source )
|
||||
void R_DrawColumnLow( lighttable_t* dc_colormap,
|
||||
byte* dc_source )
|
||||
{
|
||||
int count;
|
||||
byte* dest;
|
||||
|
@ -205,16 +209,18 @@ void R_DrawColumnLow ( lighttable_t * dc_colormap,
|
|||
count = ::g->dc_yh - ::g->dc_yl;
|
||||
|
||||
// Zero length.
|
||||
if (count < 0)
|
||||
if( count < 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if ((unsigned)::g->dc_x >= SCREENWIDTH
|
||||
if( ( unsigned )::g->dc_x >= SCREENWIDTH
|
||||
|| ::g->dc_yl < 0
|
||||
|| ::g->dc_yh >= SCREENHEIGHT)
|
||||
|| ::g->dc_yh >= SCREENHEIGHT )
|
||||
{
|
||||
|
||||
I_Error ("R_DrawColumn: %i to %i at %i", ::g->dc_yl, ::g->dc_yh, ::g->dc_x);
|
||||
I_Error( "R_DrawColumn: %i to %i at %i", ::g->dc_yl, ::g->dc_yh, ::g->dc_x );
|
||||
}
|
||||
// ::g->dccount++;
|
||||
#endif
|
||||
|
@ -222,20 +228,21 @@ void R_DrawColumnLow ( lighttable_t * dc_colormap,
|
|||
::g->dc_x <<= 1;
|
||||
|
||||
dest = ::g->ylookup[::g->dc_yl] + ::g->columnofs[::g->dc_x];
|
||||
dest2 = ::g->ylookup[::g->dc_yl] + ::g->columnofs[::g->dc_x+1];
|
||||
dest2 = ::g->ylookup[::g->dc_yl] + ::g->columnofs[::g->dc_x + 1];
|
||||
|
||||
fracstep = ::g->dc_iscale;
|
||||
frac = ::g->dc_texturemid + (::g->dc_yl-::g->centery)*fracstep;
|
||||
frac = ::g->dc_texturemid + ( ::g->dc_yl -::g->centery ) * fracstep;
|
||||
|
||||
do
|
||||
{
|
||||
// Hack. Does not work corretly.
|
||||
*dest2 = *dest = ::g->dc_colormap[::g->dc_source[(frac>>FRACBITS)&127]];
|
||||
*dest2 = *dest = ::g->dc_colormap[::g->dc_source[( frac >> FRACBITS ) & 127]];
|
||||
dest += SCREENWIDTH;
|
||||
dest2 += SCREENWIDTH;
|
||||
frac += fracstep;
|
||||
|
||||
} while (count--);
|
||||
}
|
||||
while( count-- );
|
||||
}
|
||||
|
||||
|
||||
|
@ -255,8 +262,8 @@ void R_DrawColumnLow ( lighttable_t * dc_colormap,
|
|||
// could create the SHADOW effect,
|
||||
// i.e. spectres and invisible ::g->players.
|
||||
//
|
||||
void R_DrawFuzzColumn ( lighttable_t * dc_colormap,
|
||||
byte * dc_source )
|
||||
void R_DrawFuzzColumn( lighttable_t* dc_colormap,
|
||||
byte* dc_source )
|
||||
{
|
||||
int count;
|
||||
byte* dest;
|
||||
|
@ -264,26 +271,32 @@ void R_DrawFuzzColumn ( lighttable_t * dc_colormap,
|
|||
fixed_t fracstep;
|
||||
|
||||
// Adjust borders. Low...
|
||||
if (!::g->dc_yl)
|
||||
if( !::g->dc_yl )
|
||||
{
|
||||
::g->dc_yl = 1;
|
||||
}
|
||||
|
||||
// .. and high.
|
||||
if (::g->dc_yh == ::g->viewheight-1)
|
||||
if( ::g->dc_yh == ::g->viewheight - 1 )
|
||||
{
|
||||
::g->dc_yh = ::g->viewheight - 2;
|
||||
}
|
||||
|
||||
count = ::g->dc_yh - ::g->dc_yl;
|
||||
|
||||
// Zero length.
|
||||
if (count < 0)
|
||||
if( count < 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if ((unsigned)::g->dc_x >= SCREENWIDTH
|
||||
|| ::g->dc_yl < 0 || ::g->dc_yh >= SCREENHEIGHT)
|
||||
if( ( unsigned )::g->dc_x >= SCREENWIDTH
|
||||
|| ::g->dc_yl < 0 || ::g->dc_yh >= SCREENHEIGHT )
|
||||
{
|
||||
I_Error ("R_DrawFuzzColumn: %i to %i at %i",
|
||||
::g->dc_yl, ::g->dc_yh, ::g->dc_x);
|
||||
I_Error( "R_DrawFuzzColumn: %i to %i at %i",
|
||||
::g->dc_yl, ::g->dc_yh, ::g->dc_x );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -318,7 +331,7 @@ void R_DrawFuzzColumn ( lighttable_t * dc_colormap,
|
|||
|
||||
// Looks familiar.
|
||||
fracstep = ::g->dc_iscale;
|
||||
frac = ::g->dc_texturemid + (::g->dc_yl-::g->centery)*fracstep;
|
||||
frac = ::g->dc_texturemid + ( ::g->dc_yl -::g->centery ) * fracstep;
|
||||
|
||||
// Looks like an attempt at dithering,
|
||||
// using the colormap #6 (of 0-31, a bit
|
||||
|
@ -329,16 +342,19 @@ void R_DrawFuzzColumn ( lighttable_t * dc_colormap,
|
|||
// a pixel that is either one column
|
||||
// left or right of the current one.
|
||||
// Add index from colormap to index.
|
||||
*dest = ::g->colormaps[6*256+dest[::g->fuzzoffset[::g->fuzzpos]]];
|
||||
*dest = ::g->colormaps[6 * 256 + dest[::g->fuzzoffset[::g->fuzzpos]]];
|
||||
|
||||
// Clamp table lookup index.
|
||||
if (++::g->fuzzpos == FUZZTABLE)
|
||||
if( ++::g->fuzzpos == FUZZTABLE )
|
||||
{
|
||||
::g->fuzzpos = 0;
|
||||
}
|
||||
|
||||
dest += SCREENWIDTH;
|
||||
|
||||
frac += fracstep;
|
||||
} while (count--);
|
||||
}
|
||||
while( count-- );
|
||||
}
|
||||
|
||||
|
||||
|
@ -354,8 +370,8 @@ void R_DrawFuzzColumn ( lighttable_t * dc_colormap,
|
|||
// identical ::g->sprites, kinda brightened up.
|
||||
//
|
||||
|
||||
void R_DrawTranslatedColumn ( lighttable_t * dc_colormap,
|
||||
byte * dc_source )
|
||||
void R_DrawTranslatedColumn( lighttable_t* dc_colormap,
|
||||
byte* dc_source )
|
||||
{
|
||||
int count;
|
||||
byte* dest;
|
||||
|
@ -363,16 +379,18 @@ void R_DrawTranslatedColumn ( lighttable_t * dc_colormap,
|
|||
fixed_t fracstep;
|
||||
|
||||
count = ::g->dc_yh - ::g->dc_yl;
|
||||
if (count < 0)
|
||||
if( count < 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if ((unsigned)::g->dc_x >= SCREENWIDTH
|
||||
if( ( unsigned )::g->dc_x >= SCREENWIDTH
|
||||
|| ::g->dc_yl < 0
|
||||
|| ::g->dc_yh >= SCREENHEIGHT)
|
||||
|| ::g->dc_yh >= SCREENHEIGHT )
|
||||
{
|
||||
I_Error ( "R_DrawColumn: %i to %i at %i",
|
||||
::g->dc_yl, ::g->dc_yh, ::g->dc_x);
|
||||
I_Error( "R_DrawColumn: %i to %i at %i",
|
||||
::g->dc_yl, ::g->dc_yh, ::g->dc_x );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -402,7 +420,7 @@ void R_DrawTranslatedColumn ( lighttable_t * dc_colormap,
|
|||
|
||||
// Looks familiar.
|
||||
fracstep = ::g->dc_iscale;
|
||||
frac = ::g->dc_texturemid + (::g->dc_yl-::g->centery)*fracstep;
|
||||
frac = ::g->dc_texturemid + ( ::g->dc_yl -::g->centery ) * fracstep;
|
||||
|
||||
// Here we do an additional index re-mapping.
|
||||
do
|
||||
|
@ -412,11 +430,12 @@ void R_DrawTranslatedColumn ( lighttable_t * dc_colormap,
|
|||
// used with PLAY ::g->sprites.
|
||||
// Thus the "green" ramp of the player 0 sprite
|
||||
// is mapped to gray, red, black/indigo.
|
||||
*dest = dc_colormap[::g->dc_translation[dc_source[frac>>FRACBITS]]];
|
||||
*dest = dc_colormap[::g->dc_translation[dc_source[frac >> FRACBITS]]];
|
||||
dest += SCREENWIDTH;
|
||||
|
||||
frac += fracstep;
|
||||
} while (count--);
|
||||
}
|
||||
while( count-- );
|
||||
}
|
||||
|
||||
|
||||
|
@ -429,28 +448,28 @@ void R_DrawTranslatedColumn ( lighttable_t * dc_colormap,
|
|||
// Assumes a given structure of the PLAYPAL.
|
||||
// Could be read from a lump instead.
|
||||
//
|
||||
void R_InitTranslationTables (void)
|
||||
void R_InitTranslationTables( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
::g->translationtables = (byte*)DoomLib::Z_Malloc (256*3+255, PU_STATIC, 0);
|
||||
::g->translationtables = (byte *)(( (intptr_t)::g->translationtables + 255 )& ~255);
|
||||
::g->translationtables = ( byte* )DoomLib::Z_Malloc( 256 * 3 + 255, PU_STATIC, 0 );
|
||||
::g->translationtables = ( byte* )( ( ( intptr_t )::g->translationtables + 255 ) & ~255 );
|
||||
|
||||
// translate just the 16 green colors
|
||||
for (i=0 ; i<256 ; i++)
|
||||
for( i = 0 ; i < 256 ; i++ )
|
||||
{
|
||||
if (i >= 0x70 && i<= 0x7f)
|
||||
if( i >= 0x70 && i <= 0x7f )
|
||||
{
|
||||
// map green ramp to gray, brown, red
|
||||
::g->translationtables[i] = 0x60 + (i&0xf);
|
||||
::g->translationtables [i+256] = 0x40 + (i&0xf);
|
||||
::g->translationtables [i+512] = 0x20 + (i&0xf);
|
||||
::g->translationtables[i] = 0x60 + ( i & 0xf );
|
||||
::g->translationtables [i + 256] = 0x40 + ( i & 0xf );
|
||||
::g->translationtables [i + 512] = 0x20 + ( i & 0xf );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Keep all other colors as is.
|
||||
::g->translationtables[i] = ::g->translationtables[i+256]
|
||||
= ::g->translationtables[i+512] = i;
|
||||
::g->translationtables[i] = ::g->translationtables[i + 256]
|
||||
= ::g->translationtables[i + 512] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -480,28 +499,28 @@ void R_InitTranslationTables (void)
|
|||
|
||||
//
|
||||
// Draws the actual span.
|
||||
void R_DrawSpan ( fixed_t xfrac,
|
||||
void R_DrawSpan( fixed_t xfrac,
|
||||
fixed_t yfrac,
|
||||
fixed_t ds_y,
|
||||
int ds_x1,
|
||||
int ds_x2,
|
||||
fixed_t ds_xstep,
|
||||
fixed_t ds_ystep,
|
||||
lighttable_t * ds_colormap,
|
||||
byte * ds_source )
|
||||
lighttable_t* ds_colormap,
|
||||
byte* ds_source )
|
||||
{
|
||||
byte* dest;
|
||||
int count;
|
||||
int spot;
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if (::g->ds_x2 < ::g->ds_x1
|
||||
|| ::g->ds_x1<0
|
||||
|| ::g->ds_x2>=SCREENWIDTH
|
||||
|| (unsigned)::g->ds_y>SCREENHEIGHT)
|
||||
if( ::g->ds_x2 < ::g->ds_x1
|
||||
|| ::g->ds_x1 < 0
|
||||
|| ::g->ds_x2 >= SCREENWIDTH
|
||||
|| ( unsigned )::g->ds_y > SCREENHEIGHT )
|
||||
{
|
||||
I_Error( "R_DrawSpan: %i to %i at %i",
|
||||
::g->ds_x1,::g->ds_x2,::g->ds_y);
|
||||
::g->ds_x1, ::g->ds_x2, ::g->ds_y );
|
||||
}
|
||||
// ::g->dscount++;
|
||||
#endif
|
||||
|
@ -511,14 +530,15 @@ void R_DrawSpan ( fixed_t xfrac,
|
|||
// We do not check for zero spans here?
|
||||
count = ds_x2 - g->ds_x1;
|
||||
|
||||
if ( ds_x2 < ds_x1 ) {
|
||||
if( ds_x2 < ds_x1 )
|
||||
{
|
||||
return; // SMF - think this is the sky
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
// Current texture index in u,v.
|
||||
spot = ((yfrac>>(16-6))&(63*64)) + ((xfrac>>16)&63);
|
||||
spot = ( ( yfrac >> ( 16 - 6 ) ) & ( 63 * 64 ) ) + ( ( xfrac >> 16 ) & 63 );
|
||||
|
||||
// Lookup pixel from flat texture tile,
|
||||
// re-index using light/colormap.
|
||||
|
@ -528,7 +548,8 @@ void R_DrawSpan ( fixed_t xfrac,
|
|||
xfrac += ds_xstep;
|
||||
yfrac += ds_ystep;
|
||||
|
||||
} while (count--);
|
||||
}
|
||||
while( count-- );
|
||||
}
|
||||
|
||||
|
||||
|
@ -536,7 +557,7 @@ void R_DrawSpan ( fixed_t xfrac,
|
|||
// UNUSED.
|
||||
// Loop unrolled by 4.
|
||||
#if 0
|
||||
void R_DrawSpan (void)
|
||||
void R_DrawSpan( void )
|
||||
{
|
||||
unsigned position, step;
|
||||
|
||||
|
@ -551,40 +572,40 @@ void R_DrawSpan (void)
|
|||
unsigned xtemp;
|
||||
unsigned ytemp;
|
||||
|
||||
position = ((::g->ds_xfrac<<10)&0xffff0000) | ((::g->ds_yfrac>>6)&0xffff);
|
||||
step = ((::g->ds_xstep<<10)&0xffff0000) | ((::g->ds_ystep>>6)&0xffff);
|
||||
position = ( ( ::g->ds_xfrac << 10 ) & 0xffff0000 ) | ( ( ::g->ds_yfrac >> 6 ) & 0xffff );
|
||||
step = ( ( ::g->ds_xstep << 10 ) & 0xffff0000 ) | ( ( ::g->ds_ystep >> 6 ) & 0xffff );
|
||||
|
||||
source = ::g->ds_source;
|
||||
colormap = ::g->ds_colormap;
|
||||
dest = ::g->ylookup[::g->ds_y] + ::g->columnofs[::g->ds_x1];
|
||||
count = ::g->ds_x2 - ::g->ds_x1 + 1;
|
||||
|
||||
while (count >= 4)
|
||||
while( count >= 4 )
|
||||
{
|
||||
ytemp = position>>4;
|
||||
ytemp = position >> 4;
|
||||
ytemp = ytemp & 4032;
|
||||
xtemp = position>>26;
|
||||
xtemp = position >> 26;
|
||||
spot = xtemp | ytemp;
|
||||
position += step;
|
||||
dest[0] = colormap[source[spot]];
|
||||
|
||||
ytemp = position>>4;
|
||||
ytemp = position >> 4;
|
||||
ytemp = ytemp & 4032;
|
||||
xtemp = position>>26;
|
||||
xtemp = position >> 26;
|
||||
spot = xtemp | ytemp;
|
||||
position += step;
|
||||
dest[1] = colormap[source[spot]];
|
||||
|
||||
ytemp = position>>4;
|
||||
ytemp = position >> 4;
|
||||
ytemp = ytemp & 4032;
|
||||
xtemp = position>>26;
|
||||
xtemp = position >> 26;
|
||||
spot = xtemp | ytemp;
|
||||
position += step;
|
||||
dest[2] = colormap[source[spot]];
|
||||
|
||||
ytemp = position>>4;
|
||||
ytemp = position >> 4;
|
||||
ytemp = ytemp & 4032;
|
||||
xtemp = position>>26;
|
||||
xtemp = position >> 26;
|
||||
spot = xtemp | ytemp;
|
||||
position += step;
|
||||
dest[3] = colormap[source[spot]];
|
||||
|
@ -592,11 +613,11 @@ void R_DrawSpan (void)
|
|||
count -= 4;
|
||||
dest += 4;
|
||||
}
|
||||
while (count > 0)
|
||||
while( count > 0 )
|
||||
{
|
||||
ytemp = position>>4;
|
||||
ytemp = position >> 4;
|
||||
ytemp = ytemp & 4032;
|
||||
xtemp = position>>26;
|
||||
xtemp = position >> 26;
|
||||
spot = xtemp | ytemp;
|
||||
position += step;
|
||||
*dest++ = colormap[source[spot]];
|
||||
|
@ -609,28 +630,28 @@ void R_DrawSpan (void)
|
|||
//
|
||||
// Again..
|
||||
//
|
||||
void R_DrawSpanLow ( fixed_t xfrac,
|
||||
void R_DrawSpanLow( fixed_t xfrac,
|
||||
fixed_t yfrac,
|
||||
fixed_t ds_y,
|
||||
int ds_x1,
|
||||
int ds_x2,
|
||||
fixed_t ds_xstep,
|
||||
fixed_t ds_ystep,
|
||||
lighttable_t * ds_colormap,
|
||||
byte * ds_source )
|
||||
lighttable_t* ds_colormap,
|
||||
byte* ds_source )
|
||||
{
|
||||
byte* dest;
|
||||
int count;
|
||||
int spot;
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if (::g->ds_x2 < ::g->ds_x1
|
||||
|| ::g->ds_x1<0
|
||||
|| ::g->ds_x2>=SCREENWIDTH
|
||||
|| (unsigned)::g->ds_y>SCREENHEIGHT)
|
||||
if( ::g->ds_x2 < ::g->ds_x1
|
||||
|| ::g->ds_x1 < 0
|
||||
|| ::g->ds_x2 >= SCREENWIDTH
|
||||
|| ( unsigned )::g->ds_y > SCREENHEIGHT )
|
||||
{
|
||||
I_Error( "R_DrawSpan: %i to %i at %i",
|
||||
::g->ds_x1,::g->ds_x2,::g->ds_y);
|
||||
::g->ds_x1, ::g->ds_x2, ::g->ds_y );
|
||||
}
|
||||
// ::g->dscount++;
|
||||
#endif
|
||||
|
@ -645,7 +666,7 @@ void R_DrawSpanLow ( fixed_t xfrac,
|
|||
count = ::g->ds_x2 - ::g->ds_x1;
|
||||
do
|
||||
{
|
||||
spot = ((yfrac>>(16-6))&(63*64)) + ((xfrac>>16)&63);
|
||||
spot = ( ( yfrac >> ( 16 - 6 ) ) & ( 63 * 64 ) ) + ( ( xfrac >> 16 ) & 63 );
|
||||
// Lowres/blocky mode does it twice,
|
||||
// while scale is adjusted appropriately.
|
||||
*dest++ = ::g->ds_colormap[::g->ds_source[spot]];
|
||||
|
@ -654,7 +675,8 @@ void R_DrawSpanLow ( fixed_t xfrac,
|
|||
xfrac += ::g->ds_xstep;
|
||||
yfrac += ::g->ds_ystep;
|
||||
|
||||
} while (count--);
|
||||
}
|
||||
while( count-- );
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -674,21 +696,29 @@ R_InitBuffer
|
|||
// Handle resize,
|
||||
// e.g. smaller view windows
|
||||
// with border and/or status bar.
|
||||
::g->viewwindowx = (SCREENWIDTH-width) >> 1;
|
||||
::g->viewwindowx = ( SCREENWIDTH - width ) >> 1;
|
||||
|
||||
// Column offset. For windows.
|
||||
for (i=0 ; i<width ; i++)
|
||||
for( i = 0 ; i < width ; i++ )
|
||||
{
|
||||
::g->columnofs[i] = ::g->viewwindowx + i;
|
||||
}
|
||||
|
||||
// Samw with base row offset.
|
||||
if (width == SCREENWIDTH)
|
||||
if( width == SCREENWIDTH )
|
||||
{
|
||||
::g->viewwindowy = 0;
|
||||
}
|
||||
else
|
||||
::g->viewwindowy = (SCREENHEIGHT-SBARHEIGHT-height) >> 1;
|
||||
{
|
||||
::g->viewwindowy = ( SCREENHEIGHT - SBARHEIGHT - height ) >> 1;
|
||||
}
|
||||
|
||||
// Preclaculate all row offsets.
|
||||
for (i=0 ; i<height ; i++)
|
||||
::g->ylookup[i] = ::g->screens[0] + (i+::g->viewwindowy)*SCREENWIDTH;
|
||||
for( i = 0 ; i < height ; i++ )
|
||||
{
|
||||
::g->ylookup[i] = ::g->screens[0] + ( i +::g->viewwindowy ) * SCREENWIDTH;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -700,7 +730,7 @@ R_InitBuffer
|
|||
// for variable screen sizes
|
||||
// Also draws a beveled edge.
|
||||
//
|
||||
void R_FillBackScreen (void)
|
||||
void R_FillBackScreen( void )
|
||||
{
|
||||
byte* src;
|
||||
byte* dest;
|
||||
|
@ -716,26 +746,34 @@ void R_FillBackScreen (void)
|
|||
|
||||
char* name;
|
||||
|
||||
if (::g->scaledviewwidth == SCREENWIDTH)
|
||||
if( ::g->scaledviewwidth == SCREENWIDTH )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ::g->gamemode == commercial)
|
||||
if( ::g->gamemode == commercial )
|
||||
{
|
||||
name = name2;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = name1;
|
||||
}
|
||||
|
||||
src = (byte*)W_CacheLumpName (name, PU_CACHE_SHARED);
|
||||
src = ( byte* )W_CacheLumpName( name, PU_CACHE_SHARED );
|
||||
dest = ::g->screens[1];
|
||||
|
||||
for (y=0 ; y<SCREENHEIGHT-SBARHEIGHT ; y++) {
|
||||
for (x=0 ; x<SCREENWIDTH/64 ; x++) {
|
||||
memcpy(dest, src+((y&63)<<6), 64);
|
||||
for( y = 0 ; y < SCREENHEIGHT - SBARHEIGHT ; y++ )
|
||||
{
|
||||
for( x = 0 ; x < SCREENWIDTH / 64 ; x++ )
|
||||
{
|
||||
memcpy( dest, src + ( ( y & 63 ) << 6 ), 64 );
|
||||
dest += 64;
|
||||
}
|
||||
if (SCREENWIDTH&63)
|
||||
if( SCREENWIDTH & 63 )
|
||||
{
|
||||
memcpy(dest, src+((y&63)<<6), SCREENWIDTH&63);
|
||||
dest += (SCREENWIDTH&63);
|
||||
memcpy( dest, src + ( ( y & 63 ) << 6 ), SCREENWIDTH & 63 );
|
||||
dest += ( SCREENWIDTH & 63 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -744,31 +782,35 @@ void R_FillBackScreen (void)
|
|||
windowx = ::g->viewwindowx / GLOBAL_IMAGE_SCALER;
|
||||
windowy = ::g->viewwindowy / GLOBAL_IMAGE_SCALER;
|
||||
|
||||
patch = (patch_t*)W_CacheLumpName ("brdr_t",PU_CACHE_SHARED);
|
||||
for (x=0 ; x<width ; x+=8) {
|
||||
V_DrawPatch (windowx+x,windowy-8,1,patch);
|
||||
patch = ( patch_t* )W_CacheLumpName( "brdr_t", PU_CACHE_SHARED );
|
||||
for( x = 0 ; x < width ; x += 8 )
|
||||
{
|
||||
V_DrawPatch( windowx + x, windowy - 8, 1, patch );
|
||||
}
|
||||
|
||||
patch = (patch_t*)W_CacheLumpName ("brdr_b",PU_CACHE_SHARED);
|
||||
for (x=0 ; x<width ; x+=8) {
|
||||
V_DrawPatch (windowx+x,windowy+height,1,patch);
|
||||
patch = ( patch_t* )W_CacheLumpName( "brdr_b", PU_CACHE_SHARED );
|
||||
for( x = 0 ; x < width ; x += 8 )
|
||||
{
|
||||
V_DrawPatch( windowx + x, windowy + height, 1, patch );
|
||||
}
|
||||
|
||||
patch = (patch_t*)W_CacheLumpName ("brdr_l",PU_CACHE_SHARED);
|
||||
for (y=0 ; y<height ; y+=8) {
|
||||
V_DrawPatch (windowx-8,windowy+y,1,patch);
|
||||
patch = ( patch_t* )W_CacheLumpName( "brdr_l", PU_CACHE_SHARED );
|
||||
for( y = 0 ; y < height ; y += 8 )
|
||||
{
|
||||
V_DrawPatch( windowx - 8, windowy + y, 1, patch );
|
||||
}
|
||||
|
||||
patch = (patch_t*)W_CacheLumpName ("brdr_r",PU_CACHE_SHARED);
|
||||
for (y=0 ; y<height ; y+=8) {
|
||||
V_DrawPatch (windowx+width,windowy+y,1,patch);
|
||||
patch = ( patch_t* )W_CacheLumpName( "brdr_r", PU_CACHE_SHARED );
|
||||
for( y = 0 ; y < height ; y += 8 )
|
||||
{
|
||||
V_DrawPatch( windowx + width, windowy + y, 1, patch );
|
||||
}
|
||||
|
||||
// Draw beveled edge.
|
||||
V_DrawPatch(windowx-8, windowy-8, 1, (patch_t*)W_CacheLumpName ("brdr_tl",PU_CACHE_SHARED));
|
||||
V_DrawPatch(windowx+width, windowy-8, 1, (patch_t*)W_CacheLumpName ("brdr_tr",PU_CACHE_SHARED));
|
||||
V_DrawPatch(windowx-8, windowy+height, 1, (patch_t*)W_CacheLumpName ("brdr_bl",PU_CACHE_SHARED));
|
||||
V_DrawPatch (windowx+width, windowy+height, 1, (patch_t*)W_CacheLumpName ("brdr_br",PU_CACHE_SHARED));
|
||||
V_DrawPatch( windowx - 8, windowy - 8, 1, ( patch_t* )W_CacheLumpName( "brdr_tl", PU_CACHE_SHARED ) );
|
||||
V_DrawPatch( windowx + width, windowy - 8, 1, ( patch_t* )W_CacheLumpName( "brdr_tr", PU_CACHE_SHARED ) );
|
||||
V_DrawPatch( windowx - 8, windowy + height, 1, ( patch_t* )W_CacheLumpName( "brdr_bl", PU_CACHE_SHARED ) );
|
||||
V_DrawPatch( windowx + width, windowy + height, 1, ( patch_t* )W_CacheLumpName( "brdr_br", PU_CACHE_SHARED ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -785,7 +827,7 @@ R_VideoErase
|
|||
// is not optiomal, e.g. byte by byte on
|
||||
// a 32bit CPU, as GNU GCC/Linux libc did
|
||||
// at one point.
|
||||
memcpy(::g->screens[0]+ofs, ::g->screens[1]+ofs, count);
|
||||
memcpy( ::g->screens[0] + ofs, ::g->screens[1] + ofs, count );
|
||||
}
|
||||
|
||||
|
||||
|
@ -801,38 +843,40 @@ V_MarkRect
|
|||
int width,
|
||||
int height );
|
||||
|
||||
void R_DrawViewBorder (void)
|
||||
void R_DrawViewBorder( void )
|
||||
{
|
||||
int top;
|
||||
int side;
|
||||
int ofs;
|
||||
int i;
|
||||
|
||||
if (::g->scaledviewwidth == SCREENWIDTH)
|
||||
if( ::g->scaledviewwidth == SCREENWIDTH )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
top = ((SCREENHEIGHT-SBARHEIGHT)-::g->viewheight)/2;
|
||||
side = (SCREENWIDTH-::g->scaledviewwidth)/2;
|
||||
top = ( ( SCREENHEIGHT - SBARHEIGHT ) -::g->viewheight ) / 2;
|
||||
side = ( SCREENWIDTH -::g->scaledviewwidth ) / 2;
|
||||
|
||||
// copy top and one line of left side
|
||||
R_VideoErase (0, top*SCREENWIDTH+side);
|
||||
R_VideoErase( 0, top * SCREENWIDTH + side );
|
||||
|
||||
// copy one line of right side and bottom
|
||||
ofs = (::g->viewheight+top)*SCREENWIDTH-side;
|
||||
R_VideoErase (ofs, top*SCREENWIDTH+side);
|
||||
ofs = ( ::g->viewheight + top ) * SCREENWIDTH - side;
|
||||
R_VideoErase( ofs, top * SCREENWIDTH + side );
|
||||
|
||||
// copy ::g->sides using wraparound
|
||||
ofs = top*SCREENWIDTH + SCREENWIDTH-side;
|
||||
ofs = top * SCREENWIDTH + SCREENWIDTH - side;
|
||||
side <<= 1;
|
||||
|
||||
for (i=1 ; i < ::g->viewheight ; i++)
|
||||
for( i = 1 ; i < ::g->viewheight ; i++ )
|
||||
{
|
||||
R_VideoErase (ofs, side);
|
||||
R_VideoErase( ofs, side );
|
||||
ofs += SCREENWIDTH;
|
||||
}
|
||||
|
||||
// ?
|
||||
V_MarkRect (0,0,SCREENWIDTH, SCREENHEIGHT-SBARHEIGHT);
|
||||
V_MarkRect( 0, 0, SCREENWIDTH, SCREENHEIGHT - SBARHEIGHT );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -49,25 +49,25 @@ extern byte* dc_source;
|
|||
// The span blitting interface.
|
||||
// Hook in assembler or system specific BLT
|
||||
// here.
|
||||
void R_DrawColumn ( lighttable_t * dc_colormap,
|
||||
byte * dc_source );
|
||||
void R_DrawColumn( lighttable_t* dc_colormap,
|
||||
byte* dc_source );
|
||||
|
||||
void R_DrawColumnLow ( lighttable_t * dc_colormap,
|
||||
byte * dc_source );
|
||||
void R_DrawColumnLow( lighttable_t* dc_colormap,
|
||||
byte* dc_source );
|
||||
|
||||
// The Spectre/Invisibility effect.
|
||||
void R_DrawFuzzColumn ( lighttable_t * dc_colormap,
|
||||
byte * dc_source );
|
||||
void R_DrawFuzzColumnLow ( lighttable_t * dc_colormap,
|
||||
byte * dc_source );
|
||||
void R_DrawFuzzColumn( lighttable_t* dc_colormap,
|
||||
byte* dc_source );
|
||||
void R_DrawFuzzColumnLow( lighttable_t* dc_colormap,
|
||||
byte* dc_source );
|
||||
|
||||
// Draw with color translation tables,
|
||||
// for player sprite rendering,
|
||||
// Green/Red/Blue/Indigo shirts.
|
||||
void R_DrawTranslatedColumn ( lighttable_t * dc_colormap,
|
||||
byte * dc_source );
|
||||
void R_DrawTranslatedColumnLow ( lighttable_t * dc_colormap,
|
||||
byte * dc_source );
|
||||
void R_DrawTranslatedColumn( lighttable_t* dc_colormap,
|
||||
byte* dc_source );
|
||||
void R_DrawTranslatedColumnLow( lighttable_t* dc_colormap,
|
||||
byte* dc_source );
|
||||
|
||||
void
|
||||
R_VideoErase
|
||||
|
@ -94,7 +94,7 @@ extern byte* dc_translation;
|
|||
|
||||
// Span blitting for rows, floor/ceiling.
|
||||
// No Sepctre effect needed.
|
||||
void R_DrawSpan (
|
||||
void R_DrawSpan(
|
||||
fixed_t xfrac,
|
||||
fixed_t yfrac,
|
||||
fixed_t ds_y,
|
||||
|
@ -102,19 +102,19 @@ void R_DrawSpan (
|
|||
int ds_x2,
|
||||
fixed_t ds_xstep,
|
||||
fixed_t ds_ystep,
|
||||
lighttable_t * ds_colormap,
|
||||
byte * ds_source );
|
||||
lighttable_t* ds_colormap,
|
||||
byte* ds_source );
|
||||
|
||||
// Low resolution mode, 160x200?
|
||||
void R_DrawSpanLow ( fixed_t xfrac,
|
||||
void R_DrawSpanLow( fixed_t xfrac,
|
||||
fixed_t yfrac,
|
||||
fixed_t ds_y,
|
||||
int ds_x1,
|
||||
int ds_x2,
|
||||
fixed_t ds_xstep,
|
||||
fixed_t ds_ystep,
|
||||
lighttable_t * ds_colormap,
|
||||
byte * ds_source );
|
||||
lighttable_t* ds_colormap,
|
||||
byte* ds_source );
|
||||
|
||||
|
||||
void
|
||||
|
@ -125,15 +125,15 @@ R_InitBuffer
|
|||
|
||||
// Initialize color translation tables,
|
||||
// for player rendering etc.
|
||||
void R_InitTranslationTables (void);
|
||||
void R_InitTranslationTables( void );
|
||||
|
||||
|
||||
|
||||
// Rendering function.
|
||||
void R_FillBackScreen (void);
|
||||
void R_FillBackScreen( void );
|
||||
|
||||
// If the view size is not full screen, draws a border around it.
|
||||
void R_DrawViewBorder (void);
|
||||
void R_DrawViewBorder( void );
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// fixed_t finetangent[FINEANGLES/2];
|
||||
|
||||
// fixed_t finesine[5*FINEANGLES/4];
|
||||
const fixed_t* finecosine = &finesine[FINEANGLES/4];
|
||||
const fixed_t* finecosine = &finesine[FINEANGLES / 4];
|
||||
|
||||
|
||||
|
||||
|
@ -96,23 +96,23 @@ const fixed_t* finecosine = &finesine[FINEANGLES/4];
|
|||
|
||||
|
||||
|
||||
void (*colfunc) (lighttable_t * dc_colormap,
|
||||
byte * dc_source);
|
||||
void (*basecolfunc) (lighttable_t * dc_colormap,
|
||||
byte * dc_source);
|
||||
void (*fuzzcolfunc) (lighttable_t * dc_colormap,
|
||||
byte * dc_source);
|
||||
void (*transcolfunc) (lighttable_t * dc_colormap,
|
||||
byte * dc_source);
|
||||
void (*spanfunc) (fixed_t xfrac,
|
||||
void ( *colfunc )( lighttable_t* dc_colormap,
|
||||
byte* dc_source );
|
||||
void ( *basecolfunc )( lighttable_t* dc_colormap,
|
||||
byte* dc_source );
|
||||
void ( *fuzzcolfunc )( lighttable_t* dc_colormap,
|
||||
byte* dc_source );
|
||||
void ( *transcolfunc )( lighttable_t* dc_colormap,
|
||||
byte* dc_source );
|
||||
void ( *spanfunc )( fixed_t xfrac,
|
||||
fixed_t yfrac,
|
||||
fixed_t ds_y,
|
||||
int ds_x1,
|
||||
int ds_x2,
|
||||
fixed_t ds_xstep,
|
||||
fixed_t ds_ystep,
|
||||
lighttable_t * ds_colormap,
|
||||
byte * ds_source);
|
||||
lighttable_t* ds_colormap,
|
||||
byte* ds_source );
|
||||
|
||||
|
||||
|
||||
|
@ -127,14 +127,22 @@ R_AddPointToBox
|
|||
int y,
|
||||
fixed_t* box )
|
||||
{
|
||||
if (x< box[BOXLEFT])
|
||||
if( x < box[BOXLEFT] )
|
||||
{
|
||||
box[BOXLEFT] = x;
|
||||
if (x> box[BOXRIGHT])
|
||||
}
|
||||
if( x > box[BOXRIGHT] )
|
||||
{
|
||||
box[BOXRIGHT] = x;
|
||||
if (y< box[BOXBOTTOM])
|
||||
}
|
||||
if( y < box[BOXBOTTOM] )
|
||||
{
|
||||
box[BOXBOTTOM] = y;
|
||||
if (y> box[BOXTOP])
|
||||
}
|
||||
if( y > box[BOXTOP] )
|
||||
{
|
||||
box[BOXTOP] = y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -155,28 +163,32 @@ R_PointOnSide
|
|||
fixed_t left;
|
||||
fixed_t right;
|
||||
|
||||
if (!node->dx)
|
||||
if( !node->dx )
|
||||
{
|
||||
if( x <= node->x )
|
||||
{
|
||||
if (x <= node->x)
|
||||
return node->dy > 0;
|
||||
}
|
||||
|
||||
return node->dy < 0;
|
||||
}
|
||||
if (!node->dy)
|
||||
if( !node->dy )
|
||||
{
|
||||
if( y <= node->y )
|
||||
{
|
||||
if (y <= node->y)
|
||||
return node->dx < 0;
|
||||
}
|
||||
|
||||
return node->dx > 0;
|
||||
}
|
||||
|
||||
dx = (x - node->x);
|
||||
dy = (y - node->y);
|
||||
dx = ( x - node->x );
|
||||
dy = ( y - node->y );
|
||||
|
||||
// Try to quickly decide by looking at sign bits.
|
||||
if ( (node->dy ^ node->dx ^ dx ^ dy)&0x80000000 )
|
||||
if( ( node->dy ^ node->dx ^ dx ^ dy ) & 0x80000000 )
|
||||
{
|
||||
if ( (node->dy ^ dx) & 0x80000000 )
|
||||
if( ( node->dy ^ dx ) & 0x80000000 )
|
||||
{
|
||||
// (left is negative)
|
||||
return 1;
|
||||
|
@ -184,10 +196,10 @@ R_PointOnSide
|
|||
return 0;
|
||||
}
|
||||
|
||||
left = FixedMul ( node->dy>>FRACBITS , dx );
|
||||
right = FixedMul ( dy , node->dx>>FRACBITS );
|
||||
left = FixedMul( node->dy >> FRACBITS , dx );
|
||||
right = FixedMul( dy , node->dx >> FRACBITS );
|
||||
|
||||
if (right < left)
|
||||
if( right < left )
|
||||
{
|
||||
// front side
|
||||
return 0;
|
||||
|
@ -218,28 +230,32 @@ R_PointOnSegSide
|
|||
ldx = line->v2->x - lx;
|
||||
ldy = line->v2->y - ly;
|
||||
|
||||
if (!ldx)
|
||||
if( !ldx )
|
||||
{
|
||||
if( x <= lx )
|
||||
{
|
||||
if (x <= lx)
|
||||
return ldy > 0;
|
||||
}
|
||||
|
||||
return ldy < 0;
|
||||
}
|
||||
if (!ldy)
|
||||
if( !ldy )
|
||||
{
|
||||
if( y <= ly )
|
||||
{
|
||||
if (y <= ly)
|
||||
return ldx < 0;
|
||||
}
|
||||
|
||||
return ldx > 0;
|
||||
}
|
||||
|
||||
dx = (x - lx);
|
||||
dy = (y - ly);
|
||||
dx = ( x - lx );
|
||||
dy = ( y - ly );
|
||||
|
||||
// Try to quickly decide by looking at sign bits.
|
||||
if ( (ldy ^ ldx ^ dx ^ dy)&0x80000000 )
|
||||
if( ( ldy ^ ldx ^ dx ^ dy ) & 0x80000000 )
|
||||
{
|
||||
if ( (ldy ^ dx) & 0x80000000 )
|
||||
if( ( ldy ^ dx ) & 0x80000000 )
|
||||
{
|
||||
// (left is negative)
|
||||
return 1;
|
||||
|
@ -247,10 +263,10 @@ R_PointOnSegSide
|
|||
return 0;
|
||||
}
|
||||
|
||||
left = FixedMul ( ldy>>FRACBITS , dx );
|
||||
right = FixedMul ( dy , ldx>>FRACBITS );
|
||||
left = FixedMul( ldy >> FRACBITS , dx );
|
||||
right = FixedMul( dy , ldx >> FRACBITS );
|
||||
|
||||
if (right < left)
|
||||
if( right < left )
|
||||
{
|
||||
// front side
|
||||
return 0;
|
||||
|
@ -279,29 +295,32 @@ R_PointToAngle
|
|||
( fixed_t x,
|
||||
fixed_t y )
|
||||
{
|
||||
extern fixed_t GetViewX(); extern fixed_t GetViewY();
|
||||
extern fixed_t GetViewX();
|
||||
extern fixed_t GetViewY();
|
||||
x -= GetViewX();
|
||||
y -= GetViewY();
|
||||
|
||||
if ( (!x) && (!y) )
|
||||
if( ( !x ) && ( !y ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (x>= 0)
|
||||
if( x >= 0 )
|
||||
{
|
||||
// x >=0
|
||||
if (y>= 0)
|
||||
if( y >= 0 )
|
||||
{
|
||||
// y>= 0
|
||||
|
||||
if (x>y)
|
||||
if( x > y )
|
||||
{
|
||||
// octant 0
|
||||
return tantoangle[ SlopeDiv(y,x)];
|
||||
return tantoangle[ SlopeDiv( y, x )];
|
||||
}
|
||||
else
|
||||
{
|
||||
// octant 1
|
||||
return ANG90-1-tantoangle[ SlopeDiv(x,y)];
|
||||
return ANG90 - 1 - tantoangle[ SlopeDiv( x, y )];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -309,15 +328,15 @@ R_PointToAngle
|
|||
// y<0
|
||||
y = -y;
|
||||
|
||||
if (x>y)
|
||||
if( x > y )
|
||||
{
|
||||
// octant 8
|
||||
return -tantoangle[SlopeDiv(y,x)]; // // ALANHACK UNSIGNED
|
||||
return -tantoangle[SlopeDiv( y, x )]; // // ALANHACK UNSIGNED
|
||||
}
|
||||
else
|
||||
{
|
||||
// octant 7
|
||||
return ANG270+tantoangle[ SlopeDiv(x,y)];
|
||||
return ANG270 + tantoangle[ SlopeDiv( x, y )];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -326,18 +345,18 @@ R_PointToAngle
|
|||
// x<0
|
||||
x = -x;
|
||||
|
||||
if (y>= 0)
|
||||
if( y >= 0 )
|
||||
{
|
||||
// y>= 0
|
||||
if (x>y)
|
||||
if( x > y )
|
||||
{
|
||||
// octant 3
|
||||
return ANG180-1-tantoangle[ SlopeDiv(y,x)];
|
||||
return ANG180 - 1 - tantoangle[ SlopeDiv( y, x )];
|
||||
}
|
||||
else
|
||||
{
|
||||
// octant 2
|
||||
return ANG90+ tantoangle[ SlopeDiv(x,y)];
|
||||
return ANG90 + tantoangle[ SlopeDiv( x, y )];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -345,15 +364,15 @@ R_PointToAngle
|
|||
// y<0
|
||||
y = -y;
|
||||
|
||||
if (x>y)
|
||||
if( x > y )
|
||||
{
|
||||
// octant 4
|
||||
return ANG180+tantoangle[ SlopeDiv(y,x)];
|
||||
return ANG180 + tantoangle[ SlopeDiv( y, x )];
|
||||
}
|
||||
else
|
||||
{
|
||||
// octant 5
|
||||
return ANG270-1-tantoangle[ SlopeDiv(x,y)];
|
||||
return ANG270 - 1 - tantoangle[ SlopeDiv( x, y )];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -368,11 +387,12 @@ R_PointToAngle2
|
|||
fixed_t x2,
|
||||
fixed_t y2 )
|
||||
{
|
||||
extern void SetViewX( fixed_t ); extern void SetViewY( fixed_t );
|
||||
extern void SetViewX( fixed_t );
|
||||
extern void SetViewY( fixed_t );
|
||||
SetViewX( x1 );
|
||||
SetViewY( y1 );
|
||||
|
||||
return R_PointToAngle (x2, y2);
|
||||
return R_PointToAngle( x2, y2 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -387,21 +407,22 @@ R_PointToDist
|
|||
fixed_t temp;
|
||||
fixed_t dist;
|
||||
|
||||
extern fixed_t GetViewX(); extern fixed_t GetViewY();
|
||||
dx = abs(x - GetViewX());
|
||||
dy = abs(y - GetViewY());
|
||||
extern fixed_t GetViewX();
|
||||
extern fixed_t GetViewY();
|
||||
dx = abs( x - GetViewX() );
|
||||
dy = abs( y - GetViewY() );
|
||||
|
||||
if (dy>dx)
|
||||
if( dy > dx )
|
||||
{
|
||||
temp = dx;
|
||||
dx = dy;
|
||||
dy = temp;
|
||||
}
|
||||
|
||||
angle = (tantoangle[ FixedDiv(dy,dx)>>DBITS ]+ANG90) >> ANGLETOFINESHIFT;
|
||||
angle = ( tantoangle[ FixedDiv( dy, dx ) >> DBITS ] + ANG90 ) >> ANGLETOFINESHIFT;
|
||||
|
||||
// use as cosine
|
||||
dist = FixedDiv (dx, finesine[angle] );
|
||||
dist = FixedDiv( dx, finesine[angle] );
|
||||
|
||||
return dist;
|
||||
}
|
||||
|
@ -412,7 +433,7 @@ R_PointToDist
|
|||
//
|
||||
// R_InitPointToAngle
|
||||
//
|
||||
void R_InitPointToAngle (void)
|
||||
void R_InitPointToAngle( void )
|
||||
{
|
||||
// UNUSED - now getting from tables.c
|
||||
#if 0
|
||||
|
@ -422,10 +443,10 @@ void R_InitPointToAngle (void)
|
|||
//
|
||||
// slope (tangent) to angle lookup
|
||||
//
|
||||
for (i=0 ; i<=SLOPERANGE ; i++)
|
||||
for( i = 0 ; i <= SLOPERANGE ; i++ )
|
||||
{
|
||||
f = atan( (float)i/SLOPERANGE )/(3.141592657*2);
|
||||
t = 0xffffffff*f;
|
||||
f = atan( ( float )i / SLOPERANGE ) / ( 3.141592657 * 2 );
|
||||
t = 0xffffffff * f;
|
||||
tantoangle[i] = t;
|
||||
}
|
||||
#endif
|
||||
|
@ -439,7 +460,7 @@ void R_InitPointToAngle (void)
|
|||
// at the given angle.
|
||||
// ::g->rw_distance must be calculated first.
|
||||
//
|
||||
fixed_t R_ScaleFromGlobalAngle (angle_t visangle)
|
||||
fixed_t R_ScaleFromGlobalAngle( angle_t visangle )
|
||||
{
|
||||
fixed_t scale;
|
||||
//int anglea;
|
||||
|
@ -459,37 +480,43 @@ fixed_t R_ScaleFromGlobalAngle (angle_t visangle)
|
|||
fixed_t sinv;
|
||||
fixed_t cosv;
|
||||
|
||||
sinv = finesine[(visangle-::g->rw_normalangle)>>ANGLETOFINESHIFT];
|
||||
dist = FixedDiv (::g->rw_distance, sinv);
|
||||
cosv = finecosine[(::g->viewangle-visangle)>>ANGLETOFINESHIFT];
|
||||
z = abs(FixedMul (dist, cosv));
|
||||
scale = FixedDiv(::g->projection, z);
|
||||
sinv = finesine[( visangle -::g->rw_normalangle ) >> ANGLETOFINESHIFT];
|
||||
dist = FixedDiv( ::g->rw_distance, sinv );
|
||||
cosv = finecosine[( ::g->viewangle - visangle ) >> ANGLETOFINESHIFT];
|
||||
z = abs( FixedMul( dist, cosv ) );
|
||||
scale = FixedDiv( ::g->projection, z );
|
||||
return scale;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern angle_t GetViewAngle();
|
||||
anglea = ANG90 + (visangle-GetViewAngle());
|
||||
angleb = ANG90 + (visangle-::g->rw_normalangle);
|
||||
anglea = ANG90 + ( visangle - GetViewAngle() );
|
||||
angleb = ANG90 + ( visangle -::g->rw_normalangle );
|
||||
|
||||
// both sines are allways positive
|
||||
sinea = finesine[anglea>>ANGLETOFINESHIFT];
|
||||
sineb = finesine[angleb>>ANGLETOFINESHIFT];
|
||||
num = FixedMul(::g->projection,sineb) << ::g->detailshift;
|
||||
den = FixedMul(::g->rw_distance,sinea);
|
||||
sinea = finesine[anglea >> ANGLETOFINESHIFT];
|
||||
sineb = finesine[angleb >> ANGLETOFINESHIFT];
|
||||
num = FixedMul( ::g->projection, sineb ) << ::g->detailshift;
|
||||
den = FixedMul( ::g->rw_distance, sinea );
|
||||
|
||||
// DHM - Nerve :: If the den is pretty much 0, don't try the divide
|
||||
if (den>>8 > 0 && den > num>>16)
|
||||
if( den >> 8 > 0 && den > num >> 16 )
|
||||
{
|
||||
scale = FixedDiv (num, den);
|
||||
scale = FixedDiv( num, den );
|
||||
|
||||
if (scale > 64*FRACUNIT)
|
||||
scale = 64*FRACUNIT;
|
||||
else if (scale < 256)
|
||||
if( scale > 64 * FRACUNIT )
|
||||
{
|
||||
scale = 64 * FRACUNIT;
|
||||
}
|
||||
else if( scale < 256 )
|
||||
{
|
||||
scale = 256;
|
||||
}
|
||||
}
|
||||
else
|
||||
scale = 64*FRACUNIT;
|
||||
{
|
||||
scale = 64 * FRACUNIT;
|
||||
}
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
@ -499,7 +526,7 @@ fixed_t R_ScaleFromGlobalAngle (angle_t visangle)
|
|||
//
|
||||
// R_InitTables
|
||||
//
|
||||
void R_InitTables (void)
|
||||
void R_InitTables( void )
|
||||
{
|
||||
// UNUSED: now getting from tables.c
|
||||
#if 0
|
||||
|
@ -509,20 +536,20 @@ void R_InitTables (void)
|
|||
int t;
|
||||
|
||||
// ::g->viewangle tangent table
|
||||
for (i=0 ; i<FINEANGLES/2 ; i++)
|
||||
for( i = 0 ; i < FINEANGLES / 2 ; i++ )
|
||||
{
|
||||
a = (i-FINEANGLES/4+0.5)*PI*2/FINEANGLES;
|
||||
fv = FRACUNIT*tan (a);
|
||||
a = ( i - FINEANGLES / 4 + 0.5 ) * PI * 2 / FINEANGLES;
|
||||
fv = FRACUNIT * tan( a );
|
||||
t = fv;
|
||||
finetangent[i] = t;
|
||||
}
|
||||
|
||||
// finesine table
|
||||
for (i=0 ; i<5*FINEANGLES/4 ; i++)
|
||||
for( i = 0 ; i < 5 * FINEANGLES / 4 ; i++ )
|
||||
{
|
||||
// OPTIMIZE: mirror...
|
||||
a = (i+0.5)*PI*2/FINEANGLES;
|
||||
t = FRACUNIT*sin (a);
|
||||
a = ( i + 0.5 ) * PI * 2 / FINEANGLES;
|
||||
t = FRACUNIT * sin( a );
|
||||
finesine[i] = t;
|
||||
}
|
||||
#endif
|
||||
|
@ -534,7 +561,7 @@ void R_InitTables (void)
|
|||
//
|
||||
// R_InitTextureMapping
|
||||
//
|
||||
void R_InitTextureMapping (void)
|
||||
void R_InitTextureMapping( void )
|
||||
{
|
||||
int i;
|
||||
int x;
|
||||
|
@ -547,24 +574,32 @@ void R_InitTextureMapping (void)
|
|||
//
|
||||
// Calc focallength
|
||||
// so FIELDOFVIEW angles covers SCREENWIDTH.
|
||||
focallength = FixedDiv (::g->centerxfrac,
|
||||
finetangent[FINEANGLES/4+FIELDOFVIEW/2] );
|
||||
focallength = FixedDiv( ::g->centerxfrac,
|
||||
finetangent[FINEANGLES / 4 + FIELDOFVIEW / 2] );
|
||||
|
||||
for (i=0 ; i<FINEANGLES/2 ; i++)
|
||||
for( i = 0 ; i < FINEANGLES / 2 ; i++ )
|
||||
{
|
||||
if( finetangent[i] > FRACUNIT * 2 )
|
||||
{
|
||||
if (finetangent[i] > FRACUNIT*2)
|
||||
t = -1;
|
||||
else if (finetangent[i] < -FRACUNIT*2)
|
||||
t = ::g->viewwidth+1;
|
||||
}
|
||||
else if( finetangent[i] < -FRACUNIT * 2 )
|
||||
{
|
||||
t = ::g->viewwidth + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = FixedMul (finetangent[i], focallength);
|
||||
t = (::g->centerxfrac - t+FRACUNIT-1)>>FRACBITS;
|
||||
t = FixedMul( finetangent[i], focallength );
|
||||
t = ( ::g->centerxfrac - t + FRACUNIT - 1 ) >> FRACBITS;
|
||||
|
||||
if (t < -1)
|
||||
if( t < -1 )
|
||||
{
|
||||
t = -1;
|
||||
else if (t>::g->viewwidth+1)
|
||||
t = ::g->viewwidth+1;
|
||||
}
|
||||
else if( t >::g->viewwidth + 1 )
|
||||
{
|
||||
t = ::g->viewwidth + 1;
|
||||
}
|
||||
}
|
||||
::g->viewangletox[i] = t;
|
||||
}
|
||||
|
@ -572,25 +607,31 @@ void R_InitTextureMapping (void)
|
|||
// Scan ::g->viewangletox[] to generate ::g->xtoviewangle[]:
|
||||
// ::g->xtoviewangle will give the smallest view angle
|
||||
// that maps to x.
|
||||
for (x=0;x<=::g->viewwidth;x++)
|
||||
for( x = 0; x <=::g->viewwidth; x++ )
|
||||
{
|
||||
i = 0;
|
||||
while (::g->viewangletox[i]>x)
|
||||
while( ::g->viewangletox[i] > x )
|
||||
{
|
||||
i++;
|
||||
::g->xtoviewangle[x] = (i<<ANGLETOFINESHIFT)-ANG90;
|
||||
}
|
||||
::g->xtoviewangle[x] = ( i << ANGLETOFINESHIFT ) - ANG90;
|
||||
}
|
||||
|
||||
// Take out the fencepost cases from ::g->viewangletox.
|
||||
for (i=0 ; i<FINEANGLES/2 ; i++)
|
||||
for( i = 0 ; i < FINEANGLES / 2 ; i++ )
|
||||
{
|
||||
t = FixedMul (finetangent[i], focallength);
|
||||
t = FixedMul( finetangent[i], focallength );
|
||||
t = ::g->centerx - t;
|
||||
|
||||
if (::g->viewangletox[i] == -1)
|
||||
if( ::g->viewangletox[i] == -1 )
|
||||
{
|
||||
::g->viewangletox[i] = 0;
|
||||
else if (::g->viewangletox[i] == ::g->viewwidth+1)
|
||||
}
|
||||
else if( ::g->viewangletox[i] == ::g->viewwidth + 1 )
|
||||
{
|
||||
::g->viewangletox[i] = ::g->viewwidth;
|
||||
}
|
||||
}
|
||||
|
||||
::g->clipangle = ::g->xtoviewangle[0];
|
||||
}
|
||||
|
@ -603,7 +644,7 @@ void R_InitTextureMapping (void)
|
|||
// because the ::g->scalelight table changes with view size.
|
||||
//
|
||||
|
||||
void R_InitLightTables (void)
|
||||
void R_InitLightTables( void )
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
|
@ -613,22 +654,26 @@ void R_InitLightTables (void)
|
|||
|
||||
// Calculate the light levels to use
|
||||
// for each level / distance combination.
|
||||
for (i=0 ; i< LIGHTLEVELS ; i++)
|
||||
for( i = 0 ; i < LIGHTLEVELS ; i++ )
|
||||
{
|
||||
nocollide_startmap = ((LIGHTLEVELS-1-i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
|
||||
for (j=0 ; j<MAXLIGHTZ ; j++)
|
||||
nocollide_startmap = ( ( LIGHTLEVELS - 1 - i ) * 2 ) * NUMCOLORMAPS / LIGHTLEVELS;
|
||||
for( j = 0 ; j < MAXLIGHTZ ; j++ )
|
||||
{
|
||||
scale = FixedDiv ((SCREENWIDTH/2*FRACUNIT), (j+1)<<LIGHTZSHIFT);
|
||||
scale = FixedDiv( ( SCREENWIDTH / 2 * FRACUNIT ), ( j + 1 ) << LIGHTZSHIFT );
|
||||
scale >>= LIGHTSCALESHIFT;
|
||||
level = nocollide_startmap - scale/DISTMAP;
|
||||
level = nocollide_startmap - scale / DISTMAP;
|
||||
|
||||
if (level < 0)
|
||||
if( level < 0 )
|
||||
{
|
||||
level = 0;
|
||||
}
|
||||
|
||||
if (level >= NUMCOLORMAPS)
|
||||
level = NUMCOLORMAPS-1;
|
||||
if( level >= NUMCOLORMAPS )
|
||||
{
|
||||
level = NUMCOLORMAPS - 1;
|
||||
}
|
||||
|
||||
::g->zlight[i][j] = ::g->colormaps + level*256;
|
||||
::g->zlight[i][j] = ::g->colormaps + level * 256;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -657,7 +702,7 @@ R_SetViewSize
|
|||
//
|
||||
// R_ExecuteSetViewSize
|
||||
//
|
||||
void R_ExecuteSetViewSize (void)
|
||||
void R_ExecuteSetViewSize( void )
|
||||
{
|
||||
fixed_t cosadj;
|
||||
fixed_t dy;
|
||||
|
@ -668,15 +713,15 @@ void R_ExecuteSetViewSize (void)
|
|||
|
||||
::g->setsizeneeded = false;
|
||||
|
||||
if (::g->setblocks == 11)
|
||||
if( ::g->setblocks == 11 )
|
||||
{
|
||||
::g->scaledviewwidth = ORIGINAL_WIDTH;
|
||||
::g->viewheight = ORIGINAL_HEIGHT;
|
||||
}
|
||||
else
|
||||
{
|
||||
::g->scaledviewwidth = ::g->setblocks*32;
|
||||
::g->viewheight = (::g->setblocks*168/10)&~7;
|
||||
::g->scaledviewwidth = ::g->setblocks * 32;
|
||||
::g->viewheight = ( ::g->setblocks * 168 / 10 ) & ~7;
|
||||
}
|
||||
|
||||
// SMF - temp
|
||||
|
@ -684,15 +729,15 @@ void R_ExecuteSetViewSize (void)
|
|||
::g->viewheight *= GLOBAL_IMAGE_SCALER;
|
||||
|
||||
::g->detailshift = ::g->setdetail;
|
||||
::g->viewwidth = ::g->scaledviewwidth>>::g->detailshift;
|
||||
::g->viewwidth = ::g->scaledviewwidth >>::g->detailshift;
|
||||
|
||||
::g->centery = ::g->viewheight/2;
|
||||
::g->centerx = ::g->viewwidth/2;
|
||||
::g->centerxfrac = ::g->centerx<<FRACBITS;
|
||||
::g->centeryfrac = ::g->centery<<FRACBITS;
|
||||
::g->centery = ::g->viewheight / 2;
|
||||
::g->centerx = ::g->viewwidth / 2;
|
||||
::g->centerxfrac = ::g->centerx << FRACBITS;
|
||||
::g->centeryfrac = ::g->centery << FRACBITS;
|
||||
::g->projection = ::g->centerxfrac;
|
||||
|
||||
if (!::g->detailshift)
|
||||
if( !::g->detailshift )
|
||||
{
|
||||
colfunc = basecolfunc = R_DrawColumn;
|
||||
fuzzcolfunc = R_DrawFuzzColumn;
|
||||
|
@ -707,48 +752,54 @@ void R_ExecuteSetViewSize (void)
|
|||
spanfunc = R_DrawSpanLow;
|
||||
}
|
||||
|
||||
R_InitBuffer (::g->scaledviewwidth, ::g->viewheight);
|
||||
R_InitBuffer( ::g->scaledviewwidth, ::g->viewheight );
|
||||
|
||||
R_InitTextureMapping ();
|
||||
R_InitTextureMapping();
|
||||
|
||||
// psprite scales
|
||||
::g->pspritescale = FRACUNIT*::g->viewwidth/ORIGINAL_WIDTH;
|
||||
::g->pspriteiscale = FRACUNIT*ORIGINAL_WIDTH/::g->viewwidth;
|
||||
::g->pspritescale = FRACUNIT*::g->viewwidth / ORIGINAL_WIDTH;
|
||||
::g->pspriteiscale = FRACUNIT * ORIGINAL_WIDTH /::g->viewwidth;
|
||||
|
||||
// thing clipping
|
||||
for (i=0 ; i < ::g->viewwidth ; i++)
|
||||
::g->screenheightarray[i] = ::g->viewheight;
|
||||
|
||||
// planes
|
||||
for (i=0 ; i < ::g->viewheight ; i++)
|
||||
for( i = 0 ; i < ::g->viewwidth ; i++ )
|
||||
{
|
||||
dy = ((i-::g->viewheight/2)<<FRACBITS)+FRACUNIT/2;
|
||||
dy = abs(dy);
|
||||
::g->yslope[i] = FixedDiv ( (::g->viewwidth << ::g->detailshift)/2*FRACUNIT, dy);
|
||||
::g->screenheightarray[i] = ::g->viewheight;
|
||||
}
|
||||
|
||||
for (i=0 ; i < ::g->viewwidth ; i++)
|
||||
// planes
|
||||
for( i = 0 ; i < ::g->viewheight ; i++ )
|
||||
{
|
||||
cosadj = abs(finecosine[::g->xtoviewangle[i]>>ANGLETOFINESHIFT]);
|
||||
::g->distscale[i] = FixedDiv (FRACUNIT,cosadj);
|
||||
dy = ( ( i -::g->viewheight / 2 ) << FRACBITS ) + FRACUNIT / 2;
|
||||
dy = abs( dy );
|
||||
::g->yslope[i] = FixedDiv( ( ::g->viewwidth << ::g->detailshift ) / 2 * FRACUNIT, dy );
|
||||
}
|
||||
|
||||
for( i = 0 ; i < ::g->viewwidth ; i++ )
|
||||
{
|
||||
cosadj = abs( finecosine[::g->xtoviewangle[i] >> ANGLETOFINESHIFT] );
|
||||
::g->distscale[i] = FixedDiv( FRACUNIT, cosadj );
|
||||
}
|
||||
|
||||
// Calculate the light levels to use
|
||||
// for each level / scale combination.
|
||||
for (i=0 ; i< LIGHTLEVELS ; i++)
|
||||
for( i = 0 ; i < LIGHTLEVELS ; i++ )
|
||||
{
|
||||
nocollide_startmap = ((LIGHTLEVELS-1-i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
|
||||
for (j=0 ; j<MAXLIGHTSCALE ; j++)
|
||||
nocollide_startmap = ( ( LIGHTLEVELS - 1 - i ) * 2 ) * NUMCOLORMAPS / LIGHTLEVELS;
|
||||
for( j = 0 ; j < MAXLIGHTSCALE ; j++ )
|
||||
{
|
||||
level = nocollide_startmap - j*SCREENWIDTH/(::g->viewwidth << ::g->detailshift)/DISTMAP;
|
||||
level = nocollide_startmap - j * SCREENWIDTH / ( ::g->viewwidth << ::g->detailshift ) / DISTMAP;
|
||||
|
||||
if (level < 0)
|
||||
if( level < 0 )
|
||||
{
|
||||
level = 0;
|
||||
}
|
||||
|
||||
if (level >= NUMCOLORMAPS)
|
||||
level = NUMCOLORMAPS-1;
|
||||
if( level >= NUMCOLORMAPS )
|
||||
{
|
||||
level = NUMCOLORMAPS - 1;
|
||||
}
|
||||
|
||||
::g->scalelight[i][j] = ::g->colormaps + level*256;
|
||||
::g->scalelight[i][j] = ::g->colormaps + level * 256;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -761,25 +812,25 @@ void R_ExecuteSetViewSize (void)
|
|||
|
||||
|
||||
|
||||
void R_Init (void)
|
||||
void R_Init( void )
|
||||
{
|
||||
R_InitData ();
|
||||
I_Printf ("\nR_InitData");
|
||||
R_InitPointToAngle ();
|
||||
I_Printf ("\nR_InitPointToAngle");
|
||||
R_InitTables ();
|
||||
R_InitData();
|
||||
I_Printf( "\nR_InitData" );
|
||||
R_InitPointToAngle();
|
||||
I_Printf( "\nR_InitPointToAngle" );
|
||||
R_InitTables();
|
||||
// ::g->viewwidth / ::g->viewheight / ::g->detailLevel are set by the defaults
|
||||
I_Printf ("\nR_InitTables");
|
||||
I_Printf( "\nR_InitTables" );
|
||||
|
||||
R_SetViewSize (::g->screenblocks, ::g->detailLevel);
|
||||
R_InitPlanes ();
|
||||
I_Printf ("\nR_InitPlanes");
|
||||
R_InitLightTables ();
|
||||
I_Printf ("\nR_InitLightTables");
|
||||
R_InitSkyMap ();
|
||||
I_Printf ("\nR_InitSkyMap");
|
||||
R_InitTranslationTables ();
|
||||
I_Printf ("\nR_InitTranslationsTables");
|
||||
R_SetViewSize( ::g->screenblocks, ::g->detailLevel );
|
||||
R_InitPlanes();
|
||||
I_Printf( "\nR_InitPlanes" );
|
||||
R_InitLightTables();
|
||||
I_Printf( "\nR_InitLightTables" );
|
||||
R_InitSkyMap();
|
||||
I_Printf( "\nR_InitSkyMap" );
|
||||
R_InitTranslationTables();
|
||||
I_Printf( "\nR_InitTranslationsTables" );
|
||||
|
||||
::g->framecount = 0;
|
||||
}
|
||||
|
@ -798,15 +849,17 @@ R_PointInSubsector
|
|||
int nodenum;
|
||||
|
||||
// single subsector is a special case
|
||||
if (!::g->numnodes)
|
||||
if( !::g->numnodes )
|
||||
{
|
||||
return ::g->subsectors;
|
||||
}
|
||||
|
||||
nodenum = ::g->numnodes-1;
|
||||
nodenum = ::g->numnodes - 1;
|
||||
|
||||
while (! (nodenum & NF_SUBSECTOR) )
|
||||
while( !( nodenum & NF_SUBSECTOR ) )
|
||||
{
|
||||
node = &::g->nodes[nodenum];
|
||||
side = R_PointOnSide (x, y, node);
|
||||
side = R_PointOnSide( x, y, node );
|
||||
nodenum = node->children[side];
|
||||
}
|
||||
|
||||
|
@ -818,12 +871,14 @@ R_PointInSubsector
|
|||
//
|
||||
// R_SetupFrame
|
||||
//
|
||||
void R_SetupFrame (player_t* player)
|
||||
void R_SetupFrame( player_t* player )
|
||||
{
|
||||
int i;
|
||||
|
||||
::g->viewplayer = player;
|
||||
extern void SetViewX( fixed_t ); extern void SetViewY( fixed_t ); extern void SetViewAngle( angle_t );
|
||||
extern void SetViewX( fixed_t );
|
||||
extern void SetViewY( fixed_t );
|
||||
extern void SetViewAngle( angle_t );
|
||||
SetViewX( player->mo->x );
|
||||
SetViewY( player->mo->y );
|
||||
SetViewAngle( player->mo->angle + ::g->viewangleoffset );
|
||||
|
@ -833,24 +888,28 @@ void R_SetupFrame (player_t* player)
|
|||
|
||||
extern angle_t GetViewAngle();
|
||||
|
||||
::g->viewsin = finesine[GetViewAngle()>>ANGLETOFINESHIFT];
|
||||
::g->viewcos = finecosine[GetViewAngle()>>ANGLETOFINESHIFT];
|
||||
::g->viewsin = finesine[GetViewAngle() >> ANGLETOFINESHIFT];
|
||||
::g->viewcos = finecosine[GetViewAngle() >> ANGLETOFINESHIFT];
|
||||
|
||||
::g->sscount = 0;
|
||||
|
||||
if (player->fixedcolormap)
|
||||
if( player->fixedcolormap )
|
||||
{
|
||||
::g->fixedcolormap =
|
||||
::g->colormaps
|
||||
+ player->fixedcolormap*256*sizeof(lighttable_t);
|
||||
+ player->fixedcolormap * 256 * sizeof( lighttable_t );
|
||||
|
||||
::g->walllights = ::g->scalelightfixed;
|
||||
|
||||
for (i=0 ; i<MAXLIGHTSCALE ; i++)
|
||||
for( i = 0 ; i < MAXLIGHTSCALE ; i++ )
|
||||
{
|
||||
::g->scalelightfixed[i] = ::g->fixedcolormap;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
::g->fixedcolormap = 0;
|
||||
}
|
||||
|
||||
::g->framecount++;
|
||||
::g->validcount++;
|
||||
|
@ -861,37 +920,38 @@ void R_SetupFrame (player_t* player)
|
|||
//
|
||||
// R_RenderView
|
||||
//
|
||||
void R_RenderPlayerView (player_t* player)
|
||||
void R_RenderPlayerView( player_t* player )
|
||||
{
|
||||
if ( player->mo == NULL ) {
|
||||
if( player->mo == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
R_SetupFrame (player);
|
||||
R_SetupFrame( player );
|
||||
|
||||
// Clear buffers.
|
||||
R_ClearClipSegs ();
|
||||
R_ClearDrawSegs ();
|
||||
R_ClearPlanes ();
|
||||
R_ClearSprites ();
|
||||
R_ClearClipSegs();
|
||||
R_ClearDrawSegs();
|
||||
R_ClearPlanes();
|
||||
R_ClearSprites();
|
||||
|
||||
// check for new console commands.
|
||||
NetUpdate ( NULL );
|
||||
NetUpdate( NULL );
|
||||
|
||||
// The head node is the last node output.
|
||||
R_RenderBSPNode (::g->numnodes-1);
|
||||
R_RenderBSPNode( ::g->numnodes - 1 );
|
||||
|
||||
// Check for new console commands.
|
||||
NetUpdate ( NULL );
|
||||
NetUpdate( NULL );
|
||||
|
||||
R_DrawPlanes ();
|
||||
R_DrawPlanes();
|
||||
|
||||
// Check for new console commands.
|
||||
NetUpdate ( NULL );
|
||||
NetUpdate( NULL );
|
||||
|
||||
R_DrawMasked ();
|
||||
R_DrawMasked();
|
||||
|
||||
// Check for new console commands.
|
||||
NetUpdate ( NULL );
|
||||
NetUpdate( NULL );
|
||||
}
|
||||
|
||||
|
|
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