doom

a minimalistic implementation of doom
git clone git://ssnf.xyz/doom
Log | Files | Refs

commit 41ea012cacbf2bb674b8c0b9755df2f180efb72a
parent 2bc8e02677c424f2b8b4a194243008d53c2b3083
Author: ssnf <ssnf@ssnf.xyz>
Date:   Thu, 17 Jun 2021 02:24:18 +0000

delete non-lines

Diffstat:
Msrc/Makefile | 7-------
Msrc/am_map.c | 396-------------------------------------------------------------------------------
Msrc/am_map.h | 42------------------------------------------
Msrc/d_englsh.h | 179-------------------------------------------------------------------------------
Msrc/d_event.h | 72------------------------------------------------------------------------
Msrc/d_french.h | 124-------------------------------------------------------------------------------
Msrc/d_items.c | 56--------------------------------------------------------
Msrc/d_items.h | 35-----------------------------------
Msrc/d_main.c | 361-------------------------------------------------------------------------------
Msrc/d_main.h | 48------------------------------------------------
Msrc/d_net.c | 237-------------------------------------------------------------------------------
Msrc/d_net.h | 101-------------------------------------------------------------------------------
Msrc/d_player.h | 135-------------------------------------------------------------------------------
Msrc/d_textur.h | 41-----------------------------------------
Msrc/d_think.h | 57---------------------------------------------------------
Msrc/d_ticcmd.h | 37-------------------------------------
Msrc/doomdata.h | 129-------------------------------------------------------------------------------
Msrc/doomdef.c | 32--------------------------------
Msrc/doomdef.h | 204-------------------------------------------------------------------------------
Msrc/doomstat.c | 1-
Msrc/doomstat.h | 213-------------------------------------------------------------------------------
Msrc/doomtype.h | 3---
Msrc/dstrings.c | 1-
Msrc/dstrings.h | 53-----------------------------------------------------
Msrc/f_finale.c | 199-------------------------------------------------------------------------------
Msrc/f_finale.h | 44--------------------------------------------
Msrc/f_wipe.c | 83-------------------------------------------------------------------------------
Msrc/f_wipe.h | 42------------------------------------------
Msrc/g_game.c | 476-------------------------------------------------------------------------------
Msrc/g_game.h | 56--------------------------------------------------------
Msrc/hu_lib.c | 100-------------------------------------------------------------------------------
Msrc/hu_lib.h | 117-------------------------------------------------------------------------------
Msrc/hu_stuff.c | 148-------------------------------------------------------------------------------
Msrc/hu_stuff.h | 45---------------------------------------------
Msrc/i_main.c | 30------------------------------
Msrc/i_net.c | 119-------------------------------------------------------------------------------
Msrc/i_net.h | 37-------------------------------------
Msrc/i_sound.c | 515-------------------------------------------------------------------------------
Msrc/i_sound.h | 78------------------------------------------------------------------------------
Msrc/i_system.c | 76----------------------------------------------------------------------------
Msrc/i_system.h | 79-------------------------------------------------------------------------------
Msrc/i_video.c | 291------------------------------------------------------------------------------
Msrc/i_video.h | 47-----------------------------------------------
Msrc/info.c | 175-------------------------------------------------------------------------------
Msrc/info.h | 45---------------------------------------------
Msrc/m_argv.c | 41-----------------------------------------
Msrc/m_argv.h | 36------------------------------------
Msrc/m_bbox.c | 38--------------------------------------
Msrc/m_bbox.h | 37-------------------------------------
Msrc/m_cheat.c | 49-------------------------------------------------
Msrc/m_cheat.h | 39---------------------------------------
Msrc/m_fixed.c | 46----------------------------------------------
Msrc/m_fixed.h | 39---------------------------------------
Msrc/m_menu.c | 547-------------------------------------------------------------------------------
Msrc/m_menu.h | 58----------------------------------------------------------
Msrc/m_misc.c | 179-------------------------------------------------------------------------------
Msrc/m_misc.h | 43-------------------------------------------
Msrc/m_random.c | 38--------------------------------------
Msrc/m_random.h | 40----------------------------------------
Msrc/m_swap.c | 37-------------------------------------
Msrc/m_swap.h | 37-------------------------------------
Msrc/p_ceilng.c | 103-------------------------------------------------------------------------------
Msrc/p_doors.c | 194-------------------------------------------------------------------------------
Msrc/p_enemy.c | 666+------------------------------------------------------------------------------
Msrc/p_floor.c | 122-------------------------------------------------------------------------------
Msrc/p_inter.c | 278-------------------------------------------------------------------------------
Msrc/p_inter.h | 34----------------------------------
Msrc/p_lights.c | 154-------------------------------------------------------------------------------
Msrc/p_local.h | 140-------------------------------------------------------------------------------
Msrc/p_map.c | 572-------------------------------------------------------------------------------
Msrc/p_maputl.c | 311-------------------------------------------------------------------------------
Msrc/p_mobj.c | 357-------------------------------------------------------------------------------
Msrc/p_mobj.h | 215-------------------------------------------------------------------------------
Msrc/p_plats.c | 92-------------------------------------------------------------------------------
Msrc/p_pspr.c | 352-------------------------------------------------------------------------------
Msrc/p_pspr.h | 58----------------------------------------------------------
Msrc/p_saveg.c | 171-------------------------------------------------------------------------------
Msrc/p_saveg.h | 36------------------------------------
Msrc/p_setup.c | 251-------------------------------------------------------------------------------
Msrc/p_setup.h | 35-----------------------------------
Msrc/p_sight.c | 147-------------------------------------------------------------------------------
Msrc/p_spec.c | 517-------------------------------------------------------------------------------
Msrc/p_spec.h | 265-------------------------------------------------------------------------------
Msrc/p_switch.c | 229-------------------------------------------------------------------------------
Msrc/p_telept.c | 63---------------------------------------------------------------
Msrc/p_tick.c | 93-------------------------------------------------------------------------------
Msrc/p_tick.h | 37-------------------------------------
Msrc/p_user.c | 165-------------------------------------------------------------------------------
Msrc/r_bsp.c | 249-------------------------------------------------------------------------------
Msrc/r_bsp.h | 46----------------------------------------------
Msrc/r_data.c | 337-------------------------------------------------------------------------------
Msrc/r_data.h | 45---------------------------------------------
Msrc/r_defs.h | 311-------------------------------------------------------------------------------
Msrc/r_draw.c | 374-------------------------------------------------------------------------------
Msrc/r_draw.h | 72------------------------------------------------------------------------
Msrc/r_local.h | 40----------------------------------------
Msrc/r_main.c | 347-------------------------------------------------------------------------------
Msrc/r_main.h | 96-------------------------------------------------------------------------------
Msrc/r_plane.c | 174-------------------------------------------------------------------------------
Msrc/r_plane.h | 47-----------------------------------------------
Msrc/r_segs.c | 242-------------------------------------------------------------------------------
Msrc/r_segs.h | 33---------------------------------
Msrc/r_sky.c | 47-----------------------------------------------
Msrc/r_sky.h | 37-------------------------------------
Msrc/r_state.h | 86-------------------------------------------------------------------------------
Msrc/r_things.c | 382-------------------------------------------------------------------------------
Msrc/r_things.h | 45---------------------------------------------
Msrc/s_sound.c | 348-------------------------------------------------------------------------------
Msrc/s_sound.h | 77-----------------------------------------------------------------------------
Msrc/sounds.c | 41-----------------------------------------
Msrc/sounds.h | 87-------------------------------------------------------------------------------
Msrc/st_lib.c | 105-------------------------------------------------------------------------------
Msrc/st_lib.h | 133-------------------------------------------------------------------------------
Msrc/st_stuff.c | 539-------------------------------------------------------------------------------
Msrc/st_stuff.h | 61-------------------------------------------------------------
Msrc/tables.c | 58----------------------------------------------------------
Msrc/tables.h | 72------------------------------------------------------------------------
Msrc/v_video.c | 138-------------------------------------------------------------------------------
Msrc/v_video.h | 63---------------------------------------------------------------
Msrc/w_wad.c | 254-------------------------------------------------------------------------------
Msrc/w_wad.h | 53-----------------------------------------------------
Msrc/wi_stuff.c | 618-------------------------------------------------------------------------------
Msrc/wi_stuff.h | 41-----------------------------------------
Msrc/z_zone.c | 211-------------------------------------------------------------------------------
Msrc/z_zone.h | 50--------------------------------------------------
125 files changed, 1 insertion(+), 18285 deletions(-)

diff --git a/src/Makefile b/src/Makefile @@ -2,7 +2,6 @@ CC = c89 CFLAGS = -g -Wall -Wpedantic -D_DEFAULT_SOURCE -Wno-deprecated-declarations LIBS = -lXext -lX11 -lnsl -lm LDFLAGS = ${LIBS} -L/usr/X11R6/lib - SRC = doomstat.c \ dstrings.c \ i_system.c \ @@ -64,17 +63,11 @@ SRC = doomstat.c \ info.c \ lang.c \ sounds.c - - OBJ = ${SRC:.c=.o} - all: doom - clean: rm -f *.o doom - doom: ${OBJ} ${CC} ${CFLAGS} ${LDFLAGS} ${OBJ} -o $@ - %.o: %.c ${CC} ${CFLAGS} -c $< -o $@ diff --git a/src/am_map.c b/src/am_map.c @@ -1,53 +1,16 @@ - - - - - - - - - - - - - - - - - - - - - - - - #include <stdio.h> - - #include "z_zone.h" #include "doomdef.h" #include "st_stuff.h" #include "p_local.h" #include "w_wad.h" - #include "m_cheat.h" #include "i_system.h" - - #include "v_video.h" - - #include "doomstat.h" #include "r_state.h" - - #include "dstrings.h" - #include "am_map.h" - - - #define REDS (256-5*16) #define REDRANGE 16 #define BLUES (256-4*16+8) @@ -62,8 +25,6 @@ #define YELLOWRANGE 1 #define BLACK 0 #define WHITE (256-47) - - #define BACKGROUND BLACK #define YOURCOLORS WHITE #define YOURRANGE 0 @@ -82,10 +43,7 @@ #define GRIDCOLORS (GRAYS + GRAYSRANGE/2) #define GRIDRANGE 0 #define XHAIRCOLORS GRAYS - - #define FB 0 - #define AM_PANDOWNKEY KEY_DOWNARROW #define AM_PANUPKEY KEY_UPARROW #define AM_PANRIGHTKEY KEY_RIGHTARROW @@ -99,63 +57,36 @@ #define AM_GRIDKEY 'g' #define AM_MARKKEY 'm' #define AM_CLEARMARKKEY 'c' - #define AM_NUMMARKPOINTS 10 - - #define INITSCALEMTOF (.2*FRACUNIT) - - #define F_PANINC 4 - - #define M_ZOOMIN ((int) (1.02*FRACUNIT)) - - #define M_ZOOMOUT ((int) (FRACUNIT/1.02)) - - #define FTOM(x) FixedMul(((x)<<16),scale_ftom) #define MTOF(x) (FixedMul((x),scale_mtof)>>16) - #define CXMTOF(x) (f_x + MTOF((x)-m_x)) #define CYMTOF(y) (f_y + (f_h - MTOF((y)-m_y))) - - #define LINE_NEVERSEE ML_DONTDRAW - typedef struct { int x, y; } fpoint_t; - typedef struct { fpoint_t a, b; } fline_t; - typedef struct { fixed_t x,y; } mpoint_t; - typedef struct { mpoint_t a, b; } mline_t; - typedef struct { fixed_t slp, islp; } islope_t; - - - - - - - - #define R ((8*PLAYERRADIUS)/7) mline_t player_arrow[] = { { { -R+R/8, 0 }, { R, 0 } }, @@ -168,7 +99,6 @@ mline_t player_arrow[] = { }; #undef R #define NUMPLYRLINES (sizeof(player_arrow)/sizeof(mline_t)) - #define R ((8*PLAYERRADIUS)/7) mline_t cheat_player_arrow[] = { { { -R+R/8, 0 }, { R, 0 } }, @@ -190,7 +120,6 @@ mline_t cheat_player_arrow[] = { }; #undef R #define NUMCHEATPLYRLINES (sizeof(cheat_player_arrow)/sizeof(mline_t)) - #define R (FRACUNIT) mline_t triangle_guy[] = { { { -.867*R, -.5*R }, { .867*R, -.5*R } }, @@ -199,7 +128,6 @@ mline_t triangle_guy[] = { }; #undef R #define NUMTRIANGLEGUYLINES (sizeof(triangle_guy)/sizeof(mline_t)) - #define R (FRACUNIT) mline_t thintriangle_guy[] = { { { -.5*R, -.7*R }, { R, 0 } }, @@ -208,121 +136,69 @@ mline_t thintriangle_guy[] = { }; #undef R #define NUMTHINTRIANGLEGUYLINES (sizeof(thintriangle_guy)/sizeof(mline_t)) - - - - static int cheating = 0; static int grid = 0; - static int leveljuststarted = 1; - boolean automapactive = false; static int finit_width = SCREENWIDTH; static int finit_height = SCREENHEIGHT - 32; - - static int f_x; static int f_y; - - static int f_w; static int f_h; - static int lightlev; static byte* fb; static int amclock; - static mpoint_t m_paninc; static fixed_t mtof_zoommul; static fixed_t ftom_zoommul; - static fixed_t m_x, m_y; static fixed_t m_x2, m_y2; - - - - static fixed_t m_w; static fixed_t m_h; - - static fixed_t min_x; static fixed_t min_y; static fixed_t max_x; static fixed_t max_y; - static fixed_t max_w; static fixed_t max_h; - - static fixed_t min_w; static fixed_t min_h; - - static fixed_t min_scale_mtof; static fixed_t max_scale_mtof; - - static fixed_t old_m_w, old_m_h; static fixed_t old_m_x, old_m_y; - - static mpoint_t f_oldloc; - - static fixed_t scale_mtof = INITSCALEMTOF; - static fixed_t scale_ftom; - static player_t *plr; - static patch_t *marknums[10]; static mpoint_t markpoints[AM_NUMMARKPOINTS]; static int markpointnum = 0; - static int followplayer = 1; - static unsigned char cheat_amap_seq[] = { 0xb2, 0x26, 0x26, 0x2e, 0xff }; static cheatseq_t cheat_amap = { cheat_amap_seq, 0 }; - static boolean stopped = true; - extern boolean viewactive; - - - - void V_MarkRect ( int x, int y, int width, int height ); - - - - - void AM_getIslope ( mline_t* ml, islope_t* is ) { int dx, dy; - dy = ml->a.y - ml->b.y; dx = ml->b.x - ml->a.x; if (!dy) is->islp = (dx<0?-MAXINT:MAXINT); else is->islp = FixedDiv(dx, dy); if (!dx) is->slp = (dy<0?-MAXINT:MAXINT); else is->slp = FixedDiv(dy, dx); - } - - - - void AM_activateNewScale(void) { m_x += m_w/2; @@ -334,10 +210,6 @@ void AM_activateNewScale(void) m_x2 = m_x + m_w; m_y2 = m_y + m_h; } - - - - void AM_saveScaleAndLoc(void) { old_m_x = m_x; @@ -345,13 +217,8 @@ void AM_saveScaleAndLoc(void) old_m_w = m_w; old_m_h = m_h; } - - - - void AM_restoreScaleAndLoc(void) { - m_w = old_m_w; m_h = old_m_h; if (!followplayer) @@ -364,67 +231,42 @@ void AM_restoreScaleAndLoc(void) } m_x2 = m_x + m_w; m_y2 = m_y + m_h; - - scale_mtof = FixedDiv(f_w<<FRACBITS, m_w); scale_ftom = FixedDiv(FRACUNIT, scale_mtof); } - - - - void AM_addMark(void) { markpoints[markpointnum].x = m_x + m_w/2; markpoints[markpointnum].y = m_y + m_h/2; markpointnum = (markpointnum + 1) % AM_NUMMARKPOINTS; - } - - - - - void AM_findMinMaxBoundaries(void) { int i; fixed_t a; fixed_t b; - min_x = min_y = MAXINT; max_x = max_y = -MAXINT; - for (i=0;i<numvertexes;i++) { if (vertexes[i].x < min_x) min_x = vertexes[i].x; else if (vertexes[i].x > max_x) max_x = vertexes[i].x; - if (vertexes[i].y < min_y) min_y = vertexes[i].y; else if (vertexes[i].y > max_y) max_y = vertexes[i].y; } - max_w = max_x - min_x; max_h = max_y - min_y; - min_w = 2*PLAYERRADIUS; min_h = 2*PLAYERRADIUS; - a = FixedDiv(f_w<<FRACBITS, max_w); b = FixedDiv(f_h<<FRACBITS, max_h); - min_scale_mtof = a < b ? a : b; max_scale_mtof = FixedDiv(f_h<<FRACBITS, 2*PLAYERRADIUS); - } - - - - - void AM_changeWindowLoc(void) { if (m_paninc.x || m_paninc.y) @@ -432,147 +274,94 @@ void AM_changeWindowLoc(void) followplayer = 0; f_oldloc.x = MAXINT; } - m_x += m_paninc.x; m_y += m_paninc.y; - if (m_x + m_w/2 > max_x) m_x = max_x - m_w/2; else if (m_x + m_w/2 < min_x) m_x = min_x - m_w/2; - if (m_y + m_h/2 > max_y) m_y = max_y - m_h/2; else if (m_y + m_h/2 < min_y) m_y = min_y - m_h/2; - m_x2 = m_x + m_w; m_y2 = m_y + m_h; } - - - - - void AM_initVariables(void) { int pnum; static event_t st_notify = { ev_keyup, AM_MSGENTERED }; - automapactive = true; fb = screens[0]; - f_oldloc.x = MAXINT; amclock = 0; lightlev = 0; - m_paninc.x = m_paninc.y = 0; ftom_zoommul = FRACUNIT; mtof_zoommul = FRACUNIT; - m_w = FTOM(f_w); m_h = FTOM(f_h); - - if (!playeringame[pnum = consoleplayer]) for (pnum=0;pnum<MAXPLAYERS;pnum++) if (playeringame[pnum]) break; - plr = &players[pnum]; m_x = plr->mo->x - m_w/2; m_y = plr->mo->y - m_h/2; AM_changeWindowLoc(); - - old_m_x = m_x; old_m_y = m_y; old_m_w = m_w; old_m_h = m_h; - - ST_Responder(&st_notify); - } - - - - void AM_loadPics(void) { int i; char namebuf[9]; - for (i=0;i<10;i++) { sprintf(namebuf, "AMMNUM%d", i); marknums[i] = W_CacheLumpName(namebuf, PU_STATIC); } - } - void AM_unloadPics(void) { int i; - for (i=0;i<10;i++) Z_ChangeTag(marknums[i], PU_CACHE); - } - void AM_clearMarks(void) { int i; - for (i=0;i<AM_NUMMARKPOINTS;i++) markpoints[i].x = -1; markpointnum = 0; } - - - - - void AM_LevelInit(void) { leveljuststarted = 0; - f_x = f_y = 0; f_w = finit_width; f_h = finit_height; - AM_clearMarks(); - AM_findMinMaxBoundaries(); scale_mtof = FixedDiv(min_scale_mtof, (int) (0.7*FRACUNIT)); if (scale_mtof > max_scale_mtof) scale_mtof = min_scale_mtof; scale_ftom = FixedDiv(FRACUNIT, scale_mtof); } - - - - - - - void AM_Stop (void) { static event_t st_notify = { 0, ev_keyup, AM_MSGEXITED }; - AM_unloadPics(); automapactive = false; ST_Responder(&st_notify); stopped = true; } - - - - void AM_Start (void) { static int lastlevel = -1, lastepisode = -1; - if (!stopped) AM_Stop(); stopped = false; if (lastlevel != gamemap || lastepisode != gameepisode) @@ -584,43 +373,27 @@ void AM_Start (void) AM_initVariables(); AM_loadPics(); } - - - - void AM_minOutWindowScale(void) { scale_mtof = min_scale_mtof; scale_ftom = FixedDiv(FRACUNIT, scale_mtof); AM_activateNewScale(); } - - - - void AM_maxOutWindowScale(void) { scale_mtof = max_scale_mtof; scale_ftom = FixedDiv(FRACUNIT, scale_mtof); AM_activateNewScale(); } - - - - - boolean AM_Responder ( event_t* ev ) { - int rc; static int cheatstate=0; static int bigstate=0; static char buffer[20]; - rc = false; - if (!automapactive) { if (ev->type == ev_keydown && ev->data1 == AM_STARTKEY) @@ -630,10 +403,8 @@ AM_Responder rc = true; } } - else if (ev->type == ev_keydown) { - rc = true; switch(ev->data1) { @@ -703,7 +474,6 @@ AM_Responder cheating = (cheating+1) % 3; } } - else if (ev->type == ev_keyup) { rc = false; @@ -728,22 +498,12 @@ AM_Responder break; } } - return rc; - } - - - - - void AM_changeWindowScale(void) { - - scale_mtof = FixedMul(scale_mtof, mtof_zoommul); scale_ftom = FixedDiv(FRACUNIT, scale_mtof); - if (scale_mtof < min_scale_mtof) AM_minOutWindowScale(); else if (scale_mtof > max_scale_mtof) @@ -751,14 +511,8 @@ void AM_changeWindowScale(void) else AM_activateNewScale(); } - - - - - void AM_doFollowPlayer(void) { - if (f_oldloc.x != plr->mo->x || f_oldloc.y != plr->mo->y) { m_x = FTOM(MTOF(plr->mo->x)) - m_w/2; @@ -767,81 +521,36 @@ void AM_doFollowPlayer(void) m_y2 = m_y + m_h; f_oldloc.x = plr->mo->x; f_oldloc.y = plr->mo->y; - - - - - - } - } - - - - void AM_updateLightLev(void) { static nexttic = 0; - static int litelevels[] = { 0, 4, 7, 10, 12, 14, 15, 15 }; static int litelevelscnt = 0; - - if (amclock>nexttic) { lightlev = litelevels[litelevelscnt++]; if (litelevelscnt == sizeof(litelevels)/sizeof(int)) litelevelscnt = 0; nexttic = amclock + 6 - (amclock % 6); } - } - - - - - void AM_Ticker (void) { - if (!automapactive) return; - amclock++; - if (followplayer) AM_doFollowPlayer(); - - if (ftom_zoommul != FRACUNIT) AM_changeWindowScale(); - - if (m_paninc.x || m_paninc.y) AM_changeWindowLoc(); - - - - } - - - - - void AM_clearFB(int color) { memset(fb, color, f_w*f_h); } - - - - - - - - - boolean AM_clipMline ( mline_t* ml, @@ -854,73 +563,52 @@ AM_clipMline BOTTOM =4, TOP =8 }; - register outcode1 = 0; register outcode2 = 0; register outside; - fpoint_t tmp; int dx; int dy; - - #define DOOUTCODE(oc, mx, my) \ (oc) = 0; \ if ((my) < 0) (oc) |= TOP; \ else if ((my) >= f_h) (oc) |= BOTTOM; \ if ((mx) < 0) (oc) |= LEFT; \ else if ((mx) >= f_w) (oc) |= RIGHT; - - - if (ml->a.y > m_y2) outcode1 = TOP; else if (ml->a.y < m_y) outcode1 = BOTTOM; - if (ml->b.y > m_y2) outcode2 = TOP; else if (ml->b.y < m_y) outcode2 = BOTTOM; - if (outcode1 & outcode2) return false; - if (ml->a.x < m_x) outcode1 |= LEFT; else if (ml->a.x > m_x2) outcode1 |= RIGHT; - if (ml->b.x < m_x) outcode2 |= LEFT; else if (ml->b.x > m_x2) outcode2 |= RIGHT; - if (outcode1 & outcode2) return false; - - fl->a.x = CXMTOF(ml->a.x); fl->a.y = CYMTOF(ml->a.y); fl->b.x = CXMTOF(ml->b.x); fl->b.y = CYMTOF(ml->b.y); - DOOUTCODE(outcode1, fl->a.x, fl->a.y); DOOUTCODE(outcode2, fl->b.x, fl->b.y); - if (outcode1 & outcode2) return false; - while (outcode1 | outcode2) { - - if (outcode1) outside = outcode1; else outside = outcode2; - - if (outside & TOP) { dy = fl->a.y - fl->b.y; @@ -949,7 +637,6 @@ AM_clipMline tmp.y = fl->a.y + (dy*(-fl->a.x))/dx; tmp.x = 0; } - if (outside == outcode1) { fl->a = tmp; @@ -960,19 +647,12 @@ AM_clipMline fl->b = tmp; DOOUTCODE(outcode2, fl->b.x, fl->b.y); } - if (outcode1 & outcode2) return false; } - return true; } #undef DOOUTCODE - - - - - void AM_drawFline ( fline_t* fl, @@ -987,10 +667,7 @@ AM_drawFline register int ax; register int ay; register int d; - static fuck = 0; - - if ( fl->a.x < 0 || fl->a.x >= f_w || fl->a.y < 0 || fl->a.y >= f_h || fl->b.x < 0 || fl->b.x >= f_w @@ -999,20 +676,15 @@ AM_drawFline fprintf(stderr, "fuck %d \r", fuck++); return; } - #define PUTDOT(xx,yy,cc) fb[(yy)*f_w+(xx)]=(cc) - dx = fl->b.x - fl->a.x; ax = 2 * (dx<0 ? -dx : dx); sx = dx<0 ? -1 : 1; - dy = fl->b.y - fl->a.y; ay = 2 * (dy<0 ? -dy : dy); sy = dy<0 ? -1 : 1; - x = fl->a.x; y = fl->a.y; - if (ax > ay) { d = ay - ax/2; @@ -1046,41 +718,25 @@ AM_drawFline } } } - - - - - void AM_drawMline ( mline_t* ml, int color ) { static fline_t fl; - if (AM_clipMline(ml, &fl)) AM_drawFline(&fl, color); } - - - - - - void AM_drawGrid(int color) { fixed_t x, y; fixed_t start, end; mline_t ml; - - start = m_x; if ((start-bmaporgx)%(MAPBLOCKUNITS<<FRACBITS)) start += (MAPBLOCKUNITS<<FRACBITS) - ((start-bmaporgx)%(MAPBLOCKUNITS<<FRACBITS)); end = m_x + m_w; - - ml.a.y = m_y; ml.b.y = m_y+m_h; for (x=start; x<end; x+=(MAPBLOCKUNITS<<FRACBITS)) @@ -1089,15 +745,11 @@ void AM_drawGrid(int color) ml.b.x = x; AM_drawMline(&ml, color); } - - start = m_y; if ((start-bmaporgy)%(MAPBLOCKUNITS<<FRACBITS)) start += (MAPBLOCKUNITS<<FRACBITS) - ((start-bmaporgy)%(MAPBLOCKUNITS<<FRACBITS)); end = m_y + m_h; - - ml.a.x = m_x; ml.b.x = m_x + m_w; for (y=start; y<end; y+=(MAPBLOCKUNITS<<FRACBITS)) @@ -1106,18 +758,11 @@ void AM_drawGrid(int color) ml.b.y = y; AM_drawMline(&ml, color); } - } - - - - - void AM_drawWalls(void) { int i; static mline_t l; - for (i=0;i<numlines;i++) { l.a.x = lines[i].v1->x; @@ -1162,12 +807,6 @@ void AM_drawWalls(void) } } } - - - - - - void AM_rotate ( fixed_t* x, @@ -1175,18 +814,14 @@ AM_rotate angle_t a ) { fixed_t tmpx; - tmpx = FixedMul(*x,finecosine[a>>ANGLETOFINESHIFT]) - FixedMul(*y,finesine[a>>ANGLETOFINESHIFT]); - *y = FixedMul(*x,finesine[a>>ANGLETOFINESHIFT]) + FixedMul(*y,finecosine[a>>ANGLETOFINESHIFT]); - *x = tmpx; } - void AM_drawLineCharacter ( mline_t* lineguy, @@ -1199,43 +834,33 @@ AM_drawLineCharacter { int i; mline_t l; - for (i=0;i<lineguylines;i++) { l.a.x = lineguy[i].a.x; l.a.y = lineguy[i].a.y; - if (scale) { l.a.x = FixedMul(scale, l.a.x); l.a.y = FixedMul(scale, l.a.y); } - if (angle) AM_rotate(&l.a.x, &l.a.y, angle); - l.a.x += x; l.a.y += y; - l.b.x = lineguy[i].b.x; l.b.y = lineguy[i].b.y; - if (scale) { l.b.x = FixedMul(scale, l.b.x); l.b.y = FixedMul(scale, l.b.y); } - if (angle) AM_rotate(&l.b.x, &l.b.y, angle); - l.b.x += x; l.b.y += y; - AM_drawMline(&l, color); } } - void AM_drawPlayers(void) { int i; @@ -1243,7 +868,6 @@ void AM_drawPlayers(void) static int their_colors[] = { GREENS, GRAYS, BROWNS, REDS }; int their_color = -1; int color; - if (!netgame) { if (cheating) @@ -1256,30 +880,23 @@ void AM_drawPlayers(void) WHITE, plr->mo->x, plr->mo->y); return; } - for (i=0;i<MAXPLAYERS;i++) { their_color++; p = &players[i]; - if ( (deathmatch && !singledemo) && p != plr) continue; - if (!playeringame[i]) continue; - if (p->powers[pw_invisibility]) color = 246; else color = their_colors[their_color]; - AM_drawLineCharacter (player_arrow, NUMPLYRLINES, 0, p->mo->angle, color, p->mo->x, p->mo->y); } - } - void AM_drawThings ( int colors, @@ -1287,7 +904,6 @@ AM_drawThings { int i; mobj_t* t; - for (i=0;i<numsectors;i++) { t = sectors[i].thinglist; @@ -1300,17 +916,13 @@ AM_drawThings } } } - void AM_drawMarks(void) { int i, fx, fy, w, h; - for (i=0;i<AM_NUMMARKPOINTS;i++) { if (markpoints[i].x != -1) { - - w = 5; h = 6; fx = CXMTOF(markpoints[i].x); @@ -1319,19 +931,14 @@ void AM_drawMarks(void) V_DrawPatch(fx, fy, FB, marknums[i]); } } - } - void AM_drawCrosshair(int color) { fb[(f_w*(f_h+1))/2] = color; - } - void AM_Drawer (void) { if (!automapactive) return; - AM_clearFB(BACKGROUND); if (grid) AM_drawGrid(GRIDCOLORS); @@ -1340,9 +947,6 @@ void AM_Drawer (void) if (cheating==2) AM_drawThings(THINGCOLORS, THINGRANGE); AM_drawCrosshair(XHAIRCOLORS); - AM_drawMarks(); - V_MarkRect(f_x, f_y, f_w, f_h); - } diff --git a/src/am_map.h b/src/am_map.h @@ -1,52 +1,10 @@ - - - - - - - - - - - - - - - - - - - - - #ifndef __AMMAP_H__ #define __AMMAP_H__ - - #define AM_MSGHEADER (('a'<<24)+('m'<<16)) #define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8)) #define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8)) - - - boolean AM_Responder (event_t* ev); - - void AM_Ticker (void); - - - void AM_Drawer (void); - - - void AM_Stop (void); - - - #endif - - - - - diff --git a/src/d_englsh.h b/src/d_englsh.h @@ -1,41 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __D_ENGLSH__ #define __D_ENGLSH__ - - - - - - - - #define D_DEVSTR "Development mode ON.\n" #define D_CDROM "CD-ROM Version: default.cfg from c:\\doomdata\n" - - - - #define PRESSKEY "press a key." #define PRESSYN "press y or n." #define QUITMSG "are you sure you want to\nquit this great game?" @@ -45,26 +11,20 @@ #define SAVEDEAD "you can't save if you aren't playing!\n\n"PRESSKEY #define QSPROMPT "quicksave over your game named\n\n'%s'?\n\n"PRESSYN #define QLPROMPT "do you want to quickload the game named\n\n'%s'?\n\n"PRESSYN - #define NEWGAME \ "you can't start a new game\n"\ "while in a network game.\n\n"PRESSKEY - #define NIGHTMARE \ "are you sure? this skill level\n"\ "isn't even remotely fair.\n\n"PRESSYN - #define SWSTRING \ "this is the shareware version of doom.\n\n"\ "you need to order the entire trilogy.\n\n"PRESSKEY - #define MSGOFF "Messages OFF" #define MSGON "Messages ON" #define NETEND "you can't end a netgame!\n\n"PRESSKEY #define ENDGAME "are you sure you want to end the game?\n\n"PRESSYN - #define DOSY "(press y to quit)" - #define DETAILHI "High detail" #define DETAILLO "Low detail" #define GAMMALVL0 "Gamma correction OFF" @@ -73,10 +33,6 @@ #define GAMMALVL3 "Gamma correction level 3" #define GAMMALVL4 "Gamma correction level 4" #define EMPTYSTRING "empty slot" - - - - #define GOTARMOR "Picked up the armor." #define GOTMEGA "Picked up the MegaArmor!" #define GOTHTHBONUS "Picked up a health bonus." @@ -85,14 +41,12 @@ #define GOTMEDINEED "Picked up a medikit that you REALLY need!" #define GOTMEDIKIT "Picked up a medikit." #define GOTSUPER "Supercharge!" - #define GOTBLUECARD "Picked up a blue keycard." #define GOTYELWCARD "Picked up a yellow keycard." #define GOTREDCARD "Picked up a red keycard." #define GOTBLUESKUL "Picked up a blue skull key." #define GOTYELWSKUL "Picked up a yellow skull key." #define GOTREDSKULL "Picked up a red skull key." - #define GOTINVUL "Invulnerability!" #define GOTBERSERK "Berserk!" #define GOTINVIS "Partial Invisibility" @@ -100,7 +54,6 @@ #define GOTMAP "Computer Area Map" #define GOTVISOR "Light Amplification Visor" #define GOTMSPHERE "MegaSphere!" - #define GOTCLIP "Picked up a clip." #define GOTCLIPBOX "Picked up a box of bullets." #define GOTROCKET "Picked up a rocket." @@ -110,7 +63,6 @@ #define GOTSHELLS "Picked up 4 shotgun shells." #define GOTSHELLBOX "Picked up a box of shotgun shells." #define GOTBACKPACK "Picked up a backpack full of ammo!" - #define GOTBFG9000 "You got the BFG9000! Oh, yes." #define GOTCHAINGUN "You got the chaingun!" #define GOTCHAINSAW "A chainsaw! Find some meat!" @@ -118,27 +70,14 @@ #define GOTPLASMA "You got the plasma gun!" #define GOTSHOTGUN "You got the shotgun!" #define GOTSHOTGUN2 "You got the super shotgun!" - - - - #define PD_BLUEO "You need a blue key to activate this object" #define PD_REDO "You need a red key to activate this object" #define PD_YELLOWO "You need a yellow key to activate this object" #define PD_BLUEK "You need a blue key to open this door" #define PD_REDK "You need a red key to open this door" #define PD_YELLOWK "You need a yellow key to open this door" - - - - #define GGSAVED "game saved." - - - - #define HUSTR_MSGU "[Message unsent]" - #define HUSTR_E1M1 "E1M1: Hangar" #define HUSTR_E1M2 "E1M2: Nuclear Plant" #define HUSTR_E1M3 "E1M3: Toxin Refinery" @@ -148,7 +87,6 @@ #define HUSTR_E1M7 "E1M7: Computer Station" #define HUSTR_E1M8 "E1M8: Phobos Anomaly" #define HUSTR_E1M9 "E1M9: Military Base" - #define HUSTR_E2M1 "E2M1: Deimos Anomaly" #define HUSTR_E2M2 "E2M2: Containment Area" #define HUSTR_E2M3 "E2M3: Refinery" @@ -158,7 +96,6 @@ #define HUSTR_E2M7 "E2M7: Spawning Vats" #define HUSTR_E2M8 "E2M8: Tower of Babel" #define HUSTR_E2M9 "E2M9: Fortress of Mystery" - #define HUSTR_E3M1 "E3M1: Hell Keep" #define HUSTR_E3M2 "E3M2: Slough of Despair" #define HUSTR_E3M3 "E3M3: Pandemonium" @@ -168,7 +105,6 @@ #define HUSTR_E3M7 "E3M7: Limbo" #define HUSTR_E3M8 "E3M8: Dis" #define HUSTR_E3M9 "E3M9: Warrens" - #define HUSTR_E4M1 "E4M1: Hell Beneath" #define HUSTR_E4M2 "E4M2: Perfect Hatred" #define HUSTR_E4M3 "E4M3: Sever The Wicked" @@ -178,7 +114,6 @@ #define HUSTR_E4M7 "E4M7: And Hell Followed" #define HUSTR_E4M8 "E4M8: Unto The Cruel" #define HUSTR_E4M9 "E4M9: Fear" - #define HUSTR_1 "level 1: entryway" #define HUSTR_2 "level 2: underhalls" #define HUSTR_3 "level 3: the gantlet" @@ -190,7 +125,6 @@ #define HUSTR_9 "level 9: the pit" #define HUSTR_10 "level 10: refueling base" #define HUSTR_11 "level 11: 'o' of destruction!" - #define HUSTR_12 "level 12: the factory" #define HUSTR_13 "level 13: downtown" #define HUSTR_14 "level 14: the inmost dens" @@ -200,7 +134,6 @@ #define HUSTR_18 "level 18: the courtyard" #define HUSTR_19 "level 19: the citadel" #define HUSTR_20 "level 20: gotcha!" - #define HUSTR_21 "level 21: nirvana" #define HUSTR_22 "level 22: the catacombs" #define HUSTR_23 "level 23: barrels o' fun" @@ -211,10 +144,8 @@ #define HUSTR_28 "level 28: the spirit world" #define HUSTR_29 "level 29: the living end" #define HUSTR_30 "level 30: icon of sin" - #define HUSTR_31 "level 31: wolfenstein" #define HUSTR_32 "level 32: grosse" - #define PHUSTR_1 "level 1: congo" #define PHUSTR_2 "level 2: well of souls" #define PHUSTR_3 "level 3: aztec" @@ -226,7 +157,6 @@ #define PHUSTR_9 "level 9: abattoire" #define PHUSTR_10 "level 10: onslaught" #define PHUSTR_11 "level 11: hunted" - #define PHUSTR_12 "level 12: speed" #define PHUSTR_13 "level 13: the crypt" #define PHUSTR_14 "level 14: genesis" @@ -236,7 +166,6 @@ #define PHUSTR_18 "level 18: neurosphere" #define PHUSTR_19 "level 19: nme" #define PHUSTR_20 "level 20: the death domain" - #define PHUSTR_21 "level 21: slayer" #define PHUSTR_22 "level 22: impossible mission" #define PHUSTR_23 "level 23: tombstone" @@ -247,10 +176,8 @@ #define PHUSTR_28 "level 28: the sewers" #define PHUSTR_29 "level 29: odyssey of noises" #define PHUSTR_30 "level 30: the gateway of hell" - #define PHUSTR_31 "level 31: cyberden" #define PHUSTR_32 "level 32: go 2 it" - #define THUSTR_1 "level 1: system control" #define THUSTR_2 "level 2: human bbq" #define THUSTR_3 "level 3: power control" @@ -262,7 +189,6 @@ #define THUSTR_9 "level 9: stronghold" #define THUSTR_10 "level 10: redemption" #define THUSTR_11 "level 11: storage facility" - #define THUSTR_12 "level 12: crater" #define THUSTR_13 "level 13: nukage processing" #define THUSTR_14 "level 14: steel works" @@ -272,7 +198,6 @@ #define THUSTR_18 "level 18: mill" #define THUSTR_19 "level 19: shipping/respawning" #define THUSTR_20 "level 20: central processing" - #define THUSTR_21 "level 21: administration center" #define THUSTR_22 "level 22: habitat" #define THUSTR_23 "level 23: lunar mining project" @@ -283,10 +208,8 @@ #define THUSTR_28 "level 28: heck" #define THUSTR_29 "level 29: river styx" #define THUSTR_30 "level 30: last call" - #define THUSTR_31 "level 31: pharaoh" #define THUSTR_32 "level 32: caribbean" - #define HUSTR_CHATMACRO1 "I'm ready to kick butt!" #define HUSTR_CHATMACRO2 "I'm OK." #define HUSTR_CHATMACRO3 "I'm not looking too good!" @@ -297,65 +220,38 @@ #define HUSTR_CHATMACRO8 "I'll take care of it." #define HUSTR_CHATMACRO9 "Yes" #define HUSTR_CHATMACRO0 "No" - #define HUSTR_TALKTOSELF1 "You mumble to yourself" #define HUSTR_TALKTOSELF2 "Who's there?" #define HUSTR_TALKTOSELF3 "You scare yourself" #define HUSTR_TALKTOSELF4 "You start to rave" #define HUSTR_TALKTOSELF5 "You've lost it..." - #define HUSTR_MESSAGESENT "[Message Sent]" - - - - #define HUSTR_PLRGREEN "Green: " #define HUSTR_PLRINDIGO "Indigo: " #define HUSTR_PLRBROWN "Brown: " #define HUSTR_PLRRED "Red: " - #define HUSTR_KEYGREEN 'g' #define HUSTR_KEYINDIGO 'i' #define HUSTR_KEYBROWN 'b' #define HUSTR_KEYRED 'r' - - - - - #define AMSTR_FOLLOWON "Follow Mode ON" #define AMSTR_FOLLOWOFF "Follow Mode OFF" - #define AMSTR_GRIDON "Grid ON" #define AMSTR_GRIDOFF "Grid OFF" - #define AMSTR_MARKEDSPOT "Marked Spot" #define AMSTR_MARKSCLEARED "All Marks Cleared" - - - - - #define STSTR_MUS "Music Change" #define STSTR_NOMUS "IMPOSSIBLE SELECTION" #define STSTR_DQDON "Degreelessness Mode On" #define STSTR_DQDOFF "Degreelessness Mode Off" - #define STSTR_KFAADDED "Very Happy Ammo Added" #define STSTR_FAADDED "Ammo (no keys) Added" - #define STSTR_NCON "No Clipping Mode ON" #define STSTR_NCOFF "No Clipping Mode OFF" - #define STSTR_BEHOLD "inVuln, Str, Inviso, Rad, Allmap, or Lite-amp" #define STSTR_BEHOLDX "Power-up Toggled" - #define STSTR_CHOPPERS "... doesn't suck - GM" #define STSTR_CLEV "Changing Level..." - - - - #define E1TEXT \ "Once you beat the big badasses and\n"\ "clean out the moon base you're supposed\n"\ @@ -372,8 +268,6 @@ "To continue the DOOM experience, play\n"\ "The Shores of Hell and its amazing\n"\ "sequel, Inferno!\n" - - #define E2TEXT \ "You've done it! The hideous cyber-\n"\ "demon lord that ruled the lost Deimos\n"\ @@ -392,8 +286,6 @@ "\n" \ "Now, it's on to the final chapter of\n"\ "DOOM! -- Inferno." - - #define E3TEXT \ "The loathsome spiderdemon that\n"\ "masterminded the invasion of the moon\n"\ @@ -412,8 +304,6 @@ "unleashed. It's good that no Hell-\n"\ "spawn could have come through that\n"\ "door with you ..." - - #define E4TEXT \ "the spider mastermind must have sent forth\n"\ "its legions of hellspawn before your\n"\ @@ -431,10 +321,6 @@ "of demons run amok among our cities.\n"\ "\n"\ "next stop, hell on earth!" - - - - #define C1TEXT \ "YOU HAVE ENTERED DEEPLY INTO THE INFESTED\n" \ "STARPORT. BUT SOMETHING IS WRONG. THE\n" \ @@ -448,9 +334,6 @@ "OF THE STARBASE AND FIND THE CONTROLLING\n" \ "SWITCH WHICH HOLDS EARTH'S POPULATION\n" \ "HOSTAGE." - - - #define C2TEXT \ "YOU HAVE WON! YOUR VICTORY HAS ENABLED\n" \ "HUMANKIND TO EVACUATE EARTH AND ESCAPE\n"\ @@ -469,10 +352,6 @@ "YOUR OWN HOME CITY, NOT FAR FROM THE\n"\ "STARPORT.\" SLOWLY AND PAINFULLY YOU GET\n"\ "UP AND RETURN TO THE FRAY." - - - - #define C3TEXT \ "YOU ARE AT THE CORRUPT HEART OF THE CITY,\n"\ "SURROUNDED BY THE CORPSES OF YOUR ENEMIES.\n"\ @@ -483,10 +362,6 @@ "THERE MUST BE A WAY TO CLOSE IT ON THE\n"\ "OTHER SIDE. WHAT DO YOU CARE IF YOU'VE\n"\ "GOT TO GO THROUGH HELL TO GET TO IT?" - - - - #define C4TEXT \ "THE HORRENDOUS VISAGE OF THE BIGGEST\n"\ "DEMON YOU'VE EVER SEEN CRUMBLES BEFORE\n"\ @@ -503,29 +378,16 @@ "FOREHEAD YOU BEGIN THE LONG TREK BACK\n"\ "HOME. REBUILDING EARTH OUGHT TO BE A\n"\ "LOT MORE FUN THAN RUINING IT WAS.\n" - - - - - #define C5TEXT \ "CONGRATULATIONS, YOU'VE FOUND THE SECRET\n"\ "LEVEL! LOOKS LIKE IT'S BEEN BUILT BY\n"\ "HUMANS, RATHER THAN DEMONS. YOU WONDER\n"\ "WHO THE INMATES OF THIS CORNER OF HELL\n"\ "WILL BE." - - - - #define C6TEXT \ "CONGRATULATIONS, YOU'VE FOUND THE\n"\ "SUPER SECRET LEVEL! YOU'D BETTER\n"\ "BLAZE THROUGH THIS ONE!\n" - - - - #define P1TEXT \ "You gloat over the steaming carcass of the\n"\ "Guardian. With its death, you've wrested\n"\ @@ -539,10 +401,6 @@ "struggles will have been wasted. Keep\n"\ "moving, keep fighting, keep killing.\n"\ "Oh yes, keep living, too." - - - - #define P2TEXT \ "Even the deadly Arch-Vile labyrinth could\n"\ "not stop you, and you've gotten to the\n"\ @@ -550,10 +408,6 @@ "efficiently and permanently deactivated.\n"\ "\n"\ "You're good at that kind of thing." - - - - #define P3TEXT \ "You've bashed and battered your way into\n"\ "the heart of the devil-hive. Time for a\n"\ @@ -565,9 +419,6 @@ "Grinning evilly, you check your gear, and\n"\ "get ready to give the bastard a little Hell\n"\ "of your own making!" - - - #define P4TEXT \ "The Gatekeeper's evil face is splattered\n"\ "all over the place. As its tattered corpse\n"\ @@ -581,23 +432,15 @@ "launcher in your coffin. If you go to Hell\n"\ "when you die, you'll need it for some\n"\ "final cleaning-up ..." - - - #define P5TEXT \ "You've found the second-hardest level we\n"\ "got. Hope you have a saved game a level or\n"\ "two previous. If not, be prepared to die\n"\ "aplenty. For master marines only." - - - #define P6TEXT \ "Betcha wondered just what WAS the hardest\n"\ "level we had ready for ya? Now you know.\n"\ "No one gets out alive." - - #define T1TEXT \ "You've fought your way out of the infested\n"\ "experimental labs. It seems that UAC has\n"\ @@ -611,8 +454,6 @@ "their teeth into you. With luck, the\n"\ "complex still has some warlike ordnance\n"\ "laying around." - - #define T2TEXT \ "You hear the grinding of heavy machinery\n"\ "ahead. You sure hope they're not stamping\n"\ @@ -623,8 +464,6 @@ "maniacs packed into one mad killer.\n"\ "\n"\ "You don't plan to go down easy." - - #define T3TEXT \ "The vista opening ahead looks real damn\n"\ "familiar. Smells familiar, too -- like\n"\ @@ -634,7 +473,6 @@ "brood on it, the madder you get.\n"\ "Hefting your gun, an evil grin trickles\n"\ "onto your face. Time to take some names." - #define T4TEXT \ "Suddenly, all is silent, from one horizon\n"\ "to the other. The agonizing echo of Hell\n"\ @@ -647,16 +485,12 @@ "Something rumbles in the distance.\n"\ "A blue light begins to glow inside the\n"\ "ruined skull of the demon-spitter." - - #define T5TEXT \ "What now? Looks totally different. Kind\n"\ "of like King Tut's condo. Well,\n"\ "whatever's here can't be any worse\n"\ "than usual. Can it? Or maybe it's best\n"\ "to let sleeping gods lie.." - - #define T6TEXT \ "Time for a vacation. You've burst the\n"\ "bowels of hell and by golly you're ready\n"\ @@ -668,12 +502,6 @@ "\n"\ "As you step off the transport, you hear\n"\ "the stomp of a cyberdemon's iron shoe." - - - - - - #define CC_ZOMBIE "ZOMBIEMAN" #define CC_SHOTGUN "SHOTGUN GUY" #define CC_HEAVY "HEAVY WEAPON DUDE" @@ -691,11 +519,4 @@ #define CC_SPIDER "THE SPIDER MASTERMIND" #define CC_CYBER "THE CYBERDEMON" #define CC_HERO "OUR HERO" - - #endif - - - - - diff --git a/src/d_event.h b/src/d_event.h @@ -1,37 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __D_EVENT__ #define __D_EVENT__ - - #include "doomtype.h" - - - - - - - typedef enum { ev_keydown, @@ -39,8 +8,6 @@ typedef enum ev_mouse, ev_joystick } evtype_t; - - typedef struct { evtype_t type; @@ -48,8 +15,6 @@ typedef struct int data2; int data3; } event_t; - - typedef enum { ga_nothing, @@ -63,60 +28,23 @@ typedef enum ga_worlddone, ga_screenshot } gameaction_t; - - - - - - typedef enum { - BT_ATTACK = 1, - BT_USE = 2, - - BT_SPECIAL = 128, BT_SPECIALMASK = 3, - - - BT_CHANGE = 4, - BT_WEAPONMASK = (8+16+32), BT_WEAPONSHIFT = 3, - - BTS_PAUSE = 1, - BTS_SAVEGAME = 2, - - - BTS_SAVEMASK = (4+8+16), BTS_SAVESHIFT = 2 - } buttoncode_t; - - - - - - - #define MAXEVENTS 64 - extern event_t events[MAXEVENTS]; extern int eventhead; extern int eventtail; - extern gameaction_t gameaction; - - #endif - - - - - diff --git a/src/d_french.h b/src/d_french.h @@ -1,37 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __D_FRENCH__ #define __D_FRENCH__ - - - - #define D_DEVSTR "MODE DEVELOPPEMENT ON.\n" #define D_CDROM "VERSION CD-ROM: DEFAULT.CFG DANS C:\\DOOMDATA\n" - - - - #define PRESSKEY "APPUYEZ SUR UNE TOUCHE." #define PRESSYN "APPUYEZ SUR Y OU N" #define QUITMSG "VOUS VOULEZ VRAIMENT\nQUITTER CE SUPER JEU?" @@ -54,9 +24,7 @@ #define NETEND "VOUS NE POUVEZ PAS METTRE FIN A UN JEU SUR "\ "RESEAU!\n\n"PRESSKEY #define ENDGAME "VOUS VOULEZ VRAIMENT METTRE FIN AU JEU?\n\n"PRESSYN - #define DOSY "(APPUYEZ SUR Y POUR REVENIR AU OS.)" - #define DETAILHI "GRAPHISMES MAXIMUM " #define DETAILLO "GRAPHISMES MINIMUM " #define GAMMALVL0 "CORRECTION GAMMA OFF" @@ -65,10 +33,6 @@ #define GAMMALVL3 "CORRECTION GAMMA NIVEAU 3" #define GAMMALVL4 "CORRECTION GAMMA NIVEAU 4" #define EMPTYSTRING "EMPLACEMENT VIDE" - - - - #define GOTARMOR "ARMURE RECUPEREE." #define GOTMEGA "MEGA-ARMURE RECUPEREE!" #define GOTHTHBONUS "BONUS DE SANTE RECUPERE." @@ -77,14 +41,12 @@ #define GOTMEDINEED "MEDIKIT RECUPERE. VOUS EN AVEZ VRAIMENT BESOIN!" #define GOTMEDIKIT "MEDIKIT RECUPERE." #define GOTSUPER "SUPERCHARGE!" - #define GOTBLUECARD "CARTE MAGNETIQUE BLEUE RECUPEREE." #define GOTYELWCARD "CARTE MAGNETIQUE JAUNE RECUPEREE." #define GOTREDCARD "CARTE MAGNETIQUE ROUGE RECUPEREE." #define GOTBLUESKUL "CLEF CRANE BLEUE RECUPEREE." #define GOTYELWSKUL "CLEF CRANE JAUNE RECUPEREE." #define GOTREDSKULL "CLEF CRANE ROUGE RECUPEREE." - #define GOTINVUL "INVULNERABILITE!" #define GOTBERSERK "BERSERK!" #define GOTINVIS "INVISIBILITE PARTIELLE " @@ -92,7 +54,6 @@ #define GOTMAP "CARTE INFORMATIQUE " #define GOTVISOR "VISEUR A AMPLIFICATION DE LUMIERE " #define GOTMSPHERE "MEGASPHERE!" - #define GOTCLIP "CHARGEUR RECUPERE." #define GOTCLIPBOX "BOITE DE BALLES RECUPEREE." #define GOTROCKET "ROQUETTE RECUPEREE." @@ -102,7 +63,6 @@ #define GOTSHELLS "4 CARTOUCHES RECUPEREES." #define GOTSHELLBOX "BOITE DE CARTOUCHES RECUPEREE." #define GOTBACKPACK "SAC PLEIN DE MUNITIONS RECUPERE!" - #define GOTBFG9000 "VOUS AVEZ UN BFG9000! OH, OUI!" #define GOTCHAINGUN "VOUS AVEZ LA MITRAILLEUSE!" #define GOTCHAINSAW "UNE TRONCONNEUSE!" @@ -110,27 +70,14 @@ #define GOTPLASMA "VOUS AVEZ UN FUSIL A PLASMA!" #define GOTSHOTGUN "VOUS AVEZ UN FUSIL!" #define GOTSHOTGUN2 "VOUS AVEZ UN SUPER FUSIL!" - - - - #define PD_BLUEO "IL VOUS FAUT UNE CLEF BLEUE" #define PD_REDO "IL VOUS FAUT UNE CLEF ROUGE" #define PD_YELLOWO "IL VOUS FAUT UNE CLEF JAUNE" #define PD_BLUEK PD_BLUEO #define PD_REDK PD_REDO #define PD_YELLOWK PD_YELLOWO - - - - #define GGSAVED "JEU SAUVEGARDE." - - - - #define HUSTR_MSGU "[MESSAGE NON ENVOYE]" - #define HUSTR_E1M1 "E1M1: HANGAR" #define HUSTR_E1M2 "E1M2: USINE NUCLEAIRE " #define HUSTR_E1M3 "E1M3: RAFFINERIE DE TOXINES " @@ -140,7 +87,6 @@ #define HUSTR_E1M7 "E1M7: CENTRE INFORMATIQUE " #define HUSTR_E1M8 "E1M8: ANOMALIE PHOBOS " #define HUSTR_E1M9 "E1M9: BASE MILITAIRE " - #define HUSTR_E2M1 "E2M1: ANOMALIE DEIMOS " #define HUSTR_E2M2 "E2M2: ZONE DE CONFINEMENT " #define HUSTR_E2M3 "E2M3: RAFFINERIE" @@ -150,7 +96,6 @@ #define HUSTR_E2M7 "E2M7: CUVES DE REPRODUCTION " #define HUSTR_E2M8 "E2M8: TOUR DE BABEL " #define HUSTR_E2M9 "E2M9: FORTERESSE DU MYSTERE " - #define HUSTR_E3M1 "E3M1: DONJON DE L'ENFER " #define HUSTR_E3M2 "E3M2: BOURBIER DU DESESPOIR " #define HUSTR_E3M3 "E3M3: PANDEMONIUM" @@ -160,7 +105,6 @@ #define HUSTR_E3M7 "E3M7: LIMBES" #define HUSTR_E3M8 "E3M8: DIS" #define HUSTR_E3M9 "E3M9: CLAPIERS" - #define HUSTR_1 "NIVEAU 1: ENTREE " #define HUSTR_2 "NIVEAU 2: HALLS SOUTERRAINS " #define HUSTR_3 "NIVEAU 3: LE FEU NOURRI " @@ -172,7 +116,6 @@ #define HUSTR_9 "NIVEAU 9: LE PUITS " #define HUSTR_10 "NIVEAU 10: BASE DE RAVITAILLEMENT " #define HUSTR_11 "NIVEAU 11: LE CERCLE DE LA MORT!" - #define HUSTR_12 "NIVEAU 12: L'USINE " #define HUSTR_13 "NIVEAU 13: LE CENTRE VILLE" #define HUSTR_14 "NIVEAU 14: LES ANTRES PROFONDES " @@ -182,7 +125,6 @@ #define HUSTR_18 "NIVEAU 18: LA COUR " #define HUSTR_19 "NIVEAU 19: LA CITADELLE " #define HUSTR_20 "NIVEAU 20: JE T'AI EU!" - #define HUSTR_21 "NIVEAU 21: LE NIRVANA" #define HUSTR_22 "NIVEAU 22: LES CATACOMBES " #define HUSTR_23 "NIVEAU 23: LA GRANDE FETE " @@ -193,11 +135,8 @@ #define HUSTR_28 "NIVEAU 28: LE MONDE DE L'ESPRIT " #define HUSTR_29 "NIVEAU 29: LA LIMITE " #define HUSTR_30 "NIVEAU 30: L'ICONE DU PECHE " - #define HUSTR_31 "NIVEAU 31: WOLFENSTEIN" #define HUSTR_32 "NIVEAU 32: LE MASSACRE" - - #define HUSTR_CHATMACRO1 "JE SUIS PRET A LEUR EN FAIRE BAVER!" #define HUSTR_CHATMACRO2 "JE VAIS BIEN." #define HUSTR_CHATMACRO3 "JE N'AI PAS L'AIR EN FORME!" @@ -208,65 +147,38 @@ #define HUSTR_CHATMACRO8 "JE VAIS M'EN OCCUPER." #define HUSTR_CHATMACRO9 "OUI" #define HUSTR_CHATMACRO0 "NON" - #define HUSTR_TALKTOSELF1 "VOUS PARLEZ TOUT SEUL " #define HUSTR_TALKTOSELF2 "QUI EST LA?" #define HUSTR_TALKTOSELF3 "VOUS VOUS FAITES PEUR " #define HUSTR_TALKTOSELF4 "VOUS COMMENCEZ A DELIRER " #define HUSTR_TALKTOSELF5 "VOUS ETES LARGUE..." - #define HUSTR_MESSAGESENT "[MESSAGE ENVOYE]" - - - - #define HUSTR_PLRGREEN "VERT: " #define HUSTR_PLRINDIGO "INDIGO: " #define HUSTR_PLRBROWN "BRUN: " #define HUSTR_PLRRED "ROUGE: " - #define HUSTR_KEYGREEN 'g' #define HUSTR_KEYINDIGO 'i' #define HUSTR_KEYBROWN 'b' #define HUSTR_KEYRED 'r' - - - - - #define AMSTR_FOLLOWON "MODE POURSUITE ON" #define AMSTR_FOLLOWOFF "MODE POURSUITE OFF" - #define AMSTR_GRIDON "GRILLE ON" #define AMSTR_GRIDOFF "GRILLE OFF" - #define AMSTR_MARKEDSPOT "REPERE MARQUE " #define AMSTR_MARKSCLEARED "REPERES EFFACES " - - - - - #define STSTR_MUS "CHANGEMENT DE MUSIQUE " #define STSTR_NOMUS "IMPOSSIBLE SELECTION" #define STSTR_DQDON "INVULNERABILITE ON " #define STSTR_DQDOFF "INVULNERABILITE OFF" - #define STSTR_KFAADDED "ARMEMENT MAXIMUM! " #define STSTR_FAADDED "ARMES (SAUF CLEFS) AJOUTEES" - #define STSTR_NCON "BARRIERES ON" #define STSTR_NCOFF "BARRIERES OFF" - #define STSTR_BEHOLD " inVuln, Str, Inviso, Rad, Allmap, or Lite-amp" #define STSTR_BEHOLDX "AMELIORATION ACTIVEE" - #define STSTR_CHOPPERS "... DOESN'T SUCK - GM" #define STSTR_CLEV "CHANGEMENT DE NIVEAU..." - - - - #define E1TEXT "APRES AVOIR VAINCU LES GROS MECHANTS\n"\ "ET NETTOYE LA BASE LUNAIRE, VOUS AVEZ\n"\ "GAGNE, NON? PAS VRAI? OU EST DONC VOTRE\n"\ @@ -282,7 +194,6 @@ "POUR VIVRE LA SUITE DE DOOM, JOUEZ\n"\ "A 'AUX PORTES DE L'ENFER' ET A\n"\ "L'EPISODE SUIVANT, 'L'ENFER'!\n" - #define E2TEXT "VOUS AVEZ REUSSI. L'INFAME DEMON\n"\ "QUI CONTROLAIT LA BASE LUNAIRE DE\n"\ "DEIMOS EST MORT, ET VOUS AVEZ\n"\ @@ -300,7 +211,6 @@ "\n" \ "VOICI MAINTENANT LE CHAPITRE FINAL DE\n"\ "DOOM! -- L'ENFER." - #define E3TEXT "LE DEMON ARACHNEEN ET REPUGNANT\n"\ "QUI A DIRIGE L'INVASION DES BASES\n"\ "LUNAIRES ET SEME LA MORT VIENT DE SE\n"\ @@ -318,11 +228,6 @@ "COMBATTU LE DEMON. HEUREUSEMENT,\n"\ "AUCUN GERME DU MAL N'A FRANCHI\n"\ "CETTE PORTE AVEC VOUS..." - - - - - #define C1TEXT "VOUS ETES AU PLUS PROFOND DE L'ASTROPORT\n" \ "INFESTE DE MONSTRES, MAIS QUELQUE CHOSE\n" \ "NE VA PAS. ILS ONT APPORTE LEUR PROPRE\n" \ @@ -335,9 +240,6 @@ "COEUR DE LA BASE HANTEE ET TROUVER \n" \ "L'INTERRUPTEUR DE CONTROLE QUI GARDE LA \n" \ "POPULATION DE LA TERRE EN OTAGE." - - - #define C2TEXT "VOUS AVEZ GAGNE! VOTRE VICTOIRE A PERMIS\n" \ "A L'HUMANITE D'EVACUER LA TERRE ET \n"\ "D'ECHAPPER AU CAUCHEMAR. VOUS ETES \n"\ @@ -355,9 +257,6 @@ "DE VOTRE VILLE NATALE, PRES DE L'ASTROPORT.\n"\ "VOUS VOUS RELEVEZ LENTEMENT ET PENIBLEMENT\n"\ "ET VOUS REPARTEZ POUR LE FRONT." - - - #define C3TEXT "VOUS ETES AU COEUR DE LA CITE CORROMPUE,\n"\ "ENTOURE PAR LES CADAVRES DE VOS ENNEMIS.\n"\ "VOUS NE VOYEZ PAS COMMENT DETRUIRE LA PORTE\n"\ @@ -367,9 +266,6 @@ "IL DOIT Y AVOIR UN MOYEN DE LA FERMER\n"\ "DE L'AUTRE COTE. VOUS ACCEPTEZ DE\n"\ "TRAVERSER L'ENFER POUR LE FAIRE?" - - - #define C4TEXT "LE VISAGE HORRIBLE D'UN DEMON D'UNE\n"\ "TAILLE INCROYABLE S'EFFONDRE DEVANT\n"\ "VOUS LORSQUE VOUS TIREZ UNE SALVE DE\n"\ @@ -385,24 +281,14 @@ "VOTRE FRONT COUVERT DE SUEUR ET REPARTEZ\n"\ "VERS LA TERRE. SA RECONSTRUCTION SERA\n"\ "BEAUCOUP PLUS DROLE QUE SA DESTRUCTION.\n" - - - #define C5TEXT "FELICITATIONS! VOUS AVEZ TROUVE LE\n"\ "NIVEAU SECRET! IL SEMBLE AVOIR ETE\n"\ "CONSTRUIT PAR LES HUMAINS. VOUS VOUS\n"\ "DEMANDEZ QUELS PEUVENT ETRE LES\n"\ "HABITANTS DE CE COIN PERDU DE L'ENFER." - - - #define C6TEXT "FELICITATIONS! VOUS AVEZ DECOUVERT\n"\ "LE NIVEAU SUPER SECRET! VOUS FERIEZ\n"\ "MIEUX DE FONCER DANS CELUI-LA!\n" - - - - #define CC_ZOMBIE "ZOMBIE" #define CC_SHOTGUN "TYPE AU FUSIL" #define CC_HEAVY "MEC SUPER-ARME" @@ -420,14 +306,4 @@ #define CC_SPIDER "L'ARAIGNEE CERVEAU" #define CC_CYBER "LE CYBERDEMON" #define CC_HERO "NOTRE HEROS" - - - #endif - - - - - - - diff --git a/src/d_items.c b/src/d_items.c @@ -1,51 +1,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - #include "info.h" - #ifdef __GNUG__ #pragma implementation "d_items.h" #endif #include "d_items.h" - - - - - - - - - - - - - - weaponinfo_t weaponinfo[NUMWEAPONS] = { { - am_noammo, S_PUNCHUP, S_PUNCHDOWN, @@ -54,7 +14,6 @@ weaponinfo_t weaponinfo[NUMWEAPONS] = S_NULL }, { - am_clip, S_PISTOLUP, S_PISTOLDOWN, @@ -63,7 +22,6 @@ weaponinfo_t weaponinfo[NUMWEAPONS] = S_PISTOLFLASH }, { - am_shell, S_SGUNUP, S_SGUNDOWN, @@ -72,7 +30,6 @@ weaponinfo_t weaponinfo[NUMWEAPONS] = S_SGUNFLASH1 }, { - am_clip, S_CHAINUP, S_CHAINDOWN, @@ -81,7 +38,6 @@ weaponinfo_t weaponinfo[NUMWEAPONS] = S_CHAINFLASH1 }, { - am_misl, S_MISSILEUP, S_MISSILEDOWN, @@ -90,7 +46,6 @@ weaponinfo_t weaponinfo[NUMWEAPONS] = S_MISSILEFLASH1 }, { - am_cell, S_PLASMAUP, S_PLASMADOWN, @@ -99,7 +54,6 @@ weaponinfo_t weaponinfo[NUMWEAPONS] = S_PLASMAFLASH1 }, { - am_cell, S_BFGUP, S_BFGDOWN, @@ -108,7 +62,6 @@ weaponinfo_t weaponinfo[NUMWEAPONS] = S_BFGFLASH1 }, { - am_noammo, S_SAWUP, S_SAWDOWN, @@ -117,7 +70,6 @@ weaponinfo_t weaponinfo[NUMWEAPONS] = S_NULL }, { - am_shell, S_DSGUNUP, S_DSGUNDOWN, @@ -126,11 +78,3 @@ weaponinfo_t weaponinfo[NUMWEAPONS] = S_DSGUNFLASH1 }, }; - - - - - - - - diff --git a/src/d_items.h b/src/d_items.h @@ -1,36 +1,9 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __D_ITEMS__ #define __D_ITEMS__ - #include "doomdef.h" - #ifdef __GNUG__ #pragma interface #endif - - - typedef struct { ammotype_t ammo; @@ -39,14 +12,6 @@ typedef struct int readystate; int atkstate; int flashstate; - } weaponinfo_t; - extern weaponinfo_t weaponinfo[NUMWEAPONS]; - #endif - - - - - diff --git a/src/d_main.c b/src/d_main.c @@ -1,35 +1,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - #define BGCOLOR 7 #define FGCOLOR 8 - - #ifdef NORMALUNIX #include <stdio.h> #include <stdlib.h> @@ -38,134 +8,66 @@ #include <sys/stat.h> #include <fcntl.h> #endif - - #include "doomdef.h" #include "doomstat.h" - #include "dstrings.h" #include "sounds.h" - - #include "z_zone.h" #include "w_wad.h" #include "s_sound.h" #include "v_video.h" - #include "f_finale.h" #include "f_wipe.h" - #include "m_argv.h" #include "m_misc.h" #include "m_menu.h" - #include "i_system.h" #include "i_sound.h" #include "i_video.h" - #include "g_game.h" - #include "hu_stuff.h" #include "wi_stuff.h" #include "st_stuff.h" #include "am_map.h" - #include "p_setup.h" #include "r_local.h" - - #include "d_main.h" - - - - - - - - - - void D_DoomLoop (void); - - char* wadfiles[MAXWADFILES]; - - boolean devparm; boolean nomonsters; boolean respawnparm; boolean fastparm; - boolean drone; - boolean singletics = false; - - - - - - - extern boolean inhelpscreens; - skill_t startskill; int startepisode; int startmap; boolean autostart; - FILE* debugfile; - boolean advancedemo; - - - - char wadfile[1024]; char mapdir[1024]; char basedefault[1024]; - - void D_CheckNetGame (void); void D_ProcessEvents (void); void G_BuildTiccmd (ticcmd_t* cmd); void D_DoAdvanceDemo (void); - - - - - - - - event_t events[MAXEVENTS]; int eventhead; int eventtail; - - - - - - void D_PostEvent (event_t* ev) { events[eventhead] = *ev; eventhead = (++eventhead)&(MAXEVENTS-1); } - - - - - - void D_ProcessEvents (void) { event_t* ev; - - if ( ( gamemode == commercial ) && (W_CheckNumForName("map01")<0) ) return; - for ( ; eventtail != eventhead ; eventtail = (++eventtail)&(MAXEVENTS-1) ) { ev = &events[eventtail]; @@ -174,21 +76,10 @@ void D_ProcessEvents (void) G_Responder (ev); } } - - - - - - - - - - gamestate_t wipegamestate = GS_DEMOSCREEN; extern boolean setsizeneeded; extern int showMessages; void R_ExecuteSetViewSize (void); - void D_Display (void) { static boolean viewactivestate = false; @@ -204,21 +95,15 @@ void D_Display (void) boolean done; boolean wipe; boolean redrawsbar; - if (nodrawers) return; - redrawsbar = false; - - if (setsizeneeded) { R_ExecuteSetViewSize (); oldgamestate = -1; borderdrawcount = 3; } - - if (gamestate != wipegamestate) { wipe = true; @@ -226,11 +111,8 @@ void D_Display (void) } else wipe = false; - if (gamestate == GS_LEVEL && gametic) HU_Erase(); - - switch (gamestate) { case GS_LEVEL: @@ -245,42 +127,28 @@ void D_Display (void) ST_Drawer (viewheight == 200, redrawsbar ); fullscreen = viewheight == 200; break; - case GS_INTERMISSION: WI_Drawer (); break; - case GS_FINALE: F_Drawer (); break; - case GS_DEMOSCREEN: D_PageDrawer (); break; } - - I_UpdateNoBlit (); - - if (gamestate == GS_LEVEL && !automapactive && gametic) R_RenderPlayerView (&players[displayplayer]); - if (gamestate == GS_LEVEL && gametic) HU_Drawer (); - - if (gamestate != oldgamestate && gamestate != GS_LEVEL) I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE)); - - if (gamestate == GS_LEVEL && oldgamestate != GS_LEVEL) { viewactivestate = false; R_FillBackScreen (); } - - if (gamestate == GS_LEVEL && !automapactive && scaledviewwidth != 320) { if (menuactive || menuactivestate || !viewactivestate) @@ -290,15 +158,11 @@ void D_Display (void) R_DrawViewBorder (); borderdrawcount--; } - } - menuactivestate = menuactive; viewactivestate = viewactive; inhelpscreensstate = inhelpscreens; oldgamestate = wipegamestate = gamestate; - - if (paused) { if (automapactive) @@ -308,25 +172,15 @@ void D_Display (void) V_DrawPatchDirect(viewwindowx+(scaledviewwidth-68)/2, y,0,W_CacheLumpName ("M_PAUSE", PU_CACHE)); } - - - M_Drawer (); NetUpdate (); - - - if (!wipe) { I_FinishUpdate (); return; } - - wipe_EndScreen(0, 0, SCREENWIDTH, SCREENHEIGHT); - wipestart = I_GetTime () - 1; - do { do @@ -342,19 +196,11 @@ void D_Display (void) I_FinishUpdate (); } while (!done); } - - - - - - extern boolean demorecording; - void D_DoomLoop (void) { if (demorecording) G_BeginRecording (); - if (M_CheckParm ("-debugfile")) { char filename[20]; @@ -362,15 +208,10 @@ void D_DoomLoop (void) printf ("debug output to: %s\n",filename); debugfile = fopen (filename,"w"); } - I_InitGraphics (); - while (1) { - I_StartFrame (); - - if (singletics) { I_StartTic (); @@ -387,69 +228,32 @@ void D_DoomLoop (void) { TryRunTics (); } - S_UpdateSounds (players[consoleplayer].mo); - - D_Display (); - #ifndef SNDSERV - I_UpdateSound(); #endif - #ifndef SNDINTR - I_SubmitSound(); #endif } } - - - - - - int demosequence; int pagetic; char *pagename; - - - - - - void D_PageTicker (void) { if (--pagetic < 0) D_AdvanceDemo (); } - - - - - - void D_PageDrawer (void) { V_DrawPatch (0,0, 0, W_CacheLumpName(pagename, PU_CACHE)); } - - - - - - void D_AdvanceDemo (void) { advancedemo = true; } - - - - - - void D_DoAdvanceDemo (void) { players[consoleplayer].playerstate = PST_LIVE; @@ -457,12 +261,10 @@ void D_AdvanceDemo (void) usergame = false; paused = false; gameaction = ga_nothing; - if ( gamemode == retail ) demosequence = (demosequence+1)%7; else demosequence = (demosequence+1)%6; - switch (demosequence) { case 0: @@ -499,7 +301,6 @@ void D_AdvanceDemo (void) else { pagetic = 200; - if ( gamemode == retail ) pagename = "CREDIT"; else @@ -509,110 +310,62 @@ void D_AdvanceDemo (void) case 5: G_DeferedPlayDemo ("demo3"); break; - case 6: G_DeferedPlayDemo ("demo4"); break; } } - - - - - - void D_StartTitle (void) { gameaction = ga_nothing; demosequence = -1; D_AdvanceDemo (); } - - - - - char title[128]; - - - - - - void D_AddFile (char *file) { int numwadfiles; char *newfile; - for (numwadfiles = 0 ; wadfiles[numwadfiles] ; numwadfiles++) ; - newfile = malloc (strlen(file)+1); strcpy (newfile, file); - wadfiles[numwadfiles] = newfile; } - - - - - - - void IdentifyVersion (void) { - char* doom1wad; char* doomwad; char* doomuwad; char* doom2wad; - char* doom2fwad; char* plutoniawad; char* tntwad; - #ifdef NORMALUNIX char *home; char *doomwaddir; doomwaddir = getenv("DOOMWADDIR"); if (!doomwaddir) doomwaddir = "."; - - doom2wad = malloc(strlen(doomwaddir)+1+9+1); sprintf(doom2wad, "%s/doom2.wad", doomwaddir); - - doomuwad = malloc(strlen(doomwaddir)+1+8+1); sprintf(doomuwad, "%s/doomu.wad", doomwaddir); - - doomwad = malloc(strlen(doomwaddir)+1+8+1); sprintf(doomwad, "%s/doom.wad", doomwaddir); - - doom1wad = malloc(strlen(doomwaddir)+1+9+1); sprintf(doom1wad, "%s/doom1.wad", doomwaddir); - - - plutoniawad = malloc(strlen(doomwaddir)+1+/*9*/12+1); sprintf(plutoniawad, "%s/plutonia.wad", doomwaddir); - tntwad = malloc(strlen(doomwaddir)+1+9+1); sprintf(tntwad, "%s/tnt.wad", doomwaddir); - - - doom2fwad = malloc(strlen(doomwaddir)+1+10+1); sprintf(doom2fwad, "%s/doom2f.wad", doomwaddir); - home = getenv("HOME"); if (!home) I_Error("Please set $HOME to your home directory"); sprintf(basedefault, "%s/.doomrc", home); #endif - if (M_CheckParm ("-shdev")) { gamemode = shareware; @@ -623,7 +376,6 @@ void IdentifyVersion (void) strcpy (basedefault,DEVDATA"default.cfg"); return; } - if (M_CheckParm ("-regdev")) { gamemode = registered; @@ -635,7 +387,6 @@ void IdentifyVersion (void) strcpy (basedefault,DEVDATA"default.cfg"); return; } - if (M_CheckParm ("-comdev")) { gamemode = commercial; @@ -647,82 +398,62 @@ void IdentifyVersion (void) D_AddFile (DEVDATA"tnt.wad"); else*/ D_AddFile (DEVDATA"doom2.wad"); - D_AddFile (DEVMAPS"cdata/texture1.lmp"); D_AddFile (DEVMAPS"cdata/pnames.lmp"); strcpy (basedefault,DEVDATA"default.cfg"); return; } - if ( !access (doom2fwad,R_OK) ) { gamemode = commercial; - - language = french; printf("French version\n"); D_AddFile (doom2fwad); return; } - if ( !access (doom2wad,R_OK) ) { gamemode = commercial; D_AddFile (doom2wad); return; } - if ( !access (plutoniawad, R_OK ) ) { gamemode = commercial; D_AddFile (plutoniawad); return; } - if ( !access ( tntwad, R_OK ) ) { gamemode = commercial; D_AddFile (tntwad); return; } - if ( !access (doomuwad,R_OK) ) { gamemode = retail; D_AddFile (doomuwad); return; } - if ( !access (doomwad,R_OK) ) { gamemode = registered; D_AddFile (doomwad); return; } - if ( !access (doom1wad,R_OK) ) { gamemode = shareware; D_AddFile (doom1wad); return; } - printf("Game mode indeterminate.\n"); gamemode = indetermined; - - - - } - - - - void FindResponseFile (void) { int i; #define MAXARGVS 100 - for (i = 1;i < myargc;i++) if (myargv[i][0] == '@') { @@ -735,8 +466,6 @@ void FindResponseFile (void) char *file; char *moreargs[20]; char *firstargv; - - handle = fopen (&myargv[i][1],"rb"); if (!handle) { @@ -750,16 +479,12 @@ void FindResponseFile (void) file = malloc (size); fread (file,size,1,handle); fclose (handle); - - for (index = 0,k = i+1; k < myargc; k++) moreargs[index++] = myargv[k]; - firstargv = myargv[0]; myargv = malloc(sizeof(char *)*MAXARGVS); memset(myargv,0,sizeof(char *)*MAXARGVS); myargv[0] = firstargv; - infile = file; indexinfile = k = 0; indexinfile++; @@ -774,36 +499,23 @@ void FindResponseFile (void) ((*(infile+k)<= ' ') || (*(infile+k)>'z'))) k++; } while(k < size); - for (k = 0;k < index;k++) myargv[indexinfile++] = moreargs[k]; myargc = indexinfile; - - printf("%d command-line args:\n",myargc); for (k=1;k<myargc;k++) printf("%s\n",myargv[k]); - break; } } - - - - - void D_DoomMain (void) { int p; char file[256]; - FindResponseFile (); - IdentifyVersion (); - setbuf (stdout, NULL); modifiedgame = false; - nomonsters = M_CheckParm ("-nomonsters"); respawnparm = M_CheckParm ("-respawn"); fastparm = M_CheckParm ("-fast"); @@ -812,7 +524,6 @@ void D_DoomMain (void) deathmatch = 2; else if (M_CheckParm ("-deathmatch")) deathmatch = 1; - switch ( gamemode ) { case retail: @@ -867,26 +578,20 @@ void D_DoomMain (void) VERSION/100,VERSION%100); break; } - printf ("%s\n",title); - if (devparm) printf(D_DEVSTR); - if (M_CheckParm("-cdrom")) { printf(D_CDROM); mkdir("c:\\doomdata",0); strcpy (basedefault,"c:/doomdata/default.cfg"); } - - if ( (p=M_CheckParm ("-turbo")) ) { int scale = 200; extern int forwardmove[2]; extern int sidemove[2]; - if (p<myargc-1) scale = atoi (myargv[p+1]); if (scale < 10) @@ -899,18 +604,10 @@ void D_DoomMain (void) sidemove[0] = sidemove[0]*scale/100; sidemove[1] = sidemove[1]*scale/100; } - - - - - - p = M_CheckParm ("-wart"); if (p) { myargv[p][4] = 'p'; - - switch (gamemode ) { case shareware: @@ -921,7 +618,6 @@ void D_DoomMain (void) printf("Warping to Episode %s, Map %s.\n", myargv[p+1],myargv[p+2]); break; - case commercial: default: p = atoi (myargv[p+1]); @@ -933,43 +629,32 @@ void D_DoomMain (void) } D_AddFile (file); } - p = M_CheckParm ("-file"); if (p) { - - modifiedgame = true; while (++p != myargc && myargv[p][0] != '-') D_AddFile (myargv[p]); } - p = M_CheckParm ("-playdemo"); - if (!p) p = M_CheckParm ("-timedemo"); - if (p && p < myargc-1) { sprintf (file,"%s.lmp", myargv[p+1]); D_AddFile (file); printf("Playing demo %s.lmp.\n",myargv[p+1]); } - - startskill = sk_medium; startepisode = 1; startmap = 1; autostart = false; - - p = M_CheckParm ("-skill"); if (p && p < myargc-1) { startskill = myargv[p+1][0]-'1'; autostart = true; } - p = M_CheckParm ("-episode"); if (p && p < myargc-1) { @@ -977,7 +662,6 @@ void D_DoomMain (void) startmap = 1; autostart = true; } - p = M_CheckParm ("-timer"); if (p && p < myargc-1 && deathmatch) { @@ -988,11 +672,9 @@ void D_DoomMain (void) printf("s"); printf(".\n"); } - p = M_CheckParm ("-avg"); if (p && p < myargc-1 && deathmatch) printf("Austin Virtual Gaming: Levels will end after 20 minutes\n"); - p = M_CheckParm ("-warp"); if (p && p < myargc-1) { @@ -1005,26 +687,16 @@ void D_DoomMain (void) } autostart = true; } - - printf ("V_Init: allocate screens.\n"); V_Init (); - printf ("M_LoadDefaults: Load system defaults.\n"); M_LoadDefaults (); - printf ("Z_Init: Init zone memory allocation daemon. \n"); Z_Init (); - printf ("W_Init: Init WADfiles.\n"); W_InitMultipleFiles (wadfiles); - - - if (modifiedgame) { - - char name[23][8]= { "e2m1","e2m2","e2m3","e2m4","e2m5","e2m6","e2m7","e2m8","e2m9", @@ -1032,20 +704,14 @@ void D_DoomMain (void) "dphoof","bfgga0","heada1","cybra1","spida1d1" }; int i; - if ( gamemode == shareware) I_Error("\nYou cannot -file with the shareware " "version. Register!"); - - - if (gamemode == registered) for (i = 0;i < 23; i++) if (W_CheckNumForName(name[i])<0) I_Error("\nThis is not the registered version."); } - - if (modifiedgame) { /*m*/printf ( @@ -1058,9 +724,6 @@ void D_DoomMain (void) ); getchar (); } - - - switch ( gamemode ) { case shareware: @@ -1081,56 +744,38 @@ void D_DoomMain (void) "===========================================================================\n" ); break; - default: - break; } - printf ("M_Init: Init miscellaneous info.\n"); M_Init (); - printf ("R_Init: Init DOOM refresh daemon - "); R_Init (); - printf ("\nP_Init: Init Playloop state.\n"); P_Init (); - printf ("I_Init: Setting up machine state.\n"); I_Init (); - printf ("D_CheckNetGame: Checking network game status.\n"); D_CheckNetGame (); - printf ("S_Init: Setting up sound.\n"); S_Init (snd_SfxVolume /* *8 */, snd_MusicVolume /* *8*/ ); - printf ("HU_Init: Setting up heads up display.\n"); HU_Init (); - printf ("ST_Init: Init status bar.\n"); ST_Init (); - - p = M_CheckParm ("-statcopy"); if (p && p<myargc-1) { - extern void* statcopy; - statcopy = (void*)atoi(myargv[p+1]); printf ("External statistics registered.\n"); } - - p = M_CheckParm ("-record"); - if (p && p < myargc-1) { G_RecordDemo (myargv[p+1]); autostart = true; } - p = M_CheckParm ("-playdemo"); if (p && p < myargc-1) { @@ -1138,14 +783,12 @@ void D_DoomMain (void) G_DeferedPlayDemo (myargv[p+1]); D_DoomLoop (); } - p = M_CheckParm ("-timedemo"); if (p && p < myargc-1) { G_TimeDemo (myargv[p+1]); D_DoomLoop (); } - p = M_CheckParm ("-loadgame"); if (p && p < myargc-1) { @@ -1155,16 +798,12 @@ void D_DoomMain (void) sprintf(file, SAVEGAMENAME"%c.dsg",myargv[p+1][0]); G_LoadGame (file); } - - if ( gameaction != ga_loadgame ) { if (autostart || netgame) G_InitNew (startskill, startepisode, startmap); else D_StartTitle (); - } - D_DoomLoop (); } diff --git a/src/d_main.h b/src/d_main.h @@ -1,64 +1,16 @@ - - - - - - - - - - - - - - - - - - - - - - - - #ifndef __D_MAIN__ #define __D_MAIN__ - #include "d_event.h" - #ifdef __GNUG__ #pragma interface #endif - - - #define MAXWADFILES 20 extern char* wadfiles[MAXWADFILES]; - void D_AddFile (char *file); - - - - - - - - - void D_DoomMain (void); - - void D_PostEvent (event_t* ev); - - - - - - void D_PageTicker (void); void D_PageDrawer (void); void D_AdvanceDemo (void); void D_StartTitle (void); - #endif diff --git a/src/d_net.c b/src/d_net.c @@ -1,30 +1,3 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - #include "m_menu.h" #include "i_system.h" #include "i_video.h" @@ -32,136 +5,82 @@ #include "g_game.h" #include "doomdef.h" #include "doomstat.h" - #define NCMD_EXIT 0x80000000 #define NCMD_RETRANSMIT 0x40000000 #define NCMD_SETUP 0x20000000 #define NCMD_KILL 0x10000000 #define NCMD_CHECKSUM 0x0fffffff - - doomcom_t* doomcom; doomdata_t* netbuffer; - - - - - - - - - - - #define RESENDCOUNT 10 #define PL_DRONE 0x80 - ticcmd_t localcmds[BACKUPTICS]; - ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS]; int nettics[MAXNETNODES]; boolean nodeingame[MAXNETNODES]; boolean remoteresend[MAXNETNODES]; int resendto[MAXNETNODES]; int resendcount[MAXNETNODES]; - int nodeforplayer[MAXPLAYERS]; - int maketic; int lastnettic; int skiptics; int ticdup; int maxsend; - - void D_ProcessEvents (void); void G_BuildTiccmd (ticcmd_t *cmd); void D_DoAdvanceDemo (void); - boolean reboundpacket; doomdata_t reboundstore; - - - - - - int NetbufferSize (void) { return (int)&(((doomdata_t *)0)->cmds[netbuffer->numtics]); } - - - - unsigned NetbufferChecksum (void) { unsigned c; int i,l; - c = 0x1234567; - - #ifdef NORMALUNIX return 0; #endif - l = (NetbufferSize () - (int)&(((doomdata_t *)0)->retransmitfrom))/4; for (i=0 ; i<l ; i++) c += ((unsigned *)&netbuffer->retransmitfrom)[i] * (i+1); - return c & NCMD_CHECKSUM; } - - - - int ExpandTics (int low) { int delta; - delta = low - (maketic&0xff); - if (delta >= -64 && delta <= 64) return (maketic&~0xff) + low; if (delta > 64) return (maketic&~0xff) - 256 + low; if (delta < -64) return (maketic&~0xff) + 256 + low; - I_Error ("ExpandTics: strange value %i at maketic %i",low,maketic); return 0; } - - - - - - void HSendPacket (int node, int flags ) { netbuffer->checksum = NetbufferChecksum () | flags; - if (!node) { reboundstore = *netbuffer; reboundpacket = true; return; } - if (demoplayback) return; - if (!netgame) I_Error ("Tried to transmit to another node"); - doomcom->command = CMD_SEND; doomcom->remotenode = node; doomcom->datalength = NetbufferSize (); - if (debugfile) { int i; @@ -170,24 +89,15 @@ HSendPacket realretrans = ExpandTics (netbuffer->retransmitfrom); else realretrans = -1; - fprintf (debugfile,"send (%i + %i, R %i) [%i] ", ExpandTics(netbuffer->starttic), netbuffer->numtics, realretrans, doomcom->datalength); - for (i=0 ; i<doomcom->datalength ; i++) fprintf (debugfile,"%i ",((byte *)netbuffer)[i]); - fprintf (debugfile,"\n"); } - I_NetCmd (); } - - - - - boolean HGetPacket (void) { if (reboundpacket) @@ -197,38 +107,30 @@ boolean HGetPacket (void) reboundpacket = false; return true; } - if (!netgame) return false; - if (demoplayback) return false; - doomcom->command = CMD_GET; I_NetCmd (); - if (doomcom->remotenode == -1) return false; - if (doomcom->datalength != NetbufferSize ()) { if (debugfile) fprintf (debugfile,"bad packet length %i\n",doomcom->datalength); return false; } - if (NetbufferChecksum () != (netbuffer->checksum&NCMD_CHECKSUM) ) { if (debugfile) fprintf (debugfile,"bad packet checksum\n"); return false; } - if (debugfile) { int realretrans; int i; - if (netbuffer->checksum & NCMD_SETUP) fprintf (debugfile,"setup packet\n"); else @@ -237,12 +139,10 @@ boolean HGetPacket (void) realretrans = ExpandTics (netbuffer->retransmitfrom); else realretrans = -1; - fprintf (debugfile,"get %i = (%i + %i, R %i)[%i] ", doomcom->remotenode, ExpandTics(netbuffer->starttic), netbuffer->numtics, realretrans, doomcom->datalength); - for (i=0 ; i<doomcom->datalength ; i++) fprintf (debugfile,"%i ",((byte *)netbuffer)[i]); fprintf (debugfile,"\n"); @@ -250,13 +150,7 @@ boolean HGetPacket (void) } return true; } - - - - - char exitmsg[80]; - void GetPackets (void) { int netconsole; @@ -264,21 +158,14 @@ void GetPackets (void) ticcmd_t *src, *dest; int realend; int realstart; - while ( HGetPacket() ) { if (netbuffer->checksum & NCMD_SETUP) continue; - netconsole = netbuffer->player & ~PL_DRONE; netnode = doomcom->remotenode; - - - realstart = ExpandTics (netbuffer->starttic); realend = (realstart+netbuffer->numtics); - - if (netbuffer->checksum & NCMD_EXIT) { if (!nodeingame[netnode]) @@ -292,14 +179,9 @@ void GetPackets (void) G_CheckDemoStatus (); continue; } - - if (netbuffer->checksum & NCMD_KILL) I_Error ("Killed by network driver"); - nodeforplayer[netconsole] = netnode; - - if ( resendcount[netnode] <= 0 && (netbuffer->checksum & NCMD_RETRANSMIT) ) { @@ -310,11 +192,8 @@ void GetPackets (void) } else resendcount[netnode]--; - - if (realend == nettics[netnode]) continue; - if (realend < nettics[netnode]) { if (debugfile) @@ -323,11 +202,8 @@ void GetPackets (void) realstart,netbuffer->numtics); continue; } - - if (realstart > nettics[netnode]) { - if (debugfile) fprintf (debugfile, "missed tics from %i (%i - %i)\n", @@ -335,16 +211,11 @@ void GetPackets (void) remoteresend[netnode] = true; continue; } - - { int start; - remoteresend[netnode] = false; - start = nettics[netnode] - realstart; src = &netbuffer->cmds[start]; - while (nettics[netnode] < realend) { dest = &netcmds[netconsole][nettics[netnode]%BACKUPTICS]; @@ -355,15 +226,7 @@ void GetPackets (void) } } } - - - - - - - int gametime; - void NetUpdate (void) { int nowtime; @@ -371,15 +234,11 @@ void NetUpdate (void) int i,j; int realstart; int gameticdiv; - - nowtime = I_GetTime ()/ticdup; newtics = nowtime - gametime; gametime = nowtime; - if (newtics <= 0) goto listen; - if (skiptics <= newtics) { newtics -= skiptics; @@ -390,11 +249,7 @@ void NetUpdate (void) skiptics -= newtics; newtics = 0; } - - netbuffer->player = consoleplayer; - - gameticdiv = gametic/ticdup; for (i=0 ; i<newtics ; i++) { @@ -402,17 +257,11 @@ void NetUpdate (void) D_ProcessEvents (); if (maketic - gameticdiv >= BACKUPTICS/2-1) break; - - G_BuildTiccmd (&localcmds[maketic%BACKUPTICS]); maketic++; } - - if (singletics) return; - - for (i=0 ; i<doomcom->numnodes ; i++) if (nodeingame[i]) { @@ -420,13 +269,10 @@ void NetUpdate (void) netbuffer->numtics = maketic - realstart; if (netbuffer->numtics > BACKUPTICS) I_Error ("NetUpdate: netbuffer->numtics > BACKUPTICS"); - resendto[i] = maketic - doomcom->extratics; - for (j=0 ; j< netbuffer->numtics ; j++) netbuffer->cmds[j] = localcmds[(realstart+j)%BACKUPTICS]; - if (remoteresend[i]) { netbuffer->retransmitfrom = nettics[i]; @@ -438,26 +284,16 @@ void NetUpdate (void) HSendPacket (i, 0); } } - - listen: GetPackets (); } - - - - - - void CheckAbort (void) { event_t *ev; int stoptic; - stoptic = I_GetTime () + 2; while (I_GetTime() < stoptic) I_StartTic (); - I_StartTic (); for ( ; eventtail != eventhead ; eventtail = (++eventtail)&(MAXEVENTS-1) ) @@ -467,22 +303,14 @@ void CheckAbort (void) I_Error ("Network game synchronization aborted."); } } - - - - - void D_ArbitrateNetStart (void) { int i; boolean gotinfo[MAXNETNODES]; - autostart = true; memset (gotinfo,0,sizeof(gotinfo)); - if (doomcom->consoleplayer) { - printf ("listening for network start info...\n"); while (1) { @@ -505,7 +333,6 @@ void D_ArbitrateNetStart (void) } else { - printf ("sending network start info...\n"); do { @@ -524,7 +351,6 @@ void D_ArbitrateNetStart (void) netbuffer->numtics = 0; HSendPacket (i, NCMD_SETUP); } - #if 1 for(i = 10 ; i && HGetPacket(); --i) { @@ -537,24 +363,16 @@ void D_ArbitrateNetStart (void) gotinfo[netbuffer->player&0x7f] = true; } #endif - for (i=1 ; i<doomcom->numnodes ; i++) if (!gotinfo[i]) break; } while (i < doomcom->numnodes); } } - - - - - extern int viewangleoffset; - void D_CheckNetGame (void) { int i; - for (i=0 ; i<MAXNETNODES ; i++) { nodeingame[i] = false; @@ -562,53 +380,33 @@ void D_CheckNetGame (void) remoteresend[i] = false; resendto[i] = 0; } - - I_InitNetwork (); if (doomcom->id != DOOMCOM_ID) I_Error ("Doomcom buffer invalid!"); - netbuffer = &doomcom->data; consoleplayer = displayplayer = doomcom->consoleplayer; if (netgame) D_ArbitrateNetStart (); - printf ("startskill %i deathmatch: %i startmap: %i startepisode: %i\n", startskill, deathmatch, startmap, startepisode); - - ticdup = doomcom->ticdup; maxsend = BACKUPTICS/(2*ticdup)-1; if (maxsend<1) maxsend = 1; - for (i=0 ; i<doomcom->numplayers ; i++) playeringame[i] = true; for (i=0 ; i<doomcom->numnodes ; i++) nodeingame[i] = true; - printf ("player %i of %i (%i nodes)\n", consoleplayer+1, doomcom->numplayers, doomcom->numnodes); - } - - - - - - - void D_QuitNetGame (void) { int i, j; - if (debugfile) fclose (debugfile); - if (!netgame || !usergame || consoleplayer == -1 || demoplayback) return; - - netbuffer->player = consoleplayer; netbuffer->numtics = 0; for (i=0 ; i<4 ; i++) @@ -619,19 +417,11 @@ void D_QuitNetGame (void) I_WaitVBL (1); } } - - - - - - int frametics[4]; int frameon; int frameskip[4]; int oldnettics; - extern boolean advancedemo; - void TryRunTics (void) { int i; @@ -642,15 +432,10 @@ void TryRunTics (void) int availabletics; int counts; int numplaying; - - entertic = I_GetTime ()/ticdup; realtics = entertic - oldentertics; oldentertics = entertic; - - NetUpdate (); - lowtic = MAXINT; numplaying = 0; for (i=0 ; i<doomcom->numnodes ; i++) @@ -663,75 +448,56 @@ void TryRunTics (void) } } availabletics = lowtic - gametic/ticdup; - - if (realtics < availabletics-1) counts = realtics+1; else if (realtics < availabletics) counts = realtics; else counts = availabletics; - if (counts < 1) counts = 1; - frameon++; - if (debugfile) fprintf (debugfile, "=======real: %i avail: %i game: %i\n", realtics, availabletics,counts); - if (!demoplayback) { - - for (i=0 ; i<MAXPLAYERS ; i++) if (playeringame[i]) break; if (consoleplayer == i) { - } else { if (nettics[0] <= nettics[nodeforplayer[i]]) { gametime--; - } frameskip[frameon&3] = (oldnettics > nettics[nodeforplayer[i]]); oldnettics = nettics[0]; if (frameskip[0] && frameskip[1] && frameskip[2] && frameskip[3]) { skiptics = 1; - } } } - - while (lowtic < gametic/ticdup + counts) { NetUpdate (); lowtic = MAXINT; - for (i=0 ; i<doomcom->numnodes ; i++) if (nodeingame[i] && nettics[i] < lowtic) lowtic = nettics[i]; - if (lowtic < gametic/ticdup) I_Error ("TryRunTics: lowtic < gametic"); - - if (I_GetTime ()/ticdup - entertic >= 20) { M_Ticker (); return; } } - - while (counts--) { for (i=0 ; i<ticdup ; i++) @@ -743,14 +509,11 @@ void TryRunTics (void) M_Ticker (); G_Ticker (); gametic++; - - if (i != ticdup-1) { ticcmd_t *cmd; int buf; int j; - buf = (gametic/ticdup)%BACKUPTICS; for (j=0 ; j<MAXPLAYERS ; j++) { diff --git a/src/d_net.h b/src/d_net.h @@ -1,149 +1,48 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __D_NET__ #define __D_NET__ - #include "d_player.h" - - #ifdef __GNUG__ #pragma interface #endif - - - - - - - - - - #define DOOMCOM_ID 0x12345678l - - #define MAXNETNODES 8 - - - #define BACKUPTICS 12 - typedef enum { CMD_SEND = 1, CMD_GET = 2 - } command_t; - - - - - typedef struct { - unsigned checksum; - byte retransmitfrom; - byte starttic; byte player; byte numtics; ticcmd_t cmds[BACKUPTICS]; - } doomdata_t; - - - - typedef struct { - long id; - - short intnum; - - short command; - short remotenode; - - short datalength; - - - short numnodes; - short ticdup; - short extratics; - short deathmatch; - short savegame; short episode; short map; short skill; - - short consoleplayer; short numplayers; - - - - - - - short angleoffset; - short drone; - - doomdata_t data; - } doomcom_t; - - - - void NetUpdate (void); - - - void D_QuitNetGame (void); - - void TryRunTics (void); - - #endif - - - - - - - diff --git a/src/d_player.h b/src/d_player.h @@ -1,219 +1,84 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __D_PLAYER__ #define __D_PLAYER__ - - - - - - #include "d_items.h" #include "p_pspr.h" - - - #include "p_mobj.h" - - - - #include "d_ticcmd.h" - #ifdef __GNUG__ #pragma interface #endif - - - - - - - typedef enum { - PST_LIVE, - PST_DEAD, - PST_REBORN - } playerstate_t; - - - - - typedef enum { - CF_NOCLIP = 1, - CF_GODMODE = 2, - CF_NOMOMENTUM = 4 - } cheat_t; - - - - - typedef struct player_s { mobj_t* mo; playerstate_t playerstate; ticcmd_t cmd; - - - - fixed_t viewz; - fixed_t viewheight; - fixed_t deltaviewheight; - fixed_t bob; - - - int health; int armorpoints; - int armortype; - - int powers[NUMPOWERS]; boolean cards[NUMCARDS]; boolean backpack; - - int frags[MAXPLAYERS]; weapontype_t readyweapon; - - weapontype_t pendingweapon; - boolean weaponowned[NUMWEAPONS]; int ammo[NUMAMMO]; int maxammo[NUMAMMO]; - - int attackdown; int usedown; - - - int cheats; - - int refire; - - int killcount; int itemcount; int secretcount; - - char* message; - - int damagecount; int bonuscount; - - mobj_t* attacker; - - int extralight; - - - int fixedcolormap; - - - int colormap; - - pspdef_t psprites[NUMPSPRITES]; - - boolean didsecret; - } player_t; - - - - - - typedef struct { boolean in; - - int skills; int sitems; int ssecret; int stime; int frags[4]; int score; - } wbplayerstruct_t; - typedef struct { int epsd; - - boolean didsecret; - - int last; int next; - int maxkills; int maxitems; int maxsecret; int maxfrags; - - int partime; - - int pnum; - wbplayerstruct_t plyr[MAXPLAYERS]; - } wbstartstruct_t; - - #endif - - - - - diff --git a/src/d_textur.h b/src/d_textur.h @@ -1,51 +1,10 @@ - - - - - - - - - - - - - - - - - - - - - - - #ifndef __D_TEXTUR__ #define __D_TEXTUR__ - #include "doomtype.h" - - - - - - - - typedef struct { byte width; byte height; byte data; } pic_t; - - - - #endif - - - - - diff --git a/src/d_think.h b/src/d_think.h @@ -1,79 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - - - - #ifndef __D_THINK__ #define __D_THINK__ - - #ifdef __GNUG__ #pragma interface #endif - - - - - - - - - typedef void (*actionf_v)(); typedef void (*actionf_p1)( void* ); typedef void (*actionf_p2)( void*, void* ); - typedef union { actionf_p1 acp1; actionf_v acv; actionf_p2 acp2; - } actionf_t; - - - - - - - - typedef actionf_t think_t; - - - typedef struct thinker_s { struct thinker_s* prev; struct thinker_s* next; think_t function; - } thinker_t; - - - #endif - - - - - diff --git a/src/d_ticcmd.h b/src/d_ticcmd.h @@ -1,38 +1,9 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __D_TICCMD__ #define __D_TICCMD__ - #include "doomtype.h" - #ifdef __GNUG__ #pragma interface #endif - - - - - typedef struct { char forwardmove; @@ -42,12 +13,4 @@ typedef struct byte chatchar; byte buttons; } ticcmd_t; - - - #endif - - - - - diff --git a/src/doomdata.h b/src/doomdata.h @@ -1,45 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - #ifndef __DOOMDATA__ #define __DOOMDATA__ - - #include "doomtype.h" - - #include "doomdef.h" - - - - - - - - - - - enum { ML_LABEL, @@ -54,18 +16,11 @@ enum ML_REJECT, ML_BLOCKMAP }; - - - typedef struct { short x; short y; } mapvertex_t; - - - - typedef struct { short textureoffset; @@ -73,14 +28,8 @@ typedef struct char toptexture[8]; char bottomtexture[8]; char midtexture[8]; - short sector; } mapsidedef_t; - - - - - typedef struct { short v1; @@ -88,56 +37,17 @@ typedef struct short flags; short special; short tag; - short sidenum[2]; } maplinedef_t; - - - - - - - #define ML_BLOCKING 1 - - #define ML_BLOCKMONSTERS 2 - - - #define ML_TWOSIDED 4 - - - - - - - - - - - #define ML_DONTPEGTOP 8 - - #define ML_DONTPEGBOTTOM 16 - - #define ML_SECRET 32 - - #define ML_SOUNDBLOCK 64 - - #define ML_DONTDRAW 128 - - #define ML_MAPPED 256 - - - - - typedef struct { short floorheight; @@ -148,18 +58,11 @@ typedef struct short special; short tag; } mapsector_t; - - typedef struct { short numsegs; - short firstseg; } mapsubsector_t; - - - - typedef struct { short v1; @@ -169,37 +72,16 @@ typedef struct short side; short offset; } mapseg_t; - - - - - - #define NF_SUBSECTOR 0x8000 - typedef struct { - short x; short y; short dx; short dy; - - - short bbox[2][4]; - - - unsigned short children[2]; - } mapnode_t; - - - - - - typedef struct { short x; @@ -208,15 +90,4 @@ typedef struct short type; short options; } mapthing_t; - - - - - #endif - - - - - - diff --git a/src/doomdef.c b/src/doomdef.c @@ -1,36 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - #ifdef __GNUG__ #pragma implementation "doomdef.h" #endif #include "doomdef.h" - - - - - - diff --git a/src/doomdef.h b/src/doomdef.h @@ -1,53 +1,16 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __DOOMDEF__ #define __DOOMDEF__ - #include <stdio.h> #include <string.h> - - - - - enum { VERSION = 110 }; - - - - typedef enum { shareware, registered, commercial, - retail, indetermined - } GameMode_t; - - - typedef enum { doom, @@ -55,75 +18,23 @@ typedef enum pack_tnt, pack_plut, none - } GameMission_t; - - - typedef enum { english, french, german, unknown - } Language_t; - - - - #define RANGECHECK - - - - - - - - #define SNDSERV 1 - - - - - - - - - - - - - #define BASE_WIDTH 320 - - - - - #define SCREEN_MUL 1 #define INV_ASPECT_RATIO 0.625 - - - - #define SCREENWIDTH 320 - #define SCREENHEIGHT 200 - - - - - - #define MAXPLAYERS 4 - - #define TICRATE 35 - - - - typedef enum { GS_LEVEL, @@ -131,19 +42,10 @@ typedef enum GS_FINALE, GS_DEMOSCREEN } gamestate_t; - - - - - - #define MTF_EASY 1 #define MTF_NORMAL 2 #define MTF_HARD 4 - - #define MTF_AMBUSH 8 - typedef enum { sk_baby, @@ -152,13 +54,6 @@ typedef enum sk_hard, sk_nightmare } skill_t; - - - - - - - typedef enum { it_bluecard, @@ -167,16 +62,8 @@ typedef enum it_blueskull, it_yellowskull, it_redskull, - NUMCARDS - } card_t; - - - - - - typedef enum { wp_fist, @@ -188,16 +75,9 @@ typedef enum wp_bfg, wp_chainsaw, wp_supershotgun, - NUMWEAPONS, - - wp_nochange - } weapontype_t; - - - typedef enum { am_clip, @@ -206,11 +86,7 @@ typedef enum am_misl, NUMAMMO, am_noammo - } ammotype_t; - - - typedef enum { pw_invulnerability, @@ -220,33 +96,14 @@ typedef enum pw_allmap, pw_infrared, NUMPOWERS - } powertype_t; - - - - - - - - typedef enum { INVULNTICS = (30*TICRATE), INVISTICS = (60*TICRATE), INFRATICS = (120*TICRATE), IRONTICS = (60*TICRATE) - } powerduration_t; - - - - - - - - - #define KEY_RIGHTARROW 0xae #define KEY_LEFTARROW 0xac #define KEY_UPARROW 0xad @@ -266,73 +123,12 @@ typedef enum #define KEY_F10 (0x80+0x44) #define KEY_F11 (0x80+0x57) #define KEY_F12 (0x80+0x58) - #define KEY_BACKSPACE 127 #define KEY_PAUSE 0xff - #define KEY_EQUALS 0x3d #define KEY_MINUS 0x2d - #define KEY_RSHIFT (0x80+0x36) #define KEY_RCTRL (0x80+0x1d) #define KEY_RALT (0x80+0x38) - #define KEY_LALT KEY_RALT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #endif - - - - - diff --git a/src/doomstat.c b/src/doomstat.c @@ -1,5 +1,4 @@ #include "doomstat.h" - GameMode_t gamemode = indetermined; GameMission_t gamemission = doom; Language_t language = english; diff --git a/src/doomstat.h b/src/doomstat.h @@ -1,296 +1,83 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - #ifndef __D_STATE__ #define __D_STATE__ - - - #include "doomdata.h" #include "d_net.h" - - #include "d_player.h" - - #ifdef __GNUG__ #pragma interface #endif - - - - - - extern boolean nomonsters; extern boolean respawnparm; extern boolean fastparm; - extern boolean devparm; - - - - - - extern GameMode_t gamemode; extern GameMission_t gamemission; - - extern boolean modifiedgame; - - - - extern Language_t language; - - - - - - - extern skill_t startskill; extern int startepisode; extern int startmap; - extern boolean autostart; - - extern skill_t gameskill; extern int gameepisode; extern int gamemap; - - extern boolean respawnmonsters; - - extern boolean netgame; - - - extern boolean deathmatch; - - - - - - - - - - - - extern int snd_SfxVolume; extern int snd_MusicVolume; - - - - - extern int snd_MusicDevice; extern int snd_SfxDevice; - extern int snd_DesiredMusicDevice; extern int snd_DesiredSfxDevice; - - - - - - - - - extern boolean statusbaractive; - extern boolean automapactive; extern boolean menuactive; extern boolean paused; - - extern boolean viewactive; - extern boolean nodrawers; extern boolean noblit; - extern int viewwindowx; extern int viewwindowy; extern int viewheight; extern int viewwidth; extern int scaledviewwidth; - - - - - - - - extern int viewangleoffset; - - extern int consoleplayer; extern int displayplayer; - - - - - - extern int totalkills; extern int totalitems; extern int totalsecret; - - extern int levelstarttic; extern int leveltime; - - - - - - - extern boolean usergame; - - extern boolean demoplayback; extern boolean demorecording; - - extern boolean singledemo; - - - - - extern gamestate_t gamestate; - - - - - - - - - - - - - - extern int gametic; - - - extern player_t players[MAXPLAYERS]; - - extern boolean playeringame[MAXPLAYERS]; - - - #define MAX_DM_STARTS 10 extern mapthing_t deathmatchstarts[MAX_DM_STARTS]; extern mapthing_t* deathmatch_p; - - extern mapthing_t playerstarts[MAXPLAYERS]; - - - extern wbstartstruct_t wminfo; - - - - extern int maxammo[NUMAMMO]; - - - - - - - - - - extern char basedefault[1024]; extern FILE* debugfile; - - extern boolean precache; - - - - extern gamestate_t wipegamestate; - extern int mouseSensitivity; - - extern boolean singletics; - extern int bodyqueslot; - - - - - - extern int skyflatnum; - - - - - - extern doomcom_t* doomcom; - - extern doomdata_t* netbuffer; - - extern ticcmd_t localcmds[BACKUPTICS]; extern int rndindex; - extern int maketic; extern int nettics[MAXNETNODES]; - extern ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS]; extern int ticdup; - - - #endif - - - - - diff --git a/src/doomtype.h b/src/doomtype.h @@ -1,12 +1,9 @@ #ifndef __DOOMTYPE__ #define __DOOMTYPE__ - #ifndef __BYTEBOOL__ #define __BYTEBOOL__ typedef enum {false, true} boolean; typedef unsigned char byte; #endif - #include <values.h> - #endif diff --git a/src/dstrings.c b/src/dstrings.c @@ -1,5 +1,4 @@ #include "dstrings.h" - char* endmsg[NUM_QUITMESSAGES+1] = { QUITMSG, "please don't leave, there's more\ndemons to toast!", diff --git a/src/dstrings.h b/src/dstrings.h @@ -1,66 +1,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - #ifndef __DSTRINGS__ #define __DSTRINGS__ - - - - - - #ifdef FRENCH #include "d_french.h" #else #include "d_englsh.h" #endif - - #define SAVEGAMENAME "doomsav" - - - - - - - #define DEVMAPS "devmaps" #define DEVDATA "devdata" - - - - - #define NUM_QUITMESSAGES 22 - extern char* endmsg[]; - - #endif - - - - - diff --git a/src/f_finale.c b/src/f_finale.c @@ -1,116 +1,59 @@ - - - - - - - - - - - - - - - - - - - - - - - - - #include <ctype.h> - - #include "i_system.h" #include "m_swap.h" #include "z_zone.h" #include "v_video.h" #include "w_wad.h" #include "s_sound.h" - - #include "dstrings.h" #include "sounds.h" - #include "doomstat.h" #include "r_state.h" - - - - - - - - int finalestage; - int finalecount; - #define TEXTSPEED 3 #define TEXTWAIT 250 - char* e1text = E1TEXT; char* e2text = E2TEXT; char* e3text = E3TEXT; char* e4text = E4TEXT; - char* c1text = C1TEXT; char* c2text = C2TEXT; char* c3text = C3TEXT; char* c4text = C4TEXT; char* c5text = C5TEXT; char* c6text = C6TEXT; - char* p1text = P1TEXT; char* p2text = P2TEXT; char* p3text = P3TEXT; char* p4text = P4TEXT; char* p5text = P5TEXT; char* p6text = P6TEXT; - char* t1text = T1TEXT; char* t2text = T2TEXT; char* t3text = T3TEXT; char* t4text = T4TEXT; char* t5text = T5TEXT; char* t6text = T6TEXT; - char* finaletext; char* finaleflat; - void F_StartCast (void); void F_CastTicker (void); boolean F_CastResponder (event_t *ev); void F_CastDrawer (void); - - - - void F_StartFinale (void) { gameaction = ga_nothing; gamestate = GS_FINALE; viewactive = false; automapactive = false; - - - - switch ( gamemode ) { - - case shareware: case registered: case retail: { S_ChangeMusic(mus_victor, true); - switch (gameepisode) { case 1: @@ -130,17 +73,13 @@ void F_StartFinale (void) finaletext = e4text; break; default: - break; } break; } - - case commercial: { S_ChangeMusic(mus_read_m, true); - switch (gamemap) { case 6: @@ -168,53 +107,34 @@ void F_StartFinale (void) finaletext = c6text; break; default: - break; } break; } - - - default: S_ChangeMusic(mus_read_m, true); finaleflat = "F_SKY1"; finaletext = c1text; break; } - finalestage = 0; finalecount = 0; - } - - - boolean F_Responder (event_t *event) { if (finalestage == 2) return F_CastResponder (event); - return false; } - - - - - void F_Ticker (void) { int i; - - if ( (gamemode == commercial) && ( finalecount > 50) ) { - for (i=0 ; i<MAXPLAYERS ; i++) if (players[i].cmd.buttons) break; - if (i < MAXPLAYERS) { if (gamemap == 30) @@ -223,19 +143,14 @@ void F_Ticker (void) gameaction = ga_worlddone; } } - - finalecount++; - if (finalestage == 2) { F_CastTicker (); return; } - if ( gamemode == commercial) return; - if (!finalestage && finalecount>strlen (finaletext)*TEXTSPEED + TEXTWAIT) { finalecount = 0; @@ -245,33 +160,20 @@ void F_Ticker (void) S_StartMusic (mus_bunny); } } - - - - - - - #include "hu_stuff.h" extern patch_t *hu_font[HU_FONTSIZE]; - - void F_TextWrite (void) { byte* src; byte* dest; - int x,y,w; int count; char* ch; int c; int cx; int cy; - - src = W_CacheLumpName ( finaleflat , PU_CACHE); dest = screens[0]; - for (y=0 ; y<SCREENHEIGHT ; y++) { for (x=0 ; x<SCREENWIDTH/64 ; x++) @@ -285,14 +187,10 @@ void F_TextWrite (void) dest += (SCREENWIDTH&63); } } - V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT); - - cx = 10; cy = 10; ch = finaletext; - count = (finalecount - 10)/TEXTSPEED; if (count < 0) count = 0; @@ -307,34 +205,24 @@ void F_TextWrite (void) cy += 11; continue; } - c = toupper(c) - HU_FONTSTART; if (c < 0 || c> HU_FONTSIZE) { cx += 4; continue; } - w = SHORT (hu_font[c]->width); if (cx+w > SCREENWIDTH) break; V_DrawPatch(cx, cy, 0, hu_font[c]); cx+=w; } - } - - - - - - typedef struct { char *name; mobjtype_t type; } castinfo_t; - castinfo_t castorder[] = { {CC_ZOMBIE, MT_POSSESSED}, {CC_SHOTGUN, MT_SHOTGUY}, @@ -353,10 +241,8 @@ castinfo_t castorder[] = { {CC_SPIDER, MT_SPIDER}, {CC_CYBER, MT_CYBORG}, {CC_HERO, MT_PLAYER}, - {NULL,0} }; - int castnum; int casttics; state_t* caststate; @@ -364,14 +250,7 @@ boolean castdeath; int castframes; int castonmelee; boolean castattacking; - - - - - extern gamestate_t wipegamestate; - - void F_StartCast (void) { wipegamestate = -1; @@ -385,22 +264,14 @@ void F_StartCast (void) castattacking = false; S_ChangeMusic(mus_evil, true); } - - - - - void F_CastTicker (void) { int st; int sfx; - if (--casttics > 0) return; - if (caststate->tics == -1 || caststate->nextstate == S_NULL) { - castnum++; castdeath = false; if (castorder[castnum].name == NULL) @@ -412,14 +283,11 @@ void F_CastTicker (void) } else { - if (caststate == &states[S_PLAY_ATK1]) goto stopattack; st = caststate->nextstate; caststate = &states[st]; castframes++; - - switch (st) { case S_PLAY_ATK1: sfx = sfx_dshtgn; break; @@ -450,14 +318,11 @@ void F_CastTicker (void) case S_PAIN_ATK3: sfx = sfx_sklatk; break; default: sfx = 0; break; } - if (sfx) S_StartSound (NULL, sfx); } - if (castframes == 12) { - castattacking = true; if (castonmelee) caststate=&states[mobjinfo[castorder[castnum].type].meleestate]; @@ -474,7 +339,6 @@ void F_CastTicker (void) &states[mobjinfo[castorder[castnum].type].missilestate]; } } - if (castattacking) { if (castframes == 24 @@ -486,26 +350,16 @@ void F_CastTicker (void) caststate = &states[mobjinfo[castorder[castnum].type].seestate]; } } - casttics = caststate->tics; if (casttics == -1) casttics = 15; } - - - - - - boolean F_CastResponder (event_t* ev) { if (ev->type != ev_keydown) return false; - if (castdeath) return true; - - castdeath = true; caststate = &states[mobjinfo[castorder[castnum].type].deathstate]; casttics = caststate->tics; @@ -513,11 +367,8 @@ boolean F_CastResponder (event_t* ev) castattacking = false; if (mobjinfo[castorder[castnum].type].deathsound) S_StartSound (NULL, mobjinfo[castorder[castnum].type].deathsound); - return true; } - - void F_CastPrint (char* text) { char* ch; @@ -525,11 +376,8 @@ void F_CastPrint (char* text) int cx; int w; int width; - - ch = text; width = 0; - while (ch) { c = *ch++; @@ -541,12 +389,9 @@ void F_CastPrint (char* text) width += 4; continue; } - w = SHORT (hu_font[c]->width); width += w; } - - cx = 160-width/2; ch = text; while (ch) @@ -560,20 +405,12 @@ void F_CastPrint (char* text) cx += 4; continue; } - w = SHORT (hu_font[c]->width); V_DrawPatch(cx, 180, 0, hu_font[c]); cx+=w; } - } - - - - - void V_DrawPatchFlipped (int x, int y, int scrn, patch_t *patch); - void F_CastDrawer (void) { spritedef_t* sprdef; @@ -581,29 +418,18 @@ void F_CastDrawer (void) int lump; boolean flip; patch_t* patch; - - V_DrawPatch (0,0,0, W_CacheLumpName ("BOSSBACK", PU_CACHE)); - F_CastPrint (castorder[castnum].name); - - sprdef = &sprites[caststate->sprite]; sprframe = &sprdef->spriteframes[ caststate->frame & FF_FRAMEMASK]; lump = sprframe->lump[0]; flip = (boolean)sprframe->flip[0]; - patch = W_CacheLumpNum (lump+firstspritelump, PU_CACHE); if (flip) V_DrawPatchFlipped (160,170,0,patch); else V_DrawPatch (160,170,0,patch); } - - - - - void F_DrawPatchCol ( int x, @@ -615,17 +441,13 @@ F_DrawPatchCol byte* dest; byte* desttop; int count; - column = (column_t *)((byte *)patch + LONG(patch->columnofs[col])); desttop = screens[0]+x; - - while (column->topdelta != 0xff ) { source = (byte *)column + 3; dest = desttop + column->topdelta*SCREENWIDTH; count = column->length; - while (count--) { *dest = *source++; @@ -634,11 +456,6 @@ F_DrawPatchCol column = (column_t *)( (byte *)column + column->length + 4 ); } } - - - - - void F_BunnyScroll (void) { int scrolled; @@ -648,18 +465,14 @@ void F_BunnyScroll (void) char name[10]; int stage; static int laststage; - p1 = W_CacheLumpName ("PFUB2", PU_LEVEL); p2 = W_CacheLumpName ("PFUB1", PU_LEVEL); - V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT); - scrolled = 320 - (finalecount-230)/2; if (scrolled > 320) scrolled = 320; if (scrolled < 0) scrolled = 0; - for ( x=0 ; x<SCREENWIDTH ; x++) { if (x+scrolled < 320) @@ -667,7 +480,6 @@ void F_BunnyScroll (void) else F_DrawPatchCol (x, p2, x+scrolled - 320); } - if (finalecount < 1130) return; if (finalecount < 1180) @@ -677,7 +489,6 @@ void F_BunnyScroll (void) laststage = 0; return; } - stage = (finalecount-1180) / 5; if (stage > 6) stage = 6; @@ -686,15 +497,9 @@ void F_BunnyScroll (void) S_StartSound (NULL, sfx_pistol); laststage = stage; } - sprintf (name,"END%i",stage); V_DrawPatch ((SCREENWIDTH-13*8)/2, (SCREENHEIGHT-8*8)/2,0, W_CacheLumpName (name,PU_CACHE)); } - - - - - void F_Drawer (void) { if (finalestage == 2) @@ -702,7 +507,6 @@ void F_Drawer (void) F_CastDrawer (); return; } - if (!finalestage) F_TextWrite (); else @@ -730,7 +534,4 @@ void F_Drawer (void) break; } } - } - - diff --git a/src/f_finale.h b/src/f_finale.h @@ -1,53 +1,9 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __F_FINALE__ #define __F_FINALE__ - - #include "doomtype.h" #include "d_event.h" - - - - - boolean F_Responder (event_t* ev); - - void F_Ticker (void); - - void F_Drawer (void); - - void F_StartFinale (void); - - - - #endif - - - - - diff --git a/src/f_wipe.c b/src/f_wipe.c @@ -1,51 +1,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - #include "z_zone.h" #include "i_video.h" #include "v_video.h" #include "m_random.h" - #include "doomdef.h" - #include "f_wipe.h" - - - - - - static boolean go = 0; - static byte* wipe_scr_start; static byte* wipe_scr_end; static byte* wipe_scr; - - void wipe_shittyColMajorXform ( short* array, @@ -55,19 +17,13 @@ wipe_shittyColMajorXform int x; int y; short* dest; - dest = (short*) Z_Malloc(width*height*2, PU_STATIC, 0); - for(y=0;y<height;y++) for(x=0;x<width;x++) dest[x*height+y] = array[y*width+x]; - memcpy(array, dest, width*height*2); - Z_Free(dest); - } - int wipe_initColorXForm ( int width, @@ -77,7 +33,6 @@ wipe_initColorXForm memcpy(wipe_scr, wipe_scr_start, width*height); return 0; } - int wipe_doColorXForm ( int width, @@ -88,11 +43,9 @@ wipe_doColorXForm byte* w; byte* e; int newval; - changed = false; w = wipe_scr; e = wipe_scr_end; - while (w!=wipe_scr+width*height) { if (*w != *e) @@ -119,11 +72,8 @@ wipe_doColorXForm w++; e++; } - return !changed; - } - int wipe_exitColorXForm ( int width, @@ -132,10 +82,7 @@ wipe_exitColorXForm { return 0; } - - static int* y; - int wipe_initMelt ( int width, @@ -143,17 +90,9 @@ wipe_initMelt int ticks ) { int i, r; - - memcpy(wipe_scr, wipe_scr_start, width*height); - - - wipe_shittyColMajorXform((short*)wipe_scr_start, width/2, height); wipe_shittyColMajorXform((short*)wipe_scr_end, width/2, height); - - - y = (int *) Z_Malloc(width*sizeof(int), PU_STATIC, 0); y[0] = -(M_Random()%16); for (i=1;i<width;i++) @@ -163,10 +102,8 @@ wipe_initMelt if (y[i] > 0) y[i] = 0; else if (y[i] == -16) y[i] = -15; } - return 0; } - int wipe_doMelt ( int width, @@ -177,13 +114,10 @@ wipe_doMelt int j; int dy; int idx; - short* s; short* d; boolean done = true; - width/=2; - while (ticks--) { for (i=0;i<width;i++) @@ -217,11 +151,8 @@ wipe_doMelt } } } - return done; - } - int wipe_exitMelt ( int width, @@ -231,7 +162,6 @@ wipe_exitMelt Z_Free(y); return 0; } - int wipe_StartScreen ( int x, @@ -243,7 +173,6 @@ wipe_StartScreen I_ReadScreen(wipe_scr_start); return 0; } - int wipe_EndScreen ( int x, @@ -256,7 +185,6 @@ wipe_EndScreen V_DrawBlock(x, y, 0, width, height, wipe_scr_start); return 0; } - int wipe_ScreenWipe ( int wipeno, @@ -272,30 +200,19 @@ wipe_ScreenWipe wipe_initColorXForm, wipe_doColorXForm, wipe_exitColorXForm, wipe_initMelt, wipe_doMelt, wipe_exitMelt }; - void V_MarkRect(int, int, int, int); - - if (!go) { go = 1; - wipe_scr = screens[0]; (*wipes[wipeno*3])(width, height, ticks); } - - V_MarkRect(0, 0, width, height); rc = (*wipes[wipeno*3+1])(width, height, ticks); - - - if (rc) { go = 0; (*wipes[wipeno*3+2])(width, height, ticks); } - return !go; - } diff --git a/src/f_wipe.h b/src/f_wipe.h @@ -1,59 +1,23 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __F_WIPE_H__ #define __F_WIPE_H__ - - - - - enum { - wipe_ColorXForm, - - wipe_Melt, - wipe_NUMWIPES }; - int wipe_StartScreen ( int x, int y, int width, int height ); - - int wipe_EndScreen ( int x, int y, int width, int height ); - - int wipe_ScreenWipe ( int wipeno, @@ -62,10 +26,4 @@ wipe_ScreenWipe int width, int height, int ticks ); - #endif - - - - - diff --git a/src/g_game.c b/src/g_game.c @@ -1,33 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - #include <string.h> #include <stdlib.h> - #include "doomdef.h" #include "doomstat.h" - #include "z_zone.h" #include "f_finale.h" #include "m_argv.h" @@ -35,53 +9,31 @@ #include "m_menu.h" #include "m_random.h" #include "i_system.h" - #include "p_setup.h" #include "p_saveg.h" #include "p_tick.h" - #include "d_main.h" - #include "wi_stuff.h" #include "hu_stuff.h" #include "st_stuff.h" #include "am_map.h" - - #include "v_video.h" - #include "w_wad.h" - #include "p_local.h" - #include "s_sound.h" - - #include "dstrings.h" #include "sounds.h" - - #include "r_data.h" #include "r_sky.h" - - - #include "g_game.h" - - #define SAVEGAMESIZE 0x2c000 #define SAVESTRINGSIZE 24 - - - boolean G_CheckDemoStatus (void); void G_ReadDemoTiccmd (ticcmd_t* cmd); void G_WriteDemoTiccmd (ticcmd_t* cmd); void G_PlayerReborn (int player); void G_InitNew (skill_t skill, int episode, int map); - void G_DoReborn (int playernum); - void G_DoLoadLevel (void); void G_DoNewGame (void); void G_DoLoadGame (void); @@ -90,38 +42,30 @@ void G_DoCompleted (void); void G_DoVictory (void); void G_DoWorldDone (void); void G_DoSaveGame (void); - - gameaction_t gameaction; gamestate_t gamestate; skill_t gameskill; boolean respawnmonsters; int gameepisode; int gamemap; - boolean paused; boolean sendpause; boolean sendsave; boolean usergame; - boolean timingdemo; boolean nodrawers; boolean noblit; int starttime; - boolean viewactive; - boolean deathmatch; boolean netgame; boolean playeringame[MAXPLAYERS]; player_t players[MAXPLAYERS]; - int consoleplayer; int displayplayer; int gametic; int levelstarttic; int totalkills, totalitems, totalsecret; - char demoname[32]; boolean demorecording; boolean demoplayback; @@ -130,22 +74,12 @@ byte* demobuffer; byte* demo_p; byte* demoend; boolean singledemo; - boolean precache = true; - wbstartstruct_t wminfo; - short consistancy[MAXPLAYERS][BACKUPTICS]; - byte* savebuffer; - - - - - int key_right; int key_left; - int key_up; int key_down; int key_strafeleft; @@ -154,84 +88,50 @@ int key_fire; int key_use; int key_strafe; int key_speed; - int mousebfire; int mousebstrafe; int mousebforward; - int joybfire; int joybstrafe; int joybuse; int joybspeed; - - - #define MAXPLMOVE (forwardmove[1]) - #define TURBOTHRESHOLD 0x32 - fixed_t forwardmove[2] = {0x19, 0x32}; fixed_t sidemove[2] = {0x18, 0x28}; fixed_t angleturn[3] = {640, 1280, 320}; - #define SLOWTURNTICS 6 - #define NUMKEYS 256 - boolean gamekeydown[NUMKEYS]; int turnheld; - boolean mousearray[4]; boolean* mousebuttons = &mousearray[1]; - - int mousex; int mousey; - int dclicktime; int dclickstate; int dclicks; int dclicktime2; int dclickstate2; int dclicks2; - - int joyxmove; int joyymove; boolean joyarray[5]; boolean* joybuttons = &joyarray[1]; - int savegameslot; char savedescription[32]; - - #define BODYQUESIZE 32 - mobj_t* bodyque[BODYQUESIZE]; int bodyqueslot; - void* statcopy; - - - int G_CmdChecksum (ticcmd_t* cmd) { int i; int sum = 0; - for (i=0 ; i< sizeof(*cmd)/4 - 1 ; i++) sum += ((int *)cmd)[i]; - return sum; } - - - - - - - - void G_BuildTiccmd (ticcmd_t* cmd) { int i; @@ -241,24 +141,15 @@ void G_BuildTiccmd (ticcmd_t* cmd) int tspeed; int forward; int side; - ticcmd_t* base; - base = I_BaseTiccmd (); memcpy (cmd,base,sizeof(*cmd)); - cmd->consistancy = consistancy[consoleplayer][maketic%BACKUPTICS]; - - strafe = gamekeydown[key_strafe] || mousebuttons[mousebstrafe] || joybuttons[joybstrafe]; speed = gamekeydown[key_speed] || joybuttons[joybspeed]; - forward = side = 0; - - - if (joyxmove < 0 || joyxmove > 0 || gamekeydown[key_right] @@ -266,30 +157,24 @@ void G_BuildTiccmd (ticcmd_t* cmd) turnheld += ticdup; else turnheld = 0; - if (turnheld < SLOWTURNTICS) tspeed = 2; else tspeed = speed; - - if (strafe) { if (gamekeydown[key_right]) { - side += sidemove[speed]; } if (gamekeydown[key_left]) { - side -= sidemove[speed]; } if (joyxmove > 0) side += sidemove[speed]; if (joyxmove < 0) side -= sidemove[speed]; - } else { @@ -302,15 +187,12 @@ void G_BuildTiccmd (ticcmd_t* cmd) if (joyxmove < 0) cmd->angleturn += angleturn[tspeed]; } - if (gamekeydown[key_up]) { - forward += forwardmove[speed]; } if (gamekeydown[key_down]) { - forward -= forwardmove[speed]; } if (joyymove < 0) @@ -321,22 +203,15 @@ void G_BuildTiccmd (ticcmd_t* cmd) side += sidemove[speed]; if (gamekeydown[key_strafeleft]) side -= sidemove[speed]; - - cmd->chatchar = HU_dequeueChatChar(); - if (gamekeydown[key_fire] || mousebuttons[mousebfire] || joybuttons[joybfire]) cmd->buttons |= BT_ATTACK; - if (gamekeydown[key_use] || joybuttons[joybuse] ) { cmd->buttons |= BT_USE; - dclicks = 0; } - - for (i=0 ; i<NUMWEAPONS-1 ; i++) if (gamekeydown['1'+i]) { @@ -344,12 +219,8 @@ void G_BuildTiccmd (ticcmd_t* cmd) cmd->buttons |= i<<BT_WEAPONSHIFT; break; } - - if (mousebuttons[mousebforward]) forward += forwardmove[speed]; - - if (mousebuttons[mousebforward] != dclickstate && dclicktime > 1 ) { dclickstate = mousebuttons[mousebforward]; @@ -372,8 +243,6 @@ void G_BuildTiccmd (ticcmd_t* cmd) dclickstate = 0; } } - - bstrafe = mousebuttons[mousebstrafe] || joybuttons[joybstrafe]; @@ -399,15 +268,12 @@ void G_BuildTiccmd (ticcmd_t* cmd) dclickstate2 = 0; } } - forward += mousey; if (strafe) side += mousex*2; else cmd->angleturn -= mousex*0x8; - mousex = mousey = 0; - if (forward > MAXPLMOVE) forward = MAXPLMOVE; else if (forward < -MAXPLMOVE) @@ -416,43 +282,24 @@ void G_BuildTiccmd (ticcmd_t* cmd) side = MAXPLMOVE; else if (side < -MAXPLMOVE) side = -MAXPLMOVE; - cmd->forwardmove += forward; cmd->sidemove += side; - - if (sendpause) { sendpause = false; cmd->buttons = BT_SPECIAL | BTS_PAUSE; } - if (sendsave) { sendsave = false; cmd->buttons = BT_SPECIAL | BTS_SAVEGAME | (savegameslot<<BTS_SAVESHIFT); } } - - - - - extern gamestate_t wipegamestate; - void G_DoLoadLevel (void) { int i; - - - - - - skyflatnum = R_FlatNumForName ( SKYFLATNAME ); - - - if ( (gamemode == commercial) || ( gamemode == pack_tnt ) || ( gamemode == pack_plut ) ) @@ -464,28 +311,21 @@ void G_DoLoadLevel (void) if (gamemap < 21) skytexture = R_TextureNumForName ("SKY2"); } - levelstarttic = gametic; - if (wipegamestate == GS_LEVEL) wipegamestate = -1; - gamestate = GS_LEVEL; - for (i=0 ; i<MAXPLAYERS ; i++) { if (playeringame[i] && players[i].playerstate == PST_DEAD) players[i].playerstate = PST_REBORN; memset (players[i].frags,0,sizeof(players[i].frags)); } - P_SetupLevel (gameepisode, gamemap, 0, gameskill); displayplayer = consoleplayer; starttime = I_GetTime (); gameaction = ga_nothing; Z_CheckHeap (); - - memset (gamekeydown, 0, sizeof(gamekeydown)); joyxmove = joyymove = 0; mousex = mousey = 0; @@ -493,19 +333,11 @@ void G_DoLoadLevel (void) memset (mousebuttons, 0, sizeof(mousebuttons)); memset (joybuttons, 0, sizeof(joybuttons)); } - - - - - - boolean G_Responder (event_t* ev) { - if (gamestate == GS_LEVEL && ev->type == ev_keydown && ev->data1 == KEY_F12 && (singledemo || !deathmatch) ) { - do { displayplayer++; @@ -514,8 +346,6 @@ boolean G_Responder (event_t* ev) } while (!playeringame[displayplayer] && displayplayer != consoleplayer); return true; } - - if (gameaction == ga_nothing && !singledemo && (demoplayback || gamestate == GS_DEMOSCREEN) ) @@ -529,7 +359,6 @@ boolean G_Responder (event_t* ev) } return false; } - if (gamestate == GS_LEVEL) { #if 0 @@ -546,13 +375,11 @@ boolean G_Responder (event_t* ev) if (AM_Responder (ev)) return true; } - if (gamestate == GS_FINALE) { if (F_Responder (ev)) return true; } - switch (ev->type) { case ev_keydown: @@ -564,12 +391,10 @@ boolean G_Responder (event_t* ev) if (ev->data1 <NUMKEYS) gamekeydown[ev->data1] = true; return true; - case ev_keyup: if (ev->data1 <NUMKEYS) gamekeydown[ev->data1] = false; return false; - case ev_mouse: mousebuttons[0] = ev->data1 & 1; mousebuttons[1] = ev->data1 & 2; @@ -577,7 +402,6 @@ boolean G_Responder (event_t* ev) mousex = ev->data2*(mouseSensitivity+5)/10; mousey = ev->data3*(mouseSensitivity+5)/10; return true; - case ev_joystick: joybuttons[0] = ev->data1 & 1; joybuttons[1] = ev->data1 & 2; @@ -586,32 +410,19 @@ boolean G_Responder (event_t* ev) joyxmove = ev->data2; joyymove = ev->data3; return true; - default: break; } - return false; } - - - - - - - void G_Ticker (void) { int i; int buf; ticcmd_t* cmd; - - for (i=0 ; i<MAXPLAYERS ; i++) if (playeringame[i] && players[i].playerstate == PST_REBORN) G_DoReborn (i); - - while (gameaction != ga_nothing) { switch (gameaction) @@ -648,25 +459,17 @@ void G_Ticker (void) break; } } - - - buf = (gametic/ticdup)%BACKUPTICS; - for (i=0 ; i<MAXPLAYERS ; i++) { if (playeringame[i]) { cmd = &players[i].cmd; - memcpy (cmd, &netcmds[i][buf], sizeof(ticcmd_t)); - if (demoplayback) G_ReadDemoTiccmd (cmd); if (demorecording) G_WriteDemoTiccmd (cmd); - - if (cmd->forwardmove > TURBOTHRESHOLD && !(gametic&31) && ((gametic>>5)&3) == i ) { @@ -675,7 +478,6 @@ void G_Ticker (void) sprintf (turbomessage, "%s is turbo!",player_names[i]); players[consoleplayer].message = turbomessage; } - if (netgame && !netdemo && !(gametic%ticdup) ) { if (gametic > BACKUPTICS @@ -691,8 +493,6 @@ void G_Ticker (void) } } } - - for (i=0 ; i<MAXPLAYERS ; i++) { if (playeringame[i]) @@ -708,7 +508,6 @@ void G_Ticker (void) else S_ResumeSound (); break; - case BTS_SAVEGAME: if (!savedescription[0]) strcpy (savedescription, "NET GAME"); @@ -720,8 +519,6 @@ void G_Ticker (void) } } } - - switch (gamestate) { case GS_LEVEL: @@ -730,56 +527,27 @@ void G_Ticker (void) AM_Ticker (); HU_Ticker (); break; - case GS_INTERMISSION: WI_Ticker (); break; - case GS_FINALE: F_Ticker (); break; - case GS_DEMOSCREEN: D_PageTicker (); break; } } - - - - - - - - - - - - void G_InitPlayer (int player) { player_t* p; - - p = &players[player]; - - G_PlayerReborn (player); - } - - - - - - - void G_PlayerFinishLevel (int player) { player_t* p; - p = &players[player]; - memset (p->powers, 0, sizeof (p->powers)); memset (p->cards, 0, sizeof (p->cards)); p->mo->flags &= ~MF_SHADOW; @@ -788,13 +556,6 @@ void G_PlayerFinishLevel (int player) p->damagecount = 0; p->bonuscount = 0; } - - - - - - - void G_PlayerReborn (int player) { player_t* p; @@ -803,20 +564,16 @@ void G_PlayerReborn (int player) int killcount; int itemcount; int secretcount; - memcpy (frags,players[player].frags,sizeof(frags)); killcount = players[player].killcount; itemcount = players[player].itemcount; secretcount = players[player].secretcount; - p = &players[player]; memset (p, 0, sizeof(*p)); - memcpy (players[player].frags, frags, sizeof(players[player].frags)); players[player].killcount = killcount; players[player].itemcount = itemcount; players[player].secretcount = secretcount; - p->usedown = p->attackdown = true; p->playerstate = PST_LIVE; p->health = MAXHEALTH; @@ -824,20 +581,10 @@ void G_PlayerReborn (int player) p->weaponowned[wp_fist] = true; p->weaponowned[wp_pistol] = true; p->ammo[am_clip] = 50; - for (i=0 ; i<NUMAMMO ; i++) p->maxammo[i] = maxammo[i]; - } - - - - - - - void P_SpawnPlayer (mapthing_t* mthing); - boolean G_CheckSpot ( int playernum, @@ -849,58 +596,38 @@ G_CheckSpot unsigned an; mobj_t* mo; int i; - if (!players[playernum].mo) { - for (i=0 ; i<playernum ; i++) if (players[i].mo->x == mthing->x << FRACBITS && players[i].mo->y == mthing->y << FRACBITS) return false; return true; } - x = mthing->x << FRACBITS; y = mthing->y << FRACBITS; - if (!P_CheckPosition (players[playernum].mo, x, y) ) return false; - - if (bodyqueslot >= BODYQUESIZE) P_RemoveMobj (bodyque[bodyqueslot%BODYQUESIZE]); bodyque[bodyqueslot%BODYQUESIZE] = players[playernum].mo; bodyqueslot++; - - ss = R_PointInSubsector (x,y); an = ( ANG45 * (mthing->angle/45) ) >> ANGLETOFINESHIFT; - mo = P_SpawnMobj (x+20*finecosine[an], y+20*finesine[an] , ss->sector->floorheight , MT_TFOG); - if (players[consoleplayer].viewz != 1) S_StartSound (mo, sfx_telept); - return true; } - - - - - - - void G_DeathMatchSpawnPlayer (int playernum) { int i,j; int selections; - selections = deathmatch_p - deathmatchstarts; if (selections < 4) I_Error ("Only %i deathmatch spots, 4 required", selections); - for (j=0 ; j<20 ; j++) { i = P_Random() % selections; @@ -911,44 +638,28 @@ void G_DeathMatchSpawnPlayer (int playernum) return; } } - - P_SpawnPlayer (&playerstarts[playernum]); } - - - - void G_DoReborn (int playernum) { int i; - if (!netgame) { - gameaction = ga_loadlevel; } else { - - - players[playernum].mo->player = NULL; - - if (deathmatch) { G_DeathMatchSpawnPlayer (playernum); return; } - if (G_CheckSpot (playernum, &playerstarts[playernum]) ) { P_SpawnPlayer (&playerstarts[playernum]); return; } - - for (i=0 ; i<MAXPLAYERS ; i++) { if (G_CheckSpot (playernum, &playerstarts[i]) ) @@ -958,21 +669,14 @@ void G_DoReborn (int playernum) playerstarts[i].type = i+1; return; } - } P_SpawnPlayer (&playerstarts[playernum]); } } - - void G_ScreenShot (void) { gameaction = ga_screenshot; } - - - - int pars[4][10] = { {0}, @@ -980,8 +684,6 @@ int pars[4][10] = {0,90,90,90,120,90,360,240,30,170}, {0,90,45,90,150,90,90,165,30,135} }; - - int cpars[32] = { 30,90,120,120,90,150,120,120,270,90, @@ -989,24 +691,15 @@ int cpars[32] = 240,150,180,150,150,300,330,420,300,180, 120,30 }; - - - - - boolean secretexit; extern char* pagename; - void G_ExitLevel (void) { secretexit = false; gameaction = ga_completed; } - - void G_SecretExitLevel (void) { - if ( (gamemode == commercial) && (W_CheckNumForName("map31")<0)) secretexit = false; @@ -1014,20 +707,15 @@ void G_SecretExitLevel (void) secretexit = true; gameaction = ga_completed; } - void G_DoCompleted (void) { int i; - gameaction = ga_nothing; - for (i=0 ; i<MAXPLAYERS ; i++) if (playeringame[i]) G_PlayerFinishLevel (i); - if (automapactive) AM_Stop (); - if ( gamemode != commercial) switch(gamemap) { @@ -1039,31 +727,21 @@ void G_DoCompleted (void) players[i].didsecret = true; break; } - - if ( (gamemap == 8) && (gamemode != commercial) ) { - gameaction = ga_victory; return; } - if ( (gamemap == 9) && (gamemode != commercial) ) { - for (i=0 ; i<MAXPLAYERS ; i++) players[i].didsecret = true; } - - - wminfo.didsecret = players[consoleplayer].didsecret; wminfo.epsd = gameepisode -1; wminfo.last = gamemap -1; - - if ( gamemode == commercial) { if (secretexit) @@ -1086,7 +764,6 @@ void G_DoCompleted (void) wminfo.next = 8; else if (gamemap == 9) { - switch (gameepisode) { case 1: @@ -1106,7 +783,6 @@ void G_DoCompleted (void) else wminfo.next = gamemap; } - wminfo.maxkills = totalkills; wminfo.maxitems = totalitems; wminfo.maxsecret = totalsecret; @@ -1116,7 +792,6 @@ void G_DoCompleted (void) else wminfo.partime = 35*pars[gameepisode][gamemap]; wminfo.pnum = consoleplayer; - for (i=0 ; i<MAXPLAYERS ; i++) { wminfo.plyr[i].in = playeringame[i]; @@ -1127,28 +802,18 @@ void G_DoCompleted (void) memcpy (wminfo.plyr[i].frags, players[i].frags , sizeof(wminfo.plyr[i].frags)); } - gamestate = GS_INTERMISSION; viewactive = false; automapactive = false; - if (statcopy) memcpy (statcopy, &wminfo, sizeof(wminfo)); - WI_Start (&wminfo); } - - - - - void G_WorldDone (void) { gameaction = ga_worlddone; - if (secretexit) players[consoleplayer].didsecret = true; - if ( gamemode == commercial ) { switch (gamemap) @@ -1166,7 +831,6 @@ void G_WorldDone (void) } } } - void G_DoWorldDone (void) { gamestate = GS_LEVEL; @@ -1175,86 +839,50 @@ void G_DoWorldDone (void) gameaction = ga_nothing; viewactive = true; } - - - - - - - extern boolean setsizeneeded; void R_ExecuteSetViewSize (void); - char savename[256]; - void G_LoadGame (char* name) { strcpy (savename, name); gameaction = ga_loadgame; } - #define VERSIONSIZE 16 - - void G_DoLoadGame (void) { int length; int i; int a,b,c; char vcheck[VERSIONSIZE]; - gameaction = ga_nothing; - length = M_ReadFile (savename, &savebuffer); save_p = savebuffer + SAVESTRINGSIZE; - - memset (vcheck,0,sizeof(vcheck)); sprintf (vcheck,"version %i",VERSION); if (strcmp (save_p, vcheck)) return; save_p += VERSIONSIZE; - gameskill = *save_p++; gameepisode = *save_p++; gamemap = *save_p++; for (i=0 ; i<MAXPLAYERS ; i++) playeringame[i] = *save_p++; - - G_InitNew (gameskill, gameepisode, gamemap); - - a = *save_p++; b = *save_p++; c = *save_p++; leveltime = (a<<16) + (b<<8) + c; - - P_UnArchivePlayers (); P_UnArchiveWorld (); P_UnArchiveThinkers (); P_UnArchiveSpecials (); - if (*save_p != 0x1d) I_Error ("Bad savegame"); - - Z_Free (savebuffer); - if (setsizeneeded) R_ExecuteSetViewSize (); - - R_FillBackScreen (); } - - - - - - - void G_SaveGame ( int slot, @@ -1264,7 +892,6 @@ G_SaveGame strcpy (savedescription, description); sendsave = true; } - void G_DoSaveGame (void) { char name[100]; @@ -1272,22 +899,18 @@ void G_DoSaveGame (void) char* description; int length; int i; - if (M_CheckParm("-cdrom")) sprintf(name,"c:\\doomdata\\"SAVEGAMENAME"%d.dsg",savegameslot); else sprintf (name,SAVEGAMENAME"%d.dsg",savegameslot); description = savedescription; - save_p = savebuffer = screens[1]+0x4000; - memcpy (save_p, description, SAVESTRINGSIZE); save_p += SAVESTRINGSIZE; memset (name2,0,sizeof(name2)); sprintf (name2,"version %i",VERSION); memcpy (save_p, name2, VERSIONSIZE); save_p += VERSIONSIZE; - *save_p++ = gameskill; *save_p++ = gameepisode; *save_p++ = gamemap; @@ -1296,37 +919,23 @@ void G_DoSaveGame (void) *save_p++ = leveltime>>16; *save_p++ = leveltime>>8; *save_p++ = leveltime; - P_ArchivePlayers (); P_ArchiveWorld (); P_ArchiveThinkers (); P_ArchiveSpecials (); - *save_p++ = 0x1d; - length = save_p - savebuffer; if (length > SAVEGAMESIZE) I_Error ("Savegame buffer overrun"); M_WriteFile (name, savebuffer, length); gameaction = ga_nothing; savedescription[0] = 0; - players[consoleplayer].message = GGSAVED; - - R_FillBackScreen (); } - - - - - - - skill_t d_skill; int d_episode; int d_map; - void G_DeferedInitNew ( skill_t skill, @@ -1338,8 +947,6 @@ G_DeferedInitNew d_map = map; gameaction = ga_newgame; } - - void G_DoNewGame (void) { demoplayback = false; @@ -1354,11 +961,7 @@ void G_DoNewGame (void) G_InitNew (d_skill, d_episode, d_map); gameaction = ga_nothing; } - - extern int skytexture; - - void G_InitNew ( skill_t skill, @@ -1366,24 +969,15 @@ G_InitNew int map ) { int i; - if (paused) { paused = false; S_ResumeSound (); } - - if (skill > sk_nightmare) skill = sk_nightmare; - - - - - if (episode < 1) episode = 1; - if ( gamemode == retail ) { if (episode > 4) @@ -1399,23 +993,16 @@ G_InitNew if (episode > 3) episode = 3; } - - - if (map < 1) map = 1; - if ( (map > 9) && ( gamemode != commercial) ) map = 9; - M_ClearRandom (); - if (skill == sk_nightmare || respawnparm ) respawnmonsters = true; else respawnmonsters = false; - if (fastparm || (skill == sk_nightmare && gameskill != sk_nightmare) ) { for (i=S_SARG_RUN1 ; i<=S_SARG_PAIN2 ; i++) @@ -1432,12 +1019,8 @@ G_InitNew mobjinfo[MT_HEADSHOT].speed = 10*FRACUNIT; mobjinfo[MT_TROOPSHOT].speed = 10*FRACUNIT; } - - - for (i=0 ; i<MAXPLAYERS ; i++) players[i].playerstate = PST_REBORN; - usergame = true; paused = false; demoplayback = false; @@ -1446,10 +1029,7 @@ G_InitNew gameepisode = episode; gamemap = map; gameskill = skill; - viewactive = true; - - if ( gamemode == commercial) { skytexture = R_TextureNumForName ("SKY3"); @@ -1475,22 +1055,13 @@ G_InitNew skytexture = R_TextureNumForName ("SKY4"); break; } - G_DoLoadLevel (); } - - - - - #define DEMOMARKER 0x80 - - void G_ReadDemoTiccmd (ticcmd_t* cmd) { if (*demo_p == DEMOMARKER) { - G_CheckDemoStatus (); return; } @@ -1499,8 +1070,6 @@ void G_ReadDemoTiccmd (ticcmd_t* cmd) cmd->angleturn = ((unsigned char)*demo_p++)<<8; cmd->buttons = (unsigned char)*demo_p++; } - - void G_WriteDemoTiccmd (ticcmd_t* cmd) { if (gamekeydown['q']) @@ -1512,24 +1081,15 @@ void G_WriteDemoTiccmd (ticcmd_t* cmd) demo_p -= 4; if (demo_p > demoend - 16) { - G_CheckDemoStatus (); return; } - G_ReadDemoTiccmd (cmd); } - - - - - - void G_RecordDemo (char* name) { int i; int maxsize; - usergame = false; strcpy (demoname, name); strcat (demoname, ".lmp"); @@ -1539,17 +1099,12 @@ void G_RecordDemo (char* name) maxsize = atoi(myargv[i+1])*1024; demobuffer = Z_Malloc (maxsize,PU_STATIC,NULL); demoend = demobuffer + maxsize; - demorecording = true; } - - void G_BeginRecording (void) { int i; - demo_p = demobuffer; - *demo_p++ = VERSION; *demo_p++ = gameskill; *demo_p++ = gameepisode; @@ -1559,29 +1114,19 @@ void G_BeginRecording (void) *demo_p++ = fastparm; *demo_p++ = nomonsters; *demo_p++ = consoleplayer; - for (i=0 ; i<MAXPLAYERS ; i++) *demo_p++ = playeringame[i]; } - - - - - - char* defdemoname; - void G_DeferedPlayDemo (char* name) { defdemoname = name; gameaction = ga_playdemo; } - void G_DoPlayDemo (void) { skill_t skill; int i, episode, map; - gameaction = ga_nothing; demobuffer = demo_p = W_CacheLumpName (defdemoname, PU_STATIC); if ( *demo_p++ != VERSION) @@ -1590,7 +1135,6 @@ void G_DoPlayDemo (void) gameaction = ga_nothing; return; } - skill = *demo_p++; episode = *demo_p++; map = *demo_p++; @@ -1599,7 +1143,6 @@ void G_DoPlayDemo (void) fastparm = *demo_p++; nomonsters = *demo_p++; consoleplayer = *demo_p++; - for (i=0 ; i<MAXPLAYERS ; i++) playeringame[i] = *demo_p++; if (playeringame[1]) @@ -1607,31 +1150,21 @@ void G_DoPlayDemo (void) netgame = true; netdemo = true; } - - precache = false; G_InitNew (skill, episode, map); precache = true; - usergame = false; demoplayback = true; } - - - - void G_TimeDemo (char* name) { nodrawers = M_CheckParm ("-nodraw"); noblit = M_CheckParm ("-noblit"); timingdemo = true; singletics = true; - defdemoname = name; gameaction = ga_playdemo; } - - /* =================== = @@ -1641,23 +1174,19 @@ void G_TimeDemo (char* name) = Returns true if a new demo loop action will take place =================== */ - boolean G_CheckDemoStatus (void) { int endtime; - if (timingdemo) { endtime = I_GetTime (); I_Error ("timed %i gametics in %i realtics",gametic , endtime-starttime); } - if (demoplayback) { if (singledemo) I_Quit (); - Z_ChangeTag (demobuffer, PU_CACHE); demoplayback = false; netdemo = false; @@ -1671,7 +1200,6 @@ boolean G_CheckDemoStatus (void) D_AdvanceDemo (); return true; } - if (demorecording) { *demo_p++ = DEMOMARKER; @@ -1680,9 +1208,5 @@ boolean G_CheckDemoStatus (void) demorecording = false; I_Error ("Demo %s recorded",demoname); } - return false; } - - - diff --git a/src/g_game.h b/src/g_game.h @@ -1,79 +1,23 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __G_GAME__ #define __G_GAME__ - #include "doomdef.h" #include "d_event.h" - - - - - - void G_DeathMatchSpawnPlayer (int playernum); - void G_InitNew (skill_t skill, int episode, int map); - - - - void G_DeferedInitNew (skill_t skill, int episode, int map); - void G_DeferedPlayDemo (char* demo); - - - void G_LoadGame (char* name); - void G_DoLoadGame (void); - - void G_SaveGame (int slot, char* description); - - void G_RecordDemo (char* name); - void G_BeginRecording (void); - void G_PlayDemo (char* name); void G_TimeDemo (char* name); boolean G_CheckDemoStatus (void); - void G_ExitLevel (void); void G_SecretExitLevel (void); - void G_WorldDone (void); - void G_Ticker (void); boolean G_Responder (event_t* ev); - void G_ScreenShot (void); - - #endif - - - - - diff --git a/src/hu_lib.c b/src/hu_lib.c @@ -1,53 +1,21 @@ - - - - - - - - - - - - - - - - - - - - - - - #include <ctype.h> - #include "doomdef.h" - #include "v_video.h" #include "m_swap.h" - #include "hu_lib.h" #include "r_local.h" #include "r_draw.h" - - #define noterased viewwindowx - extern boolean automapactive; - void HUlib_init(void) { } - void HUlib_clearTextLine(hu_textline_t* t) { t->len = 0; t->l[0] = 0; t->needsupdate = true; } - void HUlib_initTextLine ( hu_textline_t* t, @@ -62,13 +30,11 @@ HUlib_initTextLine t->sc = sc; HUlib_clearTextLine(t); } - boolean HUlib_addCharToTextLine ( hu_textline_t* t, char ch ) { - if (t->len == HU_MAXLINELENGTH) return false; else @@ -78,12 +44,9 @@ HUlib_addCharToTextLine t->needsupdate = 4; return true; } - } - boolean HUlib_delCharFromTextLine(hu_textline_t* t) { - if (!t->len) return false; else { @@ -91,21 +54,16 @@ boolean HUlib_delCharFromTextLine(hu_textline_t* t) t->needsupdate = 4; return true; } - } - void HUlib_drawTextLine ( hu_textline_t* l, boolean drawcursor ) { - int i; int w; int x; unsigned char c; - - x = l->x; for (i=0;i<l->len;i++) { @@ -127,28 +85,18 @@ HUlib_drawTextLine break; } } - - if (drawcursor && x + SHORT(l->f['_' - l->sc]->width) <= SCREENWIDTH) { V_DrawPatchDirect(x, l->y, FG, l->f['_' - l->sc]); } } - - - void HUlib_eraseTextLine(hu_textline_t* l) { int lh; int y; int yoffset; static boolean lastautomapactive = true; - - - - - if (!automapactive && viewwindowx && l->needsupdate) { @@ -161,16 +109,12 @@ void HUlib_eraseTextLine(hu_textline_t* l) { R_VideoErase(yoffset, viewwindowx); R_VideoErase(yoffset + viewwindowx + viewwidth, viewwindowx); - } } } - lastautomapactive = automapactive; if (l->needsupdate) l->needsupdate--; - } - void HUlib_initSText ( hu_stext_t* s, @@ -181,9 +125,7 @@ HUlib_initSText int startchar, boolean* on ) { - int i; - s->h = h; s->on = on; s->laston = true; @@ -192,25 +134,16 @@ HUlib_initSText HUlib_initTextLine(&s->l[i], x, y - i*(SHORT(font[0]->height)+1), font, startchar); - } - void HUlib_addLineToSText(hu_stext_t* s) { - int i; - - if (++s->cl == s->h) s->cl = 0; HUlib_clearTextLine(&s->l[s->cl]); - - for (i=0 ; i<s->h ; i++) s->l[i].needsupdate = 4; - } - void HUlib_addMessageToSText ( hu_stext_t* s, @@ -221,39 +154,27 @@ HUlib_addMessageToSText if (prefix) while (*prefix) HUlib_addCharToTextLine(&s->l[s->cl], *(prefix++)); - while (*msg) HUlib_addCharToTextLine(&s->l[s->cl], *(msg++)); } - void HUlib_drawSText(hu_stext_t* s) { int i, idx; hu_textline_t *l; - if (!*s->on) return; - - for (i=0 ; i<s->h ; i++) { idx = s->cl - i; if (idx < 0) idx += s->h; - l = &s->l[idx]; - - HUlib_drawTextLine(l, false); } - } - void HUlib_eraseSText(hu_stext_t* s) { - int i; - for (i=0 ; i<s->h ; i++) { if (s->laston && !*s->on) @@ -261,9 +182,7 @@ void HUlib_eraseSText(hu_stext_t* s) HUlib_eraseTextLine(&s->l[i]); } s->laston = *s->on; - } - void HUlib_initIText ( hu_itext_t* it, @@ -278,28 +197,21 @@ HUlib_initIText it->laston = true; HUlib_initTextLine(&it->l, x, y, font, startchar); } - - - void HUlib_delCharFromIText(hu_itext_t* it) { if (it->l.len != it->lm) HUlib_delCharFromTextLine(&it->l); } - void HUlib_eraseLineFromIText(hu_itext_t* it) { while (it->lm != it->l.len) HUlib_delCharFromTextLine(&it->l); } - - void HUlib_resetIText(hu_itext_t* it) { it->lm = 0; HUlib_clearTextLine(&it->l); } - void HUlib_addPrefixToIText ( hu_itext_t* it, @@ -309,15 +221,11 @@ HUlib_addPrefixToIText HUlib_addCharToTextLine(&it->l, *(str++)); it->lm = it->l.len; } - - - boolean HUlib_keyInIText ( hu_itext_t* it, unsigned char ch ) { - if (ch >= ' ' && ch <= '_') HUlib_addCharToTextLine(&it->l, (char) ch); else @@ -326,22 +234,15 @@ HUlib_keyInIText else if (ch != KEY_ENTER) return false; - return true; - } - void HUlib_drawIText(hu_itext_t* it) { - hu_textline_t *l = &it->l; - if (!*it->on) return; HUlib_drawTextLine(l, true); - } - void HUlib_eraseIText(hu_itext_t* it) { if (it->laston && !*it->on) @@ -349,4 +250,3 @@ void HUlib_eraseIText(hu_itext_t* it) HUlib_eraseTextLine(&it->l); it->laston = *it->on; } - diff --git a/src/hu_lib.h b/src/hu_lib.h @@ -1,131 +1,43 @@ - - - - - - - - - - - - - - - - - - - - #ifndef __HULIB__ #define __HULIB__ - - #include "r_defs.h" - - - - #define BG 1 #define FG 0 - - #define HU_CHARERASE KEY_BACKSPACE - #define HU_MAXLINES 4 #define HU_MAXLINELENGTH 80 - - - - - - - typedef struct { - int x; int y; - patch_t** f; int sc; char l[HU_MAXLINELENGTH+1]; int len; - - int needsupdate; - } hu_textline_t; - - - - - typedef struct { hu_textline_t l[HU_MAXLINES]; int h; int cl; - - boolean* on; boolean laston; - } hu_stext_t; - - - - - typedef struct { hu_textline_t l; - - int lm; - - boolean* on; boolean laston; - } hu_itext_t; - - - - - - - void HUlib_init(void); - - - - - - void HUlib_clearTextLine(hu_textline_t *t); - void HUlib_initTextLine(hu_textline_t *t, int x, int y, patch_t **f, int sc); - - boolean HUlib_addCharToTextLine(hu_textline_t *t, char ch); - - boolean HUlib_delCharFromTextLine(hu_textline_t *t); - - void HUlib_drawTextLine(hu_textline_t *l, boolean drawcursor); - - void HUlib_eraseTextLine(hu_textline_t *l); - - - - - - - void HUlib_initSText ( hu_stext_t* s, @@ -135,24 +47,14 @@ HUlib_initSText patch_t** font, int startchar, boolean* on ); - - void HUlib_addLineToSText(hu_stext_t* s); - - void HUlib_addMessageToSText ( hu_stext_t* s, char* prefix, char* msg ); - - void HUlib_drawSText(hu_stext_t* s); - - void HUlib_eraseSText(hu_stext_t* s); - - void HUlib_initIText ( hu_itext_t* it, @@ -161,36 +63,17 @@ HUlib_initIText patch_t** font, int startchar, boolean* on ); - - void HUlib_delCharFromIText(hu_itext_t* it); - - void HUlib_eraseLineFromIText(hu_itext_t* it); - - void HUlib_resetIText(hu_itext_t* it); - - void HUlib_addPrefixToIText ( hu_itext_t* it, char* str ); - - boolean HUlib_keyInIText ( hu_itext_t* it, unsigned char ch ); - void HUlib_drawIText(hu_itext_t* it); - - void HUlib_eraseIText(hu_itext_t* it); - #endif - - - - - diff --git a/src/hu_stuff.c b/src/hu_stuff.c @@ -1,49 +1,14 @@ - - - - - - - - - - - - - - - - - - - - - - - #include <ctype.h> - #include "doomdef.h" - #include "z_zone.h" - #include "m_swap.h" - #include "hu_stuff.h" #include "hu_lib.h" #include "w_wad.h" - #include "s_sound.h" - #include "doomstat.h" - - #include "dstrings.h" #include "sounds.h" - - - - #define HU_TITLE (mapnames[(gameepisode-1)*9+gamemap-1]) #define HU_TITLE2 (mapnames2[gamemap-1]) #define HU_TITLEP (mapnamesp[gamemap-1]) @@ -51,15 +16,11 @@ #define HU_TITLEHEIGHT 1 #define HU_TITLEX 0 #define HU_TITLEY (167 - SHORT(hu_font[0]->height)) - #define HU_INPUTTOGGLE 't' #define HU_INPUTX HU_MSGX #define HU_INPUTY (HU_MSGY + HU_MSGHEIGHT*(SHORT(hu_font[0]->height) +1)) #define HU_INPUTWIDTH 64 #define HU_INPUTHEIGHT 1 - - - char* chat_macros[] = { HUSTR_CHATMACRO0, @@ -73,7 +34,6 @@ char* chat_macros[] = HUSTR_CHATMACRO8, HUSTR_CHATMACRO9 }; - char* player_names[] = { HUSTR_PLRGREEN, @@ -81,8 +41,6 @@ char* player_names[] = HUSTR_PLRBROWN, HUSTR_PLRRED }; - - char chat_char; static player_t* plr; patch_t* hu_font[HU_FONTSIZE]; @@ -92,27 +50,16 @@ static hu_itext_t w_chat; static boolean always_off = false; static char chat_dest[MAXPLAYERS]; static hu_itext_t w_inputbuffer[MAXPLAYERS]; - static boolean message_on; boolean message_dontfuckwithme; static boolean message_nottobefuckedwith; - static hu_stext_t w_message; static int message_counter; - extern int showMessages; extern boolean automapactive; - static boolean headsupactive = false; - - - - - - char* mapnames[] = { - HUSTR_E1M1, HUSTR_E1M2, HUSTR_E1M3, @@ -122,7 +69,6 @@ char* mapnames[] = HUSTR_E1M7, HUSTR_E1M8, HUSTR_E1M9, - HUSTR_E2M1, HUSTR_E2M2, HUSTR_E2M3, @@ -132,7 +78,6 @@ char* mapnames[] = HUSTR_E2M7, HUSTR_E2M8, HUSTR_E2M9, - HUSTR_E3M1, HUSTR_E3M2, HUSTR_E3M3, @@ -142,7 +87,6 @@ char* mapnames[] = HUSTR_E3M7, HUSTR_E3M8, HUSTR_E3M9, - HUSTR_E4M1, HUSTR_E4M2, HUSTR_E4M3, @@ -152,7 +96,6 @@ char* mapnames[] = HUSTR_E4M7, HUSTR_E4M8, HUSTR_E4M9, - "NEWLEVEL", "NEWLEVEL", "NEWLEVEL", @@ -163,7 +106,6 @@ char* mapnames[] = "NEWLEVEL", "NEWLEVEL" }; - char* mapnames2[] = { HUSTR_1, @@ -177,7 +119,6 @@ char* mapnames2[] = HUSTR_9, HUSTR_10, HUSTR_11, - HUSTR_12, HUSTR_13, HUSTR_14, @@ -187,7 +128,6 @@ char* mapnames2[] = HUSTR_18, HUSTR_19, HUSTR_20, - HUSTR_21, HUSTR_22, HUSTR_23, @@ -201,8 +141,6 @@ char* mapnames2[] = HUSTR_31, HUSTR_32 }; - - char* mapnamesp[] = { PHUSTR_1, @@ -216,7 +154,6 @@ char* mapnamesp[] = PHUSTR_9, PHUSTR_10, PHUSTR_11, - PHUSTR_12, PHUSTR_13, PHUSTR_14, @@ -226,7 +163,6 @@ char* mapnamesp[] = PHUSTR_18, PHUSTR_19, PHUSTR_20, - PHUSTR_21, PHUSTR_22, PHUSTR_23, @@ -240,8 +176,6 @@ char* mapnamesp[] = PHUSTR_31, PHUSTR_32 }; - - char *mapnamest[] = { THUSTR_1, @@ -255,7 +189,6 @@ char *mapnamest[] = THUSTR_9, THUSTR_10, THUSTR_11, - THUSTR_12, THUSTR_13, THUSTR_14, @@ -265,7 +198,6 @@ char *mapnamest[] = THUSTR_18, THUSTR_19, THUSTR_20, - THUSTR_21, THUSTR_22, THUSTR_23, @@ -279,10 +211,7 @@ char *mapnamest[] = THUSTR_31, THUSTR_32 }; - - const char* shiftxform; - const char french_shiftxform[] = { 0, @@ -322,12 +251,9 @@ const char french_shiftxform[] = 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', 127 - }; - const char english_shiftxform[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, @@ -366,7 +292,6 @@ const char english_shiftxform[] = 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', 127 }; - char frenchKeyMap[128]= { 0, @@ -381,66 +306,49 @@ char frenchKeyMap[128]= '@','Q','B','C','D','E','F','G','H','I','J','K','L',',','N','O', 'P','A','R','S','T','U','V','Z','X','Y','W','^','\\','$','^',127 }; - char ForeignTranslation(unsigned char ch) { return ch < 128 ? frenchKeyMap[ch] : ch; } - void HU_Init(void) { - int i; int j; char buffer[9]; - if (french) shiftxform = french_shiftxform; else shiftxform = english_shiftxform; - - j = HU_FONTSTART; for (i=0;i<HU_FONTSIZE;i++) { sprintf(buffer, "STCFN%.3d", j++); hu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC); } - } - void HU_Stop(void) { headsupactive = false; } - void HU_Start(void) { - int i; char* s; - if (headsupactive) HU_Stop(); - plr = &players[consoleplayer]; message_on = false; message_dontfuckwithme = false; message_nottobefuckedwith = false; chat_on = false; - - HUlib_initSText(&w_message, HU_MSGX, HU_MSGY, HU_MSGHEIGHT, hu_font, HU_FONTSTART, &message_on); - - HUlib_initTextLine(&w_title, HU_TITLEX, HU_TITLEY, hu_font, HU_FONTSTART); - switch ( gamemode ) { case shareware: @@ -448,7 +356,6 @@ void HU_Start(void) case retail: s = HU_TITLE; break; - /* FIXME case pack_plut: s = HU_TITLEP; @@ -457,66 +364,45 @@ void HU_Start(void) s = HU_TITLET; break; */ - case commercial: default: s = HU_TITLE2; break; } - while (*s) HUlib_addCharToTextLine(&w_title, *(s++)); - - HUlib_initIText(&w_chat, HU_INPUTX, HU_INPUTY, hu_font, HU_FONTSTART, &chat_on); - - for (i=0 ; i<MAXPLAYERS ; i++) HUlib_initIText(&w_inputbuffer[i], 0, 0, 0, 0, &always_off); - headsupactive = true; - } - void HU_Drawer(void) { - HUlib_drawSText(&w_message); HUlib_drawIText(&w_chat); if (automapactive) HUlib_drawTextLine(&w_title, false); - } - void HU_Erase(void) { - HUlib_eraseSText(&w_message); HUlib_eraseIText(&w_chat); HUlib_eraseTextLine(&w_title); - } - void HU_Ticker(void) { - int i, rc; char c; - - if (message_counter && !--message_counter) { message_on = false; message_nottobefuckedwith = false; } - if (showMessages || message_dontfuckwithme) { - - if ((plr->message && !message_nottobefuckedwith) || (plr->message && message_dontfuckwithme)) { @@ -527,10 +413,7 @@ void HU_Ticker(void) message_nottobefuckedwith = message_dontfuckwithme; message_dontfuckwithme = 0; } - } - - if (netgame) { for (i=0 ; i<MAXPLAYERS; i++) @@ -556,7 +439,6 @@ void HU_Ticker(void) HUlib_addMessageToSText(&w_message, player_names[i], w_inputbuffer[i].l.l); - message_nottobefuckedwith = true; message_on = true; message_counter = HU_MSGTIMEOUT; @@ -572,16 +454,11 @@ void HU_Ticker(void) } } } - } - #define QUEUESIZE 128 - static char chatchars[QUEUESIZE]; static int head = 0; static int tail = 0; - - void HU_queueChatChar(char c) { if (((head + 1) & (QUEUESIZE-1)) == tail) @@ -594,11 +471,9 @@ void HU_queueChatChar(char c) head = (head + 1) & (QUEUESIZE-1); } } - char HU_dequeueChatChar(void) { char c; - if (head != tail) { c = chatchars[tail]; @@ -608,13 +483,10 @@ char HU_dequeueChatChar(void) { c = 0; } - return c; } - boolean HU_Responder(event_t *ev) { - static char lastmessage[HU_MAXLINELENGTH+1]; char* macromessage; boolean eatkey = false; @@ -623,7 +495,6 @@ boolean HU_Responder(event_t *ev) unsigned char c; int i; int numplayers; - static char destination_keys[MAXPLAYERS] = { HUSTR_KEYGREEN, @@ -631,13 +502,10 @@ boolean HU_Responder(event_t *ev) HUSTR_KEYBROWN, HUSTR_KEYRED }; - static int num_nobrainers = 0; - numplayers = 0; for (i=0 ; i<MAXPLAYERS ; i++) numplayers += playeringame[i]; - if (ev->data1 == KEY_RSHIFT) { shiftdown = ev->type == ev_keydown; @@ -648,10 +516,8 @@ boolean HU_Responder(event_t *ev) altdown = ev->type == ev_keydown; return false; } - if (ev->type != ev_keydown) return false; - if (!chat_on) { if (ev->data1 == HU_MSGREFRESH) @@ -700,24 +566,16 @@ boolean HU_Responder(event_t *ev) else { c = ev->data1; - if (altdown) { c = c - '0'; if (c > 9) return false; - macromessage = chat_macros[c]; - - HU_queueChatChar(KEY_ENTER); - - while (*macromessage) HU_queueChatChar(*macromessage++); HU_queueChatChar(KEY_ENTER); - - chat_on = false; strcpy(lastmessage, chat_macros[c]); plr->message = lastmessage; @@ -732,11 +590,7 @@ boolean HU_Responder(event_t *ev) eatkey = HUlib_keyInIText(&w_chat, c); if (eatkey) { - HU_queueChatChar(c); - - - } if (c == KEY_ENTER) { @@ -751,7 +605,5 @@ boolean HU_Responder(event_t *ev) chat_on = false; } } - return eatkey; - } diff --git a/src/hu_stuff.h b/src/hu_stuff.h @@ -1,66 +1,21 @@ - - - - - - - - - - - - - - - - - - - - #ifndef __HU_STUFF_H__ #define __HU_STUFF_H__ - #include "d_event.h" - - - - - #define HU_FONTSTART '!' #define HU_FONTEND '_' - - #define HU_FONTSIZE (HU_FONTEND - HU_FONTSTART + 1) - #define HU_BROADCAST 5 - #define HU_MSGREFRESH KEY_ENTER #define HU_MSGX 0 #define HU_MSGY 0 #define HU_MSGWIDTH 64 #define HU_MSGHEIGHT 1 - #define HU_MSGTIMEOUT (4*TICRATE) - - - - - void HU_Init(void); void HU_Start(void); - boolean HU_Responder(event_t* ev); - void HU_Ticker(void); void HU_Drawer(void); char HU_dequeueChatChar(void); void HU_Erase(void); - - #endif - - - - - diff --git a/src/i_main.c b/src/i_main.c @@ -1,34 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - #include "doomdef.h" - #include "m_argv.h" #include "d_main.h" - int main ( int argc, @@ -36,8 +8,6 @@ main { myargc = argc; myargv = argv; - D_DoomMain (); - return 0; } diff --git a/src/i_net.c b/src/i_net.c @@ -1,30 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - #include <stdlib.h> #include <string.h> #include <stdio.h> - #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -32,74 +8,41 @@ #include <unistd.h> #include <netdb.h> #include <sys/ioctl.h> - #include "i_system.h" #include "d_event.h" #include "d_net.h" #include "m_argv.h" - #include "doomstat.h" - #ifdef __GNUG__ #pragma implementation "i_net.h" #endif #include "i_net.h" - - - - - - #define ntohl(x) \ ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \ (((unsigned long int)(x) & 0x0000ff00U) << 8) | \ (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \ (((unsigned long int)(x) & 0xff000000U) >> 24))) - #define ntohs(x) \ ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \ (((unsigned short int)(x) & 0xff00) >> 8))) \ - #define htonl(x) ntohl(x) #define htons(x) ntohs(x) - void NetSend (void); boolean NetListen (void); - - - - - - int DOOMPORT = (IPPORT_USERRESERVED +0x1d ); - int sendsocket; int insocket; - struct sockaddr_in sendaddress[MAXNETNODES]; - void (*netget) (void); void (*netsend) (void); - - - - - int UDPsocket (void) { int s; - - s = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP); if (s<0) I_Error ("can't create socket: %s",strerror(errno)); - return s; } - - - - void BindToLocalPort ( int s, @@ -107,27 +50,18 @@ BindToLocalPort { int v; struct sockaddr_in address; - memset (&address, 0, sizeof(address)); address.sin_family = AF_INET; address.sin_addr.s_addr = INADDR_ANY; address.sin_port = port; - v = bind (s, (void *)&address, sizeof(address)); if (v == -1) I_Error ("BindToPort: bind: %s", strerror(errno)); } - - - - - void PacketSend (void) { int c; doomdata_t sw; - - sw.checksum = htonl(netbuffer->checksum); sw.player = netbuffer->player; sw.retransmitfrom = netbuffer->retransmitfrom; @@ -142,20 +76,10 @@ void PacketSend (void) sw.cmds[c].chatchar = netbuffer->cmds[c].chatchar; sw.cmds[c].buttons = netbuffer->cmds[c].buttons; } - - c = sendto (sendsocket , &sw, doomcom->datalength ,0,(void *)&sendaddress[doomcom->remotenode] ,sizeof(sendaddress[doomcom->remotenode])); - - - } - - - - - void PacketGet (void) { int i; @@ -163,7 +87,6 @@ void PacketGet (void) struct sockaddr_in fromaddress; int fromlen; doomdata_t sw; - fromlen = sizeof(fromaddress); c = recvfrom (insocket, &sw, sizeof(sw), 0 , (struct sockaddr *)&fromaddress, &fromlen ); @@ -174,36 +97,27 @@ void PacketGet (void) doomcom->remotenode = -1; return; } - { static int first=1; if (first) printf("len=%d:p=[0x%x 0x%x] \n", c, *(int*)&sw, *((int*)&sw+1)); first = 0; } - - for (i=0 ; i<doomcom->numnodes ; i++) if ( fromaddress.sin_addr.s_addr == sendaddress[i].sin_addr.s_addr ) break; - if (i == doomcom->numnodes) { - doomcom->remotenode = -1; return; } - doomcom->remotenode = i; doomcom->datalength = c; - - netbuffer->checksum = ntohl(sw.checksum); netbuffer->player = sw.player; netbuffer->retransmitfrom = sw.retransmitfrom; netbuffer->starttic = sw.starttic; netbuffer->numtics = sw.numtics; - for (c=0 ; c< netbuffer->numtics ; c++) { netbuffer->cmds[c].forwardmove = sw.cmds[c].forwardmove; @@ -214,42 +128,27 @@ void PacketGet (void) netbuffer->cmds[c].buttons = sw.cmds[c].buttons; } } - - - int GetLocalAddress (void) { char hostname[1024]; struct hostent* hostentry; int v; - - v = gethostname (hostname, sizeof(hostname)); if (v == -1) I_Error ("GetLocalAddress : gethostname: errno %d",errno); - hostentry = gethostbyname (hostname); if (!hostentry) I_Error ("GetLocalAddress : gethostbyname: couldn't get local host"); - return *(int *)hostentry->h_addr_list[0]; } - - - - - void I_InitNetwork (void) { boolean trueval = true; int i; int p; struct hostent* hostentry; - doomcom = malloc (sizeof (*doomcom) ); memset (doomcom, 0, sizeof(*doomcom) ); - - i = M_CheckParm ("-dup"); if (i && i< myargc-1) { @@ -261,25 +160,19 @@ void I_InitNetwork (void) } else doomcom-> ticdup = 1; - if (M_CheckParm ("-extratic")) doomcom-> extratics = 1; else doomcom-> extratics = 0; - p = M_CheckParm ("-port"); if (p && p<myargc-1) { DOOMPORT = atoi (myargv[p+1]); printf ("using alternate port %i\n",DOOMPORT); } - - - i = M_CheckParm ("-net"); if (!i) { - netgame = false; doomcom->id = DOOMCOM_ID; doomcom->numplayers = doomcom->numnodes = 1; @@ -287,16 +180,11 @@ void I_InitNetwork (void) doomcom->consoleplayer = 0; return; } - netsend = PacketSend; netget = PacketGet; netgame = true; - - doomcom->consoleplayer = myargv[i+1][0]-'1'; - doomcom->numnodes = 1; - i++; while (++i < myargc && myargv[i][0] != '-') { @@ -317,19 +205,13 @@ void I_InitNetwork (void) } doomcom->numnodes++; } - doomcom->id = DOOMCOM_ID; doomcom->numplayers = doomcom->numnodes; - - insocket = UDPsocket (); BindToLocalPort (insocket,htons(DOOMPORT)); ioctl (insocket, FIONBIO, &trueval); - sendsocket = UDPsocket (); } - - void I_NetCmd (void) { if (doomcom->command == CMD_SEND) @@ -343,4 +225,3 @@ void I_NetCmd (void) else I_Error ("Bad net cmd: %i\n",doomcom->command); } - diff --git a/src/i_net.h b/src/i_net.h @@ -1,45 +1,8 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __I_NET__ #define __I_NET__ - - #ifdef __GNUG__ #pragma interface #endif - - - - - - void I_InitNetwork (void); void I_NetCmd (void); - - #endif - - - - - diff --git a/src/i_sound.c b/src/i_sound.c @@ -1,155 +1,53 @@ - - - - - - - - - - - - - - - - - - - - - - - - #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <errno.h> #include <math.h> - #include <sys/time.h> #include <sys/types.h> - #include <fcntl.h> #include <unistd.h> #include <sys/ioctl.h> - - #include <linux/soundcard.h> - - #include <time.h> #include <signal.h> - #include "z_zone.h" - #include "i_system.h" #include "i_sound.h" #include "m_argv.h" #include "m_misc.h" #include "w_wad.h" - #include "doomdef.h" - - #ifdef SNDSERV - FILE* sndserver=0; char* sndserver_filename = "./sndserver "; #elif SNDINTR - - - - #define SOUND_INTERVAL 500 - - int I_SoundSetTimer( int duration_of_tick ); void I_SoundDelTimer( void ); #else - #endif - - - - - static int flag = 0; - - - - - - - - #define SAMPLECOUNT 512 #define NUM_CHANNELS 8 - #define BUFMUL 4 #define MIXBUFFERSIZE (SAMPLECOUNT*BUFMUL) - #define SAMPLERATE 11025 #define SAMPLESIZE 2 - - int lengths[NUMSFX]; - - int audio_fd; - - - - - signed short mixbuffer[MIXBUFFERSIZE]; - - - unsigned int channelstep[NUM_CHANNELS]; - unsigned int channelstepremainder[NUM_CHANNELS]; - - - unsigned char* channels[NUM_CHANNELS]; unsigned char* channelsend[NUM_CHANNELS]; - - - - - - - int channelstart[NUM_CHANNELS]; - - - - - int channelhandles[NUM_CHANNELS]; - - - int channelids[NUM_CHANNELS]; - - int steptable[256]; - - int vol_lookup[128*256]; - - int* channelleftvol_lookup[NUM_CHANNELS]; int* channelrightvol_lookup[NUM_CHANNELS]; - - - - - - - void myioctl ( int fd, @@ -157,7 +55,6 @@ myioctl int* arg ) { int rc; - rc = ioctl(fd, command, arg); if (rc < 0) { @@ -166,15 +63,6 @@ myioctl exit(-1); } } - - - - - - - - - void* getsfx ( char* sfxname, @@ -187,73 +75,22 @@ getsfx int paddedsize; char name[20]; int sfxlump; - - - - sprintf(name, "ds%s", sfxname); - - - - - - - - - - - if ( W_CheckNumForName(name) == -1 ) sfxlump = W_GetNumForName("dspistol"); else sfxlump = W_GetNumForName(name); - size = W_LumpLength( sfxlump ); - - - - - - - sfx = (unsigned char*)W_CacheLumpNum( sfxlump, PU_STATIC ); - - - paddedsize = ((size-8 + (SAMPLECOUNT-1)) / SAMPLECOUNT) * SAMPLECOUNT; - - paddedsfx = (unsigned char*)Z_Malloc( paddedsize+8, PU_STATIC, 0 ); - - - - - memcpy( paddedsfx, sfx, size ); for (i=size ; i<paddedsize+8 ; i++) paddedsfx[i] = 128; - - Z_Free( sfx ); - - *len = paddedsize; - - return (void *) (paddedsfx + 8); } - - - - - - - - - - - - int addsfx ( int sfxid, @@ -262,19 +99,13 @@ addsfx int seperation ) { static unsigned short handlenums = 0; - int i; int rc = -1; - int oldest = gametic; int oldestnum = 0; int slot; - int rightvol; int leftvol; - - - if ( sfxid == sfx_sawup || sfxid == sfx_sawidl || sfxid == sfx_sawful @@ -282,23 +113,16 @@ addsfx || sfxid == sfx_stnmov || sfxid == sfx_pistol ) { - for (i=0 ; i<NUM_CHANNELS ; i++) { - if ( (channels[i]) && (channelids[i] == sfxid) ) { - channels[i] = 0; - - break; } } } - - for (i=0; (i<NUM_CHANNELS) && (channels[i]); i++) { if (channelstart[i] < oldest) @@ -307,159 +131,62 @@ addsfx oldest = channelstart[i]; } } - - - - - if (i == NUM_CHANNELS) slot = oldestnum; else slot = i; - - - - channels[slot] = (unsigned char *) S_sfx[sfxid].data; - channelsend[slot] = channels[slot] + lengths[sfxid]; - - if (!handlenums) handlenums = 100; - - - channelhandles[slot] = rc = handlenums++; - - - channelstep[slot] = step; - channelstepremainder[slot] = 0; - channelstart[slot] = gametic; - - - seperation += 1; - - - - leftvol = volume - ((volume*seperation*seperation) >> 16); seperation = seperation - 257; rightvol = volume - ((volume*seperation*seperation) >> 16); - - if (rightvol < 0 || rightvol > 127) I_Error("rightvol out of bounds"); - if (leftvol < 0 || leftvol > 127) I_Error("leftvol out of bounds"); - - - channelleftvol_lookup[slot] = &vol_lookup[leftvol*256]; channelrightvol_lookup[slot] = &vol_lookup[rightvol*256]; - - - channelids[slot] = sfxid; - - return rc; } - - - - - - - - - - - - - - void I_SetChannels() { - - - int i; int j; - int* steptablemid = steptable + 128; - - /*for (i=0; i<NUM_CHANNELS; i++) { channels[i] = 0; }*/ - - - for (i=-128 ; i<128 ; i++) steptablemid[i] = (int)(pow(2.0, (i/64.0))*65536.0); - - - - - for (i=0 ; i<128 ; i++) for (j=0 ; j<256 ; j++) vol_lookup[i*256+j] = (i*(j-128)*256)/127; } - - void I_SetSfxVolume(int volume) { - - - - - snd_SfxVolume = volume; } - - void I_SetMusicVolume(int volume) { - snd_MusicVolume = volume; - - } - - - - - - int I_GetSfxLumpNum(sfxinfo_t* sfx) { char namebuf[9]; sprintf(namebuf, "ds%s", sfx->name); return W_GetNumForName(namebuf); } - - - - - - - - - - - - - int I_StartSound ( int id, @@ -468,202 +195,96 @@ I_StartSound int pitch, int priority ) { - - priority = 0; - #ifdef SNDSERV if (sndserver) { fprintf(sndserver, "p%2.2x%2.2x%2.2x%2.2x\n", id, pitch, vol, sep); fflush(sndserver); } - return id; #else - - - - id = addsfx( id, vol, steptable[pitch], sep ); - - - return id; #endif } - - - void I_StopSound (int handle) { - - - - - - handle = 0; } - - int I_SoundIsPlaying(int handle) { - return gametic < handle; } - - - - - - - - - - - - - - - - - void I_UpdateSound( void ) { #ifdef SNDINTR - static int misses = 0; #endif - - - - register unsigned int sample; register int dl; register int dr; - - signed short* leftout; signed short* rightout; signed short* leftend; - int step; - - int chan; - - - leftout = mixbuffer; rightout = mixbuffer+1; step = 2; - - - leftend = mixbuffer + SAMPLECOUNT*step; - - - - while (leftout != leftend) { - dl = 0; dr = 0; - - - - for ( chan = 0; chan < NUM_CHANNELS; chan++ ) { - if (channels[ chan ]) { - sample = *channels[ chan ]; - - - - dl += channelleftvol_lookup[ chan ][sample]; dr += channelrightvol_lookup[ chan ][sample]; - channelstepremainder[ chan ] += channelstep[ chan ]; - channels[ chan ] += channelstepremainder[ chan ] >> 16; - channelstepremainder[ chan ] &= 65536-1; - - if (channels[ chan ] >= channelsend[ chan ]) channels[ chan ] = 0; } } - - - - - - - if (dl > 0x7fff) *leftout = 0x7fff; else if (dl < -0x8000) *leftout = -0x8000; else *leftout = dl; - - if (dr > 0x7fff) *rightout = 0x7fff; else if (dr < -0x8000) *rightout = -0x8000; else *rightout = dr; - - leftout += step; rightout += step; } - #ifdef SNDINTR - if ( flag ) { misses += flag; flag = 0; } - if ( misses > 10 ) { fprintf( stderr, "I_SoundUpdate: missed 10 buffer writes\n"); misses = 0; } - - flag++; #endif } - - - - - - - - - - void I_SubmitSound(void) { - write(audio_fd, mixbuffer, SAMPLECOUNT*BUFMUL); } - - - void I_UpdateSoundParams ( int handle, @@ -671,76 +292,44 @@ I_UpdateSoundParams int sep, int pitch) { - - - - - - handle = vol = sep = pitch = 0; } - - - - void I_ShutdownSound(void) { #ifdef SNDSERV if (sndserver) { - fprintf(sndserver, "q\n"); fflush(sndserver); } #else - int done = 0; int i; - - - fprintf( stderr, "I_ShutdownSound: NOT finishing pending sounds\n"); fflush( stderr ); - while ( !done ) { for( i=0 ; i<8 && !channels[i] ; i++); - - - done=1; } #ifdef SNDINTR I_SoundDelTimer(); #endif - - close ( audio_fd ); #endif - - return; } - - - - - - void I_InitSound() { #ifdef SNDSERV char buffer[256]; - if (getenv("DOOMWADDIR")) sprintf(buffer, "%s/%s", getenv("DOOMWADDIR"), sndserver_filename); else sprintf(buffer, "%s", sndserver_filename); - - if ( !access(buffer, X_OK) ) { strcat(buffer, " -quiet"); @@ -749,230 +338,126 @@ I_InitSound() else fprintf(stderr, "Could not start sound server [%s]\n", buffer); #else - int i; - #ifdef SNDINTR fprintf( stderr, "I_SoundSetTimer: %d microsecs\n", SOUND_INTERVAL ); I_SoundSetTimer( SOUND_INTERVAL ); #endif - - fprintf( stderr, "I_InitSound: "); - audio_fd = open("/dev/dsp", O_WRONLY); if (audio_fd<0) fprintf(stderr, "Could not open /dev/dsp\n"); - - i = 11 | (2<<16); myioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &i); myioctl(audio_fd, SNDCTL_DSP_RESET, 0); - i=SAMPLERATE; - myioctl(audio_fd, SNDCTL_DSP_SPEED, &i); - i=1; myioctl(audio_fd, SNDCTL_DSP_STEREO, &i); - myioctl(audio_fd, SNDCTL_DSP_GETFMTS, &i); - if (i&=AFMT_S16_LE) myioctl(audio_fd, SNDCTL_DSP_SETFMT, &i); else fprintf(stderr, "Could not play signed 16 data\n"); - fprintf(stderr, " configured audio device\n" ); - - - fprintf( stderr, "I_InitSound: "); - for (i=1 ; i<NUMSFX ; i++) { - if (!S_sfx[i].link) { - S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] ); } else { - S_sfx[i].data = S_sfx[i].link->data; lengths[i] = lengths[(S_sfx[i].link - S_sfx)/sizeof(sfxinfo_t)]; } } - fprintf( stderr, " pre-cached all sound data\n"); - - for ( i = 0; i< MIXBUFFERSIZE; i++ ) mixbuffer[i] = 0; - - fprintf(stderr, "I_InitSound: sound module ready\n"); - #endif } - - - - - - - - - void I_InitMusic(void) { } void I_ShutdownMusic(void) { } - static int looping=0; static int musicdies=-1; - void I_PlaySong(int handle, int looping) { - handle = looping = 0; musicdies = gametic + TICRATE*30; } - void I_PauseSong (int handle) { - handle = 0; } - void I_ResumeSong (int handle) { - handle = 0; } - void I_StopSong(int handle) { - handle = 0; - looping = 0; musicdies = 0; } - void I_UnRegisterSong(int handle) { - handle = 0; } - int I_RegisterSong(void* data) { - data = NULL; - return 1; } - - int I_QrySongPlaying(int handle) { - handle = 0; return looping || musicdies > gametic; } - - - - - - - - - - - #ifdef sun typedef sigset_t tSigSet; #else typedef int tSigSet; #endif - - - - - - static int /*__itimer_which*/ itimer = ITIMER_REAL; - static int sig = SIGALRM; - - void I_HandleSoundTimer( int ignore ) { - - - - if ( flag ) { - - write(audio_fd, mixbuffer, SAMPLECOUNT*BUFMUL); - - flag = 0; } else return; - - ignore = 0; return; } - - int I_SoundSetTimer( int duration_of_tick ) { - struct itimerval value; struct itimerval ovalue; struct sigaction act; struct sigaction oact; - int res; - - - - - act.sa_handler = I_HandleSoundTimer; #ifndef sun - #endif act.sa_flags = SA_RESTART; - sigaction( sig, &act, &oact ); - value.it_interval.tv_sec = 0; value.it_interval.tv_usec = duration_of_tick; value.it_value.tv_sec = 0; value.it_value.tv_usec = duration_of_tick; - - res = setitimer( itimer, &value, &ovalue ); - - if ( res == -1 ) fprintf( stderr, "I_SoundSetTimer: interrupt n.a.\n"); - return res; } - - - void I_SoundDelTimer() { - if ( I_SoundSetTimer( 0 ) == -1) fprintf( stderr, "I_SoundDelTimer: failed to remove interrupt. Doh!\n"); } diff --git a/src/i_sound.h b/src/i_sound.h @@ -1,65 +1,19 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __I_SOUND__ #define __I_SOUND__ - #include "doomdef.h" - - #ifdef SNDSERV #include <stdio.h> extern FILE* sndserver; extern char* sndserver_filename; #endif - #include "doomstat.h" #include "sounds.h" - - - - void I_InitSound(); - - void I_UpdateSound(void); void I_SubmitSound(void); - - void I_ShutdownSound(void); - - - - - - - void I_SetChannels(); - - int I_GetSfxLumpNum (sfxinfo_t* sfxinfo ); - - - int I_StartSound ( int id, @@ -67,56 +21,24 @@ I_StartSound int sep, int pitch, int priority ); - - - void I_StopSound(int handle); - - - - int I_SoundIsPlaying(int handle); - - - void I_UpdateSoundParams ( int handle, int vol, int sep, int pitch ); - - - - - void I_InitMusic(void); void I_ShutdownMusic(void); - void I_SetMusicVolume(int volume); - void I_PauseSong(int handle); void I_ResumeSong(int handle); - int I_RegisterSong(void *data); - - - - void I_PlaySong ( int handle, int looping ); - void I_StopSong(int handle); - void I_UnRegisterSong(int handle); - - - #endif - - - - - diff --git a/src/i_system.c b/src/i_system.c @@ -1,116 +1,58 @@ - - - - - - - - - - - - - - - - - - - - - - - - #include <stdlib.h> #include <stdio.h> #include <string.h> - #include <stdarg.h> #include <sys/time.h> #include <unistd.h> - #include "doomdef.h" #include "m_misc.h" #include "i_video.h" #include "i_sound.h" - #include "d_net.h" #include "g_game.h" - #ifdef __GNUG__ #pragma implementation "i_system.h" #endif #include "i_system.h" - - - - int mb_used = 6; - - void I_Tactile ( int on, int off, int total ) { - on = off = total = 0; } - ticcmd_t emptycmd; ticcmd_t* I_BaseTiccmd(void) { return &emptycmd; } - - int I_GetHeapSize (void) { return mb_used*1024*1024; } - byte* I_ZoneBase (int* size) { *size = mb_used*1024*1024; return (byte *) malloc (*size); } - - - - - - - int I_GetTime (void) { struct timeval tp; struct timezone tzp; int newtics; static int basetime=0; - gettimeofday(&tp, &tzp); if (!basetime) basetime = tp.tv_sec; newtics = (tp.tv_sec-basetime)*TICRATE + tp.tv_usec*TICRATE/1000000; return newtics; } - - - - - - void I_Init (void) { I_InitSound(); - } - - - - void I_Quit (void) { D_QuitNetGame (); @@ -120,7 +62,6 @@ void I_Quit (void) I_ShutdownGraphics(); exit(0); } - void I_WaitVBL(int count) { #ifdef SGI @@ -133,49 +74,32 @@ void I_WaitVBL(int count) #endif #endif } - void I_BeginRead(void) { } - void I_EndRead(void) { } - byte* I_AllocLow(int length) { byte* mem; - mem = (byte *)malloc (length); memset (mem,0,length); return mem; } - - - - - extern boolean demorecording; - void I_Error (char *error, ...) { va_list argptr; - - va_start (argptr,error); fprintf (stderr, "Error: "); vfprintf (stderr,error,argptr); fprintf (stderr, "\n"); va_end (argptr); - fflush( stderr ); - - if (demorecording) G_CheckDemoStatus(); - D_QuitNetGame (); I_ShutdownGraphics(); - exit(-1); } diff --git a/src/i_system.h b/src/i_system.h @@ -1,97 +1,18 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __I_SYSTEM__ #define __I_SYSTEM__ - #include "d_ticcmd.h" #include "d_event.h" - #ifdef __GNUG__ #pragma interface #endif - - - void I_Init (void); - - - - byte* I_ZoneBase (int *size); - - - - int I_GetTime (void); - - - - - - - - - - void I_StartFrame (void); - - - - - - - void I_StartTic (void); - - - - - - - - - ticcmd_t* I_BaseTiccmd (void); - - - - void I_Quit (void); - - - - byte* I_AllocLow (int length); - void I_Tactile (int on, int off, int total); - - void I_Error (char *error, ...); - - #endif - - - - - diff --git a/src/i_video.c b/src/i_video.c @@ -1,62 +1,28 @@ - - - - - - - - - - - - - - - - - - - - - - - - #include <stdlib.h> #include <unistd.h> #include <sys/ipc.h> #include <sys/shm.h> - #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/keysym.h> - #include <X11/extensions/XShm.h> - - #ifdef LINUX int XShmGetEventBase( Display* dpy ); #endif - #include <stdarg.h> #include <sys/time.h> #include <sys/types.h> #include <sys/socket.h> - #include <netinet/in.h> #include <errno.h> #include <signal.h> - #include "doomstat.h" #include "i_system.h" #include "v_video.h" #include "m_argv.h" #include "d_main.h" - #include "doomdef.h" - #define POINTER_WARP_COUNTDOWN 1 - Display* X_display=0; Window X_mainWindow; Colormap X_cmap; @@ -68,35 +34,15 @@ XVisualInfo X_visualinfo; XImage* image; int X_width; int X_height; - - boolean doShm; - XShmSegmentInfo X_shminfo; int X_shmeventtype; - - - - boolean grabMouse; int doPointerWarp = POINTER_WARP_COUNTDOWN; - - - - - static int multiply=1; - - - - - - int xlatekey(void) { - int rc; - switch(rc = XKeycodeToKeysym(X_display, X_event.xkey.keycode, 0)) { case XK_Left: rc = KEY_LEFTARROW; break; @@ -118,35 +64,27 @@ int xlatekey(void) case XK_F10: rc = KEY_F10; break; case XK_F11: rc = KEY_F11; break; case XK_F12: rc = KEY_F12; break; - case XK_BackSpace: case XK_Delete: rc = KEY_BACKSPACE; break; - case XK_Pause: rc = KEY_PAUSE; break; - case XK_KP_Equal: case XK_equal: rc = KEY_EQUALS; break; - case XK_KP_Subtract: case XK_minus: rc = KEY_MINUS; break; - case XK_Shift_L: case XK_Shift_R: rc = KEY_RSHIFT; break; - case XK_Control_L: case XK_Control_R: rc = KEY_RCTRL; break; - case XK_Alt_L: case XK_Meta_L: case XK_Alt_R: case XK_Meta_R: rc = KEY_RALT; break; - default: if (rc >= XK_space && rc <= XK_asciitilde) rc = rc - XK_space + ' '; @@ -154,47 +92,26 @@ int xlatekey(void) rc = rc - 'A' + 'a'; break; } - return rc; - } - void I_ShutdownGraphics(void) { - if (!XShmDetach(X_display, &X_shminfo)) I_Error("XShmDetach() failed in I_ShutdownGraphics()"); - - shmdt(X_shminfo.shmaddr); shmctl(X_shminfo.shmid, IPC_RMID, 0); - - image->data = NULL; } - - - - - - void I_StartFrame (void) { - - } - static int lastmousex = 0; static int lastmousey = 0; boolean mousemoved = false; boolean shmFinished; - void I_GetEvent(void) { - event_t event; - - XNextEvent(X_display, &X_event); switch (X_event.type) { @@ -202,13 +119,11 @@ void I_GetEvent(void) event.type = ev_keydown; event.data1 = xlatekey(); D_PostEvent(&event); - break; case KeyRelease: event.type = ev_keyup; event.data1 = xlatekey(); D_PostEvent(&event); - break; case ButtonPress: event.type = ev_mouse; @@ -221,7 +136,6 @@ void I_GetEvent(void) | (X_event.xbutton.button == Button3 ? 4 : 0); event.data2 = event.data3 = 0; D_PostEvent(&event); - break; case ButtonRelease: event.type = ev_mouse; @@ -229,7 +143,6 @@ void I_GetEvent(void) (X_event.xbutton.state & Button1Mask) | (X_event.xbutton.state & Button2Mask ? 2 : 0) | (X_event.xbutton.state & Button3Mask ? 4 : 0); - event.data1 = event.data1 ^ (X_event.xbutton.button == Button1 ? 1 : 0) @@ -237,7 +150,6 @@ void I_GetEvent(void) ^ (X_event.xbutton.button == Button3 ? 4 : 0); event.data2 = event.data3 = 0; D_PostEvent(&event); - break; case MotionNotify: event.type = ev_mouse; @@ -247,7 +159,6 @@ void I_GetEvent(void) | (X_event.xmotion.state & Button3Mask ? 4 : 0); event.data2 = (X_event.xmotion.x - lastmousex) << 2; event.data3 = (lastmousey - X_event.xmotion.y) << 2; - if (event.data2 || event.data3) { lastmousex = X_event.xmotion.x; @@ -256,7 +167,6 @@ void I_GetEvent(void) X_event.xmotion.y != X_height/2) { D_PostEvent(&event); - mousemoved = false; } else { @@ -264,18 +174,14 @@ void I_GetEvent(void) } } break; - case Expose: case ConfigureNotify: break; - default: if (doShm && X_event.type == X_shmeventtype) shmFinished = true; break; } - } - Cursor createnullcursor ( Display* display, @@ -286,7 +192,6 @@ createnullcursor GC gc; XColor dummycolour; Cursor cursor; - cursormask = XCreatePixmap(display, root, 1, 1, 1/*depth*/); xgc.function = GXclear; gc = XCreateGC(display, cursormask, GCFunction, &xgc); @@ -300,22 +205,12 @@ createnullcursor XFreeGC(display,gc); return cursor; } - - - - void I_StartTic (void) { - if (!X_display) return; - while (XPending(X_display)) I_GetEvent(); - - - - if (grabMouse) { if (!--doPointerWarp) @@ -326,52 +221,30 @@ void I_StartTic (void) 0, 0, 0, 0, X_width/2, X_height/2); - doPointerWarp = POINTER_WARP_COUNTDOWN; } } - mousemoved = false; - } - - - - - void I_UpdateNoBlit (void) { - } - - - - void I_FinishUpdate (void) { - static int lasttic; int tics; int i; - - - if (devparm) { - i = I_GetTime(); tics = i - lasttic; lasttic = i; if (tics > 20) tics = 20; - for (i=0 ; i<tics*2 ; i+=2) screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff; for ( ; i<20*2 ; i+=2) screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0; - } - - if (multiply == 2) { unsigned int *olineptrs[2]; @@ -380,11 +253,9 @@ void I_FinishUpdate (void) unsigned int twoopixels; unsigned int twomoreopixels; unsigned int fouripixels; - ilineptr = (unsigned int *) (screens[0]); for (i=0 ; i<2 ; i++) olineptrs[i] = (unsigned int *) &image->data[i*X_width]; - y = SCREENHEIGHT; while (y--) { @@ -413,7 +284,6 @@ void I_FinishUpdate (void) olineptrs[0] += X_width/4; olineptrs[1] += X_width/4; } - } else if (multiply == 3) { @@ -422,11 +292,9 @@ void I_FinishUpdate (void) int x, y, i; unsigned int fouropixels[3]; unsigned int fouripixels; - ilineptr = (unsigned int *) (screens[0]); for (i=0 ; i<3 ; i++) olineptrs[i] = (unsigned int *) &image->data[i*X_width]; - y = SCREENHEIGHT; while (y--) { @@ -469,18 +337,14 @@ void I_FinishUpdate (void) olineptrs[1] += 2*X_width/4; olineptrs[2] += 2*X_width/4; } - } else if (multiply == 4) { - void Expand4(unsigned *, double *); Expand4 ((unsigned *)(screens[0]), (double *) (image->data)); } - if (doShm) { - if (!XShmPutImage( X_display, X_mainWindow, X_gc, @@ -490,19 +354,14 @@ void I_FinishUpdate (void) X_width, X_height, True )) I_Error("XShmPutImage() failed\n"); - - shmFinished = false; do { I_GetEvent(); } while (!shmFinished); - } else { - - XPutImage( X_display, X_mainWindow, X_gc, @@ -510,43 +369,25 @@ void I_FinishUpdate (void) 0, 0, 0, 0, X_width, X_height ); - - XSync(X_display, False); - } - } - - - - - void I_ReadScreen (byte* scr) { memcpy (scr, screens[0], SCREENWIDTH*SCREENHEIGHT); } - - - - - static XColor colors[256]; - void UploadNewPalette(Colormap cmap, byte *palette) { - register int i; register int c; static boolean firstcall = true; - #ifdef __cplusplus if (X_visualinfo.c_class == PseudoColor && X_visualinfo.depth == 8) #else if (X_visualinfo.class == PseudoColor && X_visualinfo.depth == 8) #endif { - if (firstcall) { firstcall = false; @@ -556,8 +397,6 @@ void UploadNewPalette(Colormap cmap, byte *palette) colors[i].flags = DoRed|DoGreen|DoBlue; } } - - for (i=0 ; i<256 ; i++) { c = gammatable[usegamma][*palette++]; @@ -567,41 +406,21 @@ void UploadNewPalette(Colormap cmap, byte *palette) c = gammatable[usegamma][*palette++]; colors[i].blue = (c<<8) + c; } - - XStoreColors(X_display, cmap, colors, 256); - } } - - - - void I_SetPalette (byte* palette) { UploadNewPalette(X_cmap, palette); } - - - - - - - - - void grabsharedmemory(int size) { - int key = ('d'<<24) | ('o'<<16) | ('o'<<8) | 'm'; struct shmid_ds shminfo; int minsize = 320*200; int id; int rc; - int pollution=5; - - do { id = shmget((key_t) key, minsize, 0777); @@ -626,15 +445,11 @@ void grabsharedmemory(int size) "Was able to kill my old shared memory\n"); else I_Error("Was NOT able to kill my old shared memory"); - id = shmget((key_t)key, size, IPC_CREAT|0777); if (id==-1) I_Error("Could not get shared memory"); - rc=shmctl(id, IPC_STAT, &shminfo); - break; - } if (size >= shminfo.shm_segsz) { @@ -671,76 +486,52 @@ void grabsharedmemory(int size) break; } } while (--pollution); - if (!pollution) { I_Error("Sorry, system too polluted with stale " "shared memory segments.\n"); } - X_shminfo.shmid = id; - - image->data = X_shminfo.shmaddr = shmat(id, 0, 0); - fprintf(stderr, "shared memory id=%d, addr=0x%x\n", id, (int) (image->data)); } - void I_InitGraphics(void) { - char* displayname; char* d; int n; int pnum; int x=0; int y=0; - - char xsign=' '; char ysign=' '; - int oktodraw; unsigned long attribmask; XSetWindowAttributes attribs; XGCValues xgcvalues; int valuemask; static int firsttime=1; - if (!firsttime) return; firsttime = 0; - signal(SIGINT, (void (*)(int)) I_Quit); - if (M_CheckParm("-2")) multiply = 2; - if (M_CheckParm("-3")) multiply = 3; - if (M_CheckParm("-4")) multiply = 4; - X_width = SCREENWIDTH * multiply; X_height = SCREENHEIGHT * multiply; - - if ( (pnum=M_CheckParm("-disp")) ) displayname = myargv[pnum+1]; else displayname = 0; - - grabMouse = !!M_CheckParm("-grabmouse"); - - if ( (pnum=M_CheckParm("-geom")) ) { - n = sscanf(myargv[pnum+1], "%c%d%c%d", &xsign, &x, &ysign, &y); - if (n==2) x = y = 0; else if (n==6) @@ -753,8 +544,6 @@ void I_InitGraphics(void) else I_Error("bad -geom parameter"); } - - X_display = XOpenDisplay(displayname); if (!X_display) { @@ -763,17 +552,11 @@ void I_InitGraphics(void) else I_Error("Could not open display (DISPLAY=[%s])", getenv("DISPLAY")); } - - X_screen = DefaultScreen(X_display); if (!XMatchVisualInfo(X_display, X_screen, 8, PseudoColor, &X_visualinfo)) I_Error("xdoom currently only supports 256-color PseudoColor screens"); X_visual = X_visualinfo.visual; - - doShm = XShmQueryExtension(X_display); - - if (doShm) { if (!displayname) displayname = (char *) getenv("DISPLAY"); @@ -785,25 +568,16 @@ void I_InitGraphics(void) if (!(!strcasecmp(displayname, "unix") || !*displayname)) doShm = false; } } - fprintf(stderr, "Using MITSHM extension\n"); - - X_cmap = XCreateColormap(X_display, RootWindow(X_display, X_screen), X_visual, AllocAll); - - attribmask = CWEventMask | CWColormap | CWBorderPixel; attribs.event_mask = KeyPressMask | KeyReleaseMask - | ExposureMask; - attribs.colormap = X_cmap; attribs.border_pixel = 0; - - X_mainWindow = XCreateWindow( X_display, RootWindow(X_display, X_screen), x, y, @@ -814,22 +588,15 @@ void I_InitGraphics(void) X_visual, attribmask, &attribs ); - XDefineCursor(X_display, X_mainWindow, createnullcursor( X_display, X_mainWindow ) ); - - valuemask = GCGraphicsExposures; xgcvalues.graphics_exposures = False; X_gc = XCreateGC( X_display, X_mainWindow, valuemask, &xgcvalues ); - - XMapWindow(X_display, X_mainWindow); - - oktodraw = 0; while (!oktodraw) { @@ -840,20 +607,14 @@ void I_InitGraphics(void) oktodraw = 1; } } - - if (grabMouse) XGrabPointer(X_display, X_mainWindow, True, ButtonPressMask|ButtonReleaseMask|PointerMotionMask, GrabModeAsync, GrabModeAsync, X_mainWindow, None, CurrentTime); - if (doShm) { - X_shmeventtype = XShmGetEventBase(X_display) + ShmCompletion; - - image = XShmCreateImage( X_display, X_visual, 8, @@ -862,34 +623,14 @@ void I_InitGraphics(void) &X_shminfo, X_width, X_height ); - grabsharedmemory(image->bytes_per_line * image->height); - - - - - - - - - - - - - - - - if (!image->data) { perror(""); I_Error("shmat() failed in InitGraphics()"); } - - if (!XShmAttach(X_display, &X_shminfo)) I_Error("XShmAttach() failed in InitGraphics()"); - } else { @@ -902,41 +643,30 @@ void I_InitGraphics(void) X_width, X_height, 8, X_width ); - } - if (multiply == 1) screens[0] = (unsigned char *) (image->data); else screens[0] = (unsigned char *) malloc (SCREENWIDTH * SCREENHEIGHT); - } - - unsigned exptable[256]; - void InitExpand (void) { int i; - for (i=0 ; i<256 ; i++) exptable[i] = i | (i<<8) | (i<<16) | (i<<24); } - double exptable2[256*256]; - void InitExpand2 (void) { int i; int j; - double* exp; union { double d; unsigned u[2]; } pixel; - printf ("building exptable2...\n"); exp = exptable2; for (i=0 ; i<256 ; i++) @@ -950,9 +680,7 @@ void InitExpand2 (void) } printf ("done.\n"); } - int inited; - void Expand4 ( unsigned* lineptr, @@ -964,85 +692,66 @@ Expand4 unsigned fourpixels; unsigned step; double* exp; - exp = exptable2; if (!inited) { inited = 1; InitExpand2 (); } - - step = 3*SCREENWIDTH/2; - y = SCREENHEIGHT-1; do { x = SCREENWIDTH; - do { fourpixels = lineptr[0]; - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) ); xline[0] = dpixel; xline[160] = dpixel; xline[320] = dpixel; xline[480] = dpixel; - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) ); xline[1] = dpixel; xline[161] = dpixel; xline[321] = dpixel; xline[481] = dpixel; - fourpixels = lineptr[1]; - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) ); xline[2] = dpixel; xline[162] = dpixel; xline[322] = dpixel; xline[482] = dpixel; - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) ); xline[3] = dpixel; xline[163] = dpixel; xline[323] = dpixel; xline[483] = dpixel; - fourpixels = lineptr[2]; - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) ); xline[4] = dpixel; xline[164] = dpixel; xline[324] = dpixel; xline[484] = dpixel; - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) ); xline[5] = dpixel; xline[165] = dpixel; xline[325] = dpixel; xline[485] = dpixel; - fourpixels = lineptr[3]; - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) ); xline[6] = dpixel; xline[166] = dpixel; xline[326] = dpixel; xline[486] = dpixel; - dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) ); xline[7] = dpixel; xline[167] = dpixel; xline[327] = dpixel; xline[487] = dpixel; - lineptr+=4; xline+=8; } while (x-=16); xline += step; } while (y--); } - - diff --git a/src/i_video.h b/src/i_video.h @@ -1,63 +1,16 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __I_VIDEO__ #define __I_VIDEO__ - - #include "doomtype.h" - #ifdef __GNUG__ #pragma interface #endif - - - - - void I_InitGraphics (void); - - void I_ShutdownGraphics(void); - - void I_SetPalette (byte* palette); - void I_UpdateNoBlit (void); void I_FinishUpdate (void); - - void I_WaitVBL(int count); - void I_ReadScreen (byte* scr); - void I_BeginRead (void); void I_EndRead (void); - - - #endif - - - - - diff --git a/src/info.c b/src/info.c @@ -1,40 +1,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - #include "sounds.h" #include "m_fixed.h" - #ifdef __GNUG__ #pragma implementation "info.h" #endif #include "info.h" - #include "p_mobj.h" - char *sprnames[NUMSPRITES] = { "TROO","SHTG","PUNG","PISG","PISF","SHTF","SHT2","CHGG","CHGF","MISG", "MISF","SAWG","PLSG","PLSF","BFGG","BFGF","BLUD","PUFF","BAL1","BAL2", @@ -51,9 +21,6 @@ char *sprnames[NUMSPRITES] = { "COL5","TBLU","TGRN","TRED","SMBT","SMGT","SMRT","HDB1","HDB2","HDB3", "HDB4","HDB5","HDB6","POB1","POB2","BRS1","TLMP","TLP2" }; - - - void A_Light0(); void A_WeaponReady(); void A_Lower(); @@ -128,8 +95,6 @@ void A_BrainSpit(); void A_SpawnSound(); void A_SpawnFly(); void A_BrainExplode(); - - state_t states[NUMSTATES] = { {SPR_TROO,0,-1,{NULL},S_NULL,0,0}, {SPR_SHTG,4,0,{A_Light0},S_NULL,0,0}, @@ -1099,10 +1064,7 @@ state_t states[NUMSTATES] = { {SPR_TLP2,32770,4,{NULL},S_TECH2LAMP4,0,0}, {SPR_TLP2,32771,4,{NULL},S_TECH2LAMP,0,0} }; - - mobjinfo_t mobjinfo[NUMMOBJTYPES] = { - { -1, S_PLAY, @@ -1128,7 +1090,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_DROPOFF|MF_PICKUP|MF_NOTDMATCH, S_NULL }, - { 3004, S_POSS_STND, @@ -1154,7 +1115,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_POSS_RAISE1 }, - { 9, S_SPOS_STND, @@ -1180,7 +1140,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_SPOS_RAISE1 }, - { 64, S_VILE_STND, @@ -1206,7 +1165,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_NULL }, - { -1, S_FIRE1, @@ -1232,7 +1190,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_NOGRAVITY, S_NULL }, - { 66, S_SKEL_STND, @@ -1258,7 +1215,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_SKEL_RAISE1 }, - { -1, S_TRACER, @@ -1284,7 +1240,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY, S_NULL }, - { -1, S_SMOKE1, @@ -1310,7 +1265,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_NOGRAVITY, S_NULL }, - { 67, S_FATT_STND, @@ -1336,7 +1290,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_FATT_RAISE1 }, - { -1, S_FATSHOT1, @@ -1362,7 +1315,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY, S_NULL }, - { 65, S_CPOS_STND, @@ -1388,7 +1340,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_CPOS_RAISE1 }, - { 3001, S_TROO_STND, @@ -1414,7 +1365,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_TROO_RAISE1 }, - { 3002, S_SARG_STND, @@ -1440,7 +1390,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_SARG_RAISE1 }, - { 58, S_SARG_STND, @@ -1466,7 +1415,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_SHADOW|MF_COUNTKILL, S_SARG_RAISE1 }, - { 3005, S_HEAD_STND, @@ -1492,7 +1440,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_FLOAT|MF_NOGRAVITY|MF_COUNTKILL, S_HEAD_RAISE1 }, - { 3003, S_BOSS_STND, @@ -1518,7 +1465,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_BOSS_RAISE1 }, - { -1, S_BRBALL1, @@ -1544,7 +1490,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY, S_NULL }, - { 69, S_BOS2_STND, @@ -1570,7 +1515,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_BOS2_RAISE1 }, - { 3006, S_SKULL_STND, @@ -1596,7 +1540,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_FLOAT|MF_NOGRAVITY, S_NULL }, - { 7, S_SPID_STND, @@ -1622,7 +1565,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_NULL }, - { 68, S_BSPI_STND, @@ -1648,7 +1590,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_BSPI_RAISE1 }, - { 16, S_CYBER_STND, @@ -1674,7 +1615,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_NULL }, - { 71, S_PAIN_STND, @@ -1700,7 +1640,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_FLOAT|MF_NOGRAVITY|MF_COUNTKILL, S_PAIN_RAISE1 }, - { 84, S_SSWV_STND, @@ -1726,7 +1665,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_COUNTKILL, S_SSWV_RAISE1 }, - { 72, S_KEENSTND, @@ -1752,7 +1690,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SPAWNCEILING|MF_NOGRAVITY|MF_SHOOTABLE|MF_COUNTKILL, S_NULL }, - { 88, S_BRAIN, @@ -1778,7 +1715,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE, S_NULL }, - { 89, S_BRAINEYE, @@ -1804,7 +1740,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_NOSECTOR, S_NULL }, - { 87, S_NULL, @@ -1830,7 +1765,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_NOSECTOR, S_NULL }, - { -1, S_SPAWN1, @@ -1856,7 +1790,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY|MF_NOCLIP, S_NULL }, - { -1, S_SPAWNFIRE1, @@ -1882,7 +1815,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_NOGRAVITY, S_NULL }, - { 2035, S_BAR1, @@ -1908,7 +1840,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SHOOTABLE|MF_NOBLOOD, S_NULL }, - { -1, S_TBALL1, @@ -1934,7 +1865,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY, S_NULL }, - { -1, S_RBALL1, @@ -1960,7 +1890,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY, S_NULL }, - { -1, S_ROCKET, @@ -1986,7 +1915,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY, S_NULL }, - { -1, S_PLASBALL, @@ -2012,7 +1940,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY, S_NULL }, - { -1, S_BFGSHOT, @@ -2038,7 +1965,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY, S_NULL }, - { -1, S_ARACH_PLAZ, @@ -2064,7 +1990,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_MISSILE|MF_DROPOFF|MF_NOGRAVITY, S_NULL }, - { -1, S_PUFF1, @@ -2090,7 +2015,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_NOGRAVITY, S_NULL }, - { -1, S_BLOOD1, @@ -2116,7 +2040,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP, S_NULL }, - { -1, S_TFOG, @@ -2142,7 +2065,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_NOGRAVITY, S_NULL }, - { -1, S_IFOG, @@ -2168,7 +2090,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_NOGRAVITY, S_NULL }, - { 14, S_NULL, @@ -2194,7 +2115,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_NOSECTOR, S_NULL }, - { -1, S_BFGEXP, @@ -2220,7 +2140,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP|MF_NOGRAVITY, S_NULL }, - { 2018, S_ARM1, @@ -2246,7 +2165,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2019, S_ARM2, @@ -2272,7 +2190,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2014, S_BON1, @@ -2298,7 +2215,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_COUNTITEM, S_NULL }, - { 2015, S_BON2, @@ -2324,7 +2240,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_COUNTITEM, S_NULL }, - { 5, S_BKEY, @@ -2350,7 +2265,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_NOTDMATCH, S_NULL }, - { 13, S_RKEY, @@ -2376,7 +2290,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_NOTDMATCH, S_NULL }, - { 6, S_YKEY, @@ -2402,7 +2315,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_NOTDMATCH, S_NULL }, - { 39, S_YSKULL, @@ -2428,7 +2340,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_NOTDMATCH, S_NULL }, - { 38, S_RSKULL, @@ -2454,7 +2365,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_NOTDMATCH, S_NULL }, - { 40, S_BSKULL, @@ -2480,7 +2390,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_NOTDMATCH, S_NULL }, - { 2011, S_STIM, @@ -2506,7 +2415,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2012, S_MEDI, @@ -2532,7 +2440,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2013, S_SOUL, @@ -2558,7 +2465,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_COUNTITEM, S_NULL }, - { 2022, S_PINV, @@ -2584,7 +2490,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_COUNTITEM, S_NULL }, - { 2023, S_PSTR, @@ -2610,7 +2515,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_COUNTITEM, S_NULL }, - { 2024, S_PINS, @@ -2636,7 +2540,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_COUNTITEM, S_NULL }, - { 2025, S_SUIT, @@ -2662,7 +2565,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2026, S_PMAP, @@ -2688,7 +2590,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_COUNTITEM, S_NULL }, - { 2045, S_PVIS, @@ -2714,7 +2615,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_COUNTITEM, S_NULL }, - { 83, S_MEGA, @@ -2740,7 +2640,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL|MF_COUNTITEM, S_NULL }, - { 2007, S_CLIP, @@ -2766,7 +2665,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2048, S_AMMO, @@ -2792,7 +2690,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2010, S_ROCK, @@ -2818,7 +2715,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2046, S_BROK, @@ -2844,7 +2740,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2047, S_CELL, @@ -2870,7 +2765,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 17, S_CELP, @@ -2896,7 +2790,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2008, S_SHEL, @@ -2922,7 +2815,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2049, S_SBOX, @@ -2948,7 +2840,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 8, S_BPAK, @@ -2974,7 +2865,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2006, S_BFUG, @@ -3000,7 +2890,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2002, S_MGUN, @@ -3026,7 +2915,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2005, S_CSAW, @@ -3052,7 +2940,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2003, S_LAUN, @@ -3078,7 +2965,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2004, S_PLAS, @@ -3104,7 +2990,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 2001, S_SHOT, @@ -3130,7 +3015,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 82, S_SHOT2, @@ -3156,7 +3040,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPECIAL, S_NULL }, - { 85, S_TECHLAMP, @@ -3182,7 +3065,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 86, S_TECH2LAMP, @@ -3208,7 +3090,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 2028, S_COLU, @@ -3234,7 +3115,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 30, S_TALLGRNCOL, @@ -3260,7 +3140,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 31, S_SHRTGRNCOL, @@ -3286,7 +3165,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 32, S_TALLREDCOL, @@ -3312,7 +3190,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 33, S_SHRTREDCOL, @@ -3338,7 +3215,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 37, S_SKULLCOL, @@ -3364,7 +3240,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 36, S_HEARTCOL, @@ -3390,7 +3265,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 41, S_EVILEYE, @@ -3416,7 +3290,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 42, S_FLOATSKULL, @@ -3442,7 +3315,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 43, S_TORCHTREE, @@ -3468,7 +3340,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 44, S_BLUETORCH, @@ -3494,7 +3365,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 45, S_GREENTORCH, @@ -3520,7 +3390,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 46, S_REDTORCH, @@ -3546,7 +3415,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 55, S_BTORCHSHRT, @@ -3572,7 +3440,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 56, S_GTORCHSHRT, @@ -3598,7 +3465,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 57, S_RTORCHSHRT, @@ -3624,7 +3490,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 47, S_STALAGTITE, @@ -3650,7 +3515,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 48, S_TECHPILLAR, @@ -3676,7 +3540,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 34, S_CANDLESTIK, @@ -3702,7 +3565,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, S_NULL }, - { 35, S_CANDELABRA, @@ -3728,7 +3590,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 49, S_BLOODYTWITCH, @@ -3754,7 +3615,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 50, S_MEAT2, @@ -3780,7 +3640,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 51, S_MEAT3, @@ -3806,7 +3665,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 52, S_MEAT4, @@ -3832,7 +3690,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 53, S_MEAT5, @@ -3858,7 +3715,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 59, S_MEAT2, @@ -3884,7 +3740,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 60, S_MEAT4, @@ -3910,7 +3765,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 61, S_MEAT3, @@ -3936,7 +3790,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 62, S_MEAT5, @@ -3962,7 +3815,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 63, S_BLOODYTWITCH, @@ -3988,7 +3840,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 22, S_HEAD_DIE6, @@ -4014,7 +3865,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, S_NULL }, - { 15, S_PLAY_DIE7, @@ -4040,7 +3890,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, S_NULL }, - { 18, S_POSS_DIE5, @@ -4066,7 +3915,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, S_NULL }, - { 21, S_SARG_DIE6, @@ -4092,7 +3940,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, S_NULL }, - { 23, S_SKULL_DIE6, @@ -4118,7 +3965,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, S_NULL }, - { 20, S_TROO_DIE5, @@ -4144,7 +3990,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, S_NULL }, - { 19, S_SPOS_DIE5, @@ -4170,7 +4015,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, S_NULL }, - { 10, S_PLAY_XDIE9, @@ -4196,7 +4040,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, S_NULL }, - { 12, S_PLAY_XDIE9, @@ -4222,7 +4065,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, S_NULL }, - { 28, S_HEADSONSTICK, @@ -4248,7 +4090,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 24, S_GIBS, @@ -4274,7 +4115,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, S_NULL }, - { 27, S_HEADONASTICK, @@ -4300,7 +4140,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 29, S_HEADCANDLES, @@ -4326,7 +4165,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 25, S_DEADSTICK, @@ -4352,7 +4190,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 26, S_LIVESTICK, @@ -4378,7 +4215,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 54, S_BIGTREE, @@ -4404,7 +4240,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 70, S_BBAR1, @@ -4430,7 +4265,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID, S_NULL }, - { 73, S_HANGNOGUTS, @@ -4456,7 +4290,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 74, S_HANGBNOBRAIN, @@ -4482,7 +4315,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 75, S_HANGTLOOKDN, @@ -4508,7 +4340,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 76, S_HANGTSKULL, @@ -4534,7 +4365,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 77, S_HANGTLOOKUP, @@ -4560,7 +4390,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 78, S_HANGTNOBRAIN, @@ -4586,7 +4415,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_SOLID|MF_SPAWNCEILING|MF_NOGRAVITY, S_NULL }, - { 79, S_COLONGIBS, @@ -4612,7 +4440,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP, S_NULL }, - { 80, S_SMALLPOOL, @@ -4638,7 +4465,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { MF_NOBLOCKMAP, S_NULL }, - { 81, S_BRAINSTEM, @@ -4665,4 +4491,3 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { S_NULL } }; - diff --git a/src/info.h b/src/info.h @@ -1,32 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - #ifndef __INFO__ #define __INFO__ - - #include "d_think.h" - typedef enum { SPR_TROO, @@ -168,9 +142,7 @@ typedef enum SPR_TLMP, SPR_TLP2, NUMSPRITES - } spritenum_t; - typedef enum { S_NULL, @@ -1142,24 +1114,17 @@ typedef enum S_TECH2LAMP4, NUMSTATES } statenum_t; - - typedef struct { spritenum_t sprite; long frame; long tics; - actionf_t action; statenum_t nextstate; long misc1, misc2; } state_t; - extern state_t states[NUMSTATES]; extern char *sprnames[NUMSPRITES]; - - - typedef enum { MT_PLAYER, MT_POSSESSED, @@ -1299,9 +1264,7 @@ typedef enum { MT_MISC85, MT_MISC86, NUMMOBJTYPES - } mobjtype_t; - typedef struct { int doomednum; @@ -1327,14 +1290,6 @@ typedef struct int activesound; int flags; int raisestate; - } mobjinfo_t; - extern mobjinfo_t mobjinfo[NUMMOBJTYPES]; - #endif - - - - - diff --git a/src/m_argv.c b/src/m_argv.c @@ -1,54 +1,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - #include <string.h> - int myargc; char** myargv; - - - - - - - - - - int M_CheckParm (char *check) { int i; - for (i = 1;i<myargc;i++) { if ( !strcasecmp(check, myargv[i]) ) return i; } - return 0; } - - - - diff --git a/src/m_argv.h b/src/m_argv.h @@ -1,42 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __M_ARGV__ #define __M_ARGV__ - - - - extern int myargc; extern char** myargv; - - - int M_CheckParm (char* check); - - #endif - - - - - diff --git a/src/m_bbox.c b/src/m_bbox.c @@ -1,45 +1,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - #ifdef __GNUG__ #pragma implementation "m_bbox.h" #endif #include "m_bbox.h" - - - - void M_ClearBox (fixed_t *box) { box[BOXTOP] = box[BOXRIGHT] = MININT; box[BOXBOTTOM] = box[BOXLEFT] = MAXINT; } - void M_AddToBox ( fixed_t* box, @@ -55,8 +22,3 @@ M_AddToBox else if (y>box[BOXTOP]) box[BOXTOP] = y; } - - - - - diff --git a/src/m_bbox.h b/src/m_bbox.h @@ -1,34 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __M_BBOX__ #define __M_BBOX__ - #include <values.h> - #include "m_fixed.h" - - - enum { BOXTOP, @@ -36,20 +9,10 @@ enum BOXLEFT, BOXRIGHT }; - - void M_ClearBox (fixed_t* box); - void M_AddToBox ( fixed_t* box, fixed_t x, fixed_t y ); - - #endif - - - - - diff --git a/src/m_cheat.c b/src/m_cheat.c @@ -1,42 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - #include "m_cheat.h" - - - - - static int firsttime = 1; static unsigned char cheat_xlate_table[256]; - - - - - - int cht_CheckCheat ( cheatseq_t* cht, @@ -44,23 +8,19 @@ cht_CheckCheat { int i; int rc = 0; - if (firsttime) { firsttime = 0; for (i=0;i<256;i++) cheat_xlate_table[i] = SCRAMBLE(i); } - if (!cht->p) cht->p = cht->sequence; - if (*cht->p == 0) *(cht->p++) = key; else if (cheat_xlate_table[(unsigned char)key] == *cht->p) cht->p++; else cht->p = cht->sequence; - if (*cht->p == 1) cht->p++; else if (*cht->p == 0xff) @@ -68,21 +28,16 @@ cht_CheckCheat cht->p = cht->sequence; rc = 1; } - return rc; } - void cht_GetParam ( cheatseq_t* cht, char* buffer ) { - unsigned char *p, c; - p = cht->sequence; while (*(p++) != 1); - do { c = *p; @@ -90,10 +45,6 @@ cht_GetParam *(p++) = 0; } while (c && *p!=0xff ); - if (*p==0xff) *buffer = 0; - } - - diff --git a/src/m_cheat.h b/src/m_cheat.h @@ -1,58 +1,19 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __M_CHEAT__ #define __M_CHEAT__ - - - - - #define SCRAMBLE(a) \ ((((a)&1)<<7) + (((a)&2)<<5) + ((a)&4) + (((a)&8)<<1) \ + (((a)&16)>>1) + ((a)&32) + (((a)&64)>>5) + (((a)&128)>>7)) - typedef struct { unsigned char* sequence; unsigned char* p; - } cheatseq_t; - int cht_CheckCheat ( cheatseq_t* cht, char key ); - - void cht_GetParam ( cheatseq_t* cht, char* buffer ); - - #endif - - - - - diff --git a/src/m_fixed.c b/src/m_fixed.c @@ -1,43 +1,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - #include "stdlib.h" - #include "doomtype.h" #include "i_system.h" - #ifdef __GNUG__ #pragma implementation "m_fixed.h" #endif #include "m_fixed.h" - - - - - - fixed_t FixedMul ( fixed_t a, @@ -45,13 +12,6 @@ FixedMul { return ((long long) a * (long long) b) >> FRACBITS; } - - - - - - - fixed_t FixedDiv ( fixed_t a, @@ -61,9 +21,6 @@ FixedDiv return (a^b)<0 ? MININT : MAXINT; return FixedDiv2 (a,b); } - - - fixed_t FixedDiv2 ( fixed_t a, @@ -74,11 +31,8 @@ FixedDiv2 c = ((long long)a<<16) / ((long long)b); return (fixed_t) c; #endif - double c; - c = ((double)a) / ((double)b) * FRACUNIT; - if (c >= 2147483648.0 || c < -2147483648.0) I_Error("FixedDiv: divide by zero"); return (fixed_t) c; diff --git a/src/m_fixed.h b/src/m_fixed.h @@ -1,51 +1,12 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __M_FIXED__ #define __M_FIXED__ - - #ifdef __GNUG__ #pragma interface #endif - - - - - #define FRACBITS 16 #define FRACUNIT (1<<FRACBITS) - typedef int fixed_t; - fixed_t FixedMul (fixed_t a, fixed_t b); fixed_t FixedDiv (fixed_t a, fixed_t b); fixed_t FixedDiv2 (fixed_t a, fixed_t b); - - - #endif - - - - - diff --git a/src/m_menu.c b/src/m_menu.c @@ -1,109 +1,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #include <ctype.h> - - #include "doomdef.h" #include "dstrings.h" - #include "d_main.h" - #include "i_system.h" #include "i_video.h" #include "z_zone.h" #include "v_video.h" #include "w_wad.h" - #include "r_local.h" - - #include "hu_stuff.h" - #include "g_game.h" - #include "m_argv.h" #include "m_swap.h" - #include "s_sound.h" - #include "doomstat.h" - - #include "sounds.h" - #include "m_menu.h" - - - extern patch_t* hu_font[HU_FONTSIZE]; extern boolean message_dontfuckwithme; - extern boolean chat_on; - - - - int mouseSensitivity; - - int showMessages; - - - int detailLevel; int screenblocks; - - int screenSize; - - int quickSaveSlot; - - int messageToPrint; - char* messageString; - - int messx; int messy; int messageLastMenuActive; - - boolean messageNeedsInput; - void (*messageRoutine)(int response); - #define SAVESTRINGSIZE 24 - char gammamsg[5][26] = { GAMMALVL0, @@ -112,47 +46,24 @@ char gammamsg[5][26] = GAMMALVL3, GAMMALVL4 }; - - int saveStringEnter; int saveSlot; int saveCharIndex; - char saveOldString[SAVESTRINGSIZE]; - boolean inhelpscreens; boolean menuactive; - #define SKULLXOFF -32 #define LINEHEIGHT 16 - extern boolean sendpause; char savegamestrings[10][SAVESTRINGSIZE]; - char endstring[160]; - - - - - typedef struct { - short status; - char name[10]; - - - - void (*routine)(int choice); - - char alphaKey; } menuitem_t; - - - typedef struct menu_s { short numitems; @@ -163,21 +74,11 @@ typedef struct menu_s short y; short lastOn; } menu_t; - short itemOn; short skullAnimCounter; short whichSkull; - - - char skullName[2][/*8*/9] = {"M_SKULL1","M_SKULL2"}; - - menu_t* currentMenu; - - - - void M_NewGame(int choice); void M_Episode(int choice); void M_ChooseSkill(int choice); @@ -188,7 +89,6 @@ void M_EndGame(int choice); void M_ReadThis(int choice); void M_ReadThis2(int choice); void M_QuitDOOM(int choice); - void M_ChangeMessages(int choice); void M_ChangeSensitivity(int choice); void M_SfxVol(int choice); @@ -197,14 +97,12 @@ void M_ChangeDetail(int choice); void M_SizeDisplay(int choice); void M_StartGame(int choice); void M_Sound(int choice); - void M_FinishReadThis(int choice); void M_LoadSelect(int choice); void M_SaveSelect(int choice); void M_ReadSaveStrings(void); void M_QuickSave(void); void M_QuickLoad(void); - void M_DrawMainMenu(void); void M_DrawReadThis1(void); void M_DrawReadThis2(void); @@ -214,7 +112,6 @@ void M_DrawOptions(void); void M_DrawSound(void); void M_DrawLoad(void); void M_DrawSave(void); - void M_DrawSaveLoadBorder(int x,int y); void M_SetupNextMenu(menu_t *menudef); void M_DrawThermo(int x,int y,int thermWidth,int thermDot); @@ -227,13 +124,6 @@ void M_StartControlPanel(void); void M_StartMessage(char *string,void *routine,boolean input); void M_StopMessage(void); void M_ClearMenus (void); - - - - - - - enum { newgame = 0, @@ -244,18 +134,15 @@ enum quitdoom, main_end } main_e; - menuitem_t MainMenu[]= { {1,"M_NGAME",M_NewGame,'n'}, {1,"M_OPTION",M_Options,'o'}, {1,"M_LOADG",M_LoadGame,'l'}, {1,"M_SAVEG",M_SaveGame,'s'}, - {1,"M_RDTHIS",M_ReadThis,'r'}, {1,"M_QUITG",M_QuitDOOM,'q'} }; - menu_t MainDef = { main_end, @@ -265,11 +152,6 @@ menu_t MainDef = 97,64, 0 }; - - - - - enum { ep1, @@ -278,7 +160,6 @@ enum ep4, ep_end } episodes_e; - menuitem_t EpisodeMenu[]= { {1,"M_EPI1", M_Episode,'k'}, @@ -286,7 +167,6 @@ menuitem_t EpisodeMenu[]= {1,"M_EPI3", M_Episode,'i'}, {1,"M_EPI4", M_Episode,'t'} }; - menu_t EpiDef = { ep_end, @@ -296,10 +176,6 @@ menu_t EpiDef = 48,63, ep1 }; - - - - enum { killthings, @@ -309,7 +185,6 @@ enum nightmare, newg_end } newgame_e; - menuitem_t NewGameMenu[]= { {1,"M_JKILL", M_ChooseSkill, 'i'}, @@ -318,7 +193,6 @@ menuitem_t NewGameMenu[]= {1,"M_ULTRA", M_ChooseSkill, 'u'}, {1,"M_NMARE", M_ChooseSkill, 'n'} }; - menu_t NewDef = { newg_end, @@ -328,12 +202,6 @@ menu_t NewDef = 48,63, hurtme }; - - - - - - enum { endgame, @@ -346,7 +214,6 @@ enum soundvol, opt_end } options_e; - menuitem_t OptionsMenu[]= { {1,"M_ENDGAM", M_EndGame,'e'}, @@ -358,7 +225,6 @@ menuitem_t OptionsMenu[]= {-1,"",0}, {1,"M_SVOL", M_Sound,'s'} }; - menu_t OptionsDef = { opt_end, @@ -368,21 +234,15 @@ menu_t OptionsDef = 60,37, 0 }; - - - - enum { rdthsempty1, read1_end } read_e; - menuitem_t ReadMenu1[] = { {1,"",M_ReadThis2,0} }; - menu_t ReadDef1 = { read1_end, @@ -392,18 +252,15 @@ menu_t ReadDef1 = 280,185, 0 }; - enum { rdthsempty2, read2_end } read_e2; - menuitem_t ReadMenu2[]= { {1,"",M_FinishReadThis,0} }; - menu_t ReadDef2 = { read2_end, @@ -413,10 +270,6 @@ menu_t ReadDef2 = 330,175, 0 }; - - - - enum { sfx_vol, @@ -425,7 +278,6 @@ enum sfx_empty2, sound_end } sound_e; - menuitem_t SoundMenu[]= { {2,"M_SFXVOL",M_SfxVol,'s'}, @@ -433,7 +285,6 @@ menuitem_t SoundMenu[]= {2,"M_MUSVOL",M_MusicVol,'m'}, {-1,"",0} }; - menu_t SoundDef = { sound_end, @@ -443,10 +294,6 @@ menu_t SoundDef = 80,64, 0 }; - - - - enum { load1, @@ -457,7 +304,6 @@ enum load6, load_end } load_e; - menuitem_t LoadMenu[]= { {1,"", M_LoadSelect,'1'}, @@ -467,7 +313,6 @@ menuitem_t LoadMenu[]= {1,"", M_LoadSelect,'5'}, {1,"", M_LoadSelect,'6'} }; - menu_t LoadDef = { load_end, @@ -477,10 +322,6 @@ menu_t LoadDef = 80,54, 0 }; - - - - menuitem_t SaveMenu[]= { {1,"", M_SaveSelect,'1'}, @@ -490,7 +331,6 @@ menuitem_t SaveMenu[]= {1,"", M_SaveSelect,'5'}, {1,"", M_SaveSelect,'6'} }; - menu_t SaveDef = { load_end, @@ -500,26 +340,18 @@ menu_t SaveDef = 80,54, 0 }; - - - - - - void M_ReadSaveStrings(void) { int handle; int count; int i; char name[256]; - for (i = 0;i < load_end;i++) { if (M_CheckParm("-cdrom")) sprintf(name,"c:\\doomdata\\"SAVEGAMENAME"%d.dsg",i); else sprintf(name,SAVEGAMENAME"%d.dsg",i); - handle = open (name, O_RDONLY | 0, 0666); if (handle == -1) { @@ -532,15 +364,9 @@ void M_ReadSaveStrings(void) LoadMenu[i].status = 1; } } - - - - - void M_DrawLoad(void) { int i; - V_DrawPatchDirect (72,28,0,W_CacheLumpName("M_LOADG",PU_CACHE)); for (i = 0;i < load_end; i++) { @@ -548,36 +374,20 @@ void M_DrawLoad(void) M_WriteText(LoadDef.x,LoadDef.y+LINEHEIGHT*i,savegamestrings[i]); } } - - - - - - void M_DrawSaveLoadBorder(int x,int y) { int i; - V_DrawPatchDirect (x-8,y+7,0,W_CacheLumpName("M_LSLEFT",PU_CACHE)); - for (i = 0;i < 24;i++) { V_DrawPatchDirect (x,y+7,0,W_CacheLumpName("M_LSCNTR",PU_CACHE)); x += 8; } - V_DrawPatchDirect (x,y+7,0,W_CacheLumpName("M_LSRGHT",PU_CACHE)); } - - - - - - void M_LoadSelect(int choice) { char name[256]; - if (M_CheckParm("-cdrom")) sprintf(name,"c:\\doomdata\\"SAVEGAMENAME"%d.dsg",choice); else @@ -585,10 +395,6 @@ void M_LoadSelect(int choice) G_LoadGame (name); M_ClearMenus (); } - - - - void M_LoadGame (int choice) { if (netgame) @@ -596,64 +402,40 @@ void M_LoadGame (int choice) M_StartMessage(LOADNET,NULL,false); return; } - M_SetupNextMenu(&LoadDef); M_ReadSaveStrings(); } - - - - - void M_DrawSave(void) { int i; - V_DrawPatchDirect (72,28,0,W_CacheLumpName("M_SAVEG",PU_CACHE)); for (i = 0;i < load_end; i++) { M_DrawSaveLoadBorder(LoadDef.x,LoadDef.y+LINEHEIGHT*i); M_WriteText(LoadDef.x,LoadDef.y+LINEHEIGHT*i,savegamestrings[i]); } - if (saveStringEnter) { i = M_StringWidth(savegamestrings[saveSlot]); M_WriteText(LoadDef.x + i,LoadDef.y+LINEHEIGHT*saveSlot,"_"); } } - - - - void M_DoSave(int slot) { G_SaveGame (slot,savegamestrings[slot]); M_ClearMenus (); - - if (quickSaveSlot == -2) quickSaveSlot = slot; } - - - - void M_SaveSelect(int choice) { - saveStringEnter = 1; - saveSlot = choice; strcpy(saveOldString,savegamestrings[choice]); if (!strcmp(savegamestrings[choice],EMPTYSTRING)) savegamestrings[choice][0] = 0; saveCharIndex = strlen(savegamestrings[choice]); } - - - - void M_SaveGame (int choice) { if (!usergame) @@ -661,21 +443,12 @@ void M_SaveGame (int choice) M_StartMessage(SAVEDEAD,NULL,false); return; } - if (gamestate != GS_LEVEL) return; - M_SetupNextMenu(&SaveDef); M_ReadSaveStrings(); } - - - - - - char tempstring[80]; - void M_QuickSaveResponse(int ch) { if (ch == 'y') @@ -684,7 +457,6 @@ void M_QuickSaveResponse(int ch) S_StartSound(NULL,sfx_swtchx); } } - void M_QuickSave(void) { if (!usergame) @@ -692,10 +464,8 @@ void M_QuickSave(void) S_StartSound(NULL,sfx_oof); return; } - if (gamestate != GS_LEVEL) return; - if (quickSaveSlot < 0) { M_StartControlPanel(); @@ -707,12 +477,6 @@ void M_QuickSave(void) sprintf(tempstring,QSPROMPT,savegamestrings[quickSaveSlot]); M_StartMessage(tempstring,M_QuickSaveResponse,true); } - - - - - - void M_QuickLoadResponse(int ch) { if (ch == 'y') @@ -721,8 +485,6 @@ void M_QuickLoadResponse(int ch) S_StartSound(NULL,sfx_swtchx); } } - - void M_QuickLoad(void) { if (netgame) @@ -730,7 +492,6 @@ void M_QuickLoad(void) M_StartMessage(QLOADNET,NULL,false); return; } - if (quickSaveSlot < 0) { M_StartMessage(QSAVESPOT,NULL,false); @@ -739,14 +500,6 @@ void M_QuickLoad(void) sprintf(tempstring,QLPROMPT,savegamestrings[quickSaveSlot]); M_StartMessage(tempstring,M_QuickLoadResponse,true); } - - - - - - - - void M_DrawReadThis1(void) { inhelpscreens = true; @@ -765,12 +518,6 @@ void M_DrawReadThis1(void) } return; } - - - - - - void M_DrawReadThis2(void) { inhelpscreens = true; @@ -778,7 +525,6 @@ void M_DrawReadThis2(void) { case retail: case commercial: - V_DrawPatchDirect (0,0,0,W_CacheLumpName("CREDIT",PU_CACHE)); break; case shareware: @@ -790,27 +536,18 @@ void M_DrawReadThis2(void) } return; } - - - - - void M_DrawSound(void) { V_DrawPatchDirect (60,38,0,W_CacheLumpName("M_SVOL",PU_CACHE)); - M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(sfx_vol+1), 16,snd_SfxVolume); - M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(music_vol+1), 16,snd_MusicVolume); } - void M_Sound(int choice) { M_SetupNextMenu(&SoundDef); } - void M_SfxVol(int choice) { switch(choice) @@ -824,10 +561,8 @@ void M_SfxVol(int choice) snd_SfxVolume++; break; } - S_SetSfxVolume(snd_SfxVolume /* *8 */); } - void M_MusicVol(int choice) { switch(choice) @@ -841,33 +576,17 @@ void M_MusicVol(int choice) snd_MusicVolume++; break; } - S_SetMusicVolume(snd_MusicVolume /* *8 */); } - - - - - - - void M_DrawMainMenu(void) { V_DrawPatchDirect (94,2,0,W_CacheLumpName("M_DOOM",PU_CACHE)); } - - - - - - - void M_DrawNewGame(void) { V_DrawPatchDirect (96,14,0,W_CacheLumpName("M_NEWG",PU_CACHE)); V_DrawPatchDirect (54,38,0,W_CacheLumpName("M_SKILL",PU_CACHE)); } - void M_NewGame(int choice) { if (netgame && !demoplayback) @@ -875,33 +594,23 @@ void M_NewGame(int choice) M_StartMessage(NEWGAME,NULL,false); return; } - if ( gamemode == commercial ) M_SetupNextMenu(&NewDef); else M_SetupNextMenu(&EpiDef); } - - - - - int epi; - void M_DrawEpisode(void) { V_DrawPatchDirect (54,38,0,W_CacheLumpName("M_EPISOD",PU_CACHE)); } - void M_VerifyNightmare(int ch) { if (ch != 'y') return; - G_DeferedInitNew(nightmare,epi+1,1); M_ClearMenus (); } - void M_ChooseSkill(int choice) { if (choice == nightmare) @@ -909,11 +618,9 @@ void M_ChooseSkill(int choice) M_StartMessage(NIGHTMARE,M_VerifyNightmare,true); return; } - G_DeferedInitNew(choice,epi+1,1); M_ClearMenus (); } - void M_Episode(int choice) { if ( (gamemode == shareware) @@ -923,8 +630,6 @@ void M_Episode(int choice) M_SetupNextMenu(&ReadDef1); return; } - - if ( (gamemode == registered) && (choice > 2)) { @@ -932,75 +637,45 @@ void M_Episode(int choice) "M_Episode: 4th episode requires UltimateDOOM\n"); choice = 0; } - epi = choice; M_SetupNextMenu(&NewDef); } - - - - - - char detailNames[2][9] = {"M_GDHIGH","M_GDLOW"}; char msgNames[2][9] = {"M_MSGOFF","M_MSGON"}; - - void M_DrawOptions(void) { V_DrawPatchDirect (108,15,0,W_CacheLumpName("M_OPTTTL",PU_CACHE)); - V_DrawPatchDirect (OptionsDef.x + 175,OptionsDef.y+LINEHEIGHT*detail,0, W_CacheLumpName(detailNames[detailLevel],PU_CACHE)); - V_DrawPatchDirect (OptionsDef.x + 120,OptionsDef.y+LINEHEIGHT*messages,0, W_CacheLumpName(msgNames[showMessages],PU_CACHE)); - M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(mousesens+1), 10,mouseSensitivity); - M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(scrnsize+1), 9,screenSize); } - void M_Options(int choice) { M_SetupNextMenu(&OptionsDef); } - - - - - - void M_ChangeMessages(int choice) { - choice = 0; showMessages = 1 - showMessages; - if (!showMessages) players[consoleplayer].message = MSGOFF; else players[consoleplayer].message = MSGON ; - message_dontfuckwithme = true; } - - - - - void M_EndGameResponse(int ch) { if (ch != 'y') return; - currentMenu->lastOn = itemOn; M_ClearMenus (); D_StartTitle (); } - void M_EndGame(int choice) { choice = 0; @@ -1009,46 +684,28 @@ void M_EndGame(int choice) S_StartSound(NULL,sfx_oof); return; } - if (netgame) { M_StartMessage(NETEND,NULL,false); return; } - M_StartMessage(ENDGAME,M_EndGameResponse,true); } - - - - - - - void M_ReadThis(int choice) { choice = 0; M_SetupNextMenu(&ReadDef1); } - void M_ReadThis2(int choice) { choice = 0; M_SetupNextMenu(&ReadDef2); } - void M_FinishReadThis(int choice) { choice = 0; M_SetupNextMenu(&MainDef); } - - - - - - - int quitsounds[8] = { sfx_pldeth, @@ -1060,7 +717,6 @@ int quitsounds[8] = sfx_posit3, sfx_sgtatk }; - int quitsounds2[8] = { sfx_vilact, @@ -1072,9 +728,6 @@ int quitsounds2[8] = sfx_bspact, sfx_sgtatk }; - - - void M_QuitResponse(int ch) { if (ch != 'y') @@ -1089,25 +742,14 @@ void M_QuitResponse(int ch) } I_Quit (); } - - - - void M_QuitDOOM(int choice) { - - if (language != english ) sprintf(endstring,"%s\n\n"DOSY, endmsg[0] ); else sprintf(endstring,"%s\n\n"DOSY, endmsg[ (gametic%(NUM_QUITMESSAGES-2))+1 ]); - M_StartMessage(endstring,M_QuitResponse,true); } - - - - void M_ChangeSensitivity(int choice) { switch(choice) @@ -1122,31 +764,18 @@ void M_ChangeSensitivity(int choice) break; } } - - - - void M_ChangeDetail(int choice) { choice = 0; detailLevel = 1 - detailLevel; - - fprintf( stderr, "M_ChangeDetail: low detail mode n.a.\n"); - return; - /*R_SetViewSize (screenblocks, detailLevel); - if (!detailLevel) players[consoleplayer].message = DETAILHI; else players[consoleplayer].message = DETAILLO;*/ } - - - - void M_SizeDisplay(int choice) { switch(choice) @@ -1166,17 +795,8 @@ void M_SizeDisplay(int choice) } break; } - - R_SetViewSize (screenblocks, detailLevel); } - - - - - - - void M_DrawThermo ( int x, @@ -1186,7 +806,6 @@ M_DrawThermo { int xx; int i; - xx = x; V_DrawPatchDirect (xx,y,0,W_CacheLumpName("M_THERML",PU_CACHE)); xx += 8; @@ -1196,13 +815,9 @@ M_DrawThermo xx += 8; } V_DrawPatchDirect (xx,y,0,W_CacheLumpName("M_THERMR",PU_CACHE)); - V_DrawPatchDirect ((x+8) + thermDot*8,y, 0,W_CacheLumpName("M_THERMO",PU_CACHE)); } - - - void M_DrawEmptyCell ( menu_t* menu, @@ -1211,7 +826,6 @@ M_DrawEmptyCell V_DrawPatchDirect (menu->x - 10, menu->y+item*LINEHEIGHT - 1, 0, W_CacheLumpName("M_CELL1",PU_CACHE)); } - void M_DrawSelCell ( menu_t* menu, @@ -1220,8 +834,6 @@ M_DrawSelCell V_DrawPatchDirect (menu->x - 10, menu->y+item*LINEHEIGHT - 1, 0, W_CacheLumpName("M_CELL2",PU_CACHE)); } - - void M_StartMessage ( char* string, @@ -1236,26 +848,16 @@ M_StartMessage menuactive = true; return; } - - - void M_StopMessage(void) { menuactive = messageLastMenuActive; messageToPrint = 0; } - - - - - - int M_StringWidth(char* string) { int i; int w = 0; int c; - for (i = 0;i < strlen(string);i++) { c = toupper(string[i]) - HU_FONTSTART; @@ -1264,33 +866,19 @@ int M_StringWidth(char* string) else w += SHORT (hu_font[c]->width); } - return w; } - - - - - - int M_StringHeight(char* string) { int i; int h; int height = SHORT(hu_font[0]->height); - h = height; for (i = 0;i < strlen(string);i++) if (string[i] == '\n') h += height; - return h; } - - - - - void M_WriteText ( int x, @@ -1302,12 +890,9 @@ M_WriteText int c; int cx; int cy; - - ch = string; cx = x; cy = y; - while(1) { c = *ch++; @@ -1319,14 +904,12 @@ M_WriteText cy += 12; continue; } - c = toupper(c) - HU_FONTSTART; if (c < 0 || c>= HU_FONTSIZE) { cx += 4; continue; } - w = SHORT (hu_font[c]->width); if (cx+w > SCREENWIDTH) break; @@ -1334,16 +917,6 @@ M_WriteText cx+=w; } } - - - - - - - - - - boolean M_Responder (event_t* ev) { int ch; @@ -1354,9 +927,7 @@ boolean M_Responder (event_t* ev) static int lasty = 0; static int mousex = 0; static int lastx = 0; - ch = -1; - if (ev->type == ev_joystick && joywait < I_GetTime()) { if (ev->data3 == -1) @@ -1369,7 +940,6 @@ boolean M_Responder (event_t* ev) ch = KEY_DOWNARROW; joywait = I_GetTime() + 5; } - if (ev->data2 == -1) { ch = KEY_LEFTARROW; @@ -1380,7 +950,6 @@ boolean M_Responder (event_t* ev) ch = KEY_RIGHTARROW; joywait = I_GetTime() + 2; } - if (ev->data1&1) { ch = KEY_ENTER; @@ -1409,7 +978,6 @@ boolean M_Responder (event_t* ev) mousewait = I_GetTime() + 5; mousey = lasty += 30; } - mousex += ev->data2; if (mousex < lastx-30) { @@ -1423,13 +991,11 @@ boolean M_Responder (event_t* ev) mousewait = I_GetTime() + 5; mousex = lastx += 30; } - if (ev->data1&1) { ch = KEY_ENTER; mousewait = I_GetTime() + 15; } - if (ev->data1&2) { ch = KEY_BACKSPACE; @@ -1442,12 +1008,8 @@ boolean M_Responder (event_t* ev) ch = ev->data1; } } - if (ch == -1) return false; - - - if (saveStringEnter) { switch(ch) @@ -1459,18 +1021,15 @@ boolean M_Responder (event_t* ev) savegamestrings[saveSlot][saveCharIndex] = 0; } break; - case KEY_ESCAPE: saveStringEnter = 0; strcpy(&savegamestrings[saveSlot][0],saveOldString); break; - case KEY_ENTER: saveStringEnter = 0; if (savegamestrings[saveSlot][0]) M_DoSave(saveSlot); break; - default: ch = toupper(ch); if (ch != 32) @@ -1488,32 +1047,24 @@ boolean M_Responder (event_t* ev) } return true; } - - if (messageToPrint) { if (messageNeedsInput == true && !(ch == ' ' || ch == 'n' || ch == 'y' || ch == KEY_ESCAPE)) return false; - menuactive = messageLastMenuActive; messageToPrint = 0; if (messageRoutine) messageRoutine(ch); - menuactive = false; S_StartSound(NULL,sfx_swtchx); return true; } - if (devparm && ch == KEY_F1) { G_ScreenShot (); return true; } - - - if (!menuactive) switch(ch) { @@ -1523,75 +1074,61 @@ boolean M_Responder (event_t* ev) M_SizeDisplay(0); S_StartSound(NULL,sfx_stnmov); return true; - case KEY_EQUALS: if (automapactive || chat_on) return false; M_SizeDisplay(1); S_StartSound(NULL,sfx_stnmov); return true; - case KEY_F1: M_StartControlPanel (); - if ( gamemode == retail ) currentMenu = &ReadDef2; else currentMenu = &ReadDef1; - itemOn = 0; S_StartSound(NULL,sfx_swtchn); return true; - case KEY_F2: M_StartControlPanel(); S_StartSound(NULL,sfx_swtchn); M_SaveGame(0); return true; - case KEY_F3: M_StartControlPanel(); S_StartSound(NULL,sfx_swtchn); M_LoadGame(0); return true; - case KEY_F4: M_StartControlPanel (); currentMenu = &SoundDef; itemOn = sfx_vol; S_StartSound(NULL,sfx_swtchn); return true; - case KEY_F5: M_ChangeDetail(0); S_StartSound(NULL,sfx_swtchn); return true; - case KEY_F6: S_StartSound(NULL,sfx_swtchn); M_QuickSave(); return true; - case KEY_F7: S_StartSound(NULL,sfx_swtchn); M_EndGame(0); return true; - case KEY_F8: M_ChangeMessages(0); S_StartSound(NULL,sfx_swtchn); return true; - case KEY_F9: S_StartSound(NULL,sfx_swtchn); M_QuickLoad(); return true; - case KEY_F10: S_StartSound(NULL,sfx_swtchn); M_QuitDOOM(0); return true; - case KEY_F11: usegamma++; if (usegamma > 4) @@ -1599,11 +1136,7 @@ boolean M_Responder (event_t* ev) players[consoleplayer].message = gammamsg[usegamma]; I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE)); return true; - } - - - if (!menuactive) { if (ch == KEY_ESCAPE) @@ -1614,9 +1147,6 @@ boolean M_Responder (event_t* ev) } return false; } - - - switch (ch) { case KEY_DOWNARROW: @@ -1628,7 +1158,6 @@ boolean M_Responder (event_t* ev) S_StartSound(NULL,sfx_pstop); } while(currentMenu->menuitems[itemOn].status==-1); return true; - case KEY_UPARROW: do { @@ -1638,7 +1167,6 @@ boolean M_Responder (event_t* ev) S_StartSound(NULL,sfx_pstop); } while(currentMenu->menuitems[itemOn].status==-1); return true; - case KEY_LEFTARROW: if (currentMenu->menuitems[itemOn].routine && currentMenu->menuitems[itemOn].status == 2) @@ -1647,7 +1175,6 @@ boolean M_Responder (event_t* ev) currentMenu->menuitems[itemOn].routine(0); } return true; - case KEY_RIGHTARROW: if (currentMenu->menuitems[itemOn].routine && currentMenu->menuitems[itemOn].status == 2) @@ -1656,7 +1183,6 @@ boolean M_Responder (event_t* ev) currentMenu->menuitems[itemOn].routine(1); } return true; - case KEY_ENTER: if (currentMenu->menuitems[itemOn].routine && currentMenu->menuitems[itemOn].status) @@ -1674,13 +1200,11 @@ boolean M_Responder (event_t* ev) } } return true; - case KEY_ESCAPE: currentMenu->lastOn = itemOn; M_ClearMenus (); S_StartSound(NULL,sfx_swtchx); return true; - case KEY_BACKSPACE: currentMenu->lastOn = itemOn; if (currentMenu->prevMenu) @@ -1690,7 +1214,6 @@ boolean M_Responder (event_t* ev) S_StartSound(NULL,sfx_swtchn); } return true; - default: for (i = itemOn+1;i < currentMenu->numitems;i++) if (currentMenu->menuitems[i].alphaKey == ch) @@ -1707,34 +1230,17 @@ boolean M_Responder (event_t* ev) return true; } break; - } - return false; } - - - - - - void M_StartControlPanel (void) { - if (menuactive) return; - menuactive = 1; currentMenu = &MainDef; itemOn = currentMenu->lastOn; } - - - - - - - void M_Drawer (void) { static short x; @@ -1743,11 +1249,7 @@ void M_Drawer (void) short max; char string[40]; int start; - inhelpscreens = false; - - - if (messageToPrint) { start = 0; @@ -1762,31 +1264,24 @@ void M_Drawer (void) start += i+1; break; } - if (i == strlen(messageString+start)) { strcpy(string,messageString+start); start += i; } - x = 160 - M_StringWidth(string)/2; M_WriteText(x,y,string); y += SHORT(hu_font[0]->height); } return; } - if (!menuactive) return; - if (currentMenu->routine) currentMenu->routine(); - - x = currentMenu->x; y = currentMenu->y; max = currentMenu->numitems; - for (i=0;i<max;i++) { if (currentMenu->menuitems[i].name[0]) @@ -1794,41 +1289,18 @@ void M_Drawer (void) W_CacheLumpName(currentMenu->menuitems[i].name ,PU_CACHE)); y += LINEHEIGHT; } - - - V_DrawPatchDirect(x + SKULLXOFF,currentMenu->y - 5 + itemOn*LINEHEIGHT, 0, W_CacheLumpName(skullName[whichSkull],PU_CACHE)); - } - - - - - void M_ClearMenus (void) { menuactive = 0; - - } - - - - - - - void M_SetupNextMenu(menu_t *menudef) { currentMenu = menudef; itemOn = currentMenu->lastOn; } - - - - - void M_Ticker (void) { if (--skullAnimCounter <= 0) @@ -1837,11 +1309,6 @@ void M_Ticker (void) skullAnimCounter = 8; } } - - - - - void M_Init (void) { currentMenu = &MainDef; @@ -1854,17 +1321,9 @@ void M_Init (void) messageString = NULL; messageLastMenuActive = menuactive; quickSaveSlot = -1; - - - - - switch ( gamemode ) { case commercial: - - - MainMenu[readthis] = MainMenu[quitdoom]; MainDef.numitems--; MainDef.y += 8; @@ -1875,17 +1334,11 @@ void M_Init (void) ReadMenu1[0].routine = M_FinishReadThis; break; case shareware: - - case registered: - EpiDef.numitems--; break; case retail: - default: break; } - } - diff --git a/src/m_menu.h b/src/m_menu.h @@ -1,67 +1,9 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __M_MENU__ #define __M_MENU__ - - - #include "d_event.h" - - - - - - - - - boolean M_Responder (event_t *ev); - - - - void M_Ticker (void); - - - void M_Drawer (void); - - - void M_Init (void); - - - void M_StartControlPanel (void); - - - - - - #endif - - - - - diff --git a/src/m_misc.c b/src/m_misc.c @@ -1,69 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - #include <sys/stat.h> #include <sys/types.h> #include <fcntl.h> #include <stdlib.h> #include <unistd.h> - #include <ctype.h> - - #include "doomdef.h" - #include "z_zone.h" - #include "m_swap.h" #include "m_argv.h" - #include "w_wad.h" - #include "i_system.h" #include "i_video.h" #include "v_video.h" - #include "hu_stuff.h" - - #include "doomstat.h" - - #include "dstrings.h" - #include "m_misc.h" - - - - - - extern patch_t* hu_font[HU_FONTSIZE]; - int M_DrawText ( int x, @@ -73,7 +26,6 @@ M_DrawText { int c; int w; - while (*string) { c = toupper(*string) - HU_FONTSTART; @@ -83,7 +35,6 @@ M_DrawText x += 4; continue; } - w = SHORT (hu_font[c]->width); if (x+w > SCREENWIDTH) break; @@ -93,20 +44,11 @@ M_DrawText V_DrawPatch(x, y, 0, hu_font[c]); x+=w; } - return x; } - - - - - - - #ifndef O_BINARY #define O_BINARY 0 #endif - boolean M_WriteFile ( char const* name, @@ -115,25 +57,15 @@ M_WriteFile { int handle; int count; - handle = open ( name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); - if (handle == -1) return false; - count = write (handle, source, length); close (handle); - if (count < length) return false; - return true; } - - - - - int M_ReadFile ( char const* name, @@ -142,7 +74,6 @@ M_ReadFile int handle, count, length; struct stat fileinfo; byte *buf; - handle = open (name, O_RDONLY | O_BINARY, 0666); if (handle == -1) I_Error ("Couldn't read file %s", name); @@ -152,74 +83,47 @@ M_ReadFile buf = Z_Malloc (length, PU_STATIC, NULL); count = read (handle, buf, length); close (handle); - if (count < length) I_Error ("Couldn't read file %s", name); - *buffer = buf; return length; } - - - - - int usemouse; int usejoystick; - extern int key_right; extern int key_left; extern int key_up; extern int key_down; - extern int key_strafeleft; extern int key_straferight; - extern int key_fire; extern int key_use; extern int key_strafe; extern int key_speed; - extern int mousebfire; extern int mousebstrafe; extern int mousebforward; - extern int joybfire; extern int joybstrafe; extern int joybuse; extern int joybspeed; - extern int viewwidth; extern int viewheight; - extern int mouseSensitivity; extern int showMessages; - extern int detailLevel; - extern int screenblocks; - extern int showMessages; - - extern int numChannels; - - - #ifdef SNDSERV extern char* sndserver_filename; extern int mb_used; #endif - #ifdef LINUX char* mousetype; char* mousedev; #endif - extern char* chat_macros[]; - - - typedef struct { char* name; @@ -228,15 +132,12 @@ typedef struct int scantranslate; int untranslated; } default_t; - default_t defaults[] = { {"mouse_sensitivity",&mouseSensitivity, 5}, {"sfx_volume",&snd_SfxVolume, 8}, {"music_volume",&snd_MusicVolume, 8}, {"show_messages",&showMessages, 1}, - - #ifdef NORMALUNIX {"key_right",&key_right, KEY_RIGHTARROW}, {"key_left",&key_left, KEY_LEFTARROW}, @@ -244,45 +145,32 @@ default_t defaults[] = {"key_down",&key_down, KEY_DOWNARROW}, {"key_strafeleft",&key_strafeleft, ','}, {"key_straferight",&key_straferight, '.'}, - {"key_fire",&key_fire, KEY_RCTRL}, {"key_use",&key_use, ' '}, {"key_strafe",&key_strafe, KEY_RALT}, {"key_speed",&key_speed, KEY_RSHIFT}, - - #ifdef SNDSERV {"sndserver", (int *) &sndserver_filename, (int) "sndserver"}, {"mb_used", &mb_used, 2}, #endif - #endif - #ifdef LINUX {"mousedev", (int*)&mousedev, (int)"/dev/ttyS0"}, {"mousetype", (int*)&mousetype, (int)"microsoft"}, #endif - {"use_mouse",&usemouse, 1}, {"mouseb_fire",&mousebfire,0}, {"mouseb_strafe",&mousebstrafe,1}, {"mouseb_forward",&mousebforward,2}, - {"use_joystick",&usejoystick, 0}, {"joyb_fire",&joybfire,0}, {"joyb_strafe",&joybstrafe,1}, {"joyb_use",&joybuse,3}, {"joyb_speed",&joybspeed,2}, - {"screenblocks",&screenblocks, 9}, {"detaillevel",&detailLevel, 0}, - {"snd_channels",&numChannels, 3}, - - - {"usegamma",&usegamma, 0}, - {"chatmacro0", (int *) &chat_macros[0], (int) HUSTR_CHATMACRO0 }, {"chatmacro1", (int *) &chat_macros[1], (int) HUSTR_CHATMACRO1 }, {"chatmacro2", (int *) &chat_macros[2], (int) HUSTR_CHATMACRO2 }, @@ -293,26 +181,17 @@ default_t defaults[] = {"chatmacro7", (int *) &chat_macros[7], (int) HUSTR_CHATMACRO7 }, {"chatmacro8", (int *) &chat_macros[8], (int) HUSTR_CHATMACRO8 }, {"chatmacro9", (int *) &chat_macros[9], (int) HUSTR_CHATMACRO9 } - }; - int numdefaults; char* defaultfile; - - - - - void M_SaveDefaults (void) { int i; int v; FILE* f; - f = fopen (defaultfile, "w"); if (!f) return; - for (i=0 ; i<numdefaults ; i++) { if (defaults[i].defaultvalue > -0xfff @@ -325,16 +204,9 @@ void M_SaveDefaults (void) * (char **) (defaults[i].location)); } } - fclose (f); } - - - - - extern byte scantokey[128]; - void M_LoadDefaults (void) { int i; @@ -345,13 +217,9 @@ void M_LoadDefaults (void) char* newstring; int parm; boolean isstring; - - numdefaults = sizeof(defaults)/sizeof(defaults[0]); for (i=0 ; i<numdefaults ; i++) *defaults[i].location = defaults[i].defaultvalue; - - i = M_CheckParm ("-config"); if (i && i<myargc-1) { @@ -360,8 +228,6 @@ void M_LoadDefaults (void) } else defaultfile = basedefault; - - f = fopen (defaultfile, "r"); if (f) { @@ -372,7 +238,6 @@ void M_LoadDefaults (void) { if (strparm[0] == '"') { - isstring = true; len = strlen(strparm); newstring = (char *) malloc(len); @@ -395,47 +260,29 @@ void M_LoadDefaults (void) } } } - fclose (f); } } - - - - - - - typedef struct { char manufacturer; char version; char encoding; char bits_per_pixel; - unsigned short xmin; unsigned short ymin; unsigned short xmax; unsigned short ymax; - unsigned short hres; unsigned short vres; - unsigned char palette[48]; - char reserved; char color_planes; unsigned short bytes_per_line; unsigned short palette_type; - char filler[58]; unsigned char data; } pcx_t; - - - - - void WritePCXfile ( char* filename, @@ -448,9 +295,7 @@ WritePCXfile int length; pcx_t* pcx; byte* pack; - pcx = Z_Malloc (width*height*2+1000, PU_STATIC, NULL); - pcx->manufacturer = 0x0a; pcx->version = 5; pcx->encoding = 1; @@ -466,11 +311,7 @@ WritePCXfile pcx->bytes_per_line = SHORT(width); pcx->palette_type = SHORT(2); memset (pcx->filler,0,sizeof(pcx->filler)); - - - pack = &pcx->data; - for (i=0 ; i<width*height ; i++) { if ( (*data & 0xc0) != 0xc0) @@ -481,36 +322,21 @@ WritePCXfile *pack++ = *data++; } } - - *pack++ = 0x0c; for (i=0 ; i<768 ; i++) *pack++ = *palette++; - - length = pack - (byte *)pcx; M_WriteFile (filename, pcx, length); - Z_Free (pcx); } - - - - - void M_ScreenShot (void) { int i; byte* linear; char lbmname[12]; - - linear = screens[2]; I_ReadScreen (linear); - - strcpy(lbmname,"DOOM00.pcx"); - for (i=0 ; i<=99 ; i++) { lbmname[4] = i/10 + '0'; @@ -520,13 +346,8 @@ void M_ScreenShot (void) } if (i==100) I_Error ("M_ScreenShot: Couldn't create a PCX"); - - WritePCXfile (lbmname, linear, SCREENWIDTH, SCREENHEIGHT, W_CacheLumpName ("PLAYPAL",PU_CACHE)); - players[consoleplayer].message = "screen shot"; } - - diff --git a/src/m_misc.h b/src/m_misc.h @@ -1,65 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __M_MISC__ #define __M_MISC__ - - #include "doomtype.h" - - - - - - boolean M_WriteFile ( char const* name, void* source, int length ); - int M_ReadFile ( char const* name, byte** buffer ); - void M_ScreenShot (void); - void M_LoadDefaults (void); - void M_SaveDefaults (void); - - int M_DrawText ( int x, int y, boolean direct, char* string ); - - #endif - - - - - diff --git a/src/m_random.c b/src/m_random.c @@ -1,32 +1,3 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unsigned char rndtable[256] = { 0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66 , 74, 21, 211, 47, 80, 242, 154, 27, 205, 128, 161, 89, 77, 36 , @@ -48,28 +19,19 @@ unsigned char rndtable[256] = { 197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136 , 120, 163, 236, 249 }; - int rndindex = 0; int prndindex = 0; - - int P_Random (void) { prndindex = (prndindex+1)&0xff; return rndtable[prndindex]; } - int M_Random (void) { rndindex = (rndindex+1)&0xff; return rndtable[rndindex]; } - void M_ClearRandom (void) { rndindex = prndindex = 0; } - - - - diff --git a/src/m_random.h b/src/m_random.h @@ -1,47 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __M_RANDOM__ #define __M_RANDOM__ - - #include "doomtype.h" - - - - - int M_Random (void); - - int P_Random (void); - - void M_ClearRandom (void); - - #endif - - - - - diff --git a/src/m_swap.c b/src/m_swap.c @@ -1,45 +1,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - #ifdef __GNUG__ #pragma implementation "m_swap.h" #endif #include "m_swap.h" - - - #ifndef __BIG_ENDIAN__ - - unsigned short SwapSHORT(unsigned short x) { - return (x>>8) | (x<<8); } - - unsigned long SwapLONG( unsigned long x) { return @@ -48,8 +15,4 @@ unsigned long SwapLONG( unsigned long x) | ((x<<8) & 0xff0000) | (x<<24); } - - #endif - - diff --git a/src/m_swap.h b/src/m_swap.h @@ -1,36 +1,8 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __M_SWAP__ #define __M_SWAP__ - - #ifdef __GNUG__ #pragma interface #endif - - - - #ifdef __BIG_ENDIAN__ short SwapSHORT(short); long SwapLONG(long); @@ -40,13 +12,4 @@ long SwapLONG(long); #define SHORT(x) (x) #define LONG(x) (x) #endif - - - - #endif - - - - - diff --git a/src/p_ceilng.c b/src/p_ceilng.c @@ -1,68 +1,23 @@ - - - - - - - - - - - - - - - - - - - - - - - - #include "z_zone.h" #include "doomdef.h" #include "p_local.h" - #include "s_sound.h" - - #include "doomstat.h" #include "r_state.h" - - #include "sounds.h" - - - - - - ceiling_t* activeceilings[MAXCEILINGS]; - - - - - - void T_MoveCeiling (ceiling_t* ceiling) { result_e res; - switch(ceiling->direction) { case 0: - break; case 1: - res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->topheight, false,1,ceiling->direction); - if (!(leveltime&7)) { switch(ceiling->type) @@ -72,11 +27,9 @@ void T_MoveCeiling (ceiling_t* ceiling) default: S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_stnmov); - break; } } - if (res == pastdest) { switch(ceiling->type) @@ -84,7 +37,6 @@ void T_MoveCeiling (ceiling_t* ceiling) case raiseToHighest: P_RemoveActiveCeiling(ceiling); break; - case silentCrushAndRaise: S_StartSound((mobj_t *)&ceiling->sector->soundorg, sfx_pstop); @@ -92,21 +44,16 @@ void T_MoveCeiling (ceiling_t* ceiling) case crushAndRaise: ceiling->direction = -1; break; - default: break; } - } break; - case -1: - res = T_MovePlane(ceiling->sector, ceiling->speed, ceiling->bottomheight, ceiling->crush,1,ceiling->direction); - if (!(leveltime&7)) { switch(ceiling->type) @@ -117,7 +64,6 @@ void T_MoveCeiling (ceiling_t* ceiling) sfx_stnmov); } } - if (res == pastdest) { switch(ceiling->type) @@ -130,12 +76,10 @@ void T_MoveCeiling (ceiling_t* ceiling) case fastCrushAndRaise: ceiling->direction = 1; break; - case lowerAndCrush: case lowerToFloor: P_RemoveActiveCeiling(ceiling); break; - default: break; } @@ -151,7 +95,6 @@ void T_MoveCeiling (ceiling_t* ceiling) case lowerAndCrush: ceiling->speed = CEILSPEED / 8; break; - default: break; } @@ -160,12 +103,6 @@ void T_MoveCeiling (ceiling_t* ceiling) break; } } - - - - - - int EV_DoCeiling ( line_t* line, @@ -175,11 +112,8 @@ EV_DoCeiling int rtn; sector_t* sec; ceiling_t* ceiling; - secnum = -1; rtn = 0; - - switch(type) { case fastCrushAndRaise: @@ -189,14 +123,11 @@ EV_DoCeiling default: break; } - while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0) { sec = &sectors[secnum]; if (sec->specialdata) continue; - - rtn = 1; ceiling = Z_Malloc (sizeof(*ceiling), PU_LEVSPEC, 0); P_AddThinker (&ceiling->thinker); @@ -204,7 +135,6 @@ EV_DoCeiling ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling; ceiling->sector = sec; ceiling->crush = false; - switch(type) { case fastCrushAndRaise: @@ -214,7 +144,6 @@ EV_DoCeiling ceiling->direction = -1; ceiling->speed = CEILSPEED * 2; break; - case silentCrushAndRaise: case crushAndRaise: ceiling->crush = true; @@ -227,29 +156,21 @@ EV_DoCeiling ceiling->direction = -1; ceiling->speed = CEILSPEED; break; - case raiseToHighest: ceiling->topheight = P_FindHighestCeilingSurrounding(sec); ceiling->direction = 1; ceiling->speed = CEILSPEED; break; } - ceiling->tag = sec->tag; ceiling->type = type; P_AddActiveCeiling(ceiling); } return rtn; } - - - - - void P_AddActiveCeiling(ceiling_t* c) { int i; - for (i = 0; i < MAXCEILINGS;i++) { if (activeceilings[i] == NULL) @@ -259,16 +180,9 @@ void P_AddActiveCeiling(ceiling_t* c) } } } - - - - - - void P_RemoveActiveCeiling(ceiling_t* c) { int i; - for (i = 0;i < MAXCEILINGS;i++) { if (activeceilings[i] == c) @@ -280,16 +194,9 @@ void P_RemoveActiveCeiling(ceiling_t* c) } } } - - - - - - void P_ActivateInStasisCeiling(line_t* line) { int i; - for (i = 0;i < MAXCEILINGS;i++) { if (activeceilings[i] @@ -302,18 +209,10 @@ void P_ActivateInStasisCeiling(line_t* line) } } } - - - - - - - int EV_CeilingCrushStop(line_t *line) { int i; int rtn; - rtn = 0; for (i = 0;i < MAXCEILINGS;i++) { @@ -327,7 +226,5 @@ int EV_CeilingCrushStop(line_t *line) rtn = 1; } } - - return rtn; } diff --git a/src/p_doors.c b/src/p_doors.c @@ -1,71 +1,25 @@ - - - - - - - - - - - - - - - - - - - - - - - - #include "z_zone.h" #include "doomdef.h" #include "p_local.h" - #include "s_sound.h" - - - #include "doomstat.h" #include "r_state.h" - - #include "dstrings.h" #include "sounds.h" - #if 0 - - - slidename_t slideFrameNames[MAXSLIDEDOORS] = { {"GDOORF1","GDOORF2","GDOORF3","GDOORF4", "GDOORB1","GDOORB2","GDOORB3","GDOORB4"}, - {"\0","\0","\0","\0"} }; #endif - - - - - - - - - void T_VerticalDoor (vldoor_t* door) { result_e res; - switch(door->direction) { case 0: - if (!--door->topcountdown) { switch(door->type) @@ -75,27 +29,22 @@ void T_VerticalDoor (vldoor_t* door) S_StartSound((mobj_t *)&door->sector->soundorg, sfx_bdcls); break; - case normal: door->direction = -1; S_StartSound((mobj_t *)&door->sector->soundorg, sfx_dorcls); break; - case close30ThenOpen: door->direction = 1; S_StartSound((mobj_t *)&door->sector->soundorg, sfx_doropn); break; - default: break; } } break; - case 2: - if (!--door->topcountdown) { switch(door->type) @@ -106,15 +55,12 @@ void T_VerticalDoor (vldoor_t* door) S_StartSound((mobj_t *)&door->sector->soundorg, sfx_doropn); break; - default: break; } } break; - case -1: - res = T_MovePlane(door->sector, door->speed, door->sector->floorheight, @@ -130,18 +76,15 @@ void T_VerticalDoor (vldoor_t* door) S_StartSound((mobj_t *)&door->sector->soundorg, sfx_bdcls); break; - case normal: case close: door->sector->specialdata = NULL; P_RemoveThinker (&door->thinker); break; - case close30ThenOpen: door->direction = 0; door->topcountdown = 35*30; break; - default: break; } @@ -153,7 +96,6 @@ void T_VerticalDoor (vldoor_t* door) case blazeClose: case close: break; - default: door->direction = 1; S_StartSound((mobj_t *)&door->sector->soundorg, @@ -162,14 +104,11 @@ void T_VerticalDoor (vldoor_t* door) } } break; - case 1: - res = T_MovePlane(door->sector, door->speed, door->topheight, false,1,door->direction); - if (res == pastdest) { switch(door->type) @@ -179,14 +118,12 @@ void T_VerticalDoor (vldoor_t* door) door->direction = 0; door->topcountdown = door->topwait; break; - case close30ThenOpen: case blazeOpen: case open: door->sector->specialdata = NULL; P_RemoveThinker (&door->thinker); break; - default: break; } @@ -194,13 +131,6 @@ void T_VerticalDoor (vldoor_t* door) break; } } - - - - - - - int EV_DoLockedDoor ( line_t* line, @@ -208,12 +138,9 @@ EV_DoLockedDoor mobj_t* thing ) { player_t* p; - p = thing->player; - if (!p) return 0; - switch(line->special) { case 99: @@ -227,7 +154,6 @@ EV_DoLockedDoor return 0; } break; - case 134: case 135: if ( !p ) @@ -239,7 +165,6 @@ EV_DoLockedDoor return 0; } break; - case 136: case 137: if ( !p ) @@ -253,11 +178,8 @@ EV_DoLockedDoor } break; } - return EV_DoDoor(line,type); } - - int EV_DoDoor ( line_t* line, @@ -266,29 +188,22 @@ EV_DoDoor int secnum,rtn; sector_t* sec; vldoor_t* door; - secnum = -1; rtn = 0; - while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0) { sec = &sectors[secnum]; if (sec->specialdata) continue; - - - rtn = 1; door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0); P_AddThinker (&door->thinker); sec->specialdata = door; - door->thinker.function.acp1 = (actionf_p1) T_VerticalDoor; door->sector = sec; door->type = type; door->topwait = VDOORWAIT; door->speed = VDOORSPEED; - switch(type) { case blazeClose: @@ -299,7 +214,6 @@ EV_DoDoor S_StartSound((mobj_t *)&door->sector->soundorg, sfx_bdcls); break; - case close: door->topheight = P_FindLowestCeilingSurrounding(sec); door->topheight -= 4*FRACUNIT; @@ -307,14 +221,12 @@ EV_DoDoor S_StartSound((mobj_t *)&door->sector->soundorg, sfx_dorcls); break; - case close30ThenOpen: door->topheight = sec->ceilingheight; door->direction = -1; S_StartSound((mobj_t *)&door->sector->soundorg, sfx_dorcls); break; - case blazeRaise: case blazeOpen: door->direction = 1; @@ -325,7 +237,6 @@ EV_DoDoor S_StartSound((mobj_t *)&door->sector->soundorg, sfx_bdopn); break; - case normal: case open: door->direction = 1; @@ -335,19 +246,12 @@ EV_DoDoor S_StartSound((mobj_t *)&door->sector->soundorg, sfx_doropn); break; - default: break; } - } return rtn; } - - - - - void EV_VerticalDoor ( line_t* line, @@ -358,19 +262,14 @@ EV_VerticalDoor sector_t* sec; vldoor_t* door; int side; - side = 0; - - player = thing->player; - switch(line->special) { case 26: case 32: if ( !player ) return; - if (!player->cards[it_bluecard] && !player->cards[it_blueskull]) { player->message = PD_BLUEK; @@ -378,12 +277,10 @@ EV_VerticalDoor return; } break; - case 27: case 34: if ( !player ) return; - if (!player->cards[it_yellowcard] && !player->cards[it_yellowskull]) { @@ -392,12 +289,10 @@ EV_VerticalDoor return; } break; - case 28: case 33: if ( !player ) return; - if (!player->cards[it_redcard] && !player->cards[it_redskull]) { player->message = PD_REDK; @@ -406,11 +301,8 @@ EV_VerticalDoor } break; } - - sec = sides[ line->sidenum[side^1]] .sector; secnum = sec-sectors; - if (sec->specialdata) { door = sec->specialdata; @@ -427,33 +319,25 @@ EV_VerticalDoor { if (!thing->player) return; - door->direction = -1; } return; } } - - switch(line->special) { case 117: case 118: S_StartSound((mobj_t *)&sec->soundorg,sfx_bdopn); break; - case 1: case 31: S_StartSound((mobj_t *)&sec->soundorg,sfx_doropn); break; - default: S_StartSound((mobj_t *)&sec->soundorg,sfx_doropn); break; } - - - door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0); P_AddThinker (&door->thinker); sec->specialdata = door; @@ -462,7 +346,6 @@ EV_VerticalDoor door->direction = 1; door->speed = VDOORSPEED; door->topwait = VDOORWAIT; - switch(line->special) { case 1: @@ -471,7 +354,6 @@ EV_VerticalDoor case 28: door->type = normal; break; - case 31: case 32: case 33: @@ -479,7 +361,6 @@ EV_VerticalDoor door->type = open; line->special = 0; break; - case 117: door->type = blazeRaise; door->speed = VDOORSPEED*4; @@ -490,27 +371,16 @@ EV_VerticalDoor door->speed = VDOORSPEED*4; break; } - - door->topheight = P_FindLowestCeilingSurrounding(sec); door->topheight -= 4*FRACUNIT; } - - - - - void P_SpawnDoorCloseIn30 (sector_t* sec) { vldoor_t* door; - door = Z_Malloc ( sizeof(*door), PU_LEVSPEC, 0); - P_AddThinker (&door->thinker); - sec->specialdata = door; sec->special = 0; - door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor; door->sector = sec; door->direction = 0; @@ -518,24 +388,16 @@ void P_SpawnDoorCloseIn30 (sector_t* sec) door->speed = VDOORSPEED; door->topcountdown = 30 * 35; } - - - - void P_SpawnDoorRaiseIn5Mins ( sector_t* sec, int secnum ) { vldoor_t* door; - door = Z_Malloc ( sizeof(*door), PU_LEVSPEC, 0); - P_AddThinker (&door->thinker); - sec->specialdata = door; sec->special = 0; - door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor; door->sector = sec; door->direction = 2; @@ -546,21 +408,8 @@ P_SpawnDoorRaiseIn5Mins door->topwait = VDOORWAIT; door->topcountdown = 5 * 60 * 35; } - - - - - - #if 0 - - - - - - slideframe_t slideFrames[MAXSLIDEDOORS]; - void P_InitSlidingDoorFrames(void) { int i; @@ -568,58 +417,42 @@ void P_InitSlidingDoorFrames(void) int f2; int f3; int f4; - - if ( gamemode != commercial) return; - for (i = 0;i < MAXSLIDEDOORS; i++) { if (!slideFrameNames[i].frontFrame1[0]) break; - f1 = R_TextureNumForName(slideFrameNames[i].frontFrame1); f2 = R_TextureNumForName(slideFrameNames[i].frontFrame2); f3 = R_TextureNumForName(slideFrameNames[i].frontFrame3); f4 = R_TextureNumForName(slideFrameNames[i].frontFrame4); - slideFrames[i].frontFrames[0] = f1; slideFrames[i].frontFrames[1] = f2; slideFrames[i].frontFrames[2] = f3; slideFrames[i].frontFrames[3] = f4; - f1 = R_TextureNumForName(slideFrameNames[i].backFrame1); f2 = R_TextureNumForName(slideFrameNames[i].backFrame2); f3 = R_TextureNumForName(slideFrameNames[i].backFrame3); f4 = R_TextureNumForName(slideFrameNames[i].backFrame4); - slideFrames[i].backFrames[0] = f1; slideFrames[i].backFrames[1] = f2; slideFrames[i].backFrames[2] = f3; slideFrames[i].backFrames[3] = f4; } } - - - - - - int P_FindSlidingDoorType(line_t* line) { int i; int val; - for (i = 0;i < MAXSLIDEDOORS;i++) { val = sides[line->sidenum[0]].midtexture; if (val == slideFrames[i].frontFrames[0]) return i; } - return -1; } - void T_SlidingDoor (slidedoor_t* door) { switch(door->status) @@ -629,26 +462,21 @@ void T_SlidingDoor (slidedoor_t* door) { if (++door->frame == SNUMFRAMES) { - sides[door->line->sidenum[0]].midtexture = 0; sides[door->line->sidenum[1]].midtexture = 0; door->line->flags &= ML_BLOCKING^0xff; - if (door->type == sdt_openOnly) { door->frontsector->specialdata = NULL; P_RemoveThinker (&door->thinker); break; } - door->timer = SDOORWAIT; door->status = sd_waiting; } else { - door->timer = SWAITTICS; - sides[door->line->sidenum[0]].midtexture = slideFrames[door->whichDoorIndex]. frontFrames[door->frame]; @@ -658,31 +486,24 @@ void T_SlidingDoor (slidedoor_t* door) } } break; - case sd_waiting: - if (!door->timer--) { - if (door->frontsector->thinglist != NULL || door->backsector->thinglist != NULL) { door->timer = SDOORWAIT; break; } - - door->status = sd_closing; door->timer = SWAITTICS; } break; - case sd_closing: if (!door->timer--) { if (--door->frame < 0) { - door->line->flags |= ML_BLOCKING; door->frontsector->specialdata = NULL; P_RemoveThinker (&door->thinker); @@ -690,9 +511,7 @@ void T_SlidingDoor (slidedoor_t* door) } else { - door->timer = SWAITTICS; - sides[door->line->sidenum[0]].midtexture = slideFrames[door->whichDoorIndex]. frontFrames[door->frame]; @@ -704,9 +523,6 @@ void T_SlidingDoor (slidedoor_t* door) break; } } - - - void EV_SlidingDoor ( line_t* line, @@ -714,19 +530,14 @@ EV_SlidingDoor { sector_t* sec; slidedoor_t* door; - - if (gamemode != commercial) return; - - sec = line->frontsector; door = NULL; if (sec->specialdata) { if (!thing->player) return; - door = sec->specialdata; if (door->type == sdt_openAndClose) { @@ -736,21 +547,16 @@ EV_SlidingDoor else return; } - - if (!door) { door = Z_Malloc (sizeof(*door), PU_LEVSPEC, 0); P_AddThinker (&door->thinker); sec->specialdata = door; - door->type = sdt_openAndClose; door->status = sd_opening; door->whichDoorIndex = P_FindSlidingDoorType(line); - if (door->whichDoorIndex < 0) I_Error("EV_SlidingDoor: Can't use texture for sliding door!"); - door->frontsector = sec; door->backsector = line->backsector; door->thinker.function = T_SlidingDoor; diff --git a/src/p_enemy.c b/src/p_enemy.c @@ -1,51 +1,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - #include <stdlib.h> - #include "m_random.h" #include "i_system.h" - #include "doomdef.h" #include "p_local.h" - #include "s_sound.h" - #include "g_game.h" - - #include "doomstat.h" #include "r_state.h" - - #include "sounds.h" - - - - typedef enum { DI_EAST, @@ -58,48 +20,18 @@ typedef enum DI_SOUTHEAST, DI_NODIR, NUMDIRS - } dirtype_t; - - - - - dirtype_t opposite[] = { DI_WEST, DI_SOUTHWEST, DI_SOUTH, DI_SOUTHEAST, DI_EAST, DI_NORTHEAST, DI_NORTH, DI_NORTHWEST, DI_NODIR }; - dirtype_t diags[] = { DI_NORTHWEST, DI_NORTHEAST, DI_SOUTHWEST, DI_SOUTHEAST }; - - - - - void A_Fall (mobj_t *actor); - - - - - - - - - - - - - - - - - mobj_t* soundtarget; - void P_RecursiveSound ( sector_t* sec, @@ -108,34 +40,26 @@ P_RecursiveSound int i; line_t* check; sector_t* other; - - if (sec->validcount == validcount && sec->soundtraversed <= soundblocks+1) { return; } - sec->validcount = validcount; sec->soundtraversed = soundblocks+1; sec->soundtarget = soundtarget; - for (i=0 ;i<sec->linecount ; i++) { check = sec->lines[i]; if (! (check->flags & ML_TWOSIDED) ) continue; - P_LineOpening (check); - if (openrange <= 0) continue; - if ( sides[ check->sidenum[0] ].sector == sec) other = sides[ check->sidenum[1] ] .sector; else other = sides[ check->sidenum[0] ].sector; - if (check->flags & ML_SOUNDBLOCK) { if (!soundblocks) @@ -145,14 +69,6 @@ P_RecursiveSound P_RecursiveSound (other, soundblocks); } } - - - - - - - - void P_NoiseAlert ( mobj_t* target, @@ -162,160 +78,99 @@ P_NoiseAlert validcount++; P_RecursiveSound (emmiter->subsector->sector, 0); } - - - - - - - boolean P_CheckMeleeRange (mobj_t* actor) { mobj_t* pl; fixed_t dist; - if (!actor->target) return false; - pl = actor->target; dist = P_AproxDistance (pl->x-actor->x, pl->y-actor->y); - if (dist >= MELEERANGE-20*FRACUNIT+pl->info->radius) return false; - if (! P_CheckSight (actor, actor->target) ) return false; - return true; } - - - - boolean P_CheckMissileRange (mobj_t* actor) { fixed_t dist; - if (! P_CheckSight (actor, actor->target) ) return false; - if ( actor->flags & MF_JUSTHIT ) { - - actor->flags &= ~MF_JUSTHIT; return true; } - if (actor->reactiontime) return false; - - dist = P_AproxDistance ( actor->x-actor->target->x, actor->y-actor->target->y) - 64*FRACUNIT; - if (!actor->info->meleestate) dist -= 128*FRACUNIT; - dist >>= 16; - if (actor->type == MT_VILE) { if (dist > 14*64) return false; } - - if (actor->type == MT_UNDEAD) { if (dist < 196) return false; dist >>= 1; } - - if (actor->type == MT_CYBORG || actor->type == MT_SPIDER || actor->type == MT_SKULL) { dist >>= 1; } - if (dist > 200) dist = 200; - if (actor->type == MT_CYBORG && dist > 160) dist = 160; - if (P_Random () < dist) return false; - return true; } - - - - - - - fixed_t xspeed[8] = {FRACUNIT,47000,0,-47000,-FRACUNIT,-47000,0,47000}; fixed_t yspeed[8] = {0,47000,FRACUNIT,47000,0,-47000,-FRACUNIT,-47000}; - #define MAXSPECIALCROSS 8 - extern line_t* spechit[MAXSPECIALCROSS]; extern int numspechit; - boolean P_Move (mobj_t* actor) { fixed_t tryx; fixed_t tryy; - line_t* ld; - - - boolean try_ok; boolean good; - if (actor->movedir == DI_NODIR) return false; - if ((unsigned)actor->movedir >= 8) I_Error ("Weird actor->movedir!"); - tryx = actor->x + actor->info->speed*xspeed[actor->movedir]; tryy = actor->y + actor->info->speed*yspeed[actor->movedir]; - try_ok = P_TryMove (actor, tryx, tryy); - if (!try_ok) { - if (actor->flags & MF_FLOAT && floatok) { - if (actor->z < tmfloorz) actor->z += FLOATSPEED; else actor->z -= FLOATSPEED; - actor->flags |= MF_INFLOAT; return true; } - if (!numspechit) return false; - actor->movedir = DI_NODIR; good = false; while (numspechit--) { ld = spechit[numspechit]; - - - if (P_UseSpecialLine (actor, ld,0)) good = true; } @@ -325,75 +180,45 @@ boolean P_Move (mobj_t* actor) { actor->flags &= ~MF_INFLOAT; } - - if (! (actor->flags & MF_FLOAT) ) actor->z = actor->floorz; return true; } - - - - - - - - - - - - - boolean P_TryWalk (mobj_t* actor) { if (!P_Move (actor)) { return false; } - actor->movecount = P_Random()&15; return true; } - - - - void P_NewChaseDir (mobj_t* actor) { fixed_t deltax; fixed_t deltay; - dirtype_t d[3]; - int tdir; dirtype_t olddir; - dirtype_t turnaround; - if (!actor->target) I_Error ("P_NewChaseDir: called with no target"); - olddir = actor->movedir; turnaround=opposite[olddir]; - deltax = actor->target->x - actor->x; deltay = actor->target->y - actor->y; - if (deltax>10*FRACUNIT) d[1]= DI_EAST; else if (deltax<-10*FRACUNIT) d[1]= DI_WEST; else d[1]=DI_NODIR; - if (deltay<-10*FRACUNIT) d[2]= DI_SOUTH; else if (deltay>10*FRACUNIT) d[2]= DI_NORTH; else d[2]=DI_NODIR; - - if (d[1] != DI_NODIR && d[2] != DI_NODIR) { @@ -401,8 +226,6 @@ void P_NewChaseDir (mobj_t* actor) if (actor->movedir != turnaround && P_TryWalk(actor)) return; } - - if (P_Random() > 200 || abs(deltay)>abs(deltax)) { @@ -410,41 +233,30 @@ void P_NewChaseDir (mobj_t* actor) d[1]=d[2]; d[2]=tdir; } - if (d[1]==turnaround) d[1]=DI_NODIR; if (d[2]==turnaround) d[2]=DI_NODIR; - if (d[1]!=DI_NODIR) { actor->movedir = d[1]; if (P_TryWalk(actor)) { - return; } } - if (d[2]!=DI_NODIR) { actor->movedir =d[2]; - if (P_TryWalk(actor)) return; } - - - if (olddir!=DI_NODIR) { actor->movedir =olddir; - if (P_TryWalk(actor)) return; } - - if (P_Random()&1) { for ( tdir=DI_EAST; @@ -454,7 +266,6 @@ void P_NewChaseDir (mobj_t* actor) if (tdir!=turnaround) { actor->movedir =tdir; - if ( P_TryWalk(actor) ) return; } @@ -469,30 +280,19 @@ void P_NewChaseDir (mobj_t* actor) if (tdir!=turnaround) { actor->movedir =tdir; - if ( P_TryWalk(actor) ) return; } } } - if (turnaround != DI_NODIR) { actor->movedir =turnaround; if ( P_TryWalk(actor) ) return; } - actor->movedir = DI_NODIR; } - - - - - - - - boolean P_LookForPlayers ( mobj_t* actor, @@ -504,32 +304,23 @@ P_LookForPlayers sector_t* sector; angle_t an; fixed_t dist; - sector = actor->subsector->sector; - c = 0; stop = (actor->lastlook-1)&3; - for ( ; ; actor->lastlook = (actor->lastlook+1)&3 ) { if (!playeringame[actor->lastlook]) continue; - if (c++ == 2 || actor->lastlook == stop) { - return false; } - player = &players[actor->lastlook]; - if (player->health <= 0) continue; - if (!P_CheckSight (actor, player->mo)) continue; - if (!allaround) { an = R_PointToAngle2 (actor->x, @@ -537,80 +328,49 @@ P_LookForPlayers player->mo->x, player->mo->y) - actor->angle; - if (an > ANG90 && an < ANG270) { dist = P_AproxDistance (player->mo->x - actor->x, player->mo->y - actor->y); - if (dist > MELEERANGE) continue; } } - actor->target = player->mo; return true; } - return false; } - - - - - - - void A_KeenDie (mobj_t* mo) { thinker_t* th; mobj_t* mo2; line_t junk; - A_Fall (mo); - - - for (th = thinkercap.next ; th != &thinkercap ; th=th->next) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; - mo2 = (mobj_t *)th; if (mo2 != mo && mo2->type == mo->type && mo2->health > 0) { - return; } } - junk.tag = 666; EV_DoDoor(&junk,open); } - - - - - - - - - - void A_Look (mobj_t* actor) { mobj_t* targ; - actor->threshold = 0; targ = actor->subsector->sector->soundtarget; - if (targ && (targ->flags & MF_SHOOTABLE) ) { actor->target = targ; - if ( actor->flags & MF_AMBUSH ) { if (P_CheckSight (actor, actor->target)) @@ -619,17 +379,12 @@ void A_Look (mobj_t* actor) else goto seeyou; } - - if (!P_LookForPlayers (actor, false) ) return; - - seeyou: if (actor->info->seesound) { int sound; - switch (actor->info->seesound) { case sfx_posit1: @@ -637,45 +392,29 @@ void A_Look (mobj_t* actor) case sfx_posit3: sound = sfx_posit1+P_Random()%3; break; - case sfx_bgsit1: case sfx_bgsit2: sound = sfx_bgsit1+P_Random()%2; break; - default: sound = actor->info->seesound; break; } - if (actor->type==MT_SPIDER || actor->type == MT_CYBORG) { - S_StartSound (NULL, sound); } else S_StartSound (actor, sound); } - P_SetMobjState (actor, actor->info->seestate); } - - - - - - - void A_Chase (mobj_t* actor) { int delta; - if (actor->reactiontime) actor->reactiontime--; - - - if (actor->threshold) { if (!actor->target @@ -686,31 +425,23 @@ void A_Chase (mobj_t* actor) else actor->threshold--; } - - if (actor->movedir < 8) { actor->angle &= (7<<29); delta = actor->angle - (actor->movedir << 29); - if (delta > 0) actor->angle -= ANG90/2; else if (delta < 0) actor->angle += ANG90/2; } - if (!actor->target || !(actor->target->flags&MF_SHOOTABLE)) { - if (P_LookForPlayers(actor,true)) return; - P_SetMobjState (actor, actor->info->spawnstate); return; } - - if (actor->flags & MF_JUSTATTACKED) { actor->flags &= ~MF_JUSTATTACKED; @@ -718,19 +449,14 @@ void A_Chase (mobj_t* actor) P_NewChaseDir (actor); return; } - - if (actor->info->meleestate && P_CheckMeleeRange (actor)) { if (actor->info->attacksound) S_StartSound (actor, actor->info->attacksound); - P_SetMobjState (actor, actor->info->meleestate); return; } - - if (actor->info->missilestate) { if (gameskill < sk_nightmare @@ -738,18 +464,13 @@ void A_Chase (mobj_t* actor) { goto nomissile; } - if (!P_CheckMissileRange (actor)) goto nomissile; - P_SetMobjState (actor, actor->info->missilestate); actor->flags |= MF_JUSTATTACKED; return; } - - nomissile: - if (netgame && !actor->threshold && !P_CheckSight (actor, actor->target) ) @@ -757,65 +478,44 @@ void A_Chase (mobj_t* actor) if (P_LookForPlayers(actor,true)) return; } - - if (--actor->movecount<0 || !P_Move (actor)) { P_NewChaseDir (actor); } - - if (actor->info->activesound && P_Random () < 3) { S_StartSound (actor, actor->info->activesound); } } - - - - - void A_FaceTarget (mobj_t* actor) { if (!actor->target) return; - actor->flags &= ~MF_AMBUSH; - actor->angle = R_PointToAngle2 (actor->x, actor->y, actor->target->x, actor->target->y); - if (actor->target->flags & MF_SHADOW) actor->angle += (P_Random()-P_Random())<<21; } - - - - - void A_PosAttack (mobj_t* actor) { int angle; int damage; int slope; - if (!actor->target) return; - A_FaceTarget (actor); angle = actor->angle; slope = P_AimLineAttack (actor, angle, MISSILERANGE); - S_StartSound (actor, sfx_pistol); angle += (P_Random()-P_Random())<<20; damage = ((P_Random()%5)+1)*3; P_LineAttack (actor, angle, MISSILERANGE, slope, damage); } - void A_SPosAttack (mobj_t* actor) { int i; @@ -823,15 +523,12 @@ void A_SPosAttack (mobj_t* actor) int bangle; int damage; int slope; - if (!actor->target) return; - S_StartSound (actor, sfx_shotgn); A_FaceTarget (actor); bangle = actor->angle; slope = P_AimLineAttack (actor, bangle, MISSILERANGE); - for (i=0 ; i<3 ; i++) { angle = bangle + ((P_Random()-P_Random())<<20); @@ -839,35 +536,27 @@ void A_SPosAttack (mobj_t* actor) P_LineAttack (actor, angle, MISSILERANGE, slope, damage); } } - void A_CPosAttack (mobj_t* actor) { int angle; int bangle; int damage; int slope; - if (!actor->target) return; - S_StartSound (actor, sfx_shotgn); A_FaceTarget (actor); bangle = actor->angle; slope = P_AimLineAttack (actor, bangle, MISSILERANGE); - angle = bangle + ((P_Random()-P_Random())<<20); damage = ((P_Random()%5)+1)*3; P_LineAttack (actor, angle, MISSILERANGE, slope, damage); } - void A_CPosRefire (mobj_t* actor) { - A_FaceTarget (actor); - if (P_Random () < 40) return; - if (!actor->target || actor->target->health <= 0 || !P_CheckSight (actor, actor->target) ) @@ -875,16 +564,11 @@ void A_CPosRefire (mobj_t* actor) P_SetMobjState (actor, actor->info->seestate); } } - - void A_SpidRefire (mobj_t* actor) { - A_FaceTarget (actor); - if (P_Random () < 10) return; - if (!actor->target || actor->target->health <= 0 || !P_CheckSight (actor, actor->target) ) @@ -892,29 +576,18 @@ void A_SpidRefire (mobj_t* actor) P_SetMobjState (actor, actor->info->seestate); } } - void A_BspiAttack (mobj_t *actor) { if (!actor->target) return; - A_FaceTarget (actor); - - P_SpawnMissile (actor, actor->target, MT_ARACHPLAZ); } - - - - - void A_TroopAttack (mobj_t* actor) { int damage; - if (!actor->target) return; - A_FaceTarget (actor); if (P_CheckMeleeRange (actor)) { @@ -923,20 +596,13 @@ void A_TroopAttack (mobj_t* actor) P_DamageMobj (actor->target, actor, actor, damage); return; } - - - P_SpawnMissile (actor, actor->target, MT_TROOPSHOT); } - - void A_SargAttack (mobj_t* actor) { int damage; - if (!actor->target) return; - A_FaceTarget (actor); if (P_CheckMeleeRange (actor)) { @@ -944,14 +610,11 @@ void A_SargAttack (mobj_t* actor) P_DamageMobj (actor->target, actor, actor, damage); } } - void A_HeadAttack (mobj_t* actor) { int damage; - if (!actor->target) return; - A_FaceTarget (actor); if (P_CheckMeleeRange (actor)) { @@ -959,28 +622,20 @@ void A_HeadAttack (mobj_t* actor) P_DamageMobj (actor->target, actor, actor, damage); return; } - - P_SpawnMissile (actor, actor->target, MT_HEADSHOT); } - void A_CyberAttack (mobj_t* actor) { if (!actor->target) return; - A_FaceTarget (actor); P_SpawnMissile (actor, actor->target, MT_ROCKET); } - - void A_BruisAttack (mobj_t* actor) { int damage; - if (!actor->target) return; - if (P_CheckMeleeRange (actor)) { S_StartSound (actor, sfx_claw); @@ -988,34 +643,22 @@ void A_BruisAttack (mobj_t* actor) P_DamageMobj (actor->target, actor, actor, damage); return; } - - P_SpawnMissile (actor, actor->target, MT_BRUISERSHOT); } - - - - - void A_SkelMissile (mobj_t* actor) { mobj_t* mo; - if (!actor->target) return; - A_FaceTarget (actor); actor->z += 16*FRACUNIT; mo = P_SpawnMissile (actor, actor->target, MT_TRACER); actor->z -= 16*FRACUNIT; - mo->x += mo->momx; mo->y += mo->momy; mo->tracer = actor->target; } - int TRACEANGLE = 0xc000000; - void A_Tracer (mobj_t* actor) { angle_t exact; @@ -1023,34 +666,23 @@ void A_Tracer (mobj_t* actor) fixed_t slope; mobj_t* dest; mobj_t* th; - if (gametic & 3) return; - - P_SpawnPuff (actor->x, actor->y, actor->z); - th = P_SpawnMobj (actor->x-actor->momx, actor->y-actor->momy, actor->z, MT_SMOKE); - th->momz = FRACUNIT; th->tics -= P_Random()&3; if (th->tics < 1) th->tics = 1; - - dest = actor->tracer; - if (!dest || dest->health <= 0) return; - - exact = R_PointToAngle2 (actor->x, actor->y, dest->x, dest->y); - if (exact != actor->angle) { if (exact - actor->angle > 0x80000000) @@ -1066,28 +698,20 @@ void A_Tracer (mobj_t* actor) actor->angle = exact; } } - exact = actor->angle>>ANGLETOFINESHIFT; actor->momx = FixedMul (actor->info->speed, finecosine[exact]); actor->momy = FixedMul (actor->info->speed, finesine[exact]); - - dist = P_AproxDistance (dest->x - actor->x, dest->y - actor->y); - dist = dist / actor->info->speed; - if (dist < 1) dist = 1; slope = (dest->z+40*FRACUNIT - actor->z) / dist; - if (slope < actor->momz) actor->momz -= FRACUNIT/8; else actor->momz += FRACUNIT/8; } - - void A_SkelWhoosh (mobj_t* actor) { if (!actor->target) @@ -1095,16 +719,12 @@ void A_SkelWhoosh (mobj_t* actor) A_FaceTarget (actor); S_StartSound (actor,sfx_skeswg); } - void A_SkelFist (mobj_t* actor) { int damage; - if (!actor->target) return; - A_FaceTarget (actor); - if (P_CheckMeleeRange (actor)) { damage = ((P_Random()%10)+1)*6; @@ -1112,320 +732,202 @@ void A_SkelFist (mobj_t* actor) P_DamageMobj (actor->target, actor, actor, damage); } } - - - - - - - mobj_t* corpsehit; mobj_t* vileobj; fixed_t viletryx; fixed_t viletryy; - boolean PIT_VileCheck (mobj_t* thing) { int maxdist; boolean check; - if (!(thing->flags & MF_CORPSE) ) return true; - if (thing->tics != -1) return true; - if (thing->info->raisestate == S_NULL) return true; - maxdist = thing->info->radius + mobjinfo[MT_VILE].radius; - if ( abs(thing->x - viletryx) > maxdist || abs(thing->y - viletryy) > maxdist ) return true; - corpsehit = thing; corpsehit->momx = corpsehit->momy = 0; corpsehit->height <<= 2; check = P_CheckPosition (corpsehit, corpsehit->x, corpsehit->y); corpsehit->height >>= 2; - if (!check) return true; - return false; } - - - - - - - void A_VileChase (mobj_t* actor) { int xl; int xh; int yl; int yh; - int bx; int by; - mobjinfo_t* info; mobj_t* temp; - if (actor->movedir != DI_NODIR) { - viletryx = actor->x + actor->info->speed*xspeed[actor->movedir]; viletryy = actor->y + actor->info->speed*yspeed[actor->movedir]; - xl = (viletryx - bmaporgx - MAXRADIUS*2)>>MAPBLOCKSHIFT; xh = (viletryx - bmaporgx + MAXRADIUS*2)>>MAPBLOCKSHIFT; yl = (viletryy - bmaporgy - MAXRADIUS*2)>>MAPBLOCKSHIFT; yh = (viletryy - bmaporgy + MAXRADIUS*2)>>MAPBLOCKSHIFT; - vileobj = actor; for (bx=xl ; bx<=xh ; bx++) { for (by=yl ; by<=yh ; by++) { - - - if (!P_BlockThingsIterator(bx,by,PIT_VileCheck)) { - temp = actor->target; actor->target = corpsehit; A_FaceTarget (actor); actor->target = temp; - P_SetMobjState (actor, S_VILE_HEAL1); S_StartSound (corpsehit, sfx_slop); info = corpsehit->info; - P_SetMobjState (corpsehit,info->raisestate); corpsehit->height <<= 2; corpsehit->flags = info->flags; corpsehit->health = info->spawnhealth; corpsehit->target = NULL; - return; } } } } - - A_Chase (actor); } - - - - - void A_VileStart (mobj_t* actor) { S_StartSound (actor, sfx_vilatk); } - - - - - - void A_Fire (mobj_t* actor); - void A_StartFire (mobj_t* actor) { S_StartSound(actor,sfx_flamst); A_Fire(actor); } - void A_FireCrackle (mobj_t* actor) { S_StartSound(actor,sfx_flame); A_Fire(actor); } - void A_Fire (mobj_t* actor) { mobj_t* dest; unsigned an; - dest = actor->tracer; if (!dest) return; - - if (!P_CheckSight (actor->target, dest) ) return; - an = dest->angle >> ANGLETOFINESHIFT; - P_UnsetThingPosition (actor); actor->x = dest->x + FixedMul (24*FRACUNIT, finecosine[an]); actor->y = dest->y + FixedMul (24*FRACUNIT, finesine[an]); actor->z = dest->z; P_SetThingPosition (actor); } - - - - - - - void A_VileTarget (mobj_t* actor) { mobj_t* fog; - if (!actor->target) return; - A_FaceTarget (actor); - fog = P_SpawnMobj (actor->target->x, actor->target->x, actor->target->z, MT_FIRE); - actor->tracer = fog; fog->target = actor; fog->tracer = actor->target; A_Fire (fog); } - - - - - - - void A_VileAttack (mobj_t* actor) { mobj_t* fire; int an; - if (!actor->target) return; - A_FaceTarget (actor); - if (!P_CheckSight (actor, actor->target) ) return; - S_StartSound (actor, sfx_barexp); P_DamageMobj (actor->target, actor, actor, 20); actor->target->momz = 1000*FRACUNIT/actor->target->info->mass; - an = actor->angle >> ANGLETOFINESHIFT; - fire = actor->tracer; - if (!fire) return; - - fire->x = actor->target->x - FixedMul (24*FRACUNIT, finecosine[an]); fire->y = actor->target->y - FixedMul (24*FRACUNIT, finesine[an]); P_RadiusAttack (fire, actor, 70 ); } - - - - - - - - - - #define FATSPREAD (ANG90/8) - void A_FatRaise (mobj_t *actor) { A_FaceTarget (actor); S_StartSound (actor, sfx_manatk); } - - void A_FatAttack1 (mobj_t* actor) { mobj_t* mo; int an; - A_FaceTarget (actor); - actor->angle += FATSPREAD; P_SpawnMissile (actor, actor->target, MT_FATSHOT); - mo = P_SpawnMissile (actor, actor->target, MT_FATSHOT); mo->angle += FATSPREAD; an = mo->angle >> ANGLETOFINESHIFT; mo->momx = FixedMul (mo->info->speed, finecosine[an]); mo->momy = FixedMul (mo->info->speed, finesine[an]); } - void A_FatAttack2 (mobj_t* actor) { mobj_t* mo; int an; - A_FaceTarget (actor); - actor->angle -= FATSPREAD; P_SpawnMissile (actor, actor->target, MT_FATSHOT); - mo = P_SpawnMissile (actor, actor->target, MT_FATSHOT); mo->angle -= FATSPREAD*2; an = mo->angle >> ANGLETOFINESHIFT; mo->momx = FixedMul (mo->info->speed, finecosine[an]); mo->momy = FixedMul (mo->info->speed, finesine[an]); } - void A_FatAttack3 (mobj_t* actor) { mobj_t* mo; int an; - A_FaceTarget (actor); - mo = P_SpawnMissile (actor, actor->target, MT_FATSHOT); mo->angle -= FATSPREAD/2; an = mo->angle >> ANGLETOFINESHIFT; mo->momx = FixedMul (mo->info->speed, finecosine[an]); mo->momy = FixedMul (mo->info->speed, finesine[an]); - mo = P_SpawnMissile (actor, actor->target, MT_FATSHOT); mo->angle += FATSPREAD/2; an = mo->angle >> ANGLETOFINESHIFT; mo->momx = FixedMul (mo->info->speed, finecosine[an]); mo->momy = FixedMul (mo->info->speed, finesine[an]); } - - - - - - #define SKULLSPEED (20*FRACUNIT) - void A_SkullAttack (mobj_t* actor) { mobj_t* dest; angle_t an; int dist; - if (!actor->target) return; - dest = actor->target; actor->flags |= MF_SKULLFLY; - S_StartSound (actor, actor->info->attacksound); A_FaceTarget (actor); an = actor->angle >> ANGLETOFINESHIFT; @@ -1433,17 +935,10 @@ void A_SkullAttack (mobj_t* actor) actor->momy = FixedMul (SKULLSPEED, finesine[an]); dist = P_AproxDistance (dest->x - actor->x, dest->y - actor->y); dist = dist / SKULLSPEED; - if (dist < 1) dist = 1; actor->momz = (dest->z+(dest->height>>1) - actor->z) / dist; } - - - - - - void A_PainShootSkull ( mobj_t* actor, @@ -1452,16 +947,12 @@ A_PainShootSkull fixed_t x; fixed_t y; fixed_t z; - mobj_t* newmobj; angle_t an; int prestep; int count; thinker_t* currentthinker; - - count = 0; - currentthinker = thinkercap.next; while (currentthinker != &thinkercap) { @@ -1470,53 +961,31 @@ A_PainShootSkull count++; currentthinker = currentthinker->next; } - - - if (count > 20) return; - - - an = angle >> ANGLETOFINESHIFT; - prestep = 4*FRACUNIT + 3*(actor->info->radius + mobjinfo[MT_SKULL].radius)/2; - x = actor->x + FixedMul (prestep, finecosine[an]); y = actor->y + FixedMul (prestep, finesine[an]); z = actor->z + 8*FRACUNIT; - newmobj = P_SpawnMobj (x , y, z, MT_SKULL); - - if (!P_TryMove (newmobj, newmobj->x, newmobj->y)) { - P_DamageMobj (newmobj,actor,actor,10000); return; } - newmobj->target = actor->target; A_SkullAttack (newmobj); } - - - - - - void A_PainAttack (mobj_t* actor) { if (!actor->target) return; - A_FaceTarget (actor); A_PainShootSkull (actor, actor->angle); } - - void A_PainDie (mobj_t* actor) { A_Fall (actor); @@ -1524,98 +993,61 @@ void A_PainDie (mobj_t* actor) A_PainShootSkull (actor, actor->angle+ANG180); A_PainShootSkull (actor, actor->angle+ANG270); } - - - - - - void A_Scream (mobj_t* actor) { int sound; - switch (actor->info->deathsound) { case 0: return; - case sfx_podth1: case sfx_podth2: case sfx_podth3: sound = sfx_podth1 + P_Random ()%3; break; - case sfx_bgdth1: case sfx_bgdth2: sound = sfx_bgdth1 + P_Random ()%2; break; - default: sound = actor->info->deathsound; break; } - - if (actor->type==MT_SPIDER || actor->type == MT_CYBORG) { - S_StartSound (NULL, sound); } else S_StartSound (actor, sound); } - - void A_XScream (mobj_t* actor) { S_StartSound (actor, sfx_slop); } - void A_Pain (mobj_t* actor) { if (actor->info->painsound) S_StartSound (actor, actor->info->painsound); } - - - void A_Fall (mobj_t *actor) { - actor->flags &= ~MF_SOLID; - - - -} - - - - - +} void A_Explode (mobj_t* thingy) { P_RadiusAttack ( thingy, thingy->target, 128 ); } - - - - - - - void A_BossDeath (mobj_t* mo) { thinker_t* th; mobj_t* mo2; line_t junk; int i; - if ( gamemode == commercial) { if (gamemap != 7) return; - if ((mo->type != MT_FATSO) && (mo->type != MT_BABY)) return; @@ -1627,28 +1059,21 @@ void A_BossDeath (mobj_t* mo) case 1: if (gamemap != 8) return; - if (mo->type != MT_BRUISER) return; break; - case 2: if (gamemap != 8) return; - if (mo->type != MT_CYBORG) return; break; - case 3: if (gamemap != 8) return; - if (mo->type != MT_SPIDER) return; - break; - case 4: switch(gamemap) { @@ -1656,53 +1081,38 @@ void A_BossDeath (mobj_t* mo) if (mo->type != MT_CYBORG) return; break; - case 8: if (mo->type != MT_SPIDER) return; break; - default: return; break; } break; - default: if (gamemap != 8) return; break; } - } - - - for (i=0 ; i<MAXPLAYERS ; i++) if (playeringame[i] && players[i].health > 0) break; - if (i==MAXPLAYERS) return; - - - for (th = thinkercap.next ; th != &thinkercap ; th=th->next) { if (th->function.acp1 != (actionf_p1)P_MobjThinker) continue; - mo2 = (mobj_t *)th; if (mo2 != mo && mo2->type == mo->type && mo2->health > 0) { - return; } } - - if ( gamemode == commercial) { if (gamemap == 7) @@ -1713,7 +1123,6 @@ void A_BossDeath (mobj_t* mo) EV_DoFloor(&junk,lowerFloorToLowest); return; } - if (mo->type == MT_BABY) { junk.tag = 667; @@ -1731,7 +1140,6 @@ void A_BossDeath (mobj_t* mo) EV_DoFloor (&junk, lowerFloorToLowest); return; break; - case 4: switch(gamemap) { @@ -1740,7 +1148,6 @@ void A_BossDeath (mobj_t* mo) EV_DoDoor (&junk, blazeOpen); return; break; - case 8: junk.tag = 666; EV_DoFloor (&junk, lowerFloorToLowest); @@ -1749,29 +1156,23 @@ void A_BossDeath (mobj_t* mo) } } } - G_ExitLevel (); } - - void A_Hoof (mobj_t* mo) { S_StartSound (mo, sfx_hoof); A_Chase (mo); } - void A_Metal (mobj_t* mo) { S_StartSound (mo, sfx_metal); A_Chase (mo); } - void A_BabyMetal (mobj_t* mo) { S_StartSound (mo, sfx_bspwlk); A_Chase (mo); } - void A_OpenShotgun2 ( player_t* player, @@ -1779,7 +1180,6 @@ A_OpenShotgun2 { S_StartSound (player->mo, sfx_dbopn); } - void A_LoadShotgun2 ( player_t* player, @@ -1787,12 +1187,10 @@ A_LoadShotgun2 { S_StartSound (player->mo, sfx_dbload); } - void A_ReFire ( player_t* player, pspdef_t* psp ); - void A_CloseShotgun2 ( player_t* player, @@ -1801,22 +1199,15 @@ A_CloseShotgun2 S_StartSound (player->mo, sfx_dbcls); A_ReFire(player,psp); } - - - mobj_t* braintargets[32]; int numbraintargets; int braintargeton; - void A_BrainAwake (mobj_t* mo) { thinker_t* thinker; mobj_t* m; - - numbraintargets = 0; braintargeton = 0; - thinker = thinkercap.next; for (thinker = thinkercap.next ; thinker != &thinkercap ; @@ -1824,113 +1215,80 @@ void A_BrainAwake (mobj_t* mo) { if (thinker->function.acp1 != (actionf_p1)P_MobjThinker) continue; - m = (mobj_t *)thinker; - if (m->type == MT_BOSSTARGET ) { braintargets[numbraintargets] = m; numbraintargets++; } } - S_StartSound (NULL,sfx_bossit); } - - void A_BrainPain (mobj_t* mo) { S_StartSound (NULL,sfx_bospn); } - - void A_BrainScream (mobj_t* mo) { int x; int y; int z; mobj_t* th; - for (x=mo->x - 196*FRACUNIT ; x< mo->x + 320*FRACUNIT ; x+= FRACUNIT*8) { y = mo->y - 320*FRACUNIT; z = 128 + P_Random()*2*FRACUNIT; th = P_SpawnMobj (x,y,z, MT_ROCKET); th->momz = P_Random()*512; - P_SetMobjState (th, S_BRAINEXPLODE1); - th->tics -= P_Random()&7; if (th->tics < 1) th->tics = 1; } - S_StartSound (NULL,sfx_bosdth); } - - - void A_BrainExplode (mobj_t* mo) { int x; int y; int z; mobj_t* th; - x = mo->x + (P_Random () - P_Random ())*2048; y = mo->y; z = 128 + P_Random()*2*FRACUNIT; th = P_SpawnMobj (x,y,z, MT_ROCKET); th->momz = P_Random()*512; - P_SetMobjState (th, S_BRAINEXPLODE1); - th->tics -= P_Random()&7; if (th->tics < 1) th->tics = 1; } - - void A_BrainDie (mobj_t* mo) { G_ExitLevel (); } - void A_BrainSpit (mobj_t* mo) { mobj_t* targ; mobj_t* newmobj; - static int easy = 0; - easy ^= 1; if (gameskill <= sk_easy && (!easy)) return; - - targ = braintargets[braintargeton]; braintargeton = (braintargeton+1)%numbraintargets; - - newmobj = P_SpawnMissile (mo, targ, MT_SPAWNSHOT); newmobj->target = targ; newmobj->reactiontime = ((targ->y - mo->y)/newmobj->momy) / newmobj->state->tics; - S_StartSound(NULL, sfx_bospit); } - - - void A_SpawnFly (mobj_t* mo); - - void A_SpawnSound (mobj_t* mo) { S_StartSound (mo,sfx_boscub); A_SpawnFly(mo); } - void A_SpawnFly (mobj_t* mo) { mobj_t* newmobj; @@ -1938,21 +1296,12 @@ void A_SpawnFly (mobj_t* mo) mobj_t* targ; int r; mobjtype_t type; - if (--mo->reactiontime) return; - targ = mo->target; - - fog = P_SpawnMobj (targ->x, targ->y, targ->z, MT_SPAWNFIRE); S_StartSound (fog, sfx_telept); - - r = P_Random (); - - - if ( r<50 ) type = MT_TROOP; else if (r<90) @@ -1975,32 +1324,19 @@ void A_SpawnFly (mobj_t* mo) type = MT_KNIGHT; else type = MT_BRUISER; - newmobj = P_SpawnMobj (targ->x, targ->y, targ->z, type); if (P_LookForPlayers (newmobj, true) ) P_SetMobjState (newmobj, newmobj->info->seestate); - - P_TeleportMove (newmobj, newmobj->x, newmobj->y); - - P_RemoveMobj (mo); } - - - void A_PlayerScream (mobj_t* mo) { - int sound = sfx_pldeth; - if ( (gamemode == commercial) && (mo->health < -50)) { - - sound = sfx_pdiehi; } - S_StartSound (mo, sound); } diff --git a/src/p_floor.c b/src/p_floor.c @@ -1,48 +1,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - #include "z_zone.h" #include "doomdef.h" #include "p_local.h" - #include "s_sound.h" - - #include "doomstat.h" #include "r_state.h" - #include "sounds.h" - - - - - - - - - result_e T_MovePlane ( sector_t* sector, @@ -54,15 +16,12 @@ T_MovePlane { boolean flag; fixed_t lastpos; - switch(floorOrCeiling) { case 0: - switch(direction) { case -1: - if (sector->floorheight - speed < dest) { lastpos = sector->floorheight; @@ -72,7 +31,6 @@ T_MovePlane { sector->floorheight =lastpos; P_ChangeSector(sector,crush); - } return pastdest; } @@ -89,9 +47,7 @@ T_MovePlane } } break; - case 1: - if (sector->floorheight + speed > dest) { lastpos = sector->floorheight; @@ -101,13 +57,11 @@ T_MovePlane { sector->floorheight = lastpos; P_ChangeSector(sector,crush); - } return pastdest; } else { - lastpos = sector->floorheight; sector->floorheight += speed; flag = P_ChangeSector(sector,crush); @@ -123,34 +77,27 @@ T_MovePlane break; } break; - case 1: - switch(direction) { case -1: - if (sector->ceilingheight - speed < dest) { lastpos = sector->ceilingheight; sector->ceilingheight = dest; flag = P_ChangeSector(sector,crush); - if (flag == true) { sector->ceilingheight = lastpos; P_ChangeSector(sector,crush); - } return pastdest; } else { - lastpos = sector->ceilingheight; sector->ceilingheight -= speed; flag = P_ChangeSector(sector,crush); - if (flag == true) { if (crush == true) @@ -161,9 +108,7 @@ T_MovePlane } } break; - case 1: - if (sector->ceilingheight + speed > dest) { lastpos = sector->ceilingheight; @@ -173,7 +118,6 @@ T_MovePlane { sector->ceilingheight = lastpos; P_ChangeSector(sector,crush); - } return pastdest; } @@ -182,7 +126,6 @@ T_MovePlane lastpos = sector->ceilingheight; sector->ceilingheight += speed; flag = P_ChangeSector(sector,crush); - #if 0 if (flag == true) { @@ -195,32 +138,22 @@ T_MovePlane break; } break; - } return ok; } - - - - - void T_MoveFloor(floormove_t* floor) { result_e res; - res = T_MovePlane(floor->sector, floor->speed, floor->floordestheight, floor->crush,0,floor->direction); - if (!(leveltime&7)) S_StartSound((mobj_t *)&floor->sector->soundorg, sfx_stnmov); - if (res == pastdest) { floor->sector->specialdata = NULL; - if (floor->direction == 1) { switch(floor->type) @@ -244,16 +177,10 @@ void T_MoveFloor(floormove_t* floor) } } P_RemoveThinker(&floor->thinker); - S_StartSound((mobj_t *)&floor->sector->soundorg, sfx_pstop); } - } - - - - int EV_DoFloor ( line_t* line, @@ -264,18 +191,13 @@ EV_DoFloor int i; sector_t* sec; floormove_t* floor; - secnum = -1; rtn = 0; while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0) { sec = &sectors[secnum]; - - if (sec->specialdata) continue; - - rtn = 1; floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0); P_AddThinker (&floor->thinker); @@ -283,7 +205,6 @@ EV_DoFloor floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor; floor->type = floortype; floor->crush = false; - switch(floortype) { case lowerFloor: @@ -293,7 +214,6 @@ EV_DoFloor floor->floordestheight = P_FindHighestFloorSurrounding(sec); break; - case lowerFloorToLowest: floor->direction = -1; floor->sector = sec; @@ -301,7 +221,6 @@ EV_DoFloor floor->floordestheight = P_FindLowestFloorSurrounding(sec); break; - case turboLower: floor->direction = -1; floor->sector = sec; @@ -311,7 +230,6 @@ EV_DoFloor if (floor->floordestheight != sec->floorheight) floor->floordestheight += 8*FRACUNIT; break; - case raiseFloorCrush: floor->crush = true; case raiseFloor: @@ -325,7 +243,6 @@ EV_DoFloor floor->floordestheight -= (8*FRACUNIT)* (floortype == raiseFloorCrush); break; - case raiseFloorTurbo: floor->direction = 1; floor->sector = sec; @@ -333,7 +250,6 @@ EV_DoFloor floor->floordestheight = P_FindNextHighestFloor(sec,sec->floorheight); break; - case raiseFloorToNearest: floor->direction = 1; floor->sector = sec; @@ -341,7 +257,6 @@ EV_DoFloor floor->floordestheight = P_FindNextHighestFloor(sec,sec->floorheight); break; - case raiseFloor24: floor->direction = 1; floor->sector = sec; @@ -356,7 +271,6 @@ EV_DoFloor floor->floordestheight = floor->sector->floorheight + 512 * FRACUNIT; break; - case raiseFloor24AndChange: floor->direction = 1; floor->sector = sec; @@ -366,12 +280,10 @@ EV_DoFloor sec->floorpic = line->frontsector->floorpic; sec->special = line->frontsector->special; break; - case raiseToTexture: { int minsize = MAXINT; side_t* side; - floor->direction = 1; floor->sector = sec; floor->speed = FLOORSPEED; @@ -397,7 +309,6 @@ EV_DoFloor floor->sector->floorheight + minsize; } break; - case lowerAndChange: floor->direction = -1; floor->sector = sec; @@ -405,7 +316,6 @@ EV_DoFloor floor->floordestheight = P_FindLowestFloorSurrounding(sec); floor->texture = sec->floorpic; - for (i = 0; i < sec->linecount; i++) { if ( twoSided(secnum, i) ) @@ -413,7 +323,6 @@ EV_DoFloor if (getSide(secnum,i,0)->sector-sectors == secnum) { sec = getSector(secnum,i,1); - if (sec->floorheight == floor->floordestheight) { floor->texture = sec->floorpic; @@ -424,7 +333,6 @@ EV_DoFloor else { sec = getSector(secnum,i,0); - if (sec->floorheight == floor->floordestheight) { floor->texture = sec->floorpic; @@ -440,13 +348,6 @@ EV_DoFloor } return rtn; } - - - - - - - int EV_BuildStairs ( line_t* line, @@ -459,26 +360,18 @@ EV_BuildStairs int texture; int ok; int rtn; - sector_t* sec; sector_t* tsec; - floormove_t* floor; - fixed_t stairsize; fixed_t speed; - secnum = -1; rtn = 0; while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0) { sec = &sectors[secnum]; - - if (sec->specialdata) continue; - - rtn = 1; floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0); P_AddThinker (&floor->thinker); @@ -500,12 +393,7 @@ EV_BuildStairs floor->speed = speed; height = sec->floorheight + stairsize; floor->floordestheight = height; - texture = sec->floorpic; - - - - do { ok = 0; @@ -513,30 +401,21 @@ EV_BuildStairs { if ( !((sec->lines[i])->flags & ML_TWOSIDED) ) continue; - tsec = (sec->lines[i])->frontsector; newsecnum = tsec-sectors; - if (secnum != newsecnum) continue; - tsec = (sec->lines[i])->backsector; newsecnum = tsec - sectors; - if (tsec->floorpic != texture) continue; - height += stairsize; - if (tsec->specialdata) continue; - sec = tsec; secnum = newsecnum; floor = Z_Malloc (sizeof(*floor), PU_LEVSPEC, 0); - P_AddThinker (&floor->thinker); - sec->specialdata = floor; floor->thinker.function.acp1 = (actionf_p1) T_MoveFloor; floor->direction = 1; @@ -550,4 +429,3 @@ EV_BuildStairs } return rtn; } - diff --git a/src/p_inter.c b/src/p_inter.c @@ -1,73 +1,19 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - #include "doomdef.h" #include "dstrings.h" #include "sounds.h" - #include "doomstat.h" - #include "m_random.h" #include "i_system.h" - #include "am_map.h" - #include "p_local.h" - #include "s_sound.h" - #ifdef __GNUG__ #pragma implementation "p_inter.h" #endif #include "p_inter.h" - - #define BONUSADD 6 - - - - - - int maxammo[NUMAMMO] = {200, 50, 300, 50}; int clipammo[NUMAMMO] = {10, 4, 20, 1}; - - - - - - - - - - - - - boolean P_GiveAmmo ( player_t* player, @@ -75,45 +21,27 @@ P_GiveAmmo int num ) { int oldammo; - if (ammo == am_noammo) return false; - if (ammo < 0 || ammo > NUMAMMO) I_Error ("P_GiveAmmo: bad type %i", ammo); - if ( player->ammo[ammo] == player->maxammo[ammo] ) return false; - if (num) num *= clipammo[ammo]; else num = clipammo[ammo]/2; - if (gameskill == sk_baby || gameskill == sk_nightmare) { - - num <<= 1; } - - oldammo = player->ammo[ammo]; player->ammo[ammo] += num; - if (player->ammo[ammo] > player->maxammo[ammo]) player->ammo[ammo] = player->maxammo[ammo]; - - - - if (oldammo) return true; - - - - switch (ammo) { case am_clip: @@ -125,7 +53,6 @@ P_GiveAmmo player->pendingweapon = wp_pistol; } break; - case am_shell: if (player->readyweapon == wp_fist || player->readyweapon == wp_pistol) @@ -134,7 +61,6 @@ P_GiveAmmo player->pendingweapon = wp_shotgun; } break; - case am_cell: if (player->readyweapon == wp_fist || player->readyweapon == wp_pistol) @@ -143,7 +69,6 @@ P_GiveAmmo player->pendingweapon = wp_plasma; } break; - case am_misl: if (player->readyweapon == wp_fist) { @@ -153,15 +78,8 @@ P_GiveAmmo default: break; } - return true; } - - - - - - boolean P_GiveWeapon ( player_t* player, @@ -170,33 +88,25 @@ P_GiveWeapon { boolean gaveammo; boolean gaveweapon; - if (netgame && (deathmatch!=2) && !dropped ) { - if (player->weaponowned[weapon]) return false; - player->bonuscount += BONUSADD; player->weaponowned[weapon] = true; - if (deathmatch) P_GiveAmmo (player, weaponinfo[weapon].ammo, 5); else P_GiveAmmo (player, weaponinfo[weapon].ammo, 2); player->pendingweapon = weapon; - if (player == &players[consoleplayer]) S_StartSound (NULL, sfx_wpnup); return false; } - if (weaponinfo[weapon].ammo != am_noammo) { - - if (dropped) gaveammo = P_GiveAmmo (player, weaponinfo[weapon].ammo, 1); else @@ -204,7 +114,6 @@ P_GiveWeapon } else gaveammo = false; - if (player->weaponowned[weapon]) gaveweapon = false; else @@ -213,16 +122,8 @@ P_GiveWeapon player->weaponowned[weapon] = true; player->pendingweapon = weapon; } - return (gaveweapon || gaveammo); } - - - - - - - boolean P_GiveBody ( player_t* player, @@ -230,44 +131,25 @@ P_GiveBody { if (player->health >= MAXHEALTH) return false; - player->health += num; if (player->health > MAXHEALTH) player->health = MAXHEALTH; player->mo->health = player->health; - return true; } - - - - - - - - boolean P_GiveArmor ( player_t* player, int armortype ) { int hits; - hits = armortype*100; if (player->armorpoints >= hits) return false; - player->armortype = armortype; player->armorpoints = hits; - return true; } - - - - - - void P_GiveCard ( player_t* player, @@ -275,15 +157,9 @@ P_GiveCard { if (player->cards[card]) return; - player->bonuscount = BONUSADD; player->cards[card] = 1; } - - - - - boolean P_GivePower ( player_t* player, @@ -294,45 +170,33 @@ P_GivePower player->powers[power] = INVULNTICS; return true; } - if (power == pw_invisibility) { player->powers[power] = INVISTICS; player->mo->flags |= MF_SHADOW; return true; } - if (power == pw_infrared) { player->powers[power] = INFRATICS; return true; } - if (power == pw_ironfeet) { player->powers[power] = IRONTICS; return true; } - if (power == pw_strength) { P_GiveBody (player, 100); player->powers[power] = 1; return true; } - if (player->powers[power]) return false; - player->powers[power] = 1; return true; } - - - - - - void P_TouchSpecialThing ( mobj_t* special, @@ -342,42 +206,28 @@ P_TouchSpecialThing int i; fixed_t delta; int sound; - delta = special->z - toucher->z; - if (delta > toucher->height || delta < -8*FRACUNIT) { - return; } - - sound = sfx_itemup; player = toucher->player; - - - if (toucher->health <= 0) return; - - switch (special->sprite) { - case SPR_ARM1: if (!P_GiveArmor (player, 1)) return; player->message = GOTARMOR; break; - case SPR_ARM2: if (!P_GiveArmor (player, 2)) return; player->message = GOTMEGA; break; - - case SPR_BON1: player->health++; if (player->health > 200) @@ -385,7 +235,6 @@ P_TouchSpecialThing player->mo->health = player->health; player->message = GOTHTHBONUS; break; - case SPR_BON2: player->armorpoints++; if (player->armorpoints > 200) @@ -394,7 +243,6 @@ P_TouchSpecialThing player->armortype = 1; player->message = GOTARMBONUS; break; - case SPR_SOUL: player->health += 100; if (player->health > 200) @@ -403,7 +251,6 @@ P_TouchSpecialThing player->message = GOTSUPER; sound = sfx_getpow; break; - case SPR_MEGA: if (gamemode != commercial) return; @@ -413,9 +260,6 @@ P_TouchSpecialThing player->message = GOTMSPHERE; sound = sfx_getpow; break; - - - case SPR_BKEY: if (!player->cards[it_bluecard]) player->message = GOTBLUECARD; @@ -423,7 +267,6 @@ P_TouchSpecialThing if (!netgame) break; return; - case SPR_YKEY: if (!player->cards[it_yellowcard]) player->message = GOTYELWCARD; @@ -431,7 +274,6 @@ P_TouchSpecialThing if (!netgame) break; return; - case SPR_RKEY: if (!player->cards[it_redcard]) player->message = GOTREDCARD; @@ -439,7 +281,6 @@ P_TouchSpecialThing if (!netgame) break; return; - case SPR_BSKU: if (!player->cards[it_blueskull]) player->message = GOTBLUESKUL; @@ -447,7 +288,6 @@ P_TouchSpecialThing if (!netgame) break; return; - case SPR_YSKU: if (!player->cards[it_yellowskull]) player->message = GOTYELWSKUL; @@ -455,7 +295,6 @@ P_TouchSpecialThing if (!netgame) break; return; - case SPR_RSKU: if (!player->cards[it_redskull]) player->message = GOTREDSKULL; @@ -463,33 +302,25 @@ P_TouchSpecialThing if (!netgame) break; return; - - case SPR_STIM: if (!P_GiveBody (player, 10)) return; player->message = GOTSTIM; break; - case SPR_MEDI: if (!P_GiveBody (player, 25)) return; - if (player->health < 25) player->message = GOTMEDINEED; else player->message = GOTMEDIKIT; break; - - - case SPR_PINV: if (!P_GivePower (player, pw_invulnerability)) return; player->message = GOTINVUL; sound = sfx_getpow; break; - case SPR_PSTR: if (!P_GivePower (player, pw_strength)) return; @@ -498,36 +329,30 @@ P_TouchSpecialThing player->pendingweapon = wp_fist; sound = sfx_getpow; break; - case SPR_PINS: if (!P_GivePower (player, pw_invisibility)) return; player->message = GOTINVIS; sound = sfx_getpow; break; - case SPR_SUIT: if (!P_GivePower (player, pw_ironfeet)) return; player->message = GOTSUIT; sound = sfx_getpow; break; - case SPR_PMAP: if (!P_GivePower (player, pw_allmap)) return; player->message = GOTMAP; sound = sfx_getpow; break; - case SPR_PVIS: if (!P_GivePower (player, pw_infrared)) return; player->message = GOTVISOR; sound = sfx_getpow; break; - - case SPR_CLIP: if (special->flags & MF_DROPPED) { @@ -541,49 +366,41 @@ P_TouchSpecialThing } player->message = GOTCLIP; break; - case SPR_AMMO: if (!P_GiveAmmo (player, am_clip,5)) return; player->message = GOTCLIPBOX; break; - case SPR_ROCK: if (!P_GiveAmmo (player, am_misl,1)) return; player->message = GOTROCKET; break; - case SPR_BROK: if (!P_GiveAmmo (player, am_misl,5)) return; player->message = GOTROCKBOX; break; - case SPR_CELL: if (!P_GiveAmmo (player, am_cell,1)) return; player->message = GOTCELL; break; - case SPR_CELP: if (!P_GiveAmmo (player, am_cell,5)) return; player->message = GOTCELLBOX; break; - case SPR_SHEL: if (!P_GiveAmmo (player, am_shell,1)) return; player->message = GOTSHELLS; break; - case SPR_SBOX: if (!P_GiveAmmo (player, am_shell,5)) return; player->message = GOTSHELLBOX; break; - case SPR_BPAK: if (!player->backpack) { @@ -595,61 +412,51 @@ P_TouchSpecialThing P_GiveAmmo (player, i, 1); player->message = GOTBACKPACK; break; - - case SPR_BFUG: if (!P_GiveWeapon (player, wp_bfg, false) ) return; player->message = GOTBFG9000; sound = sfx_wpnup; break; - case SPR_MGUN: if (!P_GiveWeapon (player, wp_chaingun, special->flags&MF_DROPPED) ) return; player->message = GOTCHAINGUN; sound = sfx_wpnup; break; - case SPR_CSAW: if (!P_GiveWeapon (player, wp_chainsaw, false) ) return; player->message = GOTCHAINSAW; sound = sfx_wpnup; break; - case SPR_LAUN: if (!P_GiveWeapon (player, wp_missile, false) ) return; player->message = GOTLAUNCHER; sound = sfx_wpnup; break; - case SPR_PLAS: if (!P_GiveWeapon (player, wp_plasma, false) ) return; player->message = GOTPLASMA; sound = sfx_wpnup; break; - case SPR_SHOT: if (!P_GiveWeapon (player, wp_shotgun, special->flags&MF_DROPPED ) ) return; player->message = GOTSHOTGUN; sound = sfx_wpnup; break; - case SPR_SGN2: if (!P_GiveWeapon (player, wp_supershotgun, special->flags&MF_DROPPED ) ) return; player->message = GOTSHOTGUN2; sound = sfx_wpnup; break; - default: I_Error ("P_SpecialThing: Unknown gettable thing"); } - if (special->flags & MF_COUNTITEM) player->itemcount++; P_RemoveMobj (special); @@ -657,11 +464,6 @@ P_TouchSpecialThing if (player == &players[consoleplayer]) S_StartSound (NULL, sound); } - - - - - void P_KillMobj ( mobj_t* source, @@ -669,51 +471,35 @@ P_KillMobj { mobjtype_t item; mobj_t* mo; - target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SKULLFLY); - if (target->type != MT_SKULL) target->flags &= ~MF_NOGRAVITY; - target->flags |= MF_CORPSE|MF_DROPOFF; target->height >>= 2; - if (source && source->player) { - if (target->flags & MF_COUNTKILL) source->player->killcount++; - if (target->player) source->player->frags[target->player-players]++; } else if (!netgame && (target->flags & MF_COUNTKILL) ) { - - players[0].killcount++; } - if (target->player) { - if (!source) target->player->frags[target->player-players]++; - target->flags &= ~MF_SOLID; target->player->playerstate = PST_DEAD; P_DropWeapon (target->player); - if (target->player == &players[consoleplayer] && automapactive) { - - AM_Stop (); } - } - if (target->health < -target->info->spawnhealth && target->info->xdeathstate) { @@ -722,53 +508,26 @@ P_KillMobj else P_SetMobjState (target, target->info->deathstate); target->tics -= P_Random()&3; - if (target->tics < 1) target->tics = 1; - - - - - - - switch (target->type) { case MT_WOLFSS: case MT_POSSESSED: item = MT_CLIP; break; - case MT_SHOTGUY: item = MT_SHOTGUN; break; - case MT_CHAINGUY: item = MT_CHAINGUN; break; - default: return; } - mo = P_SpawnMobj (target->x,target->y,ONFLOORZ, item); mo->flags |= MF_DROPPED; } - - - - - - - - - - - - - - - void P_DamageMobj ( mobj_t* target, @@ -781,26 +540,17 @@ P_DamageMobj player_t* player; fixed_t thrust; int temp; - if ( !(target->flags & MF_SHOOTABLE) ) return; - if (target->health <= 0) return; - if ( target->flags & MF_SKULLFLY ) { target->momx = target->momy = target->momz = 0; } - player = target->player; if (player && gameskill == sk_baby) damage >>= 1; - - - - - if (inflictor && !(target->flags & MF_NOCLIP) && (!source @@ -811,10 +561,7 @@ P_DamageMobj inflictor->y, target->x, target->y); - thrust = damage*(FRACUNIT>>3)*100/target->info->mass; - - if ( damage < 40 && damage > target->health && target->z - inflictor->z > 64*FRACUNIT @@ -823,42 +570,31 @@ P_DamageMobj ang += ANG180; thrust *= 4; } - ang >>= ANGLETOFINESHIFT; target->momx += FixedMul (thrust, finecosine[ang]); target->momy += FixedMul (thrust, finesine[ang]); } - - if (player) { - if (target->subsector->sector->special == 11 && damage >= target->health) { damage = target->health - 1; } - - - - if ( damage < 1000 && ( (player->cheats&CF_GODMODE) || player->powers[pw_invulnerability] ) ) { return; } - if (player->armortype) { if (player->armortype == 1) saved = damage/3; else saved = damage/2; - if (player->armorpoints <= saved) { - saved = player->armorpoints; player->armortype = 0; } @@ -868,49 +604,35 @@ P_DamageMobj player->health -= damage; if (player->health < 0) player->health = 0; - player->attacker = source; player->damagecount += damage; - if (player->damagecount > 100) player->damagecount = 100; - temp = damage < 100 ? damage : 100; - if (player == &players[consoleplayer]) I_Tactile (40,10,40+temp*2); } - - target->health -= damage; if (target->health <= 0) { P_KillMobj (source, target); return; } - if ( (P_Random () < target->info->painchance) && !(target->flags&MF_SKULLFLY) ) { target->flags |= MF_JUSTHIT; - P_SetMobjState (target, target->info->painstate); } - target->reactiontime = 0; - if ( (!target->threshold || target->type == MT_VILE) && source && source != target && source->type != MT_VILE) { - - target->target = source; target->threshold = BASETHRESHOLD; if (target->state == &states[target->info->spawnstate] && target->info->seestate != S_NULL) P_SetMobjState (target, target->info->seestate); } - } - diff --git a/src/p_inter.h b/src/p_inter.h @@ -1,41 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __P_INTER__ #define __P_INTER__ - - #ifdef __GNUG__ #pragma interface #endif - - boolean P_GivePower(player_t*, int); - - - #endif - - - - - diff --git a/src/p_lights.c b/src/p_lights.c @@ -1,103 +1,36 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - #include "z_zone.h" #include "m_random.h" - #include "doomdef.h" #include "p_local.h" - - - #include "r_state.h" - - - - - - - - void T_FireFlicker (fireflicker_t* flick) { int amount; - if (--flick->count) return; - amount = (P_Random()&3)*16; - if (flick->sector->lightlevel - amount < flick->minlight) flick->sector->lightlevel = flick->minlight; else flick->sector->lightlevel = flick->maxlight - amount; - flick->count = 4; } - - - - - - void P_SpawnFireFlicker (sector_t* sector) { fireflicker_t* flick; - - - sector->special = 0; - flick = Z_Malloc ( sizeof(*flick), PU_LEVSPEC, 0); - P_AddThinker (&flick->thinker); - flick->thinker.function.acp1 = (actionf_p1) T_FireFlicker; flick->sector = sector; flick->maxlight = sector->lightlevel; flick->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel)+16; flick->count = 4; } - - - - - - - - - - - - void T_LightFlash (lightflash_t* flash) { if (--flash->count) return; - if (flash->sector->lightlevel == flash->maxlight) { flash-> sector->lightlevel = flash->minlight; @@ -108,53 +41,25 @@ void T_LightFlash (lightflash_t* flash) flash-> sector->lightlevel = flash->maxlight; flash->count = (P_Random()&flash->maxtime)+1; } - } - - - - - - - - - void P_SpawnLightFlash (sector_t* sector) { lightflash_t* flash; - - sector->special = 0; - flash = Z_Malloc ( sizeof(*flash), PU_LEVSPEC, 0); - P_AddThinker (&flash->thinker); - flash->thinker.function.acp1 = (actionf_p1) T_LightFlash; flash->sector = sector; flash->maxlight = sector->lightlevel; - flash->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel); flash->maxtime = 64; flash->mintime = 7; flash->count = (P_Random()&flash->maxtime)+1; } - - - - - - - - - - - void T_StrobeFlash (strobe_t* flash) { if (--flash->count) return; - if (flash->sector->lightlevel == flash->minlight) { flash-> sector->lightlevel = flash->maxlight; @@ -165,16 +70,7 @@ void T_StrobeFlash (strobe_t* flash) flash-> sector->lightlevel = flash->minlight; flash->count =flash->darktime; } - } - - - - - - - - void P_SpawnStrobeFlash ( sector_t* sector, @@ -182,55 +78,35 @@ P_SpawnStrobeFlash int inSync ) { strobe_t* flash; - flash = Z_Malloc ( sizeof(*flash), PU_LEVSPEC, 0); - P_AddThinker (&flash->thinker); - flash->sector = sector; flash->darktime = fastOrSlow; flash->brighttime = STROBEBRIGHT; flash->thinker.function.acp1 = (actionf_p1) T_StrobeFlash; flash->maxlight = sector->lightlevel; flash->minlight = P_FindMinSurroundingLight(sector, sector->lightlevel); - if (flash->minlight == flash->maxlight) flash->minlight = 0; - - sector->special = 0; - if (!inSync) flash->count = (P_Random()&7)+1; else flash->count = 1; } - - - - - void EV_StartLightStrobing(line_t* line) { int secnum; sector_t* sec; - secnum = -1; while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0) { sec = &sectors[secnum]; if (sec->specialdata) continue; - P_SpawnStrobeFlash (sec,SLOWDARK, 0); } } - - - - - - void EV_TurnTagLightsOff(line_t* line) { int i; @@ -239,9 +115,7 @@ void EV_TurnTagLightsOff(line_t* line) sector_t* sector; sector_t* tsec; line_t* templine; - sector = sectors; - for (j = 0;j < numsectors; j++, sector++) { if (sector->tag == line->tag) @@ -260,11 +134,6 @@ void EV_TurnTagLightsOff(line_t* line) } } } - - - - - void EV_LightTurnOn ( line_t* line, @@ -275,26 +144,19 @@ EV_LightTurnOn sector_t* sector; sector_t* temp; line_t* templine; - sector = sectors; - for (i=0;i<numsectors;i++, sector++) { if (sector->tag == line->tag) { - - - if (!bright) { for (j = 0;j < sector->linecount; j++) { templine = sector->lines[j]; temp = getNextSector(templine,sector); - if (!temp) continue; - if (temp->lightlevel > bright) bright = temp->lightlevel; } @@ -303,18 +165,11 @@ EV_LightTurnOn } } } - - - - - - void T_Glow(glow_t* g) { switch(g->direction) { case -1: - g->sector->lightlevel -= GLOWSPEED; if (g->sector->lightlevel <= g->minlight) { @@ -322,9 +177,7 @@ void T_Glow(glow_t* g) g->direction = 1; } break; - case 1: - g->sector->lightlevel += GLOWSPEED; if (g->sector->lightlevel >= g->maxlight) { @@ -334,22 +187,15 @@ void T_Glow(glow_t* g) break; } } - - void P_SpawnGlowingLight(sector_t* sector) { glow_t* g; - g = Z_Malloc( sizeof(*g), PU_LEVSPEC, 0); - P_AddThinker(&g->thinker); - g->sector = sector; g->minlight = P_FindMinSurroundingLight(sector,sector->lightlevel); g->maxlight = sector->lightlevel; g->thinker.function.acp1 = (actionf_p1) T_Glow; g->direction = -1; - sector->special = 0; } - diff --git a/src/p_local.h b/src/p_local.h @@ -1,146 +1,61 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __P_LOCAL__ #define __P_LOCAL__ - #ifndef __R_LOCAL__ #include "r_local.h" #endif - #define FLOATSPEED (FRACUNIT*4) - - #define MAXHEALTH 100 #define VIEWHEIGHT (41*FRACUNIT) - - - #define MAPBLOCKUNITS 128 #define MAPBLOCKSIZE (MAPBLOCKUNITS*FRACUNIT) #define MAPBLOCKSHIFT (FRACBITS+7) #define MAPBMASK (MAPBLOCKSIZE-1) #define MAPBTOFRAC (MAPBLOCKSHIFT-FRACBITS) - - - #define PLAYERRADIUS 16*FRACUNIT - - - - #define MAXRADIUS 32*FRACUNIT - #define GRAVITY FRACUNIT #define MAXMOVE (30*FRACUNIT) - #define USERANGE (64*FRACUNIT) #define MELEERANGE (64*FRACUNIT) #define MISSILERANGE (32*64*FRACUNIT) - - #define BASETHRESHOLD 100 - - - - - - - - extern thinker_t thinkercap; - - void P_InitThinkers (void); void P_AddThinker (thinker_t* thinker); void P_RemoveThinker (thinker_t* thinker); - - - - - void P_SetupPsprites (player_t* curplayer); void P_MovePsprites (player_t* curplayer); void P_DropWeapon (player_t* player); - - - - - void P_PlayerThink (player_t* player); - - - - - #define ONFLOORZ MININT #define ONCEILINGZ MAXINT - - #define ITEMQUESIZE 128 - extern mapthing_t itemrespawnque[ITEMQUESIZE]; extern int itemrespawntime[ITEMQUESIZE]; 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_RemoveMobj (mobj_t* th); boolean P_SetMobjState (mobj_t* mobj, statenum_t state); void P_MobjThinker (mobj_t* mobj); - void P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z); void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage); mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type); void P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type); - - - - - void P_NoiseAlert (mobj_t* target, mobj_t* emmiter); - - - - - typedef struct { fixed_t x; fixed_t y; fixed_t dx; fixed_t dy; - } divline_t; - typedef struct { fixed_t frac; @@ -150,37 +65,27 @@ typedef struct line_t* line; } d; } intercept_t; - #define MAXINTERCEPTS 128 - extern intercept_t intercepts[MAXINTERCEPTS]; extern intercept_t* intercept_p; - typedef boolean (*traverser_t) (intercept_t *in); - fixed_t P_AproxDistance (fixed_t dx, fixed_t dy); int P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line); int P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line); void P_MakeDivline (line_t* li, divline_t* dl); fixed_t P_InterceptVector (divline_t* v2, divline_t* v1); int P_BoxOnLineSide (fixed_t* tmbox, line_t* ld); - extern fixed_t opentop; extern fixed_t openbottom; extern fixed_t openrange; extern fixed_t lowfloor; - void P_LineOpening (line_t* linedef); - boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) ); boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) ); - #define PT_ADDLINES 1 #define PT_ADDTHINGS 2 #define PT_EARLYOUT 4 - extern divline_t trace; - boolean P_PathTraverse ( fixed_t x1, @@ -189,41 +94,25 @@ P_PathTraverse fixed_t y2, int flags, boolean (*trav) (intercept_t *)); - void P_UnsetThingPosition (mobj_t* thing); void P_SetThingPosition (mobj_t* thing); - - - - - - - - extern boolean floatok; extern fixed_t tmfloorz; extern fixed_t tmceilingz; - - extern line_t* ceilingline; - boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y); boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y); boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y); void P_SlideMove (mobj_t* mo); boolean P_CheckSight (mobj_t* t1, mobj_t* t2); void P_UseLines (player_t* player); - boolean P_ChangeSector (sector_t* sector, boolean crunch); - extern mobj_t* linetarget; - fixed_t P_AimLineAttack ( mobj_t* t1, angle_t angle, fixed_t distance ); - void P_LineAttack ( mobj_t* t1, @@ -231,18 +120,11 @@ P_LineAttack fixed_t distance, fixed_t slope, int damage ); - void P_RadiusAttack ( mobj_t* spot, mobj_t* source, int damage ); - - - - - - extern byte* rejectmatrix; extern short* blockmaplump; extern short* blockmap; @@ -251,39 +133,17 @@ extern int bmapheight; extern fixed_t bmaporgx; extern fixed_t bmaporgy; extern mobj_t** blocklinks; - - - - - - extern int maxammo[NUMAMMO]; extern int clipammo[NUMAMMO]; - void P_TouchSpecialThing ( mobj_t* special, mobj_t* toucher ); - void P_DamageMobj ( mobj_t* target, mobj_t* inflictor, mobj_t* source, int damage ); - - - - - #include "p_spec.h" - - #endif - - - - - - - diff --git a/src/p_map.c b/src/p_map.c @@ -1,114 +1,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - #include <stdlib.h> - #include "m_bbox.h" #include "m_random.h" #include "i_system.h" - #include "doomdef.h" #include "p_local.h" - #include "s_sound.h" - - #include "doomstat.h" #include "r_state.h" - #include "sounds.h" - - fixed_t tmbbox[4]; mobj_t* tmthing; int tmflags; fixed_t tmx; fixed_t tmy; - - - - boolean floatok; - fixed_t tmfloorz; fixed_t tmceilingz; fixed_t tmdropoffz; - - - line_t* ceilingline; - - - #define MAXSPECIALCROSS 8 - line_t* spechit[MAXSPECIALCROSS]; int numspechit; - - - - - - - - - - boolean PIT_StompThing (mobj_t* thing) { fixed_t blockdist; - if (!(thing->flags & MF_SHOOTABLE) ) return true; - blockdist = thing->radius + tmthing->radius; - if ( abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist ) { - return true; } - - if (thing == tmthing) return true; - - if ( !tmthing->player && gamemap != 30) return false; - P_DamageMobj (thing, tmthing, tmthing, 10000); - return true; } - - - - - boolean P_TeleportMove ( mobj_t* thing, @@ -121,69 +51,37 @@ P_TeleportMove int yh; int bx; int by; - subsector_t* newsubsec; - - tmthing = thing; tmflags = thing->flags; - tmx = x; tmy = y; - tmbbox[BOXTOP] = y + tmthing->radius; tmbbox[BOXBOTTOM] = y - tmthing->radius; tmbbox[BOXRIGHT] = x + tmthing->radius; tmbbox[BOXLEFT] = x - tmthing->radius; - newsubsec = R_PointInSubsector (x,y); ceilingline = NULL; - - - - - tmfloorz = tmdropoffz = newsubsec->sector->floorheight; tmceilingz = newsubsec->sector->ceilingheight; - validcount++; numspechit = 0; - - xl = (tmbbox[BOXLEFT] - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT; xh = (tmbbox[BOXRIGHT] - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT; yl = (tmbbox[BOXBOTTOM] - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT; yh = (tmbbox[BOXTOP] - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT; - for (bx=xl ; bx<=xh ; bx++) for (by=yl ; by<=yh ; by++) if (!P_BlockThingsIterator(bx,by,PIT_StompThing)) return false; - - - P_UnsetThingPosition (thing); - thing->floorz = tmfloorz; thing->ceilingz = tmceilingz; thing->x = x; thing->y = y; - P_SetThingPosition (thing); - return true; } - - - - - - - - - - - boolean PIT_CheckLine (line_t* ld) { if (tmbbox[BOXRIGHT] <= ld->bbox[BOXLEFT] @@ -191,184 +89,95 @@ boolean PIT_CheckLine (line_t* ld) || tmbbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || tmbbox[BOXBOTTOM] >= ld->bbox[BOXTOP] ) return true; - if (P_BoxOnLineSide (tmbbox, ld) != -1) return true; - - - - - - - - - - - - if (!ld->backsector) return false; - if (!(tmthing->flags & MF_MISSILE) ) { if ( ld->flags & ML_BLOCKING ) return false; - if ( !tmthing->player && ld->flags & ML_BLOCKMONSTERS ) return false; } - - P_LineOpening (ld); - - if (opentop < tmceilingz) { tmceilingz = opentop; ceilingline = ld; } - if (openbottom > tmfloorz) tmfloorz = openbottom; - if (lowfloor < tmdropoffz) tmdropoffz = lowfloor; - - if (ld->special) { spechit[numspechit] = ld; numspechit++; } - return true; } - - - - boolean PIT_CheckThing (mobj_t* thing) { fixed_t blockdist; boolean solid; int damage; - if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_SHOOTABLE) )) return true; - blockdist = thing->radius + tmthing->radius; - if ( abs(thing->x - tmx) >= blockdist || abs(thing->y - tmy) >= blockdist ) { - return true; } - - if (thing == tmthing) return true; - - if (tmthing->flags & MF_SKULLFLY) { damage = ((P_Random()%8)+1)*tmthing->info->damage; - P_DamageMobj (thing, tmthing, tmthing, damage); - tmthing->flags &= ~MF_SKULLFLY; tmthing->momx = tmthing->momy = tmthing->momz = 0; - P_SetMobjState (tmthing, tmthing->info->spawnstate); - return false; } - - - if (tmthing->flags & MF_MISSILE) { - if (tmthing->z > thing->z + thing->height) return true; if (tmthing->z+tmthing->height < thing->z) return true; - if (tmthing->target && ( tmthing->target->type == thing->type || (tmthing->target->type == MT_KNIGHT && thing->type == MT_BRUISER)|| (tmthing->target->type == MT_BRUISER && thing->type == MT_KNIGHT) ) ) { - if (thing == tmthing->target) return true; - if (thing->type != MT_PLAYER) { - - return false; } } - if (! (thing->flags & MF_SHOOTABLE) ) { - return !(thing->flags & MF_SOLID); } - - damage = ((P_Random()%8)+1)*tmthing->info->damage; P_DamageMobj (thing, tmthing, tmthing->target, damage); - - return false; } - - if (thing->flags & MF_SPECIAL) { solid = thing->flags&MF_SOLID; if (tmflags&MF_PICKUP) { - P_TouchSpecialThing (thing, tmthing); } return !solid; } - return !(thing->flags & MF_SOLID); } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - boolean P_CheckPosition ( mobj_t* thing, @@ -382,69 +191,40 @@ P_CheckPosition int bx; int by; subsector_t* newsubsec; - tmthing = thing; tmflags = thing->flags; - tmx = x; tmy = y; - tmbbox[BOXTOP] = y + tmthing->radius; tmbbox[BOXBOTTOM] = y - tmthing->radius; tmbbox[BOXRIGHT] = x + tmthing->radius; tmbbox[BOXLEFT] = x - tmthing->radius; - newsubsec = R_PointInSubsector (x,y); ceilingline = NULL; - - - - - tmfloorz = tmdropoffz = newsubsec->sector->floorheight; tmceilingz = newsubsec->sector->ceilingheight; - validcount++; numspechit = 0; - if ( tmflags & MF_NOCLIP ) return true; - - - - - - xl = (tmbbox[BOXLEFT] - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT; xh = (tmbbox[BOXRIGHT] - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT; yl = (tmbbox[BOXBOTTOM] - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT; yh = (tmbbox[BOXTOP] - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT; - for (bx=xl ; bx<=xh ; bx++) for (by=yl ; by<=yh ; by++) if (!P_BlockThingsIterator(bx,by,PIT_CheckThing)) return false; - - xl = (tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT; xh = (tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT; yl = (tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT; yh = (tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT; - for (bx=xl ; bx<=xh ; bx++) for (by=yl ; by<=yh ; by++) if (!P_BlockLinesIterator (bx,by,PIT_CheckLine)) return false; - return true; } - - - - - - - boolean P_TryMove ( mobj_t* thing, @@ -456,50 +236,36 @@ P_TryMove int side; int oldside; line_t* ld; - floatok = false; if (!P_CheckPosition (thing, x, y)) return false; - if ( !(thing->flags & MF_NOCLIP) ) { if (tmceilingz - tmfloorz < thing->height) return false; - floatok = true; - if ( !(thing->flags&MF_TELEPORT) &&tmceilingz - thing->z < thing->height) return false; - if ( !(thing->flags&MF_TELEPORT) && tmfloorz - thing->z > 24*FRACUNIT ) return false; - if ( !(thing->flags&(MF_DROPOFF|MF_FLOAT)) && tmfloorz - tmdropoffz > 24*FRACUNIT ) return false; } - - - P_UnsetThingPosition (thing); - oldx = thing->x; oldy = thing->y; thing->floorz = tmfloorz; thing->ceilingz = tmceilingz; thing->x = x; thing->y = y; - P_SetThingPosition (thing); - - if (! (thing->flags&(MF_TELEPORT|MF_NOCLIP)) ) { while (numspechit--) { - ld = spechit[numspechit]; side = P_PointOnLineSide (thing->x, thing->y, ld); oldside = P_PointOnLineSide (oldx, oldy, ld); @@ -510,163 +276,90 @@ P_TryMove } } } - return true; } - - - - - - - - - - - - boolean P_ThingHeightClip (mobj_t* thing) { boolean onfloor; - onfloor = (thing->z == thing->floorz); - P_CheckPosition (thing, thing->x, thing->y); - - thing->floorz = tmfloorz; thing->ceilingz = tmceilingz; - if (onfloor) { - thing->z = thing->floorz; } else { - if (thing->z+thing->height > thing->ceilingz) thing->z = thing->ceilingz - thing->height; } - if (thing->ceilingz - thing->floorz < thing->height) return false; - return true; } - - - - - - - fixed_t bestslidefrac; fixed_t secondslidefrac; - line_t* bestslideline; line_t* secondslideline; - mobj_t* slidemo; - fixed_t tmxmove; fixed_t tmymove; - - - - - - - - void P_HitSlideLine (line_t* ld) { int side; - angle_t lineangle; angle_t moveangle; angle_t deltaangle; - fixed_t movelen; fixed_t newlen; - - if (ld->slopetype == ST_HORIZONTAL) { tmymove = 0; return; } - if (ld->slopetype == ST_VERTICAL) { tmxmove = 0; return; } - side = P_PointOnLineSide (slidemo->x, slidemo->y, ld); - lineangle = R_PointToAngle2 (0,0, ld->dx, ld->dy); - if (side == 1) lineangle += ANG180; - moveangle = R_PointToAngle2 (0,0, tmxmove, tmymove); deltaangle = moveangle-lineangle; - if (deltaangle > ANG180) deltaangle += ANG180; - - lineangle >>= ANGLETOFINESHIFT; deltaangle >>= ANGLETOFINESHIFT; - movelen = P_AproxDistance (tmxmove, tmymove); newlen = FixedMul (movelen, finecosine[deltaangle]); - tmxmove = FixedMul (newlen, finecosine[lineangle]); tmymove = FixedMul (newlen, finesine[lineangle]); } - - - - - boolean PTR_SlideTraverse (intercept_t* in) { line_t* li; - if (!in->isaline) I_Error ("PTR_SlideTraverse: not a line?"); - li = in->d.line; - if ( ! (li->flags & ML_TWOSIDED) ) { if (P_PointOnLineSide (slidemo->x, slidemo->y, li)) { - return true; } goto isblocking; } - - P_LineOpening (li); - if (openrange < slidemo->height) goto isblocking; - if (opentop - slidemo->z < slidemo->height) goto isblocking; - if (openbottom - slidemo->z > 24*FRACUNIT ) goto isblocking; - - return true; - - - isblocking: if (in->frac < bestslidefrac) { @@ -675,21 +368,8 @@ boolean PTR_SlideTraverse (intercept_t* in) bestslidefrac = in->frac; bestslideline = li; } - return false; } - - - - - - - - - - - - void P_SlideMove (mobj_t* mo) { fixed_t leadx; @@ -699,16 +379,11 @@ void P_SlideMove (mobj_t* mo) fixed_t newx; fixed_t newy; int hitcount; - slidemo = mo; hitcount = 0; - retry: if (++hitcount == 3) goto stairstep; - - - if (mo->momx > 0) { leadx = mo->x + mo->radius; @@ -719,7 +394,6 @@ void P_SlideMove (mobj_t* mo) leadx = mo->x - mo->radius; trailx = mo->x + mo->radius; } - if (mo->momy > 0) { leady = mo->y + mo->radius; @@ -730,86 +404,51 @@ void P_SlideMove (mobj_t* mo) leady = mo->y - mo->radius; traily = mo->y + mo->radius; } - bestslidefrac = FRACUNIT+1; - P_PathTraverse ( leadx, leady, leadx+mo->momx, leady+mo->momy, PT_ADDLINES, PTR_SlideTraverse ); P_PathTraverse ( trailx, leady, trailx+mo->momx, leady+mo->momy, PT_ADDLINES, PTR_SlideTraverse ); P_PathTraverse ( leadx, traily, leadx+mo->momx, traily+mo->momy, PT_ADDLINES, PTR_SlideTraverse ); - - if (bestslidefrac == FRACUNIT+1) { - stairstep: if (!P_TryMove (mo, mo->x, mo->y + mo->momy)) P_TryMove (mo, mo->x + mo->momx, mo->y); return; } - - bestslidefrac -= 0x800; if (bestslidefrac > 0) { newx = FixedMul (mo->momx, bestslidefrac); newy = FixedMul (mo->momy, bestslidefrac); - if (!P_TryMove (mo, mo->x+newx, mo->y+newy)) goto stairstep; } - - - bestslidefrac = FRACUNIT-(bestslidefrac+0x800); - if (bestslidefrac > FRACUNIT) bestslidefrac = FRACUNIT; - if (bestslidefrac <= 0) return; - tmxmove = FixedMul (mo->momx, bestslidefrac); tmymove = FixedMul (mo->momy, bestslidefrac); - P_HitSlideLine (bestslideline); - mo->momx = tmxmove; mo->momy = tmymove; - if (!P_TryMove (mo, mo->x+tmxmove, mo->y+tmymove)) { goto retry; } } - - - - - mobj_t* linetarget; mobj_t* shootthing; - - - fixed_t shootz; - int la_damage; fixed_t attackrange; - fixed_t aimslope; - - extern fixed_t topslope; extern fixed_t bottomslope; - - - - - - boolean PTR_AimTraverse (intercept_t* in) { @@ -819,204 +458,124 @@ PTR_AimTraverse (intercept_t* in) fixed_t thingtopslope; fixed_t thingbottomslope; fixed_t dist; - if (in->isaline) { li = in->d.line; - if ( !(li->flags & ML_TWOSIDED) ) return false; - - - - P_LineOpening (li); - if (openbottom >= opentop) return false; - dist = FixedMul (attackrange, in->frac); - if (li->frontsector->floorheight != li->backsector->floorheight) { slope = FixedDiv (openbottom - shootz , dist); if (slope > bottomslope) bottomslope = slope; } - if (li->frontsector->ceilingheight != li->backsector->ceilingheight) { slope = FixedDiv (opentop - shootz , dist); if (slope < topslope) topslope = slope; } - if (topslope <= bottomslope) return false; - return true; } - - th = in->d.thing; if (th == shootthing) return true; - if (!(th->flags&MF_SHOOTABLE)) return true; - - dist = FixedMul (attackrange, in->frac); thingtopslope = FixedDiv (th->z+th->height - shootz , dist); - if (thingtopslope < bottomslope) return true; - thingbottomslope = FixedDiv (th->z - shootz, dist); - if (thingbottomslope > topslope) return true; - - if (thingtopslope > topslope) thingtopslope = topslope; - if (thingbottomslope < bottomslope) thingbottomslope = bottomslope; - aimslope = (thingtopslope+thingbottomslope)/2; linetarget = th; - return false; } - - - - - boolean PTR_ShootTraverse (intercept_t* in) { fixed_t x; fixed_t y; fixed_t z; fixed_t frac; - line_t* li; - mobj_t* th; - fixed_t slope; fixed_t dist; fixed_t thingtopslope; fixed_t thingbottomslope; - if (in->isaline) { li = in->d.line; - if (li->special) P_ShootSpecialLine (shootthing, li); - if ( !(li->flags & ML_TWOSIDED) ) goto hitline; - - P_LineOpening (li); - dist = FixedMul (attackrange, in->frac); - if (li->frontsector->floorheight != li->backsector->floorheight) { slope = FixedDiv (openbottom - shootz , dist); if (slope > aimslope) goto hitline; } - if (li->frontsector->ceilingheight != li->backsector->ceilingheight) { slope = FixedDiv (opentop - shootz , dist); if (slope < aimslope) goto hitline; } - - return true; - - - hitline: - frac = in->frac - FixedDiv (4*FRACUNIT,attackrange); x = trace.x + FixedMul (trace.dx, frac); y = trace.y + FixedMul (trace.dy, frac); z = shootz + FixedMul (aimslope, FixedMul(frac, attackrange)); - if (li->frontsector->ceilingpic == skyflatnum) { - if (z > li->frontsector->ceilingheight) return false; - - if (li->backsector && li->backsector->ceilingpic == skyflatnum) return false; } - - P_SpawnPuff (x,y,z); - - return false; } - - th = in->d.thing; if (th == shootthing) return true; - if (!(th->flags&MF_SHOOTABLE)) return true; - - dist = FixedMul (attackrange, in->frac); thingtopslope = FixedDiv (th->z+th->height - shootz , dist); - if (thingtopslope < aimslope) return true; - thingbottomslope = FixedDiv (th->z - shootz, dist); - if (thingbottomslope > aimslope) return true; - - - - frac = in->frac - FixedDiv (10*FRACUNIT,attackrange); - x = trace.x + FixedMul (trace.dx, frac); y = trace.y + FixedMul (trace.dy, frac); z = shootz + FixedMul (aimslope, FixedMul(frac, attackrange)); - - - if (in->d.thing->flags & MF_NOBLOOD) P_SpawnPuff (x,y,z); else P_SpawnBlood (x,y,z, la_damage); - if (la_damage) P_DamageMobj (th, shootthing, shootthing, la_damage); - - return false; - } - - - - - fixed_t P_AimLineAttack ( mobj_t* t1, @@ -1025,38 +584,23 @@ P_AimLineAttack { fixed_t x2; fixed_t y2; - angle >>= ANGLETOFINESHIFT; shootthing = t1; - x2 = t1->x + (distance>>FRACBITS)*finecosine[angle]; y2 = t1->y + (distance>>FRACBITS)*finesine[angle]; shootz = t1->z + (t1->height>>1) + 8*FRACUNIT; - - topslope = 100*FRACUNIT/160; bottomslope = -100*FRACUNIT/160; - attackrange = distance; linetarget = NULL; - P_PathTraverse ( t1->x, t1->y, x2, y2, PT_ADDLINES|PT_ADDTHINGS, PTR_AimTraverse ); - if (linetarget) return aimslope; - return 0; } - - - - - - - void P_LineAttack ( mobj_t* t1, @@ -1067,7 +611,6 @@ P_LineAttack { fixed_t x2; fixed_t y2; - angle >>= ANGLETOFINESHIFT; shootthing = t1; la_damage = damage; @@ -1076,55 +619,31 @@ P_LineAttack shootz = t1->z + (t1->height>>1) + 8*FRACUNIT; attackrange = distance; aimslope = slope; - P_PathTraverse ( t1->x, t1->y, x2, y2, PT_ADDLINES|PT_ADDTHINGS, PTR_ShootTraverse ); } - - - - - - mobj_t* usething; - boolean PTR_UseTraverse (intercept_t* in) { int side; - if (!in->d.line->special) { P_LineOpening (in->d.line); if (openrange <= 0) { S_StartSound (usething, sfx_noway); - - return false; } - return true ; } - side = 0; if (P_PointOnLineSide (usething->x, usething->y, in->d.line) == 1) side = 1; - - - P_UseSpecialLine (usething, in->d.line, side); - - return false; } - - - - - - void P_UseLines (player_t* player) { int angle; @@ -1132,74 +651,41 @@ void P_UseLines (player_t* player) fixed_t y1; fixed_t x2; fixed_t y2; - usething = player->mo; - angle = player->mo->angle >> ANGLETOFINESHIFT; - x1 = player->mo->x; y1 = player->mo->y; x2 = x1 + (USERANGE>>FRACBITS)*finecosine[angle]; y2 = y1 + (USERANGE>>FRACBITS)*finesine[angle]; - P_PathTraverse ( x1, y1, x2, y2, PT_ADDLINES, PTR_UseTraverse ); } - - - - - mobj_t* bombsource; mobj_t* bombspot; int bombdamage; - - - - - - - boolean PIT_RadiusAttack (mobj_t* thing) { fixed_t dx; fixed_t dy; fixed_t dist; - if (!(thing->flags & MF_SHOOTABLE) ) return true; - - - if (thing->type == MT_CYBORG || thing->type == MT_SPIDER) return true; - dx = abs(thing->x - bombspot->x); dy = abs(thing->y - bombspot->y); - dist = dx>dy ? dx : dy; dist = (dist - thing->radius) >> FRACBITS; - if (dist < 0) dist = 0; - if (dist >= bombdamage) return true; - if ( P_CheckSight (thing, bombspot) ) { - P_DamageMobj (thing, bombspot, bombsource, bombdamage - dist); } - return true; } - - - - - - void P_RadiusAttack ( mobj_t* spot, @@ -1208,14 +694,11 @@ P_RadiusAttack { int x; int y; - int xl; int xh; int yl; int yh; - fixed_t dist; - dist = (damage+MAXRADIUS)<<FRACBITS; yh = (spot->y + dist - bmaporgy)>>MAPBLOCKSHIFT; yl = (spot->y - dist - bmaporgy)>>MAPBLOCKSHIFT; @@ -1224,97 +707,48 @@ P_RadiusAttack bombspot = spot; bombsource = source; bombdamage = damage; - for (y=yl ; y<=yh ; y++) for (x=xl ; x<=xh ; x++) P_BlockThingsIterator (x, y, PIT_RadiusAttack ); } - - - - - - - - - - - - - - - - boolean crushchange; boolean nofit; - - - - - boolean PIT_ChangeSector (mobj_t* thing) { mobj_t* mo; - if (P_ThingHeightClip (thing)) { - return true; } - - - if (thing->health <= 0) { P_SetMobjState (thing, S_GIBS); - thing->flags &= ~MF_SOLID; thing->height = 0; thing->radius = 0; - - return true; } - - if (thing->flags & MF_DROPPED) { P_RemoveMobj (thing); - - return true; } - if (! (thing->flags & MF_SHOOTABLE) ) { - return true; } - nofit = true; - if (crushchange && !(leveltime&3) ) { P_DamageMobj(thing,NULL,NULL,10); - - mo = P_SpawnMobj (thing->x, thing->y, thing->z + thing->height/2, MT_BLOOD); - mo->momx = (P_Random() - P_Random ())<<12; mo->momy = (P_Random() - P_Random ())<<12; } - - return true; } - - - - - - boolean P_ChangeSector ( sector_t* sector, @@ -1322,16 +756,10 @@ P_ChangeSector { int x; int y; - nofit = false; crushchange = crunch; - - for (x=sector->blockbox[BOXLEFT] ; x<= sector->blockbox[BOXRIGHT] ; x++) for (y=sector->blockbox[BOXBOTTOM];y<= sector->blockbox[BOXTOP] ; y++) P_BlockThingsIterator (x, y, PIT_ChangeSector); - - return nofit; } - diff --git a/src/p_maputl.c b/src/p_maputl.c @@ -1,48 +1,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - #include <stdlib.h> - - #include "m_bbox.h" - #include "doomdef.h" #include "p_local.h" - - - #include "r_state.h" - - - - - - fixed_t P_AproxDistance ( fixed_t dx, @@ -54,12 +14,6 @@ P_AproxDistance return dx+dy-(dx>>1); return dx+dy-(dy>>1); } - - - - - - int P_PointOnLineSide ( fixed_t x, @@ -70,40 +24,26 @@ P_PointOnLineSide fixed_t dy; fixed_t left; fixed_t right; - if (!line->dx) { if (x <= line->v1->x) return line->dy > 0; - return line->dy < 0; } if (!line->dy) { if (y <= line->v1->y) return line->dx < 0; - return line->dx > 0; } - dx = (x - line->v1->x); dy = (y - line->v1->y); - left = FixedMul ( line->dy>>FRACBITS , dx ); right = FixedMul ( dy , line->dx>>FRACBITS ); - if (right < left) return 0; return 1; } - - - - - - - - int P_BoxOnLineSide ( fixed_t* tmbox, @@ -111,7 +51,6 @@ P_BoxOnLineSide { int p1; int p2; - switch (ld->slopetype) { case ST_HORIZONTAL: @@ -123,7 +62,6 @@ P_BoxOnLineSide p2 ^= 1; } break; - case ST_VERTICAL: p1 = tmbox[BOXRIGHT] < ld->v1->x; p2 = tmbox[BOXLEFT] < ld->v1->x; @@ -133,28 +71,19 @@ P_BoxOnLineSide p2 ^= 1; } break; - case ST_POSITIVE: p1 = P_PointOnLineSide (tmbox[BOXLEFT], tmbox[BOXTOP], ld); p2 = P_PointOnLineSide (tmbox[BOXRIGHT], tmbox[BOXBOTTOM], ld); break; - case ST_NEGATIVE: p1 = P_PointOnLineSide (tmbox[BOXRIGHT], tmbox[BOXTOP], ld); p2 = P_PointOnLineSide (tmbox[BOXLEFT], tmbox[BOXBOTTOM], ld); break; } - if (p1 == p2) return p1; return -1; } - - - - - - int P_PointOnDivlineSide ( fixed_t x, @@ -165,46 +94,32 @@ P_PointOnDivlineSide fixed_t dy; fixed_t left; fixed_t right; - if (!line->dx) { if (x <= line->x) return line->dy > 0; - return line->dy < 0; } if (!line->dy) { if (y <= line->y) return line->dx < 0; - return line->dx > 0; } - dx = (x - line->x); dy = (y - line->y); - - if ( (line->dy ^ line->dx ^ dx ^ dy)&0x80000000 ) { if ( (line->dy ^ dx) & 0x80000000 ) return 1; return 0; } - left = FixedMul ( line->dy>>8, dx>>8 ); right = FixedMul ( dy>>8 , line->dx>>8 ); - if (right < left) return 0; return 1; } - - - - - - void P_MakeDivline ( line_t* li, @@ -215,16 +130,6 @@ P_MakeDivline dl->dx = li->dx; dl->dy = li->dy; } - - - - - - - - - - fixed_t P_InterceptVector ( divline_t* v2, @@ -234,19 +139,13 @@ P_InterceptVector fixed_t frac; fixed_t num; fixed_t den; - den = FixedMul (v1->dy>>8,v2->dx) - FixedMul(v1->dx>>8,v2->dy); - if (den == 0) return 0; - - num = FixedMul ( (v1->x - v2->x)>>8 ,v1->dy ) +FixedMul ( (v2->y - v1->y)>>8, v1->dx ); - frac = FixedDiv (num , den); - return frac; #else float frac; @@ -260,7 +159,6 @@ P_InterceptVector float v2y; float v2dx; float v2dy; - v1x = (float)v1->x/FRACUNIT; v1y = (float)v1->y/FRACUNIT; v1dx = (float)v1->dx/FRACUNIT; @@ -269,52 +167,33 @@ P_InterceptVector v2y = (float)v2->y/FRACUNIT; v2dx = (float)v2->dx/FRACUNIT; v2dy = (float)v2->dy/FRACUNIT; - den = v1dy*v2dx - v1dx*v2dy; - if (den == 0) return 0; - num = (v1x - v2x)*v1dy + (v2y - v1y)*v1dx; frac = num / den; - return frac*FRACUNIT; #endif } - - - - - - - - fixed_t opentop; fixed_t openbottom; fixed_t openrange; fixed_t lowfloor; - - void P_LineOpening (line_t* linedef) { sector_t* front; sector_t* back; - if (linedef->sidenum[1] == -1) { - openrange = 0; return; } - front = linedef->frontsector; back = linedef->backsector; - if (front->ceilingheight < back->ceilingheight) opentop = front->ceilingheight; else opentop = back->ceilingheight; - if (front->floorheight > back->floorheight) { openbottom = front->floorheight; @@ -325,55 +204,31 @@ void P_LineOpening (line_t* linedef) openbottom = back->floorheight; lowfloor = front->floorheight; } - openrange = opentop - openbottom; } - - - - - - - - - - - - - - void P_UnsetThingPosition (mobj_t* thing) { int blockx; int blocky; - if ( ! (thing->flags & MF_NOSECTOR) ) { - - if (thing->snext) thing->snext->sprev = thing->sprev; - if (thing->sprev) thing->sprev->snext = thing->snext; else thing->subsector->sector->thinglist = thing->snext; } - if ( ! (thing->flags & MF_NOBLOCKMAP) ) { - - if (thing->bnext) thing->bnext->bprev = thing->bprev; - if (thing->bprev) thing->bprev->bnext = thing->bnext; else { blockx = (thing->x - bmaporgx)>>MAPBLOCKSHIFT; blocky = (thing->y - bmaporgy)>>MAPBLOCKSHIFT; - if (blockx>=0 && blockx < bmapwidth && blocky>=0 && blocky <bmapheight) { @@ -382,14 +237,6 @@ void P_UnsetThingPosition (mobj_t* thing) } } } - - - - - - - - void P_SetThingPosition (mobj_t* thing) { @@ -398,34 +245,21 @@ P_SetThingPosition (mobj_t* thing) int blockx; int blocky; mobj_t** link; - - - ss = R_PointInSubsector (thing->x,thing->y); thing->subsector = ss; - if ( ! (thing->flags & MF_NOSECTOR) ) { - sec = ss->sector; - thing->sprev = NULL; thing->snext = sec->thinglist; - if (sec->thinglist) sec->thinglist->sprev = thing; - sec->thinglist = thing; } - - - if ( ! (thing->flags & MF_NOBLOCKMAP) ) { - blockx = (thing->x - bmaporgx)>>MAPBLOCKSHIFT; blocky = (thing->y - bmaporgy)>>MAPBLOCKSHIFT; - if (blockx>=0 && blockx < bmapwidth && blocky>=0 @@ -436,36 +270,14 @@ P_SetThingPosition (mobj_t* thing) thing->bnext = *link; if (*link) (*link)->bprev = thing; - *link = thing; } else { - thing->bnext = thing->bprev = NULL; } } } - - - - - - - - - - - - - - - - - - - - boolean P_BlockLinesIterator ( int x, @@ -475,7 +287,6 @@ P_BlockLinesIterator int offset; short* list; line_t* ld; - if (x<0 || y<0 || x>=bmapwidth @@ -483,30 +294,19 @@ P_BlockLinesIterator { return true; } - offset = y*bmapwidth+x; - offset = *(blockmap+offset); - for ( list = blockmaplump+offset ; *list != -1 ; list++) { ld = &lines[*list]; - if (ld->validcount == validcount) continue; - ld->validcount = validcount; - if ( !func(ld) ) return false; } return true; } - - - - - boolean P_BlockThingsIterator ( int x, @@ -514,7 +314,6 @@ P_BlockThingsIterator boolean(*func)(mobj_t*) ) { mobj_t* mobj; - if ( x<0 || y<0 || x>=bmapwidth @@ -522,8 +321,6 @@ P_BlockThingsIterator { return true; } - - for (mobj = blocklinks[y*bmapwidth+x] ; mobj ; mobj = mobj->bnext) @@ -533,29 +330,11 @@ P_BlockThingsIterator } return true; } - - - - - - intercept_t intercepts[MAXINTERCEPTS]; intercept_t* intercept_p; - divline_t trace; boolean earlyout; int ptflags; - - - - - - - - - - - boolean PIT_AddLineIntercepts (line_t* ld) { @@ -563,8 +342,6 @@ PIT_AddLineIntercepts (line_t* ld) int s2; fixed_t frac; divline_t dl; - - if ( trace.dx > FRACUNIT*16 || trace.dy > FRACUNIT*16 || trace.dx < -FRACUNIT*16 @@ -578,63 +355,40 @@ PIT_AddLineIntercepts (line_t* ld) s1 = P_PointOnLineSide (trace.x, trace.y, ld); s2 = P_PointOnLineSide (trace.x+trace.dx, trace.y+trace.dy, ld); } - if (s1 == s2) return true; - - P_MakeDivline (ld, &dl); frac = P_InterceptVector (&trace, &dl); - if (frac < 0) return true; - - if (earlyout && frac < FRACUNIT && !ld->backsector) { return false; } - - intercept_p->frac = frac; intercept_p->isaline = true; intercept_p->d.line = ld; intercept_p++; - return true; } - - - - - - boolean PIT_AddThingIntercepts (mobj_t* thing) { fixed_t x1; fixed_t y1; fixed_t x2; fixed_t y2; - int s1; int s2; - boolean tracepositive; - divline_t dl; - fixed_t frac; - tracepositive = (trace.dx ^ trace.dy)>0; - - if (tracepositive) { x1 = thing->x - thing->radius; y1 = thing->y + thing->radius; - x2 = thing->x + thing->radius; y2 = thing->y - thing->radius; } @@ -642,41 +396,26 @@ boolean PIT_AddThingIntercepts (mobj_t* thing) { x1 = thing->x - thing->radius; y1 = thing->y - thing->radius; - x2 = thing->x + thing->radius; y2 = thing->y + thing->radius; } - s1 = P_PointOnDivlineSide (x1, y1, &trace); s2 = P_PointOnDivlineSide (x2, y2, &trace); - if (s1 == s2) return true; - dl.x = x1; dl.y = y1; dl.dx = x2-x1; dl.dy = y2-y1; - frac = P_InterceptVector (&trace, &dl); - if (frac < 0) return true; - intercept_p->frac = frac; intercept_p->isaline = false; intercept_p->d.thing = thing; intercept_p++; - return true; } - - - - - - - boolean P_TraverseIntercepts ( traverser_t func, @@ -686,11 +425,8 @@ P_TraverseIntercepts fixed_t dist; intercept_t* scan; intercept_t* in; - count = intercept_p - intercepts; - in = 0; - while (count--) { dist = MAXINT; @@ -702,13 +438,10 @@ P_TraverseIntercepts in = scan; } } - if (dist > maxfrac) return true; - #if 0 { - in = scan = intercepts; for ( scan = intercepts ; scan<intercept_p ; scan++) if (scan->frac > maxfrac) @@ -717,26 +450,12 @@ P_TraverseIntercepts return false; } #endif - if ( !func (in) ) return false; - in->frac = MAXINT; } - return true; } - - - - - - - - - - - boolean P_PathTraverse ( fixed_t x1, @@ -750,49 +469,35 @@ P_PathTraverse fixed_t yt1; fixed_t xt2; fixed_t yt2; - fixed_t xstep; fixed_t ystep; - fixed_t partial; - fixed_t xintercept; fixed_t yintercept; - int mapx; int mapy; - int mapxstep; int mapystep; - int count; - earlyout = flags & PT_EARLYOUT; - validcount++; intercept_p = intercepts; - if ( ((x1-bmaporgx)&(MAPBLOCKSIZE-1)) == 0) x1 += FRACUNIT; - if ( ((y1-bmaporgy)&(MAPBLOCKSIZE-1)) == 0) y1 += FRACUNIT; - trace.x = x1; trace.y = y1; trace.dx = x2 - x1; trace.dy = y2 - y1; - x1 -= bmaporgx; y1 -= bmaporgy; xt1 = x1>>MAPBLOCKSHIFT; yt1 = y1>>MAPBLOCKSHIFT; - x2 -= bmaporgx; y2 -= bmaporgy; xt2 = x2>>MAPBLOCKSHIFT; yt2 = y2>>MAPBLOCKSHIFT; - if (xt2 > xt1) { mapxstep = 1; @@ -811,10 +516,7 @@ P_PathTraverse partial = FRACUNIT; ystep = 256*FRACUNIT; } - yintercept = (y1>>MAPBTOFRAC) + FixedMul (partial, ystep); - - if (yt2 > yt1) { mapystep = 1; @@ -834,13 +536,8 @@ P_PathTraverse xstep = 256*FRACUNIT; } xintercept = (x1>>MAPBTOFRAC) + FixedMul (partial, xstep); - - - - mapx = xt1; mapy = yt1; - for (count = 0 ; count < 64 ; count++) { if (flags & PT_ADDLINES) @@ -848,19 +545,16 @@ P_PathTraverse if (!P_BlockLinesIterator (mapx, mapy,PIT_AddLineIntercepts)) return false; } - if (flags & PT_ADDTHINGS) { if (!P_BlockThingsIterator (mapx, mapy,PIT_AddThingIntercepts)) return false; } - if (mapx == xt2 && mapy == yt2) { break; } - if ( (yintercept >> FRACBITS) == mapy) { yintercept += ystep; @@ -871,11 +565,6 @@ P_PathTraverse xintercept += xstep; mapy += mapystep; } - } - return P_TraverseIntercepts ( trav, FRACUNIT ); } - - - diff --git a/src/p_mobj.c b/src/p_mobj.c @@ -1,60 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - - - - #include "i_system.h" #include "z_zone.h" #include "m_random.h" - #include "doomdef.h" #include "p_local.h" #include "sounds.h" - #include "st_stuff.h" #include "hu_stuff.h" - #include "s_sound.h" - #include "doomstat.h" - - void G_PlayerReborn (int player); void P_SpawnMapThing (mapthing_t* mthing); - - - - - - int test; - boolean P_SetMobjState ( mobj_t* mobj, statenum_t state ) { state_t* st; - do { if (state == S_NULL) @@ -63,52 +25,30 @@ P_SetMobjState P_RemoveMobj (mobj); return false; } - st = &states[state]; mobj->state = st; mobj->tics = st->tics; mobj->sprite = st->sprite; mobj->frame = st->frame; - - - if (st->action.acp1) st->action.acp1(mobj); - state = st->nextstate; } while (!mobj->tics); - return true; } - - - - - void P_ExplodeMissile (mobj_t* mo) { mo->momx = mo->momy = mo->momz = 0; - P_SetMobjState (mo, mobjinfo[mo->type].deathstate); - mo->tics -= P_Random()&3; - if (mo->tics < 1) mo->tics = 1; - mo->flags &= ~MF_MISSILE; - if (mo->info->deathsound) S_StartSound (mo, mo->info->deathsound); } - - - - - #define STOPSPEED 0x1000 #define FRICTION 0xe800 - void P_XYMovement (mobj_t* mo) { fixed_t ptryx; @@ -116,35 +56,27 @@ void P_XYMovement (mobj_t* mo) player_t* player; fixed_t xmove; fixed_t ymove; - if (!mo->momx && !mo->momy) { if (mo->flags & MF_SKULLFLY) { - mo->flags &= ~MF_SKULLFLY; mo->momx = mo->momy = mo->momz = 0; - P_SetMobjState (mo, mo->info->spawnstate); } return; } - player = mo->player; - if (mo->momx > MAXMOVE) mo->momx = MAXMOVE; else if (mo->momx < -MAXMOVE) mo->momx = -MAXMOVE; - if (mo->momy > MAXMOVE) mo->momy = MAXMOVE; else if (mo->momy < -MAXMOVE) mo->momy = -MAXMOVE; - xmove = mo->momx; ymove = mo->momy; - do { if (xmove > MAXMOVE/2 || ymove > MAXMOVE/2) @@ -160,24 +92,18 @@ void P_XYMovement (mobj_t* mo) ptryy = mo->y + ymove; xmove = ymove = 0; } - if (!P_TryMove (mo, ptryx, ptryy)) { - if (mo->player) { P_SlideMove (mo); } else if (mo->flags & MF_MISSILE) { - if (ceilingline && ceilingline->backsector && ceilingline->backsector->ceilingpic == skyflatnum) { - - - P_RemoveMobj (mo); return; } @@ -187,25 +113,17 @@ void P_XYMovement (mobj_t* mo) mo->momx = mo->momy = 0; } } while (xmove || ymove); - - if (player && player->cheats & CF_NOMOMENTUM) { - mo->momx = mo->momy = 0; return; } - if (mo->flags & (MF_MISSILE | MF_SKULLFLY) ) return; - if (mo->z > mo->floorz) return; - if (mo->flags & MF_CORPSE) { - - if (mo->momx > FRACUNIT/4 || mo->momx < -FRACUNIT/4 || mo->momy > FRACUNIT/4 @@ -215,7 +133,6 @@ void P_XYMovement (mobj_t* mo) return; } } - if (mo->momx > -STOPSPEED && mo->momx < STOPSPEED && mo->momy > -STOPSPEED @@ -224,10 +141,8 @@ void P_XYMovement (mobj_t* mo) || (player->cmd.forwardmove== 0 && player->cmd.sidemove == 0 ) ) ) { - if ( player&&(unsigned)((player->mo->state - states)- S_PLAY_RUN1) < 4) P_SetMobjState (player->mo, S_PLAY); - mo->momx = 0; mo->momy = 0; } @@ -237,77 +152,49 @@ void P_XYMovement (mobj_t* mo) mo->momy = FixedMul (mo->momy, FRICTION); } } - - - - void P_ZMovement (mobj_t* mo) { fixed_t dist; fixed_t delta; - - if (mo->player && mo->z < mo->floorz) { mo->player->viewheight -= mo->floorz-mo->z; - mo->player->deltaviewheight = (VIEWHEIGHT - mo->player->viewheight)>>3; } - - mo->z += mo->momz; - if ( mo->flags & MF_FLOAT && mo->target) { - if ( !(mo->flags & MF_SKULLFLY) && !(mo->flags & MF_INFLOAT) ) { dist = P_AproxDistance (mo->x - mo->target->x, mo->y - mo->target->y); - delta =(mo->target->z + (mo->height>>1)) - mo->z; - if (delta<0 && dist < -(delta*3) ) mo->z -= FLOATSPEED; else if (delta>0 && dist < (delta*3) ) mo->z += FLOATSPEED; } - } - - if (mo->z <= mo->floorz) { - - - - - if (mo->flags & MF_SKULLFLY) { - mo->momz = -mo->momz; } - if (mo->momz < 0) { if (mo->player && mo->momz < -GRAVITY*8) { - - - - mo->player->deltaviewheight = mo->momz>>3; S_StartSound (mo, sfx_oof); } mo->momz = 0; } mo->z = mo->floorz; - if ( (mo->flags & MF_MISSILE) && !(mo->flags & MF_NOCLIP) ) { @@ -322,21 +209,17 @@ void P_ZMovement (mobj_t* mo) else mo->momz -= GRAVITY; } - if (mo->z + mo->height > mo->ceilingz) { - if (mo->momz > 0) mo->momz = 0; { mo->z = mo->ceilingz - mo->height; } - if (mo->flags & MF_SKULLFLY) { mo->momz = -mo->momz; } - if ( (mo->flags & MF_MISSILE) && !(mo->flags & MF_NOCLIP) ) { @@ -345,12 +228,6 @@ void P_ZMovement (mobj_t* mo) } } } - - - - - - void P_NightmareRespawn (mobj_t* mobj) { @@ -360,66 +237,37 @@ P_NightmareRespawn (mobj_t* mobj) subsector_t* ss; mobj_t* mo; mapthing_t* mthing; - x = mobj->spawnpoint.x << FRACBITS; y = mobj->spawnpoint.y << FRACBITS; - - if (!P_CheckPosition (mobj, x, y) ) return; - - - mo = P_SpawnMobj (mobj->x, mobj->y, mobj->subsector->sector->floorheight , MT_TFOG); - S_StartSound (mo, sfx_telept); - - ss = R_PointInSubsector (x,y); - mo = P_SpawnMobj (x, y, ss->sector->floorheight , MT_TFOG); - S_StartSound (mo, sfx_telept); - - mthing = &mobj->spawnpoint; - - if (mobj->info->flags & MF_SPAWNCEILING) z = ONCEILINGZ; else z = ONFLOORZ; - - mo = P_SpawnMobj (x,y,z, mobj->type); mo->spawnpoint = mobj->spawnpoint; mo->angle = ANG45 * (mthing->angle/45); - if (mthing->options & MTF_AMBUSH) mo->flags |= MF_AMBUSH; - mo->reactiontime = 18; - - P_RemoveMobj (mobj); } - - - - - void P_MobjThinker (mobj_t* mobj) { - if (mobj->momx || mobj->momy || (mobj->flags&MF_SKULLFLY) ) { P_XYMovement (mobj); - - if (mobj->thinker.function.acv == (actionf_v) (-1)) return; } @@ -427,53 +275,32 @@ void P_MobjThinker (mobj_t* mobj) || mobj->momz ) { P_ZMovement (mobj); - - if (mobj->thinker.function.acv == (actionf_v) (-1)) return; } - - - - if (mobj->tics != -1) { mobj->tics--; - - if (!mobj->tics) if (!P_SetMobjState (mobj, mobj->state->nextstate) ) return; } else { - if (! (mobj->flags & MF_COUNTKILL) ) return; - if (!respawnmonsters) return; - mobj->movecount++; - if (mobj->movecount < 12*35) return; - if ( leveltime&31 ) return; - if (P_Random () > 4) return; - P_NightmareRespawn (mobj); } - } - - - - - mobj_t* P_SpawnMobj ( fixed_t x, @@ -484,11 +311,9 @@ P_SpawnMobj mobj_t* mobj; state_t* st; mobjinfo_t* info; - mobj = Z_Malloc (sizeof(*mobj), PU_LEVEL, NULL); memset (mobj, 0, sizeof (*mobj)); info = &mobjinfo[type]; - mobj->type = type; mobj->info = info; mobj->x = x; @@ -497,50 +322,31 @@ P_SpawnMobj mobj->height = info->height; mobj->flags = info->flags; mobj->health = info->spawnhealth; - if (gameskill != sk_nightmare) mobj->reactiontime = info->reactiontime; - mobj->lastlook = P_Random () % MAXPLAYERS; - - st = &states[info->spawnstate]; - mobj->state = st; mobj->tics = st->tics; mobj->sprite = st->sprite; mobj->frame = st->frame; - - P_SetThingPosition (mobj); - mobj->floorz = mobj->subsector->sector->floorheight; mobj->ceilingz = mobj->subsector->sector->ceilingheight; - if (z == ONFLOORZ) mobj->z = mobj->floorz; else if (z == ONCEILINGZ) mobj->z = mobj->ceilingz - mobj->info->height; else mobj->z = z; - mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker; - P_AddThinker (&mobj->thinker); - return mobj; } - - - - - mapthing_t itemrespawnque[ITEMQUESIZE]; int itemrespawntime[ITEMQUESIZE]; int iquehead; int iquetail; - - void P_RemoveMobj (mobj_t* mobj) { if ((mobj->flags & MF_SPECIAL) @@ -551,125 +357,70 @@ void P_RemoveMobj (mobj_t* mobj) itemrespawnque[iquehead] = mobj->spawnpoint; itemrespawntime[iquehead] = leveltime; iquehead = (iquehead+1)&(ITEMQUESIZE-1); - - if (iquehead == iquetail) iquetail = (iquetail+1)&(ITEMQUESIZE-1); } - - P_UnsetThingPosition (mobj); - - S_StopSound (mobj); - - P_RemoveThinker ((thinker_t*)mobj); } - - - - - - - void P_RespawnSpecials (void) { fixed_t x; fixed_t y; fixed_t z; - subsector_t* ss; mobj_t* mo; mapthing_t* mthing; - int i; - - if (deathmatch != 2) return; - - if (iquehead == iquetail) return; - - if (leveltime - itemrespawntime[iquetail] < 30*35) return; - mthing = &itemrespawnque[iquetail]; - x = mthing->x << FRACBITS; y = mthing->y << FRACBITS; - - ss = R_PointInSubsector (x,y); mo = P_SpawnMobj (x, y, ss->sector->floorheight , MT_IFOG); S_StartSound (mo, sfx_itmbk); - - for (i=0 ; i< NUMMOBJTYPES ; i++) { if (mthing->type == mobjinfo[i].doomednum) break; } - - if (mobjinfo[i].flags & MF_SPAWNCEILING) z = ONCEILINGZ; else z = ONFLOORZ; - mo = P_SpawnMobj (x,y,z, i); mo->spawnpoint = *mthing; mo->angle = ANG45 * (mthing->angle/45); - - iquetail = (iquetail+1)&(ITEMQUESIZE-1); } - - - - - - - - - - void P_SpawnPlayer (mapthing_t* mthing) { player_t* p; fixed_t x; fixed_t y; fixed_t z; - mobj_t* mobj; - int i; - - if (!playeringame[mthing->type-1]) return; - p = &players[mthing->type-1]; - if (p->playerstate == PST_REBORN) G_PlayerReborn (mthing->type-1); - x = mthing->x << FRACBITS; y = mthing->y << FRACBITS; z = ONFLOORZ; mobj = P_SpawnMobj (x,y,z, MT_PLAYER); - - if (mthing->type > 1) mobj->flags |= (mthing->type-1)<<MF_TRANSSHIFT; - mobj->angle = ANG45 * (mthing->angle/45); mobj->player = p; mobj->health = p->health; - p->mo = mobj; p->playerstate = PST_LIVE; p->refire = 0; @@ -679,30 +430,16 @@ void P_SpawnPlayer (mapthing_t* mthing) p->extralight = 0; p->fixedcolormap = 0; p->viewheight = VIEWHEIGHT; - - P_SetupPsprites (p); - - if (deathmatch) for (i=0 ; i<NUMCARDS ; i++) p->cards[i] = true; - if (mthing->type-1 == consoleplayer) { - ST_Start (); - HU_Start (); } } - - - - - - - void P_SpawnMapThing (mapthing_t* mthing) { int i; @@ -711,8 +448,6 @@ void P_SpawnMapThing (mapthing_t* mthing) fixed_t x; fixed_t y; fixed_t z; - - if (mthing->type == 11) { if (deathmatch_p < &deathmatchstarts[10]) @@ -722,90 +457,57 @@ void P_SpawnMapThing (mapthing_t* mthing) } return; } - - if (mthing->type <= 4) { - playerstarts[mthing->type-1] = *mthing; if (!deathmatch) P_SpawnPlayer (mthing); - return; } - - if (!netgame && (mthing->options & 16) ) return; - if (gameskill == sk_baby) bit = 1; else if (gameskill == sk_nightmare) bit = 4; else bit = 1<<(gameskill-1); - if (!(mthing->options & bit) ) return; - - for (i=0 ; i< NUMMOBJTYPES ; i++) if (mthing->type == mobjinfo[i].doomednum) break; - if (i==NUMMOBJTYPES) I_Error ("P_SpawnMapThing: Unknown type %i at (%i, %i)", mthing->type, mthing->x, mthing->y); - - if (deathmatch && mobjinfo[i].flags & MF_NOTDMATCH) return; - - if (nomonsters && ( i == MT_SKULL || (mobjinfo[i].flags & MF_COUNTKILL)) ) { return; } - - x = mthing->x << FRACBITS; y = mthing->y << FRACBITS; - if (mobjinfo[i].flags & MF_SPAWNCEILING) z = ONCEILINGZ; else z = ONFLOORZ; - mobj = P_SpawnMobj (x,y,z, i); mobj->spawnpoint = *mthing; - if (mobj->tics > 0) mobj->tics = 1 + (P_Random () % mobj->tics); if (mobj->flags & MF_COUNTKILL) totalkills++; if (mobj->flags & MF_COUNTITEM) totalitems++; - mobj->angle = ANG45 * (mthing->angle/45); if (mthing->options & MTF_AMBUSH) mobj->flags |= MF_AMBUSH; } - - - - - - - - - - - extern fixed_t attackrange; - void P_SpawnPuff ( fixed_t x, @@ -813,26 +515,15 @@ P_SpawnPuff fixed_t z ) { mobj_t* th; - z += ((P_Random()-P_Random())<<10); - th = P_SpawnMobj (x,y,z, MT_PUFF); th->momz = FRACUNIT; th->tics -= P_Random()&3; - if (th->tics < 1) th->tics = 1; - - if (attackrange == MELEERANGE) P_SetMobjState (th, S_PUFF3); } - - - - - - void P_SpawnBlood ( fixed_t x, @@ -841,48 +532,28 @@ P_SpawnBlood int damage ) { mobj_t* th; - z += ((P_Random()-P_Random())<<10); th = P_SpawnMobj (x,y,z, MT_BLOOD); th->momz = FRACUNIT*2; th->tics -= P_Random()&3; - if (th->tics < 1) th->tics = 1; - if (damage <= 12 && damage >= 9) P_SetMobjState (th,S_BLOOD2); else if (damage < 9) P_SetMobjState (th,S_BLOOD3); } - - - - - - - - void P_CheckMissileSpawn (mobj_t* th) { th->tics -= P_Random()&3; if (th->tics < 1) th->tics = 1; - - - th->x += (th->momx>>1); th->y += (th->momy>>1); th->z += (th->momz>>1); - if (!P_TryMove (th, th->x, th->y)) P_ExplodeMissile (th); } - - - - - mobj_t* P_SpawnMissile ( mobj_t* source, @@ -892,43 +563,27 @@ P_SpawnMissile mobj_t* th; angle_t an; int dist; - th = P_SpawnMobj (source->x, source->y, source->z + 4*8*FRACUNIT, type); - if (th->info->seesound) S_StartSound (th, th->info->seesound); - th->target = source; an = R_PointToAngle2 (source->x, source->y, dest->x, dest->y); - - if (dest->flags & MF_SHADOW) an += (P_Random()-P_Random())<<20; - th->angle = an; an >>= ANGLETOFINESHIFT; th->momx = FixedMul (th->info->speed, finecosine[an]); th->momy = FixedMul (th->info->speed, finesine[an]); - dist = P_AproxDistance (dest->x - source->x, dest->y - source->y); dist = dist / th->info->speed; - if (dist < 1) dist = 1; - th->momz = (dest->z - source->z) / dist; P_CheckMissileSpawn (th); - return th; } - - - - - - void P_SpawnPlayerMissile ( mobj_t* source, @@ -936,43 +591,33 @@ P_SpawnPlayerMissile { mobj_t* th; angle_t an; - fixed_t x; fixed_t y; fixed_t z; fixed_t slope; - - an = source->angle; slope = P_AimLineAttack (source, an, 16*64*FRACUNIT); - if (!linetarget) { an += 1<<26; slope = P_AimLineAttack (source, an, 16*64*FRACUNIT); - if (!linetarget) { an -= 2<<26; slope = P_AimLineAttack (source, an, 16*64*FRACUNIT); } - if (!linetarget) { an = source->angle; slope = 0; } } - x = source->x; y = source->y; z = source->z + 4*8*FRACUNIT; - th = P_SpawnMobj (x,y,z, type); - if (th->info->seesound) S_StartSound (th, th->info->seesound); - th->target = source; th->angle = an; th->momx = FixedMul( th->info->speed, @@ -980,7 +625,5 @@ P_SpawnPlayerMissile th->momy = FixedMul( th->info->speed, finesine[an>>ANGLETOFINESHIFT]); th->momz = FixedMul( th->info->speed, slope); - P_CheckMissileSpawn (th); } - diff --git a/src/p_mobj.h b/src/p_mobj.h @@ -1,295 +1,80 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __P_MOBJ__ #define __P_MOBJ__ - - #include "tables.h" #include "m_fixed.h" - - #include "d_think.h" - - - #include "doomdata.h" - - - - #include "info.h" - - - #ifdef __GNUG__ #pragma interface #endif - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - typedef enum { - MF_SPECIAL = 1, - MF_SOLID = 2, - MF_SHOOTABLE = 4, - MF_NOSECTOR = 8, - MF_NOBLOCKMAP = 16, - - MF_AMBUSH = 32, - MF_JUSTHIT = 64, - MF_JUSTATTACKED = 128, - - MF_SPAWNCEILING = 256, - - - MF_NOGRAVITY = 512, - - - MF_DROPOFF = 0x400, - MF_PICKUP = 0x800, - MF_NOCLIP = 0x1000, - MF_SLIDE = 0x2000, - - MF_FLOAT = 0x4000, - - MF_TELEPORT = 0x8000, - - MF_MISSILE = 0x10000, - - MF_DROPPED = 0x20000, - - MF_SHADOW = 0x40000, - - MF_NOBLOOD = 0x80000, - - MF_CORPSE = 0x100000, - - MF_INFLOAT = 0x200000, - - - - MF_COUNTKILL = 0x400000, - - - MF_COUNTITEM = 0x800000, - - - MF_SKULLFLY = 0x1000000, - - - MF_NOTDMATCH = 0x2000000, - - - - - MF_TRANSLATION = 0xc000000, - MF_TRANSSHIFT = 26 - } mobjflag_t; - - - typedef struct mobj_s { - thinker_t thinker; - - fixed_t x; fixed_t y; fixed_t z; - - struct mobj_s* snext; struct mobj_s* sprev; - - angle_t angle; spritenum_t sprite; int frame; - - - struct mobj_s* bnext; struct mobj_s* bprev; - struct subsector_s* subsector; - - fixed_t floorz; fixed_t ceilingz; - - fixed_t radius; fixed_t height; - - fixed_t momx; fixed_t momy; fixed_t momz; - - int validcount; - mobjtype_t type; mobjinfo_t* info; - int tics; state_t* state; int flags; int health; - - int movedir; int movecount; - - - struct mobj_s* target; - - - int reactiontime; - - - int threshold; - - - struct player_s* player; - - int lastlook; - - mapthing_t spawnpoint; - - struct mobj_s* tracer; - } mobj_t; - - - #endif - - - - - diff --git a/src/p_plats.c b/src/p_plats.c @@ -1,56 +1,16 @@ - - - - - - - - - - - - - - - - - - - - - - - - - #include "i_system.h" #include "z_zone.h" #include "m_random.h" - #include "doomdef.h" #include "p_local.h" - #include "s_sound.h" - - #include "doomstat.h" #include "r_state.h" - - #include "sounds.h" - - plat_t* activeplats[MAXPLATS]; - - - - - - void T_PlatRaise(plat_t* plat) { result_e res; - switch(plat->status) { case up: @@ -58,7 +18,6 @@ void T_PlatRaise(plat_t* plat) plat->speed, plat->high, plat->crush,0,1); - if (plat->type == raiseAndChange || plat->type == raiseToNearestAndChange) { @@ -66,8 +25,6 @@ void T_PlatRaise(plat_t* plat) S_StartSound((mobj_t *)&plat->sector->soundorg, sfx_stnmov); } - - if (res == crushed && (!plat->crush)) { plat->count = plat->wait; @@ -83,29 +40,24 @@ void T_PlatRaise(plat_t* plat) plat->status = waiting; S_StartSound((mobj_t *)&plat->sector->soundorg, sfx_pstop); - switch(plat->type) { case blazeDWUS: case downWaitUpStay: P_RemoveActivePlat(plat); break; - case raiseAndChange: case raiseToNearestAndChange: P_RemoveActivePlat(plat); break; - default: break; } } } break; - case down: res = T_MovePlane(plat->sector,plat->speed,plat->low,false,0,-1); - if (res == pastdest) { plat->count = plat->wait; @@ -113,7 +65,6 @@ void T_PlatRaise(plat_t* plat) S_StartSound((mobj_t *)&plat->sector->soundorg,sfx_pstop); } break; - case waiting: if (!--plat->count) { @@ -127,12 +78,6 @@ void T_PlatRaise(plat_t* plat) break; } } - - - - - - int EV_DoPlat ( line_t* line, @@ -143,41 +88,30 @@ EV_DoPlat int secnum; int rtn; sector_t* sec; - secnum = -1; rtn = 0; - - - switch(type) { case perpetualRaise: P_ActivateInStasis(line->tag); break; - default: break; } - while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0) { sec = &sectors[secnum]; - if (sec->specialdata) continue; - - rtn = 1; plat = Z_Malloc( sizeof(*plat), PU_LEVSPEC, 0); P_AddThinker(&plat->thinker); - plat->type = type; plat->sector = sec; plat->sector->specialdata = plat; plat->thinker.function.acp1 = (actionf_p1) T_PlatRaise; plat->crush = false; plat->tag = line->tag; - switch(type) { case raiseToNearestAndChange: @@ -186,63 +120,47 @@ EV_DoPlat plat->high = P_FindNextHighestFloor(sec,sec->floorheight); plat->wait = 0; plat->status = up; - sec->special = 0; - S_StartSound((mobj_t *)&sec->soundorg,sfx_stnmov); break; - case raiseAndChange: plat->speed = PLATSPEED/2; sec->floorpic = sides[line->sidenum[0]].sector->floorpic; plat->high = sec->floorheight + amount*FRACUNIT; plat->wait = 0; plat->status = up; - S_StartSound((mobj_t *)&sec->soundorg,sfx_stnmov); break; - case downWaitUpStay: plat->speed = PLATSPEED * 4; plat->low = P_FindLowestFloorSurrounding(sec); - if (plat->low > sec->floorheight) plat->low = sec->floorheight; - plat->high = sec->floorheight; plat->wait = 35*PLATWAIT; plat->status = down; S_StartSound((mobj_t *)&sec->soundorg,sfx_pstart); break; - case blazeDWUS: plat->speed = PLATSPEED * 8; plat->low = P_FindLowestFloorSurrounding(sec); - if (plat->low > sec->floorheight) plat->low = sec->floorheight; - plat->high = sec->floorheight; plat->wait = 35*PLATWAIT; plat->status = down; S_StartSound((mobj_t *)&sec->soundorg,sfx_pstart); break; - case perpetualRaise: plat->speed = PLATSPEED; plat->low = P_FindLowestFloorSurrounding(sec); - if (plat->low > sec->floorheight) plat->low = sec->floorheight; - plat->high = P_FindHighestFloorSurrounding(sec); - if (plat->high < sec->floorheight) plat->high = sec->floorheight; - plat->wait = 35*PLATWAIT; plat->status = P_Random()&1; - S_StartSound((mobj_t *)&sec->soundorg,sfx_pstart); break; } @@ -250,13 +168,9 @@ EV_DoPlat } return rtn; } - - - void P_ActivateInStasis(int tag) { int i; - for (i = 0;i < MAXPLATS;i++) if (activeplats[i] && (activeplats[i])->tag == tag @@ -267,11 +181,9 @@ void P_ActivateInStasis(int tag) = (actionf_p1) T_PlatRaise; } } - void EV_StopPlat(line_t* line) { int j; - for (j = 0;j < MAXPLATS;j++) if (activeplats[j] && ((activeplats[j])->status != in_stasis) @@ -282,11 +194,9 @@ void EV_StopPlat(line_t* line) (activeplats[j])->thinker.function.acv = (actionf_v)NULL; } } - void P_AddActivePlat(plat_t* plat) { int i; - for (i = 0;i < MAXPLATS;i++) if (activeplats[i] == NULL) { @@ -295,7 +205,6 @@ void P_AddActivePlat(plat_t* plat) } I_Error ("P_AddActivePlat: no more plats!"); } - void P_RemoveActivePlat(plat_t* plat) { int i; @@ -305,7 +214,6 @@ void P_RemoveActivePlat(plat_t* plat) (activeplats[i])->sector->specialdata = NULL; P_RemoveThinker(&(activeplats[i])->thinker); activeplats[i] = NULL; - return; } I_Error ("P_RemoveActivePlat: can't find plat!"); diff --git a/src/p_pspr.c b/src/p_pspr.c @@ -1,58 +1,16 @@ - - - - - - - - - - - - - - - - - - - - - - - - - #include "doomdef.h" #include "d_event.h" - - #include "m_random.h" #include "p_local.h" #include "s_sound.h" - - #include "doomstat.h" - - #include "sounds.h" - #include "p_pspr.h" - #define LOWERSPEED FRACUNIT*6 #define RAISESPEED FRACUNIT*6 - #define WEAPONBOTTOM 128*FRACUNIT #define WEAPONTOP 32*FRACUNIT - - - #define BFGCELLS 40 - - - - - void P_SetPsprite ( player_t* player, @@ -61,123 +19,68 @@ P_SetPsprite { pspdef_t* psp; state_t* state; - psp = &player->psprites[position]; - do { if (!stnum) { - psp->state = NULL; break; } - state = &states[stnum]; psp->state = state; psp->tics = state->tics; - if (state->misc1) { - psp->sx = state->misc1 << FRACBITS; psp->sy = state->misc2 << FRACBITS; } - - - if (state->action.acp2) { state->action.acp2(player, psp); if (!psp->state) break; } - stnum = psp->state->nextstate; - } while (!psp->tics); - } - - - - - - fixed_t swingx; fixed_t swingy; - void P_CalcSwing (player_t* player) { fixed_t swing; int angle; - - - - - swing = player->bob; - angle = (FINEANGLES/70*leveltime)&FINEMASK; swingx = FixedMul ( swing, finesine[angle]); - angle = (FINEANGLES/70*leveltime+FINEANGLES/2)&FINEMASK; swingy = -FixedMul ( swingx, finesine[angle]); } - - - - - - - - - void P_BringUpWeapon (player_t* player) { statenum_t newstate; - if (player->pendingweapon == wp_nochange) player->pendingweapon = player->readyweapon; - if (player->pendingweapon == wp_chainsaw) S_StartSound (player->mo, sfx_sawup); - newstate = weaponinfo[player->pendingweapon].upstate; - player->pendingweapon = wp_nochange; player->psprites[ps_weapon].sy = WEAPONBOTTOM; - P_SetPsprite (player, ps_weapon, newstate); } - - - - - - boolean P_CheckAmmo (player_t* player) { ammotype_t ammo; int count; - ammo = weaponinfo[player->readyweapon].ammo; - - if (player->readyweapon == wp_bfg) count = BFGCELLS; else if (player->readyweapon == wp_supershotgun) count = 2; else count = 1; - - - if (ammo == am_noammo || player->ammo[ammo] >= count) return true; - - - do { if (player->weaponowned[wp_plasma] @@ -223,59 +126,30 @@ boolean P_CheckAmmo (player_t* player) } else { - player->pendingweapon = wp_fist; } - } while (player->pendingweapon == wp_nochange); - - P_SetPsprite (player, ps_weapon, weaponinfo[player->readyweapon].downstate); - return false; } - - - - - void P_FireWeapon (player_t* player) { statenum_t newstate; - if (!P_CheckAmmo (player)) return; - P_SetMobjState (player->mo, S_PLAY_ATK1); newstate = weaponinfo[player->readyweapon].atkstate; P_SetPsprite (player, ps_weapon, newstate); P_NoiseAlert (player->mo, player->mo); } - - - - - - - void P_DropWeapon (player_t* player) { P_SetPsprite (player, ps_weapon, weaponinfo[player->readyweapon].downstate); } - - - - - - - - - - void A_WeaponReady ( player_t* player, @@ -283,33 +157,22 @@ A_WeaponReady { statenum_t newstate; int angle; - - if (player->mo->state == &states[S_PLAY_ATK1] || player->mo->state == &states[S_PLAY_ATK2] ) { P_SetMobjState (player->mo, S_PLAY); } - if (player->readyweapon == wp_chainsaw && psp->state == &states[S_SAW]) { S_StartSound (player->mo, sfx_sawidl); } - - - if (player->pendingweapon != wp_nochange || !player->health) { - - newstate = weaponinfo[player->readyweapon].downstate; P_SetPsprite (player, ps_weapon, newstate); return; } - - - if (player->cmd.buttons & BT_ATTACK) { if ( !player->attackdown @@ -323,28 +186,15 @@ A_WeaponReady } else player->attackdown = false; - - angle = (128*leveltime)&FINEMASK; psp->sx = FRACUNIT + FixedMul (player->bob, finecosine[angle]); angle &= FINEANGLES/2-1; psp->sy = WEAPONTOP + FixedMul (player->bob, finesine[angle]); } - - - - - - - - void A_ReFire ( player_t* player, pspdef_t* psp ) { - - - if ( (player->cmd.buttons & BT_ATTACK) && player->pendingweapon == wp_nochange && player->health) @@ -358,8 +208,6 @@ void A_ReFire P_CheckAmmo (player); } } - - void A_CheckReload ( player_t* player, @@ -371,78 +219,40 @@ A_CheckReload P_SetPsprite (player, ps_weapon, S_DSNR1); #endif } - - - - - - - - void A_Lower ( player_t* player, pspdef_t* psp ) { psp->sy += LOWERSPEED; - - if (psp->sy < WEAPONBOTTOM ) return; - - if (player->playerstate == PST_DEAD) { psp->sy = WEAPONBOTTOM; - - return; } - - - if (!player->health) { - P_SetPsprite (player, ps_weapon, S_NULL); return; } - player->readyweapon = player->pendingweapon; - P_BringUpWeapon (player); } - - - - - void A_Raise ( player_t* player, pspdef_t* psp ) { statenum_t newstate; - psp->sy -= RAISESPEED; - if (psp->sy > WEAPONTOP ) return; - psp->sy = WEAPONTOP; - - - newstate = weaponinfo[player->readyweapon].readystate; - P_SetPsprite (player, ps_weapon, newstate); } - - - - - - void A_GunFlash ( player_t* player, @@ -451,17 +261,6 @@ A_GunFlash P_SetMobjState (player->mo, S_PLAY_ATK2); P_SetPsprite (player,ps_flash,weaponinfo[player->readyweapon].flashstate); } - - - - - - - - - - - void A_Punch ( player_t* player, @@ -470,18 +269,13 @@ A_Punch angle_t angle; int damage; int slope; - damage = (P_Random ()%10+1)<<1; - if (player->powers[pw_strength]) damage *= 10; - angle = player->mo->angle; angle += (P_Random()-P_Random())<<18; slope = P_AimLineAttack (player->mo, angle, MELEERANGE); P_LineAttack (player->mo, angle, MELEERANGE, slope, damage); - - if (linetarget) { S_StartSound (player->mo, sfx_punch); @@ -491,11 +285,6 @@ A_Punch linetarget->y); } } - - - - - void A_Saw ( player_t* player, @@ -504,23 +293,17 @@ A_Saw angle_t angle; int damage; int slope; - damage = 2*(P_Random ()%10+1); angle = player->mo->angle; angle += (P_Random()-P_Random())<<18; - - slope = P_AimLineAttack (player->mo, angle, MELEERANGE+1); P_LineAttack (player->mo, angle, MELEERANGE+1, slope, damage); - if (!linetarget) { S_StartSound (player->mo, sfx_sawful); return; } S_StartSound (player->mo, sfx_sawhit); - - angle = R_PointToAngle2 (player->mo->x, player->mo->y, linetarget->x, linetarget->y); if (angle - player->mo->angle > ANG180) @@ -539,12 +322,6 @@ A_Saw } player->mo->flags |= MF_JUSTATTACKED; } - - - - - - void A_FireMissile ( player_t* player, @@ -553,11 +330,6 @@ A_FireMissile player->ammo[weaponinfo[player->readyweapon].ammo]--; P_SpawnPlayerMissile (player->mo, MT_ROCKET); } - - - - - void A_FireBFG ( player_t* player, @@ -566,44 +338,23 @@ A_FireBFG player->ammo[weaponinfo[player->readyweapon].ammo] -= BFGCELLS; P_SpawnPlayerMissile (player->mo, MT_BFG); } - - - - - - void A_FirePlasma ( player_t* player, pspdef_t* psp ) { player->ammo[weaponinfo[player->readyweapon].ammo]--; - P_SetPsprite (player, ps_flash, weaponinfo[player->readyweapon].flashstate+(P_Random ()&1) ); - P_SpawnPlayerMissile (player->mo, MT_PLASMA); } - - - - - - - - fixed_t bulletslope; - - void P_BulletSlope (mobj_t* mo) { angle_t an; - - an = mo->angle; bulletslope = P_AimLineAttack (mo, an, 16*64*FRACUNIT); - if (!linetarget) { an += 1<<26; @@ -615,11 +366,6 @@ void P_BulletSlope (mobj_t* mo) } } } - - - - - void P_GunShot ( mobj_t* mo, @@ -627,69 +373,42 @@ P_GunShot { angle_t angle; int damage; - damage = 5*(P_Random ()%3+1); angle = mo->angle; - if (!accurate) angle += (P_Random()-P_Random())<<18; - P_LineAttack (mo, angle, MISSILERANGE, bulletslope, damage); } - - - - - void A_FirePistol ( player_t* player, pspdef_t* psp ) { S_StartSound (player->mo, sfx_pistol); - P_SetMobjState (player->mo, S_PLAY_ATK2); player->ammo[weaponinfo[player->readyweapon].ammo]--; - P_SetPsprite (player, ps_flash, weaponinfo[player->readyweapon].flashstate); - P_BulletSlope (player->mo); P_GunShot (player->mo, !player->refire); } - - - - - void A_FireShotgun ( player_t* player, pspdef_t* psp ) { int i; - S_StartSound (player->mo, sfx_shotgn); P_SetMobjState (player->mo, S_PLAY_ATK2); - player->ammo[weaponinfo[player->readyweapon].ammo]--; - P_SetPsprite (player, ps_flash, weaponinfo[player->readyweapon].flashstate); - P_BulletSlope (player->mo); - for (i=0 ; i<7 ; i++) P_GunShot (player->mo, false); } - - - - - - void A_FireShotgun2 ( player_t* player, @@ -698,19 +417,13 @@ A_FireShotgun2 int i; angle_t angle; int damage; - - S_StartSound (player->mo, sfx_dshtgn); P_SetMobjState (player->mo, S_PLAY_ATK2); - player->ammo[weaponinfo[player->readyweapon].ammo]-=2; - P_SetPsprite (player, ps_flash, weaponinfo[player->readyweapon].flashstate); - P_BulletSlope (player->mo); - for (i=0 ; i<20 ; i++) { damage = 5*(P_Random ()%3+1); @@ -722,96 +435,58 @@ A_FireShotgun2 bulletslope + ((P_Random()-P_Random())<<5), damage); } } - - - - - void A_FireCGun ( player_t* player, pspdef_t* psp ) { S_StartSound (player->mo, sfx_pistol); - if (!player->ammo[weaponinfo[player->readyweapon].ammo]) return; - P_SetMobjState (player->mo, S_PLAY_ATK2); player->ammo[weaponinfo[player->readyweapon].ammo]--; - P_SetPsprite (player, ps_flash, weaponinfo[player->readyweapon].flashstate + psp->state - &states[S_CHAIN1] ); - P_BulletSlope (player->mo); - P_GunShot (player->mo, !player->refire); } - - - - - - void A_Light0 (player_t *player, pspdef_t *psp) { player->extralight = 0; } - void A_Light1 (player_t *player, pspdef_t *psp) { player->extralight = 1; } - void A_Light2 (player_t *player, pspdef_t *psp) { player->extralight = 2; } - - - - - - void A_BFGSpray (mobj_t* mo) { int i; int j; int damage; angle_t an; - - for (i=0 ; i<40 ; i++) { an = mo->angle - ANG90/2 + ANG90/40*i; - - - P_AimLineAttack (mo->target, an, 16*64*FRACUNIT); - if (!linetarget) continue; - P_SpawnMobj (linetarget->x, linetarget->y, linetarget->z + (linetarget->height>>2), MT_EXTRABFG); - damage = 0; for (j=0;j<15;j++) damage += (P_Random()&7) + 1; - P_DamageMobj (linetarget, mo->target,mo->target, damage); } } - - - - - void A_BFGsound ( player_t* player, @@ -819,48 +494,24 @@ A_BFGsound { S_StartSound (player->mo, sfx_bfg); } - - - - - - - void P_SetupPsprites (player_t* player) { int i; - - for (i=0 ; i<NUMPSPRITES ; i++) player->psprites[i].state = NULL; - - player->pendingweapon = player->readyweapon; P_BringUpWeapon (player); } - - - - - - - - void P_MovePsprites (player_t* player) { int i; pspdef_t* psp; state_t* state; - psp = &player->psprites[0]; for (i=0 ; i<NUMPSPRITES ; i++, psp++) { - if ( (state = psp->state) ) { - - - if (psp->tics != -1) { psp->tics--; @@ -869,9 +520,6 @@ void P_MovePsprites (player_t* player) } } } - player->psprites[ps_flash].sx = player->psprites[ps_weapon].sx; player->psprites[ps_flash].sy = player->psprites[ps_weapon].sy; } - - diff --git a/src/p_pspr.h b/src/p_pspr.h @@ -1,82 +1,24 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __P_PSPR__ #define __P_PSPR__ - - - #include "m_fixed.h" #include "tables.h" - - - - - - - - - #include "info.h" - #ifdef __GNUG__ #pragma interface #endif - - - - - - #define FF_FULLBRIGHT 0x8000 #define FF_FRAMEMASK 0x7fff - - - - - - - - typedef enum { ps_weapon, ps_flash, NUMPSPRITES - } psprnum_t; - typedef struct { state_t* state; int tics; fixed_t sx; fixed_t sy; - } pspdef_t; - #endif - - - - - diff --git a/src/p_saveg.c b/src/p_saveg.c @@ -1,60 +1,20 @@ - - - - - - - - - - - - - - - - - - - - - - - - #include "i_system.h" #include "z_zone.h" #include "p_local.h" - - #include "doomstat.h" #include "r_state.h" - byte* save_p; - - - - #define PADSAVEP() save_p += (4 - ((int) save_p & 3)) & 3 - - - - - - void P_ArchivePlayers (void) { int i; int j; player_t* dest; - for (i=0 ; i<MAXPLAYERS ; i++) { if (!playeringame[i]) continue; - PADSAVEP(); - dest = (player_t *)save_p; memcpy (dest,&players[i],sizeof(player_t)); save_p += sizeof(player_t); @@ -68,32 +28,20 @@ void P_ArchivePlayers (void) } } } - - - - - - void P_UnArchivePlayers (void) { int i; int j; - for (i=0 ; i<MAXPLAYERS ; i++) { if (!playeringame[i]) continue; - PADSAVEP(); - memcpy (&players[i],save_p, sizeof(player_t)); save_p += sizeof(player_t); - - players[i].mo = NULL; players[i].message = NULL; players[i].attacker = NULL; - for (j=0 ; j<NUMPSPRITES ; j++) { if (players[i]. psprites[j].state) @@ -104,11 +52,6 @@ void P_UnArchivePlayers (void) } } } - - - - - void P_ArchiveWorld (void) { int i; @@ -117,10 +60,7 @@ void P_ArchiveWorld (void) line_t* li; side_t* si; short* put; - put = (short *)save_p; - - for (i=0, sec = sectors ; i<numsectors ; i++,sec++) { *put++ = sec->floorheight >> FRACBITS; @@ -131,9 +71,6 @@ void P_ArchiveWorld (void) *put++ = sec->special; *put++ = sec->tag; } - - - for (i=0, li = lines ; i<numlines ; i++,li++) { *put++ = li->flags; @@ -143,9 +80,7 @@ void P_ArchiveWorld (void) { if (li->sidenum[j] == -1) continue; - si = &sides[li->sidenum[j]]; - *put++ = si->textureoffset >> FRACBITS; *put++ = si->rowoffset >> FRACBITS; *put++ = si->toptexture; @@ -153,15 +88,8 @@ void P_ArchiveWorld (void) *put++ = si->midtexture; } } - save_p = (byte *)put; } - - - - - - void P_UnArchiveWorld (void) { int i; @@ -170,10 +98,7 @@ void P_UnArchiveWorld (void) line_t* li; side_t* si; short* get; - get = (short *)save_p; - - for (i=0, sec = sectors ; i<numsectors ; i++,sec++) { sec->floorheight = *get++ << FRACBITS; @@ -186,8 +111,6 @@ void P_UnArchiveWorld (void) sec->specialdata = 0; sec->soundtarget = 0; } - - for (i=0, li = lines ; i<numlines ; i++,li++) { li->flags = *get++; @@ -207,32 +130,15 @@ void P_UnArchiveWorld (void) } save_p = (byte *)get; } - - - - - - - - typedef enum { tc_end, tc_mobj - } thinkerclass_t; - - - - - - void P_ArchiveThinkers (void) { thinker_t* th; mobj_t* mobj; - - for (th = thinkercap.next ; th != &thinkercap ; th=th->next) { if (th->function.acp1 == (actionf_p1)P_MobjThinker) @@ -243,47 +149,30 @@ void P_ArchiveThinkers (void) memcpy (mobj, th, sizeof(*mobj)); save_p += sizeof(*mobj); mobj->state = (state_t *)(mobj->state - states); - if (mobj->player) mobj->player = (player_t *)((mobj->player-players) + 1); continue; } - - } - - *save_p++ = tc_end; } - - - - - - void P_UnArchiveThinkers (void) { byte tclass; thinker_t* currentthinker; thinker_t* next; mobj_t* mobj; - - currentthinker = thinkercap.next; while (currentthinker != &thinkercap) { next = currentthinker->next; - if (currentthinker->function.acp1 == (actionf_p1)P_MobjThinker) P_RemoveMobj ((mobj_t *)currentthinker); else Z_Free (currentthinker); - currentthinker = next; } P_InitThinkers (); - - while (1) { tclass = *save_p++; @@ -291,7 +180,6 @@ void P_UnArchiveThinkers (void) { case tc_end: return; - case tc_mobj: PADSAVEP(); mobj = Z_Malloc (sizeof(*mobj), PU_LEVEL, NULL); @@ -311,19 +199,11 @@ void P_UnArchiveThinkers (void) mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker; P_AddThinker (&mobj->thinker); break; - default: I_Error ("Unknown tclass %i in savegame",tclass); } - } - } - - - - - enum { tc_ceiling, @@ -334,22 +214,7 @@ enum tc_strobe, tc_glow, tc_endspecials - } specials_e; - - - - - - - - - - - - - - void P_ArchiveSpecials (void) { thinker_t* th; @@ -361,8 +226,6 @@ void P_ArchiveSpecials (void) strobe_t* strobe; glow_t* glow; int i; - - for (th = thinkercap.next ; th != &thinkercap ; th=th->next) { if (th->function.acv == (actionf_v)NULL) @@ -370,7 +233,6 @@ void P_ArchiveSpecials (void) for (i = 0; i < MAXCEILINGS;i++) if (activeceilings[i] == (ceiling_t *)th) break; - if (i<MAXCEILINGS) { *save_p++ = tc_ceiling; @@ -382,7 +244,6 @@ void P_ArchiveSpecials (void) } continue; } - if (th->function.acp1 == (actionf_p1)T_MoveCeiling) { *save_p++ = tc_ceiling; @@ -393,7 +254,6 @@ void P_ArchiveSpecials (void) ceiling->sector = (sector_t *)(ceiling->sector - sectors); continue; } - if (th->function.acp1 == (actionf_p1)T_VerticalDoor) { *save_p++ = tc_door; @@ -404,7 +264,6 @@ void P_ArchiveSpecials (void) door->sector = (sector_t *)(door->sector - sectors); continue; } - if (th->function.acp1 == (actionf_p1)T_MoveFloor) { *save_p++ = tc_floor; @@ -415,7 +274,6 @@ void P_ArchiveSpecials (void) floor->sector = (sector_t *)(floor->sector - sectors); continue; } - if (th->function.acp1 == (actionf_p1)T_PlatRaise) { *save_p++ = tc_plat; @@ -426,7 +284,6 @@ void P_ArchiveSpecials (void) plat->sector = (sector_t *)(plat->sector - sectors); continue; } - if (th->function.acp1 == (actionf_p1)T_LightFlash) { *save_p++ = tc_flash; @@ -437,7 +294,6 @@ void P_ArchiveSpecials (void) flash->sector = (sector_t *)(flash->sector - sectors); continue; } - if (th->function.acp1 == (actionf_p1)T_StrobeFlash) { *save_p++ = tc_strobe; @@ -448,7 +304,6 @@ void P_ArchiveSpecials (void) strobe->sector = (sector_t *)(strobe->sector - sectors); continue; } - if (th->function.acp1 == (actionf_p1)T_Glow) { *save_p++ = tc_glow; @@ -460,16 +315,8 @@ void P_ArchiveSpecials (void) continue; } } - - *save_p++ = tc_endspecials; - } - - - - - void P_UnArchiveSpecials (void) { byte tclass; @@ -480,9 +327,6 @@ void P_UnArchiveSpecials (void) lightflash_t* flash; strobe_t* strobe; glow_t* glow; - - - while (1) { tclass = *save_p++; @@ -490,7 +334,6 @@ void P_UnArchiveSpecials (void) { case tc_endspecials: return; - case tc_ceiling: PADSAVEP(); ceiling = Z_Malloc (sizeof(*ceiling), PU_LEVEL, NULL); @@ -498,14 +341,11 @@ void P_UnArchiveSpecials (void) save_p += sizeof(*ceiling); ceiling->sector = &sectors[(int)ceiling->sector]; ceiling->sector->specialdata = ceiling; - if (ceiling->thinker.function.acp1) ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling; - P_AddThinker (&ceiling->thinker); P_AddActiveCeiling(ceiling); break; - case tc_door: PADSAVEP(); door = Z_Malloc (sizeof(*door), PU_LEVEL, NULL); @@ -516,7 +356,6 @@ void P_UnArchiveSpecials (void) door->thinker.function.acp1 = (actionf_p1)T_VerticalDoor; P_AddThinker (&door->thinker); break; - case tc_floor: PADSAVEP(); floor = Z_Malloc (sizeof(*floor), PU_LEVEL, NULL); @@ -527,7 +366,6 @@ void P_UnArchiveSpecials (void) floor->thinker.function.acp1 = (actionf_p1)T_MoveFloor; P_AddThinker (&floor->thinker); break; - case tc_plat: PADSAVEP(); plat = Z_Malloc (sizeof(*plat), PU_LEVEL, NULL); @@ -535,14 +373,11 @@ void P_UnArchiveSpecials (void) save_p += sizeof(*plat); plat->sector = &sectors[(int)plat->sector]; plat->sector->specialdata = plat; - if (plat->thinker.function.acp1) plat->thinker.function.acp1 = (actionf_p1)T_PlatRaise; - P_AddThinker (&plat->thinker); P_AddActivePlat(plat); break; - case tc_flash: PADSAVEP(); flash = Z_Malloc (sizeof(*flash), PU_LEVEL, NULL); @@ -552,7 +387,6 @@ void P_UnArchiveSpecials (void) flash->thinker.function.acp1 = (actionf_p1)T_LightFlash; P_AddThinker (&flash->thinker); break; - case tc_strobe: PADSAVEP(); strobe = Z_Malloc (sizeof(*strobe), PU_LEVEL, NULL); @@ -562,7 +396,6 @@ void P_UnArchiveSpecials (void) strobe->thinker.function.acp1 = (actionf_p1)T_StrobeFlash; P_AddThinker (&strobe->thinker); break; - case tc_glow: PADSAVEP(); glow = Z_Malloc (sizeof(*glow), PU_LEVEL, NULL); @@ -572,13 +405,9 @@ void P_UnArchiveSpecials (void) glow->thinker.function.acp1 = (actionf_p1)T_Glow; P_AddThinker (&glow->thinker); break; - default: I_Error ("P_UnarchiveSpecials:Unknown tclass %i " "in savegame",tclass); } - } - } - diff --git a/src/p_saveg.h b/src/p_saveg.h @@ -1,36 +1,8 @@ - - - - - - - - - - - - - - - - - - - - - - #ifndef __P_SAVEG__ #define __P_SAVEG__ - - #ifdef __GNUG__ #pragma interface #endif - - - - void P_ArchivePlayers (void); void P_UnArchivePlayers (void); void P_ArchiveWorld (void); @@ -39,13 +11,5 @@ void P_ArchiveThinkers (void); void P_UnArchiveThinkers (void); void P_ArchiveSpecials (void); void P_UnArchiveSpecials (void); - extern byte* save_p; - - #endif - - - - - diff --git a/src/p_setup.c b/src/p_setup.c @@ -1,159 +1,59 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - #include <math.h> - #include "z_zone.h" - #include "m_swap.h" #include "m_bbox.h" - #include "g_game.h" - #include "i_system.h" #include "w_wad.h" - #include "doomdef.h" #include "p_local.h" - #include "s_sound.h" - #include "doomstat.h" - - void P_SpawnMapThing (mapthing_t* mthing); - - - - - - int numvertexes; vertex_t* vertexes; - int numsegs; seg_t* segs; - int numsectors; sector_t* sectors; - int numsubsectors; subsector_t* subsectors; - int numnodes; node_t* nodes; - int numlines; line_t* lines; - int numsides; side_t* sides; - - - - - - - - - - int bmapwidth; int bmapheight; short* blockmap; - short* blockmaplump; - fixed_t bmaporgx; fixed_t bmaporgy; - mobj_t** blocklinks; - - - - - - - - - byte* rejectmatrix; - - - #define MAX_DEATHMATCH_STARTS 10 - mapthing_t deathmatchstarts[MAX_DEATHMATCH_STARTS]; mapthing_t* deathmatch_p; mapthing_t playerstarts[MAXPLAYERS]; - - - - - - - - void P_LoadVertexes (int lump) { byte* data; int i; mapvertex_t* ml; vertex_t* li; - - - numvertexes = W_LumpLength (lump) / sizeof(mapvertex_t); - - vertexes = Z_Malloc (numvertexes*sizeof(vertex_t),PU_LEVEL,0); - - data = W_CacheLumpNum (lump,PU_STATIC); - ml = (mapvertex_t *)data; li = vertexes; - - - for (i=0 ; i<numvertexes ; i++, li++, ml++) { li->x = SHORT(ml->x)<<FRACBITS; li->y = SHORT(ml->y)<<FRACBITS; } - - Z_Free (data); } - - - - - - void P_LoadSegs (int lump) { byte* data; @@ -163,19 +63,16 @@ void P_LoadSegs (int lump) line_t* ldef; int linedef; int side; - numsegs = W_LumpLength (lump) / sizeof(mapseg_t); segs = Z_Malloc (numsegs*sizeof(seg_t),PU_LEVEL,0); memset (segs, 0, numsegs*sizeof(seg_t)); data = W_CacheLumpNum (lump,PU_STATIC); - ml = (mapseg_t *)data; li = segs; for (i=0 ; i<numsegs ; i++, li++, ml++) { li->v1 = &vertexes[SHORT(ml->v1)]; li->v2 = &vertexes[SHORT(ml->v2)]; - li->angle = (SHORT(ml->angle))<<16; li->offset = (SHORT(ml->offset))<<16; linedef = SHORT(ml->linedef); @@ -189,55 +86,37 @@ void P_LoadSegs (int lump) else li->backsector = 0; } - Z_Free (data); } - - - - - void P_LoadSubsectors (int lump) { byte* data; int i; mapsubsector_t* ms; subsector_t* ss; - numsubsectors = W_LumpLength (lump) / sizeof(mapsubsector_t); subsectors = Z_Malloc (numsubsectors*sizeof(subsector_t),PU_LEVEL,0); data = W_CacheLumpNum (lump,PU_STATIC); - ms = (mapsubsector_t *)data; memset (subsectors,0, numsubsectors*sizeof(subsector_t)); ss = subsectors; - for (i=0 ; i<numsubsectors ; i++, ss++, ms++) { ss->numlines = SHORT(ms->numsegs); ss->firstline = SHORT(ms->firstseg); } - Z_Free (data); } - - - - - - void P_LoadSectors (int lump) { byte* data; int i; mapsector_t* ms; sector_t* ss; - numsectors = W_LumpLength (lump) / sizeof(mapsector_t); sectors = Z_Malloc (numsectors*sizeof(sector_t),PU_LEVEL,0); memset (sectors, 0, numsectors*sizeof(sector_t)); data = W_CacheLumpNum (lump,PU_STATIC); - ms = (mapsector_t *)data; ss = sectors; for (i=0 ; i<numsectors ; i++, ss++, ms++) @@ -251,14 +130,8 @@ void P_LoadSectors (int lump) ss->tag = SHORT(ms->tag); ss->thinglist = NULL; } - Z_Free (data); } - - - - - void P_LoadNodes (int lump) { byte* data; @@ -267,14 +140,11 @@ void P_LoadNodes (int lump) int k; mapnode_t* mn; node_t* no; - numnodes = W_LumpLength (lump) / sizeof(mapnode_t); nodes = Z_Malloc (numnodes*sizeof(node_t),PU_LEVEL,0); data = W_CacheLumpNum (lump,PU_STATIC); - mn = (mapnode_t *)data; no = nodes; - for (i=0 ; i<numnodes ; i++, no++, mn++) { no->x = SHORT(mn->x)<<FRACBITS; @@ -288,14 +158,8 @@ void P_LoadNodes (int lump) no->bbox[j][k] = SHORT(mn->bbox[j][k])<<FRACBITS; } } - Z_Free (data); } - - - - - void P_LoadThings (int lump) { byte* data; @@ -303,16 +167,12 @@ void P_LoadThings (int lump) mapthing_t* mt; int numthings; boolean spawn; - data = W_CacheLumpNum (lump,PU_STATIC); numthings = W_LumpLength (lump) / sizeof(mapthing_t); - mt = (mapthing_t *)data; for (i=0 ; i<numthings ; i++, mt++) { spawn = true; - - if ( gamemode != commercial) { switch(mt->type) @@ -333,25 +193,15 @@ void P_LoadThings (int lump) } if (spawn == false) break; - - mt->x = SHORT(mt->x); mt->y = SHORT(mt->y); mt->angle = SHORT(mt->angle); mt->type = SHORT(mt->type); mt->options = SHORT(mt->options); - P_SpawnMapThing (mt); } - Z_Free (data); } - - - - - - void P_LoadLineDefs (int lump) { byte* data; @@ -360,12 +210,10 @@ void P_LoadLineDefs (int lump) line_t* ld; vertex_t* v1; vertex_t* v2; - numlines = W_LumpLength (lump) / sizeof(maplinedef_t); lines = Z_Malloc (numlines*sizeof(line_t),PU_LEVEL,0); memset (lines, 0, numlines*sizeof(line_t)); data = W_CacheLumpNum (lump,PU_STATIC); - mld = (maplinedef_t *)data; ld = lines; for (i=0 ; i<numlines ; i++, mld++, ld++) @@ -377,7 +225,6 @@ void P_LoadLineDefs (int lump) v2 = ld->v2 = &vertexes[SHORT(mld->v2)]; ld->dx = v2->x - v1->x; ld->dy = v2->y - v1->y; - if (!ld->dx) ld->slopetype = ST_VERTICAL; else if (!ld->dy) @@ -389,7 +236,6 @@ void P_LoadLineDefs (int lump) else ld->slopetype = ST_NEGATIVE; } - if (v1->x < v2->x) { ld->bbox[BOXLEFT] = v1->x; @@ -400,7 +246,6 @@ void P_LoadLineDefs (int lump) ld->bbox[BOXLEFT] = v2->x; ld->bbox[BOXRIGHT] = v1->x; } - if (v1->y < v2->y) { ld->bbox[BOXBOTTOM] = v1->y; @@ -411,40 +256,29 @@ void P_LoadLineDefs (int lump) ld->bbox[BOXBOTTOM] = v2->y; ld->bbox[BOXTOP] = v1->y; } - ld->sidenum[0] = SHORT(mld->sidenum[0]); ld->sidenum[1] = SHORT(mld->sidenum[1]); - if (ld->sidenum[0] != -1) ld->frontsector = sides[ld->sidenum[0]].sector; else ld->frontsector = 0; - if (ld->sidenum[1] != -1) ld->backsector = sides[ld->sidenum[1]].sector; else ld->backsector = 0; } - Z_Free (data); } - - - - - void P_LoadSideDefs (int lump) { byte* data; int i; mapsidedef_t* msd; side_t* sd; - numsides = W_LumpLength (lump) / sizeof(mapsidedef_t); sides = Z_Malloc (numsides*sizeof(side_t),PU_LEVEL,0); memset (sides, 0, numsides*sizeof(side_t)); data = W_CacheLumpNum (lump,PU_STATIC); - msd = (mapsidedef_t *)data; sd = sides; for (i=0 ; i<numsides ; i++, msd++, sd++) @@ -456,44 +290,25 @@ void P_LoadSideDefs (int lump) sd->midtexture = R_TextureNumForName(msd->midtexture); sd->sector = &sectors[SHORT(msd->sector)]; } - Z_Free (data); } - - - - - void P_LoadBlockMap (int lump) { int i; int count; - blockmaplump = W_CacheLumpNum (lump,PU_LEVEL); blockmap = blockmaplump+4; count = W_LumpLength (lump)/2; - for (i=0 ; i<count ; i++) blockmaplump[i] = SHORT(blockmaplump[i]); - bmaporgx = blockmaplump[0]<<FRACBITS; bmaporgy = blockmaplump[1]<<FRACBITS; bmapwidth = blockmaplump[2]; bmapheight = blockmaplump[3]; - - count = sizeof(*blocklinks)* bmapwidth*bmapheight; blocklinks = Z_Malloc (count,PU_LEVEL, 0); memset (blocklinks, 0, count); } - - - - - - - - void P_GroupLines (void) { line_t** linebuffer; @@ -506,31 +321,24 @@ void P_GroupLines (void) seg_t* seg; fixed_t bbox[4]; int block; - - ss = subsectors; for (i=0 ; i<numsubsectors ; i++, ss++) { seg = &segs[ss->firstline]; ss->sector = seg->sidedef->sector; } - - li = lines; total = 0; for (i=0 ; i<numlines ; i++, li++) { total++; li->frontsector->linecount++; - if (li->backsector && li->backsector != li->frontsector) { li->backsector->linecount++; total++; } } - - linebuffer = Z_Malloc (total*4, PU_LEVEL, 0); sector = sectors; for (i=0 ; i<numsectors ; i++, sector++) @@ -549,35 +357,22 @@ void P_GroupLines (void) } if (linebuffer - sector->lines != sector->linecount) I_Error ("P_GroupLines: miscounted"); -