diff --git a/doomsday/build/win32/jdoom_cl.rsp b/doomsday/build/win32/jdoom_cl.rsp index e1ca803433..1a1c72c577 100644 --- a/doomsday/build/win32/jdoom_cl.rsp +++ b/doomsday/build/win32/jdoom_cl.rsp @@ -4,6 +4,7 @@ ./../../plugins/common/src/dmu_lib.c ./../../plugins/common/src/m_multi.c ./../../plugins/common/src/mn_menu.c + ./../../plugins/jdoom/src/g_ctrl.c ./../../plugins/common/src/m_ctrl.c ./../../plugins/common/src/g_dglinit.c ./../../plugins/jdoom/src/d_api.c diff --git a/doomsday/build/win32/jheretic_cl.rsp b/doomsday/build/win32/jheretic_cl.rsp index 2083572279..7437d9d853 100644 --- a/doomsday/build/win32/jheretic_cl.rsp +++ b/doomsday/build/win32/jheretic_cl.rsp @@ -4,6 +4,7 @@ ./../../plugins/common/src/dmu_lib.c ./../../plugins/common/src/m_multi.c ./../../plugins/common/src/mn_menu.c + ./../../plugins/jheretic/src/g_ctrl.c ./../../plugins/common/src/m_ctrl.c ./../../plugins/common/src/g_dglinit.c ./../../plugins/jheretic/src/h_api.c @@ -16,6 +17,7 @@ ./../../plugins/common/src/p_xgfile.c ./../../plugins/common/src/p_view.c ./../../plugins/common/src/p_user.c + ./../../plugins/common/src/p_inventory.c ./../../plugins/common/src/p_tick.c ./../../plugins/jheretic/src/p_telept.c ./../../plugins/jheretic/src/p_switch.c diff --git a/doomsday/build/win32/jhexen_cl.rsp b/doomsday/build/win32/jhexen_cl.rsp index f8364f38ae..1918eeb2ed 100644 --- a/doomsday/build/win32/jhexen_cl.rsp +++ b/doomsday/build/win32/jhexen_cl.rsp @@ -4,11 +4,12 @@ ./../../plugins/common/src/dmu_lib.c ./../../plugins/common/src/m_multi.c ./../../plugins/common/src/mn_menu.c + ./../../plugins/jhexen/src/g_ctrl.c ./../../plugins/common/src/m_ctrl.c - ./../../plugins/common/src/g_update.c ./../../plugins/common/src/g_dglinit.c ./../../plugins/jhexen/src/x_api.c ./../../plugins/jhexen/src/hrefresh.c + ./../../plugins/common/src/g_update.c ./../../plugins/jhexen/src/hconsole.c ./../../plugins/jhexen/src/h2_main.c ./../../plugins/jhexen/src/h2_Actn.c @@ -20,6 +21,7 @@ ./../../plugins/common/src/p_actor.c ./../../plugins/common/src/p_player.c ./../../plugins/common/src/p_user.c + ./../../plugins/common/src/p_inventory.c ./../../plugins/jhexen/src/p_things.c ./../../plugins/jhexen/src/p_telept.c ./../../plugins/jhexen/src/p_switch.c diff --git a/doomsday/build/win32/vcbuild.bat b/doomsday/build/win32/vcbuild.bat index 02eb34fdb9..557077fec7 100644 --- a/doomsday/build/win32/vcbuild.bat +++ b/doomsday/build/win32/vcbuild.bat @@ -100,15 +100,14 @@ md %BIN_DIR% md %OBJ_DIR% GOTO Done - :: *** Resources (dialogs for Doomsday and drD3D) :: Requires rc.exe and cvtres.exe from the Platform SDK. :Res rc ./../../engine/win32/res/Doomsday.rc -cvtres /OUT:doomsday_res.obj /MACHINE:X86 ./../../engine/win32/doomsday.res +cvtres /OUT:%OBJ_DIR%doomsday_res.obj /MACHINE:X86 ./../../engine/win32/res/Doomsday.res rc ./../../plugins/d3d/res/drD3D.rc IF NOT EXIST %OBJ_DIR%/drD3D md %OBJ_DIR%/drD3D -cvtres /OUT:drD3D_res.obj /MACHINE:X86 ./../../plugins/d3d/res/drD3D.res +cvtres /OUT:%OBJ_DIR%/drD3D/drD3D_res.obj /MACHINE:X86 ./../../plugins/d3d/res/drD3D.res GOTO Done @@ -143,7 +142,7 @@ GOTO DONE :Doomsday CALL vcbuild checkdmt ECHO Compiling Doomsday.exe (Engine)... -cl %FLAGS% %INCS% %INCS_ENGINE_WIN32% %INCS_ENGINE_PORTABLE% %INCS_LZSS_PORTABLE% %INCS_LIBPNG_PORTABLE% %INCS_ZLIB% %INCS_PLUGIN_COMMON% %DEFINES% /D "__DOOMSDAY__" ./../../engine/win32/res/doomsday_res.obj @doomsday_cl.rsp /link /OUT:"./%BIN_DIR%/Doomsday.exe" /DEF:"./../../engine/api/doomsday.def" %LFLAGS% %LIBS% sdl_net.lib sdl.lib wsock32.lib %EXTERNAL%/libpng/win32/libpng.lib %EXTERNAL%/zlib/win32/libz.lib fmodvc.lib %EXTERNAL%/lzss/win32/lzss.lib dinput.lib dsound.lib eaxguid.lib dxguid.lib winmm.lib %EXTERNAL%/libpng/win32/libpng.lib %EXTERNAL%/zlib/win32/libz.lib %EXTERNAL%/lzss/win32/LZSS.lib gdi32.lib ole32.lib user32.lib +cl %FLAGS% %INCS% %INCS_ENGINE_WIN32% %INCS_ENGINE_PORTABLE% %INCS_LZSS_PORTABLE% %INCS_LIBPNG_PORTABLE% %INCS_ZLIB% %INCS_PLUGIN_COMMON% %DEFINES% /D "__DOOMSDAY__" ./%OBJ_DIR%/doomsday_res.obj @doomsday_cl.rsp /link /OUT:"./%BIN_DIR%/Doomsday.exe" /DEF:"./../../engine/api/doomsday.def" /IMPLIB:"./%BIN_DIR%/Doomsday.lib" %LFLAGS% %LIBS% sdl_net.lib sdl.lib wsock32.lib %EXTERNAL%/libpng/win32/libpng.lib %EXTERNAL%/zlib/win32/libz.lib fmodvc.lib %EXTERNAL%/lzss/win32/lzss.lib dinput.lib dsound.lib eaxguid.lib dxguid.lib winmm.lib %EXTERNAL%/libpng/win32/libpng.lib %EXTERNAL%/zlib/win32/libz.lib %EXTERNAL%/lzss/win32/LZSS.lib gdi32.lib ole32.lib user32.lib GOTO Done diff --git a/doomsday/plugins/common/include/am_map.h b/doomsday/plugins/common/include/am_map.h index 842e333166..c3d4f93cb1 100644 --- a/doomsday/plugins/common/include/am_map.h +++ b/doomsday/plugins/common/include/am_map.h @@ -98,21 +98,34 @@ void AM_Stop(void); #define WHITE (256-47) #define YOURCOLORS WHITE #define YOURRANGE 0 -#define WALLRANGE REDRANGE -#define TSWALLCOLORS GRAYS -#define TSWALLRANGE GRAYSRANGE -#define FDWALLRANGE BROWNRANGE -#define CDWALLRANGE YELLOWRANGE -#define THINGCOLORS GREENS -#define THINGRANGE GREENRANGE + +# ifdef __WOLFTC__ +# define WALLCOLORS GRAYS +# define WALLRANGE GRAYSRANGE +# define TSWALLCOLORS BROWNS +# define TSWALLRANGE BROWNRANGE +# define CDWALLCOLORS BROWNS +# define CDWALLRANGE BROWNRANGE +# define THINGCOLORS REDS +# define THINGRANGE REDRANGE +# else +# define WALLCOLORS REDS +# define WALLRANGE REDRANGE +# define TSWALLCOLORS GRAYS +# define TSWALLRANGE GRAYSRANGE +# define CDWALLCOLORS YELLOWS +# define CDWALLRANGE YELLOWRANGE +# define THINGCOLORS GREENS +# define THINGRANGE GREENRANGE +#endif + #define SECRETWALLCOLORS WALLCOLORS #define SECRETWALLRANGE WALLRANGE #define GRIDCOLORS (GRAYS + GRAYSRANGE/2) #define GRIDRANGE 0 #define XHAIRCOLORS GRAYS -#define WALLCOLORS REDS #define FDWALLCOLORS BROWNS -#define CDWALLCOLORS YELLOWS +#define FDWALLRANGE BROWNRANGE #define BORDEROFFSET 3 diff --git a/doomsday/plugins/common/include/g_common.h b/doomsday/plugins/common/include/g_common.h index dcd9dd9ab4..87093abf63 100644 --- a/doomsday/plugins/common/include/g_common.h +++ b/doomsday/plugins/common/include/g_common.h @@ -26,8 +26,6 @@ enum { void G_Register(void); void G_PreInit(void); void G_PostInit(void); -void G_BuildTiccmd(ticcmd_t *cmd, float elapsedTime); -void G_MergeTiccmd(ticcmd_t *dest, ticcmd_t *src); void G_StartTitle(void); void G_PostInit(void); void G_PreInit(void); diff --git a/doomsday/plugins/common/include/g_controls.h b/doomsday/plugins/common/include/g_controls.h new file mode 100644 index 0000000000..f3a86172c2 --- /dev/null +++ b/doomsday/plugins/common/include/g_controls.h @@ -0,0 +1,71 @@ +/* DE1: $Id: cl_def.h 3323 2006-06-13 17:25:33Z skyjake $ + * Copyright (C) 2005 Jaakko Kernen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not: http://www.opensource.org/ + */ + +/* + * g_controls.h: Common code for game controls + * + */ + +#ifndef __COMMON_CONTROLS_H__ +#define __COMMON_CONTROLS_H__ + +#include "p_ticcmd.h" +#include "mn_def.h" + +#define CTLCFG_TYPE void + +CTLCFG_TYPE SCControlConfig(int option, void *data); + +// Control flags. +#define CLF_ACTION 0x1 // The control is an action (+/- in front). +#define CLF_REPEAT 0x2 // Bind down + repeat. + +typedef struct { + char *command; // The command to execute. + int flags; + int bindClass; // Class it should be bound into + int defKey; // + int defMouse; // Zero means there is no default. + int defJoy; // +} Control_t; + +extern const Control_t controls[]; + +// Game registered bindClasses +enum { + GBC_CLASS1 = NUM_DDBINDCLASSES, + GBC_CLASS2, + GBC_CLASS3, + GBC_MENUHOTKEY, + GBC_CHAT, + GBC_MESSAGE +}; + +extern const Control_t *grabbing; + +void G_ControlRegister(void); +void G_DefaultBindings(void); +void G_BindClassRegistration(void); + +void G_BuildTiccmd(ticcmd_t *cmd, float elapsedTime); +void G_MergeTiccmd(ticcmd_t *dest, ticcmd_t *src); + +void G_LookAround(void); +boolean G_AdjustControlState(event_t* ev); +void G_ResetMousePos(void); + +#endif diff --git a/doomsday/plugins/common/include/hu_stuff.h b/doomsday/plugins/common/include/hu_stuff.h index 1d60ecff88..ba2844b70c 100644 --- a/doomsday/plugins/common/include/hu_stuff.h +++ b/doomsday/plugins/common/include/hu_stuff.h @@ -79,7 +79,15 @@ void WI_DrawParamText(int x, int y, char *string, dpatch_t * defFont, float defAlpha, boolean defCase, boolean defTypeIn, int halign); +void M_WriteText(int x, int y, char *string); +void M_WriteText2(int x, int y, char *string, dpatch_t *font, float red, + float green, float blue, float alpha); +void M_WriteText3(int x, int y, const char *string, dpatch_t *font, + float red, float green, float blue, float alpha, + boolean doTypeIn, int initialCount); + int M_DrawText(int x, int y, boolean direct, char *string); +void M_DrawTitle(char *text, int y); int M_StringWidth(char *string, dpatch_t * font); int M_StringHeight(char *string, dpatch_t * font); diff --git a/doomsday/plugins/common/include/p_inventory.h b/doomsday/plugins/common/include/p_inventory.h new file mode 100644 index 0000000000..7c04c7714c --- /dev/null +++ b/doomsday/plugins/common/include/p_inventory.h @@ -0,0 +1,64 @@ +/* DE1: $Id: template.c 2645 2006-01-21 12:58:39Z skyjake $ + * Copyright (C) 1999- Activision + * + * This program is covered by the HERETIC / HEXEN (LIMITED USE) source + * code license; you can redistribute it and/or modify it under the terms + * of the HERETIC / HEXEN source code license as published by Activision. + * + * THIS MATERIAL IS NOT MADE OR SUPPORTED BY ACTIVISION. + * + * WARRANTY INFORMATION. + * This program is provided as is. Activision and it's affiliates make no + * warranties of any kind, whether oral or written , express or implied, + * including any warranty of merchantability, fitness for a particular + * purpose or non-infringement, and no other representations or claims of + * any kind shall be binding on or obligate Activision or it's affiliates. + * + * LICENSE CONDITIONS. + * You shall not: + * + * 1) Exploit this Program or any of its parts commercially. + * 2) Use this Program, or permit use of this Program, on more than one + * computer, computer terminal, or workstation at the same time. + * 3) Make copies of this Program or any part thereof, or make copies of + * the materials accompanying this Program. + * 4) Use the program, or permit use of this Program, in a network, + * multi-user arrangement or remote access arrangement, including any + * online use, except as otherwise explicitly provided by this Program. + * 5) Sell, rent, lease or license any copies of this Program, without + * the express prior written consent of Activision. + * 6) Remove, disable or circumvent any proprietary notices or labels + * contained on or within the Program. + * + * You should have received a copy of the HERETIC / HEXEN source code + * license along with this program (Ravenlic.txt); if not: + * http://www.ravensoft.com/ + */ + +/* + * p_inventory.h: Common code for player inventory + * + */ + +#ifndef __COMMON_INVENTORY_H__ +#define __COMMON_INVENTORY_H__ + +extern boolean artiskip; +extern boolean usearti; +extern int inv_ptr; + +boolean P_GiveArtifact(player_t *player, artitype_e arti, mobj_t *mo); + +void P_InventoryRemoveArtifact(player_t *player, int slot); +boolean P_InventoryUseArtifact(player_t *player, artitype_e arti); +void P_InventoryNextArtifact(player_t *player); + +#if __JHERETIC__ +void P_InventoryCheckReadyArtifact(player_t *player); +#endif + +boolean P_UseArtifactOnPlayer(player_t *player, artitype_e arti); + +DEFCC(CCmdInventory); + +#endif diff --git a/doomsday/plugins/common/include/p_mapsetup.h b/doomsday/plugins/common/include/p_mapsetup.h index bc4dd8dfea..1096a699d2 100644 --- a/doomsday/plugins/common/include/p_mapsetup.h +++ b/doomsday/plugins/common/include/p_mapsetup.h @@ -37,7 +37,6 @@ extern int numthings; #endif void P_SetupLevel(int episode, int map, int playermask, skill_t skill); -void P_LocateMapLumps(int episode, int map, int *lumpIndices); #endif diff --git a/doomsday/plugins/common/include/p_start.h b/doomsday/plugins/common/include/p_start.h index 0786ffeb3a..4c5f5d6502 100644 --- a/doomsday/plugins/common/include/p_start.h +++ b/doomsday/plugins/common/include/p_start.h @@ -1,3 +1,25 @@ +/* DE1: $Id$ + * Copyright (C) 2005 Jaakko Kernen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not: http://www.opensource.org/ + */ + +/* + * p_start.h: Common playsim code relating to (re)spawn of map objects + * and map setup. + */ + #ifndef __COMMON_PLAYSTART_H__ #define __COMMON_PLAYSTART_H__ @@ -14,7 +36,7 @@ boolean P_FuzzySpawn(thing_t * spot, int playernum, thing_t *P_GetPlayerStart(int group, int pnum); void P_DealPlayerStarts(void); void P_SpawnPlayers(void); + void P_GetMapLumpName(int episode, int map, char *lumpName); -void P_LocateMapLumps(int episode, int map, int *lumpIndices); #endif diff --git a/doomsday/plugins/common/src/d_net.c b/doomsday/plugins/common/src/d_net.c index d02816ccc1..a8822840c8 100644 --- a/doomsday/plugins/common/src/d_net.c +++ b/doomsday/plugins/common/src/d_net.c @@ -16,7 +16,9 @@ */ /* - * Common code related to net games. Connecting to/from a netgame server. + * d_net.c : Common code related to net games. + + * Connecting to/from a netgame server. * Netgame events (player and world) and netgame commands. */ @@ -37,10 +39,7 @@ #elif __JHEXEN__ # include "jhexen.h" #elif __JSTRIFE__ -# include "h2def.h" -# include "p_local.h" -# include "soundst.h" -# include "d_config.h" +# include "jstrife.h" #endif #include "g_common.h" @@ -152,12 +151,12 @@ int D_NetServerStarted(int before) deathmatch = cfg.netDeathmatch; nomonsters = cfg.netNomonsters; + cfg.jumpEnabled = cfg.netJumping; + #if __JDOOM__ respawnparm = cfg.netRespawn; - cfg.jumpEnabled = cfg.netJumping; #elif __JHERETIC__ respawnparm = cfg.netRespawn; - cfg.jumpEnabled = cfg.netJumping; #elif __JHEXEN__ randomclass = cfg.netRandomclass; #endif @@ -285,13 +284,6 @@ long int D_NetPlayerEvent(int plrNumber, int peType, void *data) else if(peType == DDPE_EXIT) { Con_Message("PE: player %i has left.\n", plrNumber); - // Spawn a teleport fog. - /*P_SpawnTeleFog(players[plrNumber].plr->mo->x, - players[plrNumber].plr->mo->y); - // Let's get rid of the mobj. - P_RemoveMobj(players[plrNumber].plr->mo); - players[plrNumber].plr->mo = NULL; - players[plrNumber].playerstate = PST_REBORN; */ players[plrNumber].playerstate = PST_GONE; @@ -703,13 +695,7 @@ DEFCC(CCmdSetMap) // Only the server can change the map. if(!IS_SERVER) return false; -#ifdef __JDOOM__ - if(argc != 3) - { - Con_Printf("Usage: %s (episode) (map)\n", argv[0]); - return true; - } -#elif __JHERETIC__ +#if __JDOOM__ || __JHERETIC__ if(argc != 3) { Con_Printf("Usage: %s (episode) (map)\n", argv[0]); @@ -727,14 +713,10 @@ DEFCC(CCmdSetMap) deathmatch = cfg.netDeathmatch; nomonsters = cfg.netNomonsters; -#ifdef __JDOOM__ - respawnparm = cfg.netRespawn; cfg.jumpEnabled = cfg.netJumping; - ep = atoi(argv[1]); - map = atoi(argv[2]); -#elif __JHERETIC__ + +#if __JDOOM__ || __JHERETIC__ respawnparm = cfg.netRespawn; - cfg.jumpEnabled = cfg.netJumping; ep = atoi(argv[1]); map = atoi(argv[2]); #elif __JSTRIFE__ diff --git a/doomsday/plugins/common/src/d_netcl.c b/doomsday/plugins/common/src/d_netcl.c index 083cc730b9..47bb3f2020 100644 --- a/doomsday/plugins/common/src/d_netcl.c +++ b/doomsday/plugins/common/src/d_netcl.c @@ -15,6 +15,10 @@ * along with this program; if not: http://www.opensource.org/ */ +/* + * d_netcl.c : Common code related to net games (client-side). + */ + // HEADER FILES ------------------------------------------------------------ #ifdef __JDOOM__ @@ -32,9 +36,7 @@ #elif __JHEXEN__ # include "jhexen.h" #elif __JSTRIFE__ -# include "h2def.h" -# include "p_local.h" -# include "d_config.h" +# include "jstrife.h" #endif #include "am_map.h" @@ -56,8 +58,6 @@ // EXTERNAL DATA DECLARATIONS ---------------------------------------------- -extern char msgbuff[256]; - // PUBLIC DATA DEFINITIONS ------------------------------------------------- // PRIVATE DATA DEFINITIONS ------------------------------------------------ @@ -124,9 +124,7 @@ void NetCl_UpdateGameState(byte *data) byte gsDeathmatch = 0; byte gsMonsters = 0; byte gsRespawn = 0; -#ifndef __JHEXEN__ byte gsJumping = 0; -#endif byte gsSkill = 0; fixed_t gsGravity = 0; @@ -137,8 +135,8 @@ void NetCl_UpdateGameState(byte *data) gsDeathmatch = data[4] & 0x3; gsMonsters = (data[4] & 0x4? true : false); gsRespawn = (data[4] & 0x8? true : false); -#if __JDOOM__ || __JHERETIC__ gsJumping = (data[4] & 0x10? true : false); +#if __JDOOM__ || __JHERETIC__ gsSkill = (data[4] >> 5); #else gsSkill = data[5] & 0x7; @@ -169,18 +167,15 @@ void NetCl_UpdateGameState(byte *data) Con_Message("Game state: Map=%i Skill=%i %s\n", gsMap, gsSkill, deathmatch == 1 ? "Deathmatch" : deathmatch == 2 ? "Deathmatch2" : "Co-op"); - Con_Message(" Respawn=%s Monsters=%s Gravity=%.1f\n", - respawnparm ? "yes" : "no", !nomonsters ? "yes" : "no", - FIX2FLT(gsGravity)); #else Con_Message("Game state: Map=%i Episode=%i Skill=%i %s\n", gsMap, gsEpisode, gsSkill, deathmatch == 1 ? "Deathmatch" : deathmatch == 2 ? "Deathmatch2" : "Co-op"); +#endif Con_Message(" Respawn=%s Monsters=%s Jumping=%s Gravity=%.1f\n", respawnparm ? "yes" : "no", !nomonsters ? "yes" : "no", gsJumping ? "yes" : "no", FIX2FLT(gsGravity)); -#endif #ifdef __JHERETIC__ prevmap = gamemap; @@ -231,7 +226,7 @@ void NetCl_UpdateGameState(byte *data) P_CheckPosition(mo, mo->pos[VX], mo->pos[VY]); #endif mo->floorz = tmfloorz; - mo->ceilingz = tmceilingz; + mo->ceilingz = tmceilingz; } else // mo == NULL { @@ -355,7 +350,7 @@ void NetCl_UpdatePlayerState(byte *data, int plrNum) } # if __JHERETIC__ if(plrNum == consoleplayer) - P_CheckReadyArtifact(); + P_InventoryCheckReadyArtifact(&players[consoleplayer]); # endif } #endif diff --git a/doomsday/plugins/common/src/d_netsv.c b/doomsday/plugins/common/src/d_netsv.c index 5022d00356..ba2ee3c0e8 100644 --- a/doomsday/plugins/common/src/d_netsv.c +++ b/doomsday/plugins/common/src/d_netsv.c @@ -15,6 +15,10 @@ * along with this program; if not: http://www.opensource.org/ */ +/* + * d_netsv.c : Common code related to net games (server-side). + */ + // HEADER FILES ------------------------------------------------------------ #include @@ -26,7 +30,6 @@ # include "d_config.h" # include "s_sound.h" # include "st_stuff.h" -# include "m_random.h" # include "dstrings.h" # include "m_cheat.h" # include "g_common.h" @@ -35,9 +38,7 @@ #elif __JHEXEN__ # include "jhexen.h" #elif __JSTRIFE__ -# include "h2def.h" -# include "p_local.h" -# include "d_config.h" +# include "jstrife.h" #endif #include "d_net.h" @@ -145,10 +146,9 @@ void NetSv_UpdateGameConfig(void) strcat(gameConfigString, " nomonst"); if(respawnparm) strcat(gameConfigString, " respawn"); -#if !__JHEXEN__ + if(cfg.jumpEnabled) strcat(gameConfigString, " jump"); -#endif } /* @@ -232,10 +232,6 @@ void NetSv_Ticker(void) int i, red, palette; float power; -#if __JDOOM__ - int bz; -#endif - // Map rotation checker. NetSv_CheckCycling(); @@ -254,6 +250,7 @@ void NetSv_Ticker(void) #ifdef __JDOOM__ if(plr->powers[pw_strength]) { + int bz; // Slowly fade the berzerk out. bz = 12 - (plr->powers[pw_strength] >> 6); if(bz > red) @@ -307,14 +304,8 @@ void NetSv_Ticker(void) plr->plr->flags |= DDPF_FILTER; oldPals[i] = palette; } -#if __JDOOM__ - plr->plr->filter = D_GetFilterColor(palette); -#elif __JHERETIC__ - plr->plr->filter = H_GetFilterColor(palette); -#else /*__JHEXEN__*/ - plr->plr->filter = H2_GetFilterColor(palette); -#endif + plr->plr->filter = R_GetFilterColor(palette); } #if !__JDOOM__ @@ -813,13 +804,6 @@ void NetSv_SendGameState(int flags, int to) // The contents of the game state package are a bit messy // due to compatibility with older versions. - /*byte setup[16]; - Con_Message("Sizeof(gs)=%i\n", sizeof(packet_gamestate_t)); - Con_Message("Sent game state packet (len=%i):\n", ptr - buffer); - for(k = 0; k < ptr - buffer; ++k) - Con_Message("%02x ", buffer[k]); - Con_Message("\n");*/ - #ifdef __JDOOM__ ptr[0] = gamemode; #else @@ -831,8 +815,8 @@ void NetSv_SendGameState(int flags, int to) ptr[4] = (deathmatch & 0x3) | (!nomonsters? 0x4 : 0) | (respawnparm? 0x8 : 0) -#if __JDOOM__ || __JHERETIC__ | (cfg.jumpEnabled? 0x10 : 0) +#if __JDOOM__ || __JHERETIC__ | (gameskill << 5); #else ; @@ -846,33 +830,9 @@ void NetSv_SendGameState(int flags, int to) ptr[6] = (GRAVITY >> 8) & 0xff; // low byte ptr[7] = (GRAVITY >> 16) & 0xff; // high byte memset(ptr + 8, 0, 8); - /* - Con_Message("Alternative state packet:\n"); - for(k = 0; k < gameStateSize; ++k) - Con_Message("%02x ", setup[k]); - Con_Message("\n"); - */ ptr += gameStateSize; -#if 0 -#ifdef __JDOOM__ - gs->gamemode = gamemode; -#endif - gs->flags = flags; - gs->episode = gameepisode; - gs->map = gamemap; - gs->skill = gameskill; - gs->deathmatch = deathmatch; - gs->monsters = !nomonsters; - gs->respawn = respawnparm; -#if __JDOOM__ || __JHERETIC__ - gs->jumping = cfg.jumpEnabled; -#endif - gs->gravity = SHORT((GRAVITY >> 8) & 0xffff); - ptr += sizeof(packet_gamestate_t); -#endif // #if 0 - if(flags & GSF_CAMERA_INIT) { mobj_t *mo = players[i].plr->mo; @@ -1064,12 +1024,10 @@ void NetSv_SendPlayerState(int srcPlrNum, int destPlrNum, int flags, } if(flags & PSF_AMMO) { -#if __JHEXEN__ || __JSTRIFE__ - // 200 is the mana limit for Hexen. for(i = 0; i < NUMAMMO; i++) +#if __JHEXEN__ || __JSTRIFE__ *ptr++ = pl->ammo[i]; #else - for(i = 0; i < NUMAMMO; i++) WRITE_SHORT(ptr, pl->ammo[i]); #endif } @@ -1117,14 +1075,6 @@ void NetSv_SendPlayerState(int srcPlrNum, int destPlrNum, int flags, } #endif - /*Con_Printf( "PlrUpd (%i bytes, flags=%x):\n", ptr-buffer, flags); - for(i=0; i // required for sqrt, fabs #if __JDOOM__ +# include "d_action.h" # include "doomdef.h" # include "doomstat.h" # include "d_config.h" # include "d_player.h" # include "p_local.h" -# include "m_ctrl.h" #elif __JHERETIC__ # include "jheretic.h" #elif __JHEXEN__ # include "jhexen.h" +#elif __JSTRIFE__ +# include "jstrife.h" #endif +#include "g_controls.h" + // MACROS ------------------------------------------------------------------ -#if __JDOOM__ -# define TURBOTHRESHOLD 0x32 +#if __JDOOM__ || __JHERETIC__ +# define GOTWPN(x) (cplr->weaponowned[x]) +# define ISWPN(x) (cplr->readyweapon == x) #endif #define SLOWTURNTICS 6 -#define NUMGKEYS 256 #define JOY(x) (x) / (100) -#define NUM_MOUSE_BUTTONS 6 // TYPES ------------------------------------------------------------------- @@ -80,14 +83,6 @@ ArtifactHotkeys[] = boolean P_IsPaused(void); -#if __JHERETIC__ || __JHEXEN__ || __JSTRIFE__ -boolean inventoryMove(player_t *plr, int dir); -#endif - -#if __JHEXEN__ -void P_PlayerNextArtifact(player_t *player); -#endif - // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- @@ -98,15 +93,6 @@ static void G_UpdateCmdControls(ticcmd_t *cmd, float elapsedTime); extern boolean sendpause; -#if __JHERETIC__ || __JHEXEN__ -extern boolean inventory; -extern boolean artiskip; -#endif - -#if __JHERETIC__ -extern int inv_ptr; -#endif - // PUBLIC DATA DEFINITIONS ------------------------------------------------- // Binding classes (for the dynamic event responder chain) @@ -143,8 +129,6 @@ int dclicktime2; int dclickstate2; int dclicks2; -boolean usearti = true; - // PRIVATE DATA DEFINITIONS ------------------------------------------------ static int joymove[NUM_JOYSTICK_AXES]; @@ -191,6 +175,8 @@ cvar_t controlCVars[] = { #if !__JDOOM__ {"ctl-use-immediate", 0, CVT_INT, &cfg.chooseAndUse, 0, 1, "1=Use items immediately from the inventory."}, + {"ctl-use-next", 0, CVT_INT, &cfg.inventoryNextOnUnuse, 0, 1, + "1=Automatically select the next inventory item when unusable."}, #endif {"ctl-look-speed", 0, CVT_FLOAT, &cfg.lookSpeed, 1, 5, @@ -305,6 +291,7 @@ void G_DefaultBindings(void) * Offset is in 'angles', where 110 corresponds 85 degrees. * The delta has higher precision with small offsets. */ +#if 0 char G_MakeLookDelta(float offset) { boolean minus = offset < 0; @@ -319,12 +306,13 @@ char G_MakeLookDelta(float offset) offset = -128; return (signed char) offset; } +#endif /* * Turn client angle. If 'elapsed' is negative, the turn delta is * considered an immediate change. */ -void G_AdjustAngle(player_t *player, int turn, float elapsed) +static void G_AdjustAngle(player_t *player, int turn, float elapsed) { fixed_t delta = 0; @@ -340,7 +328,7 @@ void G_AdjustAngle(player_t *player, int turn, float elapsed) player->plr->clAngle += delta; } -void G_AdjustLookDir(player_t *player, int look, float elapsed) +static void G_AdjustLookDir(player_t *player, int look, float elapsed) { ddplayer_t *ddplr = player->plr; @@ -410,7 +398,7 @@ void G_LookAround(void) } } -void G_SetCmdViewAngles(ticcmd_t *cmd, player_t *pl) +static void G_SetCmdViewAngles(ticcmd_t *cmd, player_t *pl) { // These will be sent to the server (or P_MovePlayer). cmd->angle = pl->plr->clAngle >> 16; @@ -507,11 +495,7 @@ static void G_UpdateCmdControls(ticcmd_t *cmd, float elapsedTime) int *axes[5] = { 0, &joyfwd, &joyturn, &joystrafe, &joylook }; int look = 0, lspeed = 0; int flyheight = 0; -#if __JHEXEN__ || __JSTRIFE__ int pClass = players[consoleplayer].class; -#else - int pClass = 0; -#endif // Check the joystick axes. for(i = 0; i < 8; i++) @@ -650,20 +634,19 @@ static void G_UpdateCmdControls(ticcmd_t *cmd, float elapsedTime) if(players[consoleplayer].inventory[inv_ptr].type != arti_none) { actions[A_USEARTIFACT].on = false; -#if __JHERETIC__ - cmd->arti = 0xff; // skip artifact code -#else - P_PlayerNextArtifact(&players[consoleplayer]); -#endif + + cmd->arti = 0xff; } } else { - if(inventory) + if(ST_IsInventoryVisible()) { players[consoleplayer].readyArtifact = players[consoleplayer].inventory[inv_ptr].type; - inventory = false; + + ST_Inventory(false); // close the inventory + if(cfg.chooseAndUse) cmd->arti = players[consoleplayer].inventory[inv_ptr].type; @@ -789,10 +772,6 @@ static void G_UpdateCmdControls(ticcmd_t *cmd, float elapsedTime) cmd->jump = true; #if __JDOOM__ - -# define GOTWPN(x) (cplr->weaponowned[x]) -# define ISWPN(x) (cplr->readyweapon == x) - // Determine whether a weapon change should be done. if(actions[A_WEAPONCYCLE1].on) // Fist/chainsaw. { @@ -823,10 +802,6 @@ static void G_UpdateCmdControls(ticcmd_t *cmd, float elapsedTime) } else #elif __JHERETIC__ - -# define GOTWPN(x) (cplr->weaponowned[x]) -# define ISWPN(x) (cplr->readyweapon == x) - // Determine whether a weapon change should be done. if(actions[A_WEAPONCYCLE1].on) // Staff/Gauntlets. { @@ -845,11 +820,7 @@ static void G_UpdateCmdControls(ticcmd_t *cmd, float elapsedTime) #endif { // Take the first weapon action. -#if __JHERETIC__ - for(i = 0; i < NUMWEAPONS - 2; i++) -#else for(i = 0; i < NUMWEAPONS; i++) -#endif if(actions[A_WEAPON1 + i].on) { cmd->changeWeapon = i + 1; @@ -957,7 +928,7 @@ static void G_UpdateCmdControls(ticcmd_t *cmd, float elapsedTime) } } - mousex = mousey = 0; + G_ResetMousePos(); #define MAXPLMOVE PCLASS_INFO(pClass)->maxmove @@ -1094,14 +1065,3 @@ void G_ResetMousePos(void) { mousex = mousey = 0; } - -#if __JHERETIC__ || __JHEXEN__ || __JSTRIFE__ -/* - * Move the inventory selector - */ -DEFCC(CCmdInventory) -{ - inventoryMove(players + consoleplayer, !stricmp(argv[0], "invright")); - return true; -} -#endif diff --git a/doomsday/plugins/common/src/g_game.c b/doomsday/plugins/common/src/g_game.c index a8566d5ac0..c9e28bd618 100644 --- a/doomsday/plugins/common/src/g_game.c +++ b/doomsday/plugins/common/src/g_game.c @@ -1,14 +1,22 @@ +/* $Id$ + * + * Copyright (C) 1993-1996 by id Software, Inc. + * + * This source is available for distribution and/or modification + * only under the terms of the DOOM Source Code License as + * published by id Software. All rights reserved. + * + * The source is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License + * for more details. + */ -//************************************************************************** -//** -//** G_GAME.C -//** -//** Top-level game routines. -//** Compiles for jDoom, jHeretic and jHexen. -//** -//** Could use a LOT of tidying up! -//** -//************************************************************************** +/* + * g_game.c : Top-level game routines. + * + * Compiles for jDoom, jHeretic and jHexen. + */ // HEADER FILES ------------------------------------------------------------ #include @@ -22,11 +30,7 @@ # include "d_action.h" # include "d_config.h" # include "m_argv.h" -//# include "../engine/portable/include/m_misc.h" -# include "m_menu.h" -# include "m_random.h" # include "p_local.h" -//# include "p_tick.h" # include "wi_stuff.h" # include "st_stuff.h" # include "s_sound.h" @@ -41,12 +45,10 @@ #elif __JHEXEN__ # include # include -# include # include "jhexen.h" #elif __JSTRIFE__ # include # include -# include # include "h2def.h" # include "p_local.h" # include "soundst.h" @@ -55,10 +57,14 @@ # include "st_stuff.h" #endif +#include "g_controls.h" #include "p_mapsetup.h" #include "am_map.h" #include "hu_stuff.h" #include "hu_msg.h" +#if !__JHEXEN__ +# include "m_menu.h" +#endif #include "g_common.h" #include "g_update.h" #include "d_net.h" @@ -110,12 +116,6 @@ MonsterMissileInfo[] = // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- -void G_DefaultBindings(void); -void G_BindClassRegistration(void); -void G_ResetMousePos(void); -boolean G_AdjustControlState(event_t* ev); -void G_LookAround(void); - boolean cht_Responder(event_t *ev); boolean M_EditResponder(event_t *ev); @@ -134,8 +134,6 @@ void HU_UpdatePsprites(void); void G_ConsoleRegistration(void); void DetectIWADs(void); -void G_ControlRegister(void); - // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- void G_PlayerReborn(int player); @@ -167,26 +165,13 @@ void G_StopDemo(void); // EXTERNAL DATA DECLARATIONS ---------------------------------------------- #if __JDOOM__ -extern char *pagename; extern GameMission_t gamemission; #endif -#if __JHERETIC__ || __JHEXEN__ || __JSTRIFE__ -extern boolean inventory; -extern int curpos; -extern boolean usearti; -extern int inv_ptr; -extern boolean artiskip; -#endif - #if __JHERETIC__ extern int playerkeys; #endif -extern int povangle; -extern float targetLookOffset; -extern float lookOffset; - extern char *borderLumps[]; // PUBLIC DATA DEFINITIONS ------------------------------------------------- @@ -219,21 +204,10 @@ boolean respawnmonsters; int prevmap; #endif -#if __JDOOM__ || __JHERETIC__ -skill_t d_skill; -int d_episode; -int d_map; -#endif - boolean paused; boolean sendpause; // send a pause event next tic boolean usergame; // ok to save / end game -boolean timingdemo; // if true, exit with report on completion -boolean nodrawers; // for comparative timing purposes -boolean noblit; // for comparative timing purposes -int starttime; // for comparative timing purposes - boolean viewactive; boolean deathmatch; // only if started as net death @@ -259,13 +233,7 @@ mobj_t *bodyque[BODYQUESIZE]; int bodyqueslot; #endif -#if __JHERETIC__ || __JHEXEN__ || __JSTRIFE__ -int inventoryTics; -#endif - #if __JHEXEN__ || __JSTRIFE__ -byte demoDisabled = 0; // is demo playing disabled? - // Position indicator for cooperative net-play reborn int RebornPosition; int LeaveMap; @@ -572,10 +540,11 @@ cvar_t gamestatusCVars[] = // PRIVATE DATA DEFINITIONS ------------------------------------------------ +static skill_t d_skill; +static int d_episode; +static int d_map; + #if __JHEXEN__ || __JSTRIFE__ -static skill_t TempSkill; -static int TempEpisode; -static int TempMap; static int GameLoadSlot; #endif @@ -696,57 +665,6 @@ void G_StartTitle(void) FI_Start(script, FIMODE_LOCAL); } -#if __JHERETIC__ || __JHEXEN__ || __JSTRIFE__ -boolean inventoryMove(player_t *plr, int dir) -{ - inventoryTics = (int) (cfg.inventoryTimer * TICSPERSEC); - if(inventoryTics < 1) - inventoryTics = 1; - - if(!inventory) - { - inventory = true; - return (false); - } - - if(dir == 0) - { - inv_ptr--; - if(inv_ptr < 0) - { - inv_ptr = 0; - } - else - { - curpos--; - if(curpos < 0) - { - curpos = 0; - } - } - } - else - { - inv_ptr++; - if(inv_ptr >= plr->inventorySlotNum) - { - inv_ptr--; - if(inv_ptr < 0) - inv_ptr = 0; - } - else - { - curpos++; - if(curpos > 6) - { - curpos = 6; - } - } - } - return (true); -} -#endif - void G_DoLoadLevel(void) { action_t *act; @@ -789,7 +707,6 @@ void G_DoLoadLevel(void) P_SetupLevel(gameepisode, gamemap, 0, gameskill); Set(DD_DISPLAYPLAYER, consoleplayer); // view the guy you are playing - starttime = Sys_GetTime(); gameaction = ga_nothing; Z_CheckHeap(); @@ -842,7 +759,7 @@ boolean G_Responder(event_t *ev) if(!actions[A_USEARTIFACT].on) { // flag to denote that it's okay to use an artifact - if(!inventory) + if(!ST_IsInventoryVisible()) { plr->readyArtifact = plr->inventory[inv_ptr].type; } @@ -891,22 +808,6 @@ boolean G_Responder(event_t *ev) return false; } -#if __JHERETIC__ || __JHEXEN__ || __JSTRIFE__ -void G_InventoryTicker(void) -{ - if(!players[consoleplayer].plr->ingame) - return; - - // turn inventory off after a certain amount of time - if(inventory && !(--inventoryTics)) - { - players[consoleplayer].readyArtifact = - players[consoleplayer].inventory[inv_ptr].type; - inventory = false; - } -} -#endif - void G_SpecialButton(player_t *pl) { if(pl->plr->ingame) @@ -1024,10 +925,6 @@ void G_Ticker(void) // Update the viewer's look angle G_LookAround(); -#if __JHERETIC__ || __JHEXEN__ || __JSTRIFE__ - G_InventoryTicker(); -#endif - // Enable/disable sending of frames (delta sets) to clients. Set(DD_ALLOW_FRAMES, gamestate == GS_LEVEL); if(!IS_CLIENT) @@ -1097,27 +994,26 @@ void G_Ticker(void) #endif // armor #if __JHEXEN__ - gsvArmor = FixedDiv( - PCLASS_INFO(plyr->class)->autoarmorsave + plyr->armorpoints[ARMOR_ARMOR] + - plyr->armorpoints[ARMOR_SHIELD] + - plyr->armorpoints[ARMOR_HELMET] + - plyr->armorpoints[ARMOR_AMULET], 5 * FRACUNIT) >> FRACBITS; + gsvArmor = FixedDiv(PCLASS_INFO(plyr->class)->autoarmorsave + + plyr->armorpoints[ARMOR_ARMOR] + + plyr->armorpoints[ARMOR_SHIELD] + + plyr->armorpoints[ARMOR_HELMET] + + plyr->armorpoints[ARMOR_AMULET], 5 * FRACUNIT) >> FRACBITS; #else gsvArmor = plyr->armorpoints; #endif // owned keys + for(i = 0; i < NUMKEYS; i++) #if __JHEXEN__ - for( i= 0; i < NUMKEYS; i++) gsvKeys[i] = (plyr->keys & (1 << i))? 1 : 0; #else - for( i= 0; i < NUMKEYS; i++) gsvKeys[i] = plyr->keys[i]; #endif // current weapon gsvCurrentWeapon = plyr->readyweapon; // owned weapons - for( i= 0; i < NUMWEAPONS; i++) + for(i = 0; i < NUMWEAPONS; i++) gsvWeapons[i] = plyr->weaponowned[i]; #if __JHEXEN__ @@ -1128,12 +1024,12 @@ void G_Ticker(void) gsvWPieces[3] = (plyr->pieces == 7)? 1 : 0; #endif // current ammo amounts - for( i= 0; i < NUMAMMO; i++) + for(i = 0; i < NUMAMMO; i++) gsvAmmo[i] = plyr->ammo[i]; #if __JHERETIC__ || __JHEXEN__ // artifacts - for( i= 0; i < NUMINVENTORYSLOTS; i++) + for(i = 0; i < NUMINVENTORYSLOTS; i++) gsvArtifacts[plyr->inventory[i].type] = plyr->inventory[i].count; #endif } @@ -1211,7 +1107,7 @@ void G_PlayerExitMap(int player) p->powers[pw_flight] = 0; for(i = 0; i < MAXARTICOUNT; i++) - P_PlayerUseArtifact(p, arti_fly); + P_InventoryUseArtifact(p, arti_fly); } #endif // Remove their powers. @@ -1409,69 +1305,6 @@ void G_PlayerReborn(int player) p->plr->flags &= ~DDPF_DEAD; } -/* - * Spawns a player at one of the random death match spots - * called at level load and each death - */ -void G_DeathMatchSpawnPlayer(int playernum) -{ - int i, j; - int selections; - thing_t faraway; - boolean using_dummy = false; - ddplayer_t *pl = players[playernum].plr; - - // Spawn player initially at a distant location. - if(!pl->mo) - { - faraway.x = faraway.y = DDMAXSHORT; - faraway.angle = 0; - P_SpawnPlayer(&faraway, playernum); - using_dummy = true; - } - - // Now let's find an available deathmatch start. - selections = deathmatch_p - deathmatchstarts; - if(selections < 2) - Con_Error("Only %i deathmatch spots, 2 required", selections); - - for(j = 0; j < 20; j++) - { - i = P_Random() % selections; - if(P_CheckSpot(playernum, &deathmatchstarts[i], true)) - { -#if __JHERETIC__ || __JHEXEN__ || __JSTRIFE__ - deathmatchstarts[i].type = playernum + 1; -#endif - break; - } - } - if(using_dummy) - { - // Destroy the dummy. - P_RemoveMobj(pl->mo); - pl->mo = NULL; - } - P_SpawnPlayer(&deathmatchstarts[i], playernum); - -#if __JDOOM__ || __JHERETIC__ - // Gib anything at the spot. - P_Telefrag(players[playernum].plr->mo); -#endif -} - -/* - * Spawns the given player at a dummy place. - */ -void G_DummySpawnPlayer(int playernum) -{ - thing_t faraway; - - faraway.x = faraway.y = DDMAXSHORT; - faraway.angle = (short) 0; - P_SpawnPlayer(&faraway, playernum); -} - #ifdef __JDOOM__ void G_QueueBody(mobj_t *body) { @@ -1490,11 +1323,10 @@ void G_DoReborn(int playernum) boolean oldWeaponowned[NUMWEAPONS]; int oldKeys; int oldPieces; - boolean foundSpot; int bestWeapon; -#else - thing_t *assigned; #endif + boolean foundSpot; + thing_t *assigned; // Clear the currently playing script, if any. FI_Reset(); @@ -1506,11 +1338,11 @@ void G_DoReborn(int playernum) #if __JHEXEN__ || __JSTRIFE__ if(SV_HxRebornSlotAvailable()) - { // Use the reborn code if the slot is available + { // Use the reborn code if the slot is available gameaction = ga_singlereborn; } else - { // Start a new game if there's no reborn info + { // Start a new game if there's no reborn info gameaction = ga_newgame; } #else @@ -1550,27 +1382,35 @@ void G_DoReborn(int playernum) oldWeaponowned[i] = players[playernum].weaponowned[i]; #endif -#if __JDOOM__ || __JHERETIC__ // Try to spawn at the assigned spot. - assigned = &playerstarts[players[playernum].startspot]; + foundSpot = false; + assigned = P_GetPlayerStart( +#if __JHEXEN__ || __JSTRIFE__ + RebornPosition, +#else + 0, +#endif + playernum); if(P_CheckSpot(playernum, assigned, true)) { - Con_Printf("- spawning at assigned spot %i.\n", - players[playernum].startspot); + // Appropriate player start spot is open + Con_Printf("- spawning at assigned spot\n"); P_SpawnPlayer(assigned, playernum); - return; + foundSpot = true; } -#elif __JHEXEN__ || __JSTRIFE__ - foundSpot = false; - // Try to spawn at the assigned spot. - if(P_CheckSpot - (playernum, P_GetPlayerStart(RebornPosition, playernum), true)) +#if __JDOOM__ || __JHERETIC__ + else { - // Appropriate player start spot is open - P_SpawnPlayer(P_GetPlayerStart(RebornPosition, playernum), - playernum); - foundSpot = true; + Con_Printf("- force spawning at %i.\n", players[playernum].startspot); + + // Fuzzy returns false if it needs telefragging. + if(!P_FuzzySpawn(assigned, playernum, true)) + { + // Spawn at the assigned spot, telefrag whoever's there. + P_Telefrag(players[playernum].plr->mo); + } } +#else else { // Try to spawn at one of the other player start spots @@ -1587,7 +1427,7 @@ void G_DoReborn(int playernum) } } } - if(foundSpot == false) + if(!foundSpot) { // Player's going to be inside something P_SpawnPlayer(P_GetPlayerStart(RebornPosition, playernum), @@ -1613,17 +1453,6 @@ void G_DoReborn(int playernum) players[playernum].pendingweapon = bestWeapon; } #endif - -#if __JDOOM__ || __JHERETIC__ - Con_Printf("- force spawning at %i.\n", players[playernum].startspot); - - // Fuzzy returns false if it needs telefragging. - if(!P_FuzzySpawn(assigned, playernum, true)) - { - // Spawn at the assigned spot, telefrag whoever's there. - P_Telefrag(players[playernum].plr->mo); - } -#endif } } @@ -1633,9 +1462,9 @@ void G_StartNewInit(void) SV_HxInitBaseSlot(); SV_HxClearRebornSlot(); -# if __JHEXEN__ +# if __JHEXEN__ P_ACSInitNewGame(); -# endif +# endif // Default the player start spot group to 0 RebornPosition = 0; @@ -1655,7 +1484,7 @@ void G_StartNewGame(skill_t skill) { realMap = 1; } - G_InitNew(TempSkill, 1, realMap); + G_InitNew(d_skill, 1, realMap); } /* @@ -2048,14 +1877,14 @@ void G_DoSaveGame(void) #if __JHEXEN__ || __JSTRIFE__ void G_DeferredNewGame(skill_t skill) { - TempSkill = skill; + d_skill = skill; gameaction = ga_newgame; } void G_DoInitNew(void) { SV_HxInitBaseSlot(); - G_InitNew(TempSkill, TempEpisode, TempMap); + G_InitNew(d_skill, d_episode, d_map); gameaction = ga_nothing; } #endif @@ -2066,15 +1895,13 @@ void G_DoInitNew(void) */ void G_DeferedInitNew(skill_t skill, int episode, int map) { -#if __JHEXEN__ || __JSTRIFE__ - TempSkill = skill; - TempEpisode = episode; - TempMap = map; - gameaction = ga_initnew; -#else d_skill = skill; d_episode = episode; d_map = map; + +#if __JHEXEN__ || __JSTRIFE__ + gameaction = ga_initnew; +#else gameaction = ga_newgame; #endif } @@ -2091,7 +1918,7 @@ void G_DoNewGame(void) } G_InitNew(d_skill, d_episode, d_map); #else - G_StartNewGame(TempSkill); + G_StartNewGame(d_skill); #endif gameaction = ga_nothing; } @@ -2439,11 +2266,6 @@ void G_DoPlayDemo(void) gameaction = ga_nothing; -#if __JHEXEN__ || __JSTRIFE__ - if(demoDisabled) - return; -#endif - // The lump should contain the path of the demo file. if(lnum < 0 || W_LumpLength(lnum) != 64) { diff --git a/doomsday/plugins/common/src/g_update.c b/doomsday/plugins/common/src/g_update.c index ce8dc094d8..f485ac861e 100644 --- a/doomsday/plugins/common/src/g_update.c +++ b/doomsday/plugins/common/src/g_update.c @@ -45,10 +45,6 @@ // MACROS ------------------------------------------------------------------ -#if __JHEXEN__ || __JSTRIFE__ -# define thinkercap (*gi.thinkercap) -#endif - #define MANGLE_STATE(x) ((state_t*) ((x)? (x)-states : -1)) #define RESTORE_STATE(x) ((int)(x)==-1? NULL : &states[(int)(x)]) @@ -58,9 +54,6 @@ #if __JHEXEN__ void S_InitScript(void); -#endif - -#ifndef __JDOOM__ void M_LoadData(void); void M_UnloadData(void); #endif @@ -133,13 +126,7 @@ void G_UpdateState(int step) { case DD_GAME_MODE: // Set the game mode string. -#ifdef __JDOOM__ - D_IdentifyVersion(); -#elif __JHERETIC__ - H_IdentifyVersion(); -#else // __JHEXEN__ - H2_IdentifyVersion(); -#endif + G_IdentifyVersion(); break; case DD_PRE: @@ -149,25 +136,22 @@ void G_UpdateState(int step) case DD_POST: G_RestoreState(); P_Init(); -#if __JDOOM__ // FIXME: Detect gamemode changes (doom -> doom2, for instance). +#if !__JHEXEN__ XG_Update(); +#endif + +#if !__JDOOM__ + ST_Init(); +#endif + MN_Init(); - S_LevelMusic(); -#elif __JHERETIC__ - XG_Update(); - ST_Init(); // Updates the status bar patches. - MN_Init(); - S_LevelMusic(); -#elif __JHEXEN__ - ST_Init(); // Updates the status bar patches. - MN_Init(); + +#if __JHEXEN__ S_InitScript(); - SN_InitSequenceScript(); -#elif __JSTRIFE__ - XG_Update(); - ST_Init(); // Updates the status bar patches. - MN_Init(); +#endif + +#if __JDOOM__ || __JHERETIC__ || __JSTRIFE__ S_LevelMusic(); #endif G_SetGlowing(); diff --git a/doomsday/plugins/common/src/hu_lib.c b/doomsday/plugins/common/src/hu_lib.c index 4273cc3474..ca092efd0a 100644 --- a/doomsday/plugins/common/src/hu_lib.c +++ b/doomsday/plugins/common/src/hu_lib.c @@ -41,9 +41,6 @@ // MACROS ------------------------------------------------------------------ -// boolean : whether the screen is always erased -#define noterased viewwindowx - // TYPES ------------------------------------------------------------------- // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- @@ -54,8 +51,6 @@ // EXTERNAL DATA DECLARATIONS ---------------------------------------------- -extern boolean automapactive; // in AM_map.c - // PUBLIC DATA DEFINITIONS ------------------------------------------------- // PRIVATE DATA DEFINITIONS ------------------------------------------------ diff --git a/doomsday/plugins/common/src/hu_msg.c b/doomsday/plugins/common/src/hu_msg.c index 8564f66c3e..4c51050de8 100644 --- a/doomsday/plugins/common/src/hu_msg.c +++ b/doomsday/plugins/common/src/hu_msg.c @@ -31,27 +31,20 @@ # include "doomstat.h" # include "r_local.h" # include "p_local.h" -# include "m_ctrl.h" # include "dstrings.h" // Data. #elif __JHERETIC__ # include "jheretic.h" #elif __JHEXEN__ # include "jhexen.h" #elif __JSTRIFE__ -# include "h2def.h" -# include "d_config.h" -# include "mn_def.h" -# include "sounds.h" -# include "r_local.h" -# include "p_local.h" -# include "m_ctrl.h" -# include "textdefs.h" // Data. +# include "jstrife.h" #endif #include "hu_stuff.h" #include "hu_msg.h" #include "hu_lib.h" #include "g_common.h" +#include "g_controls.h" #include "d_net.h" // MACROS ------------------------------------------------------------------ @@ -576,7 +569,12 @@ void HUMsg_SendMessage(char *msg) DD_Execute(buff, false); } } -#ifdef __JDOOM__ +#if __WOLFTC__ + if(gamemode == commercial) + S_LocalSound(sfx_hudms1, 0); + else + S_LocalSound(sfx_hudms2, 0); +#elif __JDOOM__ if(gamemode == commercial) S_LocalSound(sfx_radio, 0); else diff --git a/doomsday/plugins/common/src/hu_pspr.c b/doomsday/plugins/common/src/hu_pspr.c index a94ac33cbb..cb320360b2 100644 --- a/doomsday/plugins/common/src/hu_pspr.c +++ b/doomsday/plugins/common/src/hu_pspr.c @@ -94,18 +94,11 @@ int HU_PSpriteYOffset(player_t *pl) offy -= FRACUNIT * ((ST_HEIGHT * cfg.sbarscale) / (2 * 20) - 1); return offy; -#elif __JHERETIC__ +#else if(Get(DD_VIEWWINDOW_HEIGHT) == SCREENHEIGHT) return PSpriteSY[pl->class][pl->readyweapon]; return PSpriteSY[pl->class][pl->readyweapon] * (20 - cfg.sbarscale) / 20.0f - FRACUNIT * (39 * cfg.sbarscale) / 40.0f; - -#elif __JHEXEN__ || __JSTRIFE__ - if(Get(DD_VIEWWINDOW_HEIGHT) == SCREENHEIGHT) - return PSpriteSY[pl->class][pl->readyweapon]; - return PSpriteSY[pl->class][pl->readyweapon] * (20 - - cfg.sbarscale) / 20.0f - - FRACUNIT * (39 * cfg.sbarscale) / 40.0f; #endif } @@ -154,56 +147,14 @@ void HU_UpdatePlayerSprite(int pnum) ddpsp->light = 1; ddpsp->alpha = 1; -#if __JDOOM__ - if(pl->powers[pw_invisibility] > 4 * 32 || - pl->powers[pw_invisibility] & 8) +#if __JDOOM__ || __JHERETIC__ + if((pl->powers[pw_invisibility] > 4 * 32) || + (pl->powers[pw_invisibility] & 8)) { // shadow draw ddpsp->alpha = .25f; } - else if(psp->state->frame & FF_FULLBRIGHT) - { - // full bright - ddpsp->light = 1; - } else - { - // local light - ddpsp->light = - P_GetIntp(pl->plr->mo->subsector, DMU_LIGHT_LEVEL) / 255.0; - } - // Needs fullbright? - if((pl->powers[pw_infrared] > 4 * 32) || (pl->powers[pw_infrared] & 8) - || pl->powers[pw_invulnerability] > 30) - { - ddpsp->light = 1; - } - -#elif __JHERETIC__ - if(pl->powers[pw_invisibility] > 4 * 32 || - pl->powers[pw_invisibility] & 8) - { - // shadow draw - ddpsp->alpha = .25f; - } - else if(psp->state->frame & FF_FULLBRIGHT) - { - // full bright - ddpsp->light = 1; - } - else - { - // local light - ddpsp->light = - P_GetIntp(pl->plr->mo->subsector, DMU_LIGHT_LEVEL) / 255.0; - } - // Needs fullbright? - if(pl->powers[pw_infrared] > 4 * 32 || pl->powers[pw_infrared] & 8) - { - // Torch lights up the psprite. - ddpsp->light = 1; - } - #elif __JHEXEN__ if(pl->powers[pw_invulnerability] && pl->class == PCLASS_CLERIC) { @@ -223,9 +174,11 @@ void HU_UpdatePlayerSprite(int pnum) ddpsp->alpha = .333f; } } - else if(psp->state->frame & FF_FULLBRIGHT) + else +#endif + if(psp->state->frame & FF_FULLBRIGHT) { - // Full bright + // full bright ddpsp->light = 1; } else @@ -234,18 +187,17 @@ void HU_UpdatePlayerSprite(int pnum) ddpsp->light = P_GetIntp(pl->plr->mo->subsector, DMU_LIGHT_LEVEL) / 255.0; } -#elif __JSTRIFE__ - if(psp->state->frame & FF_FULLBRIGHT) +#if !__JSTRIFE__ + // Needs fullbright? + if((pl->powers[pw_infrared] > 4 * 32) || (pl->powers[pw_infrared] & 8) +# if __JDOOM__ + || (pl->powers[pw_invulnerability] > 30) +# endif + ) { - // Full bright + // Torch lights up the psprite. ddpsp->light = 1; } - else - { - // local light - ddpsp->light = - P_GetIntp(pl->plr->mo->subsector, DMU_LIGHT_LEVEL) / 255.0; - } #endif // Add some extra light. ddpsp->light += .1f; diff --git a/doomsday/plugins/common/src/hu_stuff.c b/doomsday/plugins/common/src/hu_stuff.c index 3a25cbd5b5..fe15c897c1 100644 --- a/doomsday/plugins/common/src/hu_stuff.c +++ b/doomsday/plugins/common/src/hu_stuff.c @@ -50,11 +50,6 @@ // MACROS ------------------------------------------------------------------ -#ifdef __JDOOM__ -// Locally used constants, shortcuts. -#define NUMMAPS 8 -#endif - // TYPES ------------------------------------------------------------------- // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- @@ -77,9 +72,9 @@ int typein_time = 0; #ifdef __JDOOM__ // Name graphics of each level (centered) dpatch_t *lnames; +#endif boolean hu_showallfrags = false; -#endif // PRIVATE DATA DEFINITIONS ------------------------------------------------ @@ -280,15 +275,12 @@ void HU_Start(void) void HU_Drawer(void) { -#ifdef __JDOOM__ int i, k, x, y; char buf[80]; player_t *plr; -#endif HUMsg_Drawer(); -#ifdef __JDOOM__ if(hu_showallfrags) { for(y = 8, i = 0; i < MAXPLAYERS; i++) @@ -314,7 +306,6 @@ void HU_Drawer(void) y += 10; } } -#endif } void HU_Ticker(void) @@ -647,6 +638,16 @@ void M_LetterFlash(int x, int y, int w, int h, int bright, float red, if(h <= 4) return; + CLAMP(alpha, 0.0f, 1.0f); + + // Don't bother with hidden letters. + if(alpha == 0.0f) + return; + + CLAMP(red, 0.0f, 1.0f); + CLAMP(green, 0.0f, 1.0f); + CLAMP(blue, 0.0f, 1.0f); + // Store original color. gl.GetIntegerv(DGL_RGBA, origColor); diff --git a/doomsday/plugins/common/src/m_multi.c b/doomsday/plugins/common/src/m_multi.c index 4cd7996649..4172999fb5 100644 --- a/doomsday/plugins/common/src/m_multi.c +++ b/doomsday/plugins/common/src/m_multi.c @@ -25,8 +25,6 @@ # include "doomstat.h" # include "m_menu.h" # include "d_config.h" -//# include "m_misc.h" -# include "m_random.h" # include "s_sound.h" # include "dstrings.h" # include "p_local.h" diff --git a/doomsday/plugins/common/src/mn_menu.c b/doomsday/plugins/common/src/mn_menu.c index 421178d4f2..acfb807892 100644 --- a/doomsday/plugins/common/src/mn_menu.c +++ b/doomsday/plugins/common/src/mn_menu.c @@ -55,6 +55,7 @@ # include "jheretic.h" #elif __JHEXEN__ # include "jhexen.h" +# include "m_ctrl.h" # include #elif __JSTRIFE__ # include "h2def.h" diff --git a/doomsday/plugins/common/src/p_inventory.c b/doomsday/plugins/common/src/p_inventory.c new file mode 100644 index 0000000000..0199aab754 --- /dev/null +++ b/doomsday/plugins/common/src/p_inventory.c @@ -0,0 +1,639 @@ +/* DE1: $Id: template.c 2645 2006-01-21 12:58:39Z skyjake $ + * Copyright (C) 1999- Activision + * + * This program is covered by the HERETIC / HEXEN (LIMITED USE) source + * code license; you can redistribute it and/or modify it under the terms + * of the HERETIC / HEXEN source code license as published by Activision. + * + * THIS MATERIAL IS NOT MADE OR SUPPORTED BY ACTIVISION. + * + * WARRANTY INFORMATION. + * This program is provided as is. Activision and it's affiliates make no + * warranties of any kind, whether oral or written , express or implied, + * including any warranty of merchantability, fitness for a particular + * purpose or non-infringement, and no other representations or claims of + * any kind shall be binding on or obligate Activision or it's affiliates. + * + * LICENSE CONDITIONS. + * You shall not: + * + * 1) Exploit this Program or any of its parts commercially. + * 2) Use this Program, or permit use of this Program, on more than one + * computer, computer terminal, or workstation at the same time. + * 3) Make copies of this Program or any part thereof, or make copies of + * the materials accompanying this Program. + * 4) Use the program, or permit use of this Program, in a network, + * multi-user arrangement or remote access arrangement, including any + * online use, except as otherwise explicitly provided by this Program. + * 5) Sell, rent, lease or license any copies of this Program, without + * the express prior written consent of Activision. + * 6) Remove, disable or circumvent any proprietary notices or labels + * contained on or within the Program. + * + * You should have received a copy of the HERETIC / HEXEN source code + * license along with this program (Ravenlic.txt); if not: + * http://www.ravensoft.com/ + */ + +/* + * p_inventory.c: Common code for the player's inventory. + * + * Note: + * The visual representation of which is handled in the HUD code. + * + * Compiles for jHeretic and jHexen. + */ + +#if __JHERETIC__ || __JHEXEN__ + +// HEADER FILES ------------------------------------------------------------ + +#if __JHERETIC__ +# include "jheretic.h" +#elif __JHEXEN__ +# include "jhexen.h" +#endif + +#include "d_net.h" + +// MACROS ------------------------------------------------------------------ + +// TYPES ------------------------------------------------------------------- + +// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- + +// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- + +// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- + +// EXTERNAL DATA DECLARATIONS ---------------------------------------------- + +// PUBLIC DATA DEFINITIONS ------------------------------------------------- + +int inv_ptr; +boolean usearti = true; + +// PRIVATE DATA DEFINITIONS ------------------------------------------------ + +// CODE -------------------------------------------------------------------- + +/* + * Returns true if artifact accepted. + */ +boolean P_GiveArtifact(player_t *player, artitype_e arti, mobj_t *mo) +{ + int i; +#if __JHEXEN__ + int j; + boolean slidePointer = false; +#endif + + if(!player || arti < arti_none + 1 || arti > NUMARTIFACTS - 1) + return false; + + player->update |= PSF_INVENTORY; + + i = 0; + while(player->inventory[i].type != arti && i < player->inventorySlotNum) + i++; + + if(i == player->inventorySlotNum) + { +#if __JHEXEN__ + if(arti < arti_firstpuzzitem) + { + i = 0; + while(player->inventory[i].type < arti_firstpuzzitem && + i < player->inventorySlotNum) + { + i++; + } + if(i != player->inventorySlotNum) + { + for(j = player->inventorySlotNum; j > i; j--) + { + player->inventory[j].count = + player->inventory[j - 1].count; + player->inventory[j].type = player->inventory[j - 1].type; + slidePointer = true; + } + } + } +#endif + player->inventory[i].count = 1; + player->inventory[i].type = arti; + player->inventorySlotNum++; + } + else + { +#if __JHEXEN__ + if(arti >= arti_firstpuzzitem && IS_NETGAME && !deathmatch) + { // Can't carry more than 1 puzzle item in coop netplay + return false; + } +#endif + if(player->inventory[i].count >= MAXARTICOUNT) + { // Player already has max number of this item + return false; + } + player->inventory[i].count++; + } + + if(!player->artifactCount) + { + player->readyArtifact = arti; + } +#if __JHEXEN__ + else if(player == &players[consoleplayer] && slidePointer && i <= inv_ptr) + { + inv_ptr++; + curpos++; + if(curpos > 6) + { + curpos = 6; + } + } +#else + if(mo && (mo->flags & MF_COUNTITEM)) + { + player->itemcount++; + } +#endif + + player->artifactCount++; + + return true; +} + +# if __JHERETIC__ +void P_InventoryCheckReadyArtifact(player_t *player) +{ + if(!player || player != &players[consoleplayer]) + return; + + if(!player->inventory[inv_ptr].count) + { + // Set position markers and get next readyArtifact + inv_ptr--; + if(inv_ptr < 6) + { + curpos--; + if(curpos < 0) + { + curpos = 0; + } + } + if(inv_ptr >= player->inventorySlotNum) + { + inv_ptr = player->inventorySlotNum - 1; + } + if(inv_ptr < 0) + { + inv_ptr = 0; + } + player->readyArtifact = player->inventory[inv_ptr].type; + + if(!player->inventorySlotNum) + player->readyArtifact = arti_none; + } +} +# endif + +void P_InventoryNextArtifact(player_t *player) +{ + if(!player || player != &players[consoleplayer]) + return; + + inv_ptr--; + if(inv_ptr < 6) + { + curpos--; + if(curpos < 0) + { + curpos = 0; + } + } + if(inv_ptr < 0) + { + inv_ptr = player->inventorySlotNum - 1; + if(inv_ptr < 6) + { + curpos = inv_ptr; + } + else + { + curpos = 6; + } + } + player->readyArtifact = player->inventory[inv_ptr].type; +} + +void P_InventoryRemoveArtifact(player_t *player, int slot) +{ + int i; + + if(!player || slot < 0 || slot > NUMINVENTORYSLOTS) + return; + + player->update |= PSF_INVENTORY; + player->artifactCount--; + + if(!(--player->inventory[slot].count)) + { + // Used last of a type - compact the artifact list + player->readyArtifact = arti_none; + player->inventory[slot].type = arti_none; + + for(i = slot + 1; i < player->inventorySlotNum; i++) + { + player->inventory[i - 1] = player->inventory[i]; + } + + player->inventorySlotNum--; + + if(player == &players[consoleplayer]) + { // Set position markers and get next readyArtifact + inv_ptr--; + if(inv_ptr < 6) + { + curpos--; + if(curpos < 0) + curpos = 0; + } + + if(inv_ptr >= player->inventorySlotNum) + inv_ptr = player->inventorySlotNum - 1; + + if(inv_ptr < 0) + inv_ptr = 0; + + player->readyArtifact = player->inventory[inv_ptr].type; + } + } +} + +boolean P_InventoryUseArtifact(player_t *player, artitype_e arti) +{ + int i; + boolean success = false; +# if __JHERETIC__ + boolean play_sound = false; +# endif + + if(!player || arti < arti_none + 1 || arti > NUMARTIFACTS - 1) + return false; + + for(i = 0; i < player->inventorySlotNum; i++) + { + if(player->inventory[i].type == arti) + { + // Found match - try to use + if((success = P_UseArtifactOnPlayer(player, arti)) == true) + { + // Artifact was used - remove it from inventory + P_InventoryRemoveArtifact(player, i); +# if __JHERETIC__ + play_sound = true; +# else + if(arti < arti_firstpuzzitem) + { + S_ConsoleSound(SFX_ARTIFACT_USE, NULL, player - players); + } + else + { + S_ConsoleSound(SFX_PUZZLE_SUCCESS, NULL, player - players); + } +# endif + ST_InventoryFlashCurrent(player); + } + else if(cfg.inventoryNextOnUnuse) + { + // Unable to use artifact, advance pointer? +# if __JHEXEN__ + if(arti < arti_firstpuzzitem) +#endif + P_InventoryNextArtifact(player); + } + break; + } + } + +# if __JHERETIC__ + if(play_sound) + S_ConsoleSound(sfx_artiuse, NULL, player - players); +# endif + + return success; +} + +/* + * Returns true if the artifact was used. + */ +boolean P_UseArtifactOnPlayer(player_t *player, artitype_e arti) +{ + mobj_t *mo; + angle_t angle; +# if __JHEXEN__ + int i; + int count; +# endif + + if(!player || arti < arti_none + 1 || arti > NUMARTIFACTS - 1) + return false; + + switch (arti) + { + case arti_invulnerability: + if(!P_GivePower(player, pw_invulnerability)) + { + return (false); + } + break; +# if __JHERETIC__ + case arti_invisibility: + if(!P_GivePower(player, pw_invisibility)) + { + return (false); + } + break; +# endif + case arti_health: + if(!P_GiveBody(player, 25)) + { + return (false); + } + break; + case arti_superhealth: + if(!P_GiveBody(player, 100)) + { + return (false); + } + break; +# if __JHEXEN__ + case arti_healingradius: + if(!P_HealRadius(player)) + { + return (false); + } + break; +# endif +# if __JHERETIC__ + case arti_tomeofpower: + if(player->morphTics) + { // Attempt to undo chicken + if(P_UndoPlayerMorph(player) == false) + { // Failed + P_DamageMobj(player->plr->mo, NULL, NULL, 10000); + } + else + { // Succeeded + player->morphTics = 0; + S_StartSound(sfx_wpnup, player->plr->mo); + } + } + else + { + if(!P_GivePower(player, pw_weaponlevel2)) + { + return (false); + } + if(player->readyweapon == WP_FIRST) + { + P_SetPsprite(player, ps_weapon, S_STAFFREADY2_1); + } + else if(player->readyweapon == WP_EIGHTH) + { + P_SetPsprite(player, ps_weapon, S_GAUNTLETREADY2_1); + } + } + break; +# endif + case arti_torch: + if(!P_GivePower(player, pw_infrared)) + { + return (false); + } + break; +# if __JHERETIC__ + case arti_firebomb: + angle = player->plr->mo->angle >> ANGLETOFINESHIFT; + mo = P_SpawnMobj(player->plr->mo->pos[VX] + 24 * finecosine[angle], + player->plr->mo->pos[VY] + 24 * finesine[angle], + player->plr->mo->pos[VZ] - player->plr->mo->floorclip + + 15 * FRACUNIT, MT_FIREBOMB); + mo->target = player->plr->mo; + break; +# endif + case arti_egg: + mo = player->plr->mo; + P_SpawnPlayerMissile(mo, MT_EGGFX); + P_SPMAngle(mo, MT_EGGFX, mo->angle - (ANG45 / 6)); + P_SPMAngle(mo, MT_EGGFX, mo->angle + (ANG45 / 6)); + P_SPMAngle(mo, MT_EGGFX, mo->angle - (ANG45 / 3)); + P_SPMAngle(mo, MT_EGGFX, mo->angle + (ANG45 / 3)); + break; + case arti_teleport: + P_ArtiTele(player); + break; + case arti_fly: + if(!P_GivePower(player, pw_flight)) + { + return (false); + } +# if __JHEXEN__ + if(player->plr->mo->momz <= -35 * FRACUNIT) + { // stop falling scream + S_StopSound(0, player->plr->mo); + } +# endif + break; +# if __JHEXEN__ + case arti_summon: + mo = P_SpawnPlayerMissile(player->plr->mo, MT_SUMMON_FX); + if(mo) + { + mo->target = player->plr->mo; + mo->special1 = (int) (player->plr->mo); + mo->momz = 5 * FRACUNIT; + } + break; + case arti_teleportother: + P_ArtiTeleportOther(player); + break; + case arti_poisonbag: + angle = player->plr->mo->angle >> ANGLETOFINESHIFT; + if(player->class == PCLASS_CLERIC) + { + mo = P_SpawnMobj(player->plr->mo->pos[VX] + 16 * finecosine[angle], + player->plr->mo->pos[VY] + 24 * finesine[angle], + player->plr->mo->pos[VZ] - player->plr->mo->floorclip + + 8 * FRACUNIT, MT_POISONBAG); + if(mo) + { + mo->target = player->plr->mo; + } + } + else if(player->class == PCLASS_MAGE) + { + mo = P_SpawnMobj(player->plr->mo->pos[VX] + 16 * finecosine[angle], + player->plr->mo->pos[VY] + 24 * finesine[angle], + player->plr->mo->pos[VZ] - player->plr->mo->floorclip + + 8 * FRACUNIT, MT_FIREBOMB); + if(mo) + { + mo->target = player->plr->mo; + } + } + else // PCLASS_FIGHTER, obviously (also pig, not so obviously) + { + mo = P_SpawnMobj(player->plr->mo->pos[VX], + player->plr->mo->pos[VY], + player->plr->mo->pos[VZ] - player->plr->mo->floorclip + + 35 * FRACUNIT, MT_THROWINGBOMB); + if(mo) + { + mo->angle = + player->plr->mo->angle + (((P_Random() & 7) - 4) << 24); + mo->momz = + 4 * FRACUNIT + + (((int) player->plr->lookdir) << (FRACBITS - 4)); + mo->pos[VZ] += ((int) player->plr->lookdir) << (FRACBITS - 4); + P_ThrustMobj(mo, mo->angle, mo->info->speed); + mo->momx += player->plr->mo->momx >> 1; + mo->momy += player->plr->mo->momy >> 1; + mo->target = player->plr->mo; + mo->tics -= P_Random() & 3; + P_CheckMissileSpawn(mo); + } + } + break; + case arti_speed: + if(!P_GivePower(player, pw_speed)) + { + return (false); + } + break; + case arti_boostmana: + if(!P_GiveMana(player, MANA_1, MAX_MANA)) + { + if(!P_GiveMana(player, MANA_2, MAX_MANA)) + { + return false; + } + + } + else + { + P_GiveMana(player, MANA_2, MAX_MANA); + } + break; + case arti_boostarmor: + count = 0; + + for(i = 0; i < NUMARMOR; i++) + { + count += P_GiveArmor(player, i, 1); // 1 point per armor type + } + if(!count) + { + return false; + } + break; + case arti_blastradius: + P_BlastRadius(player); + break; + + case arti_puzzskull: + case arti_puzzgembig: + case arti_puzzgemred: + case arti_puzzgemgreen1: + case arti_puzzgemgreen2: + case arti_puzzgemblue1: + case arti_puzzgemblue2: + case arti_puzzbook1: + case arti_puzzbook2: + case arti_puzzskull2: + case arti_puzzfweapon: + case arti_puzzcweapon: + case arti_puzzmweapon: + case arti_puzzgear1: + case arti_puzzgear2: + case arti_puzzgear3: + case arti_puzzgear4: + if(P_UsePuzzleItem(player, arti - arti_firstpuzzitem)) + { + return true; + } + else + { + P_SetYellowMessage(player, TXT_USEPUZZLEFAILED); + return false; + } + break; +# endif + default: + return false; + } + return true; +} + +/* + * Does not bother to check the validity of the params as the only + * caller is DEFCC(CCmdInventory) (bellow). + */ +static boolean P_InventoryMove(player_t *plr, int dir) +{ + if(!ST_IsInventoryVisible()) + { + ST_Inventory(true); + return false; + } + + ST_Inventory(true); // reset the inventory auto-hide timer + + if(dir == 0) + { + inv_ptr--; + if(inv_ptr < 0) + { + inv_ptr = 0; + } + else + { + curpos--; + if(curpos < 0) + { + curpos = 0; + } + } + } + else + { + inv_ptr++; + if(inv_ptr >= plr->inventorySlotNum) + { + inv_ptr--; + if(inv_ptr < 0) + inv_ptr = 0; + } + else + { + curpos++; + if(curpos > 6) + { + curpos = 6; + } + } + } + return true; +} + +/* + * Move the inventory selector + */ +DEFCC(CCmdInventory) +{ + P_InventoryMove(players + consoleplayer, !stricmp(argv[0], "invright")); + return true; +} +#endif diff --git a/doomsday/plugins/common/src/p_mapsetup.c b/doomsday/plugins/common/src/p_mapsetup.c index 8547ffe1a6..1bbe007ba6 100644 --- a/doomsday/plugins/common/src/p_mapsetup.c +++ b/doomsday/plugins/common/src/p_mapsetup.c @@ -320,14 +320,10 @@ void P_SetupLevel(int episode, int map, int playermask, skill_t skill) P_LoadACScripts(W_GetNumForName(levelId) + ML_BEHAVIOR); // ACS object code #else // Now we can init the server. - Con_Message("Init server\n"); R_SetupLevel(levelId, DDSLF_SERVER_ONLY); #endif - Con_Message("Deal starts\n"); P_DealPlayerStarts(); - Con_Message("Spawn players\n"); P_SpawnPlayers(); - Con_Message("Done\n"); // set up world state P_SpawnSpecials(); diff --git a/doomsday/plugins/common/src/p_saveg.c b/doomsday/plugins/common/src/p_saveg.c index 5a4f2b28ed..d83287ede3 100644 --- a/doomsday/plugins/common/src/p_saveg.c +++ b/doomsday/plugins/common/src/p_saveg.c @@ -46,26 +46,33 @@ // MACROS ------------------------------------------------------------------ -#ifdef __JDOOM__ -# define MY_SAVE_MAGIC 0x1DEAD666 -# define MY_CLIENT_SAVE_MAGIC 0x2DEAD666 -# define MY_SAVE_VERSION 5 -# define SAVESTRINGSIZE 24 -# define CONSISTENCY 0x2c -# define SAVEGAMENAME "DoomSav" -# define CLIENTSAVEGAMENAME "DoomCl" -# define SAVEGAMEEXTENSION "dsg" -#endif - -#ifdef __JHERETIC__ -# define MY_SAVE_MAGIC 0x7D9A12C5 -# define MY_CLIENT_SAVE_MAGIC 0x1062AF43 -# define MY_SAVE_VERSION 5 -# define SAVESTRINGSIZE 24 -# define CONSISTENCY 0x9d -# define SAVEGAMENAME "HticSav" -# define CLIENTSAVEGAMENAME "HticCl" -# define SAVEGAMEEXTENSION "hsg" +#if __WOLFTC__ +# define MY_SAVE_MAGIC 0x1A8AFF08 +# define MY_CLIENT_SAVE_MAGIC 0x2A8AFF08 +# define MY_SAVE_VERSION 5 +# define SAVESTRINGSIZE 24 +# define CONSISTENCY 0x2c +# define SAVEGAMENAME "WolfSav" +# define CLIENTSAVEGAMENAME "WolfCl" +# define SAVEGAMEEXTENSION "wsg" +#elif __JDOOM__ +# define MY_SAVE_MAGIC 0x1DEAD666 +# define MY_CLIENT_SAVE_MAGIC 0x2DEAD666 +# define MY_SAVE_VERSION 5 +# define SAVESTRINGSIZE 24 +# define CONSISTENCY 0x2c +# define SAVEGAMENAME "DoomSav" +# define CLIENTSAVEGAMENAME "DoomCl" +# define SAVEGAMEEXTENSION "dsg" +#elif __JHERETIC__ +# define MY_SAVE_MAGIC 0x7D9A12C5 +# define MY_CLIENT_SAVE_MAGIC 0x1062AF43 +# define MY_SAVE_VERSION 5 +# define SAVESTRINGSIZE 24 +# define CONSISTENCY 0x9d +# define SAVEGAMENAME "HticSav" +# define CLIENTSAVEGAMENAME "HticCl" +# define SAVEGAMEEXTENSION "hsg" #endif #define PRE_VER5_END_SPECIALS 7 diff --git a/doomsday/plugins/common/src/p_start.c b/doomsday/plugins/common/src/p_start.c index 4efd5d5558..a43bd6399d 100644 --- a/doomsday/plugins/common/src/p_start.c +++ b/doomsday/plugins/common/src/p_start.c @@ -45,21 +45,23 @@ // MACROS ------------------------------------------------------------------ -// Maximum number of different player starts. #if __JDOOM__ || __JHERETIC__ -# define MAX_START_SPOTS 4 +# define TELEPORTSOUND sfx_telept +# define MAX_START_SPOTS 4 // Maximum number of different player starts. #else +# define TELEPORTSOUND SFX_TELEPORT # define MAX_START_SPOTS 8 #endif +// Time interval for item respawning. +#define ITEMQUESIZE 128 + // TYPES ------------------------------------------------------------------- // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- -void P_SpawnMapThing(thing_t * mthing); - #if __JHERETIC__ char *P_GetLevelName(int episode, int map); char *P_GetShortLevelName(int episode, int map); @@ -76,11 +78,12 @@ void InitMapInfo(void); // PUBLIC DATA DEFINITIONS ------------------------------------------------- // Maintain single and multi player starting spots. -thing_t deathmatchstarts[MAX_DM_STARTS]; +thing_t deathmatchstarts[MAX_DM_STARTS]; thing_t *deathmatch_p; thing_t *playerstarts; int numPlayerStarts = 0; + thing_t *things; // PRIVATE DATA DEFINITIONS ------------------------------------------------ @@ -233,105 +236,59 @@ void P_DealPlayerStarts(void) /* * Returns false if the player cannot be respawned * at the given thing_t spot because something is occupying it - * FIXME: Quite a mess! */ -boolean P_CheckSpot(int playernum, thing_t * mthing, boolean doTeleSpark) +boolean P_CheckSpot(int playernum, thing_t *mthing, boolean doTeleSpark) { - fixed_t x; - fixed_t y; - unsigned an; - mobj_t *mo; - -#if __JDOOM__ || __JSTRIFE__ - int i; -#endif -#if __JHERETIC__ || __JHEXEN__ - boolean using_dummy = false; - thing_t faraway; -#endif + fixed_t pos[3]; + ddplayer_t *ddplyr = players[playernum].plr; + boolean using_dummy = false; -#if __JDOOM__ || __JSTRIFE__ - if(!players[playernum].plr->mo) - { - // first spawn of level, before corpses - for(i = 0; i < playernum; i++) - { - if(players[i].plr->mo && - players[i].plr->mo->pos[VX] == mthing->x << FRACBITS && - players[i].plr->mo->pos[VY] == mthing->y << FRACBITS) - return false; - } - return true; - } -#endif + pos[VX] = mthing->x << FRACBITS; + pos[VY] = mthing->y << FRACBITS; - - x = mthing->x << FRACBITS; - y = mthing->y << FRACBITS; - -#if __JHERETIC__ || __JHEXEN__ - if(!players[playernum].plr->mo) + if(!ddplyr->mo) { // The player doesn't have a mobj. Let's create a dummy. - faraway.x = faraway.y = DDMAXSHORT; - P_SpawnPlayer(&faraway, playernum); + G_DummySpawnPlayer(playernum); using_dummy = true; } -#endif - players[playernum].plr->mo->flags2 &= ~MF2_PASSMOBJ; - if(!P_CheckPosition(players[playernum].plr->mo, x, y)) + ddplyr->mo->flags2 &= ~MF2_PASSMOBJ; + + if(!P_CheckPosition(ddplyr->mo, pos[VX], pos[VY])) { - players[playernum].plr->mo->flags2 |= MF2_PASSMOBJ; -#if __JHERETIC__ || __JHEXEN__ + ddplyr->mo->flags2 |= MF2_PASSMOBJ; + if(using_dummy) { - P_RemoveMobj(players[playernum].plr->mo); - players[playernum].plr->mo = NULL; + P_RemoveMobj(ddplyr->mo); + ddplyr->mo = NULL; } -#endif return false; } + ddplyr->mo->flags2 |= MF2_PASSMOBJ; -#if __JDOOM__ || __JHERETIC__ - players[playernum].plr->mo->flags2 |= MF2_PASSMOBJ; -#endif - -#if __JHERETIC__ || __JHEXEN__ if(using_dummy) { - P_RemoveMobj(players[playernum].plr->mo); - players[playernum].plr->mo = NULL; + P_RemoveMobj(ddplyr->mo); + ddplyr->mo = NULL; } -#endif #if __JDOOM__ - G_QueueBody(players[playernum].plr->mo); + G_QueueBody(ddplyr->mo); #endif - if(doTeleSpark) + if(doTeleSpark) // spawn a teleport fog { - // spawn a teleport fog - an = (ANG45 * (mthing->angle / 45)) >> ANGLETOFINESHIFT; - -#if __JDOOM__ || __JHEXEN__ || __JSTRIFE__ - mo = P_SpawnMobj(x + 20 * finecosine[an], y + 20 * finesine[an], - P_GetFixedp(R_PointInSubsector(x, y), - DMU_SECTOR_OF_SUBSECTOR | DMU_FLOOR_HEIGHT), - MT_TFOG); -#else // __JHERETIC__ - mo = P_SpawnTeleFog(x + 20 * finecosine[an], y + 20 * finesine[an]); -#endif + mobj_t *mo; + fixed_t an = (ANG45 * (mthing->angle / 45)) >> ANGLETOFINESHIFT; + + mo = P_SpawnTeleFog(pos[VX] + 20 * finecosine[an], + pos[VY] + 20 * finesine[an]); // don't start sound on first frame if(players[consoleplayer].plr->viewz != 1) - { -#if __JHEXEN__ || __JSTRIFE__ - S_StartSound(SFX_TELEPORT, mo); -#else - S_StartSound(sfx_telept, mo); -#endif - } + S_StartSound(TELEPORTSOUND, mo); } return true; @@ -343,15 +300,15 @@ boolean P_CheckSpot(int playernum, thing_t * mthing, boolean doTeleSpark) */ boolean P_FuzzySpawn(thing_t * spot, int playernum, boolean doTeleSpark) { - thing_t place; - int i, k, x, y; int offset = 33; // Player radius = 16 + thing_t place; // Try some spots in the vicinity. for(i = 0; i < 9; i++) { memcpy(&place, spot, sizeof(*spot)); + if(i != 0) { k = (i == 4 ? 0 : i); @@ -361,6 +318,7 @@ boolean P_FuzzySpawn(thing_t * spot, int playernum, boolean doTeleSpark) place.x += x * offset; place.y += y * offset; } + if(P_CheckSpot(playernum, &place, doTeleSpark)) { // This is good! @@ -415,8 +373,8 @@ void P_SpawnThings(void) break; } } - if(spawn == false) - break; + if(!spawn) + continue; #endif P_SpawnMapThing(th); } @@ -434,7 +392,8 @@ void P_SpawnThings(void) playerCount = 0; for(i = 0; i < MAXPLAYERS; i++) { - playerCount += players[i].plr->ingame; + if(players[i].plr->ingame) + playerCount++; } deathSpotsCount = deathmatch_p - deathmatchstarts; @@ -498,16 +457,82 @@ void P_SpawnPlayers(void) } } -#if __JHEXEN__ || __JSTRIFE__ /* - * Hexen specific. Returns the correct start for the player. The start + * Spawns the given player at a dummy place. + */ +void G_DummySpawnPlayer(int playernum) +{ + thing_t faraway; + + faraway.x = faraway.y = DDMAXSHORT; + faraway.angle = (short) 0; + P_SpawnPlayer(&faraway, playernum); +} + +/* + * Spawns a player at one of the random death match spots + * called at level load and each death + */ +void G_DeathMatchSpawnPlayer(int playernum) +{ + int i, j; + int selections; + boolean using_dummy = false; + ddplayer_t *pl = players[playernum].plr; + + // Spawn player initially at a distant location. + if(!pl->mo) + { + G_DummySpawnPlayer(playernum); + using_dummy = true; + } + + // Now let's find an available deathmatch start. + selections = deathmatch_p - deathmatchstarts; + if(selections < 2) + Con_Error("Only %i deathmatch spots, 2 required", selections); + + for(j = 0; j < 20; j++) + { + i = P_Random() % selections; + if(P_CheckSpot(playernum, &deathmatchstarts[i], true)) + { +#if __JHERETIC__ || __JHEXEN__ || __JSTRIFE__ + deathmatchstarts[i].type = playernum + 1; +#endif + break; + } + } + + if(using_dummy) + { + // Destroy the dummy. + P_RemoveMobj(pl->mo); + pl->mo = NULL; + } + + P_SpawnPlayer(&deathmatchstarts[i], playernum); + +#if __JDOOM__ || __JHERETIC__ + // Gib anything at the spot. + P_Telefrag(players[playernum].plr->mo); +#endif +} + +/* + * Returns the correct start for the player. The start * is in the given group, or zero if no such group exists. + * + * With jDoom groups arn't used at all. */ thing_t *P_GetPlayerStart(int group, int pnum) { +#if __JDOOM__ || __JHERETIC__ + return &playerstarts[players[pnum].startspot]; +#else int i; - thing_t *mt, *g0choice = playerstarts; + thing_t *mt, *g0choice; for(i = 0; i < numPlayerStarts; ++i) { @@ -520,8 +545,8 @@ thing_t *P_GetPlayerStart(int group, int pnum) } // Return the group zero choice. return g0choice; -} #endif +} #if __JHERETIC__ || __JHEXEN__ fixed_t P_PointLineDistance(line_t *line, fixed_t x, fixed_t y, @@ -554,7 +579,7 @@ fixed_t P_PointLineDistance(line_t *line, fixed_t x, fixed_t y, * original maps. The DOOM engine allowed these kinds of things but * a Z-buffer doesn't. */ -void P_MoveThingsOutOfWalls() +void P_MoveThingsOutOfWalls(void) { #define MAXLIST 200 sector_t *sec; @@ -625,7 +650,7 @@ void P_MoveThingsOutOfWalls() /* * Fails in some places, but works most of the time. */ -void P_TurnGizmosAwayFromDoors() +void P_TurnGizmosAwayFromDoors(void) { #define MAXLIST 200 sector_t *sec; @@ -698,7 +723,7 @@ void P_TurnGizmosAwayFromDoors() * Pretty much the same as P_TurnGizmosAwayFromDoors() * TODO: Merge them together */ -void P_TurnTorchesToFaceWalls() +void P_TurnTorchesToFaceWalls(void) { #define MAXLIST 200 sector_t *sec; diff --git a/doomsday/plugins/common/src/p_tick.c b/doomsday/plugins/common/src/p_tick.c index 6328321028..73a5140335 100644 --- a/doomsday/plugins/common/src/p_tick.c +++ b/doomsday/plugins/common/src/p_tick.c @@ -36,6 +36,7 @@ #endif #include "g_common.h" +#include "g_controls.h" #include "p_player.h" // MACROS ------------------------------------------------------------------ diff --git a/doomsday/plugins/common/src/p_user.c b/doomsday/plugins/common/src/p_user.c index 4d9dc4fef5..090e8f9279 100644 --- a/doomsday/plugins/common/src/p_user.c +++ b/doomsday/plugins/common/src/p_user.c @@ -52,40 +52,20 @@ // MACROS ------------------------------------------------------------------ -#if __JDOOM__ || __JHERETIC__ -// Index of the special effects (INVUL inverse) map. -#define INVERSECOLORMAP 32 - #define ANG5 (ANG90/18) -#elif __JHEXEN__ - -#define BLAST_RADIUS_DIST 255*FRACUNIT -#define BLAST_SPEED 20*FRACUNIT -#define BLAST_FULLSTRENGTH 255 -#define HEAL_RADIUS_DIST 255*FRACUNIT - -#endif - // 16 pixels of bob #define MAXBOB 0x100000 // TYPES ------------------------------------------------------------------- // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- -#if __JHERETIC__ || __JHEXEN__ -void P_PlayerNextArtifact(player_t *player); -#endif // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- // EXTERNAL DATA DECLARATIONS ---------------------------------------------- -#if __JHERETIC__ -extern int inv_ptr; -extern int curpos; -#endif // PUBLIC DATA DEFINITIONS ------------------------------------------------- boolean onground; @@ -110,11 +90,13 @@ classinfo_t classInfo[NUMCLASSES] = { 0x3C, {0x19, 0x32}, {0x18, 0x28}, + 2048, + 24 } }; #elif __JHERETIC__ -int newtorch; // used in the torch flicker effect. -int newtorchdelta; +int newtorch[MAXPLAYERS]; // used in the torch flicker effect. +int newtorchdelta[MAXPLAYERS]; classinfo_t classInfo[NUMCLASSES] = { { // Player @@ -126,6 +108,8 @@ classinfo_t classInfo[NUMCLASSES] = { 0x3C, {0x19, 0x32}, {0x18, 0x28}, + 2048, + 24 }, { // Chicken S_CHICPLAY, @@ -136,15 +120,17 @@ classinfo_t classInfo[NUMCLASSES] = { 0x3C, {0x19, 0x32}, {0x18, 0x28}, + 2500, + 24 }, }; #elif __JHEXEN__ -int lookdirSpeed = 3, quakeFly = 0; int newtorch[MAXPLAYERS]; // used in the torch flicker effect. int newtorchdelta[MAXPLAYERS]; classinfo_t classInfo[NUMCLASSES] = { { // Fighter + MT_PLAYER_FIGHTER, S_FPLAY, S_FPLAY_RUN1, S_FPLAY_ATK1, @@ -154,10 +140,13 @@ classinfo_t classInfo[NUMCLASSES] = { 0x3C, {0x1D, 0x3C}, {0x1B, 0x3B}, + 2048, + 18, {25 * FRACUNIT, 20 * FRACUNIT, 15 * FRACUNIT, 5 * FRACUNIT}, {190, 225, 234} }, { // Cleric + MT_PLAYER_CLERIC, S_CPLAY, S_CPLAY_RUN1, S_CPLAY_ATK1, @@ -167,10 +156,13 @@ classinfo_t classInfo[NUMCLASSES] = { 0x32, {0x19, 0x32}, {0x18, 0x28}, + 2048, + 18, {10 * FRACUNIT, 25 * FRACUNIT, 5 * FRACUNIT, 20 * FRACUNIT}, {190, 212, 225} }, { // Mage + MT_PLAYER_MAGE, S_MPLAY, S_MPLAY_RUN1, S_MPLAY_ATK1, @@ -180,10 +172,13 @@ classinfo_t classInfo[NUMCLASSES] = { 0x2D, {0x16, 0x2E}, {0x15, 0x25}, + 2048, + 18, {5 * FRACUNIT, 15 * FRACUNIT, 10 * FRACUNIT, 25 * FRACUNIT}, {190, 205, 224} }, { // Pig + MT_PIGPLAYER, S_PIGPLAY, S_PIGPLAY_RUN1, S_PIGPLAY_ATK1, @@ -193,6 +188,8 @@ classinfo_t classInfo[NUMCLASSES] = { 0x31, {0x18, 0x31}, {0x17, 0x27}, + 2048, + 18, {0, 0, 0, 0}, {0, 0, 0} }, @@ -285,22 +282,32 @@ boolean P_IsPlayerOnGround(player_t *player) * Will make the player jump if the latest command so instructs, * providing that jumping is possible. */ -#if __JDOOM__ || __JHERETIC__ void P_CheckPlayerJump(player_t *player) { + float power; ticcmd_t *cmd = &player->cmd; + // Check if we are allowed to jump. if(cfg.jumpEnabled && (!IS_CLIENT || netJumpPower > 0) && - P_IsPlayerOnGround(player) && cmd->jump && - player->jumptics <= 0) + P_IsPlayerOnGround(player) && cmd->jump && player->jumptics <= 0) { // Jump, then! - player->plr->mo->momz = - FRACUNIT * (IS_CLIENT ? netJumpPower : cfg.jumpPower); - player->jumptics = 24; + power = (IS_CLIENT ? netJumpPower : cfg.jumpPower); + +#if __JHEXEN__ + if(player->morphTics) // Pigs don't jump that high. + player->plr->mo->momz = FRACUNIT * (2 * power / 3); + else +#endif + player->plr->mo->momz = FRACUNIT * power; + + player->jumptics = PCLASS_INFO(player->class)->jumptics; + +#if __JHEXEN__ + player->plr->mo->flags2 &= ~MF2_ONMOBJ; +#endif } } -#endif void P_MovePlayer(player_t *player) { @@ -329,33 +336,21 @@ void P_MovePlayer(player_t *player) } else { -#if __JHERETIC__ - if(player->morphTics) - { // Chicken speed - if(cmd->forwardMove && (onground || plrmo->flags2 & MF2_FLY)) - P_Thrust(player, plrmo->angle, cmd->forwardMove * 2500); - if(cmd->sideMove && (onground || plrmo->flags2 & MF2_FLY)) - P_Thrust(player, plrmo->angle - ANG90, cmd->sideMove * 2500); - } - else -#endif - { - // 'Move while in air' hack (server doesn't know about this!!). - // Movement while in air traditionally disabled. - int movemul = (onground || plrmo->flags2 & MF2_FLY) ? 2048 : - cfg.airborneMovement ? cfg.airborneMovement * 64 : 0; + // 'Move while in air' hack (server doesn't know about this!!). + // Movement while in air traditionally disabled. + int movemul = (onground || plrmo->flags2 & MF2_FLY) ? PCLASS_INFO(player->class)->movemul : + (cfg.airborneMovement) ? cfg.airborneMovement * 64 : 0; - if(cmd->forwardMove && movemul) - { - P_Thrust(player, player->plr->mo->angle, - cmd->forwardMove * movemul); - } + if(cmd->forwardMove && movemul) + { + P_Thrust(player, player->plr->mo->angle, + cmd->forwardMove * movemul); + } - if(cmd->sideMove && movemul) - { - P_Thrust(player, player->plr->mo->angle - ANG90, - cmd->sideMove * movemul); - } + if(cmd->sideMove && movemul) + { + P_Thrust(player, player->plr->mo->angle - ANG90, + cmd->sideMove * movemul); } if((cmd->forwardMove || cmd->sideMove) && @@ -394,7 +389,7 @@ void P_MovePlayer(player_t *player) #if __JHERETIC__ || __JHEXEN__ else if(fly > 0) { - P_PlayerUseArtifact(player, arti_fly); + P_InventoryUseArtifact(player, arti_fly); } #endif if(plrmo->flags2 & MF2_FLY) @@ -405,9 +400,8 @@ void P_MovePlayer(player_t *player) player->flyheight /= 2; } } -#if __JDOOM__ || __JHERETIC__ + P_CheckPlayerJump(player); -#endif } #if __JHEXEN__ // Look up/down using the delta. @@ -571,17 +565,12 @@ void P_DeathThink(player_t *player) { inv_ptr = 0; curpos = 0; -# if __JHERETIC__ - newtorch = 0; - newtorchdelta = 0; - H_SetFilter(0); -# else - H2_SetFilter(0); -# endif + R_SetFilter(0); } -# if __JHEXEN__ + newtorch[player - players] = 0; newtorchdelta[player - players] = 0; +# if __JHEXEN__ player->plr->mo->special1 = player->class; if(player->plr->mo->special1 > 2) { @@ -596,7 +585,6 @@ void P_DeathThink(player_t *player) } #if __JHERETIC__ || __JHEXEN__ - void P_MorphPlayerThink(player_t *player) { mobj_t *pmo; @@ -656,9 +644,9 @@ boolean P_UndoPlayerMorph(player_t *player) weapontype_t weapon; int oldFlags; int oldFlags2; -# if __JHEXEN__ int oldBeast; +# if __JHEXEN__ player->update |= PSF_MORPH_TIME | PSF_POWERS | PSF_HEALTH; # endif @@ -671,26 +659,15 @@ boolean P_UndoPlayerMorph(player_t *player) oldFlags2 = pmo->flags2; # if __JHEXEN__ oldBeast = pmo->type; +# else + oldBeast = MT_CHICPLAYER; # endif P_SetMobjState(pmo, S_FREETARGMOBJ); playerNum = P_GetPlayerNum(player); # if __JHEXEN__ - switch (cfg.PlayerClass[playerNum]) - { - case PCLASS_FIGHTER: - mo = P_SpawnMobj(pos[VX], pos[VY], pos[VZ], MT_PLAYER_FIGHTER); - break; - case PCLASS_CLERIC: - mo = P_SpawnMobj(pos[VX], pos[VY], pos[VZ], MT_PLAYER_CLERIC); - break; - case PCLASS_MAGE: - mo = P_SpawnMobj(pos[VX], pos[VY], pos[VZ], MT_PLAYER_MAGE); - break; - default: - Con_Error("P_UndoPlayerMorph: Unknown player class %d\n", - player->class); - } + mo = P_SpawnMobj(pos[VX], pos[VY], pos[VZ], + PCLASS_INFO(cfg.PlayerClass[playerNum])->mobjtype); # else mo = P_SpawnMobj(pos[VX], pos[VY], pos[VZ], MT_PLAYER); # endif @@ -698,11 +675,8 @@ boolean P_UndoPlayerMorph(player_t *player) if(P_TestMobjLocation(mo) == false) { // Didn't fit P_RemoveMobj(mo); -# if __JHERETIC__ - mo = P_SpawnMobj(pos[VX], pos[VY], pos[VZ], MT_CHICPLAYER); -# else mo = P_SpawnMobj(pos[VX], pos[VY], pos[VZ], oldBeast); -# endif + mo->angle = angle; mo->health = player->health; mo->special1 = weapon; @@ -772,947 +746,133 @@ boolean P_UndoPlayerMorph(player_t *player) } #endif -#if __JHEXEN__ -void P_PlayerJump(player_t *player) -{ - float power; - - // Check if we are allowed to jump. - if((!IS_CLIENT || netJumpPower > 0) && - P_IsPlayerOnGround(player) && - player->jumpTics <= 0) - { - power = (IS_CLIENT ? netJumpPower : cfg.jumpPower); - - if(player->morphTics) // Pigs don't jump that high. - player->plr->mo->momz = (2 * power / 3) * FRACUNIT; - else - player->plr->mo->momz = power * FRACUNIT; - - player->plr->mo->flags2 &= ~MF2_ONMOBJ; - player->jumpTics = 18; - } -} -#endif - -#if __JHERETIC__ || __JHEXEN__ -void P_ArtiTele(player_t *player) +/* + * Called once per tick by P_Ticker. + * This routine does all the thinking for the console player during + * netgames. + */ +void P_ClientSideThink() { int i; - int selections; - fixed_t destX; - fixed_t destY; - angle_t destAngle; - - if(deathmatch) - { - selections = deathmatch_p - deathmatchstarts; - i = P_Random() % selections; - destX = deathmatchstarts[i].x << FRACBITS; - destY = deathmatchstarts[i].y << FRACBITS; - destAngle = ANG45 * (deathmatchstarts[i].angle / 45); - } - else - { - // FIXME?: DJS - this doesn't seem right... - destX = playerstarts[0].x << FRACBITS; - destY = playerstarts[0].y << FRACBITS; - destAngle = ANG45 * (playerstarts[0].angle / 45); - } - -# if __JHEXEN__ - P_Teleport(player->plr->mo, destX, destY, destAngle, true); - if(player->morphTics) - { // Teleporting away will undo any morph effects (pig) - P_UndoPlayerMorph(player); - } - //S_StartSound(NULL, sfx_wpnup); // Full volume laugh -# else - P_Teleport(player->plr->mo, destX, destY, destAngle); - /*S_StartSound(sfx_wpnup, NULL); // Full volume laugh - NetSv_Sound(NULL, sfx_wpnup, player-players); */ - S_StartSound(sfx_wpnup, NULL); -# endif -} -#endif - -#if __JHEXEN__ -void P_ArtiTeleportOther(player_t *player) -{ + player_t *pl; + ddplayer_t *dpl; mobj_t *mo; + ticcmd_t *cmd; + int fly; - mo = P_SpawnPlayerMissile(player->plr->mo, MT_TELOTHER_FX1); + if(!IS_CLIENT || !Get(DD_GAME_READY)) + return; - if(mo) - mo->target = player->plr->mo; -} + pl = &players[consoleplayer]; + dpl = pl->plr; + mo = dpl->mo; -void P_TeleportToPlayerStarts(mobj_t *victim) -{ - int i, selections = 0; - fixed_t destX, destY; - angle_t destAngle; - thing_t *start; + if(!mo) + return; - for(i = 0; i < MAXPLAYERS; i++) - { - if(!players[i].plr->ingame) - continue; + cmd = &pl->cmd; // The latest local command. + P_CalcHeight(pl); - selections++; + // Message timer. + pl->messageTics--; // Can go negative + if(!pl->messageTics) + { // Refresh the screen when a message goes away +#if __JHEXEN__ + pl->ultimateMessage = false; // clear out any chat messages. + pl->yellowMessage = false; +#endif + GL_Update(DDUF_TOP); } - i = P_Random() % selections; - start = P_GetPlayerStart(0, i); - - destX = start->x << FRACBITS; - destY = start->y << FRACBITS; - destAngle = ANG45 * (playerstarts[i].angle / 45); - - P_Teleport(victim, destX, destY, destAngle, true); - //S_StartSound(NULL, sfx_wpnup); // Full volume laugh -} - -void P_TeleportToDeathmatchStarts(mobj_t *victim) -{ - int i, selections; - fixed_t destX, destY; - angle_t destAngle; - - selections = deathmatch_p - deathmatchstarts; - if(selections) - { - i = P_Random() % selections; - destX = deathmatchstarts[i].x << FRACBITS; - destY = deathmatchstarts[i].y << FRACBITS; - destAngle = ANG45 * (deathmatchstarts[i].angle / 45); - - P_Teleport(victim, destX, destY, destAngle, true); - //S_StartSound(NULL, sfx_wpnup); // Full volume laugh - } - else - { - P_TeleportToPlayerStarts(victim); - } -} +#if __JHEXEN__ + if(pl->morphTics > 0) + pl->morphTics--; +#endif -void P_TeleportOther(mobj_t *victim) -{ - if(victim->player) - { - if(deathmatch) - P_TeleportToDeathmatchStarts(victim); - else - P_TeleportToPlayerStarts(victim); - } - else + // Powers tic away. + for(i = 0; i < NUMPOWERS; i++) { - // If death action, run it upon teleport - if(victim->flags & MF_COUNTKILL && victim->special) + switch (i) { - P_RemoveMobjFromTIDList(victim); - P_ExecuteLineSpecial(victim->special, victim->args, NULL, 0, - victim); - victim->special = 0; +#if __JDOOM__ + case pw_invulnerability: + case pw_invisibility: + case pw_ironfeet: + case pw_infrared: + case pw_strength: +#elif __JHEXEN__ + case pw_invulnerability: + case pw_infrared: + case pw_flight: + case pw_speed: + case pw_minotaur: +#endif + if(pl->powers[i] > 0) + pl->powers[i]--; + else + pl->powers[i] = 0; + break; } - - // Send all monsters to deathmatch spots - P_TeleportToDeathmatchStarts(victim); } -} -void ResetBlasted(mobj_t *mo) -{ - mo->flags2 &= ~MF2_BLASTED; - if(!(mo->flags & MF_ICECORPSE)) - { - mo->flags2 &= ~MF2_SLIDE; - } -} + // Jumping. + if(pl->jumptics) + pl->jumptics--; -void P_BlastMobj(mobj_t *source, mobj_t *victim, fixed_t strength) -{ - angle_t angle, ang; - mobj_t *mo; - fixed_t pos[3]; + P_CheckPlayerJump(pl); - angle = R_PointToAngle2(source->pos[VX], source->pos[VY], - victim->pos[VX], victim->pos[VY]); - angle >>= ANGLETOFINESHIFT; - if(strength < BLAST_FULLSTRENGTH) + // Flying. + fly = cmd->fly; //lookfly >> 4; +/* if(fly > 7) { - victim->momx = FixedMul(strength, finecosine[angle]); - victim->momy = FixedMul(strength, finesine[angle]); - if(victim->player) - { - // Players handled automatically - } - else - { - victim->flags2 |= MF2_SLIDE; - victim->flags2 |= MF2_BLASTED; - } + fly -= 16; } - else // full strength blast from artifact +*/ + if(fly && pl->powers[pw_flight]) { - if(victim->flags & MF_MISSILE) - { - switch (victim->type) - { - case MT_SORCBALL1: // don't blast sorcerer balls - case MT_SORCBALL2: - case MT_SORCBALL3: - return; - break; - case MT_MSTAFF_FX2: // Reflect to originator - victim->special1 = (int) victim->target; - victim->target = source; - break; - default: - break; - } - } - if(victim->type == MT_HOLY_FX) + if(fly != TOCENTER) { - if((mobj_t *) (victim->special1) == source) + pl->flyheight = fly * 2; + if(!(mo->ddflags & DDMF_FLY)) { - victim->special1 = (int) victim->target; - victim->target = source; + // Start flying. + // mo->ddflags |= DDMF_FLY | DDMF_NOGRAVITY; } } - victim->momx = FixedMul(BLAST_SPEED, finecosine[angle]); - victim->momy = FixedMul(BLAST_SPEED, finesine[angle]); - - // Spawn blast puff - ang = R_PointToAngle2(victim->pos[VX], victim->pos[VY], - source->pos[VX], source->pos[VY]); - ang >>= ANGLETOFINESHIFT; - - memcpy(pos, victim->pos, sizeof(pos)); - pos[VX] += FixedMul(victim->radius + FRACUNIT, finecosine[ang]); - pos[VY] += FixedMul(victim->radius + FRACUNIT, finesine[ang]); - pos[VZ] -= victim->floorclip + (victim->height >> 1); - - mo = P_SpawnMobj(pos[VX], pos[VY], pos[VZ], MT_BLASTEFFECT); - if(mo) - { - mo->momx = victim->momx; - mo->momy = victim->momy; - } - - if(victim->flags & MF_MISSILE) - { - victim->momz = 8 * FRACUNIT; - mo->momz = victim->momz; - } - else - { - victim->momz = (1000 / victim->info->mass) << FRACBITS; - } - - if(victim->player) - { - // Players handled automatically - } else { - victim->flags2 |= MF2_SLIDE; - victim->flags2 |= MF2_BLASTED; + // mo->ddflags &= ~(DDMF_FLY | DDMF_NOGRAVITY); } } -} - -/* - * Blast all mobj things away - */ -void P_BlastRadius(player_t *player) -{ - mobj_t *mo; - mobj_t *pmo = player->plr->mo; - thinker_t *think; - fixed_t dist; + // We are flying when the Fly flag is set. + if(mo->ddflags & DDMF_FLY) + { + // If we were on a mobj, we are NOT now. + if(mo->onmobj) + mo->onmobj = NULL; - S_StartSound(SFX_ARTIFACT_BLAST, pmo); - P_NoiseAlert(player->plr->mo, player->plr->mo); + // Keep the fly flag in sync. + mo->flags2 |= MF2_FLY; - for(think = gi.thinkercap->next; think != gi.thinkercap; - think = think->next) + mo->momz = pl->flyheight * FRACUNIT; + if(pl->flyheight) + pl->flyheight /= 2; + // Do some fly-bobbing. + if(mo->pos[VZ] > mo->floorz && (mo->flags2 & MF2_FLY) && + !mo->onmobj && (leveltime & 2)) + mo->pos[VZ] += finesine[(FINEANGLES / 20 * leveltime >> 2) & FINEMASK]; + } +#if __JHEXEN__ + else { - if(think->function != P_MobjThinker) - continue; // Not a mobj thinker + // Clear the Fly flag. + mo->flags2 &= ~MF2_FLY; + } +#endif - mo = (mobj_t *) think; - if((mo == pmo) || (mo->flags2 & MF2_BOSS)) - continue; // Not a valid monster - - if((mo->type == MT_POISONCLOUD) || // poison cloud - (mo->type == MT_HOLY_FX) || // holy fx - (mo->flags & MF_ICECORPSE)) // frozen corpse - { - // Let these special cases go - } - else if((mo->flags & MF_COUNTKILL) && (mo->health <= 0)) - { - continue; - } - else if(!(mo->flags & MF_COUNTKILL) && !(mo->player) && - !(mo->flags & MF_MISSILE)) - { // Must be monster, player, or missile - continue; - } - - if(mo->flags2 & MF2_DORMANT) - continue; // no dormant creatures - - if((mo->type == MT_WRAITHB) && (mo->flags2 & MF2_DONTDRAW)) - continue; // no underground wraiths - - if((mo->type == MT_SPLASHBASE) || (mo->type == MT_SPLASH)) - continue; - - if(mo->type == MT_SERPENT || mo->type == MT_SERPENTLEADER) - continue; - - dist = P_ApproxDistance(pmo->pos[VX] - mo->pos[VX], - pmo->pos[VY] - mo->pos[VY]); - if(dist > BLAST_RADIUS_DIST) - continue; // Out of range - - P_BlastMobj(pmo, mo, BLAST_FULLSTRENGTH); - } -} - -/* - * Do class specific effect for everyone in radius - */ -boolean P_HealRadius(player_t *player) -{ - mobj_t *mo; - mobj_t *pmo = player->plr->mo; - thinker_t *think; - fixed_t dist; - int effective = false; - int amount; - - for(think = gi.thinkercap->next; think != gi.thinkercap; - think = think->next) - { - if(think->function != P_MobjThinker) - continue; // Not a mobj thinker - - mo = (mobj_t *) think; - if(!mo->player || mo->health <= 0) - continue; - - dist = P_ApproxDistance(pmo->pos[VX] - mo->pos[VX], - pmo->pos[VY] - mo->pos[VY]); - if(dist > HEAL_RADIUS_DIST) - continue; // Out of range - - switch (player->class) - { - case PCLASS_FIGHTER: // Radius armor boost - if((P_GiveArmor(mo->player, ARMOR_ARMOR, 1)) || - (P_GiveArmor(mo->player, ARMOR_SHIELD, 1)) || - (P_GiveArmor(mo->player, ARMOR_HELMET, 1)) || - (P_GiveArmor(mo->player, ARMOR_AMULET, 1))) - { - effective = true; - S_StartSound(SFX_MYSTICINCANT, mo); - } - break; - case PCLASS_CLERIC: // Radius heal - amount = 50 + (P_Random() % 50); - if(P_GiveBody(mo->player, amount)) - { - effective = true; - S_StartSound(SFX_MYSTICINCANT, mo); - } - break; - case PCLASS_MAGE: // Radius mana boost - amount = 50 + (P_Random() % 50); - if((P_GiveMana(mo->player, MANA_1, amount)) || - (P_GiveMana(mo->player, MANA_2, amount))) - { - effective = true; - S_StartSound(SFX_MYSTICINCANT, mo); - } - break; - case PCLASS_PIG: - default: - break; - } - } - return (effective); -} -#endif - -#if __JHERETIC__ -void P_CheckReadyArtifact() -{ - player_t *player = &players[consoleplayer]; - - if(!player->inventory[inv_ptr].count) - { - // Set position markers and get next readyArtifact - inv_ptr--; - if(inv_ptr < 6) - { - curpos--; - if(curpos < 0) - { - curpos = 0; - } - } - if(inv_ptr >= player->inventorySlotNum) - { - inv_ptr = player->inventorySlotNum - 1; - } - if(inv_ptr < 0) - { - inv_ptr = 0; - } - player->readyArtifact = player->inventory[inv_ptr].type; - - if(!player->inventorySlotNum) - player->readyArtifact = arti_none; - } -} -#endif - -#if __JHERETIC__ || __JHEXEN__ -void P_PlayerNextArtifact(player_t *player) -{ - if(player == &players[consoleplayer]) - { - inv_ptr--; - if(inv_ptr < 6) - { - curpos--; - if(curpos < 0) - { - curpos = 0; - } - } - if(inv_ptr < 0) - { - inv_ptr = player->inventorySlotNum - 1; - if(inv_ptr < 6) - { - curpos = inv_ptr; - } - else - { - curpos = 6; - } - } - player->readyArtifact = player->inventory[inv_ptr].type; - } -} - -void P_PlayerRemoveArtifact(player_t *player, int slot) -{ - int i; - extern int inv_ptr; - extern int curpos; - - player->update |= PSF_INVENTORY; - player->artifactCount--; - if(!(--player->inventory[slot].count)) - { // Used last of a type - compact the artifact list - player->readyArtifact = arti_none; - player->inventory[slot].type = arti_none; - for(i = slot + 1; i < player->inventorySlotNum; i++) - { - player->inventory[i - 1] = player->inventory[i]; - } - player->inventorySlotNum--; - if(player == &players[consoleplayer]) - { // Set position markers and get next readyArtifact - inv_ptr--; - if(inv_ptr < 6) - { - curpos--; - if(curpos < 0) - { - curpos = 0; - } - } - if(inv_ptr >= player->inventorySlotNum) - { - inv_ptr = player->inventorySlotNum - 1; - } - if(inv_ptr < 0) - { - inv_ptr = 0; - } - player->readyArtifact = player->inventory[inv_ptr].type; - } - } -} - -void P_PlayerUseArtifact(player_t *player, artitype_t arti) -{ - int i; -# if __JHERETIC__ - boolean play_sound = false; -# endif - for(i = 0; i < player->inventorySlotNum; i++) - { -# if __JHERETIC__ - if(arti == NUMARTIFACTS) // Use everything in panic? - { - if(P_UseArtifact(player, player->inventory[i].type)) - { // Artifact was used - remove it from inventory - P_PlayerRemoveArtifact(player, i); - play_sound = true; - if(player == &players[consoleplayer]) - ArtifactFlash = 4; - } - } - else -# endif - if(player->inventory[i].type == arti) - { // Found match - try to use - if(P_UseArtifact(player, arti)) - { // Artifact was used - remove it from inventory - P_PlayerRemoveArtifact(player, i); -# if __JHERETIC__ - play_sound = true; -# else - if(arti < arti_firstpuzzitem) - { - S_ConsoleSound(SFX_ARTIFACT_USE, NULL, player - players); - } - else - { - S_ConsoleSound(SFX_PUZZLE_SUCCESS, NULL, player - players); - } -# endif - if(player == &players[consoleplayer]) - ArtifactFlash = 4; - } -# if __JHERETIC__ - else -# else - else if(arti < arti_firstpuzzitem) -# endif - { // Unable to use artifact, advance pointer - P_PlayerNextArtifact(player); - } - break; - } - } - -# if __JHERETIC__ - if(play_sound) - S_ConsoleSound(sfx_artiuse, NULL, player - players); -# endif -} - -/* - * Returns true if the artifact was used. - */ -boolean P_UseArtifact(player_t *player, artitype_t arti) -{ - mobj_t *mo; - angle_t angle; -# if __JHEXEN__ - int i; - int count; -# endif - - switch (arti) - { - case arti_invulnerability: - if(!P_GivePower(player, pw_invulnerability)) - { - return (false); - } - break; -# if __JHERETIC__ - case arti_invisibility: - if(!P_GivePower(player, pw_invisibility)) - { - return (false); - } - break; -# endif - case arti_health: - if(!P_GiveBody(player, 25)) - { - return (false); - } - break; - case arti_superhealth: - if(!P_GiveBody(player, 100)) - { - return (false); - } - break; -# if __JHEXEN__ - case arti_healingradius: - if(!P_HealRadius(player)) - { - return (false); - } - break; -# endif -# if __JHERETIC__ - case arti_tomeofpower: - if(player->morphTics) - { // Attempt to undo chicken - if(P_UndoPlayerMorph(player) == false) - { // Failed - P_DamageMobj(player->plr->mo, NULL, NULL, 10000); - } - else - { // Succeeded - player->morphTics = 0; - S_StartSound(sfx_wpnup, player->plr->mo); - } - } - else - { - if(!P_GivePower(player, pw_weaponlevel2)) - { - return (false); - } - if(player->readyweapon == WP_FIRST) - { - P_SetPsprite(player, ps_weapon, S_STAFFREADY2_1); - } - else if(player->readyweapon == WP_EIGHTH) - { - P_SetPsprite(player, ps_weapon, S_GAUNTLETREADY2_1); - } - } - break; -# endif - case arti_torch: - if(!P_GivePower(player, pw_infrared)) - { - return (false); - } - break; -# if __JHERETIC__ - case arti_firebomb: - angle = player->plr->mo->angle >> ANGLETOFINESHIFT; - mo = P_SpawnMobj(player->plr->mo->pos[VX] + 24 * finecosine[angle], - player->plr->mo->pos[VY] + 24 * finesine[angle], - player->plr->mo->pos[VZ] - player->plr->mo->floorclip + - 15 * FRACUNIT, MT_FIREBOMB); - mo->target = player->plr->mo; - break; -# endif - case arti_egg: - mo = player->plr->mo; - P_SpawnPlayerMissile(mo, MT_EGGFX); - P_SPMAngle(mo, MT_EGGFX, mo->angle - (ANG45 / 6)); - P_SPMAngle(mo, MT_EGGFX, mo->angle + (ANG45 / 6)); - P_SPMAngle(mo, MT_EGGFX, mo->angle - (ANG45 / 3)); - P_SPMAngle(mo, MT_EGGFX, mo->angle + (ANG45 / 3)); - break; - case arti_teleport: - P_ArtiTele(player); - break; - case arti_fly: - if(!P_GivePower(player, pw_flight)) - { - return (false); - } -# if __JHEXEN__ - if(player->plr->mo->momz <= -35 * FRACUNIT) - { // stop falling scream - S_StopSound(0, player->plr->mo); - } -#endif - break; -# if __JHEXEN__ - case arti_summon: - mo = P_SpawnPlayerMissile(player->plr->mo, MT_SUMMON_FX); - if(mo) - { - mo->target = player->plr->mo; - mo->special1 = (int) (player->plr->mo); - mo->momz = 5 * FRACUNIT; - } - break; - case arti_teleportother: - P_ArtiTeleportOther(player); - break; - case arti_poisonbag: - angle = player->plr->mo->angle >> ANGLETOFINESHIFT; - if(player->class == PCLASS_CLERIC) - { - mo = P_SpawnMobj(player->plr->mo->pos[VX] + 16 * finecosine[angle], - player->plr->mo->pos[VY] + 24 * finesine[angle], - player->plr->mo->pos[VZ] - player->plr->mo->floorclip + - 8 * FRACUNIT, MT_POISONBAG); - if(mo) - { - mo->target = player->plr->mo; - } - } - else if(player->class == PCLASS_MAGE) - { - mo = P_SpawnMobj(player->plr->mo->pos[VX] + 16 * finecosine[angle], - player->plr->mo->pos[VY] + 24 * finesine[angle], - player->plr->mo->pos[VZ] - player->plr->mo->floorclip + - 8 * FRACUNIT, MT_FIREBOMB); - if(mo) - { - mo->target = player->plr->mo; - } - } - else // PCLASS_FIGHTER, obviously (also pig, not so obviously) - { - mo = P_SpawnMobj(player->plr->mo->pos[VX], - player->plr->mo->pos[VY], - player->plr->mo->pos[VZ] - player->plr->mo->floorclip + - 35 * FRACUNIT, MT_THROWINGBOMB); - if(mo) - { - mo->angle = - player->plr->mo->angle + (((P_Random() & 7) - 4) << 24); - mo->momz = - 4 * FRACUNIT + - (((int) player->plr->lookdir) << (FRACBITS - 4)); - mo->pos[VZ] += ((int) player->plr->lookdir) << (FRACBITS - 4); - P_ThrustMobj(mo, mo->angle, mo->info->speed); - mo->momx += player->plr->mo->momx >> 1; - mo->momy += player->plr->mo->momy >> 1; - mo->target = player->plr->mo; - mo->tics -= P_Random() & 3; - P_CheckMissileSpawn(mo); - } - } - break; - case arti_speed: - if(!P_GivePower(player, pw_speed)) - { - return (false); - } - break; - case arti_boostmana: - if(!P_GiveMana(player, MANA_1, MAX_MANA)) - { - if(!P_GiveMana(player, MANA_2, MAX_MANA)) - { - return false; - } - - } - else - { - P_GiveMana(player, MANA_2, MAX_MANA); - } - break; - case arti_boostarmor: - count = 0; - - for(i = 0; i < NUMARMOR; i++) - { - count += P_GiveArmor(player, i, 1); // 1 point per armor type - } - if(!count) - { - return false; - } - break; - case arti_blastradius: - P_BlastRadius(player); - break; - - case arti_puzzskull: - case arti_puzzgembig: - case arti_puzzgemred: - case arti_puzzgemgreen1: - case arti_puzzgemgreen2: - case arti_puzzgemblue1: - case arti_puzzgemblue2: - case arti_puzzbook1: - case arti_puzzbook2: - case arti_puzzskull2: - case arti_puzzfweapon: - case arti_puzzcweapon: - case arti_puzzmweapon: - case arti_puzzgear1: - case arti_puzzgear2: - case arti_puzzgear3: - case arti_puzzgear4: - if(P_UsePuzzleItem(player, arti - arti_firstpuzzitem)) - { - return true; - } - else - { - P_SetYellowMessage(player, TXT_USEPUZZLEFAILED); - return false; - } - break; -# endif - default: - return false; - } - return true; -} -#endif - -#if __JHEXEN__ -void C_DECL A_SpeedFade(mobj_t *actor) -{ - actor->flags |= MF_SHADOW; - actor->flags &= ~MF_ALTSHADOW; - actor->sprite = actor->target->sprite; -} -#endif - -/* - * Called once per tick by P_Ticker. - * This routine does all the thinking for the console player during - * netgames. - */ -void P_ClientSideThink() -{ - int i; - player_t *pl; - ddplayer_t *dpl; - mobj_t *mo; - ticcmd_t *cmd; - int fly; - - if(!IS_CLIENT || !Get(DD_GAME_READY)) - return; - - pl = &players[consoleplayer]; - dpl = pl->plr; - mo = dpl->mo; - - if(!mo) - return; - - cmd = &pl->cmd; // The latest local command. - P_CalcHeight(pl); - - // Message timer. - pl->messageTics--; // Can go negative - if(!pl->messageTics -#if __JHEXEN__ - || pl->messageTics == -1 -#endif - ) - { // Refresh the screen when a message goes away -#if __JHEXEN__ - pl->ultimateMessage = false; // clear out any chat messages. - pl->yellowMessage = false; -#endif - GL_Update(DDUF_TOP); - } - -#if __JHEXEN__ - if(pl->morphTics > 0) - pl->morphTics--; - if(pl->jumpTics) - pl->jumpTics--; -#endif - - // Powers tic away. - for(i = 0; i < NUMPOWERS; i++) - { - switch (i) - { -#if __JDOOM__ - case pw_invulnerability: - case pw_invisibility: - case pw_ironfeet: - case pw_infrared: -#elif __JHEXEN__ - case pw_invulnerability: - case pw_infrared: - case pw_flight: - case pw_speed: - case pw_minotaur: -#endif - if(pl->powers[i] > 0) - pl->powers[i]--; - else - pl->powers[i] = 0; - break; - } - } - -#if __JDOOM__ - // Are we dead? - if(pl->playerstate == PST_DEAD) - { - if(dpl->viewheight > 6 * FRACUNIT) - dpl->viewheight -= FRACUNIT; - if(dpl->viewheight < 6 * FRACUNIT) - dpl->viewheight = 6 * FRACUNIT; - } - - // Jumping. - if(pl->jumptics) - pl->jumptics--; - P_CheckPlayerJump(pl); -#elif __JHEXEN__ - if(cmd->jump) - P_PlayerJump(pl); -#endif - - // Flying. - fly = cmd->fly; //lookfly >> 4; -/* if(fly > 7) - { - fly -= 16; - } -*/ - if(fly && pl->powers[pw_flight]) - { - if(fly != TOCENTER) - { - pl->flyheight = fly * 2; - if(!(mo->ddflags & DDMF_FLY)) - { - // Start flying. - // mo->ddflags |= DDMF_FLY | DDMF_NOGRAVITY; - } - } - else - { - // mo->ddflags &= ~(DDMF_FLY | DDMF_NOGRAVITY); - } - } - // We are flying when the Fly flag is set. - if(mo->ddflags & DDMF_FLY) - { - // If we were on a mobj, we are NOT now. - if(mo->onmobj) - mo->onmobj = NULL; - - // Keep the fly flag in sync. - mo->flags2 |= MF2_FLY; - - mo->momz = pl->flyheight * FRACUNIT; - if(pl->flyheight) - pl->flyheight /= 2; - // Do some fly-bobbing. - if(mo->pos[VZ] > mo->floorz && (mo->flags2 & MF2_FLY) && - !mo->onmobj && (leveltime & 2)) - mo->pos[VZ] += finesine[(FINEANGLES / 20 * leveltime >> 2) & FINEMASK]; - } -#if __JHEXEN__ - else - { - // Clear the Fly flag. - mo->flags2 &= ~MF2_FLY; - } -#endif - -#if __JHEXEN__ - if(xsectors[P_GetIntp(mo->subsector, DMU_SECTOR)].special) - P_PlayerInSpecialSector(pl); +#if __JHEXEN__ + if(xsectors[P_GetIntp(mo->subsector, DMU_SECTOR)].special) + P_PlayerInSpecialSector(pl); // Set consoleplayer thrust multiplier. if(mo->pos[VZ] > mo->floorz) // Airborne? @@ -1745,7 +905,6 @@ void P_PlayerThink(player_t *player) weapontype_t newweapon, oldweapon; #if __JHEXEN__ int floorType; - int playerNumber = player - players; #endif // jDoom @@ -1788,11 +947,7 @@ void P_PlayerThink(player_t *player) // messageTics is above the rest of the counters so that messages will // go away, even in death. player->messageTics--; // Can go negative - if(!player->messageTics -#if __JHEXEN__ - || player->messageTics == -1 -#endif - ) + if(!player->messageTics) { // Refresh the screen when a message goes away #if __JHEXEN__ player->ultimateMessage = false; // clear out any chat messages. @@ -1811,10 +966,6 @@ void P_PlayerThink(player_t *player) } #if __JHEXEN__ - if(player->jumpTics) - { - player->jumpTics--; - } if(player->morphTics) { P_MorphPlayerThink(player); @@ -1881,6 +1032,7 @@ void P_PlayerThink(player_t *player) if(P_XSector(P_GetPtrp(player->plr->mo->subsector, DMU_SECTOR))->special) P_PlayerInSpecialSector(player); + #if __JHEXEN__ if((floorType = P_GetThingFloorType(player->plr->mo)) != FLOOR_SOLID) { @@ -1915,32 +1067,37 @@ void P_PlayerThink(player_t *player) default: break; } +#endif - if(cmd->jump && onground && !player->jumpTics) - { - P_PlayerJump(player); - } + if(player->jumptics) + player->jumptics--; +#if __JHERETIC__ || __JHEXEN__ || __JSTRIFE__ if(cmd->arti) { // Use an artifact if(cmd->arti == NUMARTIFACTS) { // use one of each artifact (except puzzle artifacts) int i; - - for(i = 1; i < arti_firstpuzzitem; i++) +# if __JHEXEN__ || __JSTRIFE__ + for(i = arti_none + 1; i < arti_firstpuzzitem; i++) +# else + for(i = arti_none + 1; i < NUMARTIFACTS; i++) +# endif { - P_PlayerUseArtifact(player, i); + P_InventoryUseArtifact(player, i); } } + else if(cmd->arti == 0xff) + { + P_InventoryNextArtifact(player); + } else { - P_PlayerUseArtifact(player, cmd->arti); + P_InventoryUseArtifact(player, cmd->arti); } } -#elif __JDOOM__ - if(player->jumptics) - player->jumptics--; #endif + oldweapon = player->pendingweapon; // There might be a special weapon change. @@ -1954,11 +1111,11 @@ void P_PlayerThink(player_t *player) } // Check for weapon change. - if(cmd->changeWeapon #if __JHEXEN__ - && !player->morphTics + if(cmd->changeWeapon && !player->morphTics) +#else + if(cmd->changeWeapon) #endif - ) { // The actual changing of the weapon is done // when the weapon psprite can do it @@ -1982,11 +1139,13 @@ void P_PlayerThink(player_t *player) } if(player->pendingweapon != oldweapon) + { #if __JDOOM__ player->update |= PSF_PENDING_WEAPON | PSF_READY_WEAPON; #elif __JHEXEN__ player->update |= PSF_PENDING_WEAPON; #endif + } // check for use if(cmd->use) @@ -2015,11 +1174,17 @@ void P_PlayerThink(player_t *player) P_MovePsprites(player); // Counters, time dependend power ups. + #if __JDOOM__ // Strength counts up to diminish fade. if(player->powers[pw_strength]) player->powers[pw_strength]++; + if(player->powers[pw_ironfeet]) + player->powers[pw_ironfeet]--; +#endif + +#if __JDOOM__ || __JHERETIC__ if(player->powers[pw_invulnerability]) player->powers[pw_invulnerability]--; @@ -2028,72 +1193,25 @@ void P_PlayerThink(player_t *player) if(!--player->powers[pw_invisibility]) player->plr->mo->flags &= ~MF_SHADOW; } +#endif +#if __JDOOM__ || __JHEXEN__ if(player->powers[pw_infrared]) player->powers[pw_infrared]--; - - if(player->powers[pw_ironfeet]) - player->powers[pw_ironfeet]--; +#endif if(player->damagecount) player->damagecount--; if(player->bonuscount) player->bonuscount--; -#elif __JHEXEN__ - if(player->powers[pw_invulnerability]) - { - if(player->class == PCLASS_CLERIC) - { - if(!(leveltime & 7) && player->plr->mo->flags & MF_SHADOW && - !(player->plr->mo->flags2 & MF2_DONTDRAW)) - { - player->plr->mo->flags &= ~MF_SHADOW; - if(!(player->plr->mo->flags & MF_ALTSHADOW)) - { - player->plr->mo->flags2 |= MF2_DONTDRAW | MF2_NONSHOOTABLE; - } - } - if(!(leveltime & 31)) - { - if(player->plr->mo->flags2 & MF2_DONTDRAW) - { - if(!(player->plr->mo->flags & MF_SHADOW)) - { - player->plr->mo->flags |= MF_SHADOW | MF_ALTSHADOW; - } - else - { - player->plr->mo->flags2 &= - ~(MF2_DONTDRAW | MF2_NONSHOOTABLE); - } - } - else - { - player->plr->mo->flags |= MF_SHADOW; - player->plr->mo->flags &= ~MF_ALTSHADOW; - } - } - } - if(!(--player->powers[pw_invulnerability])) - { - player->plr->mo->flags2 &= ~(MF2_INVULNERABLE | MF2_REFLECTIVE); - if(player->class == PCLASS_CLERIC) - { - player->plr->mo->flags2 &= ~(MF2_DONTDRAW | MF2_NONSHOOTABLE); - player->plr->mo->flags &= ~(MF_SHADOW | MF_ALTSHADOW); - } - } - } - if(player->powers[pw_minotaur]) - { - player->powers[pw_minotaur]--; - } - if(player->powers[pw_infrared]) - { - player->powers[pw_infrared]--; - } + +#if __JHERETIC__ || __JHEXEN__ +# if __JHERETIC__ + if(player->powers[pw_flight]) +# elif __JHEXEN__ if(player->powers[pw_flight] && IS_NETGAME) +# endif { if(!--player->powers[pw_flight]) { @@ -2107,41 +1225,36 @@ void P_PlayerThink(player_t *player) GL_Update(DDUF_TOP); } } - if(player->powers[pw_speed]) - { - player->powers[pw_speed]--; - } - if(player->damagecount) - { - player->damagecount--; - } - if(player->bonuscount) - { - player->bonuscount--; - } - if(player->poisoncount && !(leveltime & 15)) +#endif + +#if __JHERETIC__ + if(player->powers[pw_weaponlevel2]) { - player->poisoncount -= 5; - if(player->poisoncount < 0) + if(!--player->powers[pw_weaponlevel2]) { - player->poisoncount = 0; + if((player->readyweapon == WP_SIXTH) && + (player->psprites[ps_weapon].state != &states[S_PHOENIXREADY]) + && (player->psprites[ps_weapon].state != &states[S_PHOENIXUP])) + { + P_SetPsprite(player, ps_weapon, S_PHOENIXREADY); + player->ammo[am_phoenixrod] -= USE_PHRD_AMMO_2; + player->refire = 0; + player->update |= PSF_AMMO; + } + else if((player->readyweapon == WP_EIGHTH) || + (player->readyweapon == WP_FIRST)) + { + player->pendingweapon = player->readyweapon; + player->update |= PSF_PENDING_WEAPON; + } + //BorderTopRefresh = true; + GL_Update(DDUF_TOP); } - P_PoisonDamage(player, player->poisoner, 1, true); } +#endif + // Colormaps - // if(player->powers[pw_invulnerability]) - // { - // if(player->powers[pw_invulnerability] > BLINKTHRESHOLD - // || (player->powers[pw_invulnerability]&8)) - // { - // player->plr->fixedcolormap = INVERSECOLORMAP; - // } - // else - // { - // player->plr->fixedcolormap = 0; - // } - // } - // else +#if __JHERETIC__ || __JHEXEN__ if(player->powers[pw_infrared]) { if(player->powers[pw_infrared] <= BLINKTHRESHOLD) @@ -2158,6 +1271,7 @@ void P_PlayerThink(player_t *player) else if(!(leveltime & 16)) /* && player == &players[consoleplayer]) */ { ddplayer_t *dp = player->plr; + int playerNumber = player - players; if(newtorch[playerNumber]) { @@ -2186,5 +1300,71 @@ void P_PlayerThink(player_t *player) { player->plr->fixedcolormap = 0; } + +# if __JHEXEN__ + if(player->powers[pw_invulnerability]) + { + if(player->class == PCLASS_CLERIC) + { + if(!(leveltime & 7) && player->plr->mo->flags & MF_SHADOW && + !(player->plr->mo->flags2 & MF2_DONTDRAW)) + { + player->plr->mo->flags &= ~MF_SHADOW; + if(!(player->plr->mo->flags & MF_ALTSHADOW)) + { + player->plr->mo->flags2 |= MF2_DONTDRAW | MF2_NONSHOOTABLE; + } + } + if(!(leveltime & 31)) + { + if(player->plr->mo->flags2 & MF2_DONTDRAW) + { + if(!(player->plr->mo->flags & MF_SHADOW)) + { + player->plr->mo->flags |= MF_SHADOW | MF_ALTSHADOW; + } + else + { + player->plr->mo->flags2 &= + ~(MF2_DONTDRAW | MF2_NONSHOOTABLE); + } + } + else + { + player->plr->mo->flags |= MF_SHADOW; + player->plr->mo->flags &= ~MF_ALTSHADOW; + } + } + } + if(!(--player->powers[pw_invulnerability])) + { + player->plr->mo->flags2 &= ~(MF2_INVULNERABLE | MF2_REFLECTIVE); + if(player->class == PCLASS_CLERIC) + { + player->plr->mo->flags2 &= ~(MF2_DONTDRAW | MF2_NONSHOOTABLE); + player->plr->mo->flags &= ~(MF_SHADOW | MF_ALTSHADOW); + } + } + } + if(player->powers[pw_minotaur]) + { + player->powers[pw_minotaur]--; + } + + if(player->powers[pw_speed]) + { + player->powers[pw_speed]--; + } + + if(player->poisoncount && !(leveltime & 15)) + { + player->poisoncount -= 5; + if(player->poisoncount < 0) + { + player->poisoncount = 0; + } + P_PoisonDamage(player, player->poisoner, 1, true); + } +# endif #endif } diff --git a/doomsday/plugins/common/src/p_xgline.c b/doomsday/plugins/common/src/p_xgline.c index ea80f25083..967dbb382c 100644 --- a/doomsday/plugins/common/src/p_xgline.c +++ b/doomsday/plugins/common/src/p_xgline.c @@ -33,7 +33,6 @@ # include "doomstat.h" # include "d_config.h" # include "s_sound.h" -# include "m_random.h" # include "p_inter.h" # include "r_defs.h" # include "g_game.h" diff --git a/doomsday/plugins/common/src/p_xgsec.c b/doomsday/plugins/common/src/p_xgsec.c index c4f6c06efc..43c655abde 100644 --- a/doomsday/plugins/common/src/p_xgsec.c +++ b/doomsday/plugins/common/src/p_xgsec.c @@ -33,7 +33,6 @@ # include "doomstat.h" # include "d_config.h" # include "s_sound.h" -# include "m_random.h" # include "p_inter.h" # include "r_defs.h" #elif __JHERETIC__ diff --git a/doomsday/plugins/jdoom/include/d_config.h b/doomsday/plugins/jdoom/include/d_config.h index 9949c5cfe7..31555237b7 100644 --- a/doomsday/plugins/jdoom/include/d_config.h +++ b/doomsday/plugins/jdoom/include/d_config.h @@ -33,9 +33,23 @@ enum { HUD_AMMO, HUD_KEYS, HUD_FRAGS, - HUD_FACE + HUD_FACE, + NUMHUDDISPLAYS }; +// Hud Unhide Events (the hud will unhide on these events if enabled). +typedef enum hueevent_e { + HUE_FORCE = -1, + HUE_ON_DAMAGE, + HUE_ON_PICKUP_HEALTH, + HUE_ON_PICKUP_ARMOR, + HUE_ON_PICKUP_POWER, + HUE_ON_PICKUP_WEAPON, + HUE_ON_PICKUP_AMMO, + HUE_ON_PICKUP_KEY, + NUMHUDUNHIDEEVENTS +} hueevent_t; + // WARNING: Do not use the boolean type. Its size can be either 1 or 4 bytes // depending on build settings. @@ -76,10 +90,12 @@ typedef struct jdoom_config_s { float flashcolor[3]; int flashspeed; byte turningSkull; - byte hudShown[6]; // HUD data visibility. + byte hudShown[NUMHUDDISPLAYS]; // HUD data visibility. float hudScale; // How to scale HUD data? float hudColor[4]; float hudIconAlpha; + float hudTimer; // Number of seconds until the hud/statusbar auto-hides. + byte hudUnHide[NUMHUDUNHIDEEVENTS]; // when the hud/statusbar unhides. byte usePatchReplacement; byte moveCheckZ; // if true, mobjs can move over/under each other. byte weaponAutoSwitch; diff --git a/doomsday/plugins/jdoom/include/d_items.h b/doomsday/plugins/jdoom/include/d_items.h index aec1d197d4..d3c7074a9c 100644 --- a/doomsday/plugins/jdoom/include/d_items.h +++ b/doomsday/plugins/jdoom/include/d_items.h @@ -19,6 +19,10 @@ #ifndef __D_ITEMS__ #define __D_ITEMS__ +#ifndef __JDOOM__ +# error "Using jDoom headers without __JDOOM__" +#endif + #include "doomdef.h" #ifdef __GNUG__ diff --git a/doomsday/plugins/jdoom/include/doomdef.h b/doomsday/plugins/jdoom/include/doomdef.h index db35522630..63e803d1b2 100644 --- a/doomsday/plugins/jdoom/include/doomdef.h +++ b/doomsday/plugins/jdoom/include/doomdef.h @@ -60,6 +60,9 @@ extern game_export_t gx; #define VERBOSE(code) { if(verbose >= 1) { code; } } #define VERBOSE2(code) { if(verbose >= 2) { code; } } +// Misc macros. +#define CLAMP(v, min, max) (v < min? v=min : v > max? v=max : v) + // Game mode handling - identify IWAD version // to handle IWAD dependend animations etc. typedef enum { @@ -141,6 +144,8 @@ typedef struct classinfo_s{ fixed_t maxmove; fixed_t forwardmove[2]; // walk, run fixed_t sidemove[2]; // walk, run + int movemul; // multiplier for above + int jumptics; // wait inbetween jumps } classinfo_t; extern classinfo_t classInfo[NUMCLASSES]; @@ -212,7 +217,7 @@ typedef enum { AM_NOAMMO // Unlimited for chainsaw / fist. } ammotype_t; -// Power up artifacts. +// Power ups. typedef enum { pw_invulnerability, pw_strength, @@ -243,7 +248,11 @@ enum { VX, VY, VZ }; // Vertex indices. #define IS_NETGAME Get(DD_NETGAME) #define IS_DEDICATED Get(DD_DEDICATED) -void D_IdentifyVersion(void); +//returns a number from 0 to 255 +int P_Random(void); +void M_ClearRandom(void); + +void G_IdentifyVersion(void); char *G_Get(int id); void R_SetViewSize(int blocks, int detail); diff --git a/doomsday/plugins/jdoom/include/m_ctrl.h b/doomsday/plugins/jdoom/include/m_ctrl.h index f60239e64d..1e57f992c1 100644 --- a/doomsday/plugins/jdoom/include/m_ctrl.h +++ b/doomsday/plugins/jdoom/include/m_ctrl.h @@ -28,33 +28,7 @@ #include "mn_def.h" #include "d_action.h" - -#define CTLCFG_TYPE void - -CTLCFG_TYPE SCControlConfig(int option, void *data); - -// Control flags. -#define CLF_ACTION 0x1 // The control is an action (+/- in front). -#define CLF_REPEAT 0x2 // Bind down + repeat. - -typedef struct { - char *command; // The command to execute. - int flags; - int bindClass; // Class it should be bound into - int defKey; // - int defMouse; // Zero means there is no default. - int defJoy; // -} Control_t; - -// Game registered bindClasses -enum { - GBC_CLASS1 = NUM_DDBINDCLASSES, - GBC_CLASS2, - GBC_CLASS3, - GBC_MENUHOTKEY, - GBC_CHAT, - GBC_MESSAGE -}; +#include "g_controls.h" // // !!! Add new controls to the end, the existing indices must remain unchanged !!! diff --git a/doomsday/plugins/jdoom/include/m_menu.h b/doomsday/plugins/jdoom/include/m_menu.h deleted file mode 100644 index 9b417fb8bc..0000000000 --- a/doomsday/plugins/jdoom/include/m_menu.h +++ /dev/null @@ -1,74 +0,0 @@ -/* $Id$ - * - * Copyright (C) 1993-1996 by id Software, Inc. - * - * This source is available for distribution and/or modification - * only under the terms of the DOOM Source Code License as - * published by id Software. All rights reserved. - * - * The source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License - * for more details. - */ - -/* - * Menu widget stuff, episode selection and such. - */ - -#ifndef __M_MENU__ -#define __M_MENU__ - -#ifndef __JDOOM__ -# error "Using jDoom headers without __JDOOM__" -#endif - -#include "hu_stuff.h" -#include "d_event.h" - -// -// MENUS -// -// Called by main loop, -// saves config file and calls I_Quit when user exits. -// 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. -boolean M_Responder(event_t *ev); - -// Called by Init -// registers all the CCmds and CVars for the menu -void MN_Register(void); - -// Called by main loop, -// only used for menu (skull cursor) animation. -// and menu fog, fading in and out... -void MN_Ticker(void); - -// Called by main loop, -// draws the menus directly into the screen buffer. -void M_Drawer(void); - -// Called by D_DoomMain, -// loads the config file. -void MN_Init(void); -void M_LoadData(void); -void M_UnloadData(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_ClearMenus(void); - -void M_StartMessage(char *string, void *routine, boolean input); -void M_StopMessage(void); - -void M_WriteText2(int x, int y, char *string, dpatch_t *font, - float red, float green, float blue, float alpha); -void M_WriteText3(int x, int y, const char *string, dpatch_t *font, - float red, float green, float blue, float alpha, - boolean doTypeIn, int initialCount); -DEFCC(CCmdMenuAction); -DEFCC(CCmdMsgResponse); - -#endif diff --git a/doomsday/plugins/jdoom/include/m_random.h b/doomsday/plugins/jdoom/include/m_random.h deleted file mode 100644 index 24932d8892..0000000000 --- a/doomsday/plugins/jdoom/include/m_random.h +++ /dev/null @@ -1,26 +0,0 @@ -/* $Id$ - * - * Copyright (C) 1993-1996 by id Software, Inc. - * - * This source is available for distribution and/or modification - * only under the terms of the DOOM Source Code License as - * published by id Software. All rights reserved. - * - * The source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License - * for more details. - */ - -#ifndef __M_RANDOM__ -#define __M_RANDOM__ - -#include "doomtype.h" - -// Returns a number from 0 to 255 (used only by the play simulation). -int P_Random(void); - -// Fix randoms for demos. -void M_ClearRandom(void); - -#endif diff --git a/doomsday/plugins/jdoom/include/p_local.h b/doomsday/plugins/jdoom/include/p_local.h index 88960567b0..2baeede28a 100644 --- a/doomsday/plugins/jdoom/include/p_local.h +++ b/doomsday/plugins/jdoom/include/p_local.h @@ -121,10 +121,8 @@ enum { extern int iquehead; extern int iquetail; -void P_RespawnSpecials(void); - mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type); - +void P_SpawnMapThing(thing_t * th); void P_RemoveMobj(mobj_t *th); boolean P_SetMobjState(mobj_t *mobj, statenum_t state); void P_MobjThinker(mobj_t *mobj); diff --git a/doomsday/plugins/jdoom/include/p_mobj.h b/doomsday/plugins/jdoom/include/p_mobj.h index 85815c2b88..2728afb06c 100644 --- a/doomsday/plugins/jdoom/include/p_mobj.h +++ b/doomsday/plugins/jdoom/include/p_mobj.h @@ -269,4 +269,6 @@ typedef struct mobj_s { } mobj_t; +void P_RespawnSpecials(void); + #endif diff --git a/doomsday/plugins/jdoom/include/p_spec.h b/doomsday/plugins/jdoom/include/p_spec.h index 4a6add0cce..ce9cc5cd36 100644 --- a/doomsday/plugins/jdoom/include/p_spec.h +++ b/doomsday/plugins/jdoom/include/p_spec.h @@ -404,6 +404,7 @@ void T_MoveFloor(floormove_t * floor); // // P_TELEPT // +#define TELEFOGHEIGHT 0 int EV_Teleport(line_t *line, int side, mobj_t *thing); #endif diff --git a/doomsday/plugins/jdoom/include/st_stuff.h b/doomsday/plugins/jdoom/include/st_stuff.h index b53735c08c..38f6558dc7 100644 --- a/doomsday/plugins/jdoom/include/st_stuff.h +++ b/doomsday/plugins/jdoom/include/st_stuff.h @@ -50,6 +50,9 @@ void ST_Init(void); void ST_updateGraphics(void); +// Called when it might be neccessary for the hud to unhide. +void ST_HUDUnHide(enum hueevent_e event); + // States for status bar code. typedef enum { AutomapState, @@ -63,6 +66,6 @@ typedef enum { GetChatState } st_chatstateenum_t; -int D_GetFilterColor(int filter); +int R_GetFilterColor(int filter); #endif diff --git a/doomsday/plugins/jdoom/src/d_main.c b/doomsday/plugins/jdoom/src/d_main.c index 4e607c1592..44208451d3 100644 --- a/doomsday/plugins/jdoom/src/d_main.c +++ b/doomsday/plugins/jdoom/src/d_main.c @@ -325,7 +325,7 @@ void D_IdentifyFromData(void) /* * gamemode, gamemission and the gameModeString are set. */ -void D_IdentifyVersion(void) +void G_IdentifyVersion(void) { D_IdentifyFromData(); diff --git a/doomsday/plugins/jdoom/src/d_refresh.c b/doomsday/plugins/jdoom/src/d_refresh.c index 692f860802..083b77652c 100644 --- a/doomsday/plugins/jdoom/src/d_refresh.c +++ b/doomsday/plugins/jdoom/src/d_refresh.c @@ -64,8 +64,6 @@ extern int actual_leveltime; extern dpatch_t *lnames; extern boolean amap_fullyopen; - -extern boolean inhelpscreens; extern float lookOffset; // PUBLIC DATA DEFINITIONS ------------------------------------------------- @@ -239,7 +237,6 @@ void D_Display(void) { static boolean viewactivestate = false; static boolean menuactivestate = false; - static boolean inhelpscreensstate = false; static int fullscreenmode = 0; static gamestate_t oldgamestate = -1; int ay; @@ -247,9 +244,6 @@ void D_Display(void) player_t *player = &players[displayplayer]; boolean iscam = (player->plr->flags & DDPF_CAMERA) != 0; // $democam - if(nodrawers) - return; // for comparative timing / profiling - redrawsbar = false; // $democam: can be set on every frame @@ -326,8 +320,6 @@ void D_Display(void) if((viewheight != 200)) redrawsbar = true; - if(inhelpscreensstate && !inhelpscreens) - redrawsbar = true; // just put away the help screen // Do we need to render a full status bar at this point? if (!(automapactive && cfg.automapHudDisplay == 0 )) @@ -378,7 +370,6 @@ void D_Display(void) menuactivestate = menuactive; viewactivestate = viewactive; - inhelpscreensstate = inhelpscreens; oldgamestate = wipegamestate = gamestate; // draw pause pic (but not if InFine active) diff --git a/doomsday/plugins/jdoom/src/g_ctrl.c b/doomsday/plugins/jdoom/src/g_ctrl.c new file mode 100644 index 0000000000..66bdea5b78 --- /dev/null +++ b/doomsday/plugins/jdoom/src/g_ctrl.c @@ -0,0 +1,182 @@ +/* DE1: $Id: template.c 2645 2006-01-21 12:58:39Z skyjake $ + * Copyright (C) 2006 Jaakko Keränen + * Daniel Swanson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * In addition, as a special exception, we, the authors of deng + * give permission to link the code of our release of deng with + * the libjhexen and/or the libjheretic libraries (or with modified + * versions of it that use the same license as the libjhexen or + * libjheretic libraries), and distribute the linked executables. + * You must obey the GNU General Public License in all respects for + * all of the code used other than “libjhexen or libjheretic”. If + * you modify this file, you may extend this exception to your + * version of the file, but you are not obligated to do so. If you + * do not wish to do so, delete this exception statement from your version. + */ + +/* + * g_ctrl.c: Control bindings - DOOM specifc + */ + +// HEADER FILES ------------------------------------------------------------ + +#include "d_action.h" +#include "g_controls.h" + +// MACROS ------------------------------------------------------------------ + +// TYPES ------------------------------------------------------------------- + +// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- + +// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- + +// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- + +// EXTERNAL DATA DECLARATIONS ---------------------------------------------- + +// PUBLIC DATA DEFINITIONS ------------------------------------------------- + +// +// !!! Add new controls to the end, the existing indices must remain unchanged !!! +// +const Control_t controls[] = { + // Actions (must be first so the A_* constants can be used). + {"left", CLF_ACTION, DDBC_NORMAL, DDKEY_LEFTARROW, 0, 0}, + {"right", CLF_ACTION, DDBC_NORMAL, DDKEY_RIGHTARROW, 0, 0}, + {"forward", CLF_ACTION, DDBC_NORMAL, DDKEY_UPARROW, 0, 0}, + {"backward", CLF_ACTION, DDBC_NORMAL, DDKEY_DOWNARROW, 0, 0}, + {"strafel", CLF_ACTION, DDBC_NORMAL, ',', 0, 0}, + {"strafer", CLF_ACTION, DDBC_NORMAL, '.', 0, 0}, + {"fire", CLF_ACTION, DDBC_NORMAL, DDKEY_RCTRL, 1, 1}, + {"use", CLF_ACTION, DDBC_NORMAL, ' ', 0, 4}, + {"strafe", CLF_ACTION, DDBC_NORMAL, DDKEY_RALT, 3, 2}, + {"speed", CLF_ACTION, DDBC_NORMAL, DDKEY_RSHIFT, 0, 3}, + + {"weap1", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"weapon2", CLF_ACTION, DDBC_NORMAL, '2', 0, 0}, + {"weap3", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"weapon4", CLF_ACTION, DDBC_NORMAL, '4', 0, 0}, + {"weapon5", CLF_ACTION, DDBC_NORMAL, '5', 0, 0}, + {"weapon6", CLF_ACTION, DDBC_NORMAL, '6', 0, 0}, + {"weapon7", CLF_ACTION, DDBC_NORMAL, '7', 0, 0}, + {"weapon8", CLF_ACTION, DDBC_NORMAL, '8', 0, 0}, + {"weapon9", CLF_ACTION, DDBC_NORMAL, '9', 0, 0}, + {"nextwpn", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + + {"prevwpn", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"mlook", CLF_ACTION, DDBC_NORMAL, 'm', 0, 0}, + {"jlook", CLF_ACTION, DDBC_NORMAL, 'j', 0, 0}, + {"lookup", CLF_ACTION, DDBC_NORMAL, DDKEY_PGDN, 0, 6}, + {"lookdown", CLF_ACTION, DDBC_NORMAL, DDKEY_DEL, 0, 7}, + {"lookcntr", CLF_ACTION, DDBC_NORMAL, DDKEY_END, 0, 0}, + {"jump", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"demostop", CLF_ACTION, DDBC_NORMAL, 'o', 0, 0}, + + // Menu hotkeys (default: F1 - F12). + /*28 */ {"HelpScreen", 0, DDBC_NORMAL, DDKEY_F1, 0, 0}, + {"SaveGame", 0, DDBC_NORMAL, DDKEY_F2, 0, 0}, + + {"LoadGame", 0, DDBC_NORMAL, DDKEY_F3, 0, 0}, + {"SoundMenu", 0, DDBC_NORMAL, DDKEY_F4, 0, 0}, + {"QuickSave", 0, DDBC_NORMAL, DDKEY_F6, 0, 0}, + {"EndGame", 0, DDBC_NORMAL, DDKEY_F7, 0, 0}, + {"ToggleMsgs", 0, DDBC_NORMAL, DDKEY_F8, 0, 0}, + {"QuickLoad", 0, DDBC_NORMAL, DDKEY_F9, 0, 0}, + {"quit", 0, DDBC_NORMAL, DDKEY_F10, 0, 0}, + {"ToggleGamma", 0, DDBC_NORMAL, DDKEY_F11, 0, 0}, + {"spy", 0, DDBC_NORMAL, DDKEY_F12, 0, 0}, + + // Screen controls. + {"viewsize -", CLF_REPEAT, DDBC_NORMAL, '-', 0, 0}, + {"viewsize +", CLF_REPEAT, DDBC_NORMAL, '=', 0, 0}, + {"sbsize -", CLF_REPEAT, DDBC_NORMAL, 0, 0, 0}, + {"sbsize +", CLF_REPEAT, DDBC_NORMAL, 0, 0, 0}, + + // Misc. + {"pause", 0, DDBC_NORMAL, DDKEY_PAUSE, 0, 0}, + {"screenshot", 0, DDBC_NORMAL, 0, 0, 0}, + {"beginchat", 0, DDBC_NORMAL, 't', 0, 0}, + {"beginchat 0", 0, DDBC_NORMAL, 'g', 0, 0}, + {"beginchat 1", 0, DDBC_NORMAL, 'i', 0, 0}, + {"beginchat 2", 0, DDBC_NORMAL, 'b', 0, 0}, + {"beginchat 3", 0, DDBC_NORMAL, 'r', 0, 0}, + {"msgrefresh", 0, DDBC_NORMAL, DDKEY_ENTER, 0, 0}, + + // More weapons. + {"weapon1", CLF_ACTION, DDBC_NORMAL, '1', 0, 0}, + {"weapon3", CLF_ACTION, DDBC_NORMAL, '3', 0, 0}, + + {"automap", 0, DDBC_NORMAL, DDKEY_TAB, 0, 0}, + {"follow", 0, GBC_CLASS1, 'f', 0, 0}, + {"rotate", 0, GBC_CLASS1, 'r', 0, 0}, + {"grid", 0, GBC_CLASS1, 'g', 0, 0}, + {"mzoomin", CLF_ACTION, GBC_CLASS1, '=', 0, 0}, + {"mzoomout", CLF_ACTION, GBC_CLASS1, '-', 0, 0}, + {"zoommax", 0, GBC_CLASS1, '0', 0, 0}, + {"addmark", 0, GBC_CLASS1, 'm', 0, 0}, + {"clearmarks", 0, GBC_CLASS1, 'c', 0, 0}, + {"mpanup", CLF_ACTION, GBC_CLASS2, DDKEY_UPARROW, 0, 0}, + {"mpandown", CLF_ACTION, GBC_CLASS2, DDKEY_DOWNARROW, 0, 0}, + {"mpanleft", CLF_ACTION, GBC_CLASS2, DDKEY_LEFTARROW, 0, 0}, + {"mpanright", CLF_ACTION, GBC_CLASS2, DDKEY_RIGHTARROW, 0, 0}, + + // Menu actions. + {"menuup", CLF_REPEAT, GBC_CLASS3, DDKEY_UPARROW, 0, 0}, + {"menudown", CLF_REPEAT, GBC_CLASS3, DDKEY_DOWNARROW, 0, 0}, + {"menuleft", CLF_REPEAT, GBC_CLASS3, DDKEY_LEFTARROW, 0, 0}, + {"menuright", CLF_REPEAT, GBC_CLASS3, DDKEY_RIGHTARROW, 0, 0}, + {"menuselect", 0, GBC_CLASS3, DDKEY_ENTER, 0, 0}, + {"menucancel", 0, GBC_CLASS3, DDKEY_BACKSPACE, 0, 0}, + {"menu", 0, GBC_MENUHOTKEY, DDKEY_ESCAPE, 0, 0}, + + // More chat actions. + {"chatcomplete", 0, GBC_CHAT, DDKEY_ENTER, 0, 0}, + {"chatcancel", 0, GBC_CHAT, DDKEY_ESCAPE, 0, 0}, + {"chatsendmacro 0", 0, GBC_CHAT, DDKEY_F1, 0, 0}, + {"chatsendmacro 1", 0, GBC_CHAT, DDKEY_F2, 0, 0}, + {"chatsendmacro 2", 0, GBC_CHAT, DDKEY_F3, 0, 0}, + {"chatsendmacro 3", 0, GBC_CHAT, DDKEY_F4, 0, 0}, + {"chatsendmacro 4", 0, GBC_CHAT, DDKEY_F5, 0, 0}, + {"chatsendmacro 5", 0, GBC_CHAT, DDKEY_F6, 0, 0}, + {"chatsendmacro 6", 0, GBC_CHAT, DDKEY_F7, 0, 0}, + {"chatsendmacro 7", 0, GBC_CHAT, DDKEY_F8, 0, 0}, + {"chatsendmacro 8", 0, GBC_CHAT, DDKEY_F9, 0, 0}, + {"chatsendmacro 9", 0, GBC_CHAT, DDKEY_F10, 0, 0}, + {"chatdelete", 0, GBC_CHAT, DDKEY_BACKSPACE, 0, 0}, + + {"messageyes", 0, GBC_MESSAGE, 'y', 0, 0}, + {"messageno", 0, GBC_MESSAGE, 'n', 0, 0}, + {"messagecancel", 0, GBC_MESSAGE, DDKEY_ESCAPE, 0, 0}, + + // More movement controls + {"flyup", CLF_ACTION, DDBC_NORMAL, DDKEY_PGUP, 0, 8}, + {"flydown", CLF_ACTION, DDBC_NORMAL, DDKEY_INS, 0, 9}, + {"falldown", CLF_ACTION, DDBC_NORMAL, DDKEY_HOME, 0, 0}, + + {"showhud", 0, DDBC_NORMAL, 'h', 0, 0}, + + // More menu controls + {"menunextpage", 0, GBC_CLASS3, DDKEY_PGDN, 0, 0}, + {"menuprevpage", 0, GBC_CLASS3, DDKEY_PGUP, 0, 0}, + {"", 0, 0, 0, 0, 0} // terminator +}; + +// PRIVATE DATA DEFINITIONS ------------------------------------------------ + +// CODE -------------------------------------------------------------------- diff --git a/doomsday/plugins/jdoom/src/m_cheat.c b/doomsday/plugins/jdoom/src/m_cheat.c index 92c4d799a9..049577fe62 100644 --- a/doomsday/plugins/jdoom/src/m_cheat.c +++ b/doomsday/plugins/jdoom/src/m_cheat.c @@ -41,8 +41,6 @@ // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- -void M_ClearMenus(void); - // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- @@ -50,9 +48,8 @@ void M_ClearMenus(void); // EXTERNAL DATA DECLARATIONS ---------------------------------------------- extern boolean automapactive; -extern int cheating; - extern int messageResponse; +extern int cheating; // PUBLIC DATA DEFINITIONS ------------------------------------------------- @@ -751,11 +748,9 @@ DEFCC(CCmdCheatGive) if(weapNum >= 0 && weapNum < NUMWEAPONS) { P_GiveWeapon(plyr, weapNum, false); - return true; - } - // Unrecognized - Con_Printf("What do you mean, '%c'?\n", buf[i]); + else // Unrecognized + Con_Printf("What do you mean, '%c'?\n", buf[i]); } } return true; diff --git a/doomsday/plugins/jdoom/src/p_enemy.c b/doomsday/plugins/jdoom/src/p_enemy.c index 3d238ffef1..5d86c1d21a 100644 --- a/doomsday/plugins/jdoom/src/p_enemy.c +++ b/doomsday/plugins/jdoom/src/p_enemy.c @@ -27,7 +27,6 @@ # pragma optimize("g", off) #endif -#include "m_random.h" #include "doomdef.h" #include "d_config.h" #include "p_local.h" diff --git a/doomsday/plugins/jdoom/src/p_inter.c b/doomsday/plugins/jdoom/src/p_inter.c index f0f663deca..53267621e2 100644 --- a/doomsday/plugins/jdoom/src/p_inter.c +++ b/doomsday/plugins/jdoom/src/p_inter.c @@ -26,12 +26,12 @@ #include "d_config.h" #include "dstrings.h" #include "doomstat.h" -#include "m_random.h" #include "am_map.h" #include "d_net.h" #include "p_local.h" #include "s_sound.h" #include "p_inter.h" +#include "st_stuff.h" #include "dmu_lib.h" #include "p_player.h" @@ -98,6 +98,9 @@ boolean P_GiveAmmo(player_t *player, ammotype_t ammo, int num) if(player->ammo[ammo] > player->maxammo[ammo]) player->ammo[ammo] = player->maxammo[ammo]; + // Maybe unhide the HUD? + ST_HUDUnHide(HUE_ON_PICKUP_AMMO); + return true; } @@ -173,6 +176,10 @@ boolean P_GiveWeapon(player_t *player, weapontype_t weapon, boolean dropped) P_MaybeChangeWeapon(player, weapon, AM_NOAMMO, false); } + // Maybe unhide the HUD? + if(gaveweapon) + ST_HUDUnHide(HUE_ON_PICKUP_WEAPON); + return (gaveweapon || gaveammo); } } @@ -192,6 +199,9 @@ boolean P_GiveBody(player_t *player, int num) player->plr->mo->health = player->health; player->update |= PSF_HEALTH; + // Maybe unhide the HUD? + ST_HUDUnHide(HUE_ON_PICKUP_HEALTH); + return true; } @@ -216,6 +226,9 @@ boolean P_GiveArmor(player_t *player, int armortype) player->armorpoints = hits; player->update |= PSF_ARMOR_TYPE | PSF_ARMOR_POINTS; + // Maybe unhide the HUD? + ST_HUDUnHide(HUE_ON_PICKUP_ARMOR); + return true; } @@ -227,6 +240,9 @@ void P_GiveKey(player_t *player, card_t card) player->bonuscount = BONUSADD; player->keys[card] = 1; player->update |= PSF_KEYS; + + // Maybe unhide the HUD? + ST_HUDUnHide(HUE_ON_PICKUP_KEY); } void P_GiveBackpack(player_t *player) @@ -249,20 +265,18 @@ boolean P_GivePower(player_t *player, int power) { player->update |= PSF_POWERS; - if(power == pw_invulnerability) + switch (power) { + case pw_invulnerability: player->powers[power] = INVULNTICS; - return true; - } + break; - if(power == pw_invisibility) - { + case pw_invisibility: player->powers[power] = INVISTICS; - player->plr->mo->flags |= MF_SHADOW; - return true; - } - if(power == pw_flight) - { + player->plr->mo->flags |= MF_SHADOW;; + break; + + case pw_flight: player->powers[power] = 1; player->plr->mo->flags2 |= MF2_FLY; player->plr->mo->flags |= MF_NOGRAVITY; @@ -271,31 +285,31 @@ boolean P_GivePower(player_t *player, int power) player->flyheight = 10; // thrust the player in the air a bit player->plr->mo->flags |= DDPF_FIXMOM; } - return true; - } - if(power == pw_infrared) - { + break; + + case pw_infrared: player->powers[power] = INFRATICS; - return true; - } + break; - if(power == pw_ironfeet) - { + case pw_ironfeet: player->powers[power] = IRONTICS; - return true; - } + break; - if(power == pw_strength) - { + case pw_strength: P_GiveBody(player, maxhealth); player->powers[power] = 1; - return true; - } + break; - if(player->powers[power]) - return false; // already got it + default: + if(player->powers[power]) + return false; // already got it + break; + } player->powers[power] = 1; + + // Maybe unhide the HUD? + ST_HUDUnHide(HUE_ON_PICKUP_POWER); return true; } @@ -372,6 +386,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher) player->plr->mo->health = player->health; player->update |= PSF_HEALTH; P_SetMessage(player, GOTHTHBONUS); + + // Maybe unhide the HUD? + ST_HUDUnHide(HUE_ON_PICKUP_HEALTH); break; case SPR_BON2: @@ -382,6 +399,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher) player->armortype = armorclass[0]; player->update |= PSF_ARMOR_TYPE | PSF_ARMOR_POINTS; P_SetMessage(player, GOTARMBONUS); + + // Maybe unhide the HUD? + ST_HUDUnHide(HUE_ON_PICKUP_ARMOR); break; case SPR_SOUL: @@ -392,6 +412,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher) player->update |= PSF_HEALTH; P_SetMessage(player, GOTSUPER); sound = sfx_getpow; + + // Maybe unhide the HUD? + ST_HUDUnHide(HUE_ON_PICKUP_HEALTH); break; case SPR_MEGA: @@ -403,6 +426,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher) P_GiveArmor(player, armorclass[1]); P_SetMessage(player, GOTMSPHERE); sound = sfx_getpow; + + // Maybe unhide the HUD? + ST_HUDUnHide(HUE_ON_PICKUP_HEALTH); break; // cards @@ -917,6 +943,10 @@ void P_DamageMobj2(mobj_t *target, mobj_t *inflictor, mobj_t *source, player->damagecount = 100; // teleport stomp does 10k points... temp = damage < 100 ? damage : 100; + + // Maybe unhide the HUD? + if(player == &players[consoleplayer]); + ST_HUDUnHide(HUE_ON_DAMAGE); } // How about some particles, yes? diff --git a/doomsday/plugins/jdoom/src/p_lights.c b/doomsday/plugins/jdoom/src/p_lights.c index 490566bdf9..8ce81cd0ca 100644 --- a/doomsday/plugins/jdoom/src/p_lights.c +++ b/doomsday/plugins/jdoom/src/p_lights.c @@ -19,7 +19,6 @@ // HEADER FILES ------------------------------------------------------------ -#include "m_random.h" #include "doomdef.h" #include "p_local.h" diff --git a/doomsday/plugins/jdoom/src/p_map.c b/doomsday/plugins/jdoom/src/p_map.c index aa46eb94db..c267d1342a 100644 --- a/doomsday/plugins/jdoom/src/p_map.c +++ b/doomsday/plugins/jdoom/src/p_map.c @@ -21,7 +21,6 @@ #include -#include "m_random.h" #include "doomdef.h" #include "d_config.h" #include "p_local.h" diff --git a/doomsday/plugins/jdoom/src/p_mobj.c b/doomsday/plugins/jdoom/src/p_mobj.c index e6ed5a8ab5..51c2dba713 100644 --- a/doomsday/plugins/jdoom/src/p_mobj.c +++ b/doomsday/plugins/jdoom/src/p_mobj.c @@ -26,7 +26,6 @@ #include "doomdef.h" #include "d_config.h" -#include "m_random.h" #include "p_local.h" #include "st_stuff.h" #include "hu_stuff.h" @@ -36,8 +35,6 @@ // MACROS ------------------------------------------------------------------ -#define CLAMP(v, min, max) (v < min? v=min : v > max? v=max : v) - #define VANISHTICS (2*TICSPERSEC) #define MAX_BOB_OFFSET 0x80000 @@ -73,13 +70,13 @@ extern fixed_t attackrange; // PUBLIC DATA DEFINITIONS ------------------------------------------------- +// PRIVATE DATA DEFINITIONS ------------------------------------------------ + spawnobj_t itemrespawnque[ITEMQUESIZE]; int itemrespawntime[ITEMQUESIZE]; int iquehead; int iquetail; -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - // CODE -------------------------------------------------------------------- /* @@ -463,7 +460,9 @@ void P_ZMovement(mobj_t *mo) // after hitting the ground (hard), // and utter appropriate sound. mo->dplayer->deltaviewheight = mo->momz >> 3; - S_StartSound(sfx_oof, mo); + + if(mo->player->health > 0) + S_StartSound(sfx_oof, mo); } mo->momz = 0; } @@ -524,7 +523,11 @@ void P_ZMovement(mobj_t *mo) // after hitting the ground (hard), // and utter appropriate sound. mo->dplayer->deltaviewheight = mo->momz >> 3; - S_StartSound(sfx_oof, mo); + + // Fix DOOM bug - dead players grunting when hitting the ground + // (e.g., after an archvile attack) + if(mo->player->health > 0) + S_StartSound(sfx_oof, mo); } P_HitFloor(mo); mo->momz = 0; @@ -1001,13 +1004,6 @@ void P_RespawnSpecials(void) iquetail = (iquetail + 1) & (ITEMQUESIZE - 1); } -mobj_t *P_SpawnTeleFog(int x, int y) -{ - return P_SpawnMobj(x, y, - P_GetFixedp(R_PointInSubsector(x, y), DMU_FLOOR_HEIGHT), - MT_TFOG); -} - /* * Called when a player is spawned on the level. * Most of the player structure stays unchanged between levels. @@ -1110,7 +1106,7 @@ void P_SpawnMapThing(thing_t *th) // Count deathmatch start positions if(th->type == 11) { - if(deathmatch_p < &deathmatchstarts[10]) + if(deathmatch_p < &deathmatchstarts[MAX_DM_STARTS]) { memcpy(deathmatch_p, th, sizeof(*th)); deathmatch_p++; diff --git a/doomsday/plugins/jdoom/src/p_plats.c b/doomsday/plugins/jdoom/src/p_plats.c index 23c7bc2c42..b8a4ee5090 100644 --- a/doomsday/plugins/jdoom/src/p_plats.c +++ b/doomsday/plugins/jdoom/src/p_plats.c @@ -19,7 +19,6 @@ // HEADER FILES ------------------------------------------------------------ #include "doomdef.h" -#include "m_random.h" #include "p_local.h" #include "s_sound.h" #include "doomstat.h" diff --git a/doomsday/plugins/jdoom/src/p_pspr.c b/doomsday/plugins/jdoom/src/p_pspr.c index cc38569341..1ab76a4b48 100644 --- a/doomsday/plugins/jdoom/src/p_pspr.c +++ b/doomsday/plugins/jdoom/src/p_pspr.c @@ -27,7 +27,6 @@ #include "doomdef.h" #include "d_config.h" #include "d_event.h" -#include "m_random.h" #include "p_local.h" #include "doomstat.h" #include "p_pspr.h" diff --git a/doomsday/plugins/jdoom/src/p_spec.c b/doomsday/plugins/jdoom/src/p_spec.c index 9aebf6ef01..efdb81cd94 100644 --- a/doomsday/plugins/jdoom/src/p_spec.c +++ b/doomsday/plugins/jdoom/src/p_spec.c @@ -29,7 +29,6 @@ #include "doomstat.h" #include "d_config.h" #include "m_argv.h" -#include "m_random.h" #include "p_local.h" #include "g_game.h" #include "s_sound.h" diff --git a/doomsday/plugins/jdoom/src/p_telept.c b/doomsday/plugins/jdoom/src/p_telept.c index 9782c1caf6..2b69c73416 100644 --- a/doomsday/plugins/jdoom/src/p_telept.c +++ b/doomsday/plugins/jdoom/src/p_telept.c @@ -40,6 +40,14 @@ // CODE -------------------------------------------------------------------- +mobj_t *P_SpawnTeleFog(int x, int y) +{ + subsector_t *ss = R_PointInSubsector(x, y); + + return P_SpawnMobj(x, y, P_GetFixedp(ss, DMU_FLOOR_HEIGHT) + + TELEFOGHEIGHT, MT_TFOG); +} + int EV_Teleport(line_t *line, int side, mobj_t *thing) { int i; diff --git a/doomsday/plugins/jdoom/src/st_stuff.c b/doomsday/plugins/jdoom/src/st_stuff.c index 06afe08073..bb77c847bb 100644 --- a/doomsday/plugins/jdoom/src/st_stuff.c +++ b/doomsday/plugins/jdoom/src/st_stuff.c @@ -212,7 +212,7 @@ enum { void ST_Stop(void); -// Console commands for the HUD/Statusbar +DEFCC(CCmdHUDShow); DEFCC(CCmdStatusBarSize); // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- @@ -225,14 +225,16 @@ extern boolean hu_showallfrags; // in hu_stuff.c currently // PRIVATE DATA DEFINITIONS ------------------------------------------------ +static int hudHideTics; +static float hudHideAmount; + // slide statusbar amount 1.0 is fully open static float showbar = 0.0f; // fullscreen hud alpha value static float hudalpha = 0.0f; -// main player in game -static player_t *plyr; +static float statusbarCounterAlpha = 0.0f; // ST_Start() has just been called static boolean st_firsttime; @@ -402,12 +404,31 @@ cvar_t hudCVars[] = {"hud-frags-all", 0, CVT_BYTE, &hu_showallfrags, 0, 1, "Debug: HUD shows all frags of all players."}, + + {"hud-timer", 0, CVT_FLOAT, &cfg.hudTimer, 0, 60, + "Number of seconds before the hud auto-hides."}, + + {"hud-unhide-damage", 0, CVT_BYTE, &cfg.hudUnHide[HUE_ON_DAMAGE], 0, 1, + "1=Unhide the HUD when player receives damaged."}, + {"hud-unhide-pickup-health", 0, CVT_BYTE, &cfg.hudUnHide[HUE_ON_PICKUP_HEALTH], 0, 1, + "1=Unhide the HUD when player collects a health item."}, + {"hud-unhide-pickup-armor", 0, CVT_BYTE, &cfg.hudUnHide[HUE_ON_PICKUP_ARMOR], 0, 1, + "1=Unhide the HUD when player collects an armor item."}, + {"hud-unhide-pickup-powerup", 0, CVT_BYTE, &cfg.hudUnHide[HUE_ON_PICKUP_POWER], 0, 1, + "1=Unhide the HUD when player collects a powerup or item of equipment."}, + {"hud-unhide-pickup-weapon", 0, CVT_BYTE, &cfg.hudUnHide[HUE_ON_PICKUP_WEAPON], 0, 1, + "1=Unhide the HUD when player collects a weapon."}, + {"hud-unhide-pickup-ammo", 0, CVT_BYTE, &cfg.hudUnHide[HUE_ON_PICKUP_AMMO], 0, 1, + "1=Unhide the HUD when player collects an ammo item."}, + {"hud-unhide-pickup-key", 0, CVT_BYTE, &cfg.hudUnHide[HUE_ON_PICKUP_KEY], 0, 1, + "1=Unhide the HUD when player collects a key."}, {NULL} }; // Console commands for the HUD/Status bar ccmd_t hudCCmds[] = { {"sbsize", CCmdStatusBarSize, "Status bar size adjustment.", 0 }, + {"showhud", CCmdHUDShow, "Show the HUD if hidden.", 0 }, {NULL} }; @@ -431,14 +452,19 @@ void ST_refreshBackground(void) int x, y, w, h; float cw, cw2, ch; + float alpha; GL_SetPatch(sbar.lump); - if(st_blended && ((cfg.statusbarAlpha < 1.0f) && (cfg.statusbarAlpha > 0.0f))) + alpha = cfg.statusbarAlpha - hudHideAmount; + // Clamp + CLAMP(alpha, 0.0f, 1.0f); + + if(st_blended && ((alpha < 1.0f) && (alpha > 0.0f))) { // Alpha blended status bar, we'll need to cut it up into smaller bits... - gl.Color4f(1, 1, 1, cfg.statusbarAlpha); + gl.Color4f(1, 1, 1, alpha); gl.Begin(DGL_QUADS); @@ -516,7 +542,7 @@ void ST_refreshBackground(void) GL_DrawPatch_CS(ST_FX, ST_Y+1, faceback.lump); } - else if(cfg.statusbarAlpha != 0.0f) + else if(alpha != 0.0f) { // we can just render the full thing as normal @@ -528,7 +554,23 @@ void ST_refreshBackground(void) if(IS_NETGAME) // faceback GL_DrawPatch(ST_FX, ST_Y+1, faceback.lump); } +} + +/* + * Unhides the current HUD display if hidden. + * + * @param event The HUD Update Event type to check for triggering. + */ +void ST_HUDUnHide(hueevent_t event) +{ + if(event < HUE_FORCE || event > NUMHUDUNHIDEEVENTS) + return; + if(event == HUE_FORCE || cfg.hudUnHide[event]) + { + hudHideTics = (cfg.hudTimer * TICSPERSEC); + hudHideAmount = 0; + } } int ST_calcPainOffset(void) @@ -536,8 +578,9 @@ int ST_calcPainOffset(void) int health; static int lastcalc; static int oldhealth = -1; + player_t *plyr = &players[consoleplayer]; - health = plyr->health > 100 ? 100 : plyr->health; + health = (plyr->health > 100 ? 100 : plyr->health); if(health != oldhealth) { @@ -561,6 +604,7 @@ void ST_updateFaceWidget(void) static int lastattackdown = -1; static int priority = 0; boolean doevilgrin; + player_t *plyr = &players[consoleplayer]; if(priority < 10) { @@ -735,6 +779,9 @@ void ST_updateWidgets(void) boolean found; player_t *plr = &players[consoleplayer]; + statusbarCounterAlpha = cfg.statusbarCounterAlpha - hudHideAmount; + CLAMP(statusbarCounterAlpha, 0.0f, 1.0f); + // must redirect the pointer if the ready weapon has changed. found = false; for(ammotype=0; ammotype < NUMAMMO && !found; ++ammotype) @@ -791,15 +838,27 @@ void ST_updateWidgets(void) void ST_Ticker(void) { + player_t *plyr = &players[consoleplayer]; + + if(cfg.hudTimer == 0) + { + hudHideTics = hudHideAmount = 0; + } + else + { + if(hudHideTics > 0) + hudHideTics--; + if(hudHideTics == 0 && cfg.hudTimer > 0 && hudHideAmount < 1) + hudHideAmount += 0.1f; + } st_clock++; st_randomnumber = M_Random(); ST_updateWidgets(); st_oldhealth = plyr->health; - } -int D_GetFilterColor(int filter) +int R_GetFilterColor(int filter) { int rgba = 0; @@ -814,7 +873,7 @@ int D_GetFilterColor(int filter) // Green. rgba = FMAKERGBA(0, .7, 0, .15f); else if(filter) - Con_Error("D_SetFilter: Real strange filter number: %d.\n", filter); + Con_Error("R_GetFilterColor: Real strange filter number: %d.\n", filter); return rgba; } @@ -823,6 +882,7 @@ void ST_doPaletteStuff(void) int palette; int cnt; int bzc; + player_t *plyr = &players[consoleplayer]; cnt = plyr->damagecount; @@ -864,7 +924,7 @@ void ST_doPaletteStuff(void) if(palette != st_palette) { st_palette = palette; - plyr->plr->filter = D_GetFilterColor(palette); // $democam + plyr->plr->filter = R_GetFilterColor(palette); // $democam } } @@ -951,6 +1011,10 @@ void ST_drawHUDSprite(int sprite, int x, int y, int hotspot, float alpha) spriteinfo_t sprInfo; int w, h; + CLAMP(alpha, 0.0f, 1.0f); + if(alpha == 0.0f) + return; + R_GetSpriteInfo(sprite, 0, &sprInfo); w = sprInfo.width; h = sprInfo.height; @@ -983,8 +1047,8 @@ void ST_doFullscreenStuff(void) char buf[20]; int w, h, pos = 0, spr, i; int h_width = 320 / cfg.hudScale, h_height = 200 / cfg.hudScale; - float textalpha = hudalpha - ( 1 - cfg.hudColor[3]); - float iconalpha = hudalpha - ( 1 - cfg.hudIconAlpha); + float textalpha = hudalpha - hudHideAmount - ( 1 - cfg.hudColor[3]); + float iconalpha = hudalpha - hudHideAmount - ( 1 - cfg.hudIconAlpha); int ammo_sprite[NUMAMMO] = { SPR_AMMO, SPR_SBOX, @@ -992,6 +1056,9 @@ void ST_doFullscreenStuff(void) SPR_ROCK }; + CLAMP(textalpha, 0.0f, 1.0f); + CLAMP(iconalpha, 0.0f, 1.0f); + if(IS_NETGAME && deathmatch && cfg.hudShown[HUD_FRAGS]) { // Display the frag counter. @@ -1005,7 +1072,6 @@ void ST_doFullscreenStuff(void) cfg.hudColor[2], textalpha); } - // Setup the scaling matrix. gl.MatrixMode(DGL_MODELVIEW); gl.PushMatrix(); @@ -1048,13 +1114,16 @@ void ST_doFullscreenStuff(void) { pos = (h_width/2) -(faceback.width/2) + 6; + if(iconalpha != 0.0f) + { Draw_BeginZoom(0.7f, pos , h_height - 1); - gl.Color4f(1,1,1,iconalpha); - if(IS_NETGAME) - GL_DrawPatch_CS( pos, h_height - faceback.height + 1, faceback.lump); + gl.Color4f(1, 1, 1, iconalpha); + if(IS_NETGAME) + GL_DrawPatch_CS( pos, h_height - faceback.height + 1, faceback.lump); - GL_DrawPatch_CS( pos, h_height - faceback.height, faces[st_faceindex].lump); + GL_DrawPatch_CS( pos, h_height - faceback.height, faces[st_faceindex].lump); Draw_EndZoom(); + } } pos = h_width - 1; @@ -1247,9 +1316,9 @@ void ST_loadData(void) void ST_initData(void) { int i; + player_t *plyr = &players[consoleplayer]; st_firsttime = true; - plyr = &players[consoleplayer]; st_clock = 0; st_chatstate = StartChatState; @@ -1275,14 +1344,18 @@ void ST_initData(void) } STlib_init(); + + ST_HUDUnHide(HUE_FORCE); } void ST_createWidgets(void) { int i; static int largeammo = 1994; // means "n/a" + static ammotype_t ammotype; boolean found; + player_t *plyr = &players[consoleplayer]; // ready weapon ammo // TODO: Only supports one type of ammo per weapon. @@ -1293,7 +1366,7 @@ void ST_createWidgets(void) continue; // Weapon does not take this ammo. STlib_initNum(&w_ready, ST_AMMOX, ST_AMMOY, tallnum, &plyr->ammo[ammotype], - &st_statusbaron, ST_AMMOWIDTH, &cfg.statusbarCounterAlpha); + &st_statusbaron, ST_AMMOWIDTH, &statusbarCounterAlpha); found = true; } if(!found) // Weapon requires no ammo at all. @@ -1304,11 +1377,11 @@ void ST_createWidgets(void) //STlib_initNum(&w_ready, ST_AMMOX, ST_AMMOY, tallnum, // &plyr->ammo[weaponinfo[plyr->readyweapon].ammo], - // &st_statusbaron, ST_AMMOWIDTH, &cfg.statusbarCounterAlpha); + // &st_statusbaron, ST_AMMOWIDTH, &statusbarCounterAlpha); STlib_initNum(&w_ready, ST_AMMOX, ST_AMMOY, tallnum, &largeammo, - &st_statusbaron, ST_AMMOWIDTH, &cfg.statusbarCounterAlpha); + &st_statusbaron, ST_AMMOWIDTH, &statusbarCounterAlpha); } // the last weapon type @@ -1317,7 +1390,7 @@ void ST_createWidgets(void) // health percentage STlib_initPercent(&w_health, ST_HEALTHX, ST_HEALTHY, tallnum, &plyr->health, &st_statusbaron, &tallpercent, - &cfg.statusbarCounterAlpha); + &statusbarCounterAlpha); // weapons owned for(i = 0; i < 6; i++) @@ -1325,67 +1398,66 @@ void ST_createWidgets(void) STlib_initMultIcon(&w_arms[i], ST_ARMSX + (i % 3) * ST_ARMSXSPACE, ST_ARMSY + (i / 3) * ST_ARMSYSPACE, arms[i], (int *) &plyr->weaponowned[i + 1], &st_armson, - &cfg.statusbarCounterAlpha); + &statusbarCounterAlpha); } // frags sum STlib_initNum(&w_frags, ST_FRAGSX, ST_FRAGSY, tallnum, &st_fragscount, - &st_fragson, ST_FRAGSWIDTH, &cfg.statusbarCounterAlpha); + &st_fragson, ST_FRAGSWIDTH, &statusbarCounterAlpha); // faces STlib_initMultIcon(&w_faces, ST_FACESX, ST_FACESY, faces, &st_faceindex, - &st_statusbaron, &cfg.statusbarCounterAlpha); + &st_statusbaron, &statusbarCounterAlpha); // armor percentage - should be colored later STlib_initPercent(&w_armor, ST_ARMORX, ST_ARMORY, tallnum, &plyr->armorpoints, &st_statusbaron, &tallpercent, - &cfg.statusbarCounterAlpha); + &statusbarCounterAlpha); // keyboxes 0-2 STlib_initMultIcon(&w_keyboxes[0], ST_KEY0X, ST_KEY0Y, keys, &keyboxes[0], - &st_statusbaron, &cfg.statusbarCounterAlpha); + &st_statusbaron, &statusbarCounterAlpha); STlib_initMultIcon(&w_keyboxes[1], ST_KEY1X, ST_KEY1Y, keys, &keyboxes[1], - &st_statusbaron, &cfg.statusbarCounterAlpha); + &st_statusbaron, &statusbarCounterAlpha); STlib_initMultIcon(&w_keyboxes[2], ST_KEY2X, ST_KEY2Y, keys, &keyboxes[2], - &st_statusbaron, &cfg.statusbarCounterAlpha); + &st_statusbaron, &statusbarCounterAlpha); // ammo count (all four kinds) STlib_initNum(&w_ammo[0], ST_AMMO0X, ST_AMMO0Y, shortnum, &plyr->ammo[0], - &st_statusbaron, ST_AMMO0WIDTH, &cfg.statusbarCounterAlpha); + &st_statusbaron, ST_AMMO0WIDTH, &statusbarCounterAlpha); STlib_initNum(&w_ammo[1], ST_AMMO1X, ST_AMMO1Y, shortnum, &plyr->ammo[1], - &st_statusbaron, ST_AMMO1WIDTH, &cfg.statusbarCounterAlpha); + &st_statusbaron, ST_AMMO1WIDTH, &statusbarCounterAlpha); STlib_initNum(&w_ammo[2], ST_AMMO2X, ST_AMMO2Y, shortnum, &plyr->ammo[2], - &st_statusbaron, ST_AMMO2WIDTH, &cfg.statusbarCounterAlpha); + &st_statusbaron, ST_AMMO2WIDTH, &statusbarCounterAlpha); STlib_initNum(&w_ammo[3], ST_AMMO3X, ST_AMMO3Y, shortnum, &plyr->ammo[3], - &st_statusbaron, ST_AMMO3WIDTH, &cfg.statusbarCounterAlpha); + &st_statusbaron, ST_AMMO3WIDTH, &statusbarCounterAlpha); // max ammo count (all four kinds) STlib_initNum(&w_maxammo[0], ST_MAXAMMO0X, ST_MAXAMMO0Y, shortnum, &plyr->maxammo[0], &st_statusbaron, ST_MAXAMMO0WIDTH, - &cfg.statusbarCounterAlpha); + &statusbarCounterAlpha); STlib_initNum(&w_maxammo[1], ST_MAXAMMO1X, ST_MAXAMMO1Y, shortnum, &plyr->maxammo[1], &st_statusbaron, ST_MAXAMMO1WIDTH, - &cfg.statusbarCounterAlpha); + &statusbarCounterAlpha); STlib_initNum(&w_maxammo[2], ST_MAXAMMO2X, ST_MAXAMMO2Y, shortnum, &plyr->maxammo[2], &st_statusbaron, ST_MAXAMMO2WIDTH, - &cfg.statusbarCounterAlpha); + &statusbarCounterAlpha); STlib_initNum(&w_maxammo[3], ST_MAXAMMO3X, ST_MAXAMMO3Y, shortnum, &plyr->maxammo[3], &st_statusbaron, ST_MAXAMMO3WIDTH, - &cfg.statusbarCounterAlpha); + &statusbarCounterAlpha); } void ST_Start(void) { - if(!st_stopped) ST_Stop(); @@ -1408,6 +1480,15 @@ void ST_Init(void) ST_loadData(); } +/* + * Console command to show the hud if hidden. + */ +DEFCC(CCmdHUDShow) +{ + ST_HUDUnHide(HUE_FORCE); + return true; +} + /* * Console command to change the size of the status bar. */ diff --git a/doomsday/plugins/jdoom/src/wi_stuff.c b/doomsday/plugins/jdoom/src/wi_stuff.c index 3470a92073..e3c7063a3b 100644 --- a/doomsday/plugins/jdoom/src/wi_stuff.c +++ b/doomsday/plugins/jdoom/src/wi_stuff.c @@ -26,7 +26,6 @@ #include #include #include "doomdef.h" -#include "m_random.h" #include "g_game.h" #include "s_sound.h" #include "doomstat.h" diff --git a/doomsday/plugins/jheretic/include/doomdef.h b/doomsday/plugins/jheretic/include/doomdef.h index 77f1a74446..e3343d4636 100644 --- a/doomsday/plugins/jheretic/include/doomdef.h +++ b/doomsday/plugins/jheretic/include/doomdef.h @@ -49,6 +49,9 @@ #define VERBOSE(code) { if(verbose >= 1) { code; } } #define VERBOSE2(code) { if(verbose >= 2) { code; } } +// Misc macros. +#define CLAMP(v, min, max) (v < min? v=min : v > max? v=max : v) + extern game_import_t gi; extern game_export_t gx; @@ -116,6 +119,8 @@ typedef struct classinfo_s{ fixed_t maxmove; fixed_t forwardmove[2]; // walk, run fixed_t sidemove[2]; // walk, run + int movemul; // multiplier for above + int jumptics; // wait inbetween jumps } classinfo_t; extern classinfo_t classInfo[NUMCLASSES]; @@ -233,7 +238,7 @@ typedef enum { arti_fly, arti_teleport, NUMARTIFACTS -} artitype_t; +} artitype_e; #define MAXARTICOUNT 16 @@ -256,7 +261,7 @@ enum { VX, VY, VZ }; // Vertex indices. #define IS_DEDICATED Get(DD_DEDICATED) -void H_IdentifyVersion(void); +void G_IdentifyVersion(void); char *G_Get(int id); void R_SetViewSize(int blocks, int detail); @@ -417,12 +422,8 @@ void M_ForceUppercase(char *text); // Changes a string to uppercase -//int M_Random (void); -// returns a number from 0 to 255 +//returns a number from 0 to 255 int P_Random(void); - -// as M_Random, but used only by the play simulation - void M_ClearRandom(void); // fix randoms for demos diff --git a/doomsday/plugins/jheretic/include/dstrings.h b/doomsday/plugins/jheretic/include/dstrings.h index a1052011b0..ef28a1a899 100644 --- a/doomsday/plugins/jheretic/include/dstrings.h +++ b/doomsday/plugins/jheretic/include/dstrings.h @@ -3,13 +3,16 @@ // DStrings.h -#define GET_TXT(x) ((*gi.text)[x].text) +#define GET_TXT(x) ((*gi.text)[x].text) //--------------------------------------------------------------------------- // // M_menu.c // //--------------------------------------------------------------------------- + +#define NUM_QUITMESSAGES 0 + #define PRESSKEY GET_TXT(TXT_PRESSKEY) #define PRESSYN GET_TXT(TXT_PRESSYN) #define TXT_PAUSED GET_TXT(TXT_TXT_PAUSED) @@ -35,7 +38,7 @@ #define GAMMALVL2 GET_TXT(TXT_GAMMALVL2) #define GAMMALVL3 GET_TXT(TXT_GAMMALVL3) #define GAMMALVL4 GET_TXT(TXT_GAMMALVL4) -#define EMPTYSTRING GET_TXT(TXT_EMPTYSTRING) +#define EMPTYSTRING GET_TXT(TXT_EMPTYSTRING) //--------------------------------------------------------------------------- // @@ -178,10 +181,10 @@ #define HUSTR_PLRBROWN GET_TXT(TXT_HUSTR_PLRBROWN) #define HUSTR_PLRRED GET_TXT(TXT_HUSTR_PLRRED) -#define HUSTR_KEYGREEN 'g' -#define HUSTR_KEYINDIGO 'i' -#define HUSTR_KEYBROWN 'b' -#define HUSTR_KEYRED 'r' +#define HUSTR_KEYGREEN 'g' +#define HUSTR_KEYINDIGO 'i' +#define HUSTR_KEYBROWN 'b' +#define HUSTR_KEYRED 'r' //--------------------------------------------------------------------------- // diff --git a/doomsday/plugins/jheretic/include/h_action.h b/doomsday/plugins/jheretic/include/h_action.h index 7502d3dae0..5815a8947c 100644 --- a/doomsday/plugins/jheretic/include/h_action.h +++ b/doomsday/plugins/jheretic/include/h_action.h @@ -1,6 +1,10 @@ #ifndef __JHERETIC_ACTIONS_H__ #define __JHERETIC_ACTIONS_H__ +#ifndef __JHERETIC__ +# error "Using jHeretic headers without __JHERETIC__" +#endif + #include "dd_share.h" // These must correspond the action_t's in the actions array! diff --git a/doomsday/plugins/jheretic/include/h_config.h b/doomsday/plugins/jheretic/include/h_config.h index 5783ca787d..0463c22f24 100644 --- a/doomsday/plugins/jheretic/include/h_config.h +++ b/doomsday/plugins/jheretic/include/h_config.h @@ -173,6 +173,7 @@ typedef struct jheretic_config_s { // jHeretic specific int ringFilter; int chooseAndUse; + int inventoryNextOnUnuse; int tomeCounter, tomeSound; byte fastMonsters; } jheretic_config_t; diff --git a/doomsday/plugins/jheretic/include/h_items.h b/doomsday/plugins/jheretic/include/h_items.h index f7b9a923f2..410e5277ad 100644 --- a/doomsday/plugins/jheretic/include/h_items.h +++ b/doomsday/plugins/jheretic/include/h_items.h @@ -58,7 +58,7 @@ void P_InitWeaponInfo(void); #define NUMINVENTORYSLOTS 14 typedef struct { - int type; + artitype_e type; int count; } inventory_t; diff --git a/doomsday/plugins/jheretic/include/h_player.h b/doomsday/plugins/jheretic/include/h_player.h index c0aa0d01a2..4fa8ab67a5 100644 --- a/doomsday/plugins/jheretic/include/h_player.h +++ b/doomsday/plugins/jheretic/include/h_player.h @@ -143,7 +143,7 @@ typedef struct player_s { // DJS - Here follows Heretic specific player_t properties // inventory_t inventory[NUMINVENTORYSLOTS]; - artitype_t readyArtifact; + artitype_e readyArtifact; int artifactCount; int inventorySlotNum; diff --git a/doomsday/plugins/jheretic/include/jheretic.h b/doomsday/plugins/jheretic/include/jheretic.h index ed3c903691..42ab34a017 100644 --- a/doomsday/plugins/jheretic/include/jheretic.h +++ b/doomsday/plugins/jheretic/include/jheretic.h @@ -50,6 +50,8 @@ #include "../../jheretic/include/tables.h" #include "../../jheretic/include/version.h" +#include "p_inventory.h" +#include "g_controls.h" #include "p_saveg.h" #endif // __JHERETIC_CONVENIENCE_H__ diff --git a/doomsday/plugins/jheretic/include/m_ctrl.h b/doomsday/plugins/jheretic/include/m_ctrl.h index b6dd7eacd1..51ea715c87 100644 --- a/doomsday/plugins/jheretic/include/m_ctrl.h +++ b/doomsday/plugins/jheretic/include/m_ctrl.h @@ -8,32 +8,7 @@ # error "Using jHeretic headers without __JHERETIC__" #endif -#define CTLCFG_TYPE void - -CTLCFG_TYPE SCControlConfig(int option, void *data); - -// Control flags. -#define CLF_ACTION 0x1 // The control is an action (+/- in front). -#define CLF_REPEAT 0x2 // Bind down + repeat. - -typedef struct { - char *command; // The command to execute. - int flags; - int bindClass; // Class it should be bound into - int defKey; // - int defMouse; // Zero means there is no default. - int defJoy; // -} Control_t; - -// Game registered bindClasses -enum { - GBC_CLASS1 = NUM_DDBINDCLASSES, - GBC_CLASS2, - GBC_CLASS3, - GBC_MENUHOTKEY, - GBC_CHAT, - GBC_MESSAGE -}; +#include "g_controls.h" // // !!! Add new controls to the end, the existing indices must remain unchanged !!! diff --git a/doomsday/plugins/jheretic/include/m_menu.h b/doomsday/plugins/jheretic/include/m_menu.h deleted file mode 100644 index 61a1e3a09d..0000000000 --- a/doomsday/plugins/jheretic/include/m_menu.h +++ /dev/null @@ -1,74 +0,0 @@ -/* $Id$ - * - * Copyright (C) 1993-1996 by id Software, Inc. - * - * This source is available for distribution and/or modification - * only under the terms of the DOOM Source Code License as - * published by id Software. All rights reserved. - * - * The source is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License - * for more details. - */ - -/* - * Menu widget stuff, episode selection and such. - */ - -#ifndef __M_MENU__ -#define __M_MENU__ - -#ifndef __JHERETIC__ -# error "Using jHeretic headers without __JHERETIC__" -#endif - -#include "hu_stuff.h" -#include "h_event.h" - -// -// MENUS -// -// Called by main loop, -// saves config file and calls I_Quit when user exits. -// 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. -boolean M_Responder(event_t *ev); - -// Called by Init -// registers all the CCmds and CVars for the menu -void MN_Register(void); - -// Called by main loop, -// only used for menu (skull cursor) animation. -// and menu fog, fading in and out... -void MN_Ticker(void); - -// Called by main loop, -// draws the menus directly into the screen buffer. -void M_Drawer(void); - -// Called by D_DoomMain, -// loads the config file. -void MN_Init(void); -void M_LoadData(void); -void M_UnloadData(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_ClearMenus(void); - -void M_StartMessage(char *string, void *routine, boolean input); -void M_StopMessage(void); - -void M_WriteText2(int x, int y, char *string, dpatch_t *font, - float red, float green, float blue, float alpha); -void M_WriteText3(int x, int y, const char *string, dpatch_t *font, - float red, float green, float blue, float alpha, - boolean doTypeIn, int initialCount); -DEFCC(CCmdMenuAction); -DEFCC(CCmdMsgResponse); - -#endif diff --git a/doomsday/plugins/jheretic/include/p_local.h b/doomsday/plugins/jheretic/include/p_local.h index 416d30b020..18df73d0c3 100644 --- a/doomsday/plugins/jheretic/include/p_local.h +++ b/doomsday/plugins/jheretic/include/p_local.h @@ -129,12 +129,8 @@ void P_FireWeapon(player_t *player); // ***** P_USER ***** void P_ClientSideThink(); -void P_CheckReadyArtifact(); -void P_PlayerThink(player_t *player); void P_Thrust(player_t *player, angle_t angle, fixed_t move); -void P_PlayerRemoveArtifact(player_t *player, int slot); -void P_PlayerUseArtifact(player_t *player, artitype_t arti); -boolean P_UseArtifact(player_t *player, artitype_t arti); +boolean P_UndoPlayerMorph(player_t *player); // ***** P_MOBJ ***** @@ -160,6 +156,7 @@ extern int iquetail; extern mobjtype_t PuffType; extern mobj_t *MissileMobj; +void P_SpawnMapThing(thing_t * th); mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type); void P_RemoveMobj(mobj_t *th); boolean P_SetMobjState(mobj_t *mobj, statenum_t state); @@ -262,7 +259,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher); void P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, int damage); boolean P_GiveAmmo(player_t *player, ammotype_t ammo, int count); -boolean P_GiveArtifact(player_t *player, artitype_t arti, mobj_t *mo); boolean P_GiveBody(player_t *player, int num); boolean P_GivePower(player_t *player, powertype_t power); boolean P_MorphPlayer(player_t *player); @@ -276,15 +272,21 @@ void AM_Drawer(void); void Draw_BeginZoom(float s, float originX, float originY); void Draw_EndZoom(void); -// ***** SB_BAR ***** +// ***** ST_STUFF ***** + +extern int curpos; + +void ST_Inventory(boolean show); +boolean ST_IsInventoryVisible(void); + +void ST_InventoryFlashCurrent(player_t *player); -extern int ArtifactFlash; void ST_doPaletteStuff(void); #define LOOKDIR2DEG(x) ((x) * 85.0/110.0) #define LOOKDIR2RAD(x) (LOOKDIR2DEG(x)/180*PI) -void H_SetFilter(int filter); -int H_GetFilterColor(int filter); +void R_SetFilter(int filter); +int R_GetFilterColor(int filter); #endif // __P_LOCAL__ diff --git a/doomsday/plugins/jheretic/include/p_spec.h b/doomsday/plugins/jheretic/include/p_spec.h index 785dbdc0e8..4b4c1a9667 100644 --- a/doomsday/plugins/jheretic/include/p_spec.h +++ b/doomsday/plugins/jheretic/include/p_spec.h @@ -392,7 +392,9 @@ void T_MoveFloor(floormove_t * floor); // // P_TELEPT // +#define TELEFOGHEIGHT (32*FRACUNIT) boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, angle_t angle); boolean EV_Teleport(line_t *line, int side, mobj_t *thing); +void P_ArtiTele(player_t *player); #endif diff --git a/doomsday/plugins/jheretic/src/g_ctrl.c b/doomsday/plugins/jheretic/src/g_ctrl.c new file mode 100644 index 0000000000..1dfc1b8706 --- /dev/null +++ b/doomsday/plugins/jheretic/src/g_ctrl.c @@ -0,0 +1,190 @@ +/* DE1: $Id: template.c 2645 2006-01-21 12:58:39Z skyjake $ + * Copyright (C) 2006 Jaakko Keränen + * Daniel Swanson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * In addition, as a special exception, we, the authors of deng + * give permission to link the code of our release of deng with + * the libjhexen and/or the libjheretic libraries (or with modified + * versions of it that use the same license as the libjhexen or + * libjheretic libraries), and distribute the linked executables. + * You must obey the GNU General Public License in all respects for + * all of the code used other than “libjhexen or libjheretic”. If + * you modify this file, you may extend this exception to your + * version of the file, but you are not obligated to do so. If you + * do not wish to do so, delete this exception statement from your version. + */ + +/* + * g_ctrl.c: Control bindings - Heretic specifc + */ + +// HEADER FILES ------------------------------------------------------------ + +#include "h_action.h" +#include "g_controls.h" + +// MACROS ------------------------------------------------------------------ + +// TYPES ------------------------------------------------------------------- + +// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- + +// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- + +// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- + +// EXTERNAL DATA DECLARATIONS ---------------------------------------------- + +// PUBLIC DATA DEFINITIONS ------------------------------------------------- + +// +// !!! Add new controls to the end, the existing indices must remain unchanged !!! +// +const Control_t controls[] = { + // Actions (must be first so the H2A_* constants can be used). + {"left", CLF_ACTION, DDBC_NORMAL, DDKEY_LEFTARROW, 0, 0}, + {"right", CLF_ACTION, DDBC_NORMAL, DDKEY_RIGHTARROW, 0, 0}, + {"forward", CLF_ACTION, DDBC_NORMAL, DDKEY_UPARROW, 0, 0}, + {"backward", CLF_ACTION, DDBC_NORMAL, DDKEY_DOWNARROW, 0, 0}, + {"strafel", CLF_ACTION, DDBC_NORMAL, ',', 0, 0}, + {"strafer", CLF_ACTION, DDBC_NORMAL, '.', 0, 0}, + {"fire", CLF_ACTION, DDBC_NORMAL, DDKEY_RCTRL, 1, 1}, + {"use", CLF_ACTION, DDBC_NORMAL, ' ', 0, 4}, + {"strafe", CLF_ACTION, DDBC_NORMAL, DDKEY_RALT, 3, 2}, + {"speed", CLF_ACTION, DDBC_NORMAL, DDKEY_RSHIFT, 0, 3}, + + {"flyup", CLF_ACTION, DDBC_NORMAL, DDKEY_PGUP, 0, 8}, + {"flydown", CLF_ACTION, DDBC_NORMAL, DDKEY_INS, 0, 9}, + {"falldown", CLF_ACTION, DDBC_NORMAL, DDKEY_HOME, 0, 0}, + {"lookup", CLF_ACTION, DDBC_NORMAL, DDKEY_PGDN, 0, 6}, + {"lookdown", CLF_ACTION, DDBC_NORMAL, DDKEY_DEL, 0, 7}, + {"lookcntr", CLF_ACTION, DDBC_NORMAL, DDKEY_END, 0, 0}, + {"usearti", CLF_ACTION, DDBC_NORMAL, DDKEY_ENTER, 0, 0}, + {"mlook", CLF_ACTION, DDBC_NORMAL, 'm', 0, 0}, + {"jlook", CLF_ACTION, DDBC_NORMAL, 'j', 0, 0}, + {"nextwpn", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + + {"prevwpn", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"weap1", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"weapon2", CLF_ACTION, DDBC_NORMAL, '2', 0, 0}, + {"weapon3", CLF_ACTION, DDBC_NORMAL, '3', 0, 0}, + {"weapon4", CLF_ACTION, DDBC_NORMAL, '4', 0, 0}, + {"weapon5", CLF_ACTION, DDBC_NORMAL, '5', 0, 0}, + {"weapon6", CLF_ACTION, DDBC_NORMAL, '6', 0, 0}, + {"weapon7", CLF_ACTION, DDBC_NORMAL, '7', 0, 0}, + {"weapon8", CLF_ACTION, DDBC_NORMAL, '8', 0, 0}, + {"weapon9", CLF_ACTION, DDBC_NORMAL, '9', 0, 0}, + + {"cantdie", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"invisib", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"health", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"sphealth", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"tomepwr", CLF_ACTION, DDBC_NORMAL, DDKEY_BACKSPACE, 0, 0}, + {"torch", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"firebomb", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"egg", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"flyarti", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"teleport", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + + {"panic", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"demostop", CLF_ACTION, DDBC_NORMAL, 'o', 0, 0}, + + // More weapons. + {"weapon1", CLF_ACTION, DDBC_NORMAL, '1', 0, 0}, + + // Menu hotkeys (default: F1 - F12). + /*43 */ {"helpscreen", 0, DDBC_NORMAL, DDKEY_F1, 0, 0}, + {"loadgame", 0, DDBC_NORMAL, DDKEY_F3, 0, 0}, + {"savegame", 0, DDBC_NORMAL, DDKEY_F2, 0, 0}, + {"soundmenu", 0, DDBC_NORMAL, DDKEY_F4, 0, 0}, + {"quicksave", 0, DDBC_NORMAL, DDKEY_F6, 0, 0}, + {"endgame", 0, DDBC_NORMAL, DDKEY_F7, 0, 0}, + {"togglemsgs", 0, DDBC_NORMAL, DDKEY_F8, 0, 0}, + {"quickload", 0, DDBC_NORMAL, DDKEY_F9, 0, 0}, + {"quit", 0, DDBC_NORMAL, DDKEY_F10, 0, 0}, + {"togglegamma", 0, DDBC_NORMAL, DDKEY_F11, 0, 0}, + {"spy", 0, DDBC_NORMAL, DDKEY_F12, 0, 0}, + + // Inventory. + {"invleft", CLF_REPEAT, DDBC_NORMAL, '[', 0, 0}, + {"invright", CLF_REPEAT, DDBC_NORMAL, ']', 0, 0}, + + // Screen controls. + {"viewsize +", CLF_REPEAT, DDBC_NORMAL, '=', 0, 0}, + {"viewsize -", CLF_REPEAT, DDBC_NORMAL, '-', 0, 0}, + {"sbsize +", CLF_REPEAT, DDBC_NORMAL, 0, 0, 0}, + {"sbsize -", CLF_REPEAT, DDBC_NORMAL, 0, 0, 0}, + + // Misc. + {"pause", 0, DDBC_NORMAL, DDKEY_PAUSE, 0, 0}, + {"jump", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"beginchat", 0, DDBC_NORMAL, 't', 0, 0}, + {"beginchat 0", 0, DDBC_NORMAL, 'g', 0, 0}, + {"beginchat 1", 0, DDBC_NORMAL, 'y', 0, 0}, + {"beginchat 2", 0, DDBC_NORMAL, 'r', 0, 0}, + {"beginchat 3", 0, DDBC_NORMAL, 'b', 0, 0}, + {"screenshot", 0, DDBC_NORMAL, 0, 0, 0}, + + {"automap", 0, DDBC_NORMAL, DDKEY_TAB, 0, 0}, + {"follow", 0, GBC_CLASS1, 'f', 0, 0}, + {"rotate", 0, GBC_CLASS1, 'r', 0, 0}, + {"grid", 0, GBC_CLASS1, 'g', 0, 0}, + {"mzoomin", CLF_ACTION, GBC_CLASS1, '=', 0, 0}, + {"mzoomout", CLF_ACTION, GBC_CLASS1, '-', 0, 0}, + {"zoommax", 0, GBC_CLASS1, '0', 0, 0}, + {"addmark", 0, GBC_CLASS1, 'm', 0, 0}, + {"clearmarks", 0, GBC_CLASS1, 'c', 0, 0}, + {"mpanup", CLF_ACTION, GBC_CLASS2, DDKEY_UPARROW, 0, 0}, + {"mpandown", CLF_ACTION, GBC_CLASS2, DDKEY_DOWNARROW, 0, 0}, + {"mpanleft", CLF_ACTION, GBC_CLASS2, DDKEY_LEFTARROW, 0, 0}, + {"mpanright", CLF_ACTION, GBC_CLASS2, DDKEY_RIGHTARROW, 0, 0}, + + // Menu actions. + {"menuup", CLF_REPEAT, GBC_CLASS3, DDKEY_UPARROW, 0, 0}, + {"menudown", CLF_REPEAT, GBC_CLASS3, DDKEY_DOWNARROW, 0, 0}, + {"menuleft", CLF_REPEAT, GBC_CLASS3, DDKEY_LEFTARROW, 0, 0}, + {"menuright", CLF_REPEAT, GBC_CLASS3, DDKEY_RIGHTARROW, 0, 0}, + {"menuselect", 0, GBC_CLASS3, DDKEY_ENTER, 0, 0}, + {"menucancel", 0, GBC_CLASS3, DDKEY_BACKSPACE, 0, 0}, + {"menu", 0, GBC_MENUHOTKEY, DDKEY_ESCAPE, 0, 0}, + + // More chat actions. + {"msgrefresh", 0, DDBC_NORMAL, DDKEY_ENTER, 0, 0}, + {"chatcomplete", 0, GBC_CHAT, DDKEY_ENTER, 0, 0}, + {"chatcancel", 0, GBC_CHAT, DDKEY_ESCAPE, 0, 0}, + {"chatsendmacro 0", 0, GBC_CHAT, DDKEY_F1, 0, 0}, + {"chatsendmacro 1", 0, GBC_CHAT, DDKEY_F2, 0, 0}, + {"chatsendmacro 2", 0, GBC_CHAT, DDKEY_F3, 0, 0}, + {"chatsendmacro 3", 0, GBC_CHAT, DDKEY_F4, 0, 0}, + {"chatsendmacro 4", 0, GBC_CHAT, DDKEY_F5, 0, 0}, + {"chatsendmacro 5", 0, GBC_CHAT, DDKEY_F6, 0, 0}, + {"chatsendmacro 6", 0, GBC_CHAT, DDKEY_F7, 0, 0}, + {"chatsendmacro 7", 0, GBC_CHAT, DDKEY_F8, 0, 0}, + {"chatsendmacro 8", 0, GBC_CHAT, DDKEY_F9, 0, 0}, + {"chatsendmacro 9", 0, GBC_CHAT, DDKEY_F10, 0, 0}, + {"chatdelete", 0, GBC_CHAT, DDKEY_BACKSPACE, 0, 0}, + + {"messageyes", 0, GBC_MESSAGE, 'y', 0, 0}, + {"messageno", 0, GBC_MESSAGE, 'n', 0, 0}, + {"messagecancel", 0, GBC_MESSAGE, DDKEY_ESCAPE, 0, 0}, + {"", 0, 0, 0, 0, 0} // terminator +}; + +// PRIVATE DATA DEFINITIONS ------------------------------------------------ + +// CODE -------------------------------------------------------------------- diff --git a/doomsday/plugins/jheretic/src/h_console.c b/doomsday/plugins/jheretic/src/h_console.c index 872e8b6a0b..11d9bb127d 100644 --- a/doomsday/plugins/jheretic/src/h_console.c +++ b/doomsday/plugins/jheretic/src/h_console.c @@ -22,7 +22,9 @@ // HEADER FILES ------------------------------------------------------------ #include "jheretic.h" + #include "f_infine.h" +#include "g_controls.h" // MACROS ------------------------------------------------------------------ @@ -58,8 +60,6 @@ DEFCC(CCmdSpawnMobj); DEFCC(CCmdPrintPlayerCoords); -DEFCC(CCmdInventory); - // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- DEFCC(CCmdScreenShot); diff --git a/doomsday/plugins/jheretic/src/h_main.c b/doomsday/plugins/jheretic/src/h_main.c index 1b0c2f3178..b0c7e37c06 100644 --- a/doomsday/plugins/jheretic/src/h_main.c +++ b/doomsday/plugins/jheretic/src/h_main.c @@ -214,7 +214,7 @@ void DetectIWADs(void) /* * gamemode, gamemission and the gameModeString are set. */ -void H_IdentifyVersion(void) +void G_IdentifyVersion(void) { // The game mode string is used in netgames. strcpy(gameModeString, "heretic"); @@ -246,6 +246,7 @@ void H_PreInit(void) memset(&cfg, 0, sizeof(cfg)); cfg.playerMoveSpeed = 1; cfg.dclickuse = false; + cfg.inventoryNextOnUnuse = true; cfg.mouseSensiX = cfg.mouseSensiY = 8; cfg.povLookAround = true; cfg.joyaxis[0] = JOYAXIS_TURN; diff --git a/doomsday/plugins/jheretic/src/h_refresh.c b/doomsday/plugins/jheretic/src/h_refresh.c index 6cc60c58b6..b08cca1f3e 100644 --- a/doomsday/plugins/jheretic/src/h_refresh.c +++ b/doomsday/plugins/jheretic/src/h_refresh.c @@ -49,8 +49,6 @@ void R_SetAllDoomsdayFlags(); extern boolean finalestage; extern boolean amap_fullyopen; - -extern boolean inhelpscreens; extern float lookOffset; extern const float deffontRGB[]; @@ -190,7 +188,6 @@ void D_Display(void) { static boolean viewactivestate = false; static boolean menuactivestate = false; - static boolean inhelpscreensstate = false; //static int fullscreenmode = 0; static gamestate_t oldgamestate = -1; int ay; @@ -318,7 +315,6 @@ void D_Display(void) menuactivestate = menuactive; viewactivestate = viewactive; - inhelpscreensstate = inhelpscreens; oldgamestate = wipegamestate = gamestate; // draw pause pic (but not if InFine active) diff --git a/doomsday/plugins/jheretic/src/p_inter.c b/doomsday/plugins/jheretic/src/p_inter.c index a2c8668b17..1670f32289 100644 --- a/doomsday/plugins/jheretic/src/p_inter.c +++ b/doomsday/plugins/jheretic/src/p_inter.c @@ -307,45 +307,6 @@ boolean P_GivePower(player_t *player, powertype_t power) return (true); } -/* - * Returns true if artifact accepted. - */ -boolean P_GiveArtifact(player_t *player, artitype_t arti, mobj_t *mo) -{ - int i; - - player->update |= PSF_INVENTORY; - i = 0; - while(player->inventory[i].type != arti && i < player->inventorySlotNum) - { - i++; - } - if(i == player->inventorySlotNum) - { - player->inventory[i].count = 1; - player->inventory[i].type = arti; - player->inventorySlotNum++; - } - else - { - if(player->inventory[i].count >= 16) - { // Player already has 16 of this item - return (false); - } - player->inventory[i].count++; - } - if(player->artifactCount == 0) - { - player->readyArtifact = arti; - } - player->artifactCount++; - if(mo && (mo->flags & MF_COUNTITEM)) - { - player->itemcount++; - } - return (true); -} - /* * Removes the MF_SPECIAL flag, and initiates the artifact pickup * animation. @@ -975,7 +936,7 @@ boolean P_AutoUseChaosDevice(player_t *player) { if(player->inventory[i].type == arti_teleport) { - P_PlayerUseArtifact(player, arti_teleport); + P_InventoryUseArtifact(player, arti_teleport); player->health = player->plr->mo->health = (player->health + 1) / 2; return (true); @@ -1014,7 +975,7 @@ void P_AutoUseHealth(player_t *player, int saveHealth) for(i = 0; i < count; i++) { player->health += 25; - P_PlayerRemoveArtifact(player, normalSlot); + P_InventoryRemoveArtifact(player, normalSlot); } } else if(superCount * 100 >= saveHealth) @@ -1024,7 +985,7 @@ void P_AutoUseHealth(player_t *player, int saveHealth) for(i = 0; i < count; i++) { player->health += 100; - P_PlayerRemoveArtifact(player, superSlot); + P_InventoryRemoveArtifact(player, superSlot); } } else if((gameskill == sk_baby) && @@ -1036,13 +997,13 @@ void P_AutoUseHealth(player_t *player, int saveHealth) for(i = 0; i < count; i++) { player->health += 25; - P_PlayerRemoveArtifact(player, normalSlot); + P_InventoryRemoveArtifact(player, normalSlot); } count = (saveHealth + 99) / 100; for(i = 0; i < count; i++) { player->health += 100; - P_PlayerRemoveArtifact(player, normalSlot); + P_InventoryRemoveArtifact(player, normalSlot); } } player->plr->mo->health = player->health; diff --git a/doomsday/plugins/jheretic/src/p_mobj.c b/doomsday/plugins/jheretic/src/p_mobj.c index ce20b42133..3e8b686fe0 100644 --- a/doomsday/plugins/jheretic/src/p_mobj.c +++ b/doomsday/plugins/jheretic/src/p_mobj.c @@ -44,8 +44,6 @@ void P_ApplyTorque(mobj_t *mo); // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- -void P_SpawnMapThing(thing_t * mthing); - // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- // EXTERNAL DATA DECLARATIONS ---------------------------------------------- @@ -569,7 +567,9 @@ void P_ZMovement(mobj_t *mo) // after hitting the ground (hard), // and utter appropriate sound. mo->dplayer->deltaviewheight = mo->momz >> 3; - S_StartSound(sfx_plroof, mo); + + if(mo->player->health > 0) + S_StartSound(sfx_plroof, mo); } mo->momz = 0; } @@ -631,7 +631,10 @@ void P_ZMovement(mobj_t *mo) #if __JHERETIC__ mo->player->jumptics = 12; // can't jump in a while. #endif - S_StartSound(sfx_plroof, mo); + // Fix DOOM bug - dead players grunting when hitting the ground + // (e.g., after an archvile attack) + if(mo->player->health > 0) + S_StartSound(sfx_plroof, mo); } P_HitFloor(mo); mo->momz = 0; @@ -1233,7 +1236,7 @@ void P_SpawnMapThing(thing_t * th) // count deathmatch start positions if(th->type == 11) { - if(deathmatch_p < &deathmatchstarts[16]) + if(deathmatch_p < &deathmatchstarts[MAX_DM_STARTS]) { memcpy(deathmatch_p, th, sizeof(*th)); deathmatch_p++; diff --git a/doomsday/plugins/jheretic/src/p_telept.c b/doomsday/plugins/jheretic/src/p_telept.c index 828391e0aa..8711198a54 100644 --- a/doomsday/plugins/jheretic/src/p_telept.c +++ b/doomsday/plugins/jheretic/src/p_telept.c @@ -169,3 +169,44 @@ boolean EV_Teleport(line_t *line, int side, mobj_t *thing) } return (false); } + +#if __JHERETIC__ || __JHEXEN__ +void P_ArtiTele(player_t *player) +{ + int i; + int selections; + fixed_t destX; + fixed_t destY; + angle_t destAngle; + + if(deathmatch) + { + selections = deathmatch_p - deathmatchstarts; + i = P_Random() % selections; + destX = deathmatchstarts[i].x << FRACBITS; + destY = deathmatchstarts[i].y << FRACBITS; + destAngle = ANG45 * (deathmatchstarts[i].angle / 45); + } + else + { + // FIXME?: DJS - this doesn't seem right... + destX = playerstarts[0].x << FRACBITS; + destY = playerstarts[0].y << FRACBITS; + destAngle = ANG45 * (playerstarts[0].angle / 45); + } + +# if __JHEXEN__ + P_Teleport(player->plr->mo, destX, destY, destAngle, true); + if(player->morphTics) + { // Teleporting away will undo any morph effects (pig) + P_UndoPlayerMorph(player); + } + //S_StartSound(NULL, sfx_wpnup); // Full volume laugh +# else + P_Teleport(player->plr->mo, destX, destY, destAngle); + /*S_StartSound(sfx_wpnup, NULL); // Full volume laugh + NetSv_Sound(NULL, sfx_wpnup, player-players); */ + S_StartSound(sfx_wpnup, NULL); +# endif +} +#endif diff --git a/doomsday/plugins/jheretic/src/st_stuff.c b/doomsday/plugins/jheretic/src/st_stuff.c index 6c4d9aade1..bf84bb4eac 100644 --- a/doomsday/plugins/jheretic/src/st_stuff.c +++ b/doomsday/plugins/jheretic/src/st_stuff.c @@ -102,8 +102,6 @@ typedef struct Cheat_s { // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- -void M_ClearMenus(void); - // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- boolean cht_Responder(event_t *ev); @@ -148,12 +146,15 @@ extern byte *screen; extern int messageResponse; +extern boolean hu_showallfrags; // in hu_stuff.c currently + // PUBLIC DATA DEFINITIONS ------------------------------------------------- -boolean inventory = false; int curpos; -int inv_ptr; -int ArtifactFlash; +int inventoryTics; +boolean inventory = false; + +static int ArtifactFlash; int lu_palette; @@ -286,7 +287,6 @@ static boolean st_blended = false; static int HealthMarker; static int ChainWiggle; -static player_t *CPlayer; static int oldarti = 0; static int oldartiCount = 0; @@ -565,6 +565,9 @@ cvar_t hudCVars[] = "Seconds for countdown sound of Tome of Power."}, {"hud-inventory-timer", 0, CVT_FLOAT, &cfg.inventoryTimer, 0, 30, "Seconds before the inventory auto-hides."}, + + {"hud-frags-all", 0, CVT_BYTE, &hu_showallfrags, 0, 1, + "Debug: HUD shows all frags of all players."}, {NULL} }; @@ -750,6 +753,7 @@ void ST_updateWidgets(void) found = true; } + if(!found) // Weapon takes no ammo at all. { w_ready.num = &largeammo; @@ -785,18 +789,18 @@ void ST_updateWidgets(void) else if(oldarti != plr->readyArtifact || oldartiCount != plr->inventory[inv_ptr].count) { - if(CPlayer->readyArtifact > 0) + + if(plr->readyArtifact > 0) { st_artici = plr->readyArtifact + 5; } + oldarti = plr->readyArtifact; oldartiCount = plr->inventory[inv_ptr].count; } // update the inventory - x = inv_ptr - curpos; - for(i = 0; i < NUMVISINVSLOTS; i++) { st_invslot[i] = plr->inventory[x + i].type +5; // plus 5 for useartifact patches @@ -919,14 +923,39 @@ void ST_Init(void) ST_loadData(); } +void ST_Inventory(boolean show) +{ + if(show) + { + inventory = true; + + inventoryTics = (int) (cfg.inventoryTimer * TICSPERSEC); + if(inventoryTics < 1) + inventoryTics = 1; + } + else + inventory = false; +} + +boolean ST_IsInventoryVisible(void) +{ + return inventory; +} + +void ST_InventoryFlashCurrent(player_t *player) +{ + if(player == &players[consoleplayer]) + ArtifactFlash = 4; +} + void ST_Ticker(void) { int delta; int curHealth; static int tomePlay = 0; - +Con_Message("ST_updateWidgets\n"); ST_updateWidgets(); - +Con_Message("done\n"); if(leveltime & 1) { ChainWiggle = P_Random() & 1; @@ -974,6 +1003,14 @@ void ST_Ticker(void) S_LocalSound(sfx_keyup, NULL); } } + + // turn inventory off after a certain amount of time + if(inventory && !(--inventoryTics)) + { + players[consoleplayer].readyArtifact = + players[consoleplayer].inventory[inv_ptr].type; + inventory = false; + } } static void DrINumber(signed int val, int x, int y, float r, float g, float b, float a) @@ -1184,20 +1221,21 @@ void ST_drawIcons(void) static boolean hitCenterFrame; float iconalpha = cfg.hudIconAlpha; float textalpha = cfg.hudColor[3]; + player_t *plyr = &players[consoleplayer]; Draw_BeginZoom(cfg.hudScale, 2, 2); // Flight icons - if(CPlayer->powers[pw_flight]) + if(plyr->powers[pw_flight]) { int offset = (cfg.hudShown[HUD_AMMO] && cfg.screenblocks > 10 && - CPlayer->readyweapon > 0 && - CPlayer->readyweapon < 7) ? 43 : 0; - if(CPlayer->powers[pw_flight] > BLINKTHRESHOLD || - !(CPlayer->powers[pw_flight] & 16)) + plyr->readyweapon > 0 && + plyr->readyweapon < 7) ? 43 : 0; + if(plyr->powers[pw_flight] > BLINKTHRESHOLD || + !(plyr->powers[pw_flight] & 16)) { frame = (leveltime / 3) & 15; - if(CPlayer->plr->mo->flags2 & MF2_FLY) + if(plyr->plr->mo->flags2 & MF2_FLY) { if(hitCenterFrame && (frame != 15 && frame != 0)) { @@ -1234,15 +1272,15 @@ void ST_drawIcons(void) Draw_BeginZoom(cfg.hudScale, 318, 2); - if(CPlayer->powers[pw_weaponlevel2] && !CPlayer->morphTics) + if(plyr->powers[pw_weaponlevel2] && !plyr->morphTics) { - if(cfg.tomeCounter || CPlayer->powers[pw_weaponlevel2] > BLINKTHRESHOLD - || !(CPlayer->powers[pw_weaponlevel2] & 16)) + if(cfg.tomeCounter || plyr->powers[pw_weaponlevel2] > BLINKTHRESHOLD + || !(plyr->powers[pw_weaponlevel2] & 16)) { frame = (leveltime / 3) & 15; - if(cfg.tomeCounter && CPlayer->powers[pw_weaponlevel2] < 35) + if(cfg.tomeCounter && plyr->powers[pw_weaponlevel2] < 35) { - gl.Color4f(1, 1, 1, CPlayer->powers[pw_weaponlevel2] / 35.0f); + gl.Color4f(1, 1, 1, plyr->powers[pw_weaponlevel2] / 35.0f); } GL_DrawPatchLitAlpha(300, 17, 1, iconalpha, spinbooklump.lump + frame); GL_Update(DDUF_TOP | DDUF_MESSAGES); @@ -1251,9 +1289,9 @@ void ST_drawIcons(void) { GL_Update(DDUF_TOP | DDUF_MESSAGES); } - if(CPlayer->powers[pw_weaponlevel2] < cfg.tomeCounter * 35) + if(plyr->powers[pw_weaponlevel2] < cfg.tomeCounter * 35) { - _DrSmallNumber(1 + CPlayer->powers[pw_weaponlevel2] / 35, 303, 30, + _DrSmallNumber(1 + plyr->powers[pw_weaponlevel2] / 35, 303, 30, false,1,1,1,textalpha); } } @@ -1346,7 +1384,7 @@ void ST_Drawer(int fullscreenmode, boolean refresh ) ST_drawIcons(); } -int H_GetFilterColor(int filter) +int R_GetFilterColor(int filter) { int rgba = 0; @@ -1360,9 +1398,9 @@ int H_GetFilterColor(int filter) return rgba; } -void H_SetFilter(int filter) +void R_SetFilter(int filter) { - GL_SetFilter(H_GetFilterColor(filter)); + GL_SetFilter(R_GetFilterColor(filter)); } /* @@ -1373,23 +1411,20 @@ void ST_doPaletteStuff(void) { static int sb_palette = 0; int palette; + player_t *plyr = &players[consoleplayer]; - // byte *pal; - - CPlayer = &players[consoleplayer]; - - if(CPlayer->damagecount) + if(plyr->damagecount) { - palette = (CPlayer->damagecount + 7) >> 3; + palette = (plyr->damagecount + 7) >> 3; if(palette >= NUMREDPALS) { palette = NUMREDPALS - 1; } palette += STARTREDPALS; } - else if(CPlayer->bonuscount) + else if(plyr->bonuscount) { - palette = (CPlayer->bonuscount + 7) >> 3; + palette = (plyr->bonuscount + 7) >> 3; if(palette >= NUMBONUSPALS) { palette = NUMBONUSPALS - 1; @@ -1404,7 +1439,7 @@ void ST_doPaletteStuff(void) { sb_palette = palette; - CPlayer->plr->filter = H_GetFilterColor(palette); // $democam + plyr->plr->filter = R_GetFilterColor(palette); // $democam } } @@ -1433,7 +1468,7 @@ void DrawChain(void) gemglow = healthPos / 100; chainY = (HealthMarker == - CPlayer->plr->mo->health) ? 191 : 191 + ChainWiggle; + plyr->plr->mo->health) ? 191 : 191 + ChainWiggle; // draw the chain @@ -1488,6 +1523,7 @@ void DrawChain(void) void ST_drawWidgets(boolean refresh) { int x, i; + player_t *plyr = &players[consoleplayer]; oldhealth = -1; if(!inventory) @@ -1542,7 +1578,7 @@ void ST_drawWidgets(boolean refresh) GL_DrawPatchLitAlpha(38, 159, 1, cfg.statusbarCounterAlpha, !(leveltime & 4) ? PatchINVLFGEM1.lump : PatchINVLFGEM2.lump); // Draw more right indicator - if(CPlayer->inventorySlotNum - x > 7) + if(plyr->inventorySlotNum - x > 7) GL_DrawPatchLitAlpha(269, 159, 1, cfg.statusbarCounterAlpha, !(leveltime & 4) ? PatchINVRTGEM1.lump : PatchINVRTGEM2.lump); } } @@ -1554,26 +1590,27 @@ void ST_doFullscreenStuff(void) int temp; float textalpha = hudalpha - ( 1 - cfg.hudColor[3]); float iconalpha = hudalpha - ( 1 - cfg.hudIconAlpha); + player_t *plyr = &players[consoleplayer]; GL_Update(DDUF_FULLSCREEN); if(cfg.hudShown[HUD_AMMO]) { - if(CPlayer->readyweapon > 0 && CPlayer->readyweapon < 7) + if(plyr->readyweapon > 0 && plyr->readyweapon < 7) { ammotype_t ammotype; - int lvl = (CPlayer->powers[pw_weaponlevel2]? 1 : 0); + int lvl = (plyr->powers[pw_weaponlevel2]? 1 : 0); // TODO: Only supports one type of ammo per weapon. // for each type of ammo this weapon takes. for(ammotype=0; ammotype < NUMAMMO; ++ammotype) { - if(!weaponinfo[CPlayer->readyweapon][CPlayer->class].mode[lvl].ammotype[ammotype]) + if(!weaponinfo[plyr->readyweapon][plyr->class].mode[lvl].ammotype[ammotype]) continue; Draw_BeginZoom(cfg.hudScale, 2, 2); GL_DrawPatchLitAlpha(-1, 0, 1, iconalpha, - W_GetNumForName(ammopic[CPlayer->readyweapon - 1])); - DrINumber(CPlayer->ammo[ammotype], 18, 2, 1, 1, 1, textalpha); + W_GetNumForName(ammopic[plyr->readyweapon - 1])); + DrINumber(plyr->ammo[ammotype], 18, 2, 1, 1, 1, textalpha); Draw_EndZoom(); GL_Update(DDUF_TOP); @@ -1585,9 +1622,9 @@ void ST_doFullscreenStuff(void) Draw_BeginZoom(cfg.hudScale, 2, 198); if(cfg.hudShown[HUD_HEALTH]) { - if(CPlayer->plr->mo->health > 0) + if(plyr->plr->mo->health > 0) { - DrBNumber(CPlayer->plr->mo->health, 2, 180, + DrBNumber(plyr->plr->mo->health, 2, 180, cfg.hudColor[0], cfg.hudColor[1], cfg.hudColor[2], textalpha); } else @@ -1605,24 +1642,24 @@ void ST_doFullscreenStuff(void) else if(!cfg.hudShown[HUD_HEALTH] && !cfg.hudShown[HUD_KEYS]) temp = 186; - DrINumber(CPlayer->armorpoints, 6, temp, 1, 1, 1, textalpha); + DrINumber(plyr->armorpoints, 6, temp, 1, 1, 1, textalpha); } if(cfg.hudShown[HUD_KEYS]) { x = 6; // Draw keys above health? - if(CPlayer->keys[key_yellow]) + if(plyr->keys[key_yellow]) { GL_DrawPatchLitAlpha(x, cfg.hudShown[HUD_HEALTH]? 172 : 190, 1, iconalpha, W_GetNumForName("ykeyicon")); x += 11; } - if(CPlayer->keys[key_green]) + if(plyr->keys[key_green]) { GL_DrawPatchLitAlpha(x, cfg.hudShown[HUD_HEALTH]? 172 : 190, 1, iconalpha, W_GetNumForName("gkeyicon")); x += 11; } - if(CPlayer->keys[key_blue]) + if(plyr->keys[key_blue]) { GL_DrawPatchLitAlpha(x, cfg.hudShown[HUD_HEALTH]? 172 : 190, 1, iconalpha, W_GetNumForName("bkeyicon")); } @@ -1636,7 +1673,7 @@ void ST_doFullscreenStuff(void) { if(players[i].plr->ingame) { - temp += CPlayer->frags[i]; + temp += plyr->frags[i]; } } Draw_BeginZoom(cfg.hudScale, 2, 198); @@ -1645,14 +1682,14 @@ void ST_doFullscreenStuff(void) } if(!inventory) { - if(cfg.hudShown[HUD_ARTI] && CPlayer->readyArtifact > 0) + if(cfg.hudShown[HUD_ARTI] && plyr->readyArtifact > 0) { Draw_BeginZoom(cfg.hudScale, 318, 198); GL_DrawPatchLitAlpha(286, 166, 1, iconalpha/2, W_GetNumForName("ARTIBOX")); GL_DrawPatchLitAlpha(286, 166, 1, iconalpha, - W_GetNumForName(artifactlist[CPlayer->readyArtifact + 5])); //plus 5 for useartifact flashes - DrSmallNumber(CPlayer->inventory[inv_ptr].count, 307, 188, 1, 1, 1, textalpha); + W_GetNumForName(artifactlist[plyr->readyArtifact + 5])); //plus 5 for useartifact flashes + DrSmallNumber(plyr->inventory[inv_ptr].count, 307, 188, 1, 1, 1, textalpha); Draw_EndZoom(); } } @@ -1667,13 +1704,13 @@ void ST_doFullscreenStuff(void) for(i = 0; i < 7; i++) { GL_DrawPatchLitAlpha(50 + i * 31, 168, 1, iconalpha/2, W_GetNumForName("ARTIBOX")); - if(CPlayer->inventorySlotNum > x + i && - CPlayer->inventory[x + i].type != arti_none) + if(plyr->inventorySlotNum > x + i && + plyr->inventory[x + i].type != arti_none) { GL_DrawPatchLitAlpha(50 + i * 31, 168, 1, i==curpos? hudalpha : iconalpha, - W_GetNumForName(artifactlist[CPlayer->inventory[x + i]. + W_GetNumForName(artifactlist[plyr->inventory[x + i]. type +5])); //plus 5 for useartifact flashes - DrSmallNumber(CPlayer->inventory[x + i].count, 69 + i * 31, 190, 1, 1, 1, i==curpos? hudalpha : textalpha/2); + DrSmallNumber(plyr->inventory[x + i].count, 69 + i * 31, 190, 1, 1, 1, i==curpos? hudalpha : textalpha/2); } } GL_DrawPatchLitAlpha(50 + curpos * 31, 197, 1, hudalpha, PatchSELECTBOX.lump); @@ -1682,7 +1719,7 @@ void ST_doFullscreenStuff(void) GL_DrawPatchLitAlpha(38, 167, 1, iconalpha, !(leveltime & 4) ? PatchINVLFGEM1.lump : PatchINVLFGEM2.lump); } - if(CPlayer->inventorySlotNum - x > 7) + if(plyr->inventorySlotNum - x > 7) { GL_DrawPatchLitAlpha(269, 167, 1, iconalpha, !(leveltime & 4) ? PatchINVRTGEM1.lump : PatchINVRTGEM2.lump); @@ -1886,7 +1923,7 @@ static void CheatWeaponsFunc(player_t *player, Cheat_t * cheat) } player->backpack = true; } - for(i = 0; i < NUMWEAPONS - 1; i++) + for(i = 0; i < NUMWEAPONS; i++) { if(weaponinfo[i][0].mode[0].gamemodebits & gamemodebits) player->weaponowned[i] = true; @@ -1909,7 +1946,7 @@ static void CheatPowerFunc(player_t *player, Cheat_t * cheat) } else { - P_UseArtifact(player, arti_tomeofpower); + P_UseArtifactOnPlayer(player, arti_tomeofpower); P_SetMessage(player, TXT_CHEATPOWERON); } } @@ -1982,23 +2019,22 @@ static void CheatArtifact2Func(player_t *player, Cheat_t * cheat) static void CheatArtifact3Func(player_t *player, Cheat_t * cheat) { int i; - int j; - artitype_t type; + artitype_e type; int count; type = cheat->args[0] - 'a' + 1; count = cheat->args[1] - '0'; if(type == 26 && count == 0) { // All artifacts - for(i = arti_none + 1; i < NUMARTIFACTS; i++) + for(type = arti_none + 1; type < NUMARTIFACTS; type++) { - if(gamemode == shareware && (i == arti_superhealth || i == arti_teleport)) + if(gamemode == shareware && (type == arti_superhealth || type == arti_teleport)) { continue; } - for(j = 0; j < 16; j++) + for(i = 0; i < MAXARTICOUNT; i++) { - P_GiveArtifact(player, i, NULL); + P_GiveArtifact(player, type, NULL); } } P_SetMessage(player, TXT_CHEATARTIFACTS3); diff --git a/doomsday/plugins/jhexen/include/h2_actn.h b/doomsday/plugins/jhexen/include/h2_actn.h index de8bd35d41..61be0af8e2 100644 --- a/doomsday/plugins/jhexen/include/h2_actn.h +++ b/doomsday/plugins/jhexen/include/h2_actn.h @@ -5,63 +5,63 @@ # error "Using jHexen headers without __JHEXEN__" #endif -#include "h2def.h" +#include "dd_share.h" // These must correspond the action_t's in the actions array! // Things that are needed in building ticcmds should be here. typedef enum { - // Game controls. - A_TURNLEFT, - A_TURNRIGHT, - A_FORWARD, - A_BACKWARD, - A_STRAFELEFT, - A_STRAFERIGHT, - A_JUMP, - A_FIRE, - A_USE, - A_STRAFE, - A_SPEED, - A_FLYUP, - A_FLYDOWN, - A_FLYCENTER, - A_LOOKUP, - A_LOOKDOWN, - A_LOOKCENTER, - A_USEARTIFACT, - A_MLOOK, - A_JLOOK, - A_NEXTWEAPON, - A_PREVIOUSWEAPON, - A_WEAPON1, - A_WEAPON2, - A_WEAPON3, - A_WEAPON4, + // Game controls. + A_TURNLEFT, + A_TURNRIGHT, + A_FORWARD, + A_BACKWARD, + A_STRAFELEFT, + A_STRAFERIGHT, + A_JUMP, + A_FIRE, + A_USE, + A_STRAFE, + A_SPEED, + A_FLYUP, + A_FLYDOWN, + A_FLYCENTER, + A_LOOKUP, + A_LOOKDOWN, + A_LOOKCENTER, + A_USEARTIFACT, + A_MLOOK, + A_JLOOK, + A_NEXTWEAPON, + A_PREVIOUSWEAPON, + A_WEAPON1, + A_WEAPON2, + A_WEAPON3, + A_WEAPON4, - // Item hotkeys. - A_PANIC, - A_TORCH, - A_HEALTH, - A_MYSTICURN, - A_KRATER, - A_SPEEDBOOTS, - A_BLASTRADIUS, - A_TELEPORT, - A_TELEPORTOTHER, - A_POISONBAG, - A_INVULNERABILITY, - A_DARKSERVANT, - A_EGG, + // Item hotkeys. + A_PANIC, + A_TORCH, + A_HEALTH, + A_MYSTICURN, + A_KRATER, + A_SPEEDBOOTS, + A_BLASTRADIUS, + A_TELEPORT, + A_TELEPORTOTHER, + A_POISONBAG, + A_INVULNERABILITY, + A_DARKSERVANT, + A_EGG, - // Game system actions. - A_STOPDEMO, - A_MAPZOOMIN, - A_MAPZOOMOUT, - A_MAPPANUP, - A_MAPPANDOWN, - A_MAPPANLEFT, - A_MAPPANRIGHT, - NUM_ACTIONS + // Game system actions. + A_STOPDEMO, + A_MAPZOOMIN, + A_MAPZOOMOUT, + A_MAPPANUP, + A_MAPPANDOWN, + A_MAPPANLEFT, + A_MAPPANRIGHT, + NUM_ACTIONS } h2action_t; // This is the actions array. diff --git a/doomsday/plugins/jhexen/include/h2def.h b/doomsday/plugins/jhexen/include/h2def.h index 0329dccbc1..0dce324689 100644 --- a/doomsday/plugins/jhexen/include/h2def.h +++ b/doomsday/plugins/jhexen/include/h2def.h @@ -35,6 +35,9 @@ #define DATAPATH "}data\\"GAMENAMETEXT"\\" #define STARTUPWAD "}data\\"GAMENAMETEXT"\\"GAMENAMETEXT".wad" +// Misc macros. +#define CLAMP(v, min, max) (v < min? v=min : v > max? v=max : v) + #ifdef WIN32 #pragma warning (disable:4761 4244) #define strcasecmp stricmp @@ -342,6 +345,7 @@ typedef enum { #define PCLASS_INFO(class) (&classInfo[class]) typedef struct classinfo_s{ + mobjtype_t mobjtype; int normalstate; int runstate; int attackstate; @@ -351,6 +355,8 @@ typedef struct classinfo_s{ fixed_t maxmove; fixed_t forwardmove[2]; // walk, run fixed_t sidemove[2]; // walk, run + int movemul; // multiplier for above + int jumptics; // wait inbetween jumps int armorincrement[NUMARMOR]; int piecex[3]; // temp } classinfo_t; @@ -487,7 +493,7 @@ typedef enum { arti_puzzgear3, arti_puzzgear4, NUMARTIFACTS -} artitype_t; +} artitype_e; #define MAXARTICOUNT 25 @@ -588,7 +594,7 @@ typedef struct saveplayer_s { int colormap; // 0-3 for which color to draw player pspdef_t psprites[NUMPSPRITES]; // view sprites (gun, etc) int morphTics; // player is a pig if > 0 - uint jumpTics; // delay the next jump for a moment + uint jumptics; // delay the next jump for a moment unsigned int worldTimer; // total time the player's been playing } saveplayer_t; #pragma pack() @@ -614,7 +620,7 @@ typedef struct player_s { int armorpoints[NUMARMOR]; inventory_t inventory[NUMINVENTORYSLOTS]; - artitype_t readyArtifact; + artitype_e readyArtifact; int artifactCount; int inventorySlotNum; int powers[NUMPOWERS]; @@ -642,7 +648,7 @@ typedef struct player_s { int colormap; // 0-3 for which color to draw player pspdef_t psprites[NUMPSPRITES]; // view sprites (gun, etc) int morphTics; // player is a pig if > 0 - uint jumpTics; // delay the next jump for a moment + uint jumptics; // delay the next jump for a moment unsigned int worldTimer; // total time the player's been playing int update, startspot; int viewlock; // $democam @@ -759,9 +765,6 @@ extern int leveltime; // tics in game play for par extern thing_t *deathmatch_p; extern thing_t deathmatchstarts[MAX_DM_STARTS]; -// Position indicator for cooperative net-play reborn -extern int RebornPosition; - #define MAX_PLAYER_STARTS 8 @@ -802,9 +805,9 @@ void H2_Main(void); // calls all startup code // parses command line options -void H2_IdentifyVersion(void); -void H2_SetFilter(int filter); -int H2_GetFilterColor(int filter); +void G_IdentifyVersion(void); +void R_SetFilter(int filter); +int R_GetFilterColor(int filter); char *G_Get(int id); @@ -950,23 +953,16 @@ extern int localQuakeHappening[MAXPLAYERS]; extern unsigned char rndtable[256]; extern int prndindex; -#ifndef TIC_DEBUG - -byte P_Random(); - -#else // TIC_DEBUG defined +#ifdef TIC_DEBUG extern FILE *rndDebugfile; -#define P_Random() \ - ((rndDebugfile && netgame)? (fprintf(rndDebugfile, "%i:"__FILE__", %i\n", gametic, __LINE__), \ - rndtable[(++prndindex)&0xff]) : rndtable[(++prndindex)&0xff]) #define FUNTAG(fun) { if(rndDebugfile) fprintf(rndDebugfile, "%i: %s\n", gametic, fun); } #endif // TIC_DEBUG -// as M_Random, but used only by the play simulation - +//returns a number from 0 to 255 +byte P_Random(void); void M_ClearRandom(void); extern unsigned char rndtable[256]; diff --git a/doomsday/plugins/jhexen/include/jhexen.h b/doomsday/plugins/jhexen/include/jhexen.h index 25771cab32..8724fd4379 100644 --- a/doomsday/plugins/jhexen/include/jhexen.h +++ b/doomsday/plugins/jhexen/include/jhexen.h @@ -27,7 +27,6 @@ #include "../../jhexen/include/h2def.h" #include "../../jhexen/include/acfnlink.h" #include "../../jhexen/include/h2_actn.h" -#include "../../jhexen/include/m_ctrl.h" #include "../../jhexen/include/mn_def.h" #include "../../jhexen/include/p_local.h" #include "../../jhexen/include/p_spec.h" @@ -41,4 +40,7 @@ #include "../../jhexen/include/xddefs.h" #include "../../jhexen/include/p_setup.h" +#include "p_inventory.h" +#include "g_controls.h" + #endif // __JHEXEN_CONVENIENCE_H__ diff --git a/doomsday/plugins/jhexen/include/m_ctrl.h b/doomsday/plugins/jhexen/include/m_ctrl.h index 96b56c9d6c..f094ce12aa 100644 --- a/doomsday/plugins/jhexen/include/m_ctrl.h +++ b/doomsday/plugins/jhexen/include/m_ctrl.h @@ -10,33 +10,7 @@ #include "mn_def.h" #include "h2_actn.h" - -#define CTLCFG_TYPE void - -CTLCFG_TYPE SCControlConfig(int option, void *data); - -// Control flags. -#define CLF_ACTION 0x1 // The control is an action (+/- in front). -#define CLF_REPEAT 0x2 // Bind down + repeat. - -typedef struct { - char *command; // The command to execute. - int flags; - int bindClass; // Class it should be bound into - int defKey; // - int defMouse; // Zero means there is no default. - int defJoy; // -} Control_t; - -// Game registered bindClasses -enum { - GBC_CLASS1 = NUM_DDBINDCLASSES, - GBC_CLASS2, - GBC_CLASS3, - GBC_MENUHOTKEY, - GBC_CHAT, - GBC_MESSAGE -}; +#include "g_controls.h" // // !!! Add new controls to the end, the existing indices must remain unchanged !!! diff --git a/doomsday/plugins/jhexen/include/p_local.h b/doomsday/plugins/jhexen/include/p_local.h index bca1049754..dde7c85a8c 100644 --- a/doomsday/plugins/jhexen/include/p_local.h +++ b/doomsday/plugins/jhexen/include/p_local.h @@ -86,6 +86,8 @@ typedef enum { extern int TimerGame; // tic countdown for deathmatch +#define thinkercap (*gi.thinkercap) + // ***** P_PSPR ***** #define USE_MANA1 1 @@ -101,14 +103,11 @@ void P_ActivateMorphWeapon(player_t *player); void P_PostMorphWeapon(player_t *player, weapontype_t weapon); // ***** P_USER ***** - -void P_PlayerThink(player_t *player); void P_Thrust(player_t *player, angle_t angle, fixed_t move); -void P_PlayerRemoveArtifact(player_t *player, int slot); -void P_PlayerUseArtifact(player_t *player, artitype_t arti); -boolean P_UseArtifact(player_t *player, artitype_t arti); void P_TeleportOther(mobj_t *victim); +void P_ArtiTeleportOther(player_t *player); void ResetBlasted(mobj_t *mo); +boolean P_UndoPlayerMorph(player_t *player); // ***** P_MOBJ ***** @@ -127,9 +126,16 @@ enum { #define FLOATRANDZ (DDMAXINT-1) #define FROMCEILINGZ128 (DDMAXINT-2) +// Time interval for item respawning. +#define ITEMQUESIZE 128 + +extern int iquehead; +extern int iquetail; + extern mobjtype_t PuffType; extern mobj_t *MissileMobj; +void P_SpawnMapThing(thing_t * th); mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type); void P_RemoveMobj(mobj_t *th); boolean P_SetMobjState(mobj_t *mobj, statenum_t state); @@ -140,6 +146,8 @@ boolean P_SeekerMissile(mobj_t *actor, angle_t thresh, angle_t turnMax); void P_MobjThinker(mobj_t *mobj); void P_BlasterMobjThinker(mobj_t *mobj); +boolean P_HealRadius(player_t *player); +void P_BlastRadius(player_t *player); void P_SpawnPuff(fixed_t x, fixed_t y, fixed_t z); void P_SpawnBlood(fixed_t x, fixed_t y, fixed_t z, int damage); void P_BloodSplatter(fixed_t x, fixed_t y, fixed_t z, @@ -260,7 +268,6 @@ void P_PoisonPlayer(player_t *player, mobj_t *poisoner, int poison); void P_PoisonDamage(player_t *player, mobj_t *source, int damage, boolean playPainSound); boolean P_GiveMana(player_t *player, ammotype_t mana, int count); -boolean P_GiveArtifact(player_t *player, artitype_t arti, mobj_t *mo); boolean P_GiveArmor(player_t *player, armortype_t armortype, int amount); boolean P_GiveBody(player_t *player, int num); @@ -277,10 +284,16 @@ boolean A_LocalQuake(byte *args, mobj_t *victim); void P_SpawnDirt(mobj_t *actor, fixed_t radius); void C_DECL A_BridgeRemove(mobj_t *actor); -// ***** SB_BAR ***** +// ***** ST_STUFF ***** + +extern int curpos; + +void ST_Inventory(boolean show); +boolean ST_IsInventoryVisible(void); + +void ST_InventoryFlashCurrent(player_t *player); extern int SB_state; -extern int ArtifactFlash; void SB_PaletteFlash(boolean forceChange); // ===== PO_MAN ===== diff --git a/doomsday/plugins/jhexen/include/p_spec.h b/doomsday/plugins/jhexen/include/p_spec.h index 2a7acf33c6..fb2c1e6c7f 100644 --- a/doomsday/plugins/jhexen/include/p_spec.h +++ b/doomsday/plugins/jhexen/include/p_spec.h @@ -462,9 +462,11 @@ boolean EV_StartFloorWaggle(int tag, int height, int speed, int offset, // //-------------------------------------------------------------------------- +#define TELEFOGHEIGHT (32*FRACUNIT) boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, angle_t angle, boolean useFog); boolean EV_Teleport(int tid, mobj_t *thing, boolean fog); +void P_ArtiTele(player_t *player); //-------------------------------------------------------------------------- // diff --git a/doomsday/plugins/jhexen/include/textdefs.h b/doomsday/plugins/jhexen/include/textdefs.h index 6e8561f370..74f28fb7f5 100644 --- a/doomsday/plugins/jhexen/include/textdefs.h +++ b/doomsday/plugins/jhexen/include/textdefs.h @@ -10,10 +10,12 @@ //** //************************************************************************** -#define GET_TXT(x) ((*gi.text)[x].text) +#define GET_TXT(x) ((*gi.text)[x].text) // MN_menu.c --------------------------------------------------------------- +#define NUM_QUITMESSAGES 0 + #define PRESSKEY GET_TXT(TXT_PRESSKEY) #define PRESSYN GET_TXT(TXT_PRESSYN) #define TXT_PAUSED GET_TXT(TXT_TXT_PAUSED) @@ -35,7 +37,7 @@ #define TXT_GAMMA_LEVEL_2 GET_TXT(TXT_TXT_GAMMA_LEVEL_2) #define TXT_GAMMA_LEVEL_3 GET_TXT(TXT_TXT_GAMMA_LEVEL_3) #define TXT_GAMMA_LEVEL_4 GET_TXT(TXT_TXT_GAMMA_LEVEL_4) -#define EMPTYSTRING GET_TXT(TXT_EMPTYSTRING) +#define EMPTYSTRING GET_TXT(TXT_EMPTYSTRING) // P_inter.c --------------------------------------------------------------- @@ -47,16 +49,16 @@ // Keys -#define TXT_KEY_STEEL GET_TXT(TXT_TXT_KEY_STEEL) -#define TXT_KEY_CAVE GET_TXT(TXT_TXT_KEY_CAVE) -#define TXT_KEY_AXE GET_TXT(TXT_TXT_KEY_AXE) -#define TXT_KEY_FIRE GET_TXT(TXT_TXT_KEY_FIRE) -#define TXT_KEY_EMERALD GET_TXT(TXT_TXT_KEY_EMERALD) -#define TXT_KEY_DUNGEON GET_TXT(TXT_TXT_KEY_DUNGEON) -#define TXT_KEY_SILVER GET_TXT(TXT_TXT_KEY_SILVER) -#define TXT_KEY_RUSTED GET_TXT(TXT_TXT_KEY_RUSTED) -#define TXT_KEY_HORN GET_TXT(TXT_TXT_KEY_HORN) -#define TXT_KEY_SWAMP GET_TXT(TXT_TXT_KEY_SWAMP) +#define TXT_KEY_STEEL GET_TXT(TXT_TXT_KEY_STEEL) +#define TXT_KEY_CAVE GET_TXT(TXT_TXT_KEY_CAVE) +#define TXT_KEY_AXE GET_TXT(TXT_TXT_KEY_AXE) +#define TXT_KEY_FIRE GET_TXT(TXT_TXT_KEY_FIRE) +#define TXT_KEY_EMERALD GET_TXT(TXT_TXT_KEY_EMERALD) +#define TXT_KEY_DUNGEON GET_TXT(TXT_TXT_KEY_DUNGEON) +#define TXT_KEY_SILVER GET_TXT(TXT_TXT_KEY_SILVER) +#define TXT_KEY_RUSTED GET_TXT(TXT_TXT_KEY_RUSTED) +#define TXT_KEY_HORN GET_TXT(TXT_TXT_KEY_HORN) +#define TXT_KEY_SWAMP GET_TXT(TXT_TXT_KEY_SWAMP) #define TXT_KEY_CASTLE GET_TXT(TXT_TXT_KEY_CASTLE) // Artifacts diff --git a/doomsday/plugins/jhexen/include/x_config.h b/doomsday/plugins/jhexen/include/x_config.h index dfa50e7a9b..8be9e54908 100644 --- a/doomsday/plugins/jhexen/include/x_config.h +++ b/doomsday/plugins/jhexen/include/x_config.h @@ -20,6 +20,7 @@ enum { typedef struct { float playerMoveSpeed; int chooseAndUse; + int inventoryNextOnUnuse; float lookSpeed; float turnSpeed; int quakeFly; @@ -43,17 +44,17 @@ typedef struct { byte netMap, netClass, netColor, netSkill; byte netEpisode; // unused in Hexen byte netDeathmatch, netNomonsters, netRandomclass; + byte netJumping; byte netMobDamageModifier; // multiplier for non-player mobj damage byte netMobHealthModifier; // health modifier for non-player mobjs int netGravity; // multiplayer custom gravity byte netNoMaxZRadiusAttack; // radius attacks are infinitely tall byte netNoMaxZMonsterMeleeAttack; // melee attacks are infinitely tall byte overrideHubMsg; // skip the transition hub message when 1 - byte demoDisabled; // disable demos int cameraNoClip; float bobView, bobWeapon; byte askQuickSaveLoad; - int jumpEnabled; // Always true + int jumpEnabled; float jumpPower; int airborneMovement; int usemouse, noAutoAim, alwaysRun; diff --git a/doomsday/plugins/jhexen/src/g_ctrl.c b/doomsday/plugins/jhexen/src/g_ctrl.c new file mode 100644 index 0000000000..ad4f66776c --- /dev/null +++ b/doomsday/plugins/jhexen/src/g_ctrl.c @@ -0,0 +1,185 @@ +/* DE1: $Id: template.c 2645 2006-01-21 12:58:39Z skyjake $ + * Copyright (C) 2006 Jaakko Keränen + * Daniel Swanson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * In addition, as a special exception, we, the authors of deng + * give permission to link the code of our release of deng with + * the libjhexen and/or the libjheretic libraries (or with modified + * versions of it that use the same license as the libjhexen or + * libjheretic libraries), and distribute the linked executables. + * You must obey the GNU General Public License in all respects for + * all of the code used other than “libjhexen or libjheretic”. If + * you modify this file, you may extend this exception to your + * version of the file, but you are not obligated to do so. If you + * do not wish to do so, delete this exception statement from your version. + */ + +/* + * g_ctrl.c: Control bindings - Hexen specific + */ + +// HEADER FILES ------------------------------------------------------------ + +#include "h2_actn.h" +#include "g_controls.h" + +// MACROS ------------------------------------------------------------------ + +// TYPES ------------------------------------------------------------------- + +// EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- + +// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- + +// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- + +// EXTERNAL DATA DECLARATIONS ---------------------------------------------- + +// PUBLIC DATA DEFINITIONS ------------------------------------------------- + +// +// !!! Add new controls to the end, the existing indices must remain unchanged !!! +// +const Control_t controls[] = { + // Actions (must be first so the A_* constants can be used). + {"left", CLF_ACTION, DDBC_NORMAL, DDKEY_LEFTARROW, 0, 0}, + {"right", CLF_ACTION, DDBC_NORMAL, DDKEY_RIGHTARROW, 0, 0}, + {"forward", CLF_ACTION, DDBC_NORMAL, DDKEY_UPARROW, 0, 0}, + {"backward", CLF_ACTION, DDBC_NORMAL, DDKEY_DOWNARROW, 0, 0}, + {"strafel", CLF_ACTION, DDBC_NORMAL, ',', 0, 0}, + {"strafer", CLF_ACTION, DDBC_NORMAL, '.', 0, 0}, + {"jump", CLF_ACTION, DDBC_NORMAL, '/', 2, 5}, + {"fire", CLF_ACTION, DDBC_NORMAL, DDKEY_RCTRL, 1, 1}, + {"use", CLF_ACTION, DDBC_NORMAL, ' ', 0, 4}, + {"strafe", CLF_ACTION, DDBC_NORMAL, DDKEY_RALT, 3, 2}, + + {"speed", CLF_ACTION, DDBC_NORMAL, DDKEY_RSHIFT, 0, 3}, + {"flyup", CLF_ACTION, DDBC_NORMAL, DDKEY_PGUP, 0, 8}, + {"flydown", CLF_ACTION, DDBC_NORMAL, DDKEY_INS, 0, 9}, + {"falldown", CLF_ACTION, DDBC_NORMAL, DDKEY_HOME, 0, 0}, + {"lookup", CLF_ACTION, DDBC_NORMAL, DDKEY_PGDN, 0, 6}, + {"lookdown", CLF_ACTION, DDBC_NORMAL, DDKEY_DEL, 0, 7}, + {"lookcntr", CLF_ACTION, DDBC_NORMAL, DDKEY_END, 0, 0}, + {"usearti", CLF_ACTION, DDBC_NORMAL, DDKEY_ENTER, 0, 0}, + {"mlook", CLF_ACTION, DDBC_NORMAL, 'm', 0, 0}, + {"jlook", CLF_ACTION, DDBC_NORMAL, 'j', 0, 0}, + + {"nextwpn", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"prevwpn", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"weapon1", CLF_ACTION, DDBC_NORMAL, '1', 0, 0}, + {"weapon2", CLF_ACTION, DDBC_NORMAL, '2', 0, 0}, + {"weapon3", CLF_ACTION, DDBC_NORMAL, '3', 0, 0}, + {"weapon4", CLF_ACTION, DDBC_NORMAL, '4', 0, 0}, + {"panic", CLF_ACTION, DDBC_NORMAL, DDKEY_BACKSPACE, 0, 0}, + {"torch", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"health", CLF_ACTION, DDBC_NORMAL, '\\', 0, 0}, + {"mystic", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + + {"krater", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"spdboots", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"blast", CLF_ACTION, DDBC_NORMAL, '9', 0, 0}, + {"teleport", CLF_ACTION, DDBC_NORMAL, '8', 0, 0}, + {"teleothr", CLF_ACTION, DDBC_NORMAL, '7', 0, 0}, + {"poison", CLF_ACTION, DDBC_NORMAL, '0', 0, 0}, + {"cantdie", CLF_ACTION, DDBC_NORMAL, '5', 0, 0}, + {"servant", CLF_ACTION, DDBC_NORMAL, 0, 0, 0}, + {"egg", CLF_ACTION, DDBC_NORMAL, '6', 0, 0}, + {"demostop", CLF_ACTION, DDBC_NORMAL, 'o', 0, 0}, + + // Menu hotkeys (default: F1 - F12). + {"Helpscreen", 0, DDBC_NORMAL, DDKEY_F1, 0, 0}, + {"loadgame", 0, DDBC_NORMAL, DDKEY_F3, 0, 0}, + {"savegame", 0, DDBC_NORMAL, DDKEY_F2, 0, 0}, + {"soundmenu", 0, DDBC_NORMAL, DDKEY_F4, 0, 0}, + {"suicide", 0, DDBC_NORMAL, DDKEY_F5, 0, 0}, + {"quicksave", 0, DDBC_NORMAL, DDKEY_F6, 0, 0}, + {"endgame", 0, DDBC_NORMAL, DDKEY_F7, 0, 0}, + {"togglemsgs", 0, DDBC_NORMAL, DDKEY_F8, 0, 0}, + {"quickload", 0, DDBC_NORMAL, DDKEY_F9, 0, 0}, + {"quit", 0, DDBC_NORMAL, DDKEY_F10, 0, 0}, + {"togglegamma", 0, DDBC_NORMAL, DDKEY_F11, 0, 0}, + {"spy", 0, DDBC_NORMAL, DDKEY_F12, 0, 0}, + + // Inventory. + {"invleft", CLF_REPEAT, DDBC_NORMAL, '[', 0, 0}, + {"invright", CLF_REPEAT, DDBC_NORMAL, ']', 0, 0}, + + // Screen controls. + {"viewsize +", CLF_REPEAT, DDBC_NORMAL, '=', 0, 0}, + {"viewsize -", CLF_REPEAT, DDBC_NORMAL, '-', 0, 0}, + {"sbsize +", CLF_REPEAT, DDBC_NORMAL, 0, 0, 0}, + {"sbsize -", CLF_REPEAT, DDBC_NORMAL, 0, 0, 0}, + + // Misc. + {"pause", 0, DDBC_NORMAL, DDKEY_PAUSE, 0, 0}, + {"screenshot", 0, DDBC_NORMAL, 0, 0, 0}, + + {"automap", 0, DDBC_NORMAL, DDKEY_TAB, 0, 0}, + {"follow", 0, GBC_CLASS1, 'f', 0, 0}, + {"rotate", 0, GBC_CLASS1, 'r', 0, 0}, + {"grid", 0, GBC_CLASS1, 'g', 0, 0}, + {"mzoomin", CLF_ACTION, GBC_CLASS1, '=', 0, 0}, + {"mzoomout", CLF_ACTION, GBC_CLASS1, '-', 0, 0}, + {"zoommax", 0, GBC_CLASS1, '0', 0, 0}, + {"addmark", 0, GBC_CLASS1, 'm', 0, 0}, + {"clearmarks", 0, GBC_CLASS1, 'c', 0, 0}, + {"mpanup", CLF_ACTION, GBC_CLASS2, DDKEY_UPARROW, 0, 0}, + {"mpandown", CLF_ACTION, GBC_CLASS2, DDKEY_DOWNARROW, 0, 0}, + {"mpanleft", CLF_ACTION, GBC_CLASS2, DDKEY_LEFTARROW, 0, 0}, + {"mpanright", CLF_ACTION, GBC_CLASS2, DDKEY_RIGHTARROW, 0, 0}, + + {"beginchat", 0, DDBC_NORMAL, 't', 0, 0}, + {"beginchat 0", 0, DDBC_NORMAL, 'g', 0, 0}, + {"beginchat 1", 0, DDBC_NORMAL, 'y', 0, 0}, + {"beginchat 2", 0, DDBC_NORMAL, 'r', 0, 0}, + {"beginchat 3", 0, DDBC_NORMAL, 'b', 0, 0}, + + // Menu actions. + {"menuup", CLF_REPEAT, GBC_CLASS3, DDKEY_UPARROW, 0, 0}, + {"menudown", CLF_REPEAT, GBC_CLASS3, DDKEY_DOWNARROW, 0, 0}, + {"menuleft", CLF_REPEAT, GBC_CLASS3, DDKEY_LEFTARROW, 0, 0}, + {"menuright", CLF_REPEAT, GBC_CLASS3, DDKEY_RIGHTARROW, 0, 0}, + {"menuselect", 0, GBC_CLASS3, DDKEY_ENTER, 0, 0}, + {"menucancel", 0, GBC_CLASS3, DDKEY_BACKSPACE, 0, 0}, + {"menu", 0, GBC_MENUHOTKEY, DDKEY_ESCAPE, 0, 0}, + + // More chat actions. + {"msgrefresh", 0, DDBC_NORMAL, DDKEY_ENTER, 0, 0}, + {"chatcomplete", 0, GBC_CHAT, DDKEY_ENTER, 0, 0}, + {"chatcancel", 0, GBC_CHAT, DDKEY_ESCAPE, 0, 0}, + {"chatsendmacro 0", 0, GBC_CHAT, DDKEY_F1, 0, 0}, + {"chatsendmacro 1", 0, GBC_CHAT, DDKEY_F2, 0, 0}, + {"chatsendmacro 2", 0, GBC_CHAT, DDKEY_F3, 0, 0}, + {"chatsendmacro 3", 0, GBC_CHAT, DDKEY_F4, 0, 0}, + {"chatsendmacro 4", 0, GBC_CHAT, DDKEY_F5, 0, 0}, + {"chatsendmacro 5", 0, GBC_CHAT, DDKEY_F6, 0, 0}, + {"chatsendmacro 6", 0, GBC_CHAT, DDKEY_F7, 0, 0}, + {"chatsendmacro 7", 0, GBC_CHAT, DDKEY_F8, 0, 0}, + {"chatsendmacro 8", 0, GBC_CHAT, DDKEY_F9, 0, 0}, + {"chatsendmacro 9", 0, GBC_CHAT, DDKEY_F10, 0, 0}, + {"chatdelete", 0, GBC_CHAT, DDKEY_BACKSPACE, 0, 0}, + + {"messageyes", 0, GBC_MESSAGE, 'y', 0, 0}, + {"messageno", 0, GBC_MESSAGE, 'n', 0, 0}, + {"messagecancel", 0, GBC_MESSAGE, DDKEY_ESCAPE, 0, 0}, + {"", 0, 0, 0, 0, 0} +}; + +// PRIVATE DATA DEFINITIONS ------------------------------------------------ + +// CODE -------------------------------------------------------------------- diff --git a/doomsday/plugins/jhexen/src/h2_main.c b/doomsday/plugins/jhexen/src/h2_main.c index ebea16710b..9a9f570695 100644 --- a/doomsday/plugins/jhexen/src/h2_main.c +++ b/doomsday/plugins/jhexen/src/h2_main.c @@ -190,7 +190,7 @@ boolean D_SetGameMode(GameMode_t mode) /* * Set the game mode string. */ -void H2_IdentifyVersion(void) +void G_IdentifyVersion(void) { // Determine the game mode. Assume demo mode. strcpy(gameModeString, "hexen-demo"); @@ -243,6 +243,7 @@ void H2_PreInit(void) cfg.playerMoveSpeed = 1; cfg.sbarscale = 20; cfg.dclickuse = false; + cfg.inventoryNextOnUnuse = true; cfg.mouseSensiX = 8; cfg.mouseSensiY = 8; cfg.joyaxis[0] = JOYAXIS_TURN; @@ -256,7 +257,7 @@ void H2_PreInit(void) cfg.xhairSize = 1; for(i = 0; i < 4; i++) cfg.xhairColor[i] = 255; - cfg.jumpEnabled = true; // Always true in Hexen + cfg.jumpEnabled = cfg.netJumping = true; // true by default in Hexen cfg.jumpPower = 9; cfg.airborneMovement = 1; cfg.netMap = 1; diff --git a/doomsday/plugins/jhexen/src/hconsole.c b/doomsday/plugins/jhexen/src/hconsole.c index 1a79b0e116..e3985483f9 100644 --- a/doomsday/plugins/jhexen/src/hconsole.c +++ b/doomsday/plugins/jhexen/src/hconsole.c @@ -28,6 +28,7 @@ #include "hu_stuff.h" #include "f_infine.h" #include "g_common.h" +#include "g_controls.h" // MACROS ------------------------------------------------------------------ @@ -65,8 +66,6 @@ DEFCC(CCmdSpawnMobj); DEFCC(CCmdPrintPlayerCoords); -DEFCC(CCmdInventory); - DEFCC(CCmdScriptInfo); DEFCC(CCmdTest); DEFCC(CCmdMovePlane); @@ -131,6 +130,9 @@ cvar_t gameCVars[] = { "World gravity modifier, multiplayer (-1..100). -1 = Map default."}, // Gameplay options + {"server-game-jump", 0, CVT_BYTE, + &cfg.netJumping, 0, 1, + "1=Allow jumping in multiplayer games."}, {"server-game-nomonsters", 0, CVT_BYTE, &cfg.netNomonsters, 0, 1, "1=No monsters."}, @@ -159,6 +161,8 @@ cvar_t gameCVars[] = { // Movment {"player-move-speed", 0, CVT_FLOAT, &cfg.playerMoveSpeed, 0, 1, "Player movement speed modifier."}, + {"player-jump", 0, CVT_INT, &cfg.jumpEnabled, 0, 1, + "1=Allow jumping."}, {"player-jump-power", 0, CVT_FLOAT, &cfg.jumpPower, 0, 100, "Jump power (for all clients if this is the server)."}, {"player-air-movement", 0, CVT_BYTE, &cfg.airborneMovement, 0, 32, diff --git a/doomsday/plugins/jhexen/src/hrefresh.c b/doomsday/plugins/jhexen/src/hrefresh.c index dee0565dec..3702825247 100644 --- a/doomsday/plugins/jhexen/src/hrefresh.c +++ b/doomsday/plugins/jhexen/src/hrefresh.c @@ -216,14 +216,12 @@ void R_DrawMapTitle(void) // wipegamestate can be set to -1 to force a wipe on the next draw gamestate_t wipegamestate = GS_DEMOSCREEN; -extern boolean inhelpscreens; #define SIZEFACT 4 #define SIZEFACT2 16 void G_Drawer(void) { static boolean viewactivestate = false; static boolean menuactivestate = false; - static boolean inhelpscreensstate = false; static int fullscreenmode = 0; static gamestate_t oldgamestate = -1; int py; @@ -392,7 +390,6 @@ void G_Drawer(void) menuactivestate = menuactive; viewactivestate = viewactive; - inhelpscreensstate = inhelpscreens; oldgamestate = wipegamestate = gamestate; if(paused && !fi_active) @@ -409,26 +406,9 @@ void G_Drawer(void) FI_Drawer(); } -//========================================================================== -// -// PageDrawer -// -//========================================================================== - -/*static void PageDrawer(void) - { - if(!pagename) return; - GL_DrawRawScreen(W_GetNumForName(pagename), 0, 0); - if(demosequence == 1) - { - GL_DrawPatch(4, 160, W_GetNumForName("ADVISOR")); - } - GL_Update(DDUF_FULLSCREEN); - } */ - #define FMAKERGBA(r,g,b,a) ( (byte)(0xff*r) + ((byte)(0xff*g)<<8) + ((byte)(0xff*b)<<16) + ((byte)(0xff*a)<<24) ) -int H2_GetFilterColor(int filter) +int R_GetFilterColor(int filter) { //int rgba = 0; @@ -453,13 +433,13 @@ int H2_GetFilterColor(int filter) // Light blue? return FMAKERGBA(.5f, .5f, 1, .4f); else if(filter) - Con_Error("H2_GetFilterColor: Strange filter number: %d.\n", filter); + Con_Error("R_GetFilterColor: Strange filter number: %d.\n", filter); return 0; } -void H2_SetFilter(int filter) +void R_SetFilter(int filter) { - GL_SetFilter(H2_GetFilterColor(filter)); + GL_SetFilter(R_GetFilterColor(filter)); } void H2_EndFrame(void) diff --git a/doomsday/plugins/jhexen/src/p_acs.c b/doomsday/plugins/jhexen/src/p_acs.c index 2da2211201..0fde910de0 100644 --- a/doomsday/plugins/jhexen/src/p_acs.c +++ b/doomsday/plugins/jhexen/src/p_acs.c @@ -211,13 +211,13 @@ CmdNOP, CmdTerminate, CmdSuspend, CmdPushNumber, CmdLSpec1, CmdLSpec2, // CODE -------------------------------------------------------------------- -//========================================================================== -// -// P_LoadACScripts -// -// Clients have nothing to do with scripts. -// -//========================================================================== +char *GetACString(int id) +{ + if(id < 0 || id > ACStringCount) + return NULL; + + return ACStrings[id]; +} void P_LoadACScripts(int lump) { @@ -1227,7 +1227,7 @@ static void ThingCount(int type, int tid) } else { // Count only types - for(think = gi.thinkercap->next; think != gi.thinkercap; + for(think = thinkercap.next; think != &thinkercap && think; think = think->next) { if(think->function != P_MobjThinker) @@ -1283,7 +1283,7 @@ static int CmdChangeFloor(void) int flat; int sectorIndex; - flat = R_FlatNumForName(ACStrings[Pop()]); + flat = R_FlatNumForName(GetACString(Pop())); tag = Pop(); sectorIndex = -1; while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0) @@ -1300,7 +1300,7 @@ static int CmdChangeFloorDirect(void) int sectorIndex; tag = LONG(*PCodePtr++); - flat = R_FlatNumForName(ACStrings[LONG(*PCodePtr++)]); + flat = R_FlatNumForName(GetACString(LONG(*PCodePtr++))); sectorIndex = -1; while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0) { @@ -1315,7 +1315,7 @@ static int CmdChangeCeiling(void) int flat; int sectorIndex; - flat = R_FlatNumForName(ACStrings[Pop()]); + flat = R_FlatNumForName(GetACString(Pop())); tag = Pop(); sectorIndex = -1; while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0) @@ -1332,7 +1332,7 @@ static int CmdChangeCeilingDirect(void) int sectorIndex; tag = LONG(*PCodePtr++); - flat = R_FlatNumForName(ACStrings[LONG(*PCodePtr++)]); + flat = R_FlatNumForName(GetACString(LONG(*PCodePtr++))); sectorIndex = -1; while((sectorIndex = P_FindSectorFromTag(tag, sectorIndex)) >= 0) { @@ -1504,7 +1504,7 @@ static int CmdEndPrintBold(void) static int CmdPrintString(void) { - strcat(PrintBuffer, ACStrings[Pop()]); + strcat(PrintBuffer, GetACString(Pop())); return SCRIPT_CONTINUE; } @@ -1588,7 +1588,7 @@ static int CmdSectorSound(void) #if _DEBUG Con_Printf("CmdSectorSound: volume=%i\n", volume); #endif - S_StartSoundAtVolume(S_GetSoundID(ACStrings[Pop()]), mobj, + S_StartSoundAtVolume(S_GetSoundID(GetACString(Pop())), mobj, volume / 127.0f); return SCRIPT_CONTINUE; } @@ -1602,7 +1602,7 @@ static int CmdThingSound(void) int searcher; volume = Pop(); - sound = S_GetSoundID(ACStrings[Pop()]); + sound = S_GetSoundID(GetACString(Pop())); tid = Pop(); searcher = -1; while(sound && (mobj = P_FindMobjFromTID(tid, &searcher)) != NULL) @@ -1614,7 +1614,7 @@ static int CmdThingSound(void) static int CmdAmbientSound(void) { - int volume; + int volume, sound; mobj_t *mobj = NULL; // For 3D positioning. mobj_t *plrmo = players[displayplayer].plr->mo; @@ -1631,8 +1631,10 @@ static int CmdAmbientSound(void) MT_CAMERA); // A camera's a good temporary source. mobj->tics = 5 * 35; // Five seconds should be enough. } - S_StartSoundAtVolume(S_GetSoundID(ACStrings[Pop()]), mobj, - volume / 127.0f); + + sound = S_GetSoundID(GetACString(Pop())); + S_StartSoundAtVolume(sound, mobj, volume / 127.0f); + return SCRIPT_CONTINUE; } @@ -1646,7 +1648,7 @@ static int CmdSoundSequence(void) sector_t* front = P_GetPtrp(ACScript->line, DMU_FRONT_SECTOR); mobj = P_GetPtrp(front, DMU_SOUND_ORIGIN); } - SN_StartSequenceName(mobj, ACStrings[Pop()]); + SN_StartSequenceName(mobj, GetACString(Pop())); return SCRIPT_CONTINUE; } @@ -1659,7 +1661,7 @@ static int CmdSetLineTexture(void) int texture; int searcher; - texture = R_TextureNumForName(ACStrings[Pop()]); + texture = R_TextureNumForName(GetACString(Pop())); position = Pop(); side = Pop(); lineTag = Pop(); diff --git a/doomsday/plugins/jhexen/src/p_enemy.c b/doomsday/plugins/jhexen/src/p_enemy.c index 9ead3e0da9..e45768ad32 100644 --- a/doomsday/plugins/jhexen/src/p_enemy.c +++ b/doomsday/plugins/jhexen/src/p_enemy.c @@ -430,7 +430,7 @@ boolean P_LookForMonsters(mobj_t *actor) return (false); } count = 0; - for(think = gi.thinkercap->next; think != gi.thinkercap; + for(think = thinkercap.next; think != &thinkercap && think; think = think->next) { if(think->function != P_MobjThinker) @@ -1143,7 +1143,7 @@ void C_DECL A_MinotaurLook(mobj_t *actor) if(!actor->target) // Normal monster search { - for(think = gi.thinkercap->next; think != gi.thinkercap; + for(think = thinkercap.next; think != &thinkercap && think; think = think->next) { if(think->function != P_MobjThinker) @@ -1674,7 +1674,7 @@ int P_Massacre(void) return 0; count = 0; - for(think = gi.thinkercap->next; think != gi.thinkercap; + for(think = thinkercap.next; think != &thinkercap && think; think = think->next) { if(think->function != P_MobjThinker) @@ -1847,7 +1847,7 @@ void P_InitCreatureCorpseQueue(boolean corpseScan) return; // Search mobj list for corpses and place them in this queue - for(think = gi.thinkercap->next; think != gi.thinkercap; + for(think = thinkercap.next; think != &thinkercap && think; think = think->next) { if(think->function != P_MobjThinker) @@ -2051,6 +2051,13 @@ void C_DECL A_SerpentChase(mobj_t *actor) } } +void C_DECL A_SpeedFade(mobj_t *actor) +{ + actor->flags |= MF_SHADOW; + actor->flags &= ~MF_ALTSHADOW; + actor->sprite = actor->target->sprite; +} + //============================================================================ // // A_SerpentRaiseHump diff --git a/doomsday/plugins/jhexen/src/p_floor.c b/doomsday/plugins/jhexen/src/p_floor.c index bd29123c68..a7c7e20fd5 100644 --- a/doomsday/plugins/jhexen/src/p_floor.c +++ b/doomsday/plugins/jhexen/src/p_floor.c @@ -843,7 +843,7 @@ int EV_FloorCrushStop(line_t *line, byte *args) boolean rtn; rtn = 0; - for(think = gi.thinkercap->next; think != gi.thinkercap; + for(think = thinkercap.next; think != &thinkercap && think; think = think->next) { if(think->function != T_MoveFloor) diff --git a/doomsday/plugins/jhexen/src/p_inter.c b/doomsday/plugins/jhexen/src/p_inter.c index 8893739d38..95363fa01b 100644 --- a/doomsday/plugins/jhexen/src/p_inter.c +++ b/doomsday/plugins/jhexen/src/p_inter.c @@ -33,7 +33,7 @@ int TextKeyMessages[] = { }; static void SetDormantArtifact(mobj_t *arti); -static void TryPickupArtifact(player_t *player, artitype_t artifactType, +static void TryPickupArtifact(player_t *player, artitype_e artifactType, mobj_t *artifact); static void TryPickupWeapon(player_t *player, pclass_t weaponClass, weapontype_t weaponType, mobj_t *weapon, @@ -635,7 +635,7 @@ boolean P_GivePower(player_t *player, powertype_t power) // //========================================================================== -static void TryPickupArtifact(player_t *player, artitype_t artifactType, +static void TryPickupArtifact(player_t *player, artitype_e artifactType, mobj_t *artifact) { //static char *artifactMessages[NUMARTIFACTS] = @@ -702,81 +702,6 @@ static void TryPickupArtifact(player_t *player, artitype_t artifactType, } } -//--------------------------------------------------------------------------- -// -// FUNC P_GiveArtifact -// -// Returns true if artifact accepted. -// -//--------------------------------------------------------------------------- - -boolean P_GiveArtifact(player_t *player, artitype_t arti, mobj_t *mo) -{ - int i; - int j; - boolean slidePointer; - - player->update |= PSF_INVENTORY; - slidePointer = false; - i = 0; - while(player->inventory[i].type != arti && i < player->inventorySlotNum) - { - i++; - } - if(i == player->inventorySlotNum) - { - if(arti < arti_firstpuzzitem) - { - i = 0; - while(player->inventory[i].type < arti_firstpuzzitem && - i < player->inventorySlotNum) - { - i++; - } - if(i != player->inventorySlotNum) - { - for(j = player->inventorySlotNum; j > i; j--) - { - player->inventory[j].count = - player->inventory[j - 1].count; - player->inventory[j].type = player->inventory[j - 1].type; - slidePointer = true; - } - } - } - player->inventory[i].count = 1; - player->inventory[i].type = arti; - player->inventorySlotNum++; - } - else - { - if(arti >= arti_firstpuzzitem && IS_NETGAME && !deathmatch) - { // Can't carry more than 1 puzzle item in coop netplay - return false; - } - if(player->inventory[i].count >= 25) - { // Player already has 25 of this item - return false; - } - player->inventory[i].count++; - } - if(!player->artifactCount) - { - player->readyArtifact = arti; - } - else if(player == &players[consoleplayer] && slidePointer && i <= inv_ptr) - { - inv_ptr++; - curpos++; - if(curpos > 6) - { - curpos = 6; - } - } - player->artifactCount++; - return (true); -} - //========================================================================== // // SetDormantArtifact @@ -1181,7 +1106,7 @@ mobj_t *ActiveMinotaur(player_t *master) thinker_t *think; unsigned int *starttime; - for(think = gi.thinkercap->next; think != gi.thinkercap; + for(think = thinkercap.next; think != &thinkercap && think; think = think->next) { if(think->function != P_MobjThinker) @@ -1658,7 +1583,7 @@ void P_AutoUseHealth(player_t *player, int saveHealth) for(i = 0; i < count; i++) { player->health += 25; - P_PlayerRemoveArtifact(player, normalSlot); + P_InventoryRemoveArtifact(player, normalSlot); } } else if(superCount * 100 >= saveHealth) @@ -1667,7 +1592,7 @@ void P_AutoUseHealth(player_t *player, int saveHealth) for(i = 0; i < count; i++) { player->health += 100; - P_PlayerRemoveArtifact(player, superSlot); + P_InventoryRemoveArtifact(player, superSlot); } } else if((gameskill == sk_baby) && @@ -1678,13 +1603,13 @@ void P_AutoUseHealth(player_t *player, int saveHealth) for(i = 0; i < count; i++) { player->health += 25; - P_PlayerRemoveArtifact(player, normalSlot); + P_InventoryRemoveArtifact(player, normalSlot); } count = (saveHealth + 99) / 100; for(i = 0; i < count; i++) { player->health += 100; - P_PlayerRemoveArtifact(player, normalSlot); + P_InventoryRemoveArtifact(player, normalSlot); } } player->plr->mo->health = player->health; diff --git a/doomsday/plugins/jhexen/src/p_mobj.c b/doomsday/plugins/jhexen/src/p_mobj.c index a999cdc7ea..156701a477 100644 --- a/doomsday/plugins/jhexen/src/p_mobj.c +++ b/doomsday/plugins/jhexen/src/p_mobj.c @@ -26,6 +26,11 @@ #define MAX_BOB_OFFSET 0x80000 +#define BLAST_RADIUS_DIST 255*FRACUNIT +#define BLAST_SPEED 20*FRACUNIT +#define BLAST_FULLSTRENGTH 255 +#define HEAL_RADIUS_DIST 255*FRACUNIT + // TYPES ------------------------------------------------------------------- // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- @@ -837,7 +842,7 @@ void P_ZMovement(mobj_t *mo) } if(mo->player) { - mo->player->jumpTics = 7; // delay any jumping for a short time + mo->player->jumptics = 7; // delay any jumping for a short time if(mo->momz < -GRAVITY * 8 && !(mo->flags2 & MF2_FLY)) { // squat down mo->player->plr->deltaviewheight = mo->momz >> 3; @@ -849,20 +854,24 @@ void P_ZMovement(mobj_t *mo) else if(mo->momz < -GRAVITY * 12 && !mo->player->morphTics) { S_StartSound(SFX_PLAYER_LAND, mo); - switch (mo->player->class) - { - case PCLASS_FIGHTER: - S_StartSound(SFX_PLAYER_FIGHTER_GRUNT, mo); - break; - case PCLASS_CLERIC: - S_StartSound(SFX_PLAYER_CLERIC_GRUNT, mo); - break; - case PCLASS_MAGE: - S_StartSound(SFX_PLAYER_MAGE_GRUNT, mo); - break; - default: - break; - } + + // Fix DOOM bug - dead players grunting when hitting the ground + // (e.g., after an archvile attack) + if(mo->player->health > 0) + switch (mo->player->class) + { + case PCLASS_FIGHTER: + S_StartSound(SFX_PLAYER_FIGHTER_GRUNT, mo); + break; + case PCLASS_CLERIC: + S_StartSound(SFX_PLAYER_CLERIC_GRUNT, mo); + break; + case PCLASS_MAGE: + S_StartSound(SFX_PLAYER_MAGE_GRUNT, mo); + break; + default: + break; + } } else if((P_GetThingFloorType(mo) < FLOOR_LIQUID) && (!mo->player->morphTics)) @@ -1469,21 +1478,8 @@ void P_SpawnPlayer(thing_t * mthing, int playernum) { p->class = cfg.PlayerClass[playernum]; } - switch (p->class) - { - case PCLASS_FIGHTER: - mobj = P_SpawnMobj(pos[VX], pos[VY], pos[VZ], MT_PLAYER_FIGHTER); - break; - case PCLASS_CLERIC: - mobj = P_SpawnMobj(pos[VX], pos[VY], pos[VZ], MT_PLAYER_CLERIC); - break; - case PCLASS_MAGE: - mobj = P_SpawnMobj(pos[VX], pos[VY], pos[VZ], MT_PLAYER_MAGE); - break; - default: - Con_Error("P_SpawnPlayer: Unknown class type"); - break; - } + + mobj = P_SpawnMobj(pos[VX], pos[VY], pos[VZ], PCLASS_INFO(p->class)->mobjtype); // With clients all player mobjs are remote, even the consoleplayer. if(IS_CLIENT) @@ -1826,7 +1822,7 @@ void P_CreateTIDList(void) thinker_t *t; i = 0; - for(t = gi.thinkercap->next; t != gi.thinkercap; t = t->next) + for(t = thinkercap.next; t != &thinkercap && t; t = t->next) { // Search all current thinkers if(t->function != P_MobjThinker) { // Not a mobj thinker @@ -2172,6 +2168,231 @@ int P_HitFloor(mobj_t *thing) return (FLOOR_SOLID); } +void ResetBlasted(mobj_t *mo) +{ + mo->flags2 &= ~MF2_BLASTED; + if(!(mo->flags & MF_ICECORPSE)) + { + mo->flags2 &= ~MF2_SLIDE; + } +} + +void P_BlastMobj(mobj_t *source, mobj_t *victim, fixed_t strength) +{ + angle_t angle, ang; + mobj_t *mo; + fixed_t pos[3]; + + angle = R_PointToAngle2(source->pos[VX], source->pos[VY], + victim->pos[VX], victim->pos[VY]); + angle >>= ANGLETOFINESHIFT; + if(strength < BLAST_FULLSTRENGTH) + { + victim->momx = FixedMul(strength, finecosine[angle]); + victim->momy = FixedMul(strength, finesine[angle]); + if(victim->player) + { + // Players handled automatically + } + else + { + victim->flags2 |= MF2_SLIDE; + victim->flags2 |= MF2_BLASTED; + } + } + else // full strength blast from artifact + { + if(victim->flags & MF_MISSILE) + { + switch (victim->type) + { + case MT_SORCBALL1: // don't blast sorcerer balls + case MT_SORCBALL2: + case MT_SORCBALL3: + return; + break; + case MT_MSTAFF_FX2: // Reflect to originator + victim->special1 = (int) victim->target; + victim->target = source; + break; + default: + break; + } + } + if(victim->type == MT_HOLY_FX) + { + if((mobj_t *) (victim->special1) == source) + { + victim->special1 = (int) victim->target; + victim->target = source; + } + } + victim->momx = FixedMul(BLAST_SPEED, finecosine[angle]); + victim->momy = FixedMul(BLAST_SPEED, finesine[angle]); + + // Spawn blast puff + ang = R_PointToAngle2(victim->pos[VX], victim->pos[VY], + source->pos[VX], source->pos[VY]); + ang >>= ANGLETOFINESHIFT; + + memcpy(pos, victim->pos, sizeof(pos)); + pos[VX] += FixedMul(victim->radius + FRACUNIT, finecosine[ang]); + pos[VY] += FixedMul(victim->radius + FRACUNIT, finesine[ang]); + pos[VZ] -= victim->floorclip + (victim->height >> 1); + + mo = P_SpawnMobj(pos[VX], pos[VY], pos[VZ], MT_BLASTEFFECT); + if(mo) + { + mo->momx = victim->momx; + mo->momy = victim->momy; + } + + if(victim->flags & MF_MISSILE) + { + victim->momz = 8 * FRACUNIT; + mo->momz = victim->momz; + } + else + { + victim->momz = (1000 / victim->info->mass) << FRACBITS; + } + + if(victim->player) + { + // Players handled automatically + } + else + { + victim->flags2 |= MF2_SLIDE; + victim->flags2 |= MF2_BLASTED; + } + } +} + +/* + * Blast all mobj things away + */ +void P_BlastRadius(player_t *player) +{ + mobj_t *mo; + mobj_t *pmo = player->plr->mo; + thinker_t *think; + fixed_t dist; + + S_StartSound(SFX_ARTIFACT_BLAST, pmo); + P_NoiseAlert(player->plr->mo, player->plr->mo); + + for(think = thinkercap.next; think != &thinkercap && think; + think = think->next) + { + if(think->function != P_MobjThinker) + continue; // Not a mobj thinker + + mo = (mobj_t *) think; + if((mo == pmo) || (mo->flags2 & MF2_BOSS)) + continue; // Not a valid monster + + if((mo->type == MT_POISONCLOUD) || // poison cloud + (mo->type == MT_HOLY_FX) || // holy fx + (mo->flags & MF_ICECORPSE)) // frozen corpse + { + // Let these special cases go + } + else if((mo->flags & MF_COUNTKILL) && (mo->health <= 0)) + { + continue; + } + else if(!(mo->flags & MF_COUNTKILL) && !(mo->player) && + !(mo->flags & MF_MISSILE)) + { // Must be monster, player, or missile + continue; + } + + if(mo->flags2 & MF2_DORMANT) + continue; // no dormant creatures + + if((mo->type == MT_WRAITHB) && (mo->flags2 & MF2_DONTDRAW)) + continue; // no underground wraiths + + if((mo->type == MT_SPLASHBASE) || (mo->type == MT_SPLASH)) + continue; + + if(mo->type == MT_SERPENT || mo->type == MT_SERPENTLEADER) + continue; + + dist = P_ApproxDistance(pmo->pos[VX] - mo->pos[VX], + pmo->pos[VY] - mo->pos[VY]); + if(dist > BLAST_RADIUS_DIST) + continue; // Out of range + + P_BlastMobj(pmo, mo, BLAST_FULLSTRENGTH); + } +} + +/* + * Do class specific effect for everyone in radius + */ +boolean P_HealRadius(player_t *player) +{ + mobj_t *mo; + mobj_t *pmo = player->plr->mo; + thinker_t *think; + fixed_t dist; + int effective = false; + int amount; + + for(think = thinkercap.next; think != &thinkercap && think; + think = think->next) + { + if(think->function != P_MobjThinker) + continue; // Not a mobj thinker + + mo = (mobj_t *) think; + if(!mo->player || mo->health <= 0) + continue; + + dist = P_ApproxDistance(pmo->pos[VX] - mo->pos[VX], + pmo->pos[VY] - mo->pos[VY]); + if(dist > HEAL_RADIUS_DIST) + continue; // Out of range + + switch (player->class) + { + case PCLASS_FIGHTER: // Radius armor boost + if((P_GiveArmor(mo->player, ARMOR_ARMOR, 1)) || + (P_GiveArmor(mo->player, ARMOR_SHIELD, 1)) || + (P_GiveArmor(mo->player, ARMOR_HELMET, 1)) || + (P_GiveArmor(mo->player, ARMOR_AMULET, 1))) + { + effective = true; + S_StartSound(SFX_MYSTICINCANT, mo); + } + break; + case PCLASS_CLERIC: // Radius heal + amount = 50 + (P_Random() % 50); + if(P_GiveBody(mo->player, amount)) + { + effective = true; + S_StartSound(SFX_MYSTICINCANT, mo); + } + break; + case PCLASS_MAGE: // Radius mana boost + amount = 50 + (P_Random() % 50); + if((P_GiveMana(mo->player, MANA_1, amount)) || + (P_GiveMana(mo->player, MANA_2, amount))) + { + effective = true; + S_StartSound(SFX_MYSTICINCANT, mo); + } + break; + case PCLASS_PIG: + default: + break; + } + } + return (effective); +} + //--------------------------------------------------------------------------- // // FUNC P_CheckMissileSpawn diff --git a/doomsday/plugins/jhexen/src/p_pspr.c b/doomsday/plugins/jhexen/src/p_pspr.c index 6504a6c549..dbdb5db403 100644 --- a/doomsday/plugins/jhexen/src/p_pspr.c +++ b/doomsday/plugins/jhexen/src/p_pspr.c @@ -1088,7 +1088,7 @@ void C_DECL A_MStaffAttack(player_t *player, pspdef_t * psp) player->damagecount = 0; player->bonuscount = 0; - H2_SetFilter(STARTSCOURGEPAL); + R_SetFilter(STARTSCOURGEPAL); } } @@ -1104,7 +1104,7 @@ void C_DECL A_MStaffPalette(player_t *player, pspdef_t * psp) pal = 0; } - H2_SetFilter(pal); + R_SetFilter(pal); } } @@ -1615,7 +1615,7 @@ void C_DECL A_CHolyAttack(player_t *player, pspdef_t * psp) player->damagecount = 0; player->bonuscount = 0; - H2_SetFilter(STARTHOLYPAL); + R_SetFilter(STARTHOLYPAL); } S_StartSound(SFX_CHOLY_FIRE, player->plr->mo); } @@ -1632,7 +1632,7 @@ void C_DECL A_CHolyPalette(player_t *player, pspdef_t * psp) pal = 0; } - H2_SetFilter(pal); + R_SetFilter(pal); } } diff --git a/doomsday/plugins/jhexen/src/p_spec.c b/doomsday/plugins/jhexen/src/p_spec.c index 13beef6971..555192b6c6 100644 --- a/doomsday/plugins/jhexen/src/p_spec.c +++ b/doomsday/plugins/jhexen/src/p_spec.c @@ -481,47 +481,18 @@ static boolean CheckedLockedDoor(mobj_t *mo, byte lock) boolean EV_LineSearchForPuzzleItem(line_t *line, byte *args, mobj_t *mo) { - player_t *player; - int i; - artitype_t type, arti; + artitype_e arti; - if(!mo) + if(!mo || !mo->player || !line) return false; - player = mo->player; - if(!player) + + arti = arti_firstpuzzitem + P_XLine(line)->arg1; + + if(arti < arti_firstpuzzitem) return false; // Search player's inventory for puzzle items - for(i = 0; i < player->artifactCount; i++) - { - arti = player->inventory[i].type; - type = arti - arti_firstpuzzitem; - if(type < 0) - continue; - if(type == P_XLine(line)->arg1) - { - // A puzzle item was found for the line - if(P_UseArtifact(player, arti)) - { - // A puzzle item was found for the line - P_PlayerRemoveArtifact(player, i); - if(arti < arti_firstpuzzitem) - { - S_ConsoleSound(SFX_ARTIFACT_USE, NULL, player - players); - } - else - { - S_ConsoleSound(SFX_PUZZLE_SUCCESS, NULL, player - players); - } - if(player == &players[consoleplayer]) - { - ArtifactFlash = 4; - } - return true; - } - } - } - return false; + return P_InventoryUseArtifact(mo->player, arti); } /* diff --git a/doomsday/plugins/jhexen/src/p_telept.c b/doomsday/plugins/jhexen/src/p_telept.c index 49885ec28d..092ba7d52a 100644 --- a/doomsday/plugins/jhexen/src/p_telept.c +++ b/doomsday/plugins/jhexen/src/p_telept.c @@ -32,11 +32,89 @@ // CODE -------------------------------------------------------------------- -//========================================================================== -// -// P_SpawnTeleFog -// -//========================================================================== +void P_ArtiTeleportOther(player_t *player) +{ + mobj_t *mo; + + mo = P_SpawnPlayerMissile(player->plr->mo, MT_TELOTHER_FX1); + + if(mo) + mo->target = player->plr->mo; +} + +void P_TeleportToPlayerStarts(mobj_t *victim) +{ + int i, selections = 0; + fixed_t destX, destY; + angle_t destAngle; + thing_t *start; + + for(i = 0; i < MAXPLAYERS; i++) + { + if(!players[i].plr->ingame) + continue; + + selections++; + } + + i = P_Random() % selections; + start = P_GetPlayerStart(0, i); + + destX = start->x << FRACBITS; + destY = start->y << FRACBITS; + destAngle = ANG45 * (playerstarts[i].angle / 45); + + P_Teleport(victim, destX, destY, destAngle, true); + //S_StartSound(NULL, sfx_wpnup); // Full volume laugh +} + +void P_TeleportToDeathmatchStarts(mobj_t *victim) +{ + int i, selections; + fixed_t destX, destY; + angle_t destAngle; + + selections = deathmatch_p - deathmatchstarts; + if(selections) + { + i = P_Random() % selections; + destX = deathmatchstarts[i].x << FRACBITS; + destY = deathmatchstarts[i].y << FRACBITS; + destAngle = ANG45 * (deathmatchstarts[i].angle / 45); + + P_Teleport(victim, destX, destY, destAngle, true); + //S_StartSound(NULL, sfx_wpnup); // Full volume laugh + } + else + { + P_TeleportToPlayerStarts(victim); + } +} + +void P_TeleportOther(mobj_t *victim) +{ + if(victim->player) + { + if(deathmatch) + P_TeleportToDeathmatchStarts(victim); + else + P_TeleportToPlayerStarts(victim); + } + else + { + // If death action, run it upon teleport + if(victim->flags & MF_COUNTKILL && victim->special) + { + P_RemoveMobjFromTIDList(victim); + P_ExecuteLineSpecial(victim->special, victim->args, NULL, 0, + victim); + victim->special = 0; + } + + // Send all monsters to deathmatch spots + P_TeleportToDeathmatchStarts(victim); + } +} mobj_t *P_SpawnTeleFog(int x, int y) { @@ -191,3 +269,44 @@ boolean EV_Teleport(int tid, mobj_t *thing, boolean fog) Con_Error("Can't find teleport mapspot\n"); return P_Teleport(thing, mo->pos[VX], mo->pos[VY], mo->angle, fog); } + +#if __JHERETIC__ || __JHEXEN__ +void P_ArtiTele(player_t *player) +{ + int i; + int selections; + fixed_t destX; + fixed_t destY; + angle_t destAngle; + + if(deathmatch) + { + selections = deathmatch_p - deathmatchstarts; + i = P_Random() % selections; + destX = deathmatchstarts[i].x << FRACBITS; + destY = deathmatchstarts[i].y << FRACBITS; + destAngle = ANG45 * (deathmatchstarts[i].angle / 45); + } + else + { + // FIXME?: DJS - this doesn't seem right... + destX = playerstarts[0].x << FRACBITS; + destY = playerstarts[0].y << FRACBITS; + destAngle = ANG45 * (playerstarts[0].angle / 45); + } + +# if __JHEXEN__ + P_Teleport(player->plr->mo, destX, destY, destAngle, true); + if(player->morphTics) + { // Teleporting away will undo any morph effects (pig) + P_UndoPlayerMorph(player); + } + //S_StartSound(NULL, sfx_wpnup); // Full volume laugh +# else + P_Teleport(player->plr->mo, destX, destY, destAngle); + /*S_StartSound(sfx_wpnup, NULL); // Full volume laugh + NetSv_Sound(NULL, sfx_wpnup, player-players); */ + S_StartSound(sfx_wpnup, NULL); +# endif +} +#endif diff --git a/doomsday/plugins/jhexen/src/st_stuff.c b/doomsday/plugins/jhexen/src/st_stuff.c index f8a896ddf5..9913c8498e 100644 --- a/doomsday/plugins/jhexen/src/st_stuff.c +++ b/doomsday/plugins/jhexen/src/st_stuff.c @@ -118,8 +118,6 @@ typedef struct Cheat_s { // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- -void M_ClearMenus(void); - // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- // Console commands for the HUD/Statusbar @@ -179,13 +177,16 @@ extern unsigned ShowKillsCount; extern int messageResponse; +extern boolean hu_showallfrags; // in hu_stuff.c currently + // PUBLIC DATA DECLARATIONS ------------------------------------------------ -int DebugSound; // Debug flag for displaying sound info -boolean inventory; int curpos; -int inv_ptr; -int ArtifactFlash; +int inventoryTics; +boolean inventory = false; + +int DebugSound; // Debug flag for displaying sound info +static int ArtifactFlash; // ST_Start() has just been called static boolean st_firsttime; @@ -199,9 +200,6 @@ static float showbar = 0.0f; // whether left-side main status bar is active static boolean st_statusbaron; -// main player in game -static player_t *plyr; - // used for timing static unsigned int st_clock; @@ -795,6 +793,9 @@ cvar_t hudCVars[] = // HUD displays {"hud-inventory-timer", 0, CVT_FLOAT, &cfg.inventoryTimer, 0, 30, "Seconds before the inventory auto-hides."}, + + {"hud-frags-all", 0, CVT_BYTE, &hu_showallfrags, 0, 1, + "Debug: HUD shows all frags of all players."}, {NULL} }; @@ -903,9 +904,9 @@ void ST_loadData(void) void ST_initData(void) { int i; + player_t *plyr = &players[consoleplayer]; st_firsttime = true; - plyr = &players[consoleplayer]; st_clock = 0; st_chatstate = StartChatState; @@ -927,6 +928,7 @@ void ST_initData(void) void ST_createWidgets(void) { int i, width, temp; + player_t *plyr = &players[consoleplayer]; // health num STlib_initNum(&w_health, ST_HEALTHX, ST_HEALTHY, PatchNumINumbers, @@ -1014,6 +1016,31 @@ void ST_Init(void) ST_loadData(); } +void ST_Inventory(boolean show) +{ + if(show) + { + inventory = true; + + inventoryTics = (int) (cfg.inventoryTimer * TICSPERSEC); + if(inventoryTics < 1) + inventoryTics = 1; + } + else + inventory = false; +} + +boolean ST_IsInventoryVisible(void) +{ + return inventory; +} + +void ST_InventoryFlashCurrent(player_t *player) +{ + if(player == &players[consoleplayer]) + ArtifactFlash = 4; +} + //========================================================================== // // SB_SetClassData @@ -1248,6 +1275,14 @@ void ST_Ticker(void) } HealthMarker += delta; } + + // turn inventory off after a certain amount of time + if(inventory && !(--inventoryTics)) + { + players[consoleplayer].readyArtifact = + players[consoleplayer].inventory[inv_ptr].type; + inventory = false; + } } //========================================================================== @@ -1967,7 +2002,7 @@ void ST_doPaletteStuff(boolean forceChange) { sb_palette = palette; // $democam - CPlayer->plr->filter = H2_GetFilterColor(palette); + CPlayer->plr->filter = R_GetFilterColor(palette); } } @@ -2097,6 +2132,7 @@ void ST_drawWidgets(boolean refresh) { int i; int x; + player_t *plyr = &players[consoleplayer]; oldhealth = -1; if(!inventory) @@ -2234,6 +2270,7 @@ void DrawKeyBar(void) //========================================================================== static void DrawWeaponPieces(void) { + player_t *plyr = &players[consoleplayer]; GL_DrawPatchLitAlpha(190, 162, 1, cfg.statusbarAlpha, PatchNumWEAPONSLOT.lump); @@ -3192,8 +3229,10 @@ DEFCC(CCmdCheatSuicide) DEFCC(CCmdCheatGive) { - int tellUsage = false; - int target = consoleplayer; + char buf[100]; + int i; + int weapNum; + player_t *plyr = &players[consoleplayer]; if(IS_CLIENT) { @@ -3209,35 +3248,69 @@ DEFCC(CCmdCheatGive) if(!canCheat()) return false; // Can't cheat! - // Check the arguments. + if(argc != 2 && argc != 3) + { + Con_Printf("Usage:\n give (stuff)\n"); + Con_Printf(" give (stuff) (player)\n"); + Con_Printf("Stuff consists of one or more of:\n"); + Con_Printf(" a - artifacts\n"); + Con_Printf(" h - health\n"); + Con_Printf(" k - keys\n"); + Con_Printf(" p - puzzle\n"); + Con_Printf(" w - weapons\n"); + Con_Printf(" 0-4 - weapon\n"); + return true; + } if(argc == 3) { - target = atoi(argv[2]); - if(target < 0 || target >= MAXPLAYERS || !players[target].plr->ingame) + i = atoi(argv[2]); + if(i < 0 || i >= MAXPLAYERS || !players[i].plr->ingame) return false; + plyr = &players[i]; } + strcpy(buf, argv[1]); // Stuff is the 2nd arg. + strlwr(buf); + for(i = 0; buf[i]; i++) + { + switch (buf[i]) + { + case 'a': + Con_Printf("Artifacts given.\n"); + CheatArtifactAllFunc(plyr, NULL); + break; - // Check the arguments. - if(argc != 2 && argc != 3) - tellUsage = true; - else if(!strnicmp(argv[1], "weapons", 1)) - CheatWeaponsFunc(players + target, NULL); - else if(!strnicmp(argv[1], "health", 1)) - CheatHealthFunc(players + target, NULL); - else if(!strnicmp(argv[1], "keys", 1)) - CheatKeysFunc(players + target, NULL); - else if(!strnicmp(argv[1], "artifacts", 1)) - CheatArtifactAllFunc(players + target, NULL); - else if(!strnicmp(argv[1], "puzzle", 1)) - CheatPuzzleFunc(players + target, NULL); - else - tellUsage = true; + case 'h': + Con_Printf("Health given.\n"); + CheatHealthFunc(plyr, NULL); + break; - if(tellUsage) - { - Con_Printf("Usage: give weapons/health/keys/artifacts/puzzle\n"); - Con_Printf("The first letter is enough, e.g. 'give h'.\n"); + case 'k': + Con_Printf("Keys given.\n"); + CheatKeysFunc(plyr, NULL); + break; + + case 'p': + Con_Printf("Puzzle parts given.\n"); + CheatPuzzleFunc(plyr, NULL); + break; + + case 'w': + Con_Printf("Weapons given.\n"); + CheatWeaponsFunc(plyr, NULL); + break; + + default: + // Individual Weapon + weapNum = ((int) buf[i]) - 48; + if(weapNum >= 0 && weapNum < NUMWEAPONS) + { + plyr->weaponowned[weapNum] = true; + } + else// Unrecognized + Con_Printf("What do you mean, '%c'?\n", buf[i]); + } } + return true; } diff --git a/doomsday/plugins/jhexen/src/sv_save.c b/doomsday/plugins/jhexen/src/sv_save.c index 9158de3b02..1676aa6c74 100644 --- a/doomsday/plugins/jhexen/src/sv_save.c +++ b/doomsday/plugins/jhexen/src/sv_save.c @@ -882,7 +882,7 @@ void ArchivePlayer(player_t *player) StreamOutLong(p->colormap); StreamOutBuffer(p->psprites, sizeof(p->psprites)); StreamOutLong(p->morphTics); - StreamOutLong(p->jumpTics); + StreamOutLong(p->jumptics); StreamOutLong(p->worldTimer); } @@ -942,7 +942,7 @@ void UnarchivePlayer(player_t *p) p->colormap = GET_LONG; GET_BUFFER(p->psprites); p->morphTics = GET_LONG; - p->jumpTics = GET_LONG; + p->jumptics = GET_LONG; p->worldTimer = GET_LONG; // Demangle it. @@ -1315,7 +1315,7 @@ static void SetMobjArchiveNums(void) mobj->archiveNum = MOBJ_NULL; } - for(thinker = gi.thinkercap->next; thinker != gi.thinkercap; + for(thinker = thinkercap.next; thinker != &thinkercap && thinker; thinker = thinker->next) { if(thinker->function == P_MobjThinker) @@ -1459,7 +1459,7 @@ static void ArchiveMobjs(void) StreamOutLong(ASEG_MOBJS); StreamOutLong(MobjCount); count = 0; - for(thinker = gi.thinkercap->next; thinker != gi.thinkercap; + for(thinker = thinkercap.next; thinker != &thinkercap && thinker; thinker = thinker->next) { if(thinker->function != P_MobjThinker) @@ -1770,7 +1770,7 @@ static void ArchiveThinkers(void) byte buffer[MAX_THINKER_SIZE]; StreamOutLong(ASEG_THINKERS); - for(thinker = gi.thinkercap->next; thinker != gi.thinkercap; + for(thinker = thinkercap.next; thinker != &thinkercap && thinker; thinker = thinker->next) { for(info = ThinkerInfo; info->tClass != TC_NULL; info++) @@ -2009,8 +2009,8 @@ static void RemoveAllThinkers(void) thinker_t *thinker; thinker_t *nextThinker; - thinker = gi.thinkercap->next; - while(thinker != gi.thinkercap) + thinker = thinkercap.next; + while(thinker != &thinkercap && thinker) { nextThinker = thinker->next; if(thinker->function == P_MobjThinker)