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
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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[];
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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 );
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,515 +26,545 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
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;
|
||||
// am_map.constructs end //
|
||||
// doomstat.constructs begin //
|
||||
::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;
|
||||
// d_main.constructs end //
|
||||
// d_net.constructs begin //
|
||||
doomcom_t temp_doomcom = {
|
||||
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;
|
||||
// am_map.constructs end //
|
||||
// doomstat.constructs begin //
|
||||
::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;
|
||||
// d_main.constructs end //
|
||||
// d_net.constructs begin //
|
||||
doomcom_t temp_doomcom =
|
||||
{
|
||||
0
|
||||
};
|
||||
memcpy( &::g->doomcom, &temp_doomcom, sizeof(temp_doomcom) );
|
||||
// d_net.constructs end //
|
||||
// f_wipe.constructs begin //
|
||||
::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
|
||||
};
|
||||
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->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;
|
||||
// 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;
|
||||
// hu_stuff.constructs end //
|
||||
// i_input.constructs begin //
|
||||
// i_input.constructs end //
|
||||
// i_system.constructs begin //
|
||||
::g->mb_used = 2;
|
||||
::g->current_time = 0;
|
||||
// i_system.constructs end //
|
||||
// m_cheat.constructs begin //
|
||||
::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'}
|
||||
memcpy( &::g->doomcom, &temp_doomcom, sizeof( temp_doomcom ) );
|
||||
// d_net.constructs end //
|
||||
// f_wipe.constructs begin //
|
||||
::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
|
||||
};
|
||||
memcpy( ::g->QuitMenu, temp_QuitMenu, sizeof(temp_QuitMenu) );
|
||||
menu_t temp_QuitDef = {
|
||||
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->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;
|
||||
// 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;
|
||||
// hu_stuff.constructs end //
|
||||
// i_input.constructs begin //
|
||||
// i_input.constructs end //
|
||||
// i_system.constructs begin //
|
||||
::g->mb_used = 2;
|
||||
::g->current_time = 0;
|
||||
// i_system.constructs end //
|
||||
// m_cheat.constructs begin //
|
||||
::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'}
|
||||
};
|
||||
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,
|
||||
0
|
||||
NULL,
|
||||
::g->MainMenu,
|
||||
M_DrawMainMenu,
|
||||
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
|
||||
ep1 // lastOn
|
||||
&::g->MainDef, // previous menu
|
||||
::g->EpisodeMenu, // menuitem_t ->
|
||||
M_DrawEpisode, // drawing routine ->
|
||||
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
|
||||
hurtme // lastOn
|
||||
&::g->EpiDef, // previous menu
|
||||
::g->NewGameMenu, // menuitem_t ->
|
||||
M_DrawNewGame, // drawing routine ->
|
||||
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,
|
||||
0
|
||||
&::g->MainDef,
|
||||
::g->OptionsMenu,
|
||||
M_DrawOptions,
|
||||
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,
|
||||
0
|
||||
&::g->OptionsDef,
|
||||
::g->SoundMenu,
|
||||
M_DrawSound,
|
||||
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,
|
||||
0
|
||||
&::g->MainDef,
|
||||
::g->LoadMenu,
|
||||
M_DrawLoad,
|
||||
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,
|
||||
0
|
||||
&::g->MainDef,
|
||||
::g->SaveMenu,
|
||||
M_DrawSave,
|
||||
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,
|
||||
sfx_slop,
|
||||
sfx_telept,
|
||||
sfx_posit1,
|
||||
sfx_posit3,
|
||||
sfx_sgtatk
|
||||
sfx_dmpain,
|
||||
sfx_popain,
|
||||
sfx_slop,
|
||||
sfx_telept,
|
||||
sfx_posit1,
|
||||
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,
|
||||
sfx_slop,
|
||||
sfx_skeswg,
|
||||
sfx_kntdth,
|
||||
sfx_bspact,
|
||||
sfx_sgtatk
|
||||
sfx_getpow,
|
||||
sfx_boscub,
|
||||
sfx_slop,
|
||||
sfx_skeswg,
|
||||
sfx_kntdth,
|
||||
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;
|
||||
// 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++)
|
||||
{
|
||||
chat_macros[i] = temp_chat_macros[i];
|
||||
}
|
||||
default_t temp_defaults[35] = {
|
||||
default_t( "mouse_sensitivity",&::g->mouseSensitivity, 7 ),
|
||||
|
||||
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, '.' ),
|
||||
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++ )
|
||||
{
|
||||
chat_macros[i] = temp_chat_macros[i];
|
||||
}
|
||||
default_t temp_defaults[35] =
|
||||
{
|
||||
default_t( "mouse_sensitivity", &::g->mouseSensitivity, 7 ),
|
||||
|
||||
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( "show_messages", &::g->showMessages, 1 ),
|
||||
|
||||
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( "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( "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( "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( "screenblocks",&::g->screenblocks, 10 ),
|
||||
default_t( "detaillevel",&::g->detailLevel, 0 ),
|
||||
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( "snd_channels",&::g->numChannels, S_NUMCHANNELS ),
|
||||
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( "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 ),
|
||||
default_t( "chatmacro2", &::g->chat_macros[2], HUSTR_CHATMACRO2 ),
|
||||
default_t( "chatmacro3", &::g->chat_macros[3], HUSTR_CHATMACRO3 ),
|
||||
default_t( "chatmacro4", &::g->chat_macros[4], HUSTR_CHATMACRO4 ),
|
||||
default_t( "chatmacro5", &::g->chat_macros[5], HUSTR_CHATMACRO5 ),
|
||||
default_t( "chatmacro6", &::g->chat_macros[6], HUSTR_CHATMACRO6 ),
|
||||
default_t( "chatmacro7", &::g->chat_macros[7], HUSTR_CHATMACRO7 ),
|
||||
default_t( "chatmacro8", &::g->chat_macros[8], HUSTR_CHATMACRO8 ),
|
||||
default_t( "chatmacro9", &::g->chat_macros[9], HUSTR_CHATMACRO9 )
|
||||
default_t( "chatmacro1", &::g->chat_macros[1], HUSTR_CHATMACRO1 ),
|
||||
default_t( "chatmacro2", &::g->chat_macros[2], HUSTR_CHATMACRO2 ),
|
||||
default_t( "chatmacro3", &::g->chat_macros[3], HUSTR_CHATMACRO3 ),
|
||||
default_t( "chatmacro4", &::g->chat_macros[4], HUSTR_CHATMACRO4 ),
|
||||
default_t( "chatmacro5", &::g->chat_macros[5], HUSTR_CHATMACRO5 ),
|
||||
default_t( "chatmacro6", &::g->chat_macros[6], HUSTR_CHATMACRO6 ),
|
||||
default_t( "chatmacro7", &::g->chat_macros[7], HUSTR_CHATMACRO7 ),
|
||||
default_t( "chatmacro8", &::g->chat_macros[8], HUSTR_CHATMACRO8 ),
|
||||
default_t( "chatmacro9", &::g->chat_macros[9], HUSTR_CHATMACRO9 )
|
||||
|
||||
};
|
||||
memcpy( ::g->defaults, temp_defaults, sizeof(temp_defaults) );
|
||||
// m_misc.constructs end //
|
||||
// m_random.constructs begin //
|
||||
::g->rndindex = 0;
|
||||
::g->prndindex = 0;
|
||||
// m_random.constructs end //
|
||||
// p_enemy.constructs begin //
|
||||
::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},
|
||||
{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}
|
||||
memcpy( ::g->defaults, temp_defaults, sizeof( temp_defaults ) );
|
||||
// m_misc.constructs end //
|
||||
// m_random.constructs begin //
|
||||
::g->rndindex = 0;
|
||||
::g->prndindex = 0;
|
||||
// m_random.constructs end //
|
||||
// p_enemy.constructs begin //
|
||||
::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},
|
||||
{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}
|
||||
};
|
||||
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
|
||||
};
|
||||
memcpy( ::g->fuzzoffset, temp_fuzzoffset, sizeof(temp_fuzzoffset) );
|
||||
::g->fuzzpos = 0;
|
||||
// r_draw.constructs end //
|
||||
// r_main.constructs begin //
|
||||
::g->validcount = 1;
|
||||
// r_main.constructs end //
|
||||
// sounds.constructs begin //
|
||||
musicinfo_t temp_S_music[80] = {
|
||||
{ 0 },
|
||||
{ "e1m1", 0 },
|
||||
{ "e1m2", 0 },
|
||||
{ "e1m3", 0 },
|
||||
{ "e1m4", 0 },
|
||||
{ "e1m5", 0 },
|
||||
{ "e1m6", 0 },
|
||||
{ "e1m7", 0 },
|
||||
{ "e1m8", 0 },
|
||||
{ "e1m9", 0 },
|
||||
{ "e2m1", 0 },
|
||||
{ "e2m2", 0 },
|
||||
{ "e2m3", 0 },
|
||||
{ "e2m4", 0 },
|
||||
{ "e2m5", 0 },
|
||||
{ "e2m6", 0 },
|
||||
{ "e2m7", 0 },
|
||||
{ "e2m8", 0 },
|
||||
{ "e2m9", 0 },
|
||||
{ "e3m1", 0 },
|
||||
{ "e3m2", 0 },
|
||||
{ "e3m3", 0 },
|
||||
{ "e3m4", 0 },
|
||||
{ "e3m5", 0 },
|
||||
{ "e3m6", 0 },
|
||||
{ "e3m7", 0 },
|
||||
{ "e3m8", 0 },
|
||||
{ "e3m9", 0 },
|
||||
{ "inter", 0 },
|
||||
{ "intro", 0 },
|
||||
{ "bunny", 0 },
|
||||
{ "victor", 0 },
|
||||
{ "introa", 0 },
|
||||
{ "runnin", 0 },
|
||||
{ "stalks", 0 },
|
||||
{ "countd", 0 },
|
||||
{ "betwee", 0 },
|
||||
{ "doom", 0 },
|
||||
{ "the_da", 0 },
|
||||
{ "shawn", 0 },
|
||||
{ "ddtblu", 0 },
|
||||
{ "in_cit", 0 },
|
||||
{ "dead", 0 },
|
||||
{ "stlks2", 0 },
|
||||
{ "theda2", 0 },
|
||||
{ "doom2", 0 },
|
||||
{ "ddtbl2", 0 },
|
||||
{ "runni2", 0 },
|
||||
{ "dead2", 0 },
|
||||
{ "stlks3", 0 },
|
||||
{ "romero", 0 },
|
||||
{ "shawn2", 0 },
|
||||
{ "messag", 0 },
|
||||
{ "count2", 0 },
|
||||
{ "ddtbl3", 0 },
|
||||
{ "ampie", 0 },
|
||||
{ "theda3", 0 },
|
||||
{ "adrian", 0 },
|
||||
{ "messg2", 0 },
|
||||
{ "romer2", 0 },
|
||||
{ "tense", 0 },
|
||||
{ "shawn3", 0 },
|
||||
{ "openin", 0 },
|
||||
{ "evil", 0 },
|
||||
{ "ultima", 0 },
|
||||
{ "read_m", 0 },
|
||||
{ "dm2ttl", 0 },
|
||||
{ "dm2int", 0 }
|
||||
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
|
||||
};
|
||||
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;
|
||||
// st_stuff.constructs end //
|
||||
memcpy( ::g->fuzzoffset, temp_fuzzoffset, sizeof( temp_fuzzoffset ) );
|
||||
::g->fuzzpos = 0;
|
||||
// r_draw.constructs end //
|
||||
// r_main.constructs begin //
|
||||
::g->validcount = 1;
|
||||
// r_main.constructs end //
|
||||
// sounds.constructs begin //
|
||||
musicinfo_t temp_S_music[80] =
|
||||
{
|
||||
{ 0 },
|
||||
{ "e1m1", 0 },
|
||||
{ "e1m2", 0 },
|
||||
{ "e1m3", 0 },
|
||||
{ "e1m4", 0 },
|
||||
{ "e1m5", 0 },
|
||||
{ "e1m6", 0 },
|
||||
{ "e1m7", 0 },
|
||||
{ "e1m8", 0 },
|
||||
{ "e1m9", 0 },
|
||||
{ "e2m1", 0 },
|
||||
{ "e2m2", 0 },
|
||||
{ "e2m3", 0 },
|
||||
{ "e2m4", 0 },
|
||||
{ "e2m5", 0 },
|
||||
{ "e2m6", 0 },
|
||||
{ "e2m7", 0 },
|
||||
{ "e2m8", 0 },
|
||||
{ "e2m9", 0 },
|
||||
{ "e3m1", 0 },
|
||||
{ "e3m2", 0 },
|
||||
{ "e3m3", 0 },
|
||||
{ "e3m4", 0 },
|
||||
{ "e3m5", 0 },
|
||||
{ "e3m6", 0 },
|
||||
{ "e3m7", 0 },
|
||||
{ "e3m8", 0 },
|
||||
{ "e3m9", 0 },
|
||||
{ "inter", 0 },
|
||||
{ "intro", 0 },
|
||||
{ "bunny", 0 },
|
||||
{ "victor", 0 },
|
||||
{ "introa", 0 },
|
||||
{ "runnin", 0 },
|
||||
{ "stalks", 0 },
|
||||
{ "countd", 0 },
|
||||
{ "betwee", 0 },
|
||||
{ "doom", 0 },
|
||||
{ "the_da", 0 },
|
||||
{ "shawn", 0 },
|
||||
{ "ddtblu", 0 },
|
||||
{ "in_cit", 0 },
|
||||
{ "dead", 0 },
|
||||
{ "stlks2", 0 },
|
||||
{ "theda2", 0 },
|
||||
{ "doom2", 0 },
|
||||
{ "ddtbl2", 0 },
|
||||
{ "runni2", 0 },
|
||||
{ "dead2", 0 },
|
||||
{ "stlks3", 0 },
|
||||
{ "romero", 0 },
|
||||
{ "shawn2", 0 },
|
||||
{ "messag", 0 },
|
||||
{ "count2", 0 },
|
||||
{ "ddtbl3", 0 },
|
||||
{ "ampie", 0 },
|
||||
{ "theda3", 0 },
|
||||
{ "adrian", 0 },
|
||||
{ "messg2", 0 },
|
||||
{ "romer2", 0 },
|
||||
{ "tense", 0 },
|
||||
{ "shawn3", 0 },
|
||||
{ "openin", 0 },
|
||||
{ "evil", 0 },
|
||||
{ "ultima", 0 },
|
||||
{ "read_m", 0 },
|
||||
{ "dm2ttl", 0 },
|
||||
{ "dm2int", 0 }
|
||||
};
|
||||
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;
|
||||
// st_stuff.constructs end //
|
||||
// s_sound.constructs begin //
|
||||
::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)
|
||||
::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 )
|
||||
};
|
||||
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;
|
||||
// z_zone.constructs end //
|
||||
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;
|
||||
// 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 //
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -552,7 +552,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
"CONGRATULATIONS YOU HAVE FINISHED... \n\n"\
|
||||
"THE MASTER LEVELS\n"
|
||||
|
||||
// after map 06
|
||||
// after map 06
|
||||
|
||||
#define P1TEXT \
|
||||
"You gloat over the steaming carcass of the\n"\
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,35 +40,35 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// Input event types.
|
||||
typedef enum
|
||||
{
|
||||
ev_keydown,
|
||||
ev_keyup,
|
||||
ev_mouse,
|
||||
ev_joystick,
|
||||
ev_keydown,
|
||||
ev_keyup,
|
||||
ev_mouse,
|
||||
ev_joystick,
|
||||
ev_none,
|
||||
} evtype_t;
|
||||
|
||||
// Event structure.
|
||||
typedef struct
|
||||
{
|
||||
evtype_t type;
|
||||
int data1; // keys / mouse/joystick buttons
|
||||
int data2; // mouse/joystick x move
|
||||
int data3; // mouse/joystick y move
|
||||
evtype_t type;
|
||||
int data1; // keys / mouse/joystick buttons
|
||||
int data2; // mouse/joystick x move
|
||||
int data3; // mouse/joystick y move
|
||||
} event_t;
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ga_nothing,
|
||||
ga_loadlevel,
|
||||
ga_newgame,
|
||||
ga_loadgame,
|
||||
ga_savegame,
|
||||
ga_playdemo,
|
||||
ga_completed,
|
||||
ga_victory,
|
||||
ga_worlddone,
|
||||
ga_screenshot
|
||||
ga_nothing,
|
||||
ga_loadlevel,
|
||||
ga_newgame,
|
||||
ga_loadgame,
|
||||
ga_savegame,
|
||||
ga_playdemo,
|
||||
ga_completed,
|
||||
ga_victory,
|
||||
ga_worlddone,
|
||||
ga_screenshot
|
||||
} gameaction_t;
|
||||
|
||||
|
||||
|
@ -78,32 +78,32 @@ typedef enum
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
// Press "Fire".
|
||||
BT_ATTACK = 1,
|
||||
// Use button, to open doors, activate switches.
|
||||
BT_USE = 2,
|
||||
// Press "Fire".
|
||||
BT_ATTACK = 1,
|
||||
// Use button, to open doors, activate switches.
|
||||
BT_USE = 2,
|
||||
|
||||
// Flag: game events, not really buttons.
|
||||
BT_SPECIAL = 128,
|
||||
BT_SPECIALMASK = 3,
|
||||
|
||||
// Flag, weapon change pending.
|
||||
// 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_WEAPONSHIFT = 3,
|
||||
// Flag: game events, not really buttons.
|
||||
BT_SPECIAL = 128,
|
||||
BT_SPECIALMASK = 3,
|
||||
|
||||
// Pause the game.
|
||||
BTS_PAUSE = 1,
|
||||
// Save the game at each console.
|
||||
BTS_SAVEGAME = 2,
|
||||
// Flag, weapon change pending.
|
||||
// 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_WEAPONSHIFT = 3,
|
||||
|
||||
// Pause the game.
|
||||
BTS_PAUSE = 1,
|
||||
// Save the game at each console.
|
||||
BTS_SAVEGAME = 2,
|
||||
|
||||
// Savegame slot numbers
|
||||
// occupy the second byte of buttons.
|
||||
BTS_SAVEMASK = ( 4 + 8 + 16 ),
|
||||
BTS_SAVESHIFT = 2,
|
||||
|
||||
// Savegame slot numbers
|
||||
// occupy the second byte of buttons.
|
||||
BTS_SAVEMASK = (4+8+16),
|
||||
BTS_SAVESHIFT = 2,
|
||||
|
||||
} buttoncode_t;
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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"
|
||||
|
||||
|
@ -53,87 +53,87 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//
|
||||
const weaponinfo_t weaponinfo[NUMWEAPONS] =
|
||||
{
|
||||
{
|
||||
// fist
|
||||
am_noammo,
|
||||
S_PUNCHUP,
|
||||
S_PUNCHDOWN,
|
||||
S_PUNCH,
|
||||
S_PUNCH1,
|
||||
S_NULL
|
||||
},
|
||||
{
|
||||
// pistol
|
||||
am_clip,
|
||||
S_PISTOLUP,
|
||||
S_PISTOLDOWN,
|
||||
S_PISTOL,
|
||||
S_PISTOL1,
|
||||
S_PISTOLFLASH
|
||||
},
|
||||
{
|
||||
// shotgun
|
||||
am_shell,
|
||||
S_SGUNUP,
|
||||
S_SGUNDOWN,
|
||||
S_SGUN,
|
||||
S_SGUN1,
|
||||
S_SGUNFLASH1
|
||||
},
|
||||
{
|
||||
// chaingun
|
||||
am_clip,
|
||||
S_CHAINUP,
|
||||
S_CHAINDOWN,
|
||||
S_CHAIN,
|
||||
S_CHAIN1,
|
||||
S_CHAINFLASH1
|
||||
},
|
||||
{
|
||||
// missile launcher
|
||||
am_misl,
|
||||
S_MISSILEUP,
|
||||
S_MISSILEDOWN,
|
||||
S_MISSILE,
|
||||
S_MISSILE1,
|
||||
S_MISSILEFLASH1
|
||||
},
|
||||
{
|
||||
// plasma rifle
|
||||
am_cell,
|
||||
S_PLASMAUP,
|
||||
S_PLASMADOWN,
|
||||
S_PLASMA,
|
||||
S_PLASMA1,
|
||||
S_PLASMAFLASH1
|
||||
},
|
||||
{
|
||||
// bfg 9000
|
||||
am_cell,
|
||||
S_BFGUP,
|
||||
S_BFGDOWN,
|
||||
S_BFG,
|
||||
S_BFG1,
|
||||
S_BFGFLASH1
|
||||
},
|
||||
{
|
||||
// chainsaw
|
||||
am_noammo,
|
||||
S_SAWUP,
|
||||
S_SAWDOWN,
|
||||
S_SAW,
|
||||
S_SAW1,
|
||||
S_NULL
|
||||
},
|
||||
{
|
||||
// super shotgun
|
||||
am_shell,
|
||||
S_DSGUNUP,
|
||||
S_DSGUNDOWN,
|
||||
S_DSGUN,
|
||||
S_DSGUN1,
|
||||
S_DSGUNFLASH1
|
||||
},
|
||||
{
|
||||
// fist
|
||||
am_noammo,
|
||||
S_PUNCHUP,
|
||||
S_PUNCHDOWN,
|
||||
S_PUNCH,
|
||||
S_PUNCH1,
|
||||
S_NULL
|
||||
},
|
||||
{
|
||||
// pistol
|
||||
am_clip,
|
||||
S_PISTOLUP,
|
||||
S_PISTOLDOWN,
|
||||
S_PISTOL,
|
||||
S_PISTOL1,
|
||||
S_PISTOLFLASH
|
||||
},
|
||||
{
|
||||
// shotgun
|
||||
am_shell,
|
||||
S_SGUNUP,
|
||||
S_SGUNDOWN,
|
||||
S_SGUN,
|
||||
S_SGUN1,
|
||||
S_SGUNFLASH1
|
||||
},
|
||||
{
|
||||
// chaingun
|
||||
am_clip,
|
||||
S_CHAINUP,
|
||||
S_CHAINDOWN,
|
||||
S_CHAIN,
|
||||
S_CHAIN1,
|
||||
S_CHAINFLASH1
|
||||
},
|
||||
{
|
||||
// missile launcher
|
||||
am_misl,
|
||||
S_MISSILEUP,
|
||||
S_MISSILEDOWN,
|
||||
S_MISSILE,
|
||||
S_MISSILE1,
|
||||
S_MISSILEFLASH1
|
||||
},
|
||||
{
|
||||
// plasma rifle
|
||||
am_cell,
|
||||
S_PLASMAUP,
|
||||
S_PLASMADOWN,
|
||||
S_PLASMA,
|
||||
S_PLASMA1,
|
||||
S_PLASMAFLASH1
|
||||
},
|
||||
{
|
||||
// bfg 9000
|
||||
am_cell,
|
||||
S_BFGUP,
|
||||
S_BFGDOWN,
|
||||
S_BFG,
|
||||
S_BFG1,
|
||||
S_BFGFLASH1
|
||||
},
|
||||
{
|
||||
// chainsaw
|
||||
am_noammo,
|
||||
S_SAWUP,
|
||||
S_SAWDOWN,
|
||||
S_SAW,
|
||||
S_SAW1,
|
||||
S_NULL
|
||||
},
|
||||
{
|
||||
// super shotgun
|
||||
am_shell,
|
||||
S_DSGUNUP,
|
||||
S_DSGUNDOWN,
|
||||
S_DSGUN,
|
||||
S_DSGUN1,
|
||||
S_DSGUNFLASH1
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,19 +32,19 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "doomdef.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
// Weapon info: sprite frames, ammunition use.
|
||||
typedef struct
|
||||
{
|
||||
ammotype_t ammo;
|
||||
int upstate;
|
||||
int downstate;
|
||||
int readystate;
|
||||
int atkstate;
|
||||
int flashstate;
|
||||
ammotype_t ammo;
|
||||
int upstate;
|
||||
int downstate;
|
||||
int readystate;
|
||||
int atkstate;
|
||||
int flashstate;
|
||||
|
||||
} weaponinfo_t;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -33,7 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -56,8 +56,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
typedef enum
|
||||
{
|
||||
CMD_SEND = 1,
|
||||
CMD_GET = 2
|
||||
CMD_SEND = 1,
|
||||
CMD_GET = 2
|
||||
|
||||
} command_t;
|
||||
|
||||
|
@ -67,17 +67,17 @@ typedef enum
|
|||
//
|
||||
typedef struct
|
||||
{
|
||||
// High bit is retransmit request.
|
||||
unsigned checksum;
|
||||
// Only valid if NCMD_RETRANSMIT.
|
||||
byte retransmitfrom;
|
||||
|
||||
// High bit is retransmit request.
|
||||
unsigned checksum;
|
||||
// Only valid if NCMD_RETRANSMIT.
|
||||
byte retransmitfrom;
|
||||
|
||||
byte sourceDest;
|
||||
|
||||
byte starttic;
|
||||
byte player;
|
||||
byte numtics;
|
||||
ticcmd_t cmds[BACKUPTICS];
|
||||
|
||||
byte starttic;
|
||||
byte player;
|
||||
byte numtics;
|
||||
ticcmd_t cmds[BACKUPTICS];
|
||||
|
||||
} doomdata_t;
|
||||
|
||||
|
@ -86,66 +86,66 @@ typedef struct
|
|||
|
||||
struct doomcom_t
|
||||
{
|
||||
// Supposed to be DOOMCOM_ID?
|
||||
long id;
|
||||
|
||||
// DOOM executes an int to execute commands.
|
||||
short intnum;
|
||||
// Communication between DOOM and the driver.
|
||||
// Is CMD_SEND or CMD_GET.
|
||||
short command;
|
||||
// Is dest for send, set by get (-1 = no packet).
|
||||
short remotenode;
|
||||
|
||||
// Number of bytes in doomdata to be sent
|
||||
short datalength;
|
||||
// Supposed to be DOOMCOM_ID?
|
||||
long id;
|
||||
|
||||
// Info common to all nodes.
|
||||
// Console is allways node 0.
|
||||
short numnodes;
|
||||
// Flag: 1 = no duplication, 2-5 = dup for slow nets.
|
||||
short ticdup;
|
||||
// Flag: 1 = send a backup tic in every packet.
|
||||
short extratics;
|
||||
// Flag: 1 = deathmatch.
|
||||
short deathmatch;
|
||||
// Flag: -1 = new game, 0-5 = load savegame
|
||||
short savegame;
|
||||
short episode; // 1-3
|
||||
short map; // 1-9
|
||||
short skill; // 1-5
|
||||
// DOOM executes an int to execute commands.
|
||||
short intnum;
|
||||
// Communication between DOOM and the driver.
|
||||
// Is CMD_SEND or CMD_GET.
|
||||
short command;
|
||||
// Is dest for send, set by get (-1 = no packet).
|
||||
short remotenode;
|
||||
|
||||
// Info specific to this node.
|
||||
short consoleplayer;
|
||||
short numplayers;
|
||||
|
||||
// These are related to the 3-display mode,
|
||||
// in which two drones looking left and right
|
||||
// were used to render two additional views
|
||||
// on two additional computers.
|
||||
// Probably not operational anymore.
|
||||
// 1 = left, 0 = center, -1 = right
|
||||
short angleoffset;
|
||||
// 1 = drone
|
||||
short drone;
|
||||
// Number of bytes in doomdata to be sent
|
||||
short datalength;
|
||||
|
||||
// Info common to all nodes.
|
||||
// Console is allways node 0.
|
||||
short numnodes;
|
||||
// Flag: 1 = no duplication, 2-5 = dup for slow nets.
|
||||
short ticdup;
|
||||
// Flag: 1 = send a backup tic in every packet.
|
||||
short extratics;
|
||||
// Flag: 1 = deathmatch.
|
||||
short deathmatch;
|
||||
// Flag: -1 = new game, 0-5 = load savegame
|
||||
short savegame;
|
||||
short episode; // 1-3
|
||||
short map; // 1-9
|
||||
short skill; // 1-5
|
||||
|
||||
// Info specific to this node.
|
||||
short consoleplayer;
|
||||
short numplayers;
|
||||
|
||||
// These are related to the 3-display mode,
|
||||
// in which two drones looking left and right
|
||||
// were used to render two additional views
|
||||
// on two additional computers.
|
||||
// Probably not operational anymore.
|
||||
// 1 = left, 0 = center, -1 = right
|
||||
short angleoffset;
|
||||
// 1 = drone
|
||||
short drone;
|
||||
|
||||
// The packet data to be sent.
|
||||
doomdata_t data;
|
||||
|
||||
// The packet data to be sent.
|
||||
doomdata_t data;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
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
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -58,12 +58,12 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
// Playing or camping.
|
||||
PST_LIVE,
|
||||
// Dead on the ground, view follows killer.
|
||||
PST_DEAD,
|
||||
// Ready to restart/respawn???
|
||||
PST_REBORN
|
||||
// Playing or camping.
|
||||
PST_LIVE,
|
||||
// Dead on the ground, view follows killer.
|
||||
PST_DEAD,
|
||||
// Ready to restart/respawn???
|
||||
PST_REBORN
|
||||
|
||||
} playerstate_t;
|
||||
|
||||
|
@ -73,12 +73,12 @@ typedef enum
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
// No clipping, walk through barriers.
|
||||
CF_NOCLIP = 1,
|
||||
// No damage, no health loss.
|
||||
CF_GODMODE = 2,
|
||||
// Not really a cheat, just a debug aid.
|
||||
CF_NOMOMENTUM = 4,
|
||||
// No clipping, walk through barriers.
|
||||
CF_NOCLIP = 1,
|
||||
// No damage, no health loss.
|
||||
CF_GODMODE = 2,
|
||||
// Not really a cheat, just a debug aid.
|
||||
CF_NOMOMENTUM = 4,
|
||||
|
||||
// Gives kfa at the beginning of the level.
|
||||
CF_GIVEALL = 8,
|
||||
|
@ -92,89 +92,89 @@ typedef enum
|
|||
//
|
||||
typedef struct player_s
|
||||
{
|
||||
mobj_t* mo;
|
||||
playerstate_t playerstate;
|
||||
ticcmd_t cmd;
|
||||
mobj_t* mo;
|
||||
playerstate_t playerstate;
|
||||
ticcmd_t cmd;
|
||||
|
||||
// Determine POV,
|
||||
// including viewpoint bobbing during movement.
|
||||
// Focal origin above r.z
|
||||
fixed_t viewz;
|
||||
// Base height above floor for viewz.
|
||||
fixed_t viewheight;
|
||||
// Bob/squat speed.
|
||||
fixed_t deltaviewheight;
|
||||
// bounded/scaled total momentum.
|
||||
fixed_t bob;
|
||||
// Determine POV,
|
||||
// including viewpoint bobbing during movement.
|
||||
// Focal origin above r.z
|
||||
fixed_t viewz;
|
||||
// Base height above floor for viewz.
|
||||
fixed_t viewheight;
|
||||
// Bob/squat speed.
|
||||
fixed_t deltaviewheight;
|
||||
// bounded/scaled total momentum.
|
||||
fixed_t bob;
|
||||
|
||||
// This is only used between levels,
|
||||
// mo->health is used during levels.
|
||||
int health;
|
||||
int armorpoints;
|
||||
// Armor type is 0-2.
|
||||
int armortype;
|
||||
// This is only used between levels,
|
||||
// mo->health is used during levels.
|
||||
int health;
|
||||
int armorpoints;
|
||||
// Armor type is 0-2.
|
||||
int armortype;
|
||||
|
||||
// Power ups. invinc and invis are tic counters.
|
||||
int powers[NUMPOWERS];
|
||||
qboolean cards[NUMCARDS];
|
||||
qboolean backpack;
|
||||
|
||||
// Frags, kills of other players.
|
||||
int frags[MAXPLAYERS];
|
||||
weapontype_t readyweapon;
|
||||
|
||||
// Is wp_nochange if not changing.
|
||||
weapontype_t pendingweapon;
|
||||
// Power ups. invinc and invis are tic counters.
|
||||
int powers[NUMPOWERS];
|
||||
qboolean cards[NUMCARDS];
|
||||
qboolean backpack;
|
||||
|
||||
int weaponowned[NUMWEAPONS];
|
||||
int ammo[NUMAMMO];
|
||||
int maxammo[NUMAMMO];
|
||||
// Frags, kills of other players.
|
||||
int frags[MAXPLAYERS];
|
||||
weapontype_t readyweapon;
|
||||
|
||||
// True if button down last tic.
|
||||
int attackdown;
|
||||
int usedown;
|
||||
// Is wp_nochange if not changing.
|
||||
weapontype_t pendingweapon;
|
||||
|
||||
// Bit flags, for cheats and debug.
|
||||
// See cheat_t, above.
|
||||
int cheats;
|
||||
int weaponowned[NUMWEAPONS];
|
||||
int ammo[NUMAMMO];
|
||||
int maxammo[NUMAMMO];
|
||||
|
||||
// Refired shots are less accurate.
|
||||
int refire;
|
||||
// True if button down last tic.
|
||||
int attackdown;
|
||||
int usedown;
|
||||
|
||||
// For intermission stats.
|
||||
int killcount;
|
||||
int itemcount;
|
||||
int secretcount;
|
||||
// Bit flags, for cheats and debug.
|
||||
// See cheat_t, above.
|
||||
int cheats;
|
||||
|
||||
// Refired shots are less accurate.
|
||||
int refire;
|
||||
|
||||
// For intermission stats.
|
||||
int killcount;
|
||||
int itemcount;
|
||||
int secretcount;
|
||||
|
||||
int chainsawKills;
|
||||
int berserkKills;
|
||||
|
||||
// Hint messages.
|
||||
const char* message;
|
||||
|
||||
// For screen flashing (red or bright).
|
||||
int damagecount;
|
||||
int bonuscount;
|
||||
// Hint messages.
|
||||
const char* message;
|
||||
|
||||
// Who did damage (NULL for floors/ceilings).
|
||||
mobj_t* attacker;
|
||||
|
||||
// So gun flashes light up areas.
|
||||
int extralight;
|
||||
// For screen flashing (red or bright).
|
||||
int damagecount;
|
||||
int bonuscount;
|
||||
|
||||
// Current PLAYPAL, ???
|
||||
// can be set to REDCOLORMAP for pain, etc.
|
||||
int fixedcolormap;
|
||||
// Who did damage (NULL for floors/ceilings).
|
||||
mobj_t* attacker;
|
||||
|
||||
// Player skin colorshift,
|
||||
// 0-3 for which color to draw player.
|
||||
int colormap;
|
||||
// So gun flashes light up areas.
|
||||
int extralight;
|
||||
|
||||
// Overlay view sprites (gun, etc).
|
||||
pspdef_t psprites[NUMPSPRITES];
|
||||
// Current PLAYPAL, ???
|
||||
// can be set to REDCOLORMAP for pain, etc.
|
||||
int fixedcolormap;
|
||||
|
||||
// True if secret level has been done.
|
||||
qboolean didsecret;
|
||||
// Player skin colorshift,
|
||||
// 0-3 for which color to draw player.
|
||||
int colormap;
|
||||
|
||||
// Overlay view sprites (gun, etc).
|
||||
pspdef_t psprites[NUMPSPRITES];
|
||||
|
||||
// True if secret level has been done.
|
||||
qboolean didsecret;
|
||||
|
||||
} player_t;
|
||||
|
||||
|
@ -185,41 +185,41 @@ typedef struct player_s
|
|||
//
|
||||
typedef struct
|
||||
{
|
||||
qboolean in; // whether the player is in game
|
||||
|
||||
// Player stats, kills, collected items etc.
|
||||
int skills;
|
||||
int sitems;
|
||||
int ssecret;
|
||||
int stime;
|
||||
int frags[4];
|
||||
int score; // current score on entry, modified on return
|
||||
|
||||
qboolean in; // whether the player is in game
|
||||
|
||||
// Player stats, kills, collected items etc.
|
||||
int skills;
|
||||
int sitems;
|
||||
int ssecret;
|
||||
int stime;
|
||||
int frags[4];
|
||||
int score; // current score on entry, modified on return
|
||||
|
||||
} wbplayerstruct_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int epsd; // episode # (0-2)
|
||||
int epsd; // episode # (0-2)
|
||||
|
||||
// if true, splash the secret level
|
||||
qboolean didsecret;
|
||||
|
||||
// previous and next levels, origin 0
|
||||
int last;
|
||||
int next;
|
||||
|
||||
int maxkills;
|
||||
int maxitems;
|
||||
int maxsecret;
|
||||
int maxfrags;
|
||||
// if true, splash the secret level
|
||||
qboolean didsecret;
|
||||
|
||||
// the par time
|
||||
int partime;
|
||||
|
||||
// index of this player in game
|
||||
int pnum;
|
||||
// previous and next levels, origin 0
|
||||
int last;
|
||||
int next;
|
||||
|
||||
wbplayerstruct_t plyr[MAXPLAYERS];
|
||||
int maxkills;
|
||||
int maxitems;
|
||||
int maxsecret;
|
||||
int maxfrags;
|
||||
|
||||
// the par time
|
||||
int partime;
|
||||
|
||||
// index of this player in game
|
||||
int pnum;
|
||||
|
||||
wbplayerstruct_t plyr[MAXPLAYERS];
|
||||
|
||||
} wbstartstruct_t;
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,9 +40,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// a pic is an unmasked block of pixels
|
||||
typedef struct
|
||||
{
|
||||
byte width;
|
||||
byte height;
|
||||
byte data;
|
||||
byte width;
|
||||
byte height;
|
||||
byte data;
|
||||
} pic_t;
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
//
|
||||
|
@ -41,15 +41,15 @@ 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
|
||||
{
|
||||
actionf_p1 acp1;
|
||||
actionf_v acv;
|
||||
actionf_p2 acp2;
|
||||
actionf_p1 acp1;
|
||||
actionf_v acv;
|
||||
actionf_p2 acp2;
|
||||
|
||||
} actionf_t;
|
||||
|
||||
|
@ -66,10 +66,10 @@ typedef actionf_t think_t;
|
|||
// Doubly linked list of actors.
|
||||
typedef struct thinker_s
|
||||
{
|
||||
struct thinker_s* prev;
|
||||
struct thinker_s* next;
|
||||
think_t function;
|
||||
|
||||
struct thinker_s* prev;
|
||||
struct thinker_s* next;
|
||||
think_t function;
|
||||
|
||||
} thinker_t;
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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)
|
||||
|
@ -41,11 +41,11 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// plus a checksum for internal state consistency.
|
||||
typedef struct
|
||||
{
|
||||
char forwardmove; // *2048 for move
|
||||
char sidemove; // *2048 for move
|
||||
short angleturn; // <<16 for angle delta
|
||||
short consistancy; // checks for net game
|
||||
byte buttons;
|
||||
char forwardmove; // *2048 for move
|
||||
char sidemove; // *2048 for move
|
||||
short angleturn; // <<16 for angle delta
|
||||
short consistancy; // checks for net game
|
||||
byte buttons;
|
||||
byte nextPrevWeapon;
|
||||
} ticcmd_t;
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,7 +26,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
// am_map.defs begin //
|
||||
// am_map.defs begin //
|
||||
#define REDS (256-5*16)
|
||||
#define REDRANGE 16
|
||||
#define BLUES (256-4*16+8)
|
||||
|
@ -94,13 +94,13 @@ If you have questions concerning this license or the applicable additional terms
|
|||
if ((mx) < 0) (oc) |= LEFT; \
|
||||
else if ((mx) >= ::g->f_w) (oc) |= RIGHT;
|
||||
#define PUTDOT(xx,yy,cc) ::g->fb[(yy)*::g->f_w+(xx)]=(cc)
|
||||
// am_map.defs end //
|
||||
// d_main.defs begin //
|
||||
// am_map.defs end //
|
||||
// d_main.defs begin //
|
||||
#define BGCOLOR 7
|
||||
#define FGCOLOR 8
|
||||
#define DOOMWADDIR "wads/"
|
||||
// d_main.defs end //
|
||||
// d_net.defs begin //
|
||||
// d_main.defs end //
|
||||
// d_net.defs begin //
|
||||
#define NCMD_EXIT 0x80000000
|
||||
#define NCMD_RETRANSMIT 0x40000000
|
||||
#define NCMD_SETUP 0x20000000
|
||||
|
@ -108,25 +108,25 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define NCMD_CHECKSUM 0x0fffffff
|
||||
#define RESENDCOUNT 10
|
||||
#define PL_DRONE 0x80 // bit flag in doomdata->player
|
||||
// d_net.defs end //
|
||||
// f_finale.defs begin //
|
||||
// d_net.defs end //
|
||||
// f_finale.defs begin //
|
||||
#define TEXTSPEED 3
|
||||
#define TEXTWAIT 250
|
||||
// f_finale.defs end //
|
||||
// g_game.defs begin //
|
||||
// f_finale.defs end //
|
||||
// g_game.defs begin //
|
||||
#define SAVESTRINGSIZE 64
|
||||
#define MAXPLMOVE (::g->forwardmove[1])
|
||||
#define MAXPLMOVE (::g->forwardmove[1])
|
||||
#define TURBOTHRESHOLD 0x32
|
||||
#define SLOWTURNTICS 6
|
||||
#define NUMKEYS 256
|
||||
#define SLOWTURNTICS 6
|
||||
#define NUMKEYS 256
|
||||
#define BODYQUESIZE 32
|
||||
#define VERSIONSIZE 16
|
||||
#define VERSIONSIZE 16
|
||||
#define DEMOMARKER 0x80
|
||||
// g_game.defs end //
|
||||
// hu_lib.defs begin //
|
||||
// g_game.defs end //
|
||||
// hu_lib.defs begin //
|
||||
#define noterased ::g->viewwindowx
|
||||
// hu_lib.defs end //
|
||||
// hu_stuff.defs begin //
|
||||
// hu_lib.defs end //
|
||||
// hu_stuff.defs begin //
|
||||
#define HU_TITLE (mapnames[(::g->gameepisode-1)*9+::g->gamemap-1])
|
||||
#define HU_TITLE2 (mapnames2[::g->gamemap-1])
|
||||
#define HU_TITLEP (mapnamesp[::g->gamemap-1])
|
||||
|
@ -140,8 +140,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define HU_INPUTWIDTH 64
|
||||
#define HU_INPUTHEIGHT 1
|
||||
#define QUEUESIZE 128
|
||||
// hu_stuff.defs end //
|
||||
// i_net.defs begin //
|
||||
// hu_stuff.defs end //
|
||||
// i_net.defs begin //
|
||||
// SMF
|
||||
/*
|
||||
#define ntohl(x) \
|
||||
|
@ -154,8 +154,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
(((unsigned short int)(x) & 0xff00) >> 8))) \
|
||||
#define htonl(x) ntohl(x)
|
||||
#define htons(x) ntohs(x)
|
||||
// i_net.defs end //
|
||||
// i_net_xbox.defs begin //
|
||||
// i_net.defs end //
|
||||
// i_net_xbox.defs begin //
|
||||
#define ntohl(x) \
|
||||
((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
|
||||
(((unsigned long int)(x) & 0x0000ff00U) << 8) | \
|
||||
|
@ -167,21 +167,21 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#define htonl(x) ntohl(x)
|
||||
#define htons(x) ntohs(x)
|
||||
*/
|
||||
*/
|
||||
|
||||
#define IPPORT_USERRESERVED 5000
|
||||
// i_net_xbox.defs end //
|
||||
// i_sound_xbox.defs begin //
|
||||
// i_net_xbox.defs end //
|
||||
// i_sound_xbox.defs begin //
|
||||
#define SAMPLECOUNT 512
|
||||
#define NUM_SOUNDBUFFERS 64
|
||||
#define BUFMUL 4
|
||||
#define MIXBUFFERSIZE (SAMPLECOUNT*BUFMUL)
|
||||
// i_sound_xbox.defs end //
|
||||
// i_video_xbox.defs begin //
|
||||
// i_sound_xbox.defs end //
|
||||
// i_video_xbox.defs begin //
|
||||
//#define TEXTUREWIDTH 512
|
||||
//#define TEXTUREHEIGHT 256
|
||||
// i_video_xbox.defs end //
|
||||
// mus2midi.defs begin //
|
||||
// i_video_xbox.defs end //
|
||||
// mus2midi.defs begin //
|
||||
#define MUSEVENT_KEYOFF 0
|
||||
#define MUSEVENT_KEYON 1
|
||||
#define MUSEVENT_PITCHWHEEL 2
|
||||
|
@ -190,46 +190,46 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define MUSEVENT_END 6
|
||||
#define MIDI_MAXCHANNELS 16
|
||||
#define MIDIHEADERSIZE 14
|
||||
// mus2midi.defs end //
|
||||
// m_menu.defs begin //
|
||||
// mus2midi.defs end //
|
||||
// m_menu.defs begin //
|
||||
#define SAVESTRINGSIZE 64
|
||||
#define SKULLXOFF -32
|
||||
#define LINEHEIGHT 16
|
||||
// m_menu.defs end //
|
||||
// p_enemy.defs begin //
|
||||
// m_menu.defs end //
|
||||
// p_enemy.defs begin //
|
||||
#define MAXSPECIALCROSS 8
|
||||
#define FATSPREAD (ANG90/8)
|
||||
#define SKULLSPEED (20*FRACUNIT)
|
||||
// p_enemy.defs end //
|
||||
// p_inter.defs begin //
|
||||
// p_enemy.defs end //
|
||||
// p_inter.defs begin //
|
||||
#define BONUSADD 6
|
||||
// p_inter.defs end //
|
||||
// p_map.defs begin //
|
||||
// p_inter.defs end //
|
||||
// p_map.defs begin //
|
||||
#define MAXSPECIALCROSS 8
|
||||
// p_map.defs end //
|
||||
// p_mobj.defs begin //
|
||||
// p_map.defs end //
|
||||
// p_mobj.defs begin //
|
||||
#define STOPSPEED 0x1000
|
||||
#define FRICTION 0xe800
|
||||
// p_mobj.defs end //
|
||||
// p_pspr.defs begin //
|
||||
// p_mobj.defs end //
|
||||
// p_pspr.defs begin //
|
||||
#define LOWERSPEED FRACUNIT*6
|
||||
#define RAISESPEED FRACUNIT*6
|
||||
#define WEAPONBOTTOM 128*FRACUNIT
|
||||
#define WEAPONTOP 32*FRACUNIT
|
||||
#define BFGCELLS 40
|
||||
// p_pspr.defs end //
|
||||
// p_saveg.defs begin //
|
||||
#define BFGCELLS 40
|
||||
// p_pspr.defs end //
|
||||
// p_saveg.defs begin //
|
||||
#define PADSAVEP() ::g->save_p += (4 - ((intptr_t) ::g->save_p & 3)) & 3
|
||||
// p_saveg.defs end //
|
||||
// p_setup.defs begin //
|
||||
// p_saveg.defs end //
|
||||
// p_setup.defs begin //
|
||||
#define MAX_DEATHMATCH_STARTS 10
|
||||
// p_setup.defs end //
|
||||
// p_spec.defs begin //
|
||||
// p_setup.defs end //
|
||||
// p_spec.defs begin //
|
||||
#define MAXANIMS 32
|
||||
#define MAXLINEANIMS 64
|
||||
#define MAX_ADJOINING_SECTORS 20
|
||||
// p_spec.defs end //
|
||||
// p_user.defs begin //
|
||||
// p_spec.defs end //
|
||||
// p_user.defs begin //
|
||||
#define INVERSECOLORMAP 32
|
||||
|
||||
// DHM - NERVE :: MAXBOB reduced 25%
|
||||
|
@ -237,35 +237,35 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define MAXBOB 0xC0000
|
||||
|
||||
#define ANG5 (ANG90/18)
|
||||
// p_user.defs end //
|
||||
// r_bsp.defs begin //
|
||||
// p_user.defs end //
|
||||
// r_bsp.defs begin //
|
||||
#define MAXSEGS 32
|
||||
// r_bsp.defs end //
|
||||
// r_draw.defs begin //
|
||||
// r_bsp.defs end //
|
||||
// r_draw.defs begin //
|
||||
//#define MAXWIDTH 1120
|
||||
//#define MAXHEIGHT 832
|
||||
#define SBARHEIGHT 32 * GLOBAL_IMAGE_SCALER
|
||||
#define FUZZTABLE 50
|
||||
#define FUZZTABLE 50
|
||||
#define FUZZOFF (SCREENWIDTH)
|
||||
// r_draw.defs end //
|
||||
// r_main.defs begin //
|
||||
#define FIELDOFVIEW 2048
|
||||
// r_draw.defs end //
|
||||
// r_main.defs begin //
|
||||
#define FIELDOFVIEW 2048
|
||||
#define DISTMAP 2
|
||||
// r_main.defs end //
|
||||
// r_plane.defs begin //
|
||||
// r_main.defs end //
|
||||
// r_plane.defs begin //
|
||||
//#define MAXVISPLANES 128
|
||||
#define MAXVISPLANES 384
|
||||
#define MAXOPENINGS SCREENWIDTH*64
|
||||
// r_plane.defs end //
|
||||
// r_segs.defs begin //
|
||||
// r_plane.defs end //
|
||||
// r_segs.defs begin //
|
||||
#define HEIGHTBITS 12
|
||||
#define HEIGHTUNIT (1<<HEIGHTBITS)
|
||||
// r_segs.defs end //
|
||||
// r_things.defs begin //
|
||||
// r_segs.defs end //
|
||||
// r_things.defs begin //
|
||||
#define MINZ (FRACUNIT*4)
|
||||
#define BASEYCENTER 100
|
||||
// r_things.defs end //
|
||||
// st_stuff.defs begin //
|
||||
// r_things.defs end //
|
||||
// st_stuff.defs begin //
|
||||
#define STARTREDPALS 1
|
||||
#define STARTBONUSPALS 9
|
||||
#define NUMREDPALS 8
|
||||
|
@ -301,10 +301,10 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define ST_OUCHCOUNT (1*TICRATE)
|
||||
#define ST_RAMPAGEDELAY (2*TICRATE)
|
||||
#define ST_MUCHPAIN 20
|
||||
#define ST_AMMOWIDTH 3
|
||||
#define ST_AMMOWIDTH 3
|
||||
#define ST_AMMOX 44
|
||||
#define ST_AMMOY 171
|
||||
#define ST_HEALTHWIDTH 3
|
||||
#define ST_HEALTHWIDTH 3
|
||||
#define ST_HEALTHX 90
|
||||
#define ST_HEALTHY 171
|
||||
#define ST_ARMSX 111
|
||||
|
@ -314,7 +314,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define ST_ARMSXSPACE 12
|
||||
#define ST_ARMSYSPACE 10
|
||||
#define ST_FRAGSX 138
|
||||
#define ST_FRAGSY 171
|
||||
#define ST_FRAGSY 171
|
||||
#define ST_FRAGSWIDTH 2
|
||||
#define ST_ARMORWIDTH 3
|
||||
#define ST_ARMORX 221
|
||||
|
@ -355,19 +355,19 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define ST_MAXAMMO3WIDTH ST_MAXAMMO0WIDTH
|
||||
#define ST_MAXAMMO3X 314
|
||||
#define ST_MAXAMMO3Y 185
|
||||
#define ST_WEAPON0X 110
|
||||
#define ST_WEAPON0X 110
|
||||
#define ST_WEAPON0Y 172
|
||||
#define ST_WEAPON1X 122
|
||||
#define ST_WEAPON1X 122
|
||||
#define ST_WEAPON1Y 172
|
||||
#define ST_WEAPON2X 134
|
||||
#define ST_WEAPON2X 134
|
||||
#define ST_WEAPON2Y 172
|
||||
#define ST_WEAPON3X 110
|
||||
#define ST_WEAPON3X 110
|
||||
#define ST_WEAPON3Y 181
|
||||
#define ST_WEAPON4X 122
|
||||
#define ST_WEAPON4X 122
|
||||
#define ST_WEAPON4Y 181
|
||||
#define ST_WEAPON5X 134
|
||||
#define ST_WEAPON5Y 181
|
||||
#define ST_WPNSX 109
|
||||
#define ST_WPNSX 109
|
||||
#define ST_WPNSY 191
|
||||
#define ST_DETHX 109
|
||||
#define ST_DETHY 191
|
||||
|
@ -377,7 +377,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define ST_MSGHEIGHT 1
|
||||
#define ST_OUTTEXTX 0
|
||||
#define ST_OUTTEXTY 6
|
||||
#define ST_OUTWIDTH 52
|
||||
#define ST_OUTWIDTH 52
|
||||
#define ST_OUTHEIGHT 1
|
||||
#define ST_MAPWIDTH \
|
||||
(strlen(mapnames[(::g->gameepisode-1)*9+(::g->gamemap-1)]))
|
||||
|
@ -385,8 +385,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
(SCREENWIDTH - ST_MAPWIDTH * ST_CHATFONTWIDTH)
|
||||
#define ST_MAPTITLEY 0
|
||||
#define ST_MAPHEIGHT 1
|
||||
// st_stuff.defs end //
|
||||
// s_sound.defs begin //
|
||||
// st_stuff.defs end //
|
||||
// s_sound.defs begin //
|
||||
#define S_MAX_VOLUME 127
|
||||
#define S_CLIPPING_DIST (1200*0x10000)
|
||||
#define S_CLOSE_DIST (160*0x10000)
|
||||
|
@ -400,8 +400,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define S_IFRACVOL 30
|
||||
#define NA 0
|
||||
#define S_NUMCHANNELS 256
|
||||
// s_sound.defs end //
|
||||
// wi_stuff.defs begin //
|
||||
// s_sound.defs end //
|
||||
// wi_stuff.defs begin //
|
||||
#define NUMEPISODES 4
|
||||
#define NUMMAPS 9
|
||||
#define WI_TITLEY 2
|
||||
|
@ -425,18 +425,18 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define SP_KILLS 0
|
||||
#define SP_ITEMS 2
|
||||
#define SP_SECRET 4
|
||||
#define SP_FRAGS 6
|
||||
#define SP_TIME 8
|
||||
#define SP_FRAGS 6
|
||||
#define SP_TIME 8
|
||||
#define SP_PAR ST_TIME
|
||||
#define SP_PAUSE 1
|
||||
#define SHOWNEXTLOCDELAY 4
|
||||
// wi_stuff.defs end //
|
||||
// w_wad.defs begin //
|
||||
// wi_stuff.defs end //
|
||||
// w_wad.defs begin //
|
||||
|
||||
// w_wad.defs end //
|
||||
// z_zone.defs begin //
|
||||
// w_wad.defs end //
|
||||
// z_zone.defs begin //
|
||||
#define ZONEID 0x1d4a11
|
||||
#define NUM_ZONES 11
|
||||
#define MINFRAGMENT 64
|
||||
#define NO_SHARE_LUMPS
|
||||
// z_zone.defs end //
|
||||
// z_zone.defs end //
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -47,25 +47,25 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// to provide a complete scene geometry description.
|
||||
enum
|
||||
{
|
||||
ML_LABEL, // A separator, name, ExMx or MAPxx
|
||||
ML_THINGS, // Monsters, items..
|
||||
ML_LINEDEFS, // LineDefs, from editing
|
||||
ML_SIDEDEFS, // SideDefs, from editing
|
||||
ML_VERTEXES, // Vertices, edited and BSP splits generated
|
||||
ML_SEGS, // LineSegs, from LineDefs split by BSP
|
||||
ML_SSECTORS, // SubSectors, list of LineSegs
|
||||
ML_NODES, // BSP nodes
|
||||
ML_SECTORS, // Sectors, from editing
|
||||
ML_REJECT, // LUT, sector-sector visibility
|
||||
ML_BLOCKMAP // LUT, motion clipping, walls/grid element
|
||||
ML_LABEL, // A separator, name, ExMx or MAPxx
|
||||
ML_THINGS, // Monsters, items..
|
||||
ML_LINEDEFS, // LineDefs, from editing
|
||||
ML_SIDEDEFS, // SideDefs, from editing
|
||||
ML_VERTEXES, // Vertices, edited and BSP splits generated
|
||||
ML_SEGS, // LineSegs, from LineDefs split by BSP
|
||||
ML_SSECTORS, // SubSectors, list of LineSegs
|
||||
ML_NODES, // BSP nodes
|
||||
ML_SECTORS, // Sectors, from editing
|
||||
ML_REJECT, // LUT, sector-sector visibility
|
||||
ML_BLOCKMAP // LUT, motion clipping, walls/grid element
|
||||
};
|
||||
|
||||
|
||||
// A single Vertex.
|
||||
typedef struct
|
||||
{
|
||||
short x;
|
||||
short y;
|
||||
short x;
|
||||
short y;
|
||||
} mapvertex_t;
|
||||
|
||||
|
||||
|
@ -73,13 +73,13 @@ typedef struct
|
|||
// by setting textures and offsets.
|
||||
typedef struct
|
||||
{
|
||||
short textureoffset;
|
||||
short rowoffset;
|
||||
char toptexture[8];
|
||||
char bottomtexture[8];
|
||||
char midtexture[8];
|
||||
// Front sector, towards viewer.
|
||||
short sector;
|
||||
short textureoffset;
|
||||
short rowoffset;
|
||||
char toptexture[8];
|
||||
char bottomtexture[8];
|
||||
char midtexture[8];
|
||||
// Front sector, towards viewer.
|
||||
short sector;
|
||||
} mapsidedef_t;
|
||||
|
||||
|
||||
|
@ -88,13 +88,13 @@ typedef struct
|
|||
// to the BSP builder.
|
||||
typedef struct
|
||||
{
|
||||
short v1;
|
||||
short v2;
|
||||
short flags;
|
||||
short special;
|
||||
short tag;
|
||||
// sidenum[1] will be -1 if one sided
|
||||
short sidenum[2];
|
||||
short v1;
|
||||
short v2;
|
||||
short flags;
|
||||
short special;
|
||||
short tag;
|
||||
// sidenum[1] will be -1 if one sided
|
||||
short sidenum[2];
|
||||
} maplinedef_t;
|
||||
|
||||
|
||||
|
@ -125,7 +125,7 @@ typedef struct
|
|||
#define ML_DONTPEGTOP 8
|
||||
|
||||
// lower texture unpegged
|
||||
#define ML_DONTPEGBOTTOM 16
|
||||
#define ML_DONTPEGBOTTOM 16
|
||||
|
||||
// In AutoMap: don't map as two sided: IT'S A SECRET!
|
||||
#define ML_SECRET 32
|
||||
|
@ -145,21 +145,21 @@ typedef struct
|
|||
// Sector definition, from editing.
|
||||
typedef struct
|
||||
{
|
||||
short floorheight;
|
||||
short ceilingheight;
|
||||
char floorpic[8];
|
||||
char ceilingpic[8];
|
||||
short lightlevel;
|
||||
short special;
|
||||
short tag;
|
||||
short floorheight;
|
||||
short ceilingheight;
|
||||
char floorpic[8];
|
||||
char ceilingpic[8];
|
||||
short lightlevel;
|
||||
short special;
|
||||
short tag;
|
||||
} mapsector_t;
|
||||
|
||||
// SubSector, as generated by BSP.
|
||||
typedef struct
|
||||
{
|
||||
short numsegs;
|
||||
// Index of first one, segs are stored sequentially.
|
||||
short firstseg;
|
||||
short numsegs;
|
||||
// Index of first one, segs are stored sequentially.
|
||||
short firstseg;
|
||||
} mapsubsector_t;
|
||||
|
||||
|
||||
|
@ -167,12 +167,12 @@ typedef struct
|
|||
// using partition lines selected by BSP builder.
|
||||
typedef struct
|
||||
{
|
||||
short v1;
|
||||
short v2;
|
||||
short angle;
|
||||
short linedef;
|
||||
short side;
|
||||
short offset;
|
||||
short v1;
|
||||
short v2;
|
||||
short angle;
|
||||
short linedef;
|
||||
short side;
|
||||
short offset;
|
||||
} mapseg_t;
|
||||
|
||||
|
||||
|
@ -184,19 +184,19 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
// Partition line from (x,y) to x+dx,y+dy)
|
||||
short x;
|
||||
short y;
|
||||
short dx;
|
||||
short dy;
|
||||
// Partition line from (x,y) to x+dx,y+dy)
|
||||
short x;
|
||||
short y;
|
||||
short dx;
|
||||
short dy;
|
||||
|
||||
// Bounding box for each child,
|
||||
// clip against view frustum.
|
||||
short bbox[2][4];
|
||||
// Bounding box for each child,
|
||||
// clip against view frustum.
|
||||
short bbox[2][4];
|
||||
|
||||
// If NF_SUBSECTOR its a subsector,
|
||||
// else it's a node of another subtree.
|
||||
unsigned short children[2];
|
||||
// If NF_SUBSECTOR its a subsector,
|
||||
// else it's a node of another subtree.
|
||||
unsigned short children[2];
|
||||
|
||||
} mapnode_t;
|
||||
|
||||
|
@ -207,11 +207,11 @@ typedef struct
|
|||
// plus skill/visibility flags and attributes.
|
||||
typedef struct
|
||||
{
|
||||
short x;
|
||||
short y;
|
||||
short angle;
|
||||
short type;
|
||||
short options;
|
||||
short x;
|
||||
short y;
|
||||
short angle;
|
||||
short type;
|
||||
short options;
|
||||
} mapthing_t;
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -45,27 +45,27 @@ enum { VERSION = 111 };
|
|||
// to handle IWAD dependend animations etc.
|
||||
typedef enum
|
||||
{
|
||||
shareware, // DOOM 1 shareware, E1, M9
|
||||
registered, // DOOM 1 registered, E3, M27
|
||||
commercial, // DOOM 2 retail, E1 M34
|
||||
// DOOM 2 german edition not handled
|
||||
retail, // DOOM 1 retail, E4, M36
|
||||
indetermined // Well, no IWAD found.
|
||||
|
||||
shareware, // DOOM 1 shareware, E1, M9
|
||||
registered, // DOOM 1 registered, E3, M27
|
||||
commercial, // DOOM 2 retail, E1 M34
|
||||
// DOOM 2 german edition not handled
|
||||
retail, // DOOM 1 retail, E4, M36
|
||||
indetermined // Well, no IWAD found.
|
||||
|
||||
} GameMode_t;
|
||||
|
||||
|
||||
// Mission packs - might be useful for TC stuff?
|
||||
typedef enum
|
||||
{
|
||||
doom, // DOOM 1
|
||||
doom2, // DOOM 2
|
||||
pack_tnt, // TNT mission pack
|
||||
pack_plut, // Plutonia pack
|
||||
pack_master, // Master levels
|
||||
pack_nerve, // Nerve levels
|
||||
|
||||
none
|
||||
doom, // DOOM 1
|
||||
doom2, // DOOM 2
|
||||
pack_tnt, // TNT mission pack
|
||||
pack_plut, // Plutonia pack
|
||||
pack_master, // Master levels
|
||||
pack_nerve, // Nerve levels
|
||||
|
||||
none
|
||||
|
||||
} GameMission_t;
|
||||
|
||||
|
@ -73,9 +73,9 @@ typedef enum
|
|||
// Identify language to use, software localization.
|
||||
typedef enum
|
||||
{
|
||||
english,
|
||||
german,
|
||||
unknown
|
||||
english,
|
||||
german,
|
||||
unknown
|
||||
|
||||
} Language_t;
|
||||
|
||||
|
@ -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.
|
||||
|
@ -92,7 +92,7 @@ typedef enum
|
|||
// The integrated sound support is experimental,
|
||||
// and unfinished. Default is synchronous.
|
||||
// Experimental asynchronous timer based is
|
||||
// handled by SNDINTR.
|
||||
// handled by SNDINTR.
|
||||
#define SNDSERV 1
|
||||
//#define SNDINTR 1
|
||||
|
||||
|
@ -135,13 +135,13 @@ typedef enum
|
|||
|
||||
// The current state of the game: whether we are
|
||||
// playing, gazing at the intermission screen,
|
||||
// the game final animation, or a demo.
|
||||
// the game final animation, or a demo.
|
||||
typedef enum
|
||||
{
|
||||
GS_LEVEL,
|
||||
GS_INTERMISSION,
|
||||
GS_FINALE,
|
||||
GS_DEMOSCREEN
|
||||
GS_LEVEL,
|
||||
GS_INTERMISSION,
|
||||
GS_FINALE,
|
||||
GS_DEMOSCREEN
|
||||
} gamestate_t;
|
||||
|
||||
//
|
||||
|
@ -158,11 +158,11 @@ typedef enum
|
|||
|
||||
typedef enum
|
||||
{
|
||||
sk_baby,
|
||||
sk_easy,
|
||||
sk_medium,
|
||||
sk_hard,
|
||||
sk_nightmare
|
||||
sk_baby,
|
||||
sk_easy,
|
||||
sk_medium,
|
||||
sk_hard,
|
||||
sk_nightmare
|
||||
} skill_t;
|
||||
|
||||
|
||||
|
@ -173,15 +173,15 @@ typedef enum
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
it_bluecard,
|
||||
it_yellowcard,
|
||||
it_redcard,
|
||||
it_blueskull,
|
||||
it_yellowskull,
|
||||
it_redskull,
|
||||
|
||||
NUMCARDS
|
||||
|
||||
it_bluecard,
|
||||
it_yellowcard,
|
||||
it_redcard,
|
||||
it_blueskull,
|
||||
it_yellowskull,
|
||||
it_redskull,
|
||||
|
||||
NUMCARDS
|
||||
|
||||
} card_t;
|
||||
|
||||
|
||||
|
@ -191,20 +191,20 @@ typedef enum
|
|||
// user has not changed weapon.
|
||||
typedef enum
|
||||
{
|
||||
wp_fist,
|
||||
wp_pistol,
|
||||
wp_shotgun,
|
||||
wp_chaingun,
|
||||
wp_missile,
|
||||
wp_plasma,
|
||||
wp_bfg,
|
||||
wp_chainsaw,
|
||||
wp_supershotgun,
|
||||
wp_fist,
|
||||
wp_pistol,
|
||||
wp_shotgun,
|
||||
wp_chaingun,
|
||||
wp_missile,
|
||||
wp_plasma,
|
||||
wp_bfg,
|
||||
wp_chainsaw,
|
||||
wp_supershotgun,
|
||||
|
||||
NUMWEAPONS,
|
||||
|
||||
// No pending weapon change.
|
||||
wp_nochange
|
||||
NUMWEAPONS,
|
||||
|
||||
// No pending weapon change.
|
||||
wp_nochange
|
||||
|
||||
} weapontype_t;
|
||||
|
||||
|
@ -212,12 +212,12 @@ typedef enum
|
|||
// Ammunition types defined.
|
||||
typedef enum
|
||||
{
|
||||
am_clip, // Pistol / chaingun ammo.
|
||||
am_shell, // Shotgun / double barreled shotgun.
|
||||
am_cell, // Plasma rifle, BFG.
|
||||
am_misl, // Missile launcher.
|
||||
NUMAMMO,
|
||||
am_noammo // Unlimited for chainsaw / fist.
|
||||
am_clip, // Pistol / chaingun ammo.
|
||||
am_shell, // Shotgun / double barreled shotgun.
|
||||
am_cell, // Plasma rifle, BFG.
|
||||
am_misl, // Missile launcher.
|
||||
NUMAMMO,
|
||||
am_noammo // Unlimited for chainsaw / fist.
|
||||
|
||||
} ammotype_t;
|
||||
|
||||
|
@ -225,14 +225,14 @@ typedef enum
|
|||
// Power up artifacts.
|
||||
typedef enum
|
||||
{
|
||||
pw_invulnerability,
|
||||
pw_strength,
|
||||
pw_invisibility,
|
||||
pw_ironfeet,
|
||||
pw_allmap,
|
||||
pw_infrared,
|
||||
NUMPOWERS
|
||||
|
||||
pw_invulnerability,
|
||||
pw_strength,
|
||||
pw_invisibility,
|
||||
pw_ironfeet,
|
||||
pw_allmap,
|
||||
pw_infrared,
|
||||
NUMPOWERS
|
||||
|
||||
} powertype_t;
|
||||
|
||||
|
||||
|
@ -244,11 +244,11 @@ 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
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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,105 +76,123 @@ 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;
|
||||
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.
|
||||
Sys_Yield();
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
@ -232,8 +260,8 @@ void DoomInterface::QuitCurrentGame() {
|
|||
lastTicRun = 0;
|
||||
|
||||
//if ( !gameLocal->IsSplitscreen() ) {
|
||||
// Start background demos
|
||||
D_StartTitle();
|
||||
// Start background demos
|
||||
D_StartTitle();
|
||||
//}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -263,41 +294,48 @@ void DoomInterface::EndDMGame() {
|
|||
}
|
||||
}
|
||||
|
||||
//static
|
||||
int DoomInterface::CurrentPlayer() {
|
||||
//static
|
||||
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) {
|
||||
|
||||
for(int i = 0; i < 10; i++) {
|
||||
void DoomInterface::SetMultiplayerPlayers( int localPlayerIndex, int playerCount, int localPlayer, std::vector<std::string> playerAddresses )
|
||||
{
|
||||
|
||||
for( int i = 0; i < 10; i++ )
|
||||
{
|
||||
mpArgVPtr[localPlayerIndex][i] = mpArgV[localPlayerIndex][i];
|
||||
}
|
||||
|
||||
mpArgc[localPlayerIndex] = playerCount+5;
|
||||
|
||||
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());
|
||||
mpArgc[localPlayerIndex] = playerCount + 5;
|
||||
|
||||
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() );
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -39,13 +39,13 @@ class idUserCmdMgr;
|
|||
class DoomInterface
|
||||
{
|
||||
public:
|
||||
DoomInterface();
|
||||
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
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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[] = {
|
||||
"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* 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[] = {
|
||||
"I'm Too Young To Die!", "Hey, Not Too Rough!", "Hurt Me Plenty!", "Ultra-Violence", "Nightmare"
|
||||
};
|
||||
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[] = {
|
||||
"#str_friends", "#str_around", "#str_top15"
|
||||
};
|
||||
static const char* Filter_Names[] =
|
||||
{
|
||||
"#str_friends", "#str_around", "#str_top15"
|
||||
};
|
||||
|
||||
// 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"
|
||||
};
|
||||
// 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[] = {
|
||||
"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* 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[] = {
|
||||
"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* 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[] = {
|
||||
"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* 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",
|
||||
"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* 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[] = {
|
||||
"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"
|
||||
};
|
||||
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[] = {
|
||||
{ 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 },
|
||||
};
|
||||
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() {
|
||||
return &App_Expansion_Data_Local[ DoomLib::expansionSelected ];
|
||||
const ExpansionData* GetCurrentExpansion()
|
||||
{
|
||||
return &App_Expansion_Data_Local[ DoomLib::expansionSelected ];
|
||||
}
|
||||
|
||||
void SetCurrentExpansion( int expansion )
|
||||
{
|
||||
expansionDirty = true;
|
||||
expansionSelected = expansion;
|
||||
}
|
||||
|
||||
void SetIdealExpansion( int expansion )
|
||||
{
|
||||
idealExpansion = expansion;
|
||||
}
|
||||
|
||||
idStr currentMapName;
|
||||
idStr currentDifficulty;
|
||||
|
||||
void SetCurrentMapName( idStr name )
|
||||
{
|
||||
currentMapName = name;
|
||||
}
|
||||
const idStr& GetCurrentMapName()
|
||||
{
|
||||
return currentMapName;
|
||||
}
|
||||
void SetCurrentDifficulty( idStr name )
|
||||
{
|
||||
currentDifficulty = name;
|
||||
}
|
||||
const idStr& GetCurrentDifficulty()
|
||||
{
|
||||
return currentDifficulty;
|
||||
}
|
||||
|
||||
int currentplayer = -1;
|
||||
|
||||
Globals* globaldata[4];
|
||||
|
||||
//RecvFunc Recv;
|
||||
//SendFunc Send;
|
||||
//SendRemoteFunc SendRemote;
|
||||
|
||||
|
||||
bool Active = true;
|
||||
DoomInterface Interface;
|
||||
|
||||
int idealExpansion = 0;
|
||||
int expansionSelected = 0;
|
||||
bool expansionDirty = true;
|
||||
|
||||
bool skipToLoad = false;
|
||||
char loadGamePath[MAX_PATH];
|
||||
|
||||
bool skipToNew = false;
|
||||
int chosenSkill = 0;
|
||||
int chosenEpisode = 1;
|
||||
|
||||
idMatchParameters matchParms;
|
||||
|
||||
void* ( *Z_Malloc )( int size, int tag, void* user ) = NULL;
|
||||
void ( *Z_FreeTag )( int lowtag );
|
||||
|
||||
idArray< idSysMutex, 4 > playerScreenMutexes;
|
||||
|
||||
void ExitGame()
|
||||
{
|
||||
// TODO: If we ever support splitscreen and online,
|
||||
// we'll have to call D_QuitNetGame for all local players.
|
||||
DoomLib::SetPlayer( 0 );
|
||||
D_QuitNetGame();
|
||||
|
||||
session->QuitMatch();
|
||||
}
|
||||
|
||||
void ShowXToContinue( bool activate )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
DoomLib::GetGameSKU
|
||||
========================
|
||||
*/
|
||||
gameSKU_t GetGameSKU()
|
||||
{
|
||||
|
||||
if( common->GetCurrentGame() == DOOM_CLASSIC )
|
||||
{
|
||||
return GAME_SKU_DOOM1_BFG;
|
||||
}
|
||||
else if( common->GetCurrentGame() == DOOM2_CLASSIC )
|
||||
{
|
||||
return GAME_SKU_DOOM2_BFG;
|
||||
}
|
||||
|
||||
void SetCurrentExpansion( int expansion ) {
|
||||
expansionDirty = true;
|
||||
expansionSelected = expansion;
|
||||
assert( false && "Invalid basepath" );
|
||||
return GAME_SKU_DCC;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
DoomLib::ActivateGame
|
||||
========================
|
||||
*/
|
||||
void ActivateGame()
|
||||
{
|
||||
Active = true;
|
||||
|
||||
// Turn off menu toggler
|
||||
int originalPlayer = DoomLib::GetPlayer();
|
||||
|
||||
for( int i = 0; i < Interface.GetNumPlayers(); i++ )
|
||||
{
|
||||
DoomLib::SetPlayer( i );
|
||||
::g->menuactive = false;
|
||||
}
|
||||
|
||||
void SetIdealExpansion( int expansion ) {
|
||||
idealExpansion = expansion;
|
||||
}
|
||||
|
||||
idStr currentMapName;
|
||||
idStr currentDifficulty;
|
||||
|
||||
void SetCurrentMapName( idStr name ) { currentMapName = name; }
|
||||
const idStr & GetCurrentMapName() { return currentMapName; }
|
||||
void SetCurrentDifficulty( idStr name ) { currentDifficulty = name; }
|
||||
const idStr & GetCurrentDifficulty() { return currentDifficulty; }
|
||||
|
||||
int currentplayer = -1;
|
||||
|
||||
Globals *globaldata[4];
|
||||
|
||||
//RecvFunc Recv;
|
||||
//SendFunc Send;
|
||||
//SendRemoteFunc SendRemote;
|
||||
|
||||
|
||||
bool Active = true;
|
||||
DoomInterface Interface;
|
||||
|
||||
int idealExpansion = 0;
|
||||
int expansionSelected = 0;
|
||||
bool expansionDirty = true;
|
||||
|
||||
bool skipToLoad = false;
|
||||
char loadGamePath[MAX_PATH];
|
||||
|
||||
bool skipToNew = false;
|
||||
int chosenSkill = 0;
|
||||
int chosenEpisode = 1;
|
||||
|
||||
idMatchParameters matchParms;
|
||||
|
||||
void * (*Z_Malloc)( int size, int tag, void* user ) = NULL;
|
||||
void (*Z_FreeTag)(int lowtag );
|
||||
|
||||
idArray< idSysMutex, 4 > playerScreenMutexes;
|
||||
|
||||
void ExitGame() {
|
||||
// TODO: If we ever support splitscreen and online,
|
||||
// we'll have to call D_QuitNetGame for all local players.
|
||||
DoomLib::SetPlayer( 0 );
|
||||
D_QuitNetGame();
|
||||
|
||||
session->QuitMatch();
|
||||
}
|
||||
|
||||
void ShowXToContinue( bool activate ) {
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
DoomLib::GetGameSKU
|
||||
========================
|
||||
*/
|
||||
gameSKU_t GetGameSKU() {
|
||||
|
||||
if ( common->GetCurrentGame() == DOOM_CLASSIC ) {
|
||||
return GAME_SKU_DOOM1_BFG;
|
||||
} else if ( common->GetCurrentGame() == DOOM2_CLASSIC ) {
|
||||
return GAME_SKU_DOOM2_BFG;
|
||||
}
|
||||
|
||||
assert( false && "Invalid basepath" );
|
||||
return GAME_SKU_DCC;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
DoomLib::ActivateGame
|
||||
========================
|
||||
*/
|
||||
void ActivateGame() {
|
||||
Active = true;
|
||||
|
||||
// Turn off menu toggler
|
||||
int originalPlayer = DoomLib::GetPlayer();
|
||||
|
||||
for ( int i = 0; i < Interface.GetNumPlayers(); i++ ) {
|
||||
DoomLib::SetPlayer(i);
|
||||
::g->menuactive = false;
|
||||
}
|
||||
|
||||
globalPauseTime = false;
|
||||
|
||||
DoomLib::SetPlayer( originalPlayer );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
DoomLib::HandleEndMatch
|
||||
========================
|
||||
*/
|
||||
void HandleEndMatch() {
|
||||
if ( session->GetGameLobbyBase().IsHost() ) {
|
||||
ShowXToContinue( false );
|
||||
session->EndMatch();
|
||||
}
|
||||
globalPauseTime = false;
|
||||
|
||||
DoomLib::SetPlayer( originalPlayer );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
DoomLib::HandleEndMatch
|
||||
========================
|
||||
*/
|
||||
void HandleEndMatch()
|
||||
{
|
||||
if( session->GetGameLobbyBase().IsHost() )
|
||||
{
|
||||
ShowXToContinue( false );
|
||||
session->EndMatch();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -242,28 +277,32 @@ 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 ) );
|
||||
|
||||
classicRemap[K_JOY3] = KEY_TAB ;
|
||||
classicRemap[K_JOY3] = KEY_TAB ;
|
||||
classicRemap[K_JOY4] = K_MINUS;
|
||||
classicRemap[K_JOY2] = K_EQUALS;
|
||||
classicRemap[K_JOY9] = K_ESCAPE ;
|
||||
|
@ -274,23 +313,28 @@ void DoomLib::InitControlRemap() {
|
|||
classicRemap[K_JOY_STICK1_LEFT] = K_LEFTARROW ;
|
||||
classicRemap[K_JOY_DPAD_LEFT] = K_LEFTARROW ;
|
||||
classicRemap[K_JOY_STICK1_RIGHT] = K_RIGHTARROW ;
|
||||
classicRemap[K_JOY_DPAD_RIGHT] = K_RIGHTARROW ;
|
||||
classicRemap[K_JOY_DPAD_RIGHT] = K_RIGHTARROW ;
|
||||
classicRemap[K_JOY1] = K_ENTER;
|
||||
|
||||
|
||||
}
|
||||
|
||||
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 ];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -301,7 +345,7 @@ void DoomLib::InitGame( int argc, char** argv )
|
|||
::g->myargv = argv;
|
||||
|
||||
InitControlRemap();
|
||||
|
||||
|
||||
|
||||
|
||||
D_DoomMain();
|
||||
|
@ -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,9 +399,9 @@ 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,16 +453,19 @@ 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
g = globaldata[currentplayer];
|
||||
}
|
||||
}
|
||||
|
@ -428,23 +479,25 @@ void DoomLib::SetNetworking( RecvFunc rf, SendFunc sf, SendRemoteFunc sendRemote
|
|||
}
|
||||
#endif
|
||||
|
||||
int DoomLib::GetPlayer()
|
||||
{
|
||||
return currentplayer;
|
||||
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,16 +506,18 @@ 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
|
||||
|
||||
|
||||
/*
|
||||
int player = ::g->consoleplayer;
|
||||
if (player == 2 && node == 2 ) {
|
||||
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -60,10 +60,11 @@ struct rumble_t
|
|||
bool waiting;
|
||||
int left;
|
||||
int right;
|
||||
|
||||
|
||||
};
|
||||
|
||||
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,76 +95,76 @@ 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 SetPlayer( int id );
|
||||
int GetPlayer();
|
||||
//void SetNetworking( RecvFunc rf, SendFunc sf, SendRemoteFunc sendRemote );
|
||||
|
||||
byte BuildSourceDest( int toNode );
|
||||
void GetSourceDest( byte sourceDest, int* source, int* dest );
|
||||
void SetPlayer( int id );
|
||||
int GetPlayer();
|
||||
|
||||
int RemoteNodeToPlayerIndex( int node );
|
||||
int PlayerIndexToRemoteNode( int index );
|
||||
byte BuildSourceDest( int toNode );
|
||||
void GetSourceDest( byte sourceDest, int* source, int* dest );
|
||||
|
||||
void PollNetwork();
|
||||
void SendNetwork();
|
||||
int RemoteNodeToPlayerIndex( int node );
|
||||
int PlayerIndexToRemoteNode( int index );
|
||||
|
||||
void *GetGlobalData( int player );
|
||||
void PollNetwork();
|
||||
void SendNetwork();
|
||||
|
||||
void RunSound();
|
||||
void* GetGlobalData( int player );
|
||||
|
||||
//extern RecvFunc Recv;
|
||||
//extern SendFunc Send;
|
||||
//extern SendRemoteFunc SendRemote;
|
||||
void RunSound();
|
||||
|
||||
extern void* (*Z_Malloc)( int size, int tag, void* user );
|
||||
extern void (*Z_FreeTag)(int lowtag );
|
||||
//extern RecvFunc Recv;
|
||||
//extern SendFunc Send;
|
||||
//extern SendRemoteFunc SendRemote;
|
||||
|
||||
extern DoomInterface Interface;
|
||||
extern int idealExpansion;
|
||||
extern int expansionSelected;
|
||||
extern bool expansionDirty;
|
||||
extern void* ( *Z_Malloc )( int size, int tag, void* user );
|
||||
extern void ( *Z_FreeTag )( int lowtag );
|
||||
|
||||
extern bool skipToLoad;
|
||||
extern char loadGamePath[MAX_PATH];
|
||||
extern DoomInterface Interface;
|
||||
extern int idealExpansion;
|
||||
extern int expansionSelected;
|
||||
extern bool expansionDirty;
|
||||
|
||||
extern bool skipToNew;
|
||||
extern int chosenSkill;
|
||||
extern int chosenEpisode;
|
||||
extern bool skipToLoad;
|
||||
extern char loadGamePath[MAX_PATH];
|
||||
|
||||
extern idMatchParameters matchParms;
|
||||
extern bool skipToNew;
|
||||
extern int chosenSkill;
|
||||
extern int chosenEpisode;
|
||||
|
||||
const ExpansionData * GetCurrentExpansion();
|
||||
void SetCurrentExpansion( int expansion );
|
||||
extern idMatchParameters matchParms;
|
||||
|
||||
void SetIdealExpansion( int expansion );
|
||||
const ExpansionData* GetCurrentExpansion();
|
||||
void SetCurrentExpansion( int expansion );
|
||||
|
||||
void SetCurrentMapName( idStr name );
|
||||
const idStr & GetCurrentMapName();
|
||||
void SetCurrentDifficulty( idStr name );
|
||||
const idStr & GetCurrentDifficulty();
|
||||
void SetIdealExpansion( int expansion );
|
||||
|
||||
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();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -39,7 +39,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -81,7 +81,7 @@ extern int startmap;
|
|||
|
||||
extern qboolean autostart;
|
||||
|
||||
// Selected by user.
|
||||
// Selected by user.
|
||||
extern skill_t gameskill;
|
||||
extern int gameepisode;
|
||||
extern int gamemap;
|
||||
|
@ -94,8 +94,8 @@ extern qboolean netgame;
|
|||
|
||||
// Flag: true only if started as net deathmatch.
|
||||
// An enum might handle altdeath/cooperative better.
|
||||
extern qboolean deathmatch;
|
||||
|
||||
extern qboolean deathmatch;
|
||||
|
||||
// -------------------------
|
||||
// Internal parameters for sound rendering.
|
||||
// These have been taken from the DOS version,
|
||||
|
@ -149,7 +149,7 @@ extern int scaledviewwidth;
|
|||
extern int viewangleoffset;
|
||||
|
||||
// Player taking events, and displaying.
|
||||
extern int consoleplayer;
|
||||
extern int consoleplayer;
|
||||
extern int displayplayer;
|
||||
|
||||
|
||||
|
@ -177,7 +177,7 @@ extern qboolean usergame;
|
|||
extern qboolean demoplayback;
|
||||
|
||||
// Quit after playing a demo from cmdline.
|
||||
extern qboolean singledemo;
|
||||
extern qboolean singledemo;
|
||||
|
||||
|
||||
|
||||
|
@ -218,7 +218,7 @@ extern mapthing_t playerstarts[MAXPLAYERS];
|
|||
|
||||
// Intermission stats.
|
||||
// Parameters for world map / intermission.
|
||||
extern wbstartstruct_t wminfo;
|
||||
extern wbstartstruct_t wminfo;
|
||||
|
||||
|
||||
// LUT of ammunition limits for each kind.
|
||||
|
@ -248,7 +248,7 @@ extern gamestate_t wipegamestate;
|
|||
extern int mouseSensitivity;
|
||||
//?
|
||||
// debug flag to cancel adaptiveness
|
||||
extern qboolean singletics;
|
||||
extern qboolean singletics;
|
||||
|
||||
extern int bodyqueslot;
|
||||
|
||||
|
@ -267,7 +267,7 @@ extern int skyflatnum;
|
|||
extern doomcom_t doomcom;
|
||||
|
||||
// This points inside doomcom.
|
||||
extern doomdata_t* netbuffer;
|
||||
extern doomdata_t* netbuffer;
|
||||
|
||||
|
||||
extern ticcmd_t localcmds[BACKUPTICS];
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -29,49 +29,49 @@ 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,
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?"
|
||||
// DOOM1
|
||||
QUITMSG,
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?"
|
||||
|
||||
// QuitDOOM II messages
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?"
|
||||
// QuitDOOM II messages
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?"
|
||||
|
||||
// FinalDOOM?
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
// FinalDOOM?
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
"are you sure you want to quit?",
|
||||
|
||||
// Internal debug. Different style, too.
|
||||
"are you sure you want to quit?"
|
||||
// Internal debug. Different style, too.
|
||||
"are you sure you want to quit?"
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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 );
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -50,20 +50,22 @@ wipe_shittyColMajorXform
|
|||
int width,
|
||||
int height )
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
short* dest;
|
||||
int x;
|
||||
int y;
|
||||
short* dest;
|
||||
|
||||
//dest = (short*) DoomLib::Z_Malloc(width*height*2, PU_STATIC, 0 );
|
||||
//dest = (short*) DoomLib::Z_Malloc(width*height*2, PU_STATIC, 0 );
|
||||
dest = new short[ width * height ];
|
||||
|
||||
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);
|
||||
//Z_Free(dest);
|
||||
delete[] dest;
|
||||
}
|
||||
|
||||
|
@ -74,38 +76,43 @@ wipe_initMelt
|
|||
int height,
|
||||
int ticks )
|
||||
{
|
||||
int i, r;
|
||||
|
||||
// copy start screen to main screen
|
||||
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);
|
||||
|
||||
// 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);
|
||||
int i, r;
|
||||
|
||||
::g->wipe_y[0] = -(M_Random()%16);
|
||||
// copy start screen to main screen
|
||||
memcpy( ::g->wipe_scr, ::g->wipe_scr_start, width * height );
|
||||
|
||||
for (i=1;i<width;i++)
|
||||
// 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 );
|
||||
|
||||
// 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[0] = -( M_Random() % 16 );
|
||||
|
||||
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;
|
||||
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,9 +180,9 @@ wipe_exitMelt
|
|||
int height,
|
||||
int ticks )
|
||||
{
|
||||
Z_Free(::g->wipe_y);
|
||||
Z_Free( ::g->wipe_y );
|
||||
::g->wipe_y = NULL;
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -181,9 +192,9 @@ wipe_StartScreen
|
|||
int width,
|
||||
int height )
|
||||
{
|
||||
::g->wipe_scr_start = ::g->screens[2];
|
||||
I_ReadScreen(::g->wipe_scr_start);
|
||||
return 0;
|
||||
::g->wipe_scr_start = ::g->screens[2];
|
||||
I_ReadScreen( ::g->wipe_scr_start );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -193,10 +204,10 @@ wipe_EndScreen
|
|||
int width,
|
||||
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.
|
||||
return 0;
|
||||
::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.
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -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;
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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;
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -35,7 +35,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "m_fixed.h"
|
||||
#include "info.h"
|
||||
#include "sounds.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_defs.h"
|
||||
#include "z_zone.h"
|
||||
#include "d_player.h"
|
||||
#include "m_cheat.h"
|
||||
|
@ -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
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -43,15 +43,15 @@ 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;
|
||||
t->needsupdate = true;
|
||||
t->len = 0;
|
||||
t->l[0] = 0;
|
||||
t->needsupdate = true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -62,11 +62,11 @@ HUlib_initTextLine
|
|||
patch_t** f,
|
||||
int sc )
|
||||
{
|
||||
t->x = x;
|
||||
t->y = y;
|
||||
t->f = f;
|
||||
t->sc = sc;
|
||||
HUlib_clearTextLine(t);
|
||||
t->x = x;
|
||||
t->y = y;
|
||||
t->f = f;
|
||||
t->sc = sc;
|
||||
HUlib_clearTextLine( t );
|
||||
}
|
||||
|
||||
qboolean
|
||||
|
@ -75,28 +75,33 @@ HUlib_addCharToTextLine
|
|||
char ch )
|
||||
{
|
||||
|
||||
if (t->len == HU_MAXLINELENGTH)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
t->l[t->len++] = ch;
|
||||
t->l[t->len] = 0;
|
||||
t->needsupdate = 4;
|
||||
return true;
|
||||
}
|
||||
if( t->len == HU_MAXLINELENGTH )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
t->l[t->len++] = ch;
|
||||
t->l[t->len] = 0;
|
||||
t->needsupdate = 4;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
qboolean HUlib_delCharFromTextLine(hu_textline_t* t)
|
||||
qboolean HUlib_delCharFromTextLine( hu_textline_t* t )
|
||||
{
|
||||
|
||||
if (!t->len) return false;
|
||||
else
|
||||
{
|
||||
t->l[--t->len] = 0;
|
||||
t->needsupdate = 4;
|
||||
return true;
|
||||
}
|
||||
if( !t->len )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
t->l[--t->len] = 0;
|
||||
t->needsupdate = 4;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -106,73 +111,82 @@ HUlib_drawTextLine
|
|||
qboolean drawcursor )
|
||||
{
|
||||
|
||||
int i;
|
||||
int w;
|
||||
int x;
|
||||
unsigned char c;
|
||||
int i;
|
||||
int w;
|
||||
int x;
|
||||
unsigned char c;
|
||||
|
||||
// draw the new stuff
|
||||
x = l->x;
|
||||
for (i=0;i<l->len;i++)
|
||||
{
|
||||
c = toupper(l->l[i]);
|
||||
if (c != ' '
|
||||
&& c >= l->sc
|
||||
&& c <= '_')
|
||||
// draw the new stuff
|
||||
x = l->x;
|
||||
for( i = 0; i < l->len; i++ )
|
||||
{
|
||||
w = SHORT(l->f[c - l->sc]->width);
|
||||
if (x+w > SCREENWIDTH)
|
||||
break;
|
||||
V_DrawPatchDirect(x, l->y, FG, l->f[c - l->sc]);
|
||||
x += w;
|
||||
c = toupper( l->l[i] );
|
||||
if( c != ' '
|
||||
&& c >= l->sc
|
||||
&& c <= '_' )
|
||||
{
|
||||
w = SHORT( l->f[c - l->sc]->width );
|
||||
if( x + w > SCREENWIDTH )
|
||||
{
|
||||
break;
|
||||
}
|
||||
V_DrawPatchDirect( x, l->y, FG, l->f[c - l->sc] );
|
||||
x += w;
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 4;
|
||||
if( x >= SCREENWIDTH )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 4;
|
||||
if (x >= SCREENWIDTH)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// draw the cursor if requested
|
||||
if (drawcursor
|
||||
&& x + SHORT(l->f['_' - l->sc]->width) <= SCREENWIDTH)
|
||||
{
|
||||
V_DrawPatchDirect(x, l->y, FG, l->f['_' - l->sc]);
|
||||
}
|
||||
// draw the cursor if requested
|
||||
if( drawcursor
|
||||
&& x + SHORT( l->f['_' - l->sc]->width ) <= SCREENWIDTH )
|
||||
{
|
||||
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;
|
||||
int yoffset;
|
||||
int lh;
|
||||
int y;
|
||||
int yoffset;
|
||||
|
||||
// Only erases when NOT in automap and the screen is reduced,
|
||||
// and the text must either need updating or refreshing
|
||||
// (because of a recent change back from the automap)
|
||||
// Only erases when NOT in automap and the screen is reduced,
|
||||
// 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)
|
||||
{
|
||||
lh = SHORT(l->f[0]->height) + 1;
|
||||
for (y=l->y,yoffset=y*SCREENWIDTH ; y<l->y+lh ; y++,yoffset+=SCREENWIDTH)
|
||||
if( !::g->automapactive &&
|
||||
::g->viewwindowx && l->needsupdate )
|
||||
{
|
||||
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);
|
||||
// erase right border
|
||||
}
|
||||
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
|
||||
}
|
||||
else
|
||||
{
|
||||
R_VideoErase( yoffset, ::g->viewwindowx ); // erase left border
|
||||
R_VideoErase( yoffset + ::g->viewwindowx + ::g->viewwidth, ::g->viewwindowx );
|
||||
// erase right border
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
::g->lastautomapactive = ::g->automapactive;
|
||||
if (l->needsupdate) l->needsupdate--;
|
||||
::g->lastautomapactive = ::g->automapactive;
|
||||
if( l->needsupdate )
|
||||
{
|
||||
l->needsupdate--;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -187,32 +201,36 @@ HUlib_initSText
|
|||
qboolean* on )
|
||||
{
|
||||
|
||||
int i;
|
||||
int i;
|
||||
|
||||
s->h = h;
|
||||
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);
|
||||
s->h = h;
|
||||
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 );
|
||||
|
||||
}
|
||||
|
||||
void HUlib_addLineToSText(hu_stext_t* s)
|
||||
void HUlib_addLineToSText( hu_stext_t* s )
|
||||
{
|
||||
|
||||
int i;
|
||||
int i;
|
||||
|
||||
// add a clear line
|
||||
if (++s->cl == s->h)
|
||||
s->cl = 0;
|
||||
HUlib_clearTextLine(&s->l[s->cl]);
|
||||
// add a clear line
|
||||
if( ++s->cl == s->h )
|
||||
{
|
||||
s->cl = 0;
|
||||
}
|
||||
HUlib_clearTextLine( &s->l[s->cl] );
|
||||
|
||||
// everything needs updating
|
||||
for (i=0 ; i<s->h ; i++)
|
||||
s->l[i].needsupdate = 4;
|
||||
// everything needs updating
|
||||
for( i = 0 ; i < s->h ; i++ )
|
||||
{
|
||||
s->l[i].needsupdate = 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -222,50 +240,60 @@ 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;
|
||||
int i, idx;
|
||||
hu_textline_t* l;
|
||||
|
||||
if (!*s->on)
|
||||
return; // if not on, don't draw
|
||||
if( !*s->on )
|
||||
{
|
||||
return; // if not on, don't draw
|
||||
}
|
||||
|
||||
// draw everything
|
||||
for (i=0 ; i<s->h ; i++)
|
||||
{
|
||||
idx = s->cl - i;
|
||||
if (idx < 0)
|
||||
idx += s->h; // handle queue of ::g->lines
|
||||
|
||||
l = &s->l[idx];
|
||||
// draw everything
|
||||
for( i = 0 ; i < s->h ; i++ )
|
||||
{
|
||||
idx = s->cl - i;
|
||||
if( idx < 0 )
|
||||
{
|
||||
idx += s->h; // handle queue of ::g->lines
|
||||
}
|
||||
|
||||
// need a decision made here on whether to skip the draw
|
||||
HUlib_drawTextLine(l, false); // no cursor, please
|
||||
}
|
||||
l = &s->l[idx];
|
||||
|
||||
// need a decision made here on whether to skip the draw
|
||||
HUlib_drawTextLine( l, false ); // no cursor, please
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void HUlib_eraseSText(hu_stext_t* s)
|
||||
void HUlib_eraseSText( hu_stext_t* s )
|
||||
{
|
||||
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i=0 ; i<s->h ; i++)
|
||||
{
|
||||
if (s->laston && !*s->on)
|
||||
s->l[i].needsupdate = 4;
|
||||
HUlib_eraseTextLine(&s->l[i]);
|
||||
}
|
||||
s->laston = *s->on;
|
||||
for( i = 0 ; i < s->h ; i++ )
|
||||
{
|
||||
if( s->laston && !*s->on )
|
||||
{
|
||||
s->l[i].needsupdate = 4;
|
||||
}
|
||||
HUlib_eraseTextLine( &s->l[i] );
|
||||
}
|
||||
s->laston = *s->on;
|
||||
|
||||
}
|
||||
|
||||
|
@ -278,31 +306,35 @@ HUlib_initIText
|
|||
int startchar,
|
||||
qboolean* on )
|
||||
{
|
||||
it->lm = 0; // default left margin is start of text
|
||||
it->on = on;
|
||||
it->laston = true;
|
||||
HUlib_initTextLine(&it->l, x, y, font, startchar);
|
||||
it->lm = 0; // default left margin is start of text
|
||||
it->on = on;
|
||||
it->laston = true;
|
||||
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);
|
||||
it->lm = 0;
|
||||
HUlib_clearTextLine( &it->l );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -310,9 +342,11 @@ HUlib_addPrefixToIText
|
|||
( hu_itext_t* it,
|
||||
char* str )
|
||||
{
|
||||
while (*str)
|
||||
HUlib_addCharToTextLine(&it->l, *(str++));
|
||||
it->lm = it->l.len;
|
||||
while( *str )
|
||||
{
|
||||
HUlib_addCharToTextLine( &it->l, *( str++ ) );
|
||||
}
|
||||
it->lm = it->l.len;
|
||||
}
|
||||
|
||||
// wrapper function for handling general keyed input.
|
||||
|
@ -323,36 +357,44 @@ 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)
|
||||
return false; // did not eat key
|
||||
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
|
||||
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)
|
||||
return;
|
||||
HUlib_drawTextLine(l, true); // draw the line w/ cursor
|
||||
if( !*it->on )
|
||||
{
|
||||
return;
|
||||
}
|
||||
HUlib_drawTextLine( l, true ); // draw the line w/ cursor
|
||||
|
||||
}
|
||||
|
||||
void HUlib_eraseIText(hu_itext_t* it)
|
||||
void HUlib_eraseIText( hu_itext_t* it )
|
||||
{
|
||||
if (it->laston && !*it->on)
|
||||
it->l.needsupdate = 4;
|
||||
HUlib_eraseTextLine(&it->l);
|
||||
it->laston = *it->on;
|
||||
if( it->laston && !*it->on )
|
||||
{
|
||||
it->l.needsupdate = 4;
|
||||
}
|
||||
HUlib_eraseTextLine( &it->l );
|
||||
it->laston = *it->on;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -46,17 +46,17 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// (parent of Scrolling Text and Input Text widgets)
|
||||
typedef struct
|
||||
{
|
||||
// left-justified position of scrolling text window
|
||||
int x;
|
||||
int y;
|
||||
|
||||
patch_t** f; // font
|
||||
int sc; // start character
|
||||
char l[HU_MAXLINELENGTH+1]; // line of text
|
||||
int len; // current line length
|
||||
// left-justified position of scrolling text window
|
||||
int x;
|
||||
int y;
|
||||
|
||||
// whether this line needs to be udpated
|
||||
int needsupdate;
|
||||
patch_t** f; // font
|
||||
int sc; // start character
|
||||
char l[HU_MAXLINELENGTH + 1]; // line of text
|
||||
int len; // current line length
|
||||
|
||||
// whether this line needs to be udpated
|
||||
int needsupdate;
|
||||
|
||||
} hu_textline_t;
|
||||
|
||||
|
@ -66,13 +66,13 @@ typedef struct
|
|||
// (child of Text Line widget)
|
||||
typedef struct
|
||||
{
|
||||
hu_textline_t l[HU_MAXLINES]; // text lines to draw
|
||||
int h; // height in lines
|
||||
int cl; // current line number
|
||||
hu_textline_t l[HU_MAXLINES]; // text lines to draw
|
||||
int h; // height in lines
|
||||
int cl; // current line number
|
||||
|
||||
// pointer to qboolean stating whether to update window
|
||||
qboolean* on;
|
||||
qboolean laston; // last value of *->on.
|
||||
// pointer to qboolean stating whether to update window
|
||||
qboolean* on;
|
||||
qboolean laston; // last value of *->on.
|
||||
|
||||
} hu_stext_t;
|
||||
|
||||
|
@ -82,14 +82,14 @@ typedef struct
|
|||
// (child of Text Line widget)
|
||||
typedef struct
|
||||
{
|
||||
hu_textline_t l; // text line to input on
|
||||
hu_textline_t l; // text line to input on
|
||||
|
||||
// left margin past which I am not to delete characters
|
||||
int lm;
|
||||
// left margin past which I am not to delete characters
|
||||
int lm;
|
||||
|
||||
// pointer to qboolean stating whether to update window
|
||||
qboolean* on;
|
||||
qboolean laston; // last value of *->on;
|
||||
// pointer to qboolean stating whether to update window
|
||||
qboolean* on;
|
||||
qboolean laston; // last value of *->on;
|
||||
|
||||
} hu_itext_t;
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -96,93 +96,93 @@ const char* mapnames[] =
|
|||
{
|
||||
|
||||
HUSTR_E1M1,
|
||||
HUSTR_E1M2,
|
||||
HUSTR_E1M3,
|
||||
HUSTR_E1M4,
|
||||
HUSTR_E1M5,
|
||||
HUSTR_E1M6,
|
||||
HUSTR_E1M7,
|
||||
HUSTR_E1M8,
|
||||
HUSTR_E1M9,
|
||||
HUSTR_E1M2,
|
||||
HUSTR_E1M3,
|
||||
HUSTR_E1M4,
|
||||
HUSTR_E1M5,
|
||||
HUSTR_E1M6,
|
||||
HUSTR_E1M7,
|
||||
HUSTR_E1M8,
|
||||
HUSTR_E1M9,
|
||||
|
||||
HUSTR_E2M1,
|
||||
HUSTR_E2M2,
|
||||
HUSTR_E2M3,
|
||||
HUSTR_E2M4,
|
||||
HUSTR_E2M5,
|
||||
HUSTR_E2M6,
|
||||
HUSTR_E2M7,
|
||||
HUSTR_E2M8,
|
||||
HUSTR_E2M9,
|
||||
HUSTR_E2M1,
|
||||
HUSTR_E2M2,
|
||||
HUSTR_E2M3,
|
||||
HUSTR_E2M4,
|
||||
HUSTR_E2M5,
|
||||
HUSTR_E2M6,
|
||||
HUSTR_E2M7,
|
||||
HUSTR_E2M8,
|
||||
HUSTR_E2M9,
|
||||
|
||||
HUSTR_E3M1,
|
||||
HUSTR_E3M2,
|
||||
HUSTR_E3M3,
|
||||
HUSTR_E3M4,
|
||||
HUSTR_E3M5,
|
||||
HUSTR_E3M6,
|
||||
HUSTR_E3M7,
|
||||
HUSTR_E3M8,
|
||||
HUSTR_E3M9,
|
||||
HUSTR_E3M1,
|
||||
HUSTR_E3M2,
|
||||
HUSTR_E3M3,
|
||||
HUSTR_E3M4,
|
||||
HUSTR_E3M5,
|
||||
HUSTR_E3M6,
|
||||
HUSTR_E3M7,
|
||||
HUSTR_E3M8,
|
||||
HUSTR_E3M9,
|
||||
|
||||
HUSTR_E4M1,
|
||||
HUSTR_E4M2,
|
||||
HUSTR_E4M3,
|
||||
HUSTR_E4M4,
|
||||
HUSTR_E4M5,
|
||||
HUSTR_E4M6,
|
||||
HUSTR_E4M7,
|
||||
HUSTR_E4M8,
|
||||
HUSTR_E4M9,
|
||||
HUSTR_E4M1,
|
||||
HUSTR_E4M2,
|
||||
HUSTR_E4M3,
|
||||
HUSTR_E4M4,
|
||||
HUSTR_E4M5,
|
||||
HUSTR_E4M6,
|
||||
HUSTR_E4M7,
|
||||
HUSTR_E4M8,
|
||||
HUSTR_E4M9,
|
||||
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL"
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL",
|
||||
"NEWLEVEL"
|
||||
};
|
||||
|
||||
const char* mapnames2[] =
|
||||
{
|
||||
HUSTR_1,
|
||||
HUSTR_2,
|
||||
HUSTR_3,
|
||||
HUSTR_4,
|
||||
HUSTR_5,
|
||||
HUSTR_6,
|
||||
HUSTR_7,
|
||||
HUSTR_8,
|
||||
HUSTR_9,
|
||||
HUSTR_10,
|
||||
HUSTR_11,
|
||||
HUSTR_2,
|
||||
HUSTR_3,
|
||||
HUSTR_4,
|
||||
HUSTR_5,
|
||||
HUSTR_6,
|
||||
HUSTR_7,
|
||||
HUSTR_8,
|
||||
HUSTR_9,
|
||||
HUSTR_10,
|
||||
HUSTR_11,
|
||||
|
||||
HUSTR_12,
|
||||
HUSTR_13,
|
||||
HUSTR_14,
|
||||
HUSTR_15,
|
||||
HUSTR_16,
|
||||
HUSTR_17,
|
||||
HUSTR_18,
|
||||
HUSTR_19,
|
||||
HUSTR_20,
|
||||
HUSTR_12,
|
||||
HUSTR_13,
|
||||
HUSTR_14,
|
||||
HUSTR_15,
|
||||
HUSTR_16,
|
||||
HUSTR_17,
|
||||
HUSTR_18,
|
||||
HUSTR_19,
|
||||
HUSTR_20,
|
||||
|
||||
HUSTR_21,
|
||||
HUSTR_22,
|
||||
HUSTR_23,
|
||||
HUSTR_24,
|
||||
HUSTR_25,
|
||||
HUSTR_26,
|
||||
HUSTR_27,
|
||||
HUSTR_28,
|
||||
HUSTR_29,
|
||||
HUSTR_30,
|
||||
HUSTR_31,
|
||||
HUSTR_32,
|
||||
HUSTR_33
|
||||
HUSTR_21,
|
||||
HUSTR_22,
|
||||
HUSTR_23,
|
||||
HUSTR_24,
|
||||
HUSTR_25,
|
||||
HUSTR_26,
|
||||
HUSTR_27,
|
||||
HUSTR_28,
|
||||
HUSTR_29,
|
||||
HUSTR_30,
|
||||
HUSTR_31,
|
||||
HUSTR_32,
|
||||
HUSTR_33
|
||||
|
||||
};
|
||||
|
||||
|
@ -190,78 +190,78 @@ const char* mapnames2[] =
|
|||
const char* mapnamesp[] =
|
||||
{
|
||||
PHUSTR_1,
|
||||
PHUSTR_2,
|
||||
PHUSTR_3,
|
||||
PHUSTR_4,
|
||||
PHUSTR_5,
|
||||
PHUSTR_6,
|
||||
PHUSTR_7,
|
||||
PHUSTR_8,
|
||||
PHUSTR_9,
|
||||
PHUSTR_10,
|
||||
PHUSTR_11,
|
||||
PHUSTR_2,
|
||||
PHUSTR_3,
|
||||
PHUSTR_4,
|
||||
PHUSTR_5,
|
||||
PHUSTR_6,
|
||||
PHUSTR_7,
|
||||
PHUSTR_8,
|
||||
PHUSTR_9,
|
||||
PHUSTR_10,
|
||||
PHUSTR_11,
|
||||
|
||||
PHUSTR_12,
|
||||
PHUSTR_13,
|
||||
PHUSTR_14,
|
||||
PHUSTR_15,
|
||||
PHUSTR_16,
|
||||
PHUSTR_17,
|
||||
PHUSTR_18,
|
||||
PHUSTR_19,
|
||||
PHUSTR_20,
|
||||
PHUSTR_12,
|
||||
PHUSTR_13,
|
||||
PHUSTR_14,
|
||||
PHUSTR_15,
|
||||
PHUSTR_16,
|
||||
PHUSTR_17,
|
||||
PHUSTR_18,
|
||||
PHUSTR_19,
|
||||
PHUSTR_20,
|
||||
|
||||
PHUSTR_21,
|
||||
PHUSTR_22,
|
||||
PHUSTR_23,
|
||||
PHUSTR_24,
|
||||
PHUSTR_25,
|
||||
PHUSTR_26,
|
||||
PHUSTR_27,
|
||||
PHUSTR_28,
|
||||
PHUSTR_29,
|
||||
PHUSTR_30,
|
||||
PHUSTR_31,
|
||||
PHUSTR_32
|
||||
PHUSTR_21,
|
||||
PHUSTR_22,
|
||||
PHUSTR_23,
|
||||
PHUSTR_24,
|
||||
PHUSTR_25,
|
||||
PHUSTR_26,
|
||||
PHUSTR_27,
|
||||
PHUSTR_28,
|
||||
PHUSTR_29,
|
||||
PHUSTR_30,
|
||||
PHUSTR_31,
|
||||
PHUSTR_32
|
||||
};
|
||||
|
||||
// TNT WAD map names.
|
||||
const char *mapnamest[] =
|
||||
// TNT WAD map names.
|
||||
const char* mapnamest[] =
|
||||
{
|
||||
THUSTR_1,
|
||||
THUSTR_2,
|
||||
THUSTR_3,
|
||||
THUSTR_4,
|
||||
THUSTR_5,
|
||||
THUSTR_6,
|
||||
THUSTR_7,
|
||||
THUSTR_8,
|
||||
THUSTR_9,
|
||||
THUSTR_10,
|
||||
THUSTR_11,
|
||||
THUSTR_2,
|
||||
THUSTR_3,
|
||||
THUSTR_4,
|
||||
THUSTR_5,
|
||||
THUSTR_6,
|
||||
THUSTR_7,
|
||||
THUSTR_8,
|
||||
THUSTR_9,
|
||||
THUSTR_10,
|
||||
THUSTR_11,
|
||||
|
||||
THUSTR_12,
|
||||
THUSTR_13,
|
||||
THUSTR_14,
|
||||
THUSTR_15,
|
||||
THUSTR_16,
|
||||
THUSTR_17,
|
||||
THUSTR_18,
|
||||
THUSTR_19,
|
||||
THUSTR_20,
|
||||
THUSTR_12,
|
||||
THUSTR_13,
|
||||
THUSTR_14,
|
||||
THUSTR_15,
|
||||
THUSTR_16,
|
||||
THUSTR_17,
|
||||
THUSTR_18,
|
||||
THUSTR_19,
|
||||
THUSTR_20,
|
||||
|
||||
THUSTR_21,
|
||||
THUSTR_22,
|
||||
THUSTR_23,
|
||||
THUSTR_24,
|
||||
THUSTR_25,
|
||||
THUSTR_26,
|
||||
THUSTR_27,
|
||||
THUSTR_28,
|
||||
THUSTR_29,
|
||||
THUSTR_30,
|
||||
THUSTR_31,
|
||||
THUSTR_32
|
||||
THUSTR_21,
|
||||
THUSTR_22,
|
||||
THUSTR_23,
|
||||
THUSTR_24,
|
||||
THUSTR_25,
|
||||
THUSTR_26,
|
||||
THUSTR_27,
|
||||
THUSTR_28,
|
||||
THUSTR_29,
|
||||
THUSTR_30,
|
||||
THUSTR_31,
|
||||
THUSTR_32
|
||||
};
|
||||
|
||||
|
||||
|
@ -271,50 +271,50 @@ const char english_shiftxform[] =
|
|||
{
|
||||
|
||||
0,
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||
31,
|
||||
' ', '!', '"', '#', '$', '%', '&',
|
||||
'"', // shift-'
|
||||
'(', ')', '*', '+',
|
||||
'<', // shift-,
|
||||
'_', // shift--
|
||||
'>', // shift-.
|
||||
'?', // shift-/
|
||||
')', // shift-0
|
||||
'!', // shift-1
|
||||
'@', // shift-2
|
||||
'#', // shift-3
|
||||
'$', // shift-4
|
||||
'%', // shift-5
|
||||
'^', // shift-6
|
||||
'&', // shift-7
|
||||
'*', // shift-8
|
||||
'(', // shift-9
|
||||
':',
|
||||
':', // shift-;
|
||||
'<',
|
||||
'+', // shift-=
|
||||
'>', '?', '@',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
||||
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
'[', // shift-[
|
||||
'!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
|
||||
']', // shift-]
|
||||
'"', '_',
|
||||
'\'', // shift-`
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
||||
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
'{', '|', '}', '~', 127
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
||||
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||
21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||
31,
|
||||
' ', '!', '"', '#', '$', '%', '&',
|
||||
'"', // shift-'
|
||||
'(', ')', '*', '+',
|
||||
'<', // shift-,
|
||||
'_', // shift--
|
||||
'>', // shift-.
|
||||
'?', // shift-/
|
||||
')', // shift-0
|
||||
'!', // shift-1
|
||||
'@', // shift-2
|
||||
'#', // shift-3
|
||||
'$', // shift-4
|
||||
'%', // shift-5
|
||||
'^', // shift-6
|
||||
'&', // shift-7
|
||||
'*', // shift-8
|
||||
'(', // shift-9
|
||||
':',
|
||||
':', // shift-;
|
||||
'<',
|
||||
'+', // shift-=
|
||||
'>', '?', '@',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
||||
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
'[', // shift-[
|
||||
'!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
|
||||
']', // shift-]
|
||||
'"', '_',
|
||||
'\'', // shift-`
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
||||
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
'{', '|', '}', '~', 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,94 +357,104 @@ void HU_Start(void)
|
|||
::g->chat_on = false;
|
||||
|
||||
// create the message widget
|
||||
HUlib_initSText(&::g->w_message,
|
||||
HU_MSGX, HU_MSGY, HU_MSGHEIGHT,
|
||||
::g->hu_font,
|
||||
HU_FONTSTART, &::g->message_on);
|
||||
HUlib_initSText( &::g->w_message,
|
||||
HU_MSGX, HU_MSGY, HU_MSGHEIGHT,
|
||||
::g->hu_font,
|
||||
HU_FONTSTART, &::g->message_on );
|
||||
|
||||
// create the map title widget
|
||||
HUlib_initTextLine(&::g->w_title,
|
||||
HU_TITLEX, HU_TITLEY,
|
||||
::g->hu_font,
|
||||
HU_FONTSTART);
|
||||
HUlib_initTextLine( &::g->w_title,
|
||||
HU_TITLEX, HU_TITLEY,
|
||||
::g->hu_font,
|
||||
HU_FONTSTART );
|
||||
|
||||
switch ( ::g->gamemode )
|
||||
switch( ::g->gamemode )
|
||||
{
|
||||
case shareware:
|
||||
case registered:
|
||||
case retail:
|
||||
s = HU_TITLE;
|
||||
break;
|
||||
case commercial:
|
||||
default:
|
||||
if( DoomLib::expansionSelected == 5 ) {
|
||||
int map = ::g->gamemap;
|
||||
if( ::g->gamemap > 9 ) {
|
||||
map = 0;
|
||||
}
|
||||
case shareware:
|
||||
case registered:
|
||||
case retail:
|
||||
s = HU_TITLE;
|
||||
break;
|
||||
case commercial:
|
||||
default:
|
||||
if( DoomLib::expansionSelected == 5 )
|
||||
{
|
||||
int map = ::g->gamemap;
|
||||
if( ::g->gamemap > 9 )
|
||||
{
|
||||
map = 0;
|
||||
}
|
||||
|
||||
s = DoomLib::GetCurrentExpansion()->mapNames[ map - 1 ];
|
||||
} else {
|
||||
s = DoomLib::GetCurrentExpansion()->mapNames[ ::g->gamemap - 1 ];
|
||||
}
|
||||
s = DoomLib::GetCurrentExpansion()->mapNames[ map - 1 ];
|
||||
}
|
||||
else
|
||||
{
|
||||
s = DoomLib::GetCurrentExpansion()->mapNames[ ::g->gamemap - 1 ];
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
while (*s)
|
||||
HUlib_addCharToTextLine(&::g->w_title, *(s++));
|
||||
while( *s )
|
||||
{
|
||||
HUlib_addCharToTextLine( &::g->w_title, *( s++ ) );
|
||||
}
|
||||
|
||||
// create the chat widget
|
||||
HUlib_initIText(&::g->w_chat,
|
||||
HU_INPUTX, HU_INPUTY,
|
||||
::g->hu_font,
|
||||
HU_FONTSTART, &::g->chat_on);
|
||||
HUlib_initIText( &::g->w_chat,
|
||||
HU_INPUTX, HU_INPUTY,
|
||||
::g->hu_font,
|
||||
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;
|
||||
|
@ -498,70 +510,84 @@ qboolean HU_Responder(event_t *ev)
|
|||
const static char destination_keys[MAXPLAYERS] =
|
||||
{
|
||||
HUSTR_KEYGREEN,
|
||||
HUSTR_KEYINDIGO,
|
||||
HUSTR_KEYBROWN,
|
||||
HUSTR_KEYRED
|
||||
HUSTR_KEYINDIGO,
|
||||
HUSTR_KEYBROWN,
|
||||
HUSTR_KEYRED
|
||||
};
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -571,52 +597,60 @@ qboolean HU_Responder(event_t *ev)
|
|||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -39,7 +39,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define HU_FONTEND '_' // the last font characters
|
||||
|
||||
// Calculate # of glyphs in font.
|
||||
#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1)
|
||||
#define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1)
|
||||
|
||||
#define HU_BROADCAST 5
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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
|
||||
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,55 +330,58 @@ float xbox_deadzone = 0.28f;
|
|||
|
||||
|
||||
|
||||
void I_InitInput(void)
|
||||
void I_InitInput( void )
|
||||
{
|
||||
}
|
||||
|
||||
void I_ShutdownInput()
|
||||
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) {
|
||||
case IETAxis:
|
||||
switch (::g->mouseEvents[n].action)
|
||||
{
|
||||
case M_DELTAX:
|
||||
e->data2 = ::g->mouseEvents[n].data;
|
||||
break;
|
||||
case M_DELTAY:
|
||||
e->data3 = ::g->mouseEvents[n].data;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
switch( ::g->mouseEvents[n].type )
|
||||
{
|
||||
case IETAxis:
|
||||
switch( ::g->mouseEvents[n].action )
|
||||
{
|
||||
case M_DELTAX:
|
||||
e->data2 = ::g->mouseEvents[n].data;
|
||||
break;
|
||||
case M_DELTAY:
|
||||
e->data3 = ::g->mouseEvents[n].data;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int I_PollJoystickInputEvents( controller_t *con ) {
|
||||
int I_PollJoystickInputEvents( controller_t* con )
|
||||
{
|
||||
int numEvents = 0;
|
||||
|
||||
return numEvents;
|
||||
|
@ -335,137 +390,153 @@ 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;
|
||||
rc = ' ';
|
||||
break;
|
||||
case 3: // Y
|
||||
rc = '1';
|
||||
break;
|
||||
case 1: // B
|
||||
if( ::g->menuactive ) {
|
||||
rc = KEY_BACKSPACE;
|
||||
}
|
||||
else {
|
||||
rc = '2';
|
||||
}
|
||||
break;
|
||||
case 2: // X
|
||||
//rc = ' ';
|
||||
rc = KEY_TAB;
|
||||
break;
|
||||
case 4: // White
|
||||
rc = KEY_MINUS;
|
||||
break;
|
||||
case 5: // Black
|
||||
rc = KEY_EQUALS;
|
||||
break;
|
||||
case 6: // Left triggers
|
||||
rc = KEY_RSHIFT;
|
||||
break;
|
||||
case 7: // Right
|
||||
rc = KEY_RCTRL;
|
||||
break;
|
||||
case 8: // Up
|
||||
if( ::g->menuactive ) {
|
||||
rc = KEY_UPARROW;
|
||||
}
|
||||
else {
|
||||
case 0: // A
|
||||
//rc = KEY_ENTER;
|
||||
rc = '3';
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if( ::g->menuactive ) {
|
||||
rc = KEY_DOWNARROW;
|
||||
}
|
||||
else {
|
||||
//rc = KEY_TAB;
|
||||
rc = '5';
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
if( ::g->menuactive ) {
|
||||
rc = KEY_UPARROW;
|
||||
}
|
||||
else {
|
||||
//rc = '1';
|
||||
rc = '6';
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
if( ::g->menuactive ) {
|
||||
rc = KEY_DOWNARROW;
|
||||
}
|
||||
else {
|
||||
//rc = '2';
|
||||
rc = '4';
|
||||
}
|
||||
break;
|
||||
case 12: // start
|
||||
rc = KEY_ESCAPE;
|
||||
break;
|
||||
case 13: //select
|
||||
//rc = KEY_ESCAPE;
|
||||
break;
|
||||
case 14: // lclick
|
||||
case 15: // rclick
|
||||
//rc = ' ';
|
||||
break;
|
||||
rc = ' ';
|
||||
break;
|
||||
case 3: // Y
|
||||
rc = '1';
|
||||
break;
|
||||
case 1: // B
|
||||
if( ::g->menuactive )
|
||||
{
|
||||
rc = KEY_BACKSPACE;
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = '2';
|
||||
}
|
||||
break;
|
||||
case 2: // X
|
||||
//rc = ' ';
|
||||
rc = KEY_TAB;
|
||||
break;
|
||||
case 4: // White
|
||||
rc = KEY_MINUS;
|
||||
break;
|
||||
case 5: // Black
|
||||
rc = KEY_EQUALS;
|
||||
break;
|
||||
case 6: // Left triggers
|
||||
rc = KEY_RSHIFT;
|
||||
break;
|
||||
case 7: // Right
|
||||
rc = KEY_RCTRL;
|
||||
break;
|
||||
case 8: // Up
|
||||
if( ::g->menuactive )
|
||||
{
|
||||
rc = KEY_UPARROW;
|
||||
}
|
||||
else
|
||||
{
|
||||
//rc = KEY_ENTER;
|
||||
rc = '3';
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if( ::g->menuactive )
|
||||
{
|
||||
rc = KEY_DOWNARROW;
|
||||
}
|
||||
else
|
||||
{
|
||||
//rc = KEY_TAB;
|
||||
rc = '5';
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
if( ::g->menuactive )
|
||||
{
|
||||
rc = KEY_UPARROW;
|
||||
}
|
||||
else
|
||||
{
|
||||
//rc = '1';
|
||||
rc = '6';
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
if( ::g->menuactive )
|
||||
{
|
||||
rc = KEY_DOWNARROW;
|
||||
}
|
||||
else
|
||||
{
|
||||
//rc = '2';
|
||||
rc = '4';
|
||||
}
|
||||
break;
|
||||
case 12: // start
|
||||
rc = KEY_ESCAPE;
|
||||
break;
|
||||
case 13: //select
|
||||
//rc = KEY_ESCAPE;
|
||||
break;
|
||||
case 14: // lclick
|
||||
case 15: // rclick
|
||||
//rc = ' ';
|
||||
break;
|
||||
}
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
int I_ReturnJoystickInputEvent( const int n, event_t* e) {
|
||||
int I_ReturnJoystickInputEvent( const int n, event_t* e )
|
||||
{
|
||||
|
||||
e->data1 = e->data2 = e->data3 = 0;
|
||||
|
||||
switch(::g->joyEvents[n].type)
|
||||
switch( ::g->joyEvents[n].type )
|
||||
{
|
||||
case IETAxis:
|
||||
e->type = ev_joystick;//ev_mouse;
|
||||
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:
|
||||
e->type = ev_mouse;
|
||||
e->data3 = ::g->joyEvents[n].data;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
case IETButtonAnalog:
|
||||
case IETButtonDigital:
|
||||
if (::g->joyEvents[n].data)
|
||||
e->type = ev_keydown;
|
||||
else
|
||||
e->type = ev_keyup;
|
||||
e->data1 = xlatekey(::g->joyEvents[n].action);
|
||||
return 1;
|
||||
case IETAxis:
|
||||
e->type = ev_joystick;//ev_mouse;
|
||||
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:
|
||||
e->type = ev_mouse;
|
||||
e->data3 = ::g->joyEvents[n].data;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
case IETButtonAnalog:
|
||||
case IETButtonDigital:
|
||||
if( ::g->joyEvents[n].data )
|
||||
{
|
||||
e->type = ev_keydown;
|
||||
}
|
||||
else
|
||||
{
|
||||
e->type = ev_keyup;
|
||||
}
|
||||
e->data1 = xlatekey( ::g->joyEvents[n].action );
|
||||
return 1;
|
||||
|
||||
case IETNone:
|
||||
break;
|
||||
case IETNone:
|
||||
break;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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 );
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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();
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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 ) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
========================
|
||||
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() {
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
========================
|
||||
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 );
|
||||
|
@ -238,21 +256,22 @@ void I_InitNetwork (void)
|
|||
::g->sendaddress[::g->doomcom.numnodes].sin_addr.s_addr = ipAddress;
|
||||
::g->doomcom.numnodes++;
|
||||
}
|
||||
|
||||
|
||||
::g->doomcom.id = DOOMCOM_ID;
|
||||
::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)
|
||||
//{
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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;
|
||||
|
@ -157,10 +161,10 @@ void* getsfx ( const char* sfxname, int* len )
|
|||
char name[20];
|
||||
int sfxlump;
|
||||
//float scale = 1.0f;
|
||||
|
||||
|
||||
// Get the sound data from the WAD
|
||||
sprintf( name, "ds%s", sfxname );
|
||||
|
||||
|
||||
// Scale down the plasma gun, it clips
|
||||
//if ( strcmp( sfxname, "plasma" ) == 0 ) {
|
||||
// scale = 0.75f;
|
||||
|
@ -168,38 +172,43 @@ void* getsfx ( const char* sfxname, int* len )
|
|||
//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 )
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
// Remove the cached lump.
|
||||
Z_Free( sfx );
|
||||
|
||||
|
||||
// Set length.
|
||||
*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,99 +262,116 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
int i;
|
||||
activeSound_t* sound = 0;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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];
|
||||
}
|
||||
|
||||
|
||||
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] );
|
||||
}
|
||||
|
||||
|
||||
// Set the source voice volume
|
||||
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 {
|
||||
sound->localSound = false;
|
||||
x = (ALfloat)(origin->x >> FRACBITS);
|
||||
z = (ALfloat)(origin->y >> FRACBITS);
|
||||
}
|
||||
} else {
|
||||
else
|
||||
{
|
||||
sound->localSound = false;
|
||||
x = ( ALfloat )( origin->x >> FRACBITS );
|
||||
z = ( ALfloat )( origin->y >> FRACBITS );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sound->localSound = true;
|
||||
}
|
||||
if ( sound->localSound ) {
|
||||
if( sound->localSound )
|
||||
{
|
||||
x = doom_Listener.Position.x;
|
||||
z = doom_Listener.Position.z;
|
||||
}
|
||||
alSource3f( sound->alSourceVoice, AL_POSITION, x, y, z );
|
||||
|
||||
|
||||
alSourcePlay( sound->alSourceVoice );
|
||||
|
||||
|
||||
// Set id, and start time
|
||||
sound->id = id;
|
||||
sound->start = ::g->gametic;
|
||||
sound->valid = 1;
|
||||
sound->player = player;
|
||||
sound->originator = origin;
|
||||
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -356,10 +382,12 @@ 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 );
|
||||
soundEvents[i].pitch, soundEvents[i].priority );
|
||||
}
|
||||
}
|
||||
memset( soundEvents, 0, sizeof( soundEvents ) );
|
||||
|
@ -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,
|
||||
|
@ -407,20 +440,25 @@ void I_StopSound ( int handle, int player )
|
|||
// and setting the channel to zero.
|
||||
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 );
|
||||
|
||||
|
||||
sound->valid = 0;
|
||||
sound->player = -1;
|
||||
}
|
||||
|
@ -432,25 +470,30 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -463,64 +506,75 @@ 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;
|
||||
|
||||
|
||||
pAngle >>= ANGLETOFINESHIFT;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
doom_Listener.Position.x = 0.f;
|
||||
doom_Listener.Position.y = 0.f;
|
||||
doom_Listener.Position.z = 0.f;
|
||||
}
|
||||
|
||||
|
||||
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.OrientFront.z, doom_Listener.OrientTop.x, doom_Listener.OrientTop.y,
|
||||
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);
|
||||
doom_Listener.Position.y, doom_Listener.Position.z );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
@ -545,29 +599,34 @@ 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];
|
||||
|
||||
if ( !sound ) {
|
||||
for( i = 0; i < NUM_SOUNDBUFFERS; i++ )
|
||||
{
|
||||
activeSound_t* sound = &activeSounds[i];
|
||||
|
||||
if( !sound )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
I_StopSound( sound->id, 0 );
|
||||
}
|
||||
|
||||
|
||||
// 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
I_StopSong( 0 );
|
||||
|
||||
|
||||
S_initialized = 0;
|
||||
}
|
||||
|
||||
|
@ -582,19 +641,21 @@ sound channels.
|
|||
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();
|
||||
|
||||
|
||||
soundHardwareInitialized = true;
|
||||
}
|
||||
|
||||
|
@ -609,18 +670,21 @@ sound channels.
|
|||
void I_ShutdownSoundHardware()
|
||||
{
|
||||
soundHardwareInitialized = false;
|
||||
|
||||
|
||||
I_ShutdownMusic();
|
||||
|
||||
|
||||
// Delete all source voices
|
||||
for ( int i = 0; i < NUM_SOUNDBUFFERS; ++i ) {
|
||||
activeSound_t * sound = &activeSounds[i];
|
||||
|
||||
if ( !sound ) {
|
||||
for( int i = 0; i < NUM_SOUNDBUFFERS; ++i )
|
||||
{
|
||||
activeSound_t* sound = &activeSounds[i];
|
||||
|
||||
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,10 +705,10 @@ I_InitSoundChannel
|
|||
*/
|
||||
void I_InitSoundChannel( int channel, int numOutputChannels_ )
|
||||
{
|
||||
activeSound_t *soundchannel = &activeSounds[ channel ];
|
||||
|
||||
alGenSources( (ALuint)1, &soundchannel->alSourceVoice );
|
||||
|
||||
activeSound_t* soundchannel = &activeSounds[ channel ];
|
||||
|
||||
alGenSources( ( ALuint )1, &soundchannel->alSourceVoice );
|
||||
|
||||
alSource3f( soundchannel->alSourceVoice, AL_VELOCITY, 0.f, 0.f, 0.f );
|
||||
alSourcef( soundchannel->alSourceVoice, AL_LOOPING, AL_FALSE );
|
||||
alSourcef( soundchannel->alSourceVoice, AL_MAX_DISTANCE, SFX_MAX_DISTANCE );
|
||||
|
@ -658,35 +723,41 @@ 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;
|
||||
doom_Listener.OrientFront.z = 1.f;
|
||||
|
||||
|
||||
doom_Listener.OrientTop.x = 0.f;
|
||||
doom_Listener.OrientTop.y = -1.f;
|
||||
doom_Listener.OrientTop.z = 0.f;
|
||||
|
||||
|
||||
doom_Listener.Position.x = 0.f;
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
S_initialized = 1;
|
||||
}
|
||||
}
|
||||
|
@ -701,10 +772,11 @@ 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();
|
||||
|
||||
|
||||
// Change music if required
|
||||
I_UpdateMusic();
|
||||
}
|
||||
|
@ -724,7 +796,7 @@ I_SetMusicVolume
|
|||
*/
|
||||
void I_SetMusicVolume( int volume )
|
||||
{
|
||||
x_MusicVolume = (float)volume / 15.f;
|
||||
x_MusicVolume = ( float )volume / 15.f;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -734,22 +806,23 @@ 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" );
|
||||
|
||||
|
||||
musicBuffer = NULL;
|
||||
totalBufferSize = 0;
|
||||
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,37 +834,42 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
Timidity_Shutdown();
|
||||
}
|
||||
|
||||
|
||||
totalBufferSize = 0;
|
||||
waitingForMusic = false;
|
||||
musicReady = false;
|
||||
|
||||
|
||||
Music_initialized = false;
|
||||
}
|
||||
|
||||
int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len);
|
||||
int Mus2Midi( unsigned char* bytes, unsigned char* out, int* len );
|
||||
|
||||
namespace {
|
||||
const int MaxMidiConversionSize = 1024 * 1024;
|
||||
unsigned char midiConversionBuffer[MaxMidiConversionSize];
|
||||
namespace
|
||||
{
|
||||
const int MaxMidiConversionSize = 1024 * 1024;
|
||||
unsigned char midiConversionBuffer[MaxMidiConversionSize];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -799,36 +877,39 @@ namespace {
|
|||
I_LoadSong
|
||||
======================
|
||||
*/
|
||||
void I_LoadSong( const char * songname )
|
||||
void I_LoadSong( const char* songname )
|
||||
{
|
||||
idStr lumpName = "d_";
|
||||
lumpName += static_cast< const char * >( songname );
|
||||
|
||||
unsigned char * musFile = static_cast< unsigned char * >( W_CacheLumpName( lumpName.c_str(), PU_STATIC_SHARED ) );
|
||||
|
||||
lumpName += static_cast< const char* >( songname );
|
||||
|
||||
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 );
|
||||
|
||||
|
||||
int rc = RC_NO_RETURN_VALUE;
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
musicReady = true;
|
||||
}
|
||||
|
||||
|
@ -837,25 +918,28 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
musicReady = false;
|
||||
I_LoadSong( songname );
|
||||
waitingForMusic = true;
|
||||
|
||||
if ( DoomLib::GetPlayer() >= 0 ) {
|
||||
|
||||
if( DoomLib::GetPlayer() >= 0 )
|
||||
{
|
||||
::g->mus_looping = looping;
|
||||
}
|
||||
}
|
||||
|
@ -867,24 +951,29 @@ 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 );
|
||||
alSourcePlay( alMusicSourceVoice );
|
||||
}
|
||||
|
||||
|
||||
waitingForMusic = false;
|
||||
}
|
||||
}
|
||||
|
@ -895,12 +984,13 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
alSourcePause( alMusicSourceVoice );
|
||||
}
|
||||
|
||||
|
@ -909,12 +999,13 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
alSourcePlay( alMusicSourceVoice );
|
||||
}
|
||||
|
||||
|
@ -925,10 +1016,11 @@ I_StopSong
|
|||
*/
|
||||
void I_StopSong( int handle )
|
||||
{
|
||||
if ( !Music_initialized || !alMusicSourceVoice ) {
|
||||
if( !Music_initialized || !alMusicSourceVoice )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
alSourceStop( alMusicSourceVoice );
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ) {}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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;
|
||||
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,39 +86,39 @@ void I_SetTime( int time_in )
|
|||
//
|
||||
// I_Init
|
||||
//
|
||||
void I_Init (void)
|
||||
void I_Init( void )
|
||||
{
|
||||
I_InitSound();
|
||||
// I_InitGraphics();
|
||||
I_InitSound();
|
||||
// I_InitGraphics();
|
||||
}
|
||||
|
||||
//
|
||||
// I_Quit
|
||||
//
|
||||
void I_Quit (void)
|
||||
void I_Quit( void )
|
||||
{
|
||||
D_QuitNetGame ();
|
||||
I_ShutdownSound();
|
||||
I_ShutdownMusic();
|
||||
M_SaveDefaults ();
|
||||
I_ShutdownGraphics();
|
||||
D_QuitNetGame();
|
||||
I_ShutdownSound();
|
||||
I_ShutdownMusic();
|
||||
M_SaveDefaults();
|
||||
I_ShutdownGraphics();
|
||||
// exit(0);
|
||||
|
||||
// Exceptions disabled by default on PS3
|
||||
// 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;
|
||||
va_list argptr;
|
||||
|
||||
// Message first.
|
||||
if( debugOutput ) {
|
||||
va_start (argptr,msg);
|
||||
vsprintf (pmsg, msg, argptr);
|
||||
// Message first.
|
||||
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;
|
||||
va_list argptr;
|
||||
|
||||
// Message first.
|
||||
if( debugOutput ) {
|
||||
va_start (argptr,msg);
|
||||
vsprintf (pmsg, msg, argptr);
|
||||
// Message first.
|
||||
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;
|
||||
va_list argptr;
|
||||
|
||||
// Message first.
|
||||
if( debugOutput ) {
|
||||
va_start (argptr,error);
|
||||
idStr::vsnPrintf (error_msg, ERROR_MSG_SIZE, error, argptr);
|
||||
// Message first.
|
||||
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
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -50,9 +50,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
|
||||
void I_ShutdownGraphics(void)
|
||||
void I_ShutdownGraphics( void )
|
||||
{
|
||||
// VVTODO: Shutdown Graphics
|
||||
// VVTODO: Shutdown Graphics
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,22 +60,28 @@ void I_ShutdownGraphics(void)
|
|||
//
|
||||
// I_StartFrame
|
||||
//
|
||||
void I_StartFrame (void)
|
||||
void I_StartFrame( void )
|
||||
{
|
||||
// er?
|
||||
// er?
|
||||
}
|
||||
|
||||
static void I_CombineMouseEvent(const event_t* in, event_t* out)
|
||||
static void I_CombineMouseEvent( const event_t* in, event_t* out )
|
||||
{
|
||||
if (fabs((float)in->data1) > fabs((float)out->data1))
|
||||
if( fabs( ( float )in->data1 ) > fabs( ( float )out->data1 ) )
|
||||
{
|
||||
out->data1 = in->data1;
|
||||
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,56 +92,65 @@ 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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
int i;
|
||||
event_t e;
|
||||
for (i = 0; i < numEvents; ++i)
|
||||
// right thumb stick
|
||||
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_ReturnMouseInputEvent( i, &e );
|
||||
if( e.type == ev_mouse )
|
||||
{
|
||||
I_CombineMouseEvent( &e, &e_mouse );
|
||||
}
|
||||
else if( e.type == ev_joystick )
|
||||
{
|
||||
I_CombineMouseEvent( &e, &e_joystick );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
D_PostEvent(&e_mouse);
|
||||
D_PostEvent(&e_joystick);
|
||||
numEvents = I_PollJoystickInputEvents( controller );
|
||||
if( numEvents )
|
||||
{
|
||||
int i;
|
||||
event_t e;
|
||||
for( i = 0; i < numEvents; ++i )
|
||||
{
|
||||
I_ReturnJoystickInputEvent( i, &e );
|
||||
if( e.type == ev_keydown || e.type == ev_keyup )
|
||||
{
|
||||
D_PostEvent( &e );
|
||||
}
|
||||
else if( e.type == ev_joystick )
|
||||
{
|
||||
I_CombineMouseEvent( &e, &e_joystick );
|
||||
}
|
||||
else if( e.type == ev_mouse )
|
||||
{
|
||||
I_CombineMouseEvent( &e, &e_mouse );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
D_PostEvent( &e_mouse );
|
||||
D_PostEvent( &e_joystick );
|
||||
}
|
||||
|
||||
//
|
||||
// I_UpdateNoBlit
|
||||
//
|
||||
void I_UpdateNoBlit (void)
|
||||
void I_UpdateNoBlit( void )
|
||||
{
|
||||
// what is this?
|
||||
// what is this?
|
||||
}
|
||||
|
||||
//
|
||||
// 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
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -42,17 +42,19 @@ 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;
|
||||
int i;
|
||||
|
||||
for (i = 1; i < ::g->myargc; i++)
|
||||
{
|
||||
if ( !idStr::Icmp(check, ::g->myargv[i]) )
|
||||
for( i = 1; i < ::g->myargc; i++ )
|
||||
{
|
||||
if( !idStr::Icmp( check, ::g->myargv[i] ) )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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,10 +39,10 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
|
||||
void M_ClearBox (fixed_t *box)
|
||||
void M_ClearBox( fixed_t* box )
|
||||
{
|
||||
box[BOXTOP] = box[BOXRIGHT] = MININT;
|
||||
box[BOXBOTTOM] = box[BOXLEFT] = MAXINT;
|
||||
box[BOXTOP] = box[BOXRIGHT] = MININT;
|
||||
box[BOXBOTTOM] = box[BOXLEFT] = MAXINT;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -51,14 +51,22 @@ M_AddToBox
|
|||
fixed_t x,
|
||||
fixed_t y )
|
||||
{
|
||||
if (x<box[BOXLEFT])
|
||||
box[BOXLEFT] = x;
|
||||
else if (x>box[BOXRIGHT])
|
||||
box[BOXRIGHT] = x;
|
||||
if (y<box[BOXBOTTOM])
|
||||
box[BOXBOTTOM] = y;
|
||||
else if (y>box[BOXTOP])
|
||||
box[BOXTOP] = y;
|
||||
if( x < box[BOXLEFT] )
|
||||
{
|
||||
box[BOXLEFT] = x;
|
||||
}
|
||||
else if( x > box[BOXRIGHT] )
|
||||
{
|
||||
box[BOXRIGHT] = x;
|
||||
}
|
||||
if( y < box[BOXBOTTOM] )
|
||||
{
|
||||
box[BOXBOTTOM] = y;
|
||||
}
|
||||
else if( y > box[BOXTOP] )
|
||||
{
|
||||
box[BOXTOP] = y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -35,14 +35,14 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// Bounding box coordinate storage.
|
||||
enum
|
||||
{
|
||||
BOXTOP,
|
||||
BOXBOTTOM,
|
||||
BOXLEFT,
|
||||
BOXRIGHT
|
||||
BOXTOP,
|
||||
BOXBOTTOM,
|
||||
BOXLEFT,
|
||||
BOXRIGHT
|
||||
}; // bbox coordinates
|
||||
|
||||
// Bounding box functions.
|
||||
void M_ClearBox (fixed_t* box);
|
||||
void M_ClearBox( fixed_t* box );
|
||||
|
||||
void
|
||||
M_AddToBox
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -47,47 +47,66 @@ cht_CheckCheat
|
|||
char key )
|
||||
{
|
||||
return 0; // ALAN : Checking the cheats CRASHES??
|
||||
int i;
|
||||
int rc = 0;
|
||||
int i;
|
||||
int rc = 0;
|
||||
|
||||
if (::g->firsttime)
|
||||
{
|
||||
::g->firsttime = 0;
|
||||
for (i=0;i<256;i++) ::g->cheat_xlate_table[i] = SCRAMBLE(i);
|
||||
}
|
||||
if( ::g->firsttime )
|
||||
{
|
||||
::g->firsttime = 0;
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
::g->cheat_xlate_table[i] = SCRAMBLE( i );
|
||||
}
|
||||
}
|
||||
|
||||
if (!cht->p)
|
||||
{
|
||||
cht->p = ::g->cheatbuffer + ::g->usedcheatbuffer;
|
||||
int isize = 0;
|
||||
while(cht->sequence[isize] != 0xff) cht->p[isize] = cht->sequence[isize];
|
||||
cht->p[isize] = 0xff;
|
||||
::g->usedcheatbuffer += isize;
|
||||
::g->usedcheatbuffer ++;
|
||||
}
|
||||
if( !cht->p )
|
||||
{
|
||||
cht->p = ::g->cheatbuffer + ::g->usedcheatbuffer;
|
||||
int isize = 0;
|
||||
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;
|
||||
else if
|
||||
(::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];
|
||||
cht->p[isize] = 0xff;
|
||||
}
|
||||
if( *cht->p == 0 )
|
||||
{
|
||||
*( cht->p++ ) = key;
|
||||
}
|
||||
else if
|
||||
( ::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];
|
||||
}
|
||||
cht->p[isize] = 0xff;
|
||||
}
|
||||
|
||||
if (*cht->p == 1)
|
||||
cht->p++;
|
||||
else if (*cht->p == 0xff) // end of sequence character
|
||||
{
|
||||
int isize = 0;
|
||||
while(cht->sequence[isize] != 0xff) cht->p[isize] = cht->sequence[isize];
|
||||
cht->p[isize] = 0xff;
|
||||
rc = 1;
|
||||
}
|
||||
if( *cht->p == 1 )
|
||||
{
|
||||
cht->p++;
|
||||
}
|
||||
else if( *cht->p == 0xff ) // end of sequence character
|
||||
{
|
||||
int isize = 0;
|
||||
while( cht->sequence[isize] != 0xff )
|
||||
{
|
||||
cht->p[isize] = cht->sequence[isize];
|
||||
}
|
||||
cht->p[isize] = 0xff;
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -97,28 +116,33 @@ cht_GetParam
|
|||
{
|
||||
|
||||
|
||||
unsigned char pb[16];
|
||||
unsigned char *p;
|
||||
unsigned char c;
|
||||
unsigned char pb[16];
|
||||
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);
|
||||
|
||||
do
|
||||
{
|
||||
c = *p;
|
||||
*(buffer++) = c;
|
||||
*(p++) = 0;
|
||||
}
|
||||
while (c && *p!=0xff );
|
||||
while( *( p++ ) != 1 );
|
||||
|
||||
if (*p==0xff)
|
||||
*buffer = 0;
|
||||
do
|
||||
{
|
||||
c = *p;
|
||||
*( buffer++ ) = c;
|
||||
*( p++ ) = 0;
|
||||
}
|
||||
while( c && *p != 0xff );
|
||||
|
||||
if( *p == 0xff )
|
||||
{
|
||||
*buffer = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -40,10 +40,10 @@ 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;
|
||||
|
||||
|
||||
};
|
||||
|
||||
int
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,17 +77,19 @@ FixedDiv2
|
|||
fixed_t b )
|
||||
{
|
||||
#if 0
|
||||
long long c;
|
||||
c = ((long long)a<<16) / ((long long)b);
|
||||
return (fixed_t) c;
|
||||
long long c;
|
||||
c = ( ( long long )a << 16 ) / ( ( long long )b );
|
||||
return ( fixed_t ) c;
|
||||
#endif
|
||||
|
||||
double c;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -41,29 +41,29 @@ 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 );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -75,51 +75,62 @@ M_DrawText
|
|||
qboolean direct,
|
||||
char* string )
|
||||
{
|
||||
int c;
|
||||
int w;
|
||||
int c;
|
||||
int w;
|
||||
|
||||
while (*string)
|
||||
{
|
||||
c = toupper(*string) - HU_FONTSTART;
|
||||
string++;
|
||||
if (c < 0 || c> HU_FONTSIZE)
|
||||
while( *string )
|
||||
{
|
||||
x += 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
w = SHORT (::g->hu_font[c]->width);
|
||||
if (x+w > SCREENWIDTH)
|
||||
break;
|
||||
if (direct)
|
||||
V_DrawPatchDirect(x, y, 0, ::g->hu_font[c]);
|
||||
else
|
||||
V_DrawPatch(x, y, 0, ::g->hu_font[c]);
|
||||
x+=w;
|
||||
}
|
||||
c = toupper( *string ) - HU_FONTSTART;
|
||||
string++;
|
||||
if( c < 0 || c > HU_FONTSIZE )
|
||||
{
|
||||
x += 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
return x;
|
||||
w = SHORT( ::g->hu_font[c]->width );
|
||||
if( x + w > SCREENWIDTH )
|
||||
{
|
||||
break;
|
||||
}
|
||||
if( direct )
|
||||
{
|
||||
V_DrawPatchDirect( x, y, 0, ::g->hu_font[c] );
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawPatch( x, y, 0, ::g->hu_font[c] );
|
||||
}
|
||||
x += w;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// M_WriteFile
|
||||
//
|
||||
bool M_WriteFile ( char const* name, void* source, int length ) {
|
||||
|
||||
idFile * handle = NULL;
|
||||
bool M_WriteFile( char const* name, void* source, int length )
|
||||
{
|
||||
|
||||
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,32 +223,32 @@ extern const char* const temp_chat_macros[];
|
|||
//
|
||||
// M_SaveDefaults
|
||||
//
|
||||
void M_SaveDefaults (void)
|
||||
void M_SaveDefaults( void )
|
||||
{
|
||||
/*
|
||||
int i;
|
||||
int v;
|
||||
FILE* f;
|
||||
|
||||
f = f o pen (::g->defaultfile, "w");
|
||||
if (!f)
|
||||
return; // can't write the file, but don't complain
|
||||
|
||||
for (i=0 ; i<::g->numdefaults ; i++)
|
||||
{
|
||||
if (::g->defaults[i].defaultvalue > -0xfff
|
||||
&& ::g->defaults[i].defaultvalue < 0xfff)
|
||||
{
|
||||
v = *::g->defaults[i].location;
|
||||
fprintf (f,"%s\t\t%i\n",::g->defaults[i].name,v);
|
||||
} else {
|
||||
fprintf (f,"%s\t\t\"%s\"\n",::g->defaults[i].name,
|
||||
* (char **) (::g->defaults[i].location));
|
||||
}
|
||||
}
|
||||
|
||||
fclose (f);
|
||||
*/
|
||||
/*
|
||||
int i;
|
||||
int v;
|
||||
FILE* f;
|
||||
|
||||
f = f o pen (::g->defaultfile, "w");
|
||||
if (!f)
|
||||
return; // can't write the file, but don't complain
|
||||
|
||||
for (i=0 ; i<::g->numdefaults ; i++)
|
||||
{
|
||||
if (::g->defaults[i].defaultvalue > -0xfff
|
||||
&& ::g->defaults[i].defaultvalue < 0xfff)
|
||||
{
|
||||
v = *::g->defaults[i].location;
|
||||
fprintf (f,"%s\t\t%i\n",::g->defaults[i].name,v);
|
||||
} else {
|
||||
fprintf (f,"%s\t\t\"%s\"\n",::g->defaults[i].name,
|
||||
* (char **) (::g->defaults[i].location));
|
||||
}
|
||||
}
|
||||
|
||||
fclose (f);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -242,71 +256,75 @@ void M_SaveDefaults (void)
|
|||
// M_LoadDefaults
|
||||
//
|
||||
|
||||
void M_LoadDefaults (void)
|
||||
void M_LoadDefaults( void )
|
||||
{
|
||||
int i;
|
||||
//int len;
|
||||
//FILE* f;
|
||||
//char def[80];
|
||||
//char strparm[100];
|
||||
//char* newstring;
|
||||
//int parm;
|
||||
//qboolean isstring;
|
||||
|
||||
// set everything to base values
|
||||
::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)
|
||||
{
|
||||
::g->defaultfile = ::g->myargv[i+1];
|
||||
I_Printf (" default file: %s\n",::g->defaultfile);
|
||||
}
|
||||
else
|
||||
::g->defaultfile = ::g->basedefault;
|
||||
int i;
|
||||
//int len;
|
||||
//FILE* f;
|
||||
//char def[80];
|
||||
//char strparm[100];
|
||||
//char* newstring;
|
||||
//int parm;
|
||||
//qboolean isstring;
|
||||
|
||||
/*
|
||||
// read the file in, overriding any set ::g->defaults
|
||||
f = f o pen (::g->defaultfile, "r");
|
||||
if (f)
|
||||
{
|
||||
while (!feof(f))
|
||||
{
|
||||
isstring = false;
|
||||
if (fscanf (f, "%79s %[^\n]\n", def, strparm) == 2)
|
||||
// set everything to base values
|
||||
::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 )
|
||||
{
|
||||
::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)
|
||||
{
|
||||
while (!feof(f))
|
||||
{
|
||||
if (strparm[0] == '"')
|
||||
isstring = false;
|
||||
if (fscanf (f, "%79s %[^\n]\n", def, strparm) == 2)
|
||||
{
|
||||
// get a string default
|
||||
isstring = true;
|
||||
len = strlen(strparm);
|
||||
newstring = (char *)DoomLib::Z_Malloc(len, PU_STATIC, 0);
|
||||
strparm[len-1] = 0;
|
||||
strcpy(newstring, strparm+1);
|
||||
}
|
||||
else if (strparm[0] == '0' && strparm[1] == 'x')
|
||||
sscanf(strparm+2, "%x", &parm);
|
||||
else
|
||||
sscanf(strparm, "%i", &parm);
|
||||
|
||||
for (i=0 ; i<::g->numdefaults ; i++)
|
||||
if (!strcmp(def, ::g->defaults[i].name))
|
||||
if (strparm[0] == '"')
|
||||
{
|
||||
if (!isstring)
|
||||
*::g->defaults[i].location = parm;
|
||||
else
|
||||
*::g->defaults[i].location = (int) newstring;
|
||||
break;
|
||||
// get a string default
|
||||
isstring = true;
|
||||
len = strlen(strparm);
|
||||
newstring = (char *)DoomLib::Z_Malloc(len, PU_STATIC, 0);
|
||||
strparm[len-1] = 0;
|
||||
strcpy(newstring, strparm+1);
|
||||
}
|
||||
else if (strparm[0] == '0' && strparm[1] == 'x')
|
||||
sscanf(strparm+2, "%x", &parm);
|
||||
else
|
||||
sscanf(strparm, "%i", &parm);
|
||||
|
||||
for (i=0 ; i<::g->numdefaults ; i++)
|
||||
if (!strcmp(def, ::g->defaults[i].name))
|
||||
{
|
||||
if (!isstring)
|
||||
*::g->defaults[i].location = parm;
|
||||
else
|
||||
*::g->defaults[i].location = (int) newstring;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose (f);
|
||||
}
|
||||
*/
|
||||
|
||||
fclose (f);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -335,37 +353,37 @@ WritePCXfile
|
|||
//
|
||||
// M_ScreenShot
|
||||
//
|
||||
void M_ScreenShot (void)
|
||||
void M_ScreenShot( void )
|
||||
{
|
||||
/*
|
||||
int i;
|
||||
byte* linear;
|
||||
char lbmname[12];
|
||||
|
||||
// munge planar buffer to linear
|
||||
linear = ::g->screens[2];
|
||||
I_ReadScreen (linear);
|
||||
|
||||
// find a file name to save it to
|
||||
strcpy(lbmname,"DOOM00.pcx");
|
||||
|
||||
for (i=0 ; i<=99 ; i++)
|
||||
{
|
||||
lbmname[4] = i/10 + '0';
|
||||
lbmname[5] = i%10 + '0';
|
||||
if (_access(lbmname,0) == -1)
|
||||
break; // file doesn't exist
|
||||
}
|
||||
if (i==100)
|
||||
I_Error ("M_ScreenShot: Couldn't create a PCX");
|
||||
|
||||
// save the pcx file
|
||||
WritePCXfile (lbmname, linear,
|
||||
SCREENWIDTH, SCREENHEIGHT,
|
||||
(byte*)W_CacheLumpName ("PLAYPAL",PU_CACHE_SHARED));
|
||||
|
||||
::g->players[::g->consoleplayer].message = "screen shot";
|
||||
*/
|
||||
/*
|
||||
int i;
|
||||
byte* linear;
|
||||
char lbmname[12];
|
||||
|
||||
// munge planar buffer to linear
|
||||
linear = ::g->screens[2];
|
||||
I_ReadScreen (linear);
|
||||
|
||||
// find a file name to save it to
|
||||
strcpy(lbmname,"DOOM00.pcx");
|
||||
|
||||
for (i=0 ; i<=99 ; i++)
|
||||
{
|
||||
lbmname[4] = i/10 + '0';
|
||||
lbmname[5] = i%10 + '0';
|
||||
if (_access(lbmname,0) == -1)
|
||||
break; // file doesn't exist
|
||||
}
|
||||
if (i==100)
|
||||
I_Error ("M_ScreenShot: Couldn't create a PCX");
|
||||
|
||||
// save the pcx file
|
||||
WritePCXfile (lbmname, linear,
|
||||
SCREENWIDTH, SCREENHEIGHT,
|
||||
(byte*)W_CacheLumpName ("PLAYPAL",PU_CACHE_SHARED));
|
||||
|
||||
::g->players[::g->consoleplayer].message = "screen shot";
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -41,17 +41,17 @@ M_WriteFile
|
|||
int length );
|
||||
|
||||
int
|
||||
M_ReadFile
|
||||
( char const* name,
|
||||
byte** buffer );
|
||||
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
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -34,45 +34,46 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// M_Random
|
||||
// Returns a 0-255 number
|
||||
//
|
||||
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 ,
|
||||
52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224 ,
|
||||
149, 104, 25, 178, 252, 182, 202, 182, 141, 197, 4, 81, 181, 242 ,
|
||||
145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175, 249, 0 ,
|
||||
175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235 ,
|
||||
25, 92, 20, 145, 138, 77, 69, 166, 78, 176, 173, 212, 166, 113 ,
|
||||
94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37, 171, 75 ,
|
||||
136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196 ,
|
||||
135, 106, 63, 197, 195, 86, 96, 203, 113, 101, 170, 247, 181, 113 ,
|
||||
80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112, 166, 103, 241 ,
|
||||
24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224 ,
|
||||
145, 224, 81, 206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95 ,
|
||||
28, 139, 123, 98, 125, 196, 15, 70, 194, 253, 54, 14, 109, 226 ,
|
||||
71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36 ,
|
||||
17, 46, 52, 231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106 ,
|
||||
197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136 ,
|
||||
120, 163, 236, 249
|
||||
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 ,
|
||||
52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224 ,
|
||||
149, 104, 25, 178, 252, 182, 202, 182, 141, 197, 4, 81, 181, 242 ,
|
||||
145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175, 249, 0 ,
|
||||
175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235 ,
|
||||
25, 92, 20, 145, 138, 77, 69, 166, 78, 176, 173, 212, 166, 113 ,
|
||||
94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37, 171, 75 ,
|
||||
136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196 ,
|
||||
135, 106, 63, 197, 195, 86, 96, 203, 113, 101, 170, 247, 181, 113 ,
|
||||
80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112, 166, 103, 241 ,
|
||||
24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224 ,
|
||||
145, 224, 81, 206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95 ,
|
||||
28, 139, 123, 98, 125, 196, 15, 70, 194, 253, 54, 14, 109, 226 ,
|
||||
71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36 ,
|
||||
17, 46, 52, 231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106 ,
|
||||
197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136 ,
|
||||
120, 163, 236, 249
|
||||
};
|
||||
|
||||
|
||||
// Which one is deterministic?
|
||||
int P_Random (void)
|
||||
int P_Random( void )
|
||||
{
|
||||
::g->prndindex = (::g->prndindex+1)&0xff;
|
||||
return rndtable[::g->prndindex];
|
||||
::g->prndindex = ( ::g->prndindex + 1 ) & 0xff;
|
||||
return rndtable[::g->prndindex];
|
||||
}
|
||||
|
||||
int M_Random (void)
|
||||
int M_Random( void )
|
||||
{
|
||||
::g->rndindex = (::g->rndindex+1)&0xff;
|
||||
return rndtable[::g->rndindex];
|
||||
::g->rndindex = ( ::g->rndindex + 1 ) & 0xff;
|
||||
return rndtable[::g->rndindex];
|
||||
}
|
||||
|
||||
void M_ClearRandom (void)
|
||||
void M_ClearRandom( void )
|
||||
{
|
||||
::g->rndindex = ::g->prndindex = 0;
|
||||
::g->rndindex = ::g->prndindex = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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"
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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);
|
||||
// No masking with 0xFF should be necessary.
|
||||
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);
|
||||
return
|
||||
( x >> 24 )
|
||||
| ( ( x >> 8 ) & 0xff00 )
|
||||
| ( ( x << 8 ) & 0xff0000 )
|
||||
| ( x << 24 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -35,104 +35,114 @@ 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;
|
||||
}
|
||||
|
||||
// Writes a variable length integer to a buffer, and returns bytes written
|
||||
int WriteVarLen( long value, byte* out )
|
||||
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, tempo & 0x000000ff);
|
||||
buffer = WriteByte(buffer, (tempo & 0x0000ff00) >> 8);
|
||||
buffer = WriteByte(buffer, (tempo & 0x00ff0000) >> 16);
|
||||
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 );
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
unsigned char MidiMap[] =
|
||||
unsigned char MidiMap[] =
|
||||
{
|
||||
0, // prog change
|
||||
0, // bank sel
|
||||
|
@ -152,19 +162,21 @@ unsigned char MidiMap[] =
|
|||
};
|
||||
|
||||
// The MUS data is stored in little-endian.
|
||||
namespace {
|
||||
unsigned short LittleToNative( const unsigned short value ) {
|
||||
return 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;
|
||||
|
@ -176,7 +188,7 @@ int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len)
|
|||
MidiTrackChunk_t midiTrackHeader;
|
||||
// Stores the position of the midi track header(to change the size)
|
||||
byte* midiTrackHeaderOut;
|
||||
|
||||
|
||||
// Delta time for midi event
|
||||
int delta_time = 0;
|
||||
int temp;
|
||||
|
@ -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 );
|
||||
|
@ -195,13 +207,16 @@ int Mus2Midi(unsigned char* bytes, unsigned char* out, int* len)
|
|||
header.sec_channels = LittleToNative( header.sec_channels );
|
||||
header.instrCnt = LittleToNative( header.instrCnt );
|
||||
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,143 +227,159 @@ 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) {
|
||||
byte channel;
|
||||
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);
|
||||
|
||||
if (channelMap[channel] < 0) {
|
||||
out_local += WriteVarLen( delta_time, out_local );
|
||||
|
||||
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);
|
||||
break;
|
||||
case MUSEVENT_KEYOFF:
|
||||
status |= 0x80;
|
||||
bit1 = *cur++;
|
||||
bit2 = 0x40;
|
||||
break;
|
||||
case MUSEVENT_KEYON:
|
||||
status |= 0x90;
|
||||
bit1 = *cur & 127;
|
||||
if (*cur++ & 128) // volume bit?
|
||||
channel_volume[channelMap[channel]] = *cur++;
|
||||
bit2 = channel_volume[channelMap[channel]];
|
||||
break;
|
||||
case MUSEVENT_PITCHWHEEL:
|
||||
status |= 0xE0;
|
||||
bit1 = (*cur & 1) >> 6;
|
||||
bit2 = (*cur++ >> 1) & 127;
|
||||
break;
|
||||
case MUSEVENT_CHANNELMODE:
|
||||
status |= 0xB0;
|
||||
assert(*cur < sizeof(MidiMap) / sizeof(MidiMap[0]));
|
||||
bit1 = MidiMap[*cur++];
|
||||
bit2 = (*cur++ == 12) ? header.channels + 1 : 0x00;
|
||||
break;
|
||||
case MUSEVENT_CONTROLLERCHANGE:
|
||||
if (*cur == 0) {
|
||||
cur++;
|
||||
status |= 0xC0;
|
||||
default:
|
||||
assert( 0 );
|
||||
break;
|
||||
case MUSEVENT_KEYOFF:
|
||||
status |= 0x80;
|
||||
bit1 = *cur++;
|
||||
bitc = 1;
|
||||
} else {
|
||||
bit2 = 0x40;
|
||||
break;
|
||||
case MUSEVENT_KEYON:
|
||||
status |= 0x90;
|
||||
bit1 = *cur & 127;
|
||||
if( *cur++ & 128 ) // volume bit?
|
||||
{
|
||||
channel_volume[channelMap[channel]] = *cur++;
|
||||
}
|
||||
bit2 = channel_volume[channelMap[channel]];
|
||||
break;
|
||||
case MUSEVENT_PITCHWHEEL:
|
||||
status |= 0xE0;
|
||||
bit1 = ( *cur & 1 ) >> 6;
|
||||
bit2 = ( *cur++ >> 1 ) & 127;
|
||||
break;
|
||||
case MUSEVENT_CHANNELMODE:
|
||||
status |= 0xB0;
|
||||
assert(*cur < sizeof(MidiMap) / sizeof(MidiMap[0]));
|
||||
assert( *cur < sizeof( MidiMap ) / sizeof( MidiMap[0] ) );
|
||||
bit1 = MidiMap[*cur++];
|
||||
bit2 = *cur++;
|
||||
}
|
||||
break;
|
||||
case 5: // Unknown
|
||||
assert(0);
|
||||
break;
|
||||
case MUSEVENT_END: // End
|
||||
status = 0xff;
|
||||
bit1 = 0x2f;
|
||||
bit2 = 0x00;
|
||||
assert(cur == end);
|
||||
break;
|
||||
case 7: // Unknown
|
||||
assert(0);
|
||||
break;
|
||||
bit2 = ( *cur++ == 12 ) ? header.channels + 1 : 0x00;
|
||||
break;
|
||||
case MUSEVENT_CONTROLLERCHANGE:
|
||||
if( *cur == 0 )
|
||||
{
|
||||
cur++;
|
||||
status |= 0xC0;
|
||||
bit1 = *cur++;
|
||||
bitc = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
status |= 0xB0;
|
||||
assert( *cur < sizeof( MidiMap ) / sizeof( MidiMap[0] ) );
|
||||
bit1 = MidiMap[*cur++];
|
||||
bit2 = *cur++;
|
||||
}
|
||||
break;
|
||||
case 5: // Unknown
|
||||
assert( 0 );
|
||||
break;
|
||||
case MUSEVENT_END: // End
|
||||
status = 0xff;
|
||||
bit1 = 0x2f;
|
||||
bit2 = 0x00;
|
||||
assert( cur == end );
|
||||
break;
|
||||
case 7: // Unknown
|
||||
assert( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
// Write it out
|
||||
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;
|
||||
/*{
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -54,118 +54,119 @@ 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)
|
||||
{
|
||||
case 0:
|
||||
// IN STASIS
|
||||
break;
|
||||
case 1:
|
||||
// UP
|
||||
res = T_MovePlane(ceiling->sector,
|
||||
ceiling->speed,
|
||||
ceiling->topheight,
|
||||
false,1,ceiling->direction);
|
||||
|
||||
if (!(::g->leveltime&7))
|
||||
{
|
||||
switch(ceiling->type)
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
break;
|
||||
default:
|
||||
S_StartSound( &ceiling->sector->soundorg,
|
||||
sfx_stnmov);
|
||||
// ?
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (res == pastdest)
|
||||
{
|
||||
switch(ceiling->type)
|
||||
{
|
||||
case raiseToHighest:
|
||||
P_RemoveActiveCeiling(ceiling);
|
||||
break;
|
||||
|
||||
case silentCrushAndRaise:
|
||||
S_StartSound( &ceiling->sector->soundorg,
|
||||
sfx_pstop);
|
||||
case fastCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
ceiling->direction = -1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case -1:
|
||||
// DOWN
|
||||
res = T_MovePlane(ceiling->sector,
|
||||
ceiling->speed,
|
||||
ceiling->bottomheight,
|
||||
ceiling->crush,1,ceiling->direction);
|
||||
|
||||
if (!(::g->leveltime&7))
|
||||
{
|
||||
switch(ceiling->type)
|
||||
{
|
||||
case silentCrushAndRaise: break;
|
||||
default:
|
||||
S_StartSound( &ceiling->sector->soundorg,
|
||||
sfx_stnmov);
|
||||
}
|
||||
}
|
||||
|
||||
if (res == pastdest)
|
||||
{
|
||||
switch(ceiling->type)
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
S_StartSound( &ceiling->sector->soundorg,
|
||||
sfx_pstop);
|
||||
case crushAndRaise:
|
||||
ceiling->speed = CEILSPEED;
|
||||
case fastCrushAndRaise:
|
||||
ceiling->direction = 1;
|
||||
break;
|
||||
result_e res;
|
||||
|
||||
case lowerAndCrush:
|
||||
case lowerToFloor:
|
||||
P_RemoveActiveCeiling(ceiling);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // ( res != pastdest )
|
||||
switch( ceiling->direction )
|
||||
{
|
||||
if (res == crushed)
|
||||
{
|
||||
switch(ceiling->type)
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
case lowerAndCrush:
|
||||
ceiling->speed = CEILSPEED / 8;
|
||||
break;
|
||||
case 0:
|
||||
// IN STASIS
|
||||
break;
|
||||
case 1:
|
||||
// UP
|
||||
res = T_MovePlane( ceiling->sector,
|
||||
ceiling->speed,
|
||||
ceiling->topheight,
|
||||
false, 1, ceiling->direction );
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !( ::g->leveltime & 7 ) )
|
||||
{
|
||||
switch( ceiling->type )
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
break;
|
||||
default:
|
||||
S_StartSound( &ceiling->sector->soundorg,
|
||||
sfx_stnmov );
|
||||
// ?
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( res == pastdest )
|
||||
{
|
||||
switch( ceiling->type )
|
||||
{
|
||||
case raiseToHighest:
|
||||
P_RemoveActiveCeiling( ceiling );
|
||||
break;
|
||||
|
||||
case silentCrushAndRaise:
|
||||
S_StartSound( &ceiling->sector->soundorg,
|
||||
sfx_pstop );
|
||||
case fastCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
ceiling->direction = -1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case -1:
|
||||
// DOWN
|
||||
res = T_MovePlane( ceiling->sector,
|
||||
ceiling->speed,
|
||||
ceiling->bottomheight,
|
||||
ceiling->crush, 1, ceiling->direction );
|
||||
|
||||
if( !( ::g->leveltime & 7 ) )
|
||||
{
|
||||
switch( ceiling->type )
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
break;
|
||||
default:
|
||||
S_StartSound( &ceiling->sector->soundorg,
|
||||
sfx_stnmov );
|
||||
}
|
||||
}
|
||||
|
||||
if( res == pastdest )
|
||||
{
|
||||
switch( ceiling->type )
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
S_StartSound( &ceiling->sector->soundorg,
|
||||
sfx_pstop );
|
||||
case crushAndRaise:
|
||||
ceiling->speed = CEILSPEED;
|
||||
case fastCrushAndRaise:
|
||||
ceiling->direction = 1;
|
||||
break;
|
||||
|
||||
case lowerAndCrush:
|
||||
case lowerToFloor:
|
||||
P_RemoveActiveCeiling( ceiling );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // ( res != pastdest )
|
||||
{
|
||||
if( res == crushed )
|
||||
{
|
||||
switch( ceiling->type )
|
||||
{
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
case lowerAndCrush:
|
||||
ceiling->speed = CEILSPEED / 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -178,93 +179,97 @@ EV_DoCeiling
|
|||
( line_t* line,
|
||||
ceiling_e type )
|
||||
{
|
||||
int secnum;
|
||||
int rtn;
|
||||
sector_t* sec;
|
||||
ceiling_t* ceiling;
|
||||
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
|
||||
// Reactivate in-stasis ceilings...for certain types.
|
||||
switch(type)
|
||||
{
|
||||
case fastCrushAndRaise:
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
P_ActivateInStasisCeiling(line);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
||||
{
|
||||
sec = &::g->sectors[secnum];
|
||||
if (sec->specialdata)
|
||||
continue;
|
||||
|
||||
// new door thinker
|
||||
rtn = 1;
|
||||
ceiling = (ceiling_t*)DoomLib::Z_Malloc(sizeof(*ceiling), PU_LEVEL, 0);
|
||||
P_AddThinker (&ceiling->thinker);
|
||||
sec->specialdata = ceiling;
|
||||
ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling;
|
||||
ceiling->sector = sec;
|
||||
ceiling->crush = false;
|
||||
|
||||
switch(type)
|
||||
int secnum;
|
||||
int rtn;
|
||||
sector_t* sec;
|
||||
ceiling_t* ceiling;
|
||||
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
|
||||
// Reactivate in-stasis ceilings...for certain types.
|
||||
switch( type )
|
||||
{
|
||||
case fastCrushAndRaise:
|
||||
ceiling->crush = true;
|
||||
ceiling->topheight = sec->ceilingheight;
|
||||
ceiling->bottomheight = sec->floorheight + (8*FRACUNIT);
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED * 2;
|
||||
break;
|
||||
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
ceiling->crush = true;
|
||||
ceiling->topheight = sec->ceilingheight;
|
||||
case lowerAndCrush:
|
||||
case lowerToFloor:
|
||||
ceiling->bottomheight = sec->floorheight;
|
||||
if (type != lowerToFloor)
|
||||
ceiling->bottomheight += 8*FRACUNIT;
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
|
||||
case raiseToHighest:
|
||||
ceiling->topheight = P_FindHighestCeilingSurrounding(sec);
|
||||
ceiling->direction = 1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
case fastCrushAndRaise:
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
P_ActivateInStasisCeiling( line );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ceiling->tag = sec->tag;
|
||||
ceiling->type = type;
|
||||
P_AddActiveCeiling(ceiling);
|
||||
}
|
||||
return rtn;
|
||||
|
||||
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||
{
|
||||
sec = &::g->sectors[secnum];
|
||||
if( sec->specialdata )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// new door thinker
|
||||
rtn = 1;
|
||||
ceiling = ( ceiling_t* )DoomLib::Z_Malloc( sizeof( *ceiling ), PU_LEVEL, 0 );
|
||||
P_AddThinker( &ceiling->thinker );
|
||||
sec->specialdata = ceiling;
|
||||
ceiling->thinker.function.acp1 = ( actionf_p1 )T_MoveCeiling;
|
||||
ceiling->sector = sec;
|
||||
ceiling->crush = false;
|
||||
|
||||
switch( type )
|
||||
{
|
||||
case fastCrushAndRaise:
|
||||
ceiling->crush = true;
|
||||
ceiling->topheight = sec->ceilingheight;
|
||||
ceiling->bottomheight = sec->floorheight + ( 8 * FRACUNIT );
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED * 2;
|
||||
break;
|
||||
|
||||
case silentCrushAndRaise:
|
||||
case crushAndRaise:
|
||||
ceiling->crush = true;
|
||||
ceiling->topheight = sec->ceilingheight;
|
||||
case lowerAndCrush:
|
||||
case lowerToFloor:
|
||||
ceiling->bottomheight = sec->floorheight;
|
||||
if( type != lowerToFloor )
|
||||
{
|
||||
ceiling->bottomheight += 8 * FRACUNIT;
|
||||
}
|
||||
ceiling->direction = -1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
|
||||
case raiseToHighest:
|
||||
ceiling->topheight = P_FindHighestCeilingSurrounding( sec );
|
||||
ceiling->direction = 1;
|
||||
ceiling->speed = CEILSPEED;
|
||||
break;
|
||||
}
|
||||
|
||||
ceiling->tag = sec->tag;
|
||||
ceiling->type = type;
|
||||
P_AddActiveCeiling( ceiling );
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Add an active ceiling
|
||||
//
|
||||
void P_AddActiveCeiling(ceiling_t* c)
|
||||
void P_AddActiveCeiling( ceiling_t* c )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAXCEILINGS;i++)
|
||||
{
|
||||
if (::g->activeceilings[i] == NULL)
|
||||
int i;
|
||||
|
||||
for( i = 0; i < MAXCEILINGS; i++ )
|
||||
{
|
||||
::g->activeceilings[i] = c;
|
||||
return;
|
||||
if( ::g->activeceilings[i] == NULL )
|
||||
{
|
||||
::g->activeceilings[i] = c;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -272,20 +277,20 @@ 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++)
|
||||
{
|
||||
if (::g->activeceilings[i] == c)
|
||||
int i;
|
||||
|
||||
for( i = 0; i < MAXCEILINGS; i++ )
|
||||
{
|
||||
::g->activeceilings[i]->sector->specialdata = NULL;
|
||||
P_RemoveThinker (&::g->activeceilings[i]->thinker);
|
||||
::g->activeceilings[i] = NULL;
|
||||
break;
|
||||
if( ::g->activeceilings[i] == c )
|
||||
{
|
||||
::g->activeceilings[i]->sector->specialdata = NULL;
|
||||
P_RemoveThinker( &::g->activeceilings[i]->thinker );
|
||||
::g->activeceilings[i] = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -293,21 +298,21 @@ void P_RemoveActiveCeiling(ceiling_t* c)
|
|||
//
|
||||
// Restart a ceiling that's in-stasis
|
||||
//
|
||||
void P_ActivateInStasisCeiling(line_t* line)
|
||||
void P_ActivateInStasisCeiling( line_t* line )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0;i < MAXCEILINGS;i++)
|
||||
{
|
||||
if (::g->activeceilings[i]
|
||||
&& (::g->activeceilings[i]->tag == line->tag)
|
||||
&& (::g->activeceilings[i]->direction == 0))
|
||||
int i;
|
||||
|
||||
for( i = 0; i < MAXCEILINGS; i++ )
|
||||
{
|
||||
::g->activeceilings[i]->direction = ::g->activeceilings[i]->olddirection;
|
||||
::g->activeceilings[i]->thinker.function.acp1
|
||||
= (actionf_p1)T_MoveCeiling;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -316,26 +321,26 @@ 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++)
|
||||
{
|
||||
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]->direction = 0; // in-stasis
|
||||
rtn = 1;
|
||||
}
|
||||
}
|
||||
|
||||
int i;
|
||||
int rtn;
|
||||
|
||||
return rtn;
|
||||
rtn = 0;
|
||||
for( i = 0; i < MAXCEILINGS; i++ )
|
||||
{
|
||||
if( ::g->activeceilings[i]
|
||||
&& ( ::g->activeceilings[i]->tag == line->tag )
|
||||
&& ( ::g->activeceilings[i]->direction != 0 ) )
|
||||
{
|
||||
::g->activeceilings[i]->olddirection = ::g->activeceilings[i]->direction;
|
||||
::g->activeceilings[i]->thinker.function.acv = ( actionf_v )NULL;
|
||||
::g->activeceilings[i]->direction = 0; // in-stasis
|
||||
rtn = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -55,141 +55,141 @@ extern bool globalNetworking;
|
|||
//
|
||||
// T_VerticalDoor
|
||||
//
|
||||
void T_VerticalDoor (vldoor_t* door)
|
||||
void T_VerticalDoor( vldoor_t* door )
|
||||
{
|
||||
result_e res;
|
||||
|
||||
switch(door->direction)
|
||||
{
|
||||
case 0:
|
||||
// WAITING
|
||||
if (!--door->topcountdown)
|
||||
result_e res;
|
||||
|
||||
switch( door->direction )
|
||||
{
|
||||
switch(door->type)
|
||||
{
|
||||
case blazeRaise:
|
||||
door->direction = -1; // time to go back down
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_bdcls);
|
||||
break;
|
||||
|
||||
case normal:
|
||||
door->direction = -1; // time to go back down
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_dorcls);
|
||||
break;
|
||||
|
||||
case close30ThenOpen:
|
||||
door->direction = 1;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_doropn);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
// WAITING
|
||||
if( !--door->topcountdown )
|
||||
{
|
||||
switch( door->type )
|
||||
{
|
||||
case blazeRaise:
|
||||
door->direction = -1; // time to go back down
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_bdcls );
|
||||
break;
|
||||
|
||||
case normal:
|
||||
door->direction = -1; // time to go back down
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_dorcls );
|
||||
break;
|
||||
|
||||
case close30ThenOpen:
|
||||
door->direction = 1;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_doropn );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// INITIAL WAIT
|
||||
if( !--door->topcountdown )
|
||||
{
|
||||
switch( door->type )
|
||||
{
|
||||
case raiseIn5Mins:
|
||||
door->direction = 1;
|
||||
door->type = normal;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_doropn );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case -1:
|
||||
// DOWN
|
||||
res = T_MovePlane( door->sector,
|
||||
door->speed,
|
||||
door->sector->floorheight,
|
||||
false, 1, door->direction );
|
||||
if( res == pastdest )
|
||||
{
|
||||
switch( door->type )
|
||||
{
|
||||
case blazeRaise:
|
||||
case blazeClose:
|
||||
door->sector->specialdata = NULL;
|
||||
P_RemoveThinker( &door->thinker ); // unlink and free
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_bdcls );
|
||||
break;
|
||||
|
||||
case normal:
|
||||
case closed:
|
||||
door->sector->specialdata = NULL;
|
||||
P_RemoveThinker( &door->thinker ); // unlink and free
|
||||
break;
|
||||
|
||||
case close30ThenOpen:
|
||||
door->direction = 0;
|
||||
door->topcountdown = TICRATE * 30;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( res == crushed )
|
||||
{
|
||||
switch( door->type )
|
||||
{
|
||||
case blazeClose:
|
||||
case closed: // DO NOT GO BACK UP!
|
||||
break;
|
||||
|
||||
default:
|
||||
door->direction = 1;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_doropn );
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// UP
|
||||
res = T_MovePlane( door->sector,
|
||||
door->speed,
|
||||
door->topheight,
|
||||
false, 1, door->direction );
|
||||
|
||||
if( res == pastdest )
|
||||
{
|
||||
switch( door->type )
|
||||
{
|
||||
case blazeRaise:
|
||||
case normal:
|
||||
door->direction = 0; // wait at top
|
||||
door->topcountdown = door->topwait;
|
||||
break;
|
||||
|
||||
case close30ThenOpen:
|
||||
case blazeOpen:
|
||||
case opened:
|
||||
door->sector->specialdata = NULL;
|
||||
P_RemoveThinker( &door->thinker ); // unlink and free
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// INITIAL WAIT
|
||||
if (!--door->topcountdown)
|
||||
{
|
||||
switch(door->type)
|
||||
{
|
||||
case raiseIn5Mins:
|
||||
door->direction = 1;
|
||||
door->type = normal;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_doropn);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case -1:
|
||||
// DOWN
|
||||
res = T_MovePlane(door->sector,
|
||||
door->speed,
|
||||
door->sector->floorheight,
|
||||
false,1,door->direction);
|
||||
if (res == pastdest)
|
||||
{
|
||||
switch(door->type)
|
||||
{
|
||||
case blazeRaise:
|
||||
case blazeClose:
|
||||
door->sector->specialdata = NULL;
|
||||
P_RemoveThinker (&door->thinker); // unlink and free
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_bdcls);
|
||||
break;
|
||||
|
||||
case normal:
|
||||
case closed:
|
||||
door->sector->specialdata = NULL;
|
||||
P_RemoveThinker (&door->thinker); // unlink and free
|
||||
break;
|
||||
|
||||
case close30ThenOpen:
|
||||
door->direction = 0;
|
||||
door->topcountdown = TICRATE*30;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (res == crushed)
|
||||
{
|
||||
switch(door->type)
|
||||
{
|
||||
case blazeClose:
|
||||
case closed: // DO NOT GO BACK UP!
|
||||
break;
|
||||
|
||||
default:
|
||||
door->direction = 1;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_doropn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// UP
|
||||
res = T_MovePlane(door->sector,
|
||||
door->speed,
|
||||
door->topheight,
|
||||
false,1,door->direction);
|
||||
|
||||
if (res == pastdest)
|
||||
{
|
||||
switch(door->type)
|
||||
{
|
||||
case blazeRaise:
|
||||
case normal:
|
||||
door->direction = 0; // wait at top
|
||||
door->topcountdown = door->topwait;
|
||||
break;
|
||||
|
||||
case close30ThenOpen:
|
||||
case blazeOpen:
|
||||
case opened:
|
||||
door->sector->specialdata = NULL;
|
||||
P_RemoveThinker (&door->thinker); // unlink and free
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -204,57 +204,71 @@ EV_DoLockedDoor
|
|||
vldoor_e type,
|
||||
mobj_t* thing )
|
||||
{
|
||||
player_t* p;
|
||||
|
||||
p = thing->player;
|
||||
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
switch(line->special)
|
||||
{
|
||||
case 99: // Blue Lock
|
||||
case 133:
|
||||
if ( !p )
|
||||
return 0;
|
||||
if (!p->cards[it_bluecard] && !p->cards[it_blueskull])
|
||||
{
|
||||
p->message = PD_BLUEO;
|
||||
if (p == &::g->players[::g->consoleplayer])
|
||||
S_StartSound(NULL,sfx_oof);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 134: // Red Lock
|
||||
case 135:
|
||||
if ( !p )
|
||||
return 0;
|
||||
if (!p->cards[it_redcard] && !p->cards[it_redskull])
|
||||
{
|
||||
p->message = PD_REDO;
|
||||
if (p == &::g->players[::g->consoleplayer])
|
||||
S_StartSound(NULL,sfx_oof);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 136: // Yellow Lock
|
||||
case 137:
|
||||
if ( !p )
|
||||
return 0;
|
||||
if (!p->cards[it_yellowcard] &&
|
||||
!p->cards[it_yellowskull])
|
||||
{
|
||||
p->message = PD_YELLOWO;
|
||||
if (p == &::g->players[::g->consoleplayer])
|
||||
S_StartSound(NULL,sfx_oof);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
player_t* p;
|
||||
|
||||
return EV_DoDoor(line,type);
|
||||
p = thing->player;
|
||||
|
||||
if( !p )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch( line->special )
|
||||
{
|
||||
case 99: // Blue Lock
|
||||
case 133:
|
||||
if( !p )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if( !p->cards[it_bluecard] && !p->cards[it_blueskull] )
|
||||
{
|
||||
p->message = PD_BLUEO;
|
||||
if( p == &::g->players[::g->consoleplayer] )
|
||||
{
|
||||
S_StartSound( NULL, sfx_oof );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 134: // Red Lock
|
||||
case 135:
|
||||
if( !p )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if( !p->cards[it_redcard] && !p->cards[it_redskull] )
|
||||
{
|
||||
p->message = PD_REDO;
|
||||
if( p == &::g->players[::g->consoleplayer] )
|
||||
{
|
||||
S_StartSound( NULL, sfx_oof );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 136: // Yellow Lock
|
||||
case 137:
|
||||
if( !p )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if( !p->cards[it_yellowcard] &&
|
||||
!p->cards[it_yellowskull] )
|
||||
{
|
||||
p->message = PD_YELLOWO;
|
||||
if( p == &::g->players[::g->consoleplayer] )
|
||||
{
|
||||
S_StartSound( NULL, sfx_oof );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return EV_DoDoor( line, type );
|
||||
}
|
||||
|
||||
|
||||
|
@ -263,85 +277,87 @@ EV_DoDoor
|
|||
( line_t* line,
|
||||
vldoor_e type )
|
||||
{
|
||||
int secnum,rtn;
|
||||
sector_t* sec;
|
||||
vldoor_t* door;
|
||||
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
|
||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
||||
{
|
||||
sec = &::g->sectors[secnum];
|
||||
if (sec->specialdata)
|
||||
continue;
|
||||
|
||||
|
||||
// new door thinker
|
||||
rtn = 1;
|
||||
door = (vldoor_t*)DoomLib::Z_Malloc(sizeof(*door), PU_LEVEL, 0);
|
||||
P_AddThinker (&door->thinker);
|
||||
sec->specialdata = door;
|
||||
int secnum, rtn;
|
||||
sector_t* sec;
|
||||
vldoor_t* door;
|
||||
|
||||
door->thinker.function.acp1 = (actionf_p1) T_VerticalDoor;
|
||||
door->sector = sec;
|
||||
door->type = type;
|
||||
door->topwait = VDOORWAIT;
|
||||
door->speed = VDOORSPEED;
|
||||
|
||||
switch(type)
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
|
||||
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||
{
|
||||
case blazeClose:
|
||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
||||
door->topheight -= 4*FRACUNIT;
|
||||
door->direction = -1;
|
||||
door->speed = VDOORSPEED * 4;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_bdcls);
|
||||
break;
|
||||
|
||||
case closed:
|
||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
||||
door->topheight -= 4*FRACUNIT;
|
||||
door->direction = -1;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_dorcls);
|
||||
break;
|
||||
|
||||
case close30ThenOpen:
|
||||
door->topheight = sec->ceilingheight;
|
||||
door->direction = -1;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_dorcls);
|
||||
break;
|
||||
|
||||
case blazeRaise:
|
||||
case blazeOpen:
|
||||
door->direction = 1;
|
||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
||||
door->topheight -= 4*FRACUNIT;
|
||||
door->speed = VDOORSPEED * 4;
|
||||
if (door->topheight != sec->ceilingheight)
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_bdopn);
|
||||
break;
|
||||
|
||||
case normal:
|
||||
case opened:
|
||||
door->direction = 1;
|
||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
||||
door->topheight -= 4*FRACUNIT;
|
||||
if (door->topheight != sec->ceilingheight)
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_doropn);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
sec = &::g->sectors[secnum];
|
||||
if( sec->specialdata )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// new door thinker
|
||||
rtn = 1;
|
||||
door = ( vldoor_t* )DoomLib::Z_Malloc( sizeof( *door ), PU_LEVEL, 0 );
|
||||
P_AddThinker( &door->thinker );
|
||||
sec->specialdata = door;
|
||||
|
||||
door->thinker.function.acp1 = ( actionf_p1 ) T_VerticalDoor;
|
||||
door->sector = sec;
|
||||
door->type = type;
|
||||
door->topwait = VDOORWAIT;
|
||||
door->speed = VDOORSPEED;
|
||||
|
||||
switch( type )
|
||||
{
|
||||
case blazeClose:
|
||||
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||
door->topheight -= 4 * FRACUNIT;
|
||||
door->direction = -1;
|
||||
door->speed = VDOORSPEED * 4;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_bdcls );
|
||||
break;
|
||||
|
||||
case closed:
|
||||
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||
door->topheight -= 4 * FRACUNIT;
|
||||
door->direction = -1;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_dorcls );
|
||||
break;
|
||||
|
||||
case close30ThenOpen:
|
||||
door->topheight = sec->ceilingheight;
|
||||
door->direction = -1;
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_dorcls );
|
||||
break;
|
||||
|
||||
case blazeRaise:
|
||||
case blazeOpen:
|
||||
door->direction = 1;
|
||||
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||
door->topheight -= 4 * FRACUNIT;
|
||||
door->speed = VDOORSPEED * 4;
|
||||
if( door->topheight != sec->ceilingheight )
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_bdopn );
|
||||
break;
|
||||
|
||||
case normal:
|
||||
case opened:
|
||||
door->direction = 1;
|
||||
door->topheight = P_FindLowestCeilingSurrounding( sec );
|
||||
door->topheight -= 4 * FRACUNIT;
|
||||
if( door->topheight != sec->ceilingheight )
|
||||
S_StartSound( &door->sector->soundorg,
|
||||
sfx_doropn );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return rtn;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
|
||||
|
@ -353,175 +369,192 @@ EV_VerticalDoor
|
|||
( line_t* line,
|
||||
mobj_t* thing )
|
||||
{
|
||||
player_t* player;
|
||||
int secnum;
|
||||
sector_t* sec;
|
||||
vldoor_t* door;
|
||||
int side;
|
||||
|
||||
side = 0; // only front ::g->sides can be used
|
||||
player_t* player;
|
||||
int secnum;
|
||||
sector_t* sec;
|
||||
vldoor_t* door;
|
||||
int side;
|
||||
|
||||
// Check for locks
|
||||
player = thing->player;
|
||||
|
||||
switch(line->special)
|
||||
{
|
||||
case 26: // Blue Lock
|
||||
case 32:
|
||||
if ( !player )
|
||||
return;
|
||||
|
||||
if (!player->cards[it_bluecard] && !player->cards[it_blueskull])
|
||||
{
|
||||
player->message = PD_BLUEK;
|
||||
if (globalNetworking || (player == &::g->players[::g->consoleplayer]))
|
||||
S_StartSound(player->mo,sfx_oof);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 27: // Yellow Lock
|
||||
case 34:
|
||||
if ( !player )
|
||||
return;
|
||||
|
||||
if (!player->cards[it_yellowcard] &&
|
||||
!player->cards[it_yellowskull])
|
||||
{
|
||||
player->message = PD_YELLOWK;
|
||||
if (globalNetworking || (player == &::g->players[::g->consoleplayer]))
|
||||
S_StartSound(player->mo,sfx_oof);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 28: // Red Lock
|
||||
case 33:
|
||||
if ( !player )
|
||||
return;
|
||||
|
||||
if (!player->cards[it_redcard] && !player->cards[it_redskull])
|
||||
{
|
||||
player->message = PD_REDK;
|
||||
if (globalNetworking || (player == &::g->players[::g->consoleplayer]))
|
||||
S_StartSound(player->mo,sfx_oof);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// if the sector has an active thinker, use it
|
||||
sec = ::g->sides[ line->sidenum[side^1]] .sector;
|
||||
secnum = sec-::g->sectors;
|
||||
side = 0; // only front ::g->sides can be used
|
||||
|
||||
if (sec->specialdata)
|
||||
{
|
||||
door = (vldoor_t*)sec->specialdata;
|
||||
switch(line->special)
|
||||
// Check for locks
|
||||
player = thing->player;
|
||||
|
||||
switch( line->special )
|
||||
{
|
||||
case 1: // ONLY FOR "RAISE" DOORS, NOT "OPEN"s
|
||||
case 26:
|
||||
case 27:
|
||||
case 28:
|
||||
case 117:
|
||||
if (door->direction == -1)
|
||||
door->direction = 1; // go back up
|
||||
else
|
||||
{
|
||||
if (!thing->player)
|
||||
return; // JDC: bad guys never close doors
|
||||
|
||||
door->direction = -1; // start going down immediately
|
||||
}
|
||||
return;
|
||||
case 26: // Blue Lock
|
||||
case 32:
|
||||
if( !player )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( !player->cards[it_bluecard] && !player->cards[it_blueskull] )
|
||||
{
|
||||
player->message = PD_BLUEK;
|
||||
if( globalNetworking || ( player == &::g->players[::g->consoleplayer] ) )
|
||||
{
|
||||
S_StartSound( player->mo, sfx_oof );
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 27: // Yellow Lock
|
||||
case 34:
|
||||
if( !player )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( !player->cards[it_yellowcard] &&
|
||||
!player->cards[it_yellowskull] )
|
||||
{
|
||||
player->message = PD_YELLOWK;
|
||||
if( globalNetworking || ( player == &::g->players[::g->consoleplayer] ) )
|
||||
{
|
||||
S_StartSound( player->mo, sfx_oof );
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 28: // Red Lock
|
||||
case 33:
|
||||
if( !player )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( !player->cards[it_redcard] && !player->cards[it_redskull] )
|
||||
{
|
||||
player->message = PD_REDK;
|
||||
if( globalNetworking || ( player == &::g->players[::g->consoleplayer] ) )
|
||||
{
|
||||
S_StartSound( player->mo, sfx_oof );
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// for proper sound
|
||||
if (globalNetworking || (player == &::g->players[::g->consoleplayer])) {
|
||||
switch(line->special)
|
||||
|
||||
// if the sector has an active thinker, use it
|
||||
sec = ::g->sides[ line->sidenum[side ^ 1]] .sector;
|
||||
secnum = sec -::g->sectors;
|
||||
|
||||
if( sec->specialdata )
|
||||
{
|
||||
door = ( vldoor_t* )sec->specialdata;
|
||||
switch( line->special )
|
||||
{
|
||||
case 117: // BLAZING DOOR RAISE
|
||||
case 118: // BLAZING DOOR OPEN
|
||||
S_StartSound( &sec->soundorg,sfx_bdopn);
|
||||
break;
|
||||
case 1: // ONLY FOR "RAISE" DOORS, NOT "OPEN"s
|
||||
case 26:
|
||||
case 27:
|
||||
case 28:
|
||||
case 117:
|
||||
if( door->direction == -1 )
|
||||
{
|
||||
door->direction = 1; // go back up
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !thing->player )
|
||||
{
|
||||
return; // JDC: bad guys never close doors
|
||||
}
|
||||
|
||||
case 1: // NORMAL DOOR SOUND
|
||||
case 31:
|
||||
S_StartSound( &sec->soundorg,sfx_doropn);
|
||||
break;
|
||||
|
||||
default: // LOCKED DOOR SOUND
|
||||
S_StartSound( &sec->soundorg,sfx_doropn);
|
||||
break;
|
||||
door->direction = -1; // start going down immediately
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// new 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->sector = sec;
|
||||
door->direction = 1;
|
||||
door->speed = VDOORSPEED;
|
||||
door->topwait = VDOORWAIT;
|
||||
|
||||
switch(line->special)
|
||||
{
|
||||
case 1:
|
||||
case 26:
|
||||
case 27:
|
||||
case 28:
|
||||
door->type = normal;
|
||||
break;
|
||||
|
||||
case 31:
|
||||
case 32:
|
||||
case 33:
|
||||
case 34:
|
||||
door->type = opened;
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
case 117: // blazing door raise
|
||||
door->type = blazeRaise;
|
||||
door->speed = VDOORSPEED*4;
|
||||
break;
|
||||
case 118: // blazing door open
|
||||
door->type = blazeOpen;
|
||||
line->special = 0;
|
||||
door->speed = VDOORSPEED*4;
|
||||
break;
|
||||
}
|
||||
|
||||
// find the top and bottom of the movement range
|
||||
door->topheight = P_FindLowestCeilingSurrounding(sec);
|
||||
door->topheight -= 4*FRACUNIT;
|
||||
// for proper sound
|
||||
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 );
|
||||
break;
|
||||
|
||||
case 1: // NORMAL DOOR SOUND
|
||||
case 31:
|
||||
S_StartSound( &sec->soundorg, sfx_doropn );
|
||||
break;
|
||||
|
||||
default: // LOCKED DOOR SOUND
|
||||
S_StartSound( &sec->soundorg, sfx_doropn );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// new door thinker
|
||||
door = ( vldoor_t* )DoomLib::Z_Malloc( sizeof( *door ), PU_LEVEL, 0 );
|
||||
P_AddThinker( &door->thinker );
|
||||
sec->specialdata = door;
|
||||
door->thinker.function.acp1 = ( actionf_p1 ) T_VerticalDoor;
|
||||
door->sector = sec;
|
||||
door->direction = 1;
|
||||
door->speed = VDOORSPEED;
|
||||
door->topwait = VDOORWAIT;
|
||||
|
||||
switch( line->special )
|
||||
{
|
||||
case 1:
|
||||
case 26:
|
||||
case 27:
|
||||
case 28:
|
||||
door->type = normal;
|
||||
break;
|
||||
|
||||
case 31:
|
||||
case 32:
|
||||
case 33:
|
||||
case 34:
|
||||
door->type = opened;
|
||||
line->special = 0;
|
||||
break;
|
||||
|
||||
case 117: // blazing door raise
|
||||
door->type = blazeRaise;
|
||||
door->speed = VDOORSPEED * 4;
|
||||
break;
|
||||
case 118: // blazing door open
|
||||
door->type = blazeOpen;
|
||||
line->special = 0;
|
||||
door->speed = VDOORSPEED * 4;
|
||||
break;
|
||||
}
|
||||
|
||||
// find the top and bottom of the movement range
|
||||
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);
|
||||
vldoor_t* door;
|
||||
|
||||
P_AddThinker (&door->thinker);
|
||||
door = ( vldoor_t* )DoomLib::Z_Malloc( sizeof( *door ), PU_LEVEL, 0 );
|
||||
|
||||
sec->specialdata = door;
|
||||
sec->special = 0;
|
||||
P_AddThinker( &door->thinker );
|
||||
|
||||
door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor;
|
||||
door->sector = sec;
|
||||
door->direction = 0;
|
||||
door->type = normal;
|
||||
door->speed = VDOORSPEED;
|
||||
door->topcountdown = 30 * TICRATE;
|
||||
sec->specialdata = door;
|
||||
sec->special = 0;
|
||||
|
||||
door->thinker.function.acp1 = ( actionf_p1 )T_VerticalDoor;
|
||||
door->sector = sec;
|
||||
door->direction = 0;
|
||||
door->type = normal;
|
||||
door->speed = VDOORSPEED;
|
||||
door->topcountdown = 30 * TICRATE;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -532,24 +565,24 @@ P_SpawnDoorRaiseIn5Mins
|
|||
( sector_t* sec,
|
||||
int secnum )
|
||||
{
|
||||
vldoor_t* door;
|
||||
|
||||
door = (vldoor_t*)DoomLib::Z_Malloc( sizeof(*door), PU_LEVEL, 0);
|
||||
|
||||
P_AddThinker (&door->thinker);
|
||||
vldoor_t* door;
|
||||
|
||||
sec->specialdata = door;
|
||||
sec->special = 0;
|
||||
door = ( vldoor_t* )DoomLib::Z_Malloc( sizeof( *door ), PU_LEVEL, 0 );
|
||||
|
||||
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->topwait = VDOORWAIT;
|
||||
door->topcountdown = 5 * 60 * TICRATE;
|
||||
P_AddThinker( &door->thinker );
|
||||
|
||||
sec->specialdata = door;
|
||||
sec->special = 0;
|
||||
|
||||
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->topwait = VDOORWAIT;
|
||||
door->topcountdown = 5 * 60 * TICRATE;
|
||||
}
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -59,202 +59,206 @@ T_MovePlane
|
|||
int floorOrCeiling,
|
||||
int direction )
|
||||
{
|
||||
qboolean flag;
|
||||
fixed_t lastpos;
|
||||
|
||||
switch(floorOrCeiling)
|
||||
{
|
||||
case 0:
|
||||
// FLOOR
|
||||
switch(direction)
|
||||
{
|
||||
case -1:
|
||||
// DOWN
|
||||
if (sector->floorheight - speed < dest)
|
||||
{
|
||||
lastpos = sector->floorheight;
|
||||
sector->floorheight = dest;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
if (flag == true)
|
||||
{
|
||||
sector->floorheight =lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
//return crushed;
|
||||
}
|
||||
return pastdest;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastpos = sector->floorheight;
|
||||
sector->floorheight -= speed;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
if (flag == true)
|
||||
{
|
||||
sector->floorheight = lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
return crushed;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// UP
|
||||
if (sector->floorheight + speed > dest)
|
||||
{
|
||||
lastpos = sector->floorheight;
|
||||
sector->floorheight = dest;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
if (flag == true)
|
||||
{
|
||||
sector->floorheight = lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
//return crushed;
|
||||
}
|
||||
return pastdest;
|
||||
}
|
||||
else
|
||||
{
|
||||
// COULD GET CRUSHED
|
||||
lastpos = sector->floorheight;
|
||||
sector->floorheight += speed;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
if (flag == true)
|
||||
{
|
||||
if (crush == true)
|
||||
return crushed;
|
||||
sector->floorheight = lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
return crushed;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// CEILING
|
||||
switch(direction)
|
||||
{
|
||||
case -1:
|
||||
// DOWN
|
||||
if (sector->ceilingheight - speed < dest)
|
||||
{
|
||||
lastpos = sector->ceilingheight;
|
||||
sector->ceilingheight = dest;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
qboolean flag;
|
||||
fixed_t lastpos;
|
||||
|
||||
if (flag == true)
|
||||
{
|
||||
sector->ceilingheight = lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
//return crushed;
|
||||
}
|
||||
return pastdest;
|
||||
}
|
||||
else
|
||||
{
|
||||
// COULD GET CRUSHED
|
||||
lastpos = sector->ceilingheight;
|
||||
sector->ceilingheight -= speed;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
switch( floorOrCeiling )
|
||||
{
|
||||
case 0:
|
||||
// FLOOR
|
||||
switch( direction )
|
||||
{
|
||||
case -1:
|
||||
// DOWN
|
||||
if( sector->floorheight - speed < dest )
|
||||
{
|
||||
lastpos = sector->floorheight;
|
||||
sector->floorheight = dest;
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
if( flag == true )
|
||||
{
|
||||
sector->floorheight = lastpos;
|
||||
P_ChangeSector( sector, crush );
|
||||
//return crushed;
|
||||
}
|
||||
return pastdest;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastpos = sector->floorheight;
|
||||
sector->floorheight -= speed;
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
if( flag == true )
|
||||
{
|
||||
sector->floorheight = lastpos;
|
||||
P_ChangeSector( sector, crush );
|
||||
return crushed;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
if (flag == true)
|
||||
{
|
||||
if (crush == true)
|
||||
return crushed;
|
||||
sector->ceilingheight = lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
return crushed;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// UP
|
||||
if (sector->ceilingheight + speed > dest)
|
||||
{
|
||||
lastpos = sector->ceilingheight;
|
||||
sector->ceilingheight = dest;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
if (flag == true)
|
||||
{
|
||||
sector->ceilingheight = lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
//return crushed;
|
||||
}
|
||||
return pastdest;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastpos = sector->ceilingheight;
|
||||
sector->ceilingheight += speed;
|
||||
flag = P_ChangeSector(sector,crush);
|
||||
case 1:
|
||||
// UP
|
||||
if( sector->floorheight + speed > dest )
|
||||
{
|
||||
lastpos = sector->floorheight;
|
||||
sector->floorheight = dest;
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
if( flag == true )
|
||||
{
|
||||
sector->floorheight = lastpos;
|
||||
P_ChangeSector( sector, crush );
|
||||
//return crushed;
|
||||
}
|
||||
return pastdest;
|
||||
}
|
||||
else
|
||||
{
|
||||
// COULD GET CRUSHED
|
||||
lastpos = sector->floorheight;
|
||||
sector->floorheight += speed;
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
if( flag == true )
|
||||
{
|
||||
if( crush == true )
|
||||
{
|
||||
return crushed;
|
||||
}
|
||||
sector->floorheight = lastpos;
|
||||
P_ChangeSector( sector, crush );
|
||||
return crushed;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// CEILING
|
||||
switch( direction )
|
||||
{
|
||||
case -1:
|
||||
// DOWN
|
||||
if( sector->ceilingheight - speed < dest )
|
||||
{
|
||||
lastpos = sector->ceilingheight;
|
||||
sector->ceilingheight = dest;
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
|
||||
if( flag == true )
|
||||
{
|
||||
sector->ceilingheight = lastpos;
|
||||
P_ChangeSector( sector, crush );
|
||||
//return crushed;
|
||||
}
|
||||
return pastdest;
|
||||
}
|
||||
else
|
||||
{
|
||||
// COULD GET CRUSHED
|
||||
lastpos = sector->ceilingheight;
|
||||
sector->ceilingheight -= speed;
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
|
||||
if( flag == true )
|
||||
{
|
||||
if( crush == true )
|
||||
{
|
||||
return crushed;
|
||||
}
|
||||
sector->ceilingheight = lastpos;
|
||||
P_ChangeSector( sector, crush );
|
||||
return crushed;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// UP
|
||||
if( sector->ceilingheight + speed > dest )
|
||||
{
|
||||
lastpos = sector->ceilingheight;
|
||||
sector->ceilingheight = dest;
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
if( flag == true )
|
||||
{
|
||||
sector->ceilingheight = lastpos;
|
||||
P_ChangeSector( sector, crush );
|
||||
//return crushed;
|
||||
}
|
||||
return pastdest;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastpos = sector->ceilingheight;
|
||||
sector->ceilingheight += speed;
|
||||
flag = P_ChangeSector( sector, crush );
|
||||
// UNUSED
|
||||
#if 0
|
||||
if (flag == true)
|
||||
{
|
||||
sector->ceilingheight = lastpos;
|
||||
P_ChangeSector(sector,crush);
|
||||
return crushed;
|
||||
}
|
||||
if( flag == true )
|
||||
{
|
||||
sector->ceilingheight = lastpos;
|
||||
P_ChangeSector( sector, crush );
|
||||
return crushed;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
return ok;
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 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,
|
||||
floor->speed,
|
||||
floor->floordestheight,
|
||||
floor->crush,0,floor->direction);
|
||||
|
||||
if (!(::g->leveltime&7))
|
||||
S_StartSound( &floor->sector->soundorg,
|
||||
sfx_stnmov);
|
||||
|
||||
if (res == pastdest)
|
||||
{
|
||||
floor->sector->specialdata = NULL;
|
||||
result_e res;
|
||||
|
||||
if (floor->direction == 1)
|
||||
{
|
||||
switch(floor->type)
|
||||
{
|
||||
case donutRaise:
|
||||
floor->sector->special = floor->newspecial;
|
||||
floor->sector->floorpic = floor->texture;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (floor->direction == -1)
|
||||
{
|
||||
switch(floor->type)
|
||||
{
|
||||
case lowerAndChange:
|
||||
floor->sector->special = floor->newspecial;
|
||||
floor->sector->floorpic = floor->texture;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
P_RemoveThinker(&floor->thinker);
|
||||
res = T_MovePlane( floor->sector,
|
||||
floor->speed,
|
||||
floor->floordestheight,
|
||||
floor->crush, 0, floor->direction );
|
||||
|
||||
S_StartSound( &floor->sector->soundorg,
|
||||
sfx_pstop);
|
||||
}
|
||||
if( !( ::g->leveltime & 7 ) )
|
||||
S_StartSound( &floor->sector->soundorg,
|
||||
sfx_stnmov );
|
||||
|
||||
if( res == pastdest )
|
||||
{
|
||||
floor->sector->specialdata = NULL;
|
||||
|
||||
if( floor->direction == 1 )
|
||||
{
|
||||
switch( floor->type )
|
||||
{
|
||||
case donutRaise:
|
||||
floor->sector->special = floor->newspecial;
|
||||
floor->sector->floorpic = floor->texture;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( floor->direction == -1 )
|
||||
{
|
||||
switch( floor->type )
|
||||
{
|
||||
case lowerAndChange:
|
||||
floor->sector->special = floor->newspecial;
|
||||
floor->sector->floorpic = floor->texture;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
P_RemoveThinker( &floor->thinker );
|
||||
|
||||
S_StartSound( &floor->sector->soundorg,
|
||||
sfx_pstop );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -266,186 +270,192 @@ EV_DoFloor
|
|||
( line_t* line,
|
||||
floor_e floortype )
|
||||
{
|
||||
int secnum;
|
||||
int rtn;
|
||||
int i;
|
||||
sector_t* sec;
|
||||
floormove_t* floor;
|
||||
int secnum;
|
||||
int rtn;
|
||||
int i;
|
||||
sector_t* sec;
|
||||
floormove_t* floor;
|
||||
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
||||
{
|
||||
sec = &::g->sectors[secnum];
|
||||
|
||||
// ALREADY MOVING? IF SO, KEEP GOING...
|
||||
if (sec->specialdata)
|
||||
continue;
|
||||
|
||||
// new floor thinker
|
||||
rtn = 1;
|
||||
floor = (floormove_t*)DoomLib::Z_Malloc(sizeof(*floor), PU_LEVEL, 0);
|
||||
P_AddThinker (&floor->thinker);
|
||||
sec->specialdata = floor;
|
||||
floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
|
||||
floor->type = floortype;
|
||||
floor->crush = false;
|
||||
|
||||
switch(floortype)
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||
{
|
||||
case lowerFloor:
|
||||
floor->direction = -1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindHighestFloorSurrounding(sec);
|
||||
break;
|
||||
sec = &::g->sectors[secnum];
|
||||
|
||||
case lowerFloorToLowest:
|
||||
floor->direction = -1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindLowestFloorSurrounding(sec);
|
||||
break;
|
||||
|
||||
case turboLower:
|
||||
floor->direction = -1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED * 4;
|
||||
floor->floordestheight =
|
||||
P_FindHighestFloorSurrounding(sec);
|
||||
if (floor->floordestheight != sec->floorheight)
|
||||
floor->floordestheight += 8*FRACUNIT;
|
||||
break;
|
||||
|
||||
case raiseFloorCrush:
|
||||
floor->crush = true;
|
||||
case raiseFloor:
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindLowestCeilingSurrounding(sec);
|
||||
if (floor->floordestheight > sec->ceilingheight)
|
||||
floor->floordestheight = sec->ceilingheight;
|
||||
floor->floordestheight -= (8*FRACUNIT)*
|
||||
(floortype == raiseFloorCrush);
|
||||
break;
|
||||
|
||||
case raiseFloorTurbo:
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED*4;
|
||||
floor->floordestheight =
|
||||
P_FindNextHighestFloor(sec,sec->floorheight);
|
||||
break;
|
||||
|
||||
case raiseFloorToNearest:
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindNextHighestFloor(sec,sec->floorheight);
|
||||
break;
|
||||
|
||||
case raiseFloor24:
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight = floor->sector->floorheight +
|
||||
24 * FRACUNIT;
|
||||
break;
|
||||
case raiseFloor512:
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight = floor->sector->floorheight +
|
||||
512 * FRACUNIT;
|
||||
break;
|
||||
|
||||
case raiseFloor24AndChange:
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight = floor->sector->floorheight +
|
||||
24 * FRACUNIT;
|
||||
sec->floorpic = line->frontsector->floorpic;
|
||||
sec->special = line->frontsector->special;
|
||||
break;
|
||||
|
||||
case raiseToTexture:
|
||||
{
|
||||
int minsize = MAXINT;
|
||||
side_t* side;
|
||||
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
for (i = 0; i < sec->linecount; i++)
|
||||
{
|
||||
if (twoSided (secnum, i) )
|
||||
{
|
||||
side = getSide(secnum,i,0);
|
||||
if (side->bottomtexture >= 0)
|
||||
if (::g->s_textureheight[side->bottomtexture] <
|
||||
minsize)
|
||||
minsize =
|
||||
::g->s_textureheight[side->bottomtexture];
|
||||
side = getSide(secnum,i,1);
|
||||
if (side->bottomtexture >= 0)
|
||||
if (::g->s_textureheight[side->bottomtexture] <
|
||||
minsize)
|
||||
minsize =
|
||||
::g->s_textureheight[side->bottomtexture];
|
||||
}
|
||||
}
|
||||
floor->floordestheight =
|
||||
floor->sector->floorheight + minsize;
|
||||
}
|
||||
break;
|
||||
|
||||
case lowerAndChange:
|
||||
floor->direction = -1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindLowestFloorSurrounding(sec);
|
||||
floor->texture = sec->floorpic;
|
||||
|
||||
for (i = 0; i < sec->linecount; i++)
|
||||
{
|
||||
if ( twoSided(secnum, i) )
|
||||
// ALREADY MOVING? IF SO, KEEP GOING...
|
||||
if( sec->specialdata )
|
||||
{
|
||||
if (getSide(secnum,i,0)->sector-::g->sectors == secnum)
|
||||
{
|
||||
sec = getSector(secnum,i,1);
|
||||
|
||||
if (sec->floorheight == floor->floordestheight)
|
||||
{
|
||||
floor->texture = sec->floorpic;
|
||||
floor->newspecial = sec->special;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sec = getSector(secnum,i,0);
|
||||
|
||||
if (sec->floorheight == floor->floordestheight)
|
||||
{
|
||||
floor->texture = sec->floorpic;
|
||||
floor->newspecial = sec->special;
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// new floor thinker
|
||||
rtn = 1;
|
||||
floor = ( floormove_t* )DoomLib::Z_Malloc( sizeof( *floor ), PU_LEVEL, 0 );
|
||||
P_AddThinker( &floor->thinker );
|
||||
sec->specialdata = floor;
|
||||
floor->thinker.function.acp1 = ( actionf_p1 ) T_MoveFloor;
|
||||
floor->type = floortype;
|
||||
floor->crush = false;
|
||||
|
||||
switch( floortype )
|
||||
{
|
||||
case lowerFloor:
|
||||
floor->direction = -1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindHighestFloorSurrounding( sec );
|
||||
break;
|
||||
|
||||
case lowerFloorToLowest:
|
||||
floor->direction = -1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindLowestFloorSurrounding( sec );
|
||||
break;
|
||||
|
||||
case turboLower:
|
||||
floor->direction = -1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED * 4;
|
||||
floor->floordestheight =
|
||||
P_FindHighestFloorSurrounding( sec );
|
||||
if( floor->floordestheight != sec->floorheight )
|
||||
{
|
||||
floor->floordestheight += 8 * FRACUNIT;
|
||||
}
|
||||
break;
|
||||
|
||||
case raiseFloorCrush:
|
||||
floor->crush = true;
|
||||
case raiseFloor:
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindLowestCeilingSurrounding( sec );
|
||||
if( floor->floordestheight > sec->ceilingheight )
|
||||
{
|
||||
floor->floordestheight = sec->ceilingheight;
|
||||
}
|
||||
floor->floordestheight -= ( 8 * FRACUNIT ) *
|
||||
( floortype == raiseFloorCrush );
|
||||
break;
|
||||
|
||||
case raiseFloorTurbo:
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED * 4;
|
||||
floor->floordestheight =
|
||||
P_FindNextHighestFloor( sec, sec->floorheight );
|
||||
break;
|
||||
|
||||
case raiseFloorToNearest:
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindNextHighestFloor( sec, sec->floorheight );
|
||||
break;
|
||||
|
||||
case raiseFloor24:
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight = floor->sector->floorheight +
|
||||
24 * FRACUNIT;
|
||||
break;
|
||||
case raiseFloor512:
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight = floor->sector->floorheight +
|
||||
512 * FRACUNIT;
|
||||
break;
|
||||
|
||||
case raiseFloor24AndChange:
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight = floor->sector->floorheight +
|
||||
24 * FRACUNIT;
|
||||
sec->floorpic = line->frontsector->floorpic;
|
||||
sec->special = line->frontsector->special;
|
||||
break;
|
||||
|
||||
case raiseToTexture:
|
||||
{
|
||||
int minsize = MAXINT;
|
||||
side_t* side;
|
||||
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
for( i = 0; i < sec->linecount; i++ )
|
||||
{
|
||||
if( twoSided( secnum, i ) )
|
||||
{
|
||||
side = getSide( secnum, i, 0 );
|
||||
if( side->bottomtexture >= 0 )
|
||||
if( ::g->s_textureheight[side->bottomtexture] <
|
||||
minsize )
|
||||
minsize =
|
||||
::g->s_textureheight[side->bottomtexture];
|
||||
side = getSide( secnum, i, 1 );
|
||||
if( side->bottomtexture >= 0 )
|
||||
if( ::g->s_textureheight[side->bottomtexture] <
|
||||
minsize )
|
||||
minsize =
|
||||
::g->s_textureheight[side->bottomtexture];
|
||||
}
|
||||
}
|
||||
floor->floordestheight =
|
||||
floor->sector->floorheight + minsize;
|
||||
}
|
||||
break;
|
||||
|
||||
case lowerAndChange:
|
||||
floor->direction = -1;
|
||||
floor->sector = sec;
|
||||
floor->speed = FLOORSPEED;
|
||||
floor->floordestheight =
|
||||
P_FindLowestFloorSurrounding( sec );
|
||||
floor->texture = sec->floorpic;
|
||||
|
||||
for( i = 0; i < sec->linecount; i++ )
|
||||
{
|
||||
if( twoSided( secnum, i ) )
|
||||
{
|
||||
if( getSide( secnum, i, 0 )->sector -::g->sectors == secnum )
|
||||
{
|
||||
sec = getSector( secnum, i, 1 );
|
||||
|
||||
if( sec->floorheight == floor->floordestheight )
|
||||
{
|
||||
floor->texture = sec->floorpic;
|
||||
floor->newspecial = sec->special;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sec = getSector( secnum, i, 0 );
|
||||
|
||||
if( sec->floorheight == floor->floordestheight )
|
||||
{
|
||||
floor->texture = sec->floorpic;
|
||||
floor->newspecial = sec->special;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rtn;
|
||||
return rtn;
|
||||
}
|
||||
|
||||
|
||||
|
@ -459,103 +469,114 @@ EV_BuildStairs
|
|||
( line_t* line,
|
||||
stair_e type )
|
||||
{
|
||||
int secnum;
|
||||
int height;
|
||||
int i;
|
||||
int newsecnum;
|
||||
int texture;
|
||||
int ok;
|
||||
int rtn;
|
||||
|
||||
sector_t* sec;
|
||||
sector_t* tsec;
|
||||
int secnum;
|
||||
int height;
|
||||
int i;
|
||||
int newsecnum;
|
||||
int texture;
|
||||
int ok;
|
||||
int rtn;
|
||||
|
||||
floormove_t* floor;
|
||||
|
||||
fixed_t stairsize = 0;
|
||||
fixed_t speed = 0;
|
||||
sector_t* sec;
|
||||
sector_t* tsec;
|
||||
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
||||
{
|
||||
sec = &::g->sectors[secnum];
|
||||
|
||||
// ALREADY MOVING? IF SO, KEEP GOING...
|
||||
if (sec->specialdata)
|
||||
continue;
|
||||
|
||||
// new floor thinker
|
||||
rtn = 1;
|
||||
floor = (floormove_t*)DoomLib::Z_Malloc(sizeof(*floor), PU_LEVEL, 0);
|
||||
P_AddThinker (&floor->thinker);
|
||||
sec->specialdata = floor;
|
||||
floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
switch(type)
|
||||
floormove_t* floor;
|
||||
|
||||
fixed_t stairsize = 0;
|
||||
fixed_t speed = 0;
|
||||
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||
{
|
||||
case build8:
|
||||
speed = FLOORSPEED/4;
|
||||
stairsize = 8*FRACUNIT;
|
||||
break;
|
||||
case turbo16:
|
||||
speed = FLOORSPEED*4;
|
||||
stairsize = 16*FRACUNIT;
|
||||
break;
|
||||
}
|
||||
floor->speed = speed;
|
||||
height = sec->floorheight + stairsize;
|
||||
floor->floordestheight = height;
|
||||
|
||||
texture = sec->floorpic;
|
||||
|
||||
// Find next sector to raise
|
||||
// 1. Find 2-sided line with same sector side[0]
|
||||
// 2. Other side is the next sector to raise
|
||||
do
|
||||
{
|
||||
ok = 0;
|
||||
for (i = 0;i < sec->linecount;i++)
|
||||
{
|
||||
if ( !((sec->lines[i])->flags & ML_TWOSIDED) )
|
||||
continue;
|
||||
|
||||
tsec = (sec->lines[i])->frontsector;
|
||||
newsecnum = tsec-::g->sectors;
|
||||
|
||||
if (secnum != newsecnum)
|
||||
continue;
|
||||
sec = &::g->sectors[secnum];
|
||||
|
||||
tsec = (sec->lines[i])->backsector;
|
||||
newsecnum = tsec - ::g->sectors;
|
||||
|
||||
if (tsec->floorpic != texture)
|
||||
continue;
|
||||
|
||||
height += stairsize;
|
||||
|
||||
if (tsec->specialdata)
|
||||
continue;
|
||||
|
||||
sec = tsec;
|
||||
secnum = newsecnum;
|
||||
floor = (floormove_t*)DoomLib::Z_Malloc(sizeof(*floor), PU_LEVEL, 0);
|
||||
|
||||
P_AddThinker (&floor->thinker);
|
||||
// ALREADY MOVING? IF SO, KEEP GOING...
|
||||
if( sec->specialdata )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// new floor thinker
|
||||
rtn = 1;
|
||||
floor = ( floormove_t* )DoomLib::Z_Malloc( sizeof( *floor ), PU_LEVEL, 0 );
|
||||
P_AddThinker( &floor->thinker );
|
||||
sec->specialdata = floor;
|
||||
floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor;
|
||||
floor->thinker.function.acp1 = ( actionf_p1 ) T_MoveFloor;
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
switch( type )
|
||||
{
|
||||
case build8:
|
||||
speed = FLOORSPEED / 4;
|
||||
stairsize = 8 * FRACUNIT;
|
||||
break;
|
||||
case turbo16:
|
||||
speed = FLOORSPEED * 4;
|
||||
stairsize = 16 * FRACUNIT;
|
||||
break;
|
||||
}
|
||||
floor->speed = speed;
|
||||
height = sec->floorheight + stairsize;
|
||||
floor->floordestheight = height;
|
||||
ok = 1;
|
||||
break;
|
||||
}
|
||||
} while(ok);
|
||||
}
|
||||
return rtn;
|
||||
|
||||
texture = sec->floorpic;
|
||||
|
||||
// Find next sector to raise
|
||||
// 1. Find 2-sided line with same sector side[0]
|
||||
// 2. Other side is the next sector to raise
|
||||
do
|
||||
{
|
||||
ok = 0;
|
||||
for( i = 0; i < sec->linecount; i++ )
|
||||
{
|
||||
if( !( ( sec->lines[i] )->flags & ML_TWOSIDED ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
tsec = ( sec->lines[i] )->frontsector;
|
||||
newsecnum = tsec -::g->sectors;
|
||||
|
||||
if( secnum != newsecnum )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
tsec = ( sec->lines[i] )->backsector;
|
||||
newsecnum = tsec - ::g->sectors;
|
||||
|
||||
if( tsec->floorpic != texture )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
height += stairsize;
|
||||
|
||||
if( tsec->specialdata )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sec = tsec;
|
||||
secnum = newsecnum;
|
||||
floor = ( floormove_t* )DoomLib::Z_Malloc( sizeof( *floor ), PU_LEVEL, 0 );
|
||||
|
||||
P_AddThinker( &floor->thinker );
|
||||
|
||||
sec->specialdata = floor;
|
||||
floor->thinker.function.acp1 = ( actionf_p1 ) T_MoveFloor;
|
||||
floor->direction = 1;
|
||||
floor->sector = sec;
|
||||
floor->speed = speed;
|
||||
floor->floordestheight = height;
|
||||
ok = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while( ok );
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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 );
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -47,21 +47,27 @@ 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)
|
||||
return;
|
||||
|
||||
amount = (P_Random()&3)*16;
|
||||
|
||||
if (flick->sector->lightlevel - amount < flick->minlight)
|
||||
flick->sector->lightlevel = flick->minlight;
|
||||
else
|
||||
flick->sector->lightlevel = flick->maxlight - amount;
|
||||
int amount;
|
||||
|
||||
flick->count = 4;
|
||||
if( --flick->count )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
amount = ( P_Random() & 3 ) * 16;
|
||||
|
||||
if( flick->sector->lightlevel - amount < flick->minlight )
|
||||
{
|
||||
flick->sector->lightlevel = flick->minlight;
|
||||
}
|
||||
else
|
||||
{
|
||||
flick->sector->lightlevel = flick->maxlight - amount;
|
||||
}
|
||||
|
||||
flick->count = 4;
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,23 +75,23 @@ void T_FireFlicker (fireflicker_t* flick)
|
|||
//
|
||||
// P_SpawnFireFlicker
|
||||
//
|
||||
void P_SpawnFireFlicker (sector_t* sector)
|
||||
void P_SpawnFireFlicker( sector_t* sector )
|
||||
{
|
||||
fireflicker_t* flick;
|
||||
|
||||
// Note that we are resetting sector attributes.
|
||||
// Nothing special about it during gameplay.
|
||||
sector->special = 0;
|
||||
|
||||
flick = (fireflicker_t*)DoomLib::Z_Malloc( sizeof(*flick), PU_LEVEL, 0);
|
||||
fireflicker_t* flick;
|
||||
|
||||
P_AddThinker (&flick->thinker);
|
||||
// Note that we are resetting sector attributes.
|
||||
// Nothing special about it during gameplay.
|
||||
sector->special = 0;
|
||||
|
||||
flick->thinker.function.acp1 = (actionf_p1) T_FireFlicker;
|
||||
flick->sector = sector;
|
||||
flick->maxlight = sector->lightlevel;
|
||||
flick->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel)+16;
|
||||
flick->count = 4;
|
||||
flick = ( fireflicker_t* )DoomLib::Z_Malloc( sizeof( *flick ), PU_LEVEL, 0 );
|
||||
|
||||
P_AddThinker( &flick->thinker );
|
||||
|
||||
flick->thinker.function.acp1 = ( actionf_p1 ) T_FireFlicker;
|
||||
flick->sector = sector;
|
||||
flick->maxlight = sector->lightlevel;
|
||||
flick->minlight = P_FindMinSurroundingLight( sector, sector->lightlevel ) + 16;
|
||||
flick->count = 4;
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,21 +105,23 @@ 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)
|
||||
return;
|
||||
|
||||
if (flash->sector->lightlevel == flash->maxlight)
|
||||
{
|
||||
flash-> sector->lightlevel = flash->minlight;
|
||||
flash->count = (P_Random()&flash->mintime)+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
flash-> sector->lightlevel = flash->maxlight;
|
||||
flash->count = (P_Random()&flash->maxtime)+1;
|
||||
}
|
||||
if( --flash->count )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( flash->sector->lightlevel == flash->maxlight )
|
||||
{
|
||||
flash-> sector->lightlevel = flash->minlight;
|
||||
flash->count = ( P_Random()&flash->mintime ) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
flash-> sector->lightlevel = flash->maxlight;
|
||||
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;
|
||||
lightflash_t* flash;
|
||||
|
||||
// nothing special about it during gameplay
|
||||
sector->special = 0;
|
||||
|
||||
flash = (lightflash_t*)DoomLib::Z_Malloc( sizeof(*flash), PU_LEVEL, 0);
|
||||
// nothing special about it during gameplay
|
||||
sector->special = 0;
|
||||
|
||||
P_AddThinker (&flash->thinker);
|
||||
flash = ( lightflash_t* )DoomLib::Z_Malloc( sizeof( *flash ), PU_LEVEL, 0 );
|
||||
|
||||
flash->thinker.function.acp1 = (actionf_p1) T_LightFlash;
|
||||
flash->sector = sector;
|
||||
flash->maxlight = sector->lightlevel;
|
||||
P_AddThinker( &flash->thinker );
|
||||
|
||||
flash->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel);
|
||||
flash->maxtime = 64;
|
||||
flash->mintime = 7;
|
||||
flash->count = (P_Random()&flash->maxtime)+1;
|
||||
flash->thinker.function.acp1 = ( actionf_p1 ) T_LightFlash;
|
||||
flash->sector = sector;
|
||||
flash->maxlight = sector->lightlevel;
|
||||
|
||||
flash->minlight = P_FindMinSurroundingLight( sector, sector->lightlevel );
|
||||
flash->maxtime = 64;
|
||||
flash->mintime = 7;
|
||||
flash->count = ( P_Random()&flash->maxtime ) + 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -156,21 +164,23 @@ void P_SpawnLightFlash (sector_t* sector)
|
|||
//
|
||||
// T_StrobeFlash
|
||||
//
|
||||
void T_StrobeFlash (strobe_t* flash)
|
||||
void T_StrobeFlash( strobe_t* flash )
|
||||
{
|
||||
if (--flash->count)
|
||||
return;
|
||||
|
||||
if (flash->sector->lightlevel == flash->minlight)
|
||||
{
|
||||
flash-> sector->lightlevel = flash->maxlight;
|
||||
flash->count = flash->brighttime;
|
||||
}
|
||||
else
|
||||
{
|
||||
flash-> sector->lightlevel = flash->minlight;
|
||||
flash->count =flash->darktime;
|
||||
}
|
||||
if( --flash->count )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( flash->sector->lightlevel == flash->minlight )
|
||||
{
|
||||
flash-> sector->lightlevel = flash->maxlight;
|
||||
flash->count = flash->brighttime;
|
||||
}
|
||||
else
|
||||
{
|
||||
flash-> sector->lightlevel = flash->minlight;
|
||||
flash->count = flash->darktime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -187,49 +197,57 @@ P_SpawnStrobeFlash
|
|||
int fastOrSlow,
|
||||
int inSync )
|
||||
{
|
||||
strobe_t* flash;
|
||||
|
||||
flash = (strobe_t*)DoomLib::Z_Malloc( sizeof(*flash), PU_LEVEL, 0);
|
||||
strobe_t* flash;
|
||||
|
||||
P_AddThinker (&flash->thinker);
|
||||
flash = ( strobe_t* )DoomLib::Z_Malloc( sizeof( *flash ), PU_LEVEL, 0 );
|
||||
|
||||
flash->sector = sector;
|
||||
flash->darktime = fastOrSlow;
|
||||
flash->brighttime = STROBEBRIGHT;
|
||||
flash->thinker.function.acp1 = (actionf_p1) T_StrobeFlash;
|
||||
flash->maxlight = sector->lightlevel;
|
||||
flash->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel);
|
||||
|
||||
if (flash->minlight == flash->maxlight)
|
||||
flash->minlight = 0;
|
||||
P_AddThinker( &flash->thinker );
|
||||
|
||||
// nothing special about it during gameplay
|
||||
sector->special = 0;
|
||||
flash->sector = sector;
|
||||
flash->darktime = fastOrSlow;
|
||||
flash->brighttime = STROBEBRIGHT;
|
||||
flash->thinker.function.acp1 = ( actionf_p1 ) T_StrobeFlash;
|
||||
flash->maxlight = sector->lightlevel;
|
||||
flash->minlight = P_FindMinSurroundingLight( sector, sector->lightlevel );
|
||||
|
||||
if (!inSync)
|
||||
flash->count = (P_Random()&7)+1;
|
||||
else
|
||||
flash->count = 1;
|
||||
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;
|
||||
}
|
||||
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)
|
||||
{
|
||||
sec = &::g->sectors[secnum];
|
||||
if (sec->specialdata)
|
||||
continue;
|
||||
|
||||
P_SpawnStrobeFlash (sec,SLOWDARK, 0);
|
||||
}
|
||||
int secnum;
|
||||
sector_t* sec;
|
||||
|
||||
secnum = -1;
|
||||
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||
{
|
||||
sec = &::g->sectors[secnum];
|
||||
if( sec->specialdata )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
P_SpawnStrobeFlash( sec, SLOWDARK, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -237,34 +255,38 @@ 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;
|
||||
int min;
|
||||
sector_t* sector;
|
||||
sector_t* tsec;
|
||||
line_t* templine;
|
||||
|
||||
sector = ::g->sectors;
|
||||
|
||||
for (j = 0;j < ::g->numsectors; j++, sector++)
|
||||
{
|
||||
if (sector->tag == line->tag)
|
||||
int i;
|
||||
int j;
|
||||
int min;
|
||||
sector_t* sector;
|
||||
sector_t* tsec;
|
||||
line_t* templine;
|
||||
|
||||
sector = ::g->sectors;
|
||||
|
||||
for( j = 0; j < ::g->numsectors; j++, sector++ )
|
||||
{
|
||||
min = sector->lightlevel;
|
||||
for (i = 0;i < sector->linecount; i++)
|
||||
{
|
||||
templine = sector->lines[i];
|
||||
tsec = getNextSector(templine,sector);
|
||||
if (!tsec)
|
||||
continue;
|
||||
if (tsec->lightlevel < min)
|
||||
min = tsec->lightlevel;
|
||||
}
|
||||
sector->lightlevel = min;
|
||||
if( sector->tag == line->tag )
|
||||
{
|
||||
min = sector->lightlevel;
|
||||
for( i = 0; i < sector->linecount; i++ )
|
||||
{
|
||||
templine = sector->lines[i];
|
||||
tsec = getNextSector( templine, sector );
|
||||
if( !tsec )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if( tsec->lightlevel < min )
|
||||
{
|
||||
min = tsec->lightlevel;
|
||||
}
|
||||
}
|
||||
sector->lightlevel = min;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -276,87 +298,91 @@ EV_LightTurnOn
|
|||
( line_t* line,
|
||||
int bright )
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
sector_t* sector;
|
||||
sector_t* temp;
|
||||
line_t* templine;
|
||||
|
||||
sector = ::g->sectors;
|
||||
|
||||
for (i = 0; i < ::g->numsectors; i++, sector++)
|
||||
{
|
||||
if (sector->tag == line->tag)
|
||||
int i;
|
||||
int j;
|
||||
sector_t* sector;
|
||||
sector_t* temp;
|
||||
line_t* templine;
|
||||
|
||||
sector = ::g->sectors;
|
||||
|
||||
for( i = 0; i < ::g->numsectors; i++, sector++ )
|
||||
{
|
||||
// bright = 0 means to search
|
||||
// for highest light level
|
||||
// surrounding sector
|
||||
if (!bright)
|
||||
{
|
||||
for (j = 0;j < sector->linecount; j++)
|
||||
if( sector->tag == line->tag )
|
||||
{
|
||||
templine = sector->lines[j];
|
||||
temp = getNextSector(templine,sector);
|
||||
// bright = 0 means to search
|
||||
// for highest light level
|
||||
// surrounding sector
|
||||
if( !bright )
|
||||
{
|
||||
for( j = 0; j < sector->linecount; j++ )
|
||||
{
|
||||
templine = sector->lines[j];
|
||||
temp = getNextSector( templine, sector );
|
||||
|
||||
if (!temp)
|
||||
continue;
|
||||
if( !temp )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (temp->lightlevel > bright)
|
||||
bright = temp->lightlevel;
|
||||
if( temp->lightlevel > bright )
|
||||
{
|
||||
bright = temp->lightlevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
sector-> lightlevel = bright;
|
||||
}
|
||||
}
|
||||
sector-> lightlevel = bright;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Spawn glowing light
|
||||
//
|
||||
|
||||
void T_Glow(glow_t* g)
|
||||
void T_Glow( glow_t* g )
|
||||
{
|
||||
switch(g->direction)
|
||||
{
|
||||
case -1:
|
||||
// DOWN
|
||||
g->sector->lightlevel -= GLOWSPEED;
|
||||
if (g->sector->lightlevel <= g->minlight)
|
||||
switch( g->direction )
|
||||
{
|
||||
g->sector->lightlevel += GLOWSPEED;
|
||||
g->direction = 1;
|
||||
case -1:
|
||||
// DOWN
|
||||
g->sector->lightlevel -= GLOWSPEED;
|
||||
if( g->sector->lightlevel <= g->minlight )
|
||||
{
|
||||
g->sector->lightlevel += GLOWSPEED;
|
||||
g->direction = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// UP
|
||||
g->sector->lightlevel += GLOWSPEED;
|
||||
if( g->sector->lightlevel >= g->maxlight )
|
||||
{
|
||||
g->sector->lightlevel -= GLOWSPEED;
|
||||
g->direction = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// UP
|
||||
g->sector->lightlevel += GLOWSPEED;
|
||||
if (g->sector->lightlevel >= g->maxlight)
|
||||
{
|
||||
g->sector->lightlevel -= GLOWSPEED;
|
||||
g->direction = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
glow_t* g;
|
||||
|
||||
P_AddThinker(&g->thinker);
|
||||
g = ( glow_t* )DoomLib::Z_Malloc( sizeof( *g ), PU_LEVEL, 0 );
|
||||
|
||||
g->sector = sector;
|
||||
g->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel);
|
||||
g->maxlight = sector->lightlevel;
|
||||
g->thinker.function.acp1 = (actionf_p1) T_Glow;
|
||||
g->direction = -1;
|
||||
P_AddThinker( &g->thinker );
|
||||
|
||||
sector->special = 0;
|
||||
g->sector = sector;
|
||||
g->minlight = P_FindMinSurroundingLight( sector, sector->lightlevel );
|
||||
g->maxlight = sector->lightlevel;
|
||||
g->thinker.function.acp1 = ( actionf_p1 ) T_Glow;
|
||||
g->direction = -1;
|
||||
|
||||
sector->special = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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)
|
||||
|
@ -73,26 +73,26 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//
|
||||
|
||||
// both the head and tail of the thinker list
|
||||
extern thinker_t thinkercap;
|
||||
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 );
|
||||
|
||||
|
||||
//
|
||||
|
@ -140,21 +140,22 @@ void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
|
|||
//
|
||||
typedef struct
|
||||
{
|
||||
fixed_t x;
|
||||
fixed_t y;
|
||||
fixed_t dx;
|
||||
fixed_t dy;
|
||||
|
||||
fixed_t x;
|
||||
fixed_t y;
|
||||
fixed_t dx;
|
||||
fixed_t dy;
|
||||
|
||||
} divline_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t frac; // along trace line
|
||||
qboolean isaline;
|
||||
union {
|
||||
mobj_t* thing;
|
||||
line_t* line;
|
||||
} d;
|
||||
fixed_t frac; // along trace line
|
||||
qboolean isaline;
|
||||
union
|
||||
{
|
||||
mobj_t* thing;
|
||||
line_t* line;
|
||||
} d;
|
||||
} intercept_t;
|
||||
|
||||
#define MAXINTERCEPTS 128
|
||||
|
@ -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
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -48,7 +48,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -102,7 +102,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
// things, but nothing can run into a missile).
|
||||
// Each block in the grid is 128*128 units, and knows about
|
||||
// every line_t that it contains a piece of, and every
|
||||
// interactable mobj_t that has its origin contained.
|
||||
// interactable mobj_t that has its origin contained.
|
||||
//
|
||||
// A valid mobj_t is a mobj_t that has the proper subsector_t
|
||||
// filled in for its xy coordinates and is linked into the
|
||||
|
@ -122,89 +122,89 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
// Call P_SpecialThing when touched.
|
||||
MF_SPECIAL = 1,
|
||||
// Blocks.
|
||||
MF_SOLID = 2,
|
||||
// Can be hit.
|
||||
MF_SHOOTABLE = 4,
|
||||
// Don't use the sector links (invisible but touchable).
|
||||
MF_NOSECTOR = 8,
|
||||
// Don't use the blocklinks (inert but displayable)
|
||||
MF_NOBLOCKMAP = 16,
|
||||
// Call P_SpecialThing when touched.
|
||||
MF_SPECIAL = 1,
|
||||
// Blocks.
|
||||
MF_SOLID = 2,
|
||||
// Can be hit.
|
||||
MF_SHOOTABLE = 4,
|
||||
// Don't use the sector links (invisible but touchable).
|
||||
MF_NOSECTOR = 8,
|
||||
// Don't use the blocklinks (inert but displayable)
|
||||
MF_NOBLOCKMAP = 16,
|
||||
|
||||
// Not to be activated by sound, deaf monster.
|
||||
MF_AMBUSH = 32,
|
||||
// Will try to attack right back.
|
||||
MF_JUSTHIT = 64,
|
||||
// Will take at least one step before attacking.
|
||||
MF_JUSTATTACKED = 128,
|
||||
// On level spawning (initial position),
|
||||
// hang from ceiling instead of stand on floor.
|
||||
MF_SPAWNCEILING = 256,
|
||||
// Don't apply gravity (every tic),
|
||||
// that is, object will float, keeping current height
|
||||
// or changing it actively.
|
||||
MF_NOGRAVITY = 512,
|
||||
// Not to be activated by sound, deaf monster.
|
||||
MF_AMBUSH = 32,
|
||||
// Will try to attack right back.
|
||||
MF_JUSTHIT = 64,
|
||||
// Will take at least one step before attacking.
|
||||
MF_JUSTATTACKED = 128,
|
||||
// On level spawning (initial position),
|
||||
// hang from ceiling instead of stand on floor.
|
||||
MF_SPAWNCEILING = 256,
|
||||
// Don't apply gravity (every tic),
|
||||
// that is, object will float, keeping current height
|
||||
// or changing it actively.
|
||||
MF_NOGRAVITY = 512,
|
||||
|
||||
// Movement flags.
|
||||
// This allows jumps from high places.
|
||||
MF_DROPOFF = 0x400,
|
||||
// For players, will pick up items.
|
||||
MF_PICKUP = 0x800,
|
||||
// Player cheat. ???
|
||||
MF_NOCLIP = 0x1000,
|
||||
// Player: keep info about sliding along walls.
|
||||
MF_SLIDE = 0x2000,
|
||||
// Allow moves to any height, no gravity.
|
||||
// For active floaters, e.g. cacodemons, pain elementals.
|
||||
MF_FLOAT = 0x4000,
|
||||
// Don't cross lines
|
||||
// ??? or look at heights on teleport.
|
||||
MF_TELEPORT = 0x8000,
|
||||
// Don't hit same species, explode on block.
|
||||
// Player missiles as well as fireballs of various kinds.
|
||||
MF_MISSILE = 0x10000,
|
||||
// Dropped by a demon, not level spawned.
|
||||
// E.g. ammo clips dropped by dying former humans.
|
||||
MF_DROPPED = 0x20000,
|
||||
// Use fuzzy draw (shadow demons or spectres),
|
||||
// temporary player invisibility powerup.
|
||||
MF_SHADOW = 0x40000,
|
||||
// Flag: don't bleed when shot (use puff),
|
||||
// barrels and shootable furniture shall not bleed.
|
||||
MF_NOBLOOD = 0x80000,
|
||||
// Don't stop moving halfway off a step,
|
||||
// that is, have dead bodies slide down all the way.
|
||||
MF_CORPSE = 0x100000,
|
||||
// Floating to a height for a move, ???
|
||||
// don't auto float to target's height.
|
||||
MF_INFLOAT = 0x200000,
|
||||
// Movement flags.
|
||||
// This allows jumps from high places.
|
||||
MF_DROPOFF = 0x400,
|
||||
// For players, will pick up items.
|
||||
MF_PICKUP = 0x800,
|
||||
// Player cheat. ???
|
||||
MF_NOCLIP = 0x1000,
|
||||
// Player: keep info about sliding along walls.
|
||||
MF_SLIDE = 0x2000,
|
||||
// Allow moves to any height, no gravity.
|
||||
// For active floaters, e.g. cacodemons, pain elementals.
|
||||
MF_FLOAT = 0x4000,
|
||||
// Don't cross lines
|
||||
// ??? or look at heights on teleport.
|
||||
MF_TELEPORT = 0x8000,
|
||||
// Don't hit same species, explode on block.
|
||||
// Player missiles as well as fireballs of various kinds.
|
||||
MF_MISSILE = 0x10000,
|
||||
// Dropped by a demon, not level spawned.
|
||||
// E.g. ammo clips dropped by dying former humans.
|
||||
MF_DROPPED = 0x20000,
|
||||
// Use fuzzy draw (shadow demons or spectres),
|
||||
// temporary player invisibility powerup.
|
||||
MF_SHADOW = 0x40000,
|
||||
// Flag: don't bleed when shot (use puff),
|
||||
// barrels and shootable furniture shall not bleed.
|
||||
MF_NOBLOOD = 0x80000,
|
||||
// Don't stop moving halfway off a step,
|
||||
// that is, have dead bodies slide down all the way.
|
||||
MF_CORPSE = 0x100000,
|
||||
// Floating to a height for a move, ???
|
||||
// don't auto float to target's height.
|
||||
MF_INFLOAT = 0x200000,
|
||||
|
||||
// On kill, count this enemy object
|
||||
// towards intermission kill total.
|
||||
// Happy gathering.
|
||||
MF_COUNTKILL = 0x400000,
|
||||
|
||||
// On picking up, count this item object
|
||||
// towards intermission item total.
|
||||
MF_COUNTITEM = 0x800000,
|
||||
// On kill, count this enemy object
|
||||
// towards intermission kill total.
|
||||
// Happy gathering.
|
||||
MF_COUNTKILL = 0x400000,
|
||||
|
||||
// Special handling: skull in flight.
|
||||
// Neither a cacodemon nor a missile.
|
||||
MF_SKULLFLY = 0x1000000,
|
||||
// On picking up, count this item object
|
||||
// towards intermission item total.
|
||||
MF_COUNTITEM = 0x800000,
|
||||
|
||||
// Don't spawn this object
|
||||
// in death match mode (e.g. key cards).
|
||||
MF_NOTDMATCH = 0x2000000,
|
||||
// Special handling: skull in flight.
|
||||
// Neither a cacodemon nor a missile.
|
||||
MF_SKULLFLY = 0x1000000,
|
||||
|
||||
// Player sprites in multiplayer modes are modified
|
||||
// using an internal color lookup table for re-indexing.
|
||||
// If 0x4 0x8 or 0xc,
|
||||
// use a translation table for player colormaps
|
||||
MF_TRANSLATION = 0xc000000,
|
||||
// Hmm ???.
|
||||
MF_TRANSSHIFT = 26
|
||||
// Don't spawn this object
|
||||
// in death match mode (e.g. key cards).
|
||||
MF_NOTDMATCH = 0x2000000,
|
||||
|
||||
// Player sprites in multiplayer modes are modified
|
||||
// using an internal color lookup table for re-indexing.
|
||||
// If 0x4 0x8 or 0xc,
|
||||
// use a translation table for player colormaps
|
||||
MF_TRANSLATION = 0xc000000,
|
||||
// Hmm ???.
|
||||
MF_TRANSSHIFT = 26
|
||||
|
||||
} mobjflag_t;
|
||||
|
||||
|
@ -212,83 +212,83 @@ typedef enum
|
|||
// Map Object definition.
|
||||
struct mobj_t
|
||||
{
|
||||
// List: thinker links.
|
||||
thinker_t thinker;
|
||||
// List: thinker links.
|
||||
thinker_t thinker;
|
||||
|
||||
// Info for drawing: position.
|
||||
fixed_t x;
|
||||
fixed_t y;
|
||||
fixed_t z;
|
||||
// Info for drawing: position.
|
||||
fixed_t x;
|
||||
fixed_t y;
|
||||
fixed_t z;
|
||||
|
||||
// More list: links in sector (if needed)
|
||||
mobj_t* snext;
|
||||
mobj_t* sprev;
|
||||
// More list: links in sector (if needed)
|
||||
mobj_t* snext;
|
||||
mobj_t* sprev;
|
||||
|
||||
//More drawing info: to determine current sprite.
|
||||
angle_t angle; // orientation
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
int frame; // might be ORed with FF_FULLBRIGHT
|
||||
//More drawing info: to determine current sprite.
|
||||
angle_t angle; // orientation
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
int frame; // might be ORed with FF_FULLBRIGHT
|
||||
|
||||
// Interaction info, by BLOCKMAP.
|
||||
// Links in blocks (if needed).
|
||||
mobj_t* bnext;
|
||||
mobj_t* bprev;
|
||||
|
||||
struct subsector_s* subsector;
|
||||
// Interaction info, by BLOCKMAP.
|
||||
// Links in blocks (if needed).
|
||||
mobj_t* bnext;
|
||||
mobj_t* bprev;
|
||||
|
||||
// The closest interval over all contacted Sectors.
|
||||
fixed_t floorz;
|
||||
fixed_t ceilingz;
|
||||
struct subsector_s* subsector;
|
||||
|
||||
// For movement checking.
|
||||
fixed_t radius;
|
||||
fixed_t height;
|
||||
// The closest interval over all contacted Sectors.
|
||||
fixed_t floorz;
|
||||
fixed_t ceilingz;
|
||||
|
||||
// Momentums, used to update position.
|
||||
fixed_t momx;
|
||||
fixed_t momy;
|
||||
fixed_t momz;
|
||||
// For movement checking.
|
||||
fixed_t radius;
|
||||
fixed_t height;
|
||||
|
||||
// If == validcount, already checked.
|
||||
int validcount;
|
||||
// Momentums, used to update position.
|
||||
fixed_t momx;
|
||||
fixed_t momy;
|
||||
fixed_t momz;
|
||||
|
||||
mobjtype_t type;
|
||||
const mobjinfo_t* info; // &mobjinfo[mobj->type]
|
||||
|
||||
int tics; // state tic counter
|
||||
const state_t* state;
|
||||
int flags;
|
||||
int health;
|
||||
// If == validcount, already checked.
|
||||
int validcount;
|
||||
|
||||
// Movement direction, movement generation (zig-zagging).
|
||||
int movedir; // 0-7
|
||||
int movecount; // when 0, select a new dir
|
||||
mobjtype_t type;
|
||||
const mobjinfo_t* info; // &mobjinfo[mobj->type]
|
||||
|
||||
// Thing being chased/attacked (or NULL),
|
||||
// also the originator for missiles.
|
||||
mobj_t* target;
|
||||
int tics; // state tic counter
|
||||
const state_t* state;
|
||||
int flags;
|
||||
int health;
|
||||
|
||||
// Reaction time: if non 0, don't attack yet.
|
||||
// Used by player to freeze a bit after teleporting.
|
||||
int reactiontime;
|
||||
// Movement direction, movement generation (zig-zagging).
|
||||
int movedir; // 0-7
|
||||
int movecount; // when 0, select a new dir
|
||||
|
||||
// If >0, the target will be chased
|
||||
// no matter what (even if shot)
|
||||
int threshold;
|
||||
// Thing being chased/attacked (or NULL),
|
||||
// also the originator for missiles.
|
||||
mobj_t* target;
|
||||
|
||||
// Additional info record for player avatars only.
|
||||
// Only valid if type == MT_PLAYER
|
||||
struct player_s* player;
|
||||
// Reaction time: if non 0, don't attack yet.
|
||||
// Used by player to freeze a bit after teleporting.
|
||||
int reactiontime;
|
||||
|
||||
// Player number last looked for.
|
||||
int lastlook;
|
||||
// If >0, the target will be chased
|
||||
// no matter what (even if shot)
|
||||
int threshold;
|
||||
|
||||
// For nightmare respawn.
|
||||
mapthing_t spawnpoint;
|
||||
// Additional info record for player avatars only.
|
||||
// Only valid if type == MT_PLAYER
|
||||
struct player_s* player;
|
||||
|
||||
// Player number last looked for.
|
||||
int lastlook;
|
||||
|
||||
// For nightmare respawn.
|
||||
mapthing_t spawnpoint;
|
||||
|
||||
// Thing being chased/attacked for tracers.
|
||||
mobj_t* tracer;
|
||||
|
||||
// Thing being chased/attacked for tracers.
|
||||
mobj_t* tracer;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -53,85 +53,89 @@ 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)
|
||||
{
|
||||
case up:
|
||||
res = T_MovePlane(plat->sector,
|
||||
plat->speed,
|
||||
plat->high,
|
||||
plat->crush,0,1);
|
||||
|
||||
if (plat->type == raiseAndChange
|
||||
|| plat->type == raiseToNearestAndChange)
|
||||
{
|
||||
if (!(::g->leveltime&7))
|
||||
S_StartSound( &plat->sector->soundorg,
|
||||
sfx_stnmov);
|
||||
}
|
||||
|
||||
|
||||
if (res == crushed && (!plat->crush))
|
||||
{
|
||||
plat->count = plat->wait;
|
||||
plat->status = down;
|
||||
S_StartSound( &plat->sector->soundorg,
|
||||
sfx_pstart);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (res == pastdest)
|
||||
{
|
||||
plat->count = plat->wait;
|
||||
plat->status = waiting;
|
||||
S_StartSound( &plat->sector->soundorg,
|
||||
sfx_pstop);
|
||||
result_e res;
|
||||
|
||||
switch(plat->type)
|
||||
{
|
||||
case blazeDWUS:
|
||||
case downWaitUpStay:
|
||||
P_RemoveActivePlat(plat);
|
||||
break;
|
||||
|
||||
case raiseAndChange:
|
||||
case raiseToNearestAndChange:
|
||||
P_RemoveActivePlat(plat);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case down:
|
||||
res = T_MovePlane(plat->sector,plat->speed,plat->low,false,0,-1);
|
||||
switch( plat->status )
|
||||
{
|
||||
case up:
|
||||
res = T_MovePlane( plat->sector,
|
||||
plat->speed,
|
||||
plat->high,
|
||||
plat->crush, 0, 1 );
|
||||
|
||||
if (res == pastdest)
|
||||
{
|
||||
plat->count = plat->wait;
|
||||
plat->status = waiting;
|
||||
S_StartSound( &plat->sector->soundorg,sfx_pstop);
|
||||
if( plat->type == raiseAndChange
|
||||
|| plat->type == raiseToNearestAndChange )
|
||||
{
|
||||
if( !( ::g->leveltime & 7 ) )
|
||||
S_StartSound( &plat->sector->soundorg,
|
||||
sfx_stnmov );
|
||||
}
|
||||
|
||||
|
||||
if( res == crushed && ( !plat->crush ) )
|
||||
{
|
||||
plat->count = plat->wait;
|
||||
plat->status = down;
|
||||
S_StartSound( &plat->sector->soundorg,
|
||||
sfx_pstart );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( res == pastdest )
|
||||
{
|
||||
plat->count = plat->wait;
|
||||
plat->status = waiting;
|
||||
S_StartSound( &plat->sector->soundorg,
|
||||
sfx_pstop );
|
||||
|
||||
switch( plat->type )
|
||||
{
|
||||
case blazeDWUS:
|
||||
case downWaitUpStay:
|
||||
P_RemoveActivePlat( plat );
|
||||
break;
|
||||
|
||||
case raiseAndChange:
|
||||
case raiseToNearestAndChange:
|
||||
P_RemoveActivePlat( plat );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case down:
|
||||
res = T_MovePlane( plat->sector, plat->speed, plat->low, false, 0, -1 );
|
||||
|
||||
if( res == pastdest )
|
||||
{
|
||||
plat->count = plat->wait;
|
||||
plat->status = waiting;
|
||||
S_StartSound( &plat->sector->soundorg, sfx_pstop );
|
||||
}
|
||||
break;
|
||||
|
||||
case waiting:
|
||||
if( !--plat->count )
|
||||
{
|
||||
if( plat->sector->floorheight == plat->low )
|
||||
{
|
||||
plat->status = up;
|
||||
}
|
||||
else
|
||||
{
|
||||
plat->status = down;
|
||||
}
|
||||
S_StartSound( &plat->sector->soundorg, sfx_pstart );
|
||||
}
|
||||
case in_stasis:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case waiting:
|
||||
if (!--plat->count)
|
||||
{
|
||||
if (plat->sector->floorheight == plat->low)
|
||||
plat->status = up;
|
||||
else
|
||||
plat->status = down;
|
||||
S_StartSound( &plat->sector->soundorg,sfx_pstart);
|
||||
}
|
||||
case in_stasis:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -145,175 +149,185 @@ EV_DoPlat
|
|||
plattype_e type,
|
||||
int amount )
|
||||
{
|
||||
plat_t* plat;
|
||||
int secnum;
|
||||
int rtn;
|
||||
sector_t* sec;
|
||||
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
plat_t* plat;
|
||||
int secnum;
|
||||
int rtn;
|
||||
sector_t* sec;
|
||||
|
||||
|
||||
// Activate all <type> plats that are in_stasis
|
||||
switch(type)
|
||||
{
|
||||
case perpetualRaise:
|
||||
P_ActivateInStasis(line->tag);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0)
|
||||
{
|
||||
sec = &::g->sectors[secnum];
|
||||
secnum = -1;
|
||||
rtn = 0;
|
||||
|
||||
if (sec->specialdata)
|
||||
continue;
|
||||
|
||||
// Find lowest & highest floors around sector
|
||||
rtn = 1;
|
||||
plat = (plat_t*)DoomLib::Z_Malloc( sizeof(*plat), PU_LEVEL, 0);
|
||||
P_AddThinker(&plat->thinker);
|
||||
|
||||
plat->type = type;
|
||||
plat->sector = sec;
|
||||
plat->sector->specialdata = plat;
|
||||
plat->thinker.function.acp1 = (actionf_p1) T_PlatRaise;
|
||||
plat->crush = false;
|
||||
plat->tag = line->tag;
|
||||
|
||||
switch(type)
|
||||
|
||||
// Activate all <type> plats that are in_stasis
|
||||
switch( type )
|
||||
{
|
||||
case raiseToNearestAndChange:
|
||||
plat->speed = PLATSPEED/2;
|
||||
sec->floorpic = ::g->sides[line->sidenum[0]].sector->floorpic;
|
||||
plat->high = P_FindNextHighestFloor(sec,sec->floorheight);
|
||||
plat->wait = 0;
|
||||
plat->status = up;
|
||||
// NO MORE DAMAGE, IF APPLICABLE
|
||||
sec->special = 0;
|
||||
case perpetualRaise:
|
||||
P_ActivateInStasis( line->tag );
|
||||
break;
|
||||
|
||||
S_StartSound( &sec->soundorg,sfx_stnmov);
|
||||
break;
|
||||
|
||||
case raiseAndChange:
|
||||
plat->speed = PLATSPEED/2;
|
||||
sec->floorpic = ::g->sides[line->sidenum[0]].sector->floorpic;
|
||||
plat->high = sec->floorheight + amount*FRACUNIT;
|
||||
plat->wait = 0;
|
||||
plat->status = up;
|
||||
|
||||
S_StartSound( &sec->soundorg,sfx_stnmov);
|
||||
break;
|
||||
|
||||
case downWaitUpStay:
|
||||
plat->speed = PLATSPEED * 4;
|
||||
plat->low = P_FindLowestFloorSurrounding(sec);
|
||||
|
||||
if (plat->low > sec->floorheight)
|
||||
plat->low = sec->floorheight;
|
||||
|
||||
plat->high = sec->floorheight;
|
||||
plat->wait = TICRATE*PLATWAIT;
|
||||
plat->status = down;
|
||||
S_StartSound( &sec->soundorg,sfx_pstart);
|
||||
break;
|
||||
|
||||
case blazeDWUS:
|
||||
plat->speed = PLATSPEED * 8;
|
||||
plat->low = P_FindLowestFloorSurrounding(sec);
|
||||
|
||||
if (plat->low > sec->floorheight)
|
||||
plat->low = sec->floorheight;
|
||||
|
||||
plat->high = sec->floorheight;
|
||||
plat->wait = TICRATE*PLATWAIT;
|
||||
plat->status = down;
|
||||
S_StartSound( &sec->soundorg,sfx_pstart);
|
||||
break;
|
||||
|
||||
case perpetualRaise:
|
||||
plat->speed = PLATSPEED;
|
||||
plat->low = P_FindLowestFloorSurrounding(sec);
|
||||
|
||||
if (plat->low > sec->floorheight)
|
||||
plat->low = sec->floorheight;
|
||||
|
||||
plat->high = P_FindHighestFloorSurrounding(sec);
|
||||
|
||||
if (plat->high < sec->floorheight)
|
||||
plat->high = sec->floorheight;
|
||||
|
||||
plat->wait = TICRATE*PLATWAIT;
|
||||
plat->status = (plat_e)(P_Random()&1);
|
||||
|
||||
S_StartSound( &sec->soundorg,sfx_pstart);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
P_AddActivePlat(plat);
|
||||
}
|
||||
return rtn;
|
||||
|
||||
while( ( secnum = P_FindSectorFromLineTag( line, secnum ) ) >= 0 )
|
||||
{
|
||||
sec = &::g->sectors[secnum];
|
||||
|
||||
if( sec->specialdata )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Find lowest & highest floors around sector
|
||||
rtn = 1;
|
||||
plat = ( plat_t* )DoomLib::Z_Malloc( sizeof( *plat ), PU_LEVEL, 0 );
|
||||
P_AddThinker( &plat->thinker );
|
||||
|
||||
plat->type = type;
|
||||
plat->sector = sec;
|
||||
plat->sector->specialdata = plat;
|
||||
plat->thinker.function.acp1 = ( actionf_p1 ) T_PlatRaise;
|
||||
plat->crush = false;
|
||||
plat->tag = line->tag;
|
||||
|
||||
switch( type )
|
||||
{
|
||||
case raiseToNearestAndChange:
|
||||
plat->speed = PLATSPEED / 2;
|
||||
sec->floorpic = ::g->sides[line->sidenum[0]].sector->floorpic;
|
||||
plat->high = P_FindNextHighestFloor( sec, sec->floorheight );
|
||||
plat->wait = 0;
|
||||
plat->status = up;
|
||||
// NO MORE DAMAGE, IF APPLICABLE
|
||||
sec->special = 0;
|
||||
|
||||
S_StartSound( &sec->soundorg, sfx_stnmov );
|
||||
break;
|
||||
|
||||
case raiseAndChange:
|
||||
plat->speed = PLATSPEED / 2;
|
||||
sec->floorpic = ::g->sides[line->sidenum[0]].sector->floorpic;
|
||||
plat->high = sec->floorheight + amount * FRACUNIT;
|
||||
plat->wait = 0;
|
||||
plat->status = up;
|
||||
|
||||
S_StartSound( &sec->soundorg, sfx_stnmov );
|
||||
break;
|
||||
|
||||
case downWaitUpStay:
|
||||
plat->speed = PLATSPEED * 4;
|
||||
plat->low = P_FindLowestFloorSurrounding( sec );
|
||||
|
||||
if( plat->low > sec->floorheight )
|
||||
{
|
||||
plat->low = sec->floorheight;
|
||||
}
|
||||
|
||||
plat->high = sec->floorheight;
|
||||
plat->wait = TICRATE * PLATWAIT;
|
||||
plat->status = down;
|
||||
S_StartSound( &sec->soundorg, sfx_pstart );
|
||||
break;
|
||||
|
||||
case blazeDWUS:
|
||||
plat->speed = PLATSPEED * 8;
|
||||
plat->low = P_FindLowestFloorSurrounding( sec );
|
||||
|
||||
if( plat->low > sec->floorheight )
|
||||
{
|
||||
plat->low = sec->floorheight;
|
||||
}
|
||||
|
||||
plat->high = sec->floorheight;
|
||||
plat->wait = TICRATE * PLATWAIT;
|
||||
plat->status = down;
|
||||
S_StartSound( &sec->soundorg, sfx_pstart );
|
||||
break;
|
||||
|
||||
case perpetualRaise:
|
||||
plat->speed = PLATSPEED;
|
||||
plat->low = P_FindLowestFloorSurrounding( sec );
|
||||
|
||||
if( plat->low > sec->floorheight )
|
||||
{
|
||||
plat->low = sec->floorheight;
|
||||
}
|
||||
|
||||
plat->high = P_FindHighestFloorSurrounding( sec );
|
||||
|
||||
if( plat->high < sec->floorheight )
|
||||
{
|
||||
plat->high = sec->floorheight;
|
||||
}
|
||||
|
||||
plat->wait = TICRATE * PLATWAIT;
|
||||
plat->status = ( plat_e )( P_Random() & 1 );
|
||||
|
||||
S_StartSound( &sec->soundorg, sfx_pstart );
|
||||
break;
|
||||
}
|
||||
P_AddActivePlat( plat );
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void P_ActivateInStasis(int tag)
|
||||
void P_ActivateInStasis( int tag )
|
||||
{
|
||||
int i;
|
||||
|
||||
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;
|
||||
}
|
||||
int i;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
(::g->activeplats[j])->oldstatus = (::g->activeplats[j])->status;
|
||||
(::g->activeplats[j])->status = in_stasis;
|
||||
(::g->activeplats[j])->thinker.function.acv = (actionf_v)NULL;
|
||||
}
|
||||
int j;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
::g->activeplats[i] = plat;
|
||||
return;
|
||||
}
|
||||
I_Error ("P_AddActivePlat: no more plats!");
|
||||
int i;
|
||||
|
||||
for( i = 0; i < MAXPLATS; i++ )
|
||||
if( ::g->activeplats[i] == NULL )
|
||||
{
|
||||
::g->activeplats[i] = plat;
|
||||
return;
|
||||
}
|
||||
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])
|
||||
{
|
||||
(::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!");
|
||||
int 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] = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
I_Error( "P_RemoveActivePlat: can't find plat!" );
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -65,18 +65,18 @@ If you have questions concerning this license or the applicable additional terms
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
ps_weapon,
|
||||
ps_flash,
|
||||
NUMPSPRITES
|
||||
ps_weapon,
|
||||
ps_flash,
|
||||
NUMPSPRITES
|
||||
|
||||
} psprnum_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const state_t* state; // a NULL state means not active
|
||||
int tics;
|
||||
fixed_t sx;
|
||||
fixed_t sy;
|
||||
const state_t* state; // a NULL state means not active
|
||||
int tics;
|
||||
fixed_t sx;
|
||||
fixed_t sy;
|
||||
|
||||
} pspdef_t;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -31,22 +31,22 @@ 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;
|
||||
extern byte* save_p;
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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 ))
|
||||
// ::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 ) )
|
||||
{
|
||||
// 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->segs = (seg_t*)Z_Malloc (::g->numsegs*sizeof(seg_t),PU_LEVEL,0);
|
||||
::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,65 +219,65 @@ 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->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->numsectors = W_LumpLength( lump ) / sizeof( mapsector_t );
|
||||
|
||||
ms = (mapsector_t *)data;
|
||||
::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;
|
||||
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));
|
||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
||||
|
||||
ms = (mapsector_t *)data;
|
||||
ss = ::g->sectors;
|
||||
for (i=0 ; i < ::g->numsectors ; i++, ss++, ms++)
|
||||
/*
|
||||
if (MallocForLump( lump, ::g->numsectors*sizeof(sector_t), (void**)&::g->sectors, PU_LEVEL_SHARED ))
|
||||
{
|
||||
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;
|
||||
}
|
||||
memset (::g->sectors, 0, ::g->numsectors*sizeof(sector_t));
|
||||
data = (byte*)W_CacheLumpNum (lump,PU_CACHE_SHARED); // ALAN: LOADTIME
|
||||
|
||||
DoomLib::Z_Free(data);
|
||||
}
|
||||
*/
|
||||
ms = (mapsector_t *)data;
|
||||
ss = ::g->sectors;
|
||||
for (i=0 ; i < ::g->numsectors ; i++, ss++, ms++)
|
||||
{
|
||||
ss->floorheight = SHORT(ms->floorheight)<<FRACBITS;
|
||||
ss->ceilingheight = SHORT(ms->ceilingheight)<<FRACBITS;
|
||||
ss->floorpic = R_FlatNumForName(ms->floorpic);
|
||||
ss->ceilingpic = R_FlatNumForName(ms->ceilingpic);
|
||||
ss->lightlevel = SHORT(ms->lightlevel);
|
||||
ss->special = SHORT(ms->special);
|
||||
ss->tag = SHORT(ms->tag);
|
||||
ss->thinglist = NULL;
|
||||
}
|
||||
|
||||
DoomLib::Z_Free(data);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// P_LoadNodes
|
||||
//
|
||||
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,47 +326,49 @@ 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
|
||||
case 88: // Boss Brain
|
||||
case 89: // Boss Shooter
|
||||
case 69: // Hell Knight
|
||||
case 67: // Mancubus
|
||||
case 71: // Pain Elemental
|
||||
case 65: // Former Human Commando
|
||||
case 66: // Revenant
|
||||
case 84: // Wolf SS
|
||||
spawn = false;
|
||||
break;
|
||||
case 68: // Arachnotron
|
||||
case 64: // Archvile
|
||||
case 88: // Boss Brain
|
||||
case 89: // Boss Shooter
|
||||
case 69: // Hell Knight
|
||||
case 67: // Mancubus
|
||||
case 71: // Pain Elemental
|
||||
case 65: // Former Human Commando
|
||||
case 66: // Revenant
|
||||
case 84: // Wolf SS
|
||||
spawn = false;
|
||||
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);
|
||||
// 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);
|
||||
P_SpawnMapThing( mt );
|
||||
}
|
||||
|
||||
Z_Free(data);
|
||||
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)
|
||||
if( ld->sidenum[1] != -1 )
|
||||
{
|
||||
ld->backsector = ::g->sides[ld->sidenum[1]].sector;
|
||||
}
|
||||
else
|
||||
{
|
||||
ld->backsector = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Z_Free(data);
|
||||
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;
|
||||
|
@ -534,10 +562,10 @@ void P_GroupLines (void)
|
|||
fixed_t bbox[4];
|
||||
int block;
|
||||
|
||||
|
||||
|
||||
// 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,58 +574,60 @@ 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++;
|
||||
}
|
||||
}
|
||||
|
||||
// build line tables for each sector
|
||||
linebuffer = (line_t**)Z_Malloc (total*sizeof(line_t*), PU_LEVEL, 0);
|
||||
// build line tables for each sector
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -609,9 +639,9 @@ void P_GroupLines (void)
|
|||
void
|
||||
P_SetupLevel
|
||||
( int episode,
|
||||
int map,
|
||||
int playermask,
|
||||
skill_t skill)
|
||||
int map,
|
||||
int playermask,
|
||||
skill_t skill )
|
||||
{
|
||||
int i;
|
||||
char lumpname[9];
|
||||
|
@ -619,10 +649,10 @@ 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;
|
||||
::g->players[i].killcount = ::g->players[i].secretcount
|
||||
= ::g->players[i].itemcount = 0;
|
||||
|
||||
::g->players[i].chainsawKills = 0;
|
||||
::g->players[i].berserkKills = 0;
|
||||
|
@ -630,35 +660,39 @@ P_SetupLevel
|
|||
|
||||
// Initial height of PointOfView
|
||||
// will be set by player think.
|
||||
::g->players[::g->consoleplayer].viewz = 1;
|
||||
::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,56 +703,58 @@ 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);
|
||||
// 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_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 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// clear special respawning que
|
||||
::g->iquehead = ::g->iquetail = 0;
|
||||
::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 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -55,45 +55,57 @@ P_DivlineSide
|
|||
fixed_t y,
|
||||
divline_t* node )
|
||||
{
|
||||
fixed_t dx;
|
||||
fixed_t dy;
|
||||
fixed_t left;
|
||||
fixed_t right;
|
||||
fixed_t dx;
|
||||
fixed_t dy;
|
||||
fixed_t left;
|
||||
fixed_t right;
|
||||
|
||||
if (!node->dx)
|
||||
{
|
||||
if (x==node->x)
|
||||
return 2;
|
||||
|
||||
if (x <= node->x)
|
||||
return node->dy > 0;
|
||||
if( !node->dx )
|
||||
{
|
||||
if( x == node->x )
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
return node->dy < 0;
|
||||
}
|
||||
|
||||
if (!node->dy)
|
||||
{
|
||||
if (x==node->y)
|
||||
return 2;
|
||||
if( x <= node->x )
|
||||
{
|
||||
return node->dy > 0;
|
||||
}
|
||||
|
||||
if (y <= node->y)
|
||||
return node->dx < 0;
|
||||
return node->dy < 0;
|
||||
}
|
||||
|
||||
return node->dx > 0;
|
||||
}
|
||||
|
||||
dx = (x - node->x);
|
||||
dy = (y - node->y);
|
||||
if( !node->dy )
|
||||
{
|
||||
if( x == node->y )
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
left = (node->dy>>FRACBITS) * (dx>>FRACBITS);
|
||||
right = (dy>>FRACBITS) * (node->dx>>FRACBITS);
|
||||
|
||||
if (right < left)
|
||||
return 0; // front side
|
||||
|
||||
if (left == right)
|
||||
return 2;
|
||||
return 1; // back side
|
||||
if( y <= node->y )
|
||||
{
|
||||
return node->dx < 0;
|
||||
}
|
||||
|
||||
return node->dx > 0;
|
||||
}
|
||||
|
||||
dx = ( x - node->x );
|
||||
dy = ( y - node->y );
|
||||
|
||||
left = ( node->dy >> FRACBITS ) * ( dx >> FRACBITS );
|
||||
right = ( dy >> FRACBITS ) * ( node->dx >> FRACBITS );
|
||||
|
||||
if( right < left )
|
||||
{
|
||||
return 0; // front side
|
||||
}
|
||||
|
||||
if( left == right )
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
return 1; // back side
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,21 +120,23 @@ P_InterceptVector2
|
|||
( divline_t* v2,
|
||||
divline_t* v1 )
|
||||
{
|
||||
fixed_t frac;
|
||||
fixed_t num;
|
||||
fixed_t den;
|
||||
|
||||
den = FixedMul (v1->dy>>8,v2->dx) - FixedMul(v1->dx>>8,v2->dy);
|
||||
fixed_t frac;
|
||||
fixed_t num;
|
||||
fixed_t den;
|
||||
|
||||
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);
|
||||
den = FixedMul( v1->dy >> 8, v2->dx ) - FixedMul( v1->dx >> 8, v2->dy );
|
||||
|
||||
return frac;
|
||||
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 );
|
||||
|
||||
return frac;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -130,119 +144,145 @@ 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;
|
||||
int s1;
|
||||
int s2;
|
||||
int count;
|
||||
subsector_t* sub;
|
||||
sector_t* front;
|
||||
sector_t* back;
|
||||
fixed_t psight_opentop;
|
||||
fixed_t psight_openbottom;
|
||||
divline_t divl;
|
||||
vertex_t* v1;
|
||||
vertex_t* v2;
|
||||
fixed_t frac;
|
||||
fixed_t slope;
|
||||
|
||||
seg_t* seg;
|
||||
line_t* line;
|
||||
int s1;
|
||||
int s2;
|
||||
int count;
|
||||
subsector_t* sub;
|
||||
sector_t* front;
|
||||
sector_t* back;
|
||||
fixed_t psight_opentop;
|
||||
fixed_t psight_openbottom;
|
||||
divline_t divl;
|
||||
vertex_t* v1;
|
||||
vertex_t* v2;
|
||||
fixed_t frac;
|
||||
fixed_t slope;
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if (num>=::g->numsubsectors)
|
||||
I_Error ("P_CrossSubsector: ss %i with numss = %i",
|
||||
num,
|
||||
::g->numsubsectors);
|
||||
if( num >=::g->numsubsectors )
|
||||
I_Error( "P_CrossSubsector: ss %i with numss = %i",
|
||||
num,
|
||||
::g->numsubsectors );
|
||||
#endif
|
||||
|
||||
sub = &::g->subsectors[num];
|
||||
|
||||
// check ::g->lines
|
||||
count = sub->numlines;
|
||||
seg = &::g->segs[sub->firstline];
|
||||
sub = &::g->subsectors[num];
|
||||
|
||||
for ( ; count ; seg++, count--)
|
||||
{
|
||||
line = seg->linedef;
|
||||
// check ::g->lines
|
||||
count = sub->numlines;
|
||||
seg = &::g->segs[sub->firstline];
|
||||
|
||||
// allready checked other side?
|
||||
if (line->validcount == ::g->validcount)
|
||||
continue;
|
||||
|
||||
line->validcount = ::g->validcount;
|
||||
|
||||
v1 = line->v1;
|
||||
v2 = line->v2;
|
||||
s1 = P_DivlineSide (v1->x,v1->y, &::g->strace);
|
||||
s2 = P_DivlineSide (v2->x, v2->y, &::g->strace);
|
||||
|
||||
// line isn't crossed?
|
||||
if (s1 == s2)
|
||||
continue;
|
||||
|
||||
divl.x = v1->x;
|
||||
divl.y = v1->y;
|
||||
divl.dx = v2->x - v1->x;
|
||||
divl.dy = v2->y - v1->y;
|
||||
s1 = P_DivlineSide (::g->strace.x, ::g->strace.y, &divl);
|
||||
s2 = P_DivlineSide (::g->t2x, ::g->t2y, &divl);
|
||||
|
||||
// line isn't crossed?
|
||||
if (s1 == s2)
|
||||
continue;
|
||||
|
||||
// stop because it is not two sided anyway
|
||||
// might do this after updating validcount?
|
||||
if ( !(line->flags & ML_TWOSIDED) )
|
||||
return false;
|
||||
|
||||
// crosses a two sided line
|
||||
front = seg->frontsector;
|
||||
back = seg->backsector;
|
||||
|
||||
// no wall to block sight with?
|
||||
if (front->floorheight == back->floorheight
|
||||
&& front->ceilingheight == back->ceilingheight)
|
||||
continue;
|
||||
|
||||
// possible occluder
|
||||
// because of ceiling height differences
|
||||
if (front->ceilingheight < back->ceilingheight)
|
||||
psight_opentop = front->ceilingheight;
|
||||
else
|
||||
psight_opentop = back->ceilingheight;
|
||||
|
||||
// because of ceiling height differences
|
||||
if (front->floorheight > back->floorheight)
|
||||
psight_openbottom = front->floorheight;
|
||||
else
|
||||
psight_openbottom = back->floorheight;
|
||||
|
||||
// quick test for totally closed doors
|
||||
if (psight_openbottom >= psight_opentop)
|
||||
return false; // stop
|
||||
|
||||
frac = P_InterceptVector2 (&::g->strace, &divl);
|
||||
|
||||
if (front->floorheight != back->floorheight)
|
||||
for( ; count ; seg++, count-- )
|
||||
{
|
||||
slope = FixedDiv (psight_openbottom - ::g->sightzstart , frac);
|
||||
if (slope > ::g->bottomslope)
|
||||
::g->bottomslope = slope;
|
||||
line = seg->linedef;
|
||||
|
||||
// allready checked other side?
|
||||
if( line->validcount == ::g->validcount )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
line->validcount = ::g->validcount;
|
||||
|
||||
v1 = line->v1;
|
||||
v2 = line->v2;
|
||||
s1 = P_DivlineSide( v1->x, v1->y, &::g->strace );
|
||||
s2 = P_DivlineSide( v2->x, v2->y, &::g->strace );
|
||||
|
||||
// line isn't crossed?
|
||||
if( s1 == s2 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
divl.x = v1->x;
|
||||
divl.y = v1->y;
|
||||
divl.dx = v2->x - v1->x;
|
||||
divl.dy = v2->y - v1->y;
|
||||
s1 = P_DivlineSide( ::g->strace.x, ::g->strace.y, &divl );
|
||||
s2 = P_DivlineSide( ::g->t2x, ::g->t2y, &divl );
|
||||
|
||||
// line isn't crossed?
|
||||
if( s1 == s2 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// stop because it is not two sided anyway
|
||||
// might do this after updating validcount?
|
||||
if( !( line->flags & ML_TWOSIDED ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// crosses a two sided line
|
||||
front = seg->frontsector;
|
||||
back = seg->backsector;
|
||||
|
||||
// no wall to block sight with?
|
||||
if( front->floorheight == back->floorheight
|
||||
&& front->ceilingheight == back->ceilingheight )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// possible occluder
|
||||
// because of ceiling height differences
|
||||
if( front->ceilingheight < back->ceilingheight )
|
||||
{
|
||||
psight_opentop = front->ceilingheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
psight_opentop = back->ceilingheight;
|
||||
}
|
||||
|
||||
// because of ceiling height differences
|
||||
if( front->floorheight > back->floorheight )
|
||||
{
|
||||
psight_openbottom = front->floorheight;
|
||||
}
|
||||
else
|
||||
{
|
||||
psight_openbottom = back->floorheight;
|
||||
}
|
||||
|
||||
// quick test for totally closed doors
|
||||
if( psight_openbottom >= psight_opentop )
|
||||
{
|
||||
return false; // stop
|
||||
}
|
||||
|
||||
frac = P_InterceptVector2( &::g->strace, &divl );
|
||||
|
||||
if( front->floorheight != back->floorheight )
|
||||
{
|
||||
slope = FixedDiv( psight_openbottom - ::g->sightzstart , frac );
|
||||
if( slope > ::g->bottomslope )
|
||||
{
|
||||
::g->bottomslope = slope;
|
||||
}
|
||||
}
|
||||
|
||||
if( front->ceilingheight != back->ceilingheight )
|
||||
{
|
||||
slope = FixedDiv( psight_opentop - ::g->sightzstart , frac );
|
||||
if( slope < ::g->topslope )
|
||||
{
|
||||
::g->topslope = slope;
|
||||
}
|
||||
}
|
||||
|
||||
if( ::g->topslope <= ::g->bottomslope )
|
||||
{
|
||||
return false; // stop
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
// 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;
|
||||
node_t* bsp;
|
||||
int side;
|
||||
|
||||
if (bspnum & NF_SUBSECTOR)
|
||||
{
|
||||
if (bspnum == -1)
|
||||
return P_CrossSubsector (0);
|
||||
else
|
||||
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 = 0; // an "on" should cross both ::g->sides
|
||||
if( bspnum & NF_SUBSECTOR )
|
||||
{
|
||||
if( bspnum == -1 )
|
||||
{
|
||||
return P_CrossSubsector( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return P_CrossSubsector( bspnum & ( ~NF_SUBSECTOR ) );
|
||||
}
|
||||
}
|
||||
|
||||
// cross the starting 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))
|
||||
{
|
||||
// the line doesn't touch the other side
|
||||
return true;
|
||||
}
|
||||
|
||||
// cross the ending side
|
||||
return P_CrossBSPNode (bsp->children[side^1]);
|
||||
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 = 0; // an "on" should cross both ::g->sides
|
||||
}
|
||||
|
||||
// cross the starting 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 ) )
|
||||
{
|
||||
// the line doesn't touch the other side
|
||||
return true;
|
||||
}
|
||||
|
||||
// cross the ending side
|
||||
return P_CrossBSPNode( bsp->children[side ^ 1] );
|
||||
}
|
||||
|
||||
|
||||
|
@ -299,49 +347,49 @@ P_CheckSight
|
|||
( mobj_t* t1,
|
||||
mobj_t* t2 )
|
||||
{
|
||||
int s1;
|
||||
int s2;
|
||||
int pnum;
|
||||
int bytenum;
|
||||
int bitnum;
|
||||
|
||||
// First check for trivial rejection.
|
||||
int s1;
|
||||
int s2;
|
||||
int pnum;
|
||||
int bytenum;
|
||||
int bitnum;
|
||||
|
||||
// Determine subsector entries in REJECT table.
|
||||
s1 = (t1->subsector->sector - ::g->sectors);
|
||||
s2 = (t2->subsector->sector - ::g->sectors);
|
||||
pnum = s1*::g->numsectors + s2;
|
||||
bytenum = pnum>>3;
|
||||
bitnum = 1 << (pnum&7);
|
||||
// First check for trivial rejection.
|
||||
|
||||
// Check in REJECT table.
|
||||
if (::g->rejectmatrix[bytenum]&bitnum)
|
||||
{
|
||||
::g->sightcounts[0]++;
|
||||
// Determine subsector entries in REJECT table.
|
||||
s1 = ( t1->subsector->sector - ::g->sectors );
|
||||
s2 = ( t2->subsector->sector - ::g->sectors );
|
||||
pnum = s1*::g->numsectors + s2;
|
||||
bytenum = pnum >> 3;
|
||||
bitnum = 1 << ( pnum & 7 );
|
||||
|
||||
// can't possibly be connected
|
||||
return false;
|
||||
}
|
||||
// Check in REJECT table.
|
||||
if( ::g->rejectmatrix[bytenum]&bitnum )
|
||||
{
|
||||
::g->sightcounts[0]++;
|
||||
|
||||
// An unobstructed LOS is possible.
|
||||
// Now look from eyes of t1 to any part of t2.
|
||||
::g->sightcounts[1]++;
|
||||
// can't possibly be connected
|
||||
return false;
|
||||
}
|
||||
|
||||
::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->strace.x = t1->x;
|
||||
::g->strace.y = t1->y;
|
||||
::g->t2x = t2->x;
|
||||
::g->t2y = t2->y;
|
||||
::g->strace.dx = t2->x - t1->x;
|
||||
::g->strace.dy = t2->y - t1->y;
|
||||
// An unobstructed LOS is possible.
|
||||
// Now look from eyes of t1 to any part of t2.
|
||||
::g->sightcounts[1]++;
|
||||
|
||||
// the head node is the last node output
|
||||
return P_CrossBSPNode (::g->numnodes-1);
|
||||
::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->strace.x = t1->x;
|
||||
::g->strace.y = t1->y;
|
||||
::g->t2x = t2->x;
|
||||
::g->t2y = t2->y;
|
||||
::g->strace.dx = t2->x - t1->x;
|
||||
::g->strace.dy = t2->y - t1->y;
|
||||
|
||||
// the head node is the last node output
|
||||
return P_CrossBSPNode( ::g->numnodes - 1 );
|
||||
}
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -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 );
|
||||
|
||||
|
||||
|
||||
|
@ -126,40 +126,40 @@ int EV_DoDonut(line_t* line);
|
|||
//
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
sector_t* sector;
|
||||
int count;
|
||||
int maxlight;
|
||||
int minlight;
|
||||
|
||||
thinker_t thinker;
|
||||
sector_t* sector;
|
||||
int count;
|
||||
int maxlight;
|
||||
int minlight;
|
||||
|
||||
} fireflicker_t;
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
sector_t* sector;
|
||||
int count;
|
||||
int maxlight;
|
||||
int minlight;
|
||||
int maxtime;
|
||||
int mintime;
|
||||
|
||||
thinker_t thinker;
|
||||
sector_t* sector;
|
||||
int count;
|
||||
int maxlight;
|
||||
int minlight;
|
||||
int maxtime;
|
||||
int mintime;
|
||||
|
||||
} lightflash_t;
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
sector_t* sector;
|
||||
int count;
|
||||
int minlight;
|
||||
int maxlight;
|
||||
int darktime;
|
||||
int brighttime;
|
||||
|
||||
thinker_t thinker;
|
||||
sector_t* sector;
|
||||
int count;
|
||||
int minlight;
|
||||
int maxlight;
|
||||
int darktime;
|
||||
int brighttime;
|
||||
|
||||
} strobe_t;
|
||||
|
||||
|
||||
|
@ -167,11 +167,11 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
sector_t* sector;
|
||||
int minlight;
|
||||
int maxlight;
|
||||
int direction;
|
||||
thinker_t thinker;
|
||||
sector_t* sector;
|
||||
int minlight;
|
||||
int maxlight;
|
||||
int direction;
|
||||
|
||||
} glow_t;
|
||||
|
||||
|
@ -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 );
|
||||
|
||||
|
||||
|
||||
|
@ -212,54 +212,55 @@ void P_SpawnGlowingLight(sector_t* sector);
|
|||
//
|
||||
typedef struct
|
||||
{
|
||||
char name1[9];
|
||||
char name2[9];
|
||||
short episode;
|
||||
|
||||
char name1[9];
|
||||
char name2[9];
|
||||
short episode;
|
||||
|
||||
} switchlist_t;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
top,
|
||||
middle,
|
||||
bottom
|
||||
top,
|
||||
middle,
|
||||
bottom
|
||||
|
||||
} bwhere_e;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
line_t* line;
|
||||
bwhere_e where;
|
||||
int btexture;
|
||||
int btimer;
|
||||
union {
|
||||
mobj_t * soundorg;
|
||||
degenmobj_t * degensoundorg;
|
||||
line_t* line;
|
||||
bwhere_e where;
|
||||
int btexture;
|
||||
int btimer;
|
||||
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.
|
||||
#define BUTTONTIME TICRATE
|
||||
// 1 second, in ticks.
|
||||
#define BUTTONTIME TICRATE
|
||||
|
||||
extern button_t buttonlist[MAXBUTTONS];
|
||||
extern button_t buttonlist[MAXBUTTONS];
|
||||
|
||||
void
|
||||
P_ChangeSwitchTexture
|
||||
( line_t* line,
|
||||
int useAgain );
|
||||
|
||||
void P_InitSwitchList(void);
|
||||
void P_InitSwitchList( void );
|
||||
|
||||
|
||||
//
|
||||
|
@ -267,10 +268,10 @@ void P_InitSwitchList(void);
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
up,
|
||||
down,
|
||||
waiting,
|
||||
in_stasis
|
||||
up,
|
||||
down,
|
||||
waiting,
|
||||
in_stasis
|
||||
|
||||
} plat_e;
|
||||
|
||||
|
@ -278,11 +279,11 @@ typedef enum
|
|||
|
||||
typedef enum
|
||||
{
|
||||
perpetualRaise,
|
||||
downWaitUpStay,
|
||||
raiseAndChange,
|
||||
raiseToNearestAndChange,
|
||||
blazeDWUS
|
||||
perpetualRaise,
|
||||
downWaitUpStay,
|
||||
raiseAndChange,
|
||||
raiseToNearestAndChange,
|
||||
blazeDWUS
|
||||
|
||||
} plattype_e;
|
||||
|
||||
|
@ -290,19 +291,19 @@ typedef enum
|
|||
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
sector_t* sector;
|
||||
fixed_t speed;
|
||||
fixed_t low;
|
||||
fixed_t high;
|
||||
int wait;
|
||||
int count;
|
||||
plat_e status;
|
||||
plat_e oldstatus;
|
||||
qboolean crush;
|
||||
int tag;
|
||||
plattype_e type;
|
||||
|
||||
thinker_t thinker;
|
||||
sector_t* sector;
|
||||
fixed_t speed;
|
||||
fixed_t low;
|
||||
fixed_t high;
|
||||
int wait;
|
||||
int count;
|
||||
plat_e status;
|
||||
plat_e oldstatus;
|
||||
qboolean crush;
|
||||
int tag;
|
||||
plattype_e type;
|
||||
|
||||
} plat_t;
|
||||
|
||||
|
||||
|
@ -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 );
|
||||
|
||||
|
||||
//
|
||||
|
@ -333,14 +334,14 @@ void P_ActivateInStasis(int tag);
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
normal,
|
||||
close30ThenOpen,
|
||||
closed,
|
||||
opened,
|
||||
raiseIn5Mins,
|
||||
blazeRaise,
|
||||
blazeOpen,
|
||||
blazeClose
|
||||
normal,
|
||||
close30ThenOpen,
|
||||
closed,
|
||||
opened,
|
||||
raiseIn5Mins,
|
||||
blazeRaise,
|
||||
blazeOpen,
|
||||
blazeClose
|
||||
|
||||
} vldoor_e;
|
||||
|
||||
|
@ -348,21 +349,21 @@ typedef enum
|
|||
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
vldoor_e type;
|
||||
sector_t* sector;
|
||||
fixed_t topheight;
|
||||
fixed_t speed;
|
||||
thinker_t thinker;
|
||||
vldoor_e type;
|
||||
sector_t* sector;
|
||||
fixed_t topheight;
|
||||
fixed_t speed;
|
||||
|
||||
// 1 = up, 0 = waiting at top, -1 = down
|
||||
int direction;
|
||||
|
||||
// tics to wait at the top
|
||||
int topwait;
|
||||
// (keep in case a door going down is reset)
|
||||
// when it reaches 0, start going down
|
||||
int topcountdown;
|
||||
|
||||
// 1 = up, 0 = waiting at top, -1 = down
|
||||
int direction;
|
||||
|
||||
// tics to wait at the top
|
||||
int topwait;
|
||||
// (keep in case a door going down is reset)
|
||||
// when it reaches 0, start going down
|
||||
int topcountdown;
|
||||
|
||||
} vldoor_t;
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -402,9 +403,9 @@ P_SpawnDoorRaiseIn5Mins
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
sd_opening,
|
||||
sd_waiting,
|
||||
sd_closing
|
||||
sd_opening,
|
||||
sd_waiting,
|
||||
sd_closing
|
||||
|
||||
} sd_e;
|
||||
|
||||
|
@ -412,9 +413,9 @@ typedef enum
|
|||
|
||||
typedef enum
|
||||
{
|
||||
sdt_openOnly,
|
||||
sdt_closeOnly,
|
||||
sdt_openAndClose
|
||||
sdt_openOnly,
|
||||
sdt_closeOnly,
|
||||
sdt_openAndClose
|
||||
|
||||
} sdt_e;
|
||||
|
||||
|
@ -423,15 +424,15 @@ typedef enum
|
|||
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
sdt_e type;
|
||||
line_t* line;
|
||||
int frame;
|
||||
int whichDoorIndex;
|
||||
int timer;
|
||||
sector_t* frontsector;
|
||||
sector_t* backsector;
|
||||
sd_e status;
|
||||
thinker_t thinker;
|
||||
sdt_e type;
|
||||
line_t* line;
|
||||
int frame;
|
||||
int whichDoorIndex;
|
||||
int timer;
|
||||
sector_t* frontsector;
|
||||
sector_t* backsector;
|
||||
sd_e status;
|
||||
|
||||
} slidedoor_t;
|
||||
|
||||
|
@ -439,23 +440,23 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
char frontFrame1[9];
|
||||
char frontFrame2[9];
|
||||
char frontFrame3[9];
|
||||
char frontFrame4[9];
|
||||
char backFrame1[9];
|
||||
char backFrame2[9];
|
||||
char backFrame3[9];
|
||||
char backFrame4[9];
|
||||
|
||||
char frontFrame1[9];
|
||||
char frontFrame2[9];
|
||||
char frontFrame3[9];
|
||||
char frontFrame4[9];
|
||||
char backFrame1[9];
|
||||
char backFrame2[9];
|
||||
char backFrame3[9];
|
||||
char backFrame4[9];
|
||||
|
||||
} slidename_t;
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int frontFrames[4];
|
||||
int backFrames[4];
|
||||
int frontFrames[4];
|
||||
int backFrames[4];
|
||||
|
||||
} slideframe_t;
|
||||
|
||||
|
@ -468,9 +469,9 @@ typedef struct
|
|||
#define SWAITTICS 4
|
||||
|
||||
// how many diff. types of anims
|
||||
#define MAXSLIDEDOORS 5
|
||||
#define MAXSLIDEDOORS 5
|
||||
|
||||
void P_InitSlidingDoorFrames(void);
|
||||
void P_InitSlidingDoorFrames( void );
|
||||
|
||||
void
|
||||
EV_SlidingDoor
|
||||
|
@ -485,12 +486,12 @@ EV_SlidingDoor
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
lowerToFloor,
|
||||
raiseToHighest,
|
||||
lowerAndCrush,
|
||||
crushAndRaise,
|
||||
fastCrushAndRaise,
|
||||
silentCrushAndRaise
|
||||
lowerToFloor,
|
||||
raiseToHighest,
|
||||
lowerAndCrush,
|
||||
crushAndRaise,
|
||||
fastCrushAndRaise,
|
||||
silentCrushAndRaise
|
||||
|
||||
} ceiling_e;
|
||||
|
||||
|
@ -498,21 +499,21 @@ typedef enum
|
|||
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
ceiling_e type;
|
||||
sector_t* sector;
|
||||
fixed_t bottomheight;
|
||||
fixed_t topheight;
|
||||
fixed_t speed;
|
||||
qboolean crush;
|
||||
thinker_t thinker;
|
||||
ceiling_e type;
|
||||
sector_t* sector;
|
||||
fixed_t bottomheight;
|
||||
fixed_t topheight;
|
||||
fixed_t speed;
|
||||
qboolean crush;
|
||||
|
||||
// 1 = up, 0 = waiting, -1 = down
|
||||
int direction;
|
||||
// 1 = up, 0 = waiting, -1 = down
|
||||
int direction;
|
||||
|
||||
// ID
|
||||
int tag;
|
||||
int olddirection;
|
||||
|
||||
// ID
|
||||
int tag;
|
||||
int olddirection;
|
||||
|
||||
} ceiling_t;
|
||||
|
||||
|
||||
|
@ -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 );
|
||||
|
||||
|
||||
//
|
||||
|
@ -542,37 +543,37 @@ void P_ActivateInStasisCeiling(line_t* line);
|
|||
//
|
||||
typedef enum
|
||||
{
|
||||
// lower floor to highest surrounding floor
|
||||
lowerFloor,
|
||||
|
||||
// lower floor to lowest surrounding floor
|
||||
lowerFloorToLowest,
|
||||
|
||||
// lower floor to highest surrounding floor VERY FAST
|
||||
turboLower,
|
||||
|
||||
// raise floor to lowest surrounding CEILING
|
||||
raiseFloor,
|
||||
|
||||
// raise floor to next highest surrounding floor
|
||||
raiseFloorToNearest,
|
||||
// lower floor to highest surrounding floor
|
||||
lowerFloor,
|
||||
|
||||
// raise floor to shortest height texture around it
|
||||
raiseToTexture,
|
||||
|
||||
// lower floor to lowest surrounding floor
|
||||
// and change floorpic
|
||||
lowerAndChange,
|
||||
|
||||
raiseFloor24,
|
||||
raiseFloor24AndChange,
|
||||
raiseFloorCrush,
|
||||
// lower floor to lowest surrounding floor
|
||||
lowerFloorToLowest,
|
||||
|
||||
// lower floor to highest surrounding floor VERY FAST
|
||||
turboLower,
|
||||
|
||||
// raise floor to lowest surrounding CEILING
|
||||
raiseFloor,
|
||||
|
||||
// raise floor to next highest surrounding floor
|
||||
raiseFloorToNearest,
|
||||
|
||||
// raise floor to shortest height texture around it
|
||||
raiseToTexture,
|
||||
|
||||
// lower floor to lowest surrounding floor
|
||||
// and change floorpic
|
||||
lowerAndChange,
|
||||
|
||||
raiseFloor24,
|
||||
raiseFloor24AndChange,
|
||||
raiseFloorCrush,
|
||||
|
||||
// raise to next highest floor, turbo-speed
|
||||
raiseFloorTurbo,
|
||||
donutRaise,
|
||||
raiseFloor512
|
||||
|
||||
// raise to next highest floor, turbo-speed
|
||||
raiseFloorTurbo,
|
||||
donutRaise,
|
||||
raiseFloor512
|
||||
|
||||
} floor_e;
|
||||
|
||||
|
||||
|
@ -580,24 +581,24 @@ typedef enum
|
|||
|
||||
typedef enum
|
||||
{
|
||||
build8, // slowly build by 8
|
||||
turbo16 // quickly build by 16
|
||||
|
||||
build8, // slowly build by 8
|
||||
turbo16 // quickly build by 16
|
||||
|
||||
} stair_e;
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
floor_e type;
|
||||
qboolean crush;
|
||||
sector_t* sector;
|
||||
int direction;
|
||||
int newspecial;
|
||||
short texture;
|
||||
fixed_t floordestheight;
|
||||
fixed_t speed;
|
||||
thinker_t thinker;
|
||||
floor_e type;
|
||||
qboolean crush;
|
||||
sector_t* sector;
|
||||
int direction;
|
||||
int newspecial;
|
||||
short texture;
|
||||
fixed_t floordestheight;
|
||||
fixed_t speed;
|
||||
|
||||
} floormove_t;
|
||||
|
||||
|
@ -607,10 +608,10 @@ typedef struct
|
|||
|
||||
typedef enum
|
||||
{
|
||||
ok,
|
||||
crushed,
|
||||
pastdest
|
||||
|
||||
ok,
|
||||
crushed,
|
||||
pastdest
|
||||
|
||||
} result_e;
|
||||
|
||||
result_e
|
||||
|
@ -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
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,9 @@
|
|||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -55,84 +55,100 @@ EV_Teleport
|
|||
int side,
|
||||
mobj_t* thing )
|
||||
{
|
||||
int i;
|
||||
int tag;
|
||||
mobj_t* m;
|
||||
mobj_t* fog;
|
||||
unsigned an;
|
||||
thinker_t* thinker;
|
||||
sector_t* sector;
|
||||
fixed_t oldx;
|
||||
fixed_t oldy;
|
||||
fixed_t oldz;
|
||||
int i;
|
||||
int tag;
|
||||
mobj_t* m;
|
||||
mobj_t* fog;
|
||||
unsigned an;
|
||||
thinker_t* thinker;
|
||||
sector_t* sector;
|
||||
fixed_t oldx;
|
||||
fixed_t oldy;
|
||||
fixed_t oldz;
|
||||
|
||||
// don't teleport missiles
|
||||
if (thing->flags & MF_MISSILE)
|
||||
return 0;
|
||||
|
||||
// Don't teleport if hit back of line,
|
||||
// so you can get out of teleporter.
|
||||
if (side == 1)
|
||||
return 0;
|
||||
|
||||
|
||||
tag = line->tag;
|
||||
for (i = 0; i < ::g->numsectors; i++)
|
||||
{
|
||||
if (::g->sectors[ i ].tag == tag )
|
||||
// don't teleport missiles
|
||||
if( thing->flags & MF_MISSILE )
|
||||
{
|
||||
thinker = ::g->thinkercap.next;
|
||||
for (thinker = ::g->thinkercap.next;
|
||||
thinker != &::g->thinkercap;
|
||||
thinker = thinker->next)
|
||||
{
|
||||
// not a mobj
|
||||
if (thinker->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
m = (mobj_t *)thinker;
|
||||
|
||||
// not a teleportman
|
||||
if (m->type != MT_TELEPORTMAN )
|
||||
continue;
|
||||
|
||||
sector = m->subsector->sector;
|
||||
// wrong sector
|
||||
if (sector-::g->sectors != i )
|
||||
continue;
|
||||
|
||||
oldx = thing->x;
|
||||
oldy = thing->y;
|
||||
oldz = thing->z;
|
||||
|
||||
if (!P_TeleportMove (thing, m->x, m->y))
|
||||
return 0;
|
||||
|
||||
thing->z = thing->floorz; //fixme: not needed?
|
||||
if (thing->player)
|
||||
thing->player->viewz = thing->z+thing->player->viewheight;
|
||||
|
||||
// spawn teleport fog at source and destination
|
||||
fog = P_SpawnMobj (oldx, oldy, oldz, MT_TFOG);
|
||||
S_StartSound (fog, sfx_telept);
|
||||
an = m->angle >> ANGLETOFINESHIFT;
|
||||
fog = P_SpawnMobj (m->x+20*finecosine[an], m->y+20*finesine[an]
|
||||
, thing->z, MT_TFOG);
|
||||
|
||||
// emit sound, where?
|
||||
S_StartSound (fog, sfx_telept);
|
||||
|
||||
// don't move for a bit
|
||||
if (thing->player)
|
||||
thing->reactiontime = 18;
|
||||
|
||||
thing->angle = m->angle;
|
||||
thing->momx = thing->momy = thing->momz = 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
// Don't teleport if hit back of line,
|
||||
// so you can get out of teleporter.
|
||||
if( side == 1 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
tag = line->tag;
|
||||
for( i = 0; i < ::g->numsectors; i++ )
|
||||
{
|
||||
if( ::g->sectors[ i ].tag == tag )
|
||||
{
|
||||
thinker = ::g->thinkercap.next;
|
||||
for( thinker = ::g->thinkercap.next;
|
||||
thinker != &::g->thinkercap;
|
||||
thinker = thinker->next )
|
||||
{
|
||||
// not a mobj
|
||||
if( thinker->function.acp1 != ( actionf_p1 )P_MobjThinker )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
m = ( mobj_t* )thinker;
|
||||
|
||||
// not a teleportman
|
||||
if( m->type != MT_TELEPORTMAN )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sector = m->subsector->sector;
|
||||
// wrong sector
|
||||
if( sector -::g->sectors != i )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
oldx = thing->x;
|
||||
oldy = thing->y;
|
||||
oldz = thing->z;
|
||||
|
||||
if( !P_TeleportMove( thing, m->x, m->y ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
thing->z = thing->floorz; //fixme: not needed?
|
||||
if( thing->player )
|
||||
{
|
||||
thing->player->viewz = thing->z + thing->player->viewheight;
|
||||
}
|
||||
|
||||
// spawn teleport fog at source and destination
|
||||
fog = P_SpawnMobj( oldx, oldy, oldz, MT_TFOG );
|
||||
S_StartSound( fog, sfx_telept );
|
||||
an = m->angle >> ANGLETOFINESHIFT;
|
||||
fog = P_SpawnMobj( m->x + 20 * finecosine[an], m->y + 20 * finesine[an]
|
||||
, thing->z, MT_TFOG );
|
||||
|
||||
// emit sound, where?
|
||||
S_StartSound( fog, sfx_telept );
|
||||
|
||||
// don't move for a bit
|
||||
if( thing->player )
|
||||
{
|
||||
thing->reactiontime = 18;
|
||||
}
|
||||
|
||||
thing->angle = m->angle;
|
||||
thing->momx = thing->momy = thing->momz = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
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