summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2008-09-04 23:22:39 +0000
committerSimon Howard2008-09-04 23:22:39 +0000
commit0774dce204c2c01622c59819e2a29590a1b50e46 (patch)
tree214f8b6e440d8d09ead9909f4c42f842404f6c41
parent0df2cb80cf03d7259746834220d209b306a8c503 (diff)
downloadchocolate-doom-0774dce204c2c01622c59819e2a29590a1b50e46.tar.gz
chocolate-doom-0774dce204c2c01622c59819e2a29590a1b50e46.tar.bz2
chocolate-doom-0774dce204c2c01622c59819e2a29590a1b50e46.zip
Remove unused files.
Subversion-branch: /branches/raven-branch Subversion-revision: 1196
-rw-r--r--src/heretic/d_netbak.c797
-rw-r--r--src/heretic/drcoord.h18
-rw-r--r--src/heretic/dstrings.bak406
-rw-r--r--src/heretic/g_old.c1819
-rw-r--r--src/heretic/i_ibm_a.asm135
-rw-r--r--src/heretic/linear.asm258
-rw-r--r--src/heretic/netold.c783
-rw-r--r--src/heretic/oldd_net.c790
-rw-r--r--src/heretic/vgaview.h24
-rw-r--r--src/hexen/defs.inc52
-rw-r--r--src/hexen/drcoord.h29
-rw-r--r--src/hexen/dstrings.h205
-rw-r--r--src/hexen/i_ibm_a.asm135
-rw-r--r--src/hexen/linear.asm349
-rw-r--r--src/hexen/oldd_net.c790
-rw-r--r--src/hexen/template.c32
-rw-r--r--src/hexen/vgaview.h34
17 files changed, 0 insertions, 6656 deletions
diff --git a/src/heretic/d_netbak.c b/src/heretic/d_netbak.c
deleted file mode 100644
index f9f52147..00000000
--- a/src/heretic/d_netbak.c
+++ /dev/null
@@ -1,797 +0,0 @@
-
-// I_pcnet.m
-//
-// Modified 12-21-94 by Chris Rhinehart for use with multiple ticdups
-// actually, it wasn't modified, but rather we are currently using this
-// older version of D_NET.C, since the new one doesn't seem to work with
-// ticdup set to greater than one.
-
-#include "DoomDef.h"
-#include "P_local.h"
-#include "soundst.h"
-
-#define NCMD_EXIT 0x80000000
-#define NCMD_RETRANSMIT 0x40000000
-#define NCMD_SETUP 0x20000000
-#define NCMD_CHECKSUM 0x0fffffff
-
-/*
-if more space needs to be crunched out of the protocol...
-
-1 drone
-2 player
-8 tic
-5 numtics
-
-#define NCMD_EXIT 0x80000000
-#define NCMD_RETRANSMIT 0x40000000 // a retransmit will have 0 tics
-#define NCMD_DRONE 0x20000000
-#define NCMD_PLAYER 0x18000000
-#define NCMD_PLAYERSHIFT 27
-#define NCMD_TIC 0x00ff0000
-#define NCMD_TICSHIFT 16
-#define NCMD_NUMTICS 0x0000ff00
-#define NCMD_NUMTICSSHIFT 8
-#define NCMD_CHECKSUM 0x000000ff
-
-*/
-
-
-
-
-
-doomcom_t *doomcom;
-doomdata_t *netbuffer; // points inside doomcom
-
-
-/*
-==============================================================================
-
- NETWORKING
-
-gametic is the tic about to (or currently being) run
-maketic is the tick that hasn't had control made for it yet
-nettics[] has the maketics for all players
-
-a gametic cannot be run until nettics[] > gametic for all players
-
-==============================================================================
-*/
-
-#define RESENDCOUNT 10
-#define PL_DRONE 0x80 // bit flag in doomdata->player
-
-ticcmd_t localcmds[BACKUPTICS];
-
-ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];
-int nettics[MAXNETNODES];
-boolean nodeingame[MAXNETNODES]; // set false as nodes leave game
-boolean remoteresend[MAXNETNODES]; // set when local needs tics
-int resendto[MAXNETNODES]; // set when remote needs tics
-int resendcount[MAXNETNODES];
-
-int nodeforplayer[MAXPLAYERS];
-
-int gametime;
-int maketic;
-int lastnettic, skiptics;
-int ticdup;
-
-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;
-
- 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;
-}
-
-
-//============================================================================
-
-
-/*
-==============
-=
-= HSendPacket
-=
-==============
-*/
-
-void HSendPacket (int node, int flags)
-{
- netbuffer->checksum = NetbufferChecksum () | flags;
-
- if (!node)
- {
- reboundstore = *netbuffer;
- reboundpacket = true;
- 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;
- int realretrans;
- if (netbuffer->checksum & NCMD_RETRANSMIT)
- 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 ();
-}
-
-/*
-==============
-=
-= HGetPacket
-=
-= Returns false if no packet is waiting
-=
-==============
-*/
-
-boolean HGetPacket (void)
-{
- if (reboundpacket)
- {
- *netbuffer = reboundstore;
- doomcom->remotenode = 0;
- reboundpacket = false;
- return true;
- }
-
- if (!netgame)
- 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
- {
- if (netbuffer->checksum & NCMD_RETRANSMIT)
- 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");
- }
-}
- return true;
-}
-
-
-/*
-===================
-=
-= GetPackets
-=
-===================
-*/
-
-char exitmsg[80];
-
-void GetPackets (void)
-{
- int netconsole;
- int netnode;
- int netdrone;
- int j;
- ticcmd_t *src, *dest;
- int dupedstart, dupedend;
- int skiptics;
- int realstart;
-
- while (HGetPacket ())
- {
- if (netbuffer->checksum & NCMD_SETUP)
- continue; // extra setup packet
-
- netdrone = netbuffer->player & PL_DRONE;
- netconsole = netbuffer->player & ~PL_DRONE;
- netnode = doomcom->remotenode;
- //
- // to save bytes, only the low byte of tic numbers are sent
- // Figure out what the rest of the bytes are
- //
- realstart = ExpandTics (netbuffer->starttic);
- dupedstart = realstart*doomcom->ticdup;
- dupedend = (realstart+netbuffer->numtics)*doomcom->ticdup;
-
- //
- // check for exiting the game
- //
- if (netbuffer->checksum & NCMD_EXIT)
- {
- if (!nodeingame[netnode])
- continue;
- nodeingame[netnode] = false;
- if (!netdrone)
- {
- playeringame[netconsole] = false;
- strcpy (exitmsg, "PLAYER 1 HAS LEFT THE GAME");
- exitmsg[7] += netconsole;
- P_SetMessage(&players[consoleplayer], exitmsg, true);
- UpdateState |= I_MESSAGES;
- S_StartSound(NULL, sfx_chat);
- }
- continue;
- }
-
- //
- // drone packets are just notifications
- //
- if (netdrone)
- {
- nettics[netnode] = dupedend;
- continue;
- }
-
- nodeforplayer[netconsole] = netnode;
-
- //
- // check for retransmit request
- //
- if ( resendcount[netnode] <= 0
- && (netbuffer->checksum & NCMD_RETRANSMIT) )
- {
- resendto[netnode] = ExpandTics(netbuffer->retransmitfrom);
-if (debugfile)
-fprintf (debugfile,"retransmit from %i\n", resendto[netnode]);
- resendcount[netnode] = RESENDCOUNT;
- }
- else
- resendcount[netnode]--;
-
- //
- // check for out of order / duplicated packet
- //
- if (dupedend == nettics[netnode])
- continue;
-
- if (dupedend < nettics[netnode])
- {
-if (debugfile)
-fprintf (debugfile,"out of order packet (%i + %i)\n" ,realstart,netbuffer->numtics);
- continue;
- }
-
- //
- // check for a missed packet
- //
- if (dupedstart > nettics[netnode])
- {
- // stop processing until the other system resends the missed tics
-if (debugfile)
-fprintf (debugfile,"missed tics from %i (%i - %i)\n", netnode, dupedstart, nettics[netnode]);
- remoteresend[netnode] = true;
- continue;
- }
-
-//
-// update command store from the packet
-//
- remoteresend[netnode] = false;
-
- skiptics = nettics[netnode]/doomcom->ticdup - realstart;
- src = &netbuffer->cmds[skiptics];
-
- while (nettics[netnode] < dupedend)
- {
- for (j=0 ; j<doomcom->ticdup ; j++)
- {
- dest = &netcmds[netconsole][nettics[netnode]%BACKUPTICS];
- nettics[netnode]++;
- *dest = *src;
- src->chatchar = 0;
- if (src->buttons & BT_SPECIAL)
- src->buttons = 0;
- }
- src++;
- }
- }
-}
-
-/*
-=============
-=
-= NetUpdate
-=
-= Builds ticcmds for console player
-= sends out a packet
-=============
-*/
-
-void NetUpdate (void)
-{
- int nowtime;
- int newtics;
- int i,j;
- int gameticdiv;
- int realstart;
-
- if (singletics)
- return; // singletic update is syncronous
-
-//
-// check time
-//
- nowtime = I_GetTime ()/doomcom->ticdup;
- newtics = nowtime - gametime;
- gametime = nowtime;
- if (newtics <= 0) // nothing new to update
- goto listen;
-
- if (skiptics <= newtics)
- {
- newtics -= skiptics;
- skiptics = 0;
- }
- else
- {
- skiptics -= newtics;
- newtics = 0;
- }
-
-
- netbuffer->player = consoleplayer;
- if (doomcom->drone)
- netbuffer->player |= PL_DRONE;
-
-//
-// drone packets
-//
- if (doomcom->drone)
- {
- I_StartTic ();
- D_ProcessEvents ();
- goto sendit;
- }
-
-//
-// build new ticcmds for console player
-//
- gameticdiv = (gametic+doomcom->ticdup-1)/doomcom->ticdup;
- for (i=0 ; i<newtics ; i++)
- {
- I_StartTic ();
- D_ProcessEvents ();
- if (maketic - gameticdiv >= BACKUPTICS/2 /* /doomcom->ticdup */- 1)
- {
- newtics = i;
- break; // can't hold any more
- }
-//printf ("mk:%i ",maketic);
- G_BuildTiccmd (&localcmds[maketic%BACKUPTICS]);
- maketic++;
- }
-
-//
-// send the packet to the other nodes
-//
-sendit:
- for (i=0 ; i<doomcom->numnodes ; i++)
- if (nodeingame[i])
- {
- if (doomcom->drone)
- {
- netbuffer->starttic = realstart = maketic + BACKUPTICS/2;
- netbuffer->numtics = 0;
- }
- else
- {
- netbuffer->starttic = realstart = resendto[i];
- netbuffer->numtics = maketic - realstart;
- resendto[i] = maketic - doomcom->extratics;
- }
-
- if (netbuffer->numtics > BACKUPTICS)
- I_Error ("NetUpdate: netbuffer->numtics > BACKUPTICS");
-
- for (j=0 ; j< netbuffer->numtics ; j++)
- netbuffer->cmds[j] =
- localcmds[(realstart+j)%BACKUPTICS];
-
- if (remoteresend[i])
- {
- netbuffer->retransmitfrom = nettics[i]/doomcom->ticdup;
- HSendPacket (i, NCMD_RETRANSMIT);
- }
- else
- {
- netbuffer->retransmitfrom = 0;
- HSendPacket (i, 0);
- }
- }
-
-//
-// listen for other packets
-//
-listen:
-
- GetPackets ();
-}
-
-
-/*
-=====================
-=
-= CheckAbort
-=
-=====================
-*/
-
-void CheckAbort (void)
-{
- event_t *ev;
-
- I_WaitVBL(2);
-
- I_StartTic ();
- for ( ; eventtail != eventhead
- ; eventtail = (++eventtail)&(MAXEVENTS-1) )
- {
- ev = &events[eventtail];
- if (ev->type == ev_keydown && ev->data1 == KEY_ESCAPE)
- I_Error ("Network game synchronization aborted.");
- }
-}
-
-/*
-=====================
-=
-= D_ArbitrateNetStart
-=
-=====================
-*/
-
-void D_ArbitrateNetStart (void)
-{
- int i;
- boolean gotinfo[MAXNETNODES];
-
- autostart = true;
- memset (gotinfo,0,sizeof(gotinfo));
-
- if (doomcom->consoleplayer)
- { // listen for setup info from key player
- //printf ("listening for network start info...\n");
- while (1)
- {
- CheckAbort ();
- if (!HGetPacket ())
- continue;
- if (netbuffer->checksum & NCMD_SETUP)
- {
- if (netbuffer->player != VERSION)
- I_Error ("Different HERETIC versions cannot play a net game!");
- startskill = netbuffer->retransmitfrom & 15;
- deathmatch = (netbuffer->retransmitfrom & 0x80) > 0;
- startmap = netbuffer->starttic & 15;
- startepisode = netbuffer->starttic >> 4;
- return;
- }
- }
- }
- else
- { // key player, send the setup info
-// printf ("sending network start info...\n");
- do
- {
- CheckAbort ();
- for (i=0 ; i<doomcom->numnodes ; i++)
- {
- netbuffer->retransmitfrom = startskill;
- if (deathmatch)
- netbuffer->retransmitfrom |= 0x80;
- netbuffer->starttic = startepisode * 16 + startmap;
- netbuffer->player = VERSION;
- netbuffer->numtics = 0;
- HSendPacket (i, NCMD_SETUP);
- }
-
- while (HGetPacket ())
- {
-//printf ("got packet\n");
- gotinfo[netbuffer->player&0x7f] = true;
- }
-
- for (i=1 ; i<doomcom->numnodes ; i++)
- if (!gotinfo[i])
- break;
- } while (i < doomcom->numnodes);
- }
-}
-
-/*
-===================
-=
-= D_CheckNetGame
-=
-= Works out player numbers among the net participants
-===================
-*/
-
-extern int viewangleoffset;
-
-void D_CheckNetGame (void)
-{
- int i;
-
- for (i=0 ; i<MAXNETNODES ; i++)
- {
- nodeingame[i] = false;
- nettics[i] = 0;
- remoteresend[i] = false; // set when local needs tics
- resendto[i] = 0; // which tic to start sending
- }
-
-// I_InitNetwork sets doomcom and netgame
- 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);
-
-// read values out of doomcom
- ticdup = doomcom->ticdup;
-
- 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);
-
-}
-
-/*
-==================
-=
-= D_QuitNetGame
-=
-= Called before quitting to leave a net game without hanging the
-= other players
-=
-==================
-*/
-
-void D_QuitNetGame (void)
-{
- int i, j;
-
- if (debugfile)
- fclose (debugfile);
-
- if (!netgame || !usergame || consoleplayer == -1)
- return;
-
-// send a bunch of packets for security
- netbuffer->player = consoleplayer;
- if (doomcom->drone)
- netbuffer->player |= PL_DRONE;
- netbuffer->numtics = 0;
- for (i=0 ; i<4 ; i++)
- {
- for (j=1 ; j<doomcom->numnodes ; j++)
- if (nodeingame[j])
- HSendPacket (j, NCMD_EXIT);
- I_WaitVBL (1);
- }
-}
-
-
-
-/*
-===============
-=
-= TryRunTics
-=
-===============
-*/
-
-int frametics[4], frameon;
-int frameskip[4];
-int oldnettics;
-extern boolean advancedemo;
-
-void TryRunTics (void)
-{
- int i;
- int lowtic, nextlowest;
- int entertic;
- int static oldentertics;
- int realtics, availabletics;
- int counts;
- int numplaying;
-
-//
-// get real tics
-//
- entertic = I_GetTime ();
- realtics = entertic - oldentertics;
- oldentertics = entertic;
-
-//
-// get available tics
-//
- NetUpdate ();
-
- lowtic = nextlowest = MAXINT;
- numplaying = 0;
- for (i=0 ; i<doomcom->numnodes ; i++)
- if (nodeingame[i])
- {
- numplaying++;
- if (nettics[i] < lowtic)
- {
- nextlowest = lowtic;
- lowtic = nettics[i];
- }
- else if (nettics[i] < nextlowest)
- nextlowest = nettics[i];
- }
- availabletics = lowtic - gametic;
-
-
-//
-// decide how many tics to run
-//
- 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);
-
-//=============================================================================
-//
-// ideally nettics[0] should be 1 - 3 tics above lowtic
-// if we are consistantly slower, speed up time
-// drones should never hold up the other players
-//
- for (i=0 ; i<MAXPLAYERS ; i++)
- if (playeringame[i])
- break;
- if (consoleplayer == i)
- { // the key player does not adapt
- }
- else
- {
- if (nettics[0] <= nettics[nodeforplayer[i]])
- {
- gametime--;
-// printf ("-");
- }
- frameskip[frameon&3] = (oldnettics > nettics[nodeforplayer[i]]);
- oldnettics = nettics[0];
- if (frameskip[0] && frameskip[1] && frameskip[2] && frameskip[3])
- {
- skiptics = 1;
-// printf ("+");
- }
- }
-//=============================================================================
-
-//
-// wait for new tics if needed
-//
- while (lowtic < gametic + counts)
- {
-
- NetUpdate ();
- lowtic = MAXINT;
-
- for (i=0 ; i<doomcom->numnodes ; i++)
- if (nodeingame[i] && nettics[i] < lowtic)
- lowtic = nettics[i];
-
- if (lowtic < gametic)
- I_Error ("TryRunTics: lowtic < gametic");
-
- // don't stay in here forever -- give the menu a chance to work
- if (I_GetTime () - entertic >= 20)
- {
- MN_Ticker ();
- return;
- }
- }
-
-
-//
-// run the tics
-//
- while (counts--)
- {
- if (advancedemo)
- D_DoAdvanceDemo ();
- MN_Ticker ();
- G_Ticker ();
- NetUpdate (); // check for new console commands
- gametic++;
- }
-}
diff --git a/src/heretic/drcoord.h b/src/heretic/drcoord.h
deleted file mode 100644
index dbe42572..00000000
--- a/src/heretic/drcoord.h
+++ /dev/null
@@ -1,18 +0,0 @@
-
-#import <appkit/appkit.h>
-
-@interface DRCoord:Object
-{
- id players_i;
- id console_i;
- id skill_i;
- id episode_i;
- id map_i;
-}
-
-- newGame: sender;
-- scale1: sender;
-- scale2: sender;
-- scale4: sender;
-
-@end
diff --git a/src/heretic/dstrings.bak b/src/heretic/dstrings.bak
deleted file mode 100644
index 6dfdffc1..00000000
--- a/src/heretic/dstrings.bak
+++ /dev/null
@@ -1,406 +0,0 @@
-
-// DStrings.h
-
-//---------------------------------------------------------------------------
-//
-// M_menu.c
-//
-//---------------------------------------------------------------------------
-#define PRESSKEY "press a key."
-#define PRESSYN "press y or n."
-#define TXT_PAUSED "PAUSED"
-#define QUITMSG "are you sure you want to\nquit this great game?"
-#define LOADNET "you can't do load while in a net game!\n\n"PRESSKEY
-#define QLOADNET "you can't quickload during a netgame!\n\n"PRESSKEY
-#define QSAVESPOT "you haven't picked a quicksave slot yet!\n\n"PRESSKEY
-#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 to dos.)"
-#define DETAILHI "High detail"
-#define DETAILLO "Low detail"
-#define GAMMALVL0 "Gamma correction OFF"
-#define GAMMALVL1 "Gamma correction level 1"
-#define GAMMALVL2 "Gamma correction level 2"
-#define GAMMALVL3 "Gamma correction level 3"
-#define GAMMALVL4 "Gamma correction level 4"
-#define EMPTYSTRING "empty slot"
-
-//---------------------------------------------------------------------------
-//
-// P_inter.c
-//
-//---------------------------------------------------------------------------
-
-// Keys
-
-#define TXT_GOTBLUEKEY "BLUE KEY"
-#define TXT_GOTYELLOWKEY "YELLOW KEY"
-#define TXT_GOTGREENKEY "GREEN KEY"
-
-// Artifacts
-
-#define TXT_ARTIHEALTH "QUARTZ FLASK"
-#define TXT_ARTIFLY "WINGS OF WRATH"
-#define TXT_ARTIINVULNERABILITY "RING OF INVINCIBILITY"
-#define TXT_ARTITOMEOFPOWER "TOME OF POWER"
-#define TXT_ARTIINVISIBILITY "SHADOWSPHERE"
-#define TXT_ARTIEGG "MORPH OVUM"
-#define TXT_ARTISUPERHEALTH "MYSTIC URN"
-#define TXT_ARTITORCH "TORCH"
-#define TXT_ARTIFIREBOMB "TIME BOMB OF THE ANCIENTS"
-#define TXT_ARTITELEPORT "CHAOS DEVICE"
-
-// Items
-
-#define TXT_ITEMHEALTH "CRYSTAL VIAL"
-#define TXT_ITEMBAGOFHOLDING "BAG OF HOLDING"
-#define TXT_ITEMSHIELD1 "SILVER SHIELD"
-#define TXT_ITEMSHIELD2 "ENCHANTED SHIELD"
-#define TXT_ITEMSUPERMAP "MAP SCROLL"
-
-// Ammo
-
-#define TXT_AMMOGOLDWAND1 "WAND CRYSTAL"
-#define TXT_AMMOGOLDWAND2 "CRYSTAL GEODE"
-#define TXT_AMMOMACE1 "MACE SPHERES"
-#define TXT_AMMOMACE2 "PILE OF MACE SPHERES"
-#define TXT_AMMOCROSSBOW1 "ETHEREAL ARROWS"
-#define TXT_AMMOCROSSBOW2 "QUIVER OF ETHEREAL ARROWS"
-#define TXT_AMMOBLASTER1 "CLAW ORB"
-#define TXT_AMMOBLASTER2 "ENERGY ORB"
-#define TXT_AMMOSKULLROD1 "LESSER RUNES"
-#define TXT_AMMOSKULLROD2 "GREATER RUNES"
-#define TXT_AMMOPHOENIXROD1 "FLAME ORB"
-#define TXT_AMMOPHOENIXROD2 "INFERNO ORB"
-
-// Weapons
-
-#define TXT_WPNMACE "FIREMACE"
-#define TXT_WPNCROSSBOW "ETHEREAL CROSSBOW"
-#define TXT_WPNBLASTER "DRAGON CLAW"
-#define TXT_WPNSKULLROD "HELLSTAFF"
-#define TXT_WPNPHOENIXROD "PHOENIX ROD"
-#define TXT_WPNGAUNTLETS "GAUNTLETS OF THE NECROMANCER"
-
-//---------------------------------------------------------------------------
-//
-// SB_bar.c
-//
-//---------------------------------------------------------------------------
-
-#define TXT_CHEATGODON "GOD MODE ON"
-#define TXT_CHEATGODOFF "GOD MODE OFF"
-#define TXT_CHEATNOCLIPON "NO CLIPPING ON"
-#define TXT_CHEATNOCLIPOFF "NO CLIPPING OFF"
-#define TXT_CHEATWEAPONS "ALL WEAPONS"
-#define TXT_CHEATFLIGHTON "FLIGHT ON"
-#define TXT_CHEATFLIGHTOFF "FLIGHT OFF"
-#define TXT_CHEATPOWERON "POWER ON"
-#define TXT_CHEATPOWEROFF "POWER OFF"
-#define TXT_CHEATHEALTH "FULL HEALTH"
-#define TXT_CHEATKEYS "ALL KEYS"
-#define TXT_CHEATSOUNDON "SOUND DEBUG ON"
-#define TXT_CHEATSOUNDOFF "SOUND DEBUG OFF"
-#define TXT_CHEATTICKERON "TICKER ON"
-#define TXT_CHEATTICKEROFF "TICKER OFF"
-#define TXT_CHEATARTIFACTS1 "CHOOSE AN ARTIFACT ( A - J )"
-#define TXT_CHEATARTIFACTS2 "HOW MANY ( 1 - 9 )"
-#define TXT_CHEATARTIFACTS3 "YOU GOT IT"
-#define TXT_CHEATARTIFACTSFAIL "BAD INPUT"
-#define TXT_CHEATWARP "LEVEL WARP"
-#define TXT_CHEATSCREENSHOT "SCREENSHOT"
-#define TXT_CHEATCHICKENON "CHICKEN ON"
-#define TXT_CHEATCHICKENOFF "CHICKEN OFF"
-#define TXT_CHEATMASSACRE "MASSACRE"
-#define TXT_CHEATIDDQD "TRYING TO CHEAT, EH? NOW YOU DIE!"
-#define TXT_CHEATIDKFA "CHEATER - YOU DON'T DESERVE WEAPONS"
-
-//---------------------------------------------------------------------------
-//
-// P_doors.c
-//
-//---------------------------------------------------------------------------
-
-#define TXT_NEEDBLUEKEY "YOU NEED A BLUE KEY TO OPEN THIS DOOR"
-#define TXT_NEEDGREENKEY "YOU NEED A GREEN KEY TO OPEN THIS DOOR"
-#define TXT_NEEDYELLOWKEY "YOU NEED A YELLOW KEY TO OPEN THIS DOOR"
-
-//---------------------------------------------------------------------------
-//
-// G_game.c
-//
-//---------------------------------------------------------------------------
-
-#define TXT_GAMESAVED "GAME SAVED"
-
-//---------------------------------------------------------------------------
-//
-// HU_stuff.c
-//
-//---------------------------------------------------------------------------
-
-#define HUSTR_E1M1 "E1M1: Hangar"
-#define HUSTR_E1M2 "E1M2: Nuclear Plant"
-#define HUSTR_E1M3 "E1M3: Toxin Refinery"
-#define HUSTR_E1M4 "E1M4: Command Control"
-#define HUSTR_E1M5 "E1M5: Phobos Lab"
-#define HUSTR_E1M6 "E1M6: Central Processing"
-#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"
-#define HUSTR_E2M4 "E2M4: Deimos Lab"
-#define HUSTR_E2M5 "E2M5: Command Center"
-#define HUSTR_E2M6 "E2M6: Halls of the Damned"
-#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"
-#define HUSTR_E3M4 "E3M4: House of Pain"
-#define HUSTR_E3M5 "E3M5: Unholy Cathedral"
-#define HUSTR_E3M6 "E3M6: Mt. Erebus"
-#define HUSTR_E3M7 "E3M7: Limbo"
-#define HUSTR_E3M8 "E3M8: Dis"
-#define HUSTR_E3M9 "E3M9: Warrens"
-
-#define HUSTR_CHATMACRO1 "I'm ready to kick butt!"
-#define HUSTR_CHATMACRO2 "I'm OK."
-#define HUSTR_CHATMACRO3 "I'm not looking too good!"
-#define HUSTR_CHATMACRO4 "Help!"
-#define HUSTR_CHATMACRO5 "You suck!"
-#define HUSTR_CHATMACRO6 "Next time, scumbag..."
-#define HUSTR_CHATMACRO7 "Come here!"
-#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]"
-
-// The following should NOT be changed unless it seems
-// just AWFULLY necessary
-
-#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'
-
-//---------------------------------------------------------------------------
-//
-// AM_map.c
-//
-//---------------------------------------------------------------------------
-
-#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"
-
-//---------------------------------------------------------------------------
-//
-// ST_stuff.c
-//
-//---------------------------------------------------------------------------
-
-#define STSTR_DQDON "Degreelessness Mode On"
-#define STSTR_DQDOFF "Degreelessness Mode Off"
-
-#define STSTR_KFAADDED "Very Happy Ammo 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..."
-
-//---------------------------------------------------------------------------
-//
-// F_finale.c
-//
-//---------------------------------------------------------------------------
-
-#define E1TEXT "with the destruction of the iron\n"\
- "liches and their minions, the last\n"\
- "of the undead are cleared from this\n"\
- "plane of existence.\n\n"\
- "those creatures had to come from\n"\
- "somewhere, though, and you have the\n"\
- "sneaky suspicion that the fiery\n"\
- "portal of hell's maw opens onto\n"\
- "their home dimension.\n\n"\
- "to make sure that more undead\n"\
- "(or even worse things) don't come\n"\
- "through, you'll have to seal hell's\n"\
- "maw from the other side. of course\n"\
- "this means you may get stuck in a\n"\
- "very unfriendly world, but no one\n"\
- "ever said being a Heretic was easy!"
-
-#define E2TEXT "the mighty maulotaurs have proved\n"\
- "to be no match for you, and as\n"\
- "their steaming corpses slide to the\n"\
- "ground you feel a sense of grim\n"\
- "satisfaction that they have been\n"\
- "destroyed.\n\n"\
- "the gateways which they guarded\n"\
- "have opened, revealing what you\n"\
- "hope is the way home. but as you\n"\
- "step through, mocking laughter\n"\
- "rings in your ears.\n\n"\
- "was some other force controlling\n"\
- "the maulotaurs? could there be even\n"\
- "more horrific beings through this\n"\
- "gate? the sweep of a crystal dome\n"\
- "overhead where the sky should be is\n"\
- "certainly not a good sign...."
-
-#define E3TEXT "the death of d'sparil has loosed\n"\
- "the magical bonds holding his\n"\
- "creatures on this plane, their\n"\
- "dying screams overwhelming his own\n"\
- "cries of agony.\n\n"\
- "your oath of vengeance fulfilled,\n"\
- "you enter the portal to your own\n"\
- "world, mere moments before the dome\n"\
- "shatters into a million pieces.\n\n"\
- "but if d'sparil's power is broken\n"\
- "forever, why don't you feel safe?\n"\
- "was it that last shout just before\n"\
- "his death, the one that sounded\n"\
- "like a curse? or a summoning? you\n"\
- "can't really be sure, but it might\n"\
- "just have been a scream.\n\n"\
- "then again, what about the other\n"\
- "serpent riders?"
-
-#define E4TEXT "you thought you would return to your\n"\
- "own world after d'sparil died, but\n"\
- "his final act banished you to his\n"\
- "own plane. here you entered the\n"\
- "shattered remnants of lands\n"\
- "conquered by d'sparil. you defeated\n"\
- "the last guardians of these lands,\n"\
- "but now you stand before the gates\n"\
- "to d'sparil's stronghold. until this\n"\
- "moment you had no doubts about your\n"\
- "ability to face anything you might\n"\
- "encounter, but beyond this portal\n"\
- "lies the very heart of the evil\n"\
- "which invaded your world. d'sparil\n"\
- "might be dead, but the pit where he\n"\
- "was spawned remains. now you must\n"\
- "enter that pit in the hopes of\n"\
- "finding a way out. and somewhere,\n"\
- "in the darkest corner of d'sparil's\n"\
- "demesne, his personal bodyguards\n"\
- "await your arrival ..."
-
-#define E5TEXT "as the final maulotaur bellows his\n"\
- "death-agony, you realize that you\n"\
- "have never come so close to your own\n"\
- "destruction. not even the fight with\n"\
- "d'sparil and his disciples had been\n"\
- "this desperate. grimly you stare at\n"\
- "the gates which open before you,\n"\
- "wondering if they lead home, or if\n"\
- "they open onto some undreamed-of\n"\
- "horror. you find yourself wondering\n"\
- "if you have the strength to go on,\n"\
- "if nothing but death and pain await\n"\
- "you. but what else can you do, if\n"\
- "the will to fight is gone? can you\n"\
- "force yourself to continue in the\n"\
- "face of such despair? do you have\n"\
- "the courage? you find, in the end,\n"\
- "that it is not within you to\n"\
- "surrender without a fight. eyes\n"\
- "wide, you go to meet your fate."
-
-/*
-#define E1TEXT "Once you beat the big badasses and\n"\
- "clean out the moon base you're supposed\n"\
- "to win, aren't you? Aren't you? Where's\n"\
- "your fat reward and ticket home? What\n"\
- "the hell is this? It's not supposed to\n"\
- "end this way!\n"\
- "\n" \
- "It stinks like rotten meat, but looks\n"\
- "like the lost Deimos base. Looks like\n"\
- "you're stuck on The Shores of Hell.\n"\
- "The only way out is through.\n"\
- "\n"\
- "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"\
- "moon base has been slain and you\n"\
- "are triumphant! But ... where are\n"\
- "you? You clamber to the edge of the\n"\
- "moon and look down to see the awful\n"\
- "truth.\n" \
- "\n"\
- "Deimos floats above Hell itself!\n"\
- "You've never heard of anyone escaping\n"\
- "from Hell, but you'll make the bastards\n"\
- "sorry they ever heard of you! Quickly,\n"\
- "you rappel down to the surface of\n"\
- "Hell.\n"\
- "\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"\
- "bases and caused so much death has had\n"\
- "its ass kicked for all time.\n"\
- "\n"\
- "A hidden doorway opens and you enter.\n"\
- "You've proven too tough for Hell to\n"\
- "contain, and now Hell at last plays\n"\
- "fair -- for you emerge from the door\n"\
- "to see the green fields of Earth!\n"\
- "Home at last.\n" \
- "\n"\
- "You wonder what's been happening on\n"\
- "Earth while you were battling evil\n"\
- "unleashed. It's good that no Hell-\n"\
- "spawn could have come through that\n"\
- "door with you ..."
-*/
diff --git a/src/heretic/g_old.c b/src/heretic/g_old.c
deleted file mode 100644
index 4d186e39..00000000
--- a/src/heretic/g_old.c
+++ /dev/null
@@ -1,1819 +0,0 @@
-
-// G_game.c
-
-#include <string.h>
-#include "DoomDef.h"
-#include "P_local.h"
-#include "soundst.h"
-
-// Macros
-
-#define SAVE_GAME_TERMINATOR 0x1d
-
-// Functions
-
-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);
-void G_DoPlayDemo (void);
-void G_DoCompleted (void);
-void G_DoVictory (void);
-void G_DoWorldDone (void);
-void G_DoSaveGame (void);
-
-void D_PageTicker(void);
-void D_AdvanceDemo(void);
-
-struct
-{
- mobjtype_t type;
- int speed[2];
-} MonsterMissileInfo[] =
-{
- { MT_IMPBALL, 10, 20 },
- { MT_MUMMYFX1, 9, 18 },
- { MT_KNIGHTAXE, 9, 18 },
- { MT_REDAXE, 9, 18 },
- { MT_BEASTBALL, 12, 20 },
- { MT_WIZFX1, 18, 24 },
- { MT_SNAKEPRO_A, 14, 20 },
- { MT_SNAKEPRO_B, 14, 20 },
- { MT_HEADFX1, 13, 20 },
- { MT_HEADFX3, 10, 18 },
- { MT_MNTRFX1, 20, 26 },
- { MT_MNTRFX2, 14, 20 },
- { MT_SRCRFX1, 20, 28 },
- { MT_SOR2FX1, 20, 28 },
- { -1, -1, -1 } // Terminator
-};
-
-gameaction_t gameaction;
-gamestate_t gamestate;
-skill_t gameskill;
-boolean respawnmonsters;
-int gameepisode;
-int gamemap;
-int prevmap;
-
-boolean paused;
-boolean sendpause; // send a pause event next tic
-boolean sendsave; // send a save event next tic
-boolean usergame; // ok to save / end game
-
-boolean timingdemo; // if true, exit with report on completion
-int starttime; // for comparative timing purposes
-
-boolean viewactive;
-
-boolean deathmatch; // only if started as net death
-boolean netgame; // only true if packets are broadcast
-boolean playeringame[MAXPLAYERS];
-player_t players[MAXPLAYERS];
-
-int consoleplayer; // player taking events and displaying
-int displayplayer; // view being displayed
-int gametic;
-int levelstarttic; // gametic at level start
-int totalkills, totalitems, totalsecret; // for intermission
-
-char demoname[32];
-boolean demorecording;
-boolean demoplayback;
-byte *demobuffer, *demo_p;
-boolean singledemo; // quit after playing a demo from cmdline
-
-boolean precache = true; // if true, load all graphics at start
-
-short consistancy[MAXPLAYERS][BACKUPTICS];
-
-byte *savebuffer, *save_p;
-
-
-//
-// controls (have defaults)
-//
-int key_right, key_left, key_up, key_down;
-int key_strafeleft, key_straferight;
-int key_fire, key_use, key_strafe, key_speed;
-int key_flyup, key_flydown, key_flycenter;
-int key_lookup, key_lookdown, key_lookcenter;
-int key_invleft, key_invright, key_useartifact;
-
-int mousebfire;
-int mousebstrafe;
-int mousebforward;
-
-int joybfire;
-int joybstrafe;
-int joybuse;
-int joybspeed;
-
-
-
-#define MAXPLMOVE 0x32
-
-fixed_t forwardmove[2] = {0x19, 0x32};
-fixed_t sidemove[2] = {0x18, 0x28};
-fixed_t angleturn[3] = {640, 1280, 320}; // + slow turn
-#define SLOWTURNTICS 6
-
-#define NUMKEYS 256
-boolean gamekeydown[NUMKEYS];
-int turnheld; // for accelerative turning
-int lookheld;
-
-
-boolean mousearray[4];
-boolean *mousebuttons = &mousearray[1];
- // allow [-1]
-int mousex, mousey; // mouse values are used once
-int dclicktime, dclickstate, dclicks;
-int dclicktime2, dclickstate2, dclicks2;
-
-int joyxmove, joyymove; // joystick values are repeated
-boolean joyarray[5];
-boolean *joybuttons = &joyarray[1]; // allow [-1]
-
-int savegameslot;
-char savedescription[32];
-
-int inventoryTics;
-
-#ifdef __WATCOMC__
-extern externdata_t *i_ExternData;
-#endif
-
-//=============================================================================
-// Not used - ripped out for Heretic
-/*
-int G_CmdChecksum(ticcmd_t *cmd)
-{
- int i;
- int sum;
-
- sum = 0;
- for(i = 0; i < sizeof(*cmd)/4-1; i++)
- {
- sum += ((int *)cmd)[i];
- }
- return(sum);
-}
-*/
-
-/*
-====================
-=
-= G_BuildTiccmd
-=
-= Builds a ticcmd from all of the available inputs or reads it from the
-= demo buffer.
-= If recording a demo, write it out
-====================
-*/
-
-extern boolean inventory;
-extern int curpos;
-extern int inv_ptr;
-
-extern int isCyberPresent; // is CyberMan present?
-boolean usearti = true;
-void I_ReadCyberCmd (ticcmd_t *cmd);
-
-void G_BuildTiccmd (ticcmd_t *cmd)
-{
- int i;
- boolean strafe, bstrafe;
- int speed, tspeed, lspeed;
- int forward, side;
- int look, arti;
- int flyheight;
-
- extern boolean noartiskip;
-
-#ifdef __WATCOMC__
- int angleDelta;
- static int oldAngle;
- extern int newViewAngleOff;
- static int externInvKey;
- extern boolean automapactive;
- event_t ev;
-#endif
-
-
- memset (cmd,0,sizeof(*cmd));
- cmd->consistancy =
- consistancy[consoleplayer][(maketic*ticdup)%BACKUPTICS];
- if (isCyberPresent)
- I_ReadCyberCmd (cmd);
-
-//printf ("cons: %i\n",cmd->consistancy);
-
- strafe = gamekeydown[key_strafe] || mousebuttons[mousebstrafe]
- || joybuttons[joybstrafe];
- speed = gamekeydown[key_speed] || joybuttons[joybspeed]
- || joybuttons[joybspeed];
-#ifdef __WATCOMC__
- if(useexterndriver)
- {
- speed |= (i_ExternData->buttons&EBT_SPEED);
- strafe |= (i_ExternData->buttons&EBT_STRAFE);
- }
-#endif
-
- forward = side = look = arti = flyheight = 0;
-
-//
-// use two stage accelerative turning on the keyboard and joystick
-//
- if (joyxmove < 0 || joyxmove > 0
- || gamekeydown[key_right] || gamekeydown[key_left])
- turnheld += ticdup;
- else
- turnheld = 0;
- if (turnheld < SLOWTURNTICS)
- tspeed = 2; // slow turn
- else
- tspeed = speed;
-
- if(gamekeydown[key_lookdown] || gamekeydown[key_lookup])
- {
- lookheld += ticdup;
- }
- else
- {
- lookheld = 0;
- }
- if(lookheld < SLOWTURNTICS)
- {
- lspeed = 3;
- }
- else
- {
- lspeed = 5;
- }
-
-//
-// let movement keys cancel each other out
-//
- 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
- {
- if (gamekeydown[key_right])
- cmd->angleturn -= angleturn[tspeed];
- if (gamekeydown[key_left])
- cmd->angleturn += angleturn[tspeed];
- if (joyxmove > 0)
- cmd->angleturn -= angleturn[tspeed];
- if (joyxmove < 0)
- cmd->angleturn += angleturn[tspeed];
- }
-
- if (gamekeydown[key_up])
- forward += forwardmove[speed];
- if (gamekeydown[key_down])
- forward -= forwardmove[speed];
- if (joyymove < 0)
- forward += forwardmove[speed];
- if (joyymove > 0)
- forward -= forwardmove[speed];
- if (gamekeydown[key_straferight])
- side += sidemove[speed];
- if (gamekeydown[key_strafeleft])
- side -= sidemove[speed];
-
- // Look up/down/center keys
- if(gamekeydown[key_lookup])
- {
- look = lspeed;
- }
- if(gamekeydown[key_lookdown])
- {
- look = -lspeed;
- }
- if(gamekeydown[key_lookcenter])
- {
- look = TOCENTER;
- }
-
-#ifdef __WATCOMC__
- if(useexterndriver && i_ExternData->buttons&EBT_CENTERVIEW)
- {
- look = TOCENTER;
- }
- if(useexterndriver && look != TOCENTER && (gamestate == GS_LEVEL ||
- gamestate == GS_INTERMISSION))
- {
- if(i_ExternData->moveForward)
- {
- forward += i_ExternData->moveForward;
- if(speed)
- {
- forward <<= 1;
- }
- }
- if(i_ExternData->angleTurn)
- {
- if(strafe)
- {
- side += i_ExternData->angleTurn;
- }
- else
- {
- cmd->angleturn += i_ExternData->angleTurn;
- }
- }
- if(i_ExternData->moveSideways)
- {
- side += i_ExternData->moveSideways;
- if(speed)
- {
- side <<= 1;
- }
- }
- if(i_ExternData->pitch)
- {
- angleDelta = i_ExternData->pitch-oldAngle;
- if(abs(angleDelta < 14))
- {
- look = angleDelta/2;
- }
- else
- {
- look = 7*(angleDelta > 0 ? 1 : -1);
- }
- if(look == TOCENTER)
- {
- look++;
- }
- oldAngle += look;
- }
- if(i_ExternData->flyDirection)
- {
- if(i_ExternData->flyDirection > 0)
- {
- flyheight = 5;
- }
- else
- {
- flyheight = -5;
- }
- }
- if(abs(newViewAngleOff-i_ExternData->angleHead) < 3000)
- {
- newViewAngleOff = i_ExternData->angleHead;
- }
- if(i_ExternData->buttons&EBT_FIRE)
- {
- cmd->buttons |= BT_ATTACK;
- }
- if(i_ExternData->buttons&EBT_OPENDOOR)
- {
- cmd->buttons |= BT_USE;
- }
- if(i_ExternData->buttons&EBT_PAUSE)
- {
- sendpause ^= 1;
- }
- if(externInvKey&EBT_USEARTIFACT)
- {
- ev.type = ev_keyup;
- ev.data1 = key_useartifact;
- D_PostEvent(&ev);
- externInvKey &= ~EBT_USEARTIFACT;
- }
- else if(i_ExternData->buttons&EBT_USEARTIFACT)
- {
- externInvKey |= EBT_USEARTIFACT;
- ev.type = ev_keydown;
- ev.data1 = key_useartifact;
- D_PostEvent(&ev);
- }
- if(externInvKey&EBT_INVENTORYRIGHT)
- {
- ev.type = ev_keyup;
- ev.data1 = key_invright;
- D_PostEvent(&ev);
- externInvKey &= ~EBT_INVENTORYRIGHT;
- }
- else if(i_ExternData->buttons&EBT_INVENTORYRIGHT)
- {
- externInvKey |= EBT_INVENTORYRIGHT;
- ev.type = ev_keydown;
- ev.data1 = key_invright;
- D_PostEvent(&ev);
- }
- if(externInvKey&EBT_INVENTORYLEFT)
- {
- ev.type = ev_keyup;
- ev.data1 = key_invleft;
- D_PostEvent(&ev);
- externInvKey &= ~EBT_INVENTORYLEFT;
- }
- else if(i_ExternData->buttons&EBT_INVENTORYLEFT)
- {
- externInvKey |= EBT_INVENTORYLEFT;
- ev.type = ev_keydown;
- ev.data1 = key_invleft;
- D_PostEvent(&ev);
- }
- if(i_ExternData->buttons&EBT_FLYDROP)
- {
- flyheight = TOCENTER;
- }
- if(i_ExternData->buttons&EBT_MAP && gamestate == GS_LEVEL)
- {
- if(automapactive)
- {
- AM_Stop();
- }
- else
- {
- AM_Start();
- }
- }
- }
-#endif
-
- // Fly up/down/drop keys
- if(gamekeydown[key_flyup])
- {
- flyheight = 5; // note that the actual flyheight will be twice this
- }
- if(gamekeydown[key_flydown])
- {
- flyheight = -5;
- }
- if(gamekeydown[key_flycenter])
- {
- flyheight = TOCENTER;
- look = TOCENTER;
- }
-
- // Use artifact key
- if(gamekeydown[key_useartifact])
- {
- if(gamekeydown[key_speed] && !noartiskip)
- {
- if(players[consoleplayer].inventory[inv_ptr].type != arti_none)
- {
- gamekeydown[key_useartifact] = false;
- cmd->arti = 0xff; // skip artifact code
- }
- }
- else
- {
- if(inventory)
- {
- players[consoleplayer].readyArtifact =
- players[consoleplayer].inventory[inv_ptr].type;
- inventory = false;
- cmd->arti = 0;
- usearti = false;
- }
- else if(usearti)
- {
- cmd->arti = players[consoleplayer].inventory[inv_ptr].type;
- usearti = false;
- }
- }
- }
- if(gamekeydown[127] && !cmd->arti
- && !players[consoleplayer].powers[pw_weaponlevel2])
- {
- gamekeydown[127] = false;
- cmd->arti = arti_tomeofpower;
- }
-
-//
-// buttons
-//
- cmd->chatchar = CT_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; // clear double clicks if hit use button
- }
-
- for(i = 0; i < NUMWEAPONS-2; i++)
- {
- if(gamekeydown['1'+i])
- {
- cmd->buttons |= BT_CHANGE;
- cmd->buttons |= i<<BT_WEAPONSHIFT;
- break;
- }
- }
-
-//
-// mouse
-//
- if (mousebuttons[mousebforward])
- forward += forwardmove[speed];
-
-//
-// forward double click
-//
- if (mousebuttons[mousebforward] != dclickstate && dclicktime > 1 )
- {
- dclickstate = mousebuttons[mousebforward];
- if (dclickstate)
- dclicks++;
- if (dclicks == 2)
- {
- cmd->buttons |= BT_USE;
- dclicks = 0;
- }
- else
- dclicktime = 0;
- }
- else
- {
- dclicktime += ticdup;
- if (dclicktime > 20)
- {
- dclicks = 0;
- dclickstate = 0;
- }
- }
-
-//
-// strafe double click
-//
- bstrafe = mousebuttons[mousebstrafe]
-|| joybuttons[joybstrafe];
- if (bstrafe != dclickstate2 && dclicktime2 > 1 )
- {
- dclickstate2 = bstrafe;
- if (dclickstate2)
- dclicks2++;
- if (dclicks2 == 2)
- {
- cmd->buttons |= BT_USE;
- dclicks2 = 0;
- }
- else
- dclicktime2 = 0;
- }
- else
- {
- dclicktime2 += ticdup;
- if (dclicktime2 > 20)
- {
- dclicks2 = 0;
- dclickstate2 = 0;
- }
- }
-
- if (strafe)
- {
- side += mousex*2;
- }
- else
- {
- cmd->angleturn -= mousex*0x8;
- }
- forward += mousey;
- mousex = mousey = 0;
-
- if (forward > MAXPLMOVE)
- forward = MAXPLMOVE;
- else if (forward < -MAXPLMOVE)
- forward = -MAXPLMOVE;
- if (side > MAXPLMOVE)
- side = MAXPLMOVE;
- else if (side < -MAXPLMOVE)
- side = -MAXPLMOVE;
-
- cmd->forwardmove += forward;
- cmd->sidemove += side;
- if(players[consoleplayer].playerstate == PST_LIVE)
- {
- if(look < 0)
- {
- look += 16;
- }
- cmd->lookfly = look;
- }
- if(flyheight < 0)
- {
- flyheight += 16;
- }
- cmd->lookfly |= flyheight<<4;
-
-//
-// special buttons
-//
- if (sendpause)
- {
- sendpause = false;
- cmd->buttons = BT_SPECIAL | BTS_PAUSE;
- }
-
- if (sendsave)
- {
- sendsave = false;
- cmd->buttons = BT_SPECIAL | BTS_SAVEGAME | (savegameslot<<BTS_SAVESHIFT);
- }
-}
-
-
-/*
-==============
-=
-= G_DoLoadLevel
-=
-==============
-*/
-
-void G_DoLoadLevel (void)
-{
- int i;
-
- levelstarttic = gametic; // for time calculation
- 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; // view the guy you are playing
- starttime = I_GetTime ();
- gameaction = ga_nothing;
- Z_CheckHeap ();
-
-//
-// clear cmd building stuff
-//
-
- memset (gamekeydown, 0, sizeof(gamekeydown));
- joyxmove = joyymove = 0;
- mousex = mousey = 0;
- sendpause = sendsave = paused = false;
- memset (mousebuttons, 0, sizeof(mousebuttons));
- memset (joybuttons, 0, sizeof(joybuttons));
-}
-
-
-/*
-===============================================================================
-=
-= G_Responder
-=
-= get info needed to make ticcmd_ts for the players
-=
-===============================================================================
-*/
-
-boolean G_Responder(event_t *ev)
-{
- player_t *plr;
- extern boolean MenuActive;
-
- plr = &players[consoleplayer];
- if(ev->type == ev_keyup && ev->data1 == key_useartifact)
- { // flag to denote that it's okay to use an artifact
- if(!inventory)
- {
- plr->readyArtifact = plr->inventory[inv_ptr].type;
- }
- usearti = true;
- }
-
- // Check for spy mode player cycle
- if(gamestate == GS_LEVEL && ev->type == ev_keydown
- && ev->data1 == KEY_F12 && !deathmatch)
- { // Cycle the display player
- do
- {
- displayplayer++;
- if(displayplayer == MAXPLAYERS)
- {
- displayplayer = 0;
- }
- } while(!playeringame[displayplayer]
- && displayplayer != consoleplayer);
- return(true);
- }
-
- if(gamestate == GS_LEVEL)
- {
- if(CT_Responder(ev))
- { // Chat ate the event
- return(true);
- }
- if(SB_Responder(ev))
- { // Status bar ate the event
- return(true);
- }
- if(AM_Responder(ev))
- { // Automap ate the event
- return(true);
- }
- }
-
- switch(ev->type)
- {
- case ev_keydown:
- if(ev->data1 == key_invleft)
- {
- inventoryTics = 5*35;
- if(!inventory)
- {
- inventory = true;
- break;
- }
- inv_ptr--;
- if(inv_ptr < 0)
- {
- inv_ptr = 0;
- }
- else
- {
- curpos--;
- if(curpos < 0)
- {
- curpos = 0;
- }
- }
- return(true);
- }
- if(ev->data1 == key_invright)
- {
- inventoryTics = 5*35;
- if(!inventory)
- {
- inventory = true;
- break;
- }
- inv_ptr++;
- if(inv_ptr >= plr->inventorySlotNum)
- {
- inv_ptr--;
- if(inv_ptr < 0)
- inv_ptr = 0;
- }
- else
- {
- curpos++;
- if(curpos > 6)
- {
- curpos = 6;
- }
- }
- return(true);
- }
- if(ev->data1 == KEY_PAUSE && !MenuActive)
- {
- sendpause = true;
- return(true);
- }
- if(ev->data1 < NUMKEYS)
- {
- gamekeydown[ev->data1] = true;
- }
- return(true); // eat key down events
-
- case ev_keyup:
- if(ev->data1 < NUMKEYS)
- {
- gamekeydown[ev->data1] = false;
- }
- return(false); // always let key up events filter down
-
- case ev_mouse:
- mousebuttons[0] = ev->data1&1;
- mousebuttons[1] = ev->data1&2;
- mousebuttons[2] = ev->data1&4;
- mousex = ev->data2*(mouseSensitivity+5)/10;
- mousey = ev->data3*(mouseSensitivity+5)/10;
- return(true); // eat events
-
- case ev_joystick:
- joybuttons[0] = ev->data1&1;
- joybuttons[1] = ev->data1&2;
- joybuttons[2] = ev->data1&4;
- joybuttons[3] = ev->data1&8;
- joyxmove = ev->data2;
- joyymove = ev->data3;
- return(true); // eat events
-
- default:
- break;
- }
- return(false);
-}
-
-/*
-===============================================================================
-=
-= G_Ticker
-=
-===============================================================================
-*/
-
-void G_Ticker (void)
-{
- int i, buf;
- ticcmd_t *cmd;
-
-//
-// do player reborns if needed
-//
- for (i=0 ; i<MAXPLAYERS ; i++)
- if (playeringame[i] && players[i].playerstate == PST_REBORN)
- G_DoReborn (i);
-
-//
-// do things to change the game state
-//
- while (gameaction != ga_nothing)
- {
- switch (gameaction)
- {
- case ga_loadlevel:
- G_DoLoadLevel ();
- break;
- case ga_newgame:
- G_DoNewGame ();
- break;
- case ga_loadgame:
- G_DoLoadGame ();
- break;
- case ga_savegame:
- G_DoSaveGame ();
- break;
- case ga_playdemo:
- G_DoPlayDemo ();
- break;
- case ga_screenshot:
- M_ScreenShot ();
- gameaction = ga_nothing;
- break;
- case ga_completed:
- G_DoCompleted ();
- break;
- case ga_worlddone:
- G_DoWorldDone();
- break;
- case ga_victory:
- F_StartFinale();
- break;
- default:
- break;
- }
- }
-
-
-//
-// get commands, check consistancy, and build new consistancy check
-//
- buf = gametic%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 (netgame && !(gametic%ticdup) )
- {
- if (gametic > BACKUPTICS
- && consistancy[i][buf] != cmd->consistancy)
- {
- I_Error ("consistency failure (%i should be %i)",cmd->consistancy, consistancy[i][buf]);
- }
- if (players[i].mo)
- consistancy[i][buf] = players[i].mo->x;
- else
- consistancy[i][buf] = rndindex;
- }
- }
-
-//
-// check for special buttons
-//
- for (i=0 ; i<MAXPLAYERS ; i++)
- if (playeringame[i])
- {
- if (players[i].cmd.buttons & BT_SPECIAL)
- {
- switch (players[i].cmd.buttons & BT_SPECIALMASK)
- {
- case BTS_PAUSE:
- paused ^= 1;
- if(paused)
- {
- S_PauseSound();
- }
- else
- {
- S_ResumeSound();
- }
- break;
-
- case BTS_SAVEGAME:
- if (!savedescription[0])
- {
- if(netgame)
- {
- strcpy (savedescription, "NET GAME");
- }
- else
- {
- strcpy(savedescription, "SAVE GAME");
- }
- }
- savegameslot =
- (players[i].cmd.buttons & BTS_SAVEMASK)>>BTS_SAVESHIFT;
- gameaction = ga_savegame;
- break;
- }
- }
- }
- // turn inventory off after a certain amount of time
- if(inventory && !(--inventoryTics))
- {
- players[consoleplayer].readyArtifact =
- players[consoleplayer].inventory[inv_ptr].type;
- inventory = false;
- cmd->arti = 0;
- }
-//
-// do main actions
-//
-//
-// do main actions
-//
- switch (gamestate)
- {
- case GS_LEVEL:
- P_Ticker ();
- SB_Ticker ();
- AM_Ticker ();
- CT_Ticker();
- break;
- case GS_INTERMISSION:
- IN_Ticker ();
- break;
- case GS_FINALE:
- F_Ticker();
- break;
- case GS_DEMOSCREEN:
- D_PageTicker ();
- break;
- }
-}
-
-
-/*
-==============================================================================
-
- PLAYER STRUCTURE FUNCTIONS
-
-also see P_SpawnPlayer in P_Things
-==============================================================================
-*/
-
-/*
-====================
-=
-= G_InitPlayer
-=
-= Called at the start
-= Called by the game initialization functions
-====================
-*/
-
-void G_InitPlayer (int player)
-{
- player_t *p;
-
-// set up the saved info
- p = &players[player];
-
-// clear everything else to defaults
- G_PlayerReborn (player);
-
-}
-
-
-/*
-====================
-=
-= G_PlayerFinishLevel
-=
-= Can when a player completes a level
-====================
-*/
-extern int curpos;
-extern int inv_ptr;
-extern int playerkeys;
-
-void G_PlayerFinishLevel(int player)
-{
- player_t *p;
- int i;
-
-/* // BIG HACK
- inv_ptr = 0;
- curpos = 0;
-*/
- // END HACK
- p = &players[player];
- for(i=0; i<p->inventorySlotNum; i++)
- {
- p->inventory[i].count = 1;
- }
- p->artifactCount = p->inventorySlotNum;
-
- if(!deathmatch)
- {
- for(i = 0; i < 16; i++)
- {
- P_PlayerUseArtifact(p, arti_fly);
- }
- }
- memset(p->powers, 0, sizeof(p->powers));
- memset(p->keys, 0, sizeof(p->keys));
- playerkeys = 0;
-// memset(p->inventory, 0, sizeof(p->inventory));
- if(p->chickenTics)
- {
- p->readyweapon = p->mo->special1; // Restore weapon
- p->chickenTics = 0;
- }
- p->messageTics = 0;
- p->lookdir = 0;
- p->mo->flags &= ~MF_SHADOW; // Remove invisibility
- p->extralight = 0; // Remove weapon flashes
- p->fixedcolormap = 0; // Remove torch
- p->damagecount = 0; // No palette changes
- p->bonuscount = 0;
- p->rain1 = NULL;
- p->rain2 = NULL;
- if(p == &players[consoleplayer])
- {
- SB_state = -1; // refresh the status bar
- }
-}
-
-/*
-====================
-=
-= G_PlayerReborn
-=
-= Called after a player dies
-= almost everything is cleared and initialized
-====================
-*/
-
-void G_PlayerReborn(int player)
-{
- player_t *p;
- int i;
- int frags[MAXPLAYERS];
- int killcount, itemcount, secretcount;
- boolean secret;
-
- secret = false;
- memcpy(frags, players[player].frags, sizeof(frags));
- killcount = players[player].killcount;
- itemcount = players[player].itemcount;
- secretcount = players[player].secretcount;
-
- p = &players[player];
- if(p->didsecret)
- {
- secret = true;
- }
- 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; // don't do anything immediately
- p->playerstate = PST_LIVE;
- p->health = MAXHEALTH;
- p->readyweapon = p->pendingweapon = wp_goldwand;
- p->weaponowned[wp_staff] = true;
- p->weaponowned[wp_goldwand] = true;
- p->messageTics = 0;
- p->lookdir = 0;
- p->ammo[am_goldwand] = 50;
- for(i = 0; i < NUMAMMO; i++)
- {
- p->maxammo[i] = maxammo[i];
- }
- if(gamemap == 9 || secret)
- {
- p->didsecret = true;
- }
- if(p == &players[consoleplayer])
- {
- SB_state = -1; // refresh the status bar
- }
-}
-
-/*
-====================
-=
-= G_CheckSpot
-=
-= Returns false if the player cannot be respawned at the given mapthing_t spot
-= because something is occupying it
-====================
-*/
-
-void P_SpawnPlayer (mapthing_t *mthing);
-
-boolean G_CheckSpot (int playernum, mapthing_t *mthing)
-{
- fixed_t x,y;
- subsector_t *ss;
- unsigned an;
- mobj_t *mo;
-
- x = mthing->x << FRACBITS;
- y = mthing->y << FRACBITS;
-
- players[playernum].mo->flags2 &= ~MF2_PASSMOBJ;
- if (!P_CheckPosition (players[playernum].mo, x, y) )
- {
- players[playernum].mo->flags2 |= MF2_PASSMOBJ;
- return false;
- }
- players[playernum].mo->flags2 |= MF2_PASSMOBJ;
-
-// spawn a teleport fog
- 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+TELEFOGHEIGHT
-, MT_TFOG);
-
- if (players[consoleplayer].viewz != 1)
- S_StartSound (mo, sfx_telept); // don't start sound on first frame
-
- return true;
-}
-
-/*
-====================
-=
-= G_DeathMatchSpawnPlayer
-=
-= Spawns a player at one of the random death match spots
-= called at level load and each death
-====================
-*/
-
-void G_DeathMatchSpawnPlayer (int playernum)
-{
- int i,j;
- int selections;
-
- 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;
- if (G_CheckSpot (playernum, &deathmatchstarts[i]) )
- {
- deathmatchstarts[i].type = playernum+1;
- P_SpawnPlayer (&deathmatchstarts[i]);
- return;
- }
- }
-
-// no good spot, so the player will probably get stuck
- P_SpawnPlayer (&playerstarts[playernum]);
-}
-
-/*
-====================
-=
-= G_DoReborn
-=
-====================
-*/
-
-void G_DoReborn (int playernum)
-{
- int i;
-
- if (G_CheckDemoStatus ())
- return;
- if (!netgame)
- gameaction = ga_loadlevel; // reload the level from scratch
- else
- { // respawn at the start
- players[playernum].mo->player = NULL; // dissasociate the corpse
-
- // spawn at random spot if in death match
- if (deathmatch)
- {
- G_DeathMatchSpawnPlayer (playernum);
- return;
- }
-
- if (G_CheckSpot (playernum, &playerstarts[playernum]) )
- {
- P_SpawnPlayer (&playerstarts[playernum]);
- return;
- }
- // try to spawn at one of the other players spots
- for (i=0 ; i<MAXPLAYERS ; i++)
- if (G_CheckSpot (playernum, &playerstarts[i]) )
- {
- playerstarts[i].type = playernum+1; // fake as other player
- P_SpawnPlayer (&playerstarts[i]);
- playerstarts[i].type = i+1; // restore
- return;
- }
- // he's going to be inside something. Too bad.
- P_SpawnPlayer (&playerstarts[playernum]);
- }
-}
-
-
-void G_ScreenShot (void)
-{
- gameaction = ga_screenshot;
-}
-
-
-/*
-====================
-=
-= G_DoCompleted
-=
-====================
-*/
-
-boolean secretexit;
-
-void G_ExitLevel (void)
-{
- secretexit = false;
- gameaction = ga_completed;
-}
-
-void G_SecretExitLevel (void)
-{
- secretexit = true;
- gameaction = ga_completed;
-}
-
-void G_DoCompleted(void)
-{
- int i;
- static int afterSecret[3] = { 7, 5, 5 };
-
- gameaction = ga_nothing;
- if(G_CheckDemoStatus())
- {
- return;
- }
- for(i = 0; i < MAXPLAYERS; i++)
- {
- if(playeringame[i])
- {
- G_PlayerFinishLevel(i);
- }
- }
- prevmap = gamemap;
- if(secretexit == true)
- {
- gamemap = 9;
- }
- else if(gamemap == 9)
- { // Finished secret level
- gamemap = afterSecret[gameepisode-1];
- }
- else if(gamemap == 8)
- {
- gameaction = ga_victory;
- return;
- }
- else
- {
- gamemap++;
- }
- gamestate = GS_INTERMISSION;
- IN_Start();
-}
-
-//============================================================================
-//
-// G_WorldDone
-//
-//============================================================================
-
-void G_WorldDone(void)
-{
- gameaction = ga_worlddone;
-}
-
-//============================================================================
-//
-// G_DoWorldDone
-//
-//============================================================================
-
-void G_DoWorldDone(void)
-{
- gamestate = GS_LEVEL;
- G_DoLoadLevel();
- gameaction = ga_nothing;
- viewactive = true;
-}
-
-//---------------------------------------------------------------------------
-//
-// PROC G_LoadGame
-//
-// Can be called by the startup code or the menu task.
-//
-//---------------------------------------------------------------------------
-
-char savename[256];
-
-void G_LoadGame(char *name)
-{
- strcpy(savename, name);
- gameaction = ga_loadgame;
-}
-
-//---------------------------------------------------------------------------
-//
-// PROC G_DoLoadGame
-//
-// Called by G_Ticker based on gameaction.
-//
-//---------------------------------------------------------------------------
-
-#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;
- // Skip the description field
- memset(vcheck, 0, sizeof(vcheck));
- sprintf(vcheck, "version %i", VERSION);
- if (strcmp (save_p, vcheck))
- { // Bad version
- return;
- }
- save_p += VERSIONSIZE;
- gameskill = *save_p++;
- gameepisode = *save_p++;
- gamemap = *save_p++;
- for(i = 0; i < MAXPLAYERS; i++)
- {
- playeringame[i] = *save_p++;
- }
- // Load a base level
- G_InitNew(gameskill, gameepisode, gamemap);
-
- // Create leveltime
- a = *save_p++;
- b = *save_p++;
- c = *save_p++;
- leveltime = (a<<16)+(b<<8)+c;
-
- // De-archive all the modifications
- P_UnArchivePlayers();
- P_UnArchiveWorld();
- P_UnArchiveThinkers();
- P_UnArchiveSpecials();
-
- if(*save_p != SAVE_GAME_TERMINATOR)
- { // Missing savegame termination marker
- I_Error("Bad savegame");
- }
- Z_Free(savebuffer);
-}
-
-//---------------------------------------------------------------------------
-//
-// PROC G_SaveGame
-//
-// Called by the menu task. <description> is a 24 byte text string.
-//
-//---------------------------------------------------------------------------
-
-void G_SaveGame(int slot, char *description)
-{
- savegameslot = slot;
- strcpy(savedescription, description);
- sendsave = true;
-}
-
-//---------------------------------------------------------------------------
-//
-// PROC G_DoSaveGame
-//
-// Called by G_Ticker based on gameaction.
-//
-//---------------------------------------------------------------------------
-
-void G_DoSaveGame(void)
-{
- char name[100];
- char name2[VERSIONSIZE];
- char *description;
- int length;
- int i;
-
- if(cdrom)
- {
- sprintf(name, SAVEGAMENAMECD"%d.hsg", savegameslot);
- }
- else
- {
- sprintf(name, SAVEGAMENAME"%d.hsg", savegameslot);
- }
- description = savedescription;
-
- // Allocate save game buffer
- save_p = savebuffer = Z_Malloc(SAVEGAMESIZE, PU_STATIC, NULL);
-
- 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;
- for(i = 0; i < MAXPLAYERS; i++)
- {
- *save_p++ = playeringame[i];
- }
- *save_p++ = leveltime>>16;
- *save_p++ = leveltime>>8;
- *save_p++ = leveltime;
-
- P_ArchivePlayers();
- P_ArchiveWorld();
- P_ArchiveThinkers();
- P_ArchiveSpecials();
-
- // Send a savegame termination marker
- *save_p++ = SAVE_GAME_TERMINATOR;
-
- length = save_p-savebuffer;
- if(length > SAVEGAMESIZE)
- {
- I_Error("Savegame buffer overrun");
- }
- M_WriteFile(name, savebuffer, length);
- gameaction = ga_nothing;
- savedescription[0] = 0;
- Z_Free(savebuffer);
- P_SetMessage(&players[consoleplayer], TXT_GAMESAVED, true);
-}
-
-/*
-====================
-=
-= G_InitNew
-=
-= Can be called by the startup code or the menu task
-= consoleplayer, displayplayer, playeringame[] should be set
-====================
-*/
-
-skill_t d_skill;
-int d_episode;
-int d_map;
-
-void G_DeferedInitNew (skill_t skill, int episode, int map)
-{
- d_skill = skill;
- d_episode = episode;
- d_map = map;
- gameaction = ga_newgame;
-}
-
-void G_DoNewGame (void)
-{
- G_InitNew (d_skill, d_episode, d_map);
- gameaction = ga_nothing;
-}
-
-extern int skytexture;
-
-void G_InitNew(skill_t skill, int episode, int map)
-{
- int i;
- int speed;
-
- if(paused)
- {
- paused = false;
- S_ResumeSound();
- }
- if(skill < sk_baby)
- skill = sk_baby;
- if(skill > sk_nightmare)
- skill = sk_nightmare;
- if(episode < 1)
- episode = 1;
- // Up to 9 episodes for testing
- if(episode > 9)
- episode = 9;
- if(map < 1)
- map = 1;
- if(map > 9)
- map = 9;
- M_ClearRandom();
- if(respawnparm)
- {
- respawnmonsters = true;
- }
- else
- {
- respawnmonsters = false;
- }
- // Set monster missile speeds
- speed = skill == sk_nightmare;
- for(i = 0; MonsterMissileInfo[i].type != -1; i++)
- {
- mobjinfo[MonsterMissileInfo[i].type].speed
- = MonsterMissileInfo[i].speed[speed]<<FRACBITS;
- }
- // Force players to be initialized upon first level load
- for(i = 0; i < MAXPLAYERS; i++)
- {
- players[i].playerstate = PST_REBORN;
- }
- // Set up a bunch of globals
- usergame = true; // will be set false if a demo
- paused = false;
- demorecording = false;
- demoplayback = false;
- viewactive = true;
- gameepisode = episode;
- gamemap = map;
- gameskill = skill;
- viewactive = true;
- BorderNeedRefresh = true;
-
- // Set the sky map
- switch(episode)
- {
- case 1:
- skytexture = R_TextureNumForName("SKY1");
- break;
- case 2:
- skytexture = R_TextureNumForName("SKY2");
- break;
- case 3:
- skytexture = R_TextureNumForName("SKY3");
- break;
- default:
- skytexture = R_TextureNumForName("SKY1");
- break;
- }
-
-//
-// give one null ticcmd_t
-//
-#if 0
- gametic = 0;
- maketic = 1;
- for (i=0 ; i<MAXPLAYERS ; i++)
- nettics[i] = 1; // one null event for this gametic
- memset (localcmds,0,sizeof(localcmds));
- memset (netcmds,0,sizeof(netcmds));
-#endif
- G_DoLoadLevel();
-}
-
-
-/*
-===============================================================================
-
- DEMO RECORDING
-
-===============================================================================
-*/
-
-#define DEMOMARKER 0x80
-
-void G_ReadDemoTiccmd (ticcmd_t *cmd)
-{
- if (*demo_p == DEMOMARKER)
- { // end of demo data stream
- G_CheckDemoStatus ();
- return;
- }
- cmd->forwardmove = ((signed char)*demo_p++);
- cmd->sidemove = ((signed char)*demo_p++);
- cmd->angleturn = ((unsigned char)*demo_p++)<<8;
- cmd->buttons = (unsigned char)*demo_p++;
- cmd->lookfly = (unsigned char)*demo_p++;
- cmd->arti = (unsigned char)*demo_p++;
-}
-
-void G_WriteDemoTiccmd (ticcmd_t *cmd)
-{
- if (gamekeydown['q']) // press q to end demo recording
- G_CheckDemoStatus ();
- *demo_p++ = cmd->forwardmove;
- *demo_p++ = cmd->sidemove;
- *demo_p++ = cmd->angleturn>>8;
- *demo_p++ = cmd->buttons;
- *demo_p++ = cmd->lookfly;
- *demo_p++ = cmd->arti;
- demo_p -= 6;
- G_ReadDemoTiccmd (cmd); // make SURE it is exactly the same
-}
-
-
-
-/*
-===================
-=
-= G_RecordDemo
-=
-===================
-*/
-
-void G_RecordDemo (skill_t skill, int numplayers, int episode, int map, char *name)
-{
- int i;
-
- G_InitNew (skill, episode, map);
- usergame = false;
- strcpy (demoname, name);
- strcat (demoname, ".lmp");
- demobuffer = demo_p = Z_Malloc (0x20000,PU_STATIC,NULL);
- *demo_p++ = skill;
- *demo_p++ = episode;
- *demo_p++ = map;
-
- for (i=0 ; i<MAXPLAYERS ; i++)
- *demo_p++ = playeringame[i];
-
- demorecording = true;
-}
-
-
-/*
-===================
-=
-= G_PlayDemo
-=
-===================
-*/
-
-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);
- skill = *demo_p++;
- episode = *demo_p++;
- map = *demo_p++;
-
- for (i=0 ; i<MAXPLAYERS ; i++)
- playeringame[i] = *demo_p++;
-
- precache = false; // don't spend a lot of time in loadlevel
- G_InitNew (skill, episode, map);
- precache = true;
- usergame = false;
- demoplayback = true;
-}
-
-
-/*
-===================
-=
-= G_TimeDemo
-=
-===================
-*/
-
-void G_TimeDemo (char *name)
-{
- skill_t skill;
- int episode, map;
-
- demobuffer = demo_p = W_CacheLumpName (name, PU_STATIC);
- skill = *demo_p++;
- episode = *demo_p++;
- map = *demo_p++;
- G_InitNew (skill, episode, map);
- usergame = false;
- demoplayback = true;
- timingdemo = true;
- singletics = true;
-}
-
-
-/*
-===================
-=
-= G_CheckDemoStatus
-=
-= Called after a death or level completion to allow demos to be cleaned up
-= 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;
- D_AdvanceDemo ();
- return true;
- }
-
- if (demorecording)
- {
- *demo_p++ = DEMOMARKER;
- M_WriteFile (demoname, demobuffer, demo_p - demobuffer);
- Z_Free (demobuffer);
- demorecording = false;
- I_Error ("Demo %s recorded",demoname);
- }
-
- return false;
-}
-
-
-
diff --git a/src/heretic/i_ibm_a.asm b/src/heretic/i_ibm_a.asm
deleted file mode 100644
index 06e5a9df..00000000
--- a/src/heretic/i_ibm_a.asm
+++ /dev/null
@@ -1,135 +0,0 @@
- .386
- .MODEL small
-
-.DATA
-
-
-
-.CODE
-
-IF 0
-#define PEL_WRITE_ADR 0x3c8
-#define PEL_READ_ADR 0x3c7
-#define PEL_DATA 0x3c9
-ENDIF
-
-;================
-;
-; I_DivException
-;
-;================
-
-PROC I_DivException_
-PUBLIC I_DivException_
- mov edx,03c9h
- mov al,63
- out dx,al
-
- mov ebx,0ffffffh
- mov eax,[ebx]
- retf
-ENDP
-
-;================
-;
-; I_SetDivException
-;
-;================
-
-PROC I_SetDivException_
-PUBLIC I_SetDivException_
- pusha
-
- mov eax,0212h
- mov ebx,0
- mov ecx,cs
- mov edx,OFFSET I_DivException_
- int 31h
- jnc good
-
- popa
- mov eax,0
- ret
-
-good:
- popa
- mov eax,1
- ret
-
-ENDP
-
-
-;================
-;
-; I_ReadJoystick
-;
-; Read the absolute joystick values
-; returns false if not connected
-;================
-
-.data
-
-_joystickx dd 0
-_joysticky dd 0
-PUBLIC _joystickx, _joysticky
-
-.code
-
-PROC I_ReadJoystick_
-PUBLIC I_ReadJoystick_
- pusha
- pushf ; state of interrupt flag
- cli
-
- mov dx,0201h
- in al,dx
- out dx,al ; Clear the resistors
-
- mov ah,1 ; Get masks into registers
- mov ch,2
-
- xor esi,esi ; Clear count registers
- xor edi,edi
- xor ebx,ebx ; Clear high byte of bx for later
-
- mov ebp,10000 ; joystick is disconnected if value is this big
-
-jloop:
- in al,dx ; Get bits indicating whether all are finished
-
- dec ebp ; Check bounding register
- jz bad ; We have a silly value - abort
-
- mov bl,al ; Duplicate the bits
- and bl,ah ; Mask off useless bits (in [xb])
- add esi,ebx ; Possibly increment count register
- mov cl,bl ; Save for testing later
-
- mov bl,al
- and bl,ch ; [yb]
- add edi,ebx
-
- add cl,bl
- jnz jloop ; If both bits were 0, drop out
-
-done:
- mov [_joystickx],esi
- shr edi,1 ; because 2s were added
- mov [_joysticky],edi
-
- popf ; restore interrupt flag
- popa
- mov eax,1 ; read was ok
- ret
-
-bad:
- popf ; restore interrupt flag
- popa
- xor eax, eax ; read was bad
- ret
-
-ENDP
-
-
-END
-
diff --git a/src/heretic/linear.asm b/src/heretic/linear.asm
deleted file mode 100644
index 0543f883..00000000
--- a/src/heretic/linear.asm
+++ /dev/null
@@ -1,258 +0,0 @@
- .386
- .MODEL small
- INCLUDE defs.inc
-
-
-;============================================================================
-;
-; unwound vertical scaling code
-;
-; eax light table pointer, 0 lowbyte overwritten
-; ebx all 0, low byte overwritten
-; ecx fractional step value
-; edx fractional scale value
-; esi start of source pixels
-; edi bottom pixel in screenbuffer to blit into
-;
-; ebx should be set to 0 0 0 dh to feed the pipeline
-;
-; The graphics wrap vertically at 128 pixels
-;============================================================================
-
-.DATA
-
-EXTRN _centery:DWORD
-
-SCALEDEFINE MACRO number
- dd vscale&number
-ENDM
-
- ALIGN 4
-scalecalls LABEL
-LINE = 0
-REPT SCREENHEIGHT+1
- SCALEDEFINE %LINE
-LINE = LINE+1
-ENDM
-
-
-;=================================
-
-
-.CODE
-
-;================
-;
-; R_DrawColumn
-;
-;================
-
-PROC R_DrawColumn_
-PUBLIC R_DrawColumn_
- PUSHR
-
- mov ebp,[_dc_yh]
- mov ebx,ebp
- mov edi,[_ylookup+ebx*4]
- mov ebx,[_dc_x]
- add edi,[_columnofs + ebx*4]
-
- mov eax,[_dc_yl]
- sub ebp,eax ; ebp = pixel count
- or ebp,ebp
- js done
-
- mov ecx,[_dc_iscale]
-
- sub eax,[_centery]
- imul ecx
- mov edx,[_dc_texturemid]
- add edx,eax
- shl edx,9 ; 7 significant bits, 25 frac
-
- shl ecx,9 ; 7 significant bits, 25 frac
- mov esi,[_dc_source]
-
- mov eax,[_dc_colormap]
-
- xor ebx,ebx
- shld ebx,edx,7 ; get address of first location
- call [scalecalls+4+ebp*4]
-
-done:
- POPR
- ret
-
-;============ HIGH DETAIL ============
-
-SCALELABEL MACRO number
-vscale&number:
-ENDM
-
-LINE = SCREENHEIGHT
-REPT SCREENHEIGHT-1
- SCALELABEL %LINE
- mov al,[esi+ebx] ; get source pixel
- add edx,ecx ; calculate next location
- mov al,[eax] ; translate the color
-; xor ebx,ebx
-; shld ebx,edx,7 ; get address of next location
- mov ebx,edx
- shr ebx,25
- mov [edi-(LINE-1)*SCREENWIDTH],al ; draw a pixel to the buffer
-LINE = LINE-1
-ENDM
-vscale1:
- mov al,[esi+ebx]
- mov al,[eax]
- mov [edi],al
-vscale0:
- ret
-
-ENDP
-
-
-
-;============================================================================
-;
-; unwound horizontal texture mapping code
-;
-; eax lighttable
-; ebx scratch register
-; ecx position 6.10 bits x, 6.10 bits y
-; edx step 6.10 bits x, 6.10 bits y
-; esi start of block
-; edi dest
-; ebp fff to mask bx
-;
-; ebp should by preset from ebx / ecx before calling
-;============================================================================
-
-OP_SHLD = 0fh
-
-
-.DATA
-
-
-MAPDEFINE MACRO number
- dd hmap&number
-ENDM
-
- ALIGN 4
-mapcalls LABEL
-LINE = 0
-REPT SCREENWIDTH+1
- MAPDEFINE %LINE
-LINE = LINE+1
-ENDM
-
-
-callpoint dd 0
-returnpoint dd 0
-
-
-.CODE
-
-;================
-;
-; R_DrawSpan
-;
-; Horizontal texture mapping
-;
-;================
-
-
-PROC R_DrawSpan_
-PUBLIC R_DrawSpan_
- PUSHR
-
-IFE SKIPPRIMITIVES
-
- mov eax,[_ds_x1]
- mov ebx,[_ds_x2]
- mov eax,[mapcalls+eax*4]
- mov [callpoint],eax ; spot to jump into unwound
- mov eax,[mapcalls+4+ebx*4]
- mov [returnpoint],eax ; spot to patch a ret at
- mov BYTE PTR [eax], OP_RET
-
-;
-; build composite position
-;
- mov ecx,[_ds_xfrac]
- shl ecx,10
- and ecx,0ffff0000h
- mov eax,[_ds_yfrac]
- shr eax,6
- and eax,0ffffh
- or ecx,eax
-
-;
-; build composite step
-;
- mov edx,[_ds_xstep]
- shl edx,10
- and edx,0ffff0000h
- mov eax,[_ds_ystep]
- shr eax,6
- and eax,0ffffh
- or edx,eax
-
- mov esi,[_ds_source]
-
- mov edi,[_ds_y]
- mov edi,[_ylookup+edi*4]
- add edi,[_columnofs]
-
- mov eax,[_ds_colormap]
-
-;
-; feed the pipeline and jump in
-;
- mov ebp,0fffh ; used to mask off slop high bits from position
- shld ebx,ecx,22 ; shift y units in
- shld ebx,ecx,6 ; shift x units in
- and ebx,ebp ; mask off slop bits
- call [callpoint]
-
- mov ebx,[returnpoint]
- mov BYTE PTR [ebx],OP_MOVAL ; remove the ret patched in
-
-ENDIF
- POPR
- ret
-
-
-;============= HIGH DETAIL ============
-
-.CODE
-
-MAPLABEL MACRO number
-hmap&number:
-ENDM
-
-LINE = 0
-PCOL = 0
-REPT SCREENWIDTH/4
-PLANE = 0
-REPT 4
- MAPLABEL %LINE
-LINE = LINE + 1
-
- mov al,[esi+ebx] ; get source pixel
- shld ebx,ecx,22 ; shift y units in
- shld ebx,ecx,6 ; shift x units in
- mov al,[eax] ; translate color
- and ebx,ebp ; mask off slop bits
- add ecx,edx ; position += step
- mov [edi+PLANE+PCOL*4],al ; write pixel
-PLANE = PLANE + 1
-ENDM
-PCOL = PCOL + 1
-ENDM
-hmap320:
- ret
-
-ENDP
-
-END
diff --git a/src/heretic/netold.c b/src/heretic/netold.c
deleted file mode 100644
index d58ac551..00000000
--- a/src/heretic/netold.c
+++ /dev/null
@@ -1,783 +0,0 @@
-// I_pcnet.m
-
-#include "DoomDef.h"
-#include "P_local.h"
-#include "soundst.h"
-
-#define NCMD_EXIT 0x80000000
-#define NCMD_RETRANSMIT 0x40000000
-#define NCMD_SETUP 0x20000000
-#define NCMD_KILL 0x10000000 // kill game
-#define NCMD_CHECKSUM 0x0fffffff
-
-
-doomcom_t *doomcom;
-doomdata_t *netbuffer; // points inside doomcom
-
-
-/*
-==============================================================================
-
- NETWORKING
-
-gametic is the tic about to (or currently being) run
-maketic is the tick that hasn't had control made for it yet
-nettics[] has the maketics for all players
-
-a gametic cannot be run until nettics[] > gametic for all players
-
-==============================================================================
-*/
-
-#define RESENDCOUNT 10
-#define PL_DRONE 0x80 // bit flag in doomdata->player
-
-ticcmd_t localcmds[BACKUPTICS];
-
-ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];
-int nettics[MAXNETNODES];
-boolean nodeingame[MAXNETNODES]; // set false as nodes leave game
-boolean remoteresend[MAXNETNODES]; // set when local needs tics
-int resendto[MAXNETNODES]; // set when remote needs tics
-int resendcount[MAXNETNODES];
-
-int nodeforplayer[MAXPLAYERS];
-
-int maketic;
-int lastnettic, skiptics;
-int ticdup;
-int maxsend; // BACKUPTICS/(2*ticdup)-1
-
-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 NeXT
- return 0; // byte order problems
-#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;
-}
-
-
-//============================================================================
-
-
-/*
-==============
-=
-= HSendPacket
-=
-==============
-*/
-
-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;
- int realretrans;
- if (netbuffer->checksum & NCMD_RETRANSMIT)
- 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 ();
-}
-
-/*
-==============
-=
-= HGetPacket
-=
-= Returns false if no packet is waiting
-=
-==============
-*/
-
-boolean HGetPacket (void)
-{
- if (reboundpacket)
- {
- *netbuffer = reboundstore;
- doomcom->remotenode = 0;
- 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
- {
- if (netbuffer->checksum & NCMD_RETRANSMIT)
- 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");
- }
-}
- return true;
-}
-
-
-/*
-===================
-=
-= GetPackets
-=
-===================
-*/
-
-char exitmsg[80];
-
-void GetPackets (void)
-{
- int netconsole;
- int netnode;
- ticcmd_t *src, *dest;
- int realend;
- int realstart;
-
- while (HGetPacket ())
- {
- if (netbuffer->checksum & NCMD_SETUP)
- continue; // extra setup packet
-
- netconsole = netbuffer->player & ~PL_DRONE;
- netnode = doomcom->remotenode;
- //
- // to save bytes, only the low byte of tic numbers are sent
- // Figure out what the rest of the bytes are
- //
- realstart = ExpandTics (netbuffer->starttic);
- realend = (realstart+netbuffer->numtics);
-
- //
- // check for exiting the game
- //
- if (netbuffer->checksum & NCMD_EXIT)
- {
- if (!nodeingame[netnode])
- continue;
- nodeingame[netnode] = false;
- playeringame[netconsole] = false;
- strcpy(exitmsg, "PLAYER 1 LEFT THE GAME");
- S_StartSound(NULL, sfx_chat);
- exitmsg[7] += netconsole;
- //players[consoleplayer].message = exitmsg;
- P_SetMessage(&players[consoleplayer], exitmsg, true);
-/* if (demorecording)
- G_CheckDemoStatus ();
-*/ // DEBUG
- continue;
- }
-
- //
- // check for a remote game kill
- //
- if (netbuffer->checksum & NCMD_KILL)
- I_Error ("Killed by network driver");
-
- nodeforplayer[netconsole] = netnode;
-
- //
- // check for retransmit request
- //
- if ( resendcount[netnode] <= 0
- && (netbuffer->checksum & NCMD_RETRANSMIT) )
- {
- resendto[netnode] = ExpandTics(netbuffer->retransmitfrom);
-if (debugfile)
-fprintf (debugfile,"retransmit from %i\n", resendto[netnode]);
- resendcount[netnode] = RESENDCOUNT;
- }
- else
- resendcount[netnode]--;
-
- //
- // check for out of order / duplicated packet
- //
- if (realend == nettics[netnode])
- continue;
-
- if (realend < nettics[netnode])
- {
-if (debugfile)
-fprintf (debugfile,"out of order packet (%i + %i)\n" ,realstart,netbuffer->numtics);
- continue;
- }
-
- //
- // check for a missed packet
- //
- if (realstart > nettics[netnode])
- {
- // stop processing until the other system resends the missed tics
-if (debugfile)
-fprintf (debugfile,"missed tics from %i (%i - %i)\n", netnode, realstart, nettics[netnode]);
- remoteresend[netnode] = true;
- continue;
- }
-
-//
-// update command store from the packet
-//
-{
- int start;
-
- remoteresend[netnode] = false;
-
- start = nettics[netnode] - realstart;
- src = &netbuffer->cmds[start];
-
- while (nettics[netnode] < realend)
- {
- dest = &netcmds[netconsole][nettics[netnode]%BACKUPTICS];
- nettics[netnode]++;
- *dest = *src;
- src++;
- }
- }
-}
-
-}
-
-/*
-=============
-=
-= NetUpdate
-=
-= Builds ticcmds for console player
-= sends out a packet
-=============
-*/
-
-int gametime;
-
-void NetUpdate (void)
-{
- int nowtime;
- int newtics;
- int i,j;
- int realstart;
- int gameticdiv;
-
-//
-// check time
-//
- nowtime = I_GetTime ()/ticdup;
- newtics = nowtime - gametime;
- gametime = nowtime;
-
- if (newtics <= 0) // nothing new to update
- goto listen;
-
- if (skiptics <= newtics)
- {
- newtics -= skiptics;
- skiptics = 0;
- }
- else
- {
- skiptics -= newtics;
- newtics = 0;
- }
-
-
- netbuffer->player = consoleplayer;
-
-//
-// build new ticcmds for console player
-//
- gameticdiv = gametic/ticdup;
- for (i=0 ; i<newtics ; i++)
- {
- I_StartTic ();
- D_ProcessEvents ();
- if (maketic - gameticdiv >= BACKUPTICS/2-1)
- break; // can't hold any more
-//printf ("mk:%i ",maketic);
- G_BuildTiccmd (&localcmds[maketic%BACKUPTICS]);
- maketic++;
- }
-
-
- if (singletics)
- return; // singletic update is syncronous
-
-//
-// send the packet to the other nodes
-//
- for (i=0 ; i<doomcom->numnodes ; i++)
- if (nodeingame[i])
- {
- netbuffer->starttic = realstart = resendto[i];
- 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];
- HSendPacket (i, NCMD_RETRANSMIT);
- }
- else
- {
- netbuffer->retransmitfrom = 0;
- HSendPacket (i, 0);
- }
- }
-
-//
-// listen for other packets
-//
-listen:
-
- GetPackets ();
-}
-
-
-/*
-=====================
-=
-= CheckAbort
-=
-=====================
-*/
-
-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) )
- {
- ev = &events[eventtail];
- if (ev->type == ev_keydown && ev->data1 == KEY_ESCAPE)
- I_Error ("Network game synchronization aborted.");
- }
-}
-
-/*
-=====================
-=
-= D_ArbitrateNetStart
-=
-=====================
-*/
-
-void D_ArbitrateNetStart (void)
-{
- int i;
- boolean gotinfo[MAXNETNODES];
-
- autostart = true;
- memset (gotinfo,0,sizeof(gotinfo));
-
- if (doomcom->consoleplayer)
- { // listen for setup info from key player
- while (1)
- {
- CheckAbort ();
- if (!HGetPacket ())
- continue;
- if (netbuffer->checksum & NCMD_SETUP)
- {
- if (netbuffer->player != VERSION)
- I_Error ("Different DOOM versions cannot play a net game!");
- startskill = netbuffer->retransmitfrom & 15;
- deathmatch = (netbuffer->retransmitfrom & 0xc0) >> 6;
- nomonsters = (netbuffer->retransmitfrom & 0x20) > 0;
- respawnparm = (netbuffer->retransmitfrom & 0x10) > 0;
- startmap = netbuffer->starttic & 0x3f;
- startepisode = netbuffer->starttic >> 6;
- return;
- }
- }
- }
- else
- { // key player, send the setup info
- do
- {
- CheckAbort ();
- for (i=0 ; i<doomcom->numnodes ; i++)
- {
- netbuffer->retransmitfrom = startskill;
- if (deathmatch)
- netbuffer->retransmitfrom |= (deathmatch<<6);
- if (nomonsters)
- netbuffer->retransmitfrom |= 0x20;
- if (respawnparm)
- netbuffer->retransmitfrom |= 0x10;
- netbuffer->starttic = startepisode * 64 + startmap;
- netbuffer->player = VERSION;
- netbuffer->numtics = 0;
- HSendPacket (i, NCMD_SETUP);
- }
-
-#if 1
- for(i = 10 ; i && HGetPacket(); --i)
- {
- if((netbuffer->player&0x7f) < MAXNETNODES)
- gotinfo[netbuffer->player&0x7f] = true;
- }
-#else
- while (HGetPacket ())
- {
- gotinfo[netbuffer->player&0x7f] = true;
- }
-#endif
-
- for (i=1 ; i<doomcom->numnodes ; i++)
- if (!gotinfo[i])
- break;
- } while (i < doomcom->numnodes);
- }
-}
-
-/*
-===================
-=
-= D_CheckNetGame
-=
-= Works out player numbers among the net participants
-===================
-*/
-
-extern int viewangleoffset;
-
-void D_CheckNetGame (void)
-{
- int i;
-
- for (i=0 ; i<MAXNETNODES ; i++)
- {
- nodeingame[i] = false;
- nettics[i] = 0;
- remoteresend[i] = false; // set when local needs tics
- resendto[i] = 0; // which tic to start sending
- }
-
-// I_InitNetwork sets doomcom and netgame
- 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);
-
-// read values out of doomcom
- ticdup = doomcom->ticdup;
- maxsend = BACKUPTICS/2-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);
-
-}
-
-/*
-==================
-=
-= D_QuitNetGame
-=
-= Called before quitting to leave a net game without hanging the
-= other players
-=
-==================
-*/
-
-void D_QuitNetGame (void)
-{
- int i, j;
-
- if (debugfile)
- fclose (debugfile);
-
- if (!netgame || !usergame || consoleplayer == -1 || demoplayback)
- return;
-
-// send a bunch of packets for security
- netbuffer->player = consoleplayer;
- netbuffer->numtics = 0;
- for (i=0 ; i<4 ; i++)
- {
- for (j=1 ; j<doomcom->numnodes ; j++)
- if (nodeingame[j])
- HSendPacket (j, NCMD_EXIT);
- I_WaitVBL (1);
- }
-}
-
-
-
-/*
-===============
-=
-= TryRunTics
-=
-===============
-*/
-
-int frametics[4], frameon;
-int frameskip[4];
-int oldnettics;
-extern boolean advancedemo;
-
-void TryRunTics (void)
-{
- int i;
- int lowtic;
- int entertic;
- static int oldentertics;
- int realtics, availabletics;
- int counts;
- int numplaying;
-
-//
-// get real tics
-//
- entertic = I_GetTime ()/ticdup;
- realtics = entertic - oldentertics;
- oldentertics = entertic;
-
-//
-// get available tics
-//
- NetUpdate ();
-
- lowtic = MAXINT;
- numplaying = 0;
- for (i=0 ; i<doomcom->numnodes ; i++)
- if (nodeingame[i])
- {
- numplaying++;
- if (nettics[i] < lowtic)
- lowtic = nettics[i];
- }
- availabletics = lowtic - gametic/ticdup;
-
-
-//
-// decide how many tics to run
-//
- 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)
- {
- //=============================================================================
- //
- // ideally nettics[0] should be 1 - 3 tics above lowtic
- // if we are consistantly slower, speed up time
- //
- for (i=0 ; i<MAXPLAYERS ; i++)
- if (playeringame[i])
- break;
- if (consoleplayer == i)
- { // the key player does not adapt
- }
- else
- {
- if (nettics[0] <= nettics[nodeforplayer[i]])
- {
- gametime--;
- // printf ("-");
- }
- frameskip[frameon&3] = (oldnettics > nettics[nodeforplayer[i]]);
- oldnettics = nettics[0];
- if (frameskip[0] && frameskip[1] && frameskip[2] && frameskip[3])
- {
- skiptics = 1;
- // printf ("+");
- }
- }
- //=============================================================================
- } // demoplayback
-
- //
- // wait for new tics if needed
- //
- 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");
-
- // don't stay in here forever -- give the menu a chance to work
- if (I_GetTime ()/ticdup - entertic >= 20)
- {
- MN_Ticker ();
- return;
- }
- }
-
-//
-// run the count * ticdup dics
-//
- while (counts--)
- {
- for (i=0 ; i<ticdup ; i++)
- {
- if (gametic/ticdup > lowtic)
- I_Error ("gametic>lowtic");
- if (advancedemo)
- D_DoAdvanceDemo ();
- MN_Ticker ();
- G_Ticker ();
- gametic++;
- //
- // modify command for duplicated tics
- //
- if (i != ticdup-1)
- {
- ticcmd_t *cmd;
- int buf;
- int j;
-
- buf = (gametic/ticdup)%BACKUPTICS;
- for (j=0 ; j<MAXPLAYERS ; j++)
- {
- cmd = &netcmds[j][buf];
- cmd->chatchar = 0;
- if (cmd->buttons & BT_SPECIAL)
- cmd->buttons = 0;
- }
- }
- }
- NetUpdate (); // check for new console commands
- }
-}
diff --git a/src/heretic/oldd_net.c b/src/heretic/oldd_net.c
deleted file mode 100644
index c4dd1bf9..00000000
--- a/src/heretic/oldd_net.c
+++ /dev/null
@@ -1,790 +0,0 @@
-// I_pcnet.m
-
-#include "DoomDef.h"
-
-#define NCMD_EXIT 0x80000000
-#define NCMD_RETRANSMIT 0x40000000
-#define NCMD_SETUP 0x20000000
-#define NCMD_CHECKSUM 0x0fffffff
-
-/*
-if more space needs to be crunched out of the protocol...
-
-1 drone
-2 player
-8 tic
-5 numtics
-
-#define NCMD_EXIT 0x80000000
-#define NCMD_RETRANSMIT 0x40000000 // a retransmit will have 0 tics
-#define NCMD_DRONE 0x20000000
-#define NCMD_PLAYER 0x18000000
-#define NCMD_PLAYERSHIFT 27
-#define NCMD_TIC 0x00ff0000
-#define NCMD_TICSHIFT 16
-#define NCMD_NUMTICS 0x0000ff00
-#define NCMD_NUMTICSSHIFT 8
-#define NCMD_CHECKSUM 0x000000ff
-
-*/
-
-
-
-
-
-doomcom_t *doomcom;
-doomdata_t *netbuffer; // points inside doomcom
-
-
-/*
-==============================================================================
-
- NETWORKING
-
-gametic is the tic about to (or currently being) run
-maketic is the tick that hasn't had control made for it yet
-nettics[] has the maketics for all players
-
-a gametic cannot be run until nettics[] > gametic for all players
-
-==============================================================================
-*/
-
-#define RESENDCOUNT 10
-#define PL_DRONE 0x80 // bit flag in doomdata->player
-
-ticcmd_t localcmds[BACKUPTICS];
-
-ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];
-int nettics[MAXNETNODES];
-boolean nodeingame[MAXNETNODES]; // set false as nodes leave game
-boolean remoteresend[MAXNETNODES]; // set when local needs tics
-int resendto[MAXNETNODES]; // set when remote needs tics
-int resendcount[MAXNETNODES];
-
-int nodeforplayer[MAXPLAYERS];
-
-int gametime;
-int maketic;
-int lastnettic, skiptics;
-int ticdup;
-
-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 NeXT
- return 0; // byte order problems
-#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;
-}
-
-
-//============================================================================
-
-
-/*
-==============
-=
-= HSendPacket
-=
-==============
-*/
-
-void HSendPacket (int node, int flags)
-{
- netbuffer->checksum = NetbufferChecksum () | flags;
-
- if (!node)
- {
- reboundstore = *netbuffer;
- reboundpacket = true;
- 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;
- int realretrans;
- if (netbuffer->checksum & NCMD_RETRANSMIT)
- 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 ();
-}
-
-/*
-==============
-=
-= HGetPacket
-=
-= Returns false if no packet is waiting
-=
-==============
-*/
-
-boolean HGetPacket (void)
-{
- if (reboundpacket)
- {
- *netbuffer = reboundstore;
- doomcom->remotenode = 0;
- reboundpacket = false;
- return true;
- }
-
- if (!netgame)
- 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
- {
- if (netbuffer->checksum & NCMD_RETRANSMIT)
- 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");
- }
-}
- return true;
-}
-
-
-/*
-===================
-=
-= GetPackets
-=
-===================
-*/
-
-char exitmsg[80];
-
-void GetPackets (void)
-{
- int netconsole;
- int netnode;
- int netdrone;
- int j;
- ticcmd_t *src, *dest;
- int dupedstart, dupedend;
- int skiptics;
- int realstart;
-
- while (HGetPacket ())
- {
- if (netbuffer->checksum & NCMD_SETUP)
- continue; // extra setup packet
-
- netdrone = netbuffer->player & PL_DRONE;
- netconsole = netbuffer->player & ~PL_DRONE;
- netnode = doomcom->remotenode;
- //
- // to save bytes, only the low byte of tic numbers are sent
- // Figure out what the rest of the bytes are
- //
- realstart = ExpandTics (netbuffer->starttic);
- dupedstart = realstart*doomcom->ticdup;
- dupedend = (realstart+netbuffer->numtics)*doomcom->ticdup;
-
- //
- // check for exiting the game
- //
- if (netbuffer->checksum & NCMD_EXIT)
- {
- if (!nodeingame[netnode])
- continue;
- nodeingame[netnode] = false;
- if (!netdrone)
- {
- playeringame[netconsole] = false;
- strcpy (exitmsg, "Player 1 left the game");
- exitmsg[7] += netconsole;
- players[consoleplayer].message = exitmsg;
- }
- continue;
- }
-
- //
- // drone packets are just notifications
- //
- if (netdrone)
- {
- nettics[netnode] = dupedend;
- continue;
- }
-
- nodeforplayer[netconsole] = netnode;
-
- //
- // check for retransmit request
- //
- if ( resendcount[netnode] <= 0
- && (netbuffer->checksum & NCMD_RETRANSMIT) )
- {
- resendto[netnode] = ExpandTics(netbuffer->retransmitfrom);
-if (debugfile)
-fprintf (debugfile,"retransmit from %i\n", resendto[netnode]);
- resendcount[netnode] = RESENDCOUNT;
- }
- else
- resendcount[netnode]--;
-
- //
- // check for out of order / duplicated packet
- //
- if (dupedend == nettics[netnode])
- continue;
-
- if (dupedend < nettics[netnode])
- {
-if (debugfile)
-fprintf (debugfile,"out of order packet (%i + %i)\n" ,realstart,netbuffer->numtics);
- continue;
- }
-
- //
- // check for a missed packet
- //
- if (dupedstart > nettics[netnode])
- {
- // stop processing until the other system resends the missed tics
-if (debugfile)
-fprintf (debugfile,"missed tics from %i (%i - %i)\n", netnode, dupedstart, nettics[netnode]);
- remoteresend[netnode] = true;
- continue;
- }
-
-//
-// update command store from the packet
-//
- remoteresend[netnode] = false;
-
- skiptics = nettics[netnode]/doomcom->ticdup - realstart;
- src = &netbuffer->cmds[skiptics];
-
- while (nettics[netnode] < dupedend)
- {
- for (j=0 ; j<doomcom->ticdup ; j++)
- {
- dest = &netcmds[netconsole][nettics[netnode]%BACKUPTICS];
- nettics[netnode]++;
- *dest = *src;
- src->chatchar = 0;
- if (src->buttons & BT_SPECIAL)
- src->buttons = 0;
- }
- src++;
- }
- }
-}
-
-/*
-=============
-=
-= NetUpdate
-=
-= Builds ticcmds for console player
-= sends out a packet
-=============
-*/
-
-void NetUpdate (void)
-{
- int nowtime;
- int newtics;
- int i,j;
- int gameticdiv;
- int realstart;
-
- if (singletics)
- return; // singletic update is syncronous
-
-//
-// check time
-//
- nowtime = I_GetTime ()/doomcom->ticdup;
- newtics = nowtime - gametime;
- gametime = nowtime;
- if (newtics <= 0) // nothing new to update
- goto listen;
-
- if (skiptics <= newtics)
- {
- newtics -= skiptics;
- skiptics = 0;
- }
- else
- {
- skiptics -= newtics;
- newtics = 0;
- }
-
-
- netbuffer->player = consoleplayer;
- if (doomcom->drone)
- netbuffer->player |= PL_DRONE;
-
-//
-// drone packets
-//
- if (doomcom->drone)
- {
- I_StartTic ();
- D_ProcessEvents ();
- goto sendit;
- }
-
-//
-// build new ticcmds for console player
-//
- gameticdiv = (gametic+doomcom->ticdup-1)/doomcom->ticdup;
- for (i=0 ; i<newtics ; i++)
- {
- I_StartTic ();
- D_ProcessEvents ();
- if (maketic - gameticdiv >= BACKUPTICS/2 /* /doomcom->ticdup */- 1)
- {
- newtics = i;
- break; // can't hold any more
- }
-//printf ("mk:%i ",maketic);
- G_BuildTiccmd (&localcmds[maketic%BACKUPTICS]);
- maketic++;
- }
-
-//
-// send the packet to the other nodes
-//
-sendit:
- for (i=0 ; i<doomcom->numnodes ; i++)
- if (nodeingame[i])
- {
- if (doomcom->drone)
- {
- netbuffer->starttic = realstart = maketic + BACKUPTICS/2;
- netbuffer->numtics = 0;
- }
- else
- {
- netbuffer->starttic = realstart = resendto[i];
- netbuffer->numtics = maketic - realstart;
- resendto[i] = maketic - doomcom->extratics;
- }
-
- if (netbuffer->numtics > BACKUPTICS)
- I_Error ("NetUpdate: netbuffer->numtics > BACKUPTICS");
-
- for (j=0 ; j< netbuffer->numtics ; j++)
- netbuffer->cmds[j] =
- localcmds[(realstart+j)%BACKUPTICS];
-
- if (remoteresend[i])
- {
- netbuffer->retransmitfrom = nettics[i]/doomcom->ticdup;
- HSendPacket (i, NCMD_RETRANSMIT);
- }
- else
- {
- netbuffer->retransmitfrom = 0;
- HSendPacket (i, 0);
- }
- }
-
-//
-// listen for other packets
-//
-listen:
-
- GetPackets ();
-}
-
-
-/*
-=====================
-=
-= CheckAbort
-=
-=====================
-*/
-
-void CheckAbort (void)
-{
- event_t *ev;
-
- I_WaitVBL(2);
-
- I_StartTic ();
- for ( ; eventtail != eventhead
- ; eventtail = (++eventtail)&(MAXEVENTS-1) )
- {
- ev = &events[eventtail];
- if (ev->type == ev_keydown && ev->data1 == KEY_ESCAPE)
- I_Error ("Network game synchronization aborted.");
- }
-}
-
-/*
-=====================
-=
-= D_ArbitrateNetStart
-=
-=====================
-*/
-
-void D_ArbitrateNetStart (void)
-{
- int i;
- boolean gotinfo[MAXNETNODES];
-
- autostart = true;
- memset (gotinfo,0,sizeof(gotinfo));
-
- if (doomcom->consoleplayer)
- { // listen for setup info from key player
- printf ("listening for network start info...\n");
- while (1)
- {
- CheckAbort ();
- if (!HGetPacket ())
- continue;
- if (netbuffer->checksum & NCMD_SETUP)
- {
- if (netbuffer->player != VERSION)
- I_Error ("Different DOOM versions cannot play a net game!");
- startskill = netbuffer->retransmitfrom & 15;
- deathmatch = (netbuffer->retransmitfrom & 0x80) > 0;
- nomonsters = (netbuffer->retransmitfrom & 0x40) > 0;
- respawnparm = (netbuffer->retransmitfrom & 0x20) > 0;
- startmap = netbuffer->starttic & 15;
- startepisode = netbuffer->starttic >> 4;
- return;
- }
- }
- }
- else
- { // key player, send the setup info
- printf ("sending network start info...\n");
- do
- {
- CheckAbort ();
- for (i=0 ; i<doomcom->numnodes ; i++)
- {
- netbuffer->retransmitfrom = startskill;
- if (deathmatch)
- netbuffer->retransmitfrom |= 0x80;
- if (nomonsters)
- netbuffer->retransmitfrom |= 0x40;
- if (respawnparm)
- netbuffer->retransmitfrom |= 0x20;
- netbuffer->starttic = startepisode * 16 + startmap;
- netbuffer->player = VERSION;
- netbuffer->numtics = 0;
- HSendPacket (i, NCMD_SETUP);
- }
-
- while (HGetPacket ())
- {
- gotinfo[netbuffer->player&0x7f] = true;
- }
-
- for (i=1 ; i<doomcom->numnodes ; i++)
- if (!gotinfo[i])
- break;
- } while (i < doomcom->numnodes);
- }
-}
-
-/*
-===================
-=
-= D_CheckNetGame
-=
-= Works out player numbers among the net participants
-===================
-*/
-
-extern int viewangleoffset;
-
-void D_CheckNetGame (void)
-{
- int i;
-
- for (i=0 ; i<MAXNETNODES ; i++)
- {
- nodeingame[i] = false;
- nettics[i] = 0;
- remoteresend[i] = false; // set when local needs tics
- resendto[i] = 0; // which tic to start sending
- }
-
-// I_InitNetwork sets doomcom and netgame
- 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);
-
-// read values out of doomcom
- ticdup = doomcom->ticdup;
-
- 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);
-
-}
-
-/*
-==================
-=
-= D_QuitNetGame
-=
-= Called before quitting to leave a net game without hanging the
-= other players
-=
-==================
-*/
-
-void D_QuitNetGame (void)
-{
- int i, j;
-
- if (debugfile)
- fclose (debugfile);
-
- if (!netgame || !usergame || consoleplayer == -1)
- return;
-
-// send a bunch of packets for security
- netbuffer->player = consoleplayer;
- if (doomcom->drone)
- netbuffer->player |= PL_DRONE;
- netbuffer->numtics = 0;
- for (i=0 ; i<4 ; i++)
- {
- for (j=1 ; j<doomcom->numnodes ; j++)
- if (nodeingame[j])
- HSendPacket (j, NCMD_EXIT);
- I_WaitVBL (1);
- }
-}
-
-
-
-/*
-===============
-=
-= TryRunTics
-=
-===============
-*/
-
-int frametics[4], frameon;
-int frameskip[4];
-int oldnettics;
-extern boolean advancedemo;
-
-void TryRunTics (void)
-{
- int i;
- int lowtic, nextlowest;
- int entertic;
- int static oldentertics;
- int realtics, availabletics;
- int counts;
- int numplaying;
-
-//
-// get real tics
-//
- entertic = I_GetTime ();
- realtics = entertic - oldentertics;
- oldentertics = entertic;
-
-//
-// get available tics
-//
- NetUpdate ();
-
- lowtic = nextlowest = MAXINT;
- numplaying = 0;
- for (i=0 ; i<doomcom->numnodes ; i++)
- if (nodeingame[i])
- {
- numplaying++;
- if (nettics[i] < lowtic)
- {
- nextlowest = lowtic;
- lowtic = nettics[i];
- }
- else if (nettics[i] < nextlowest)
- nextlowest = nettics[i];
- }
- availabletics = lowtic - gametic;
-
-
-//
-// decide how many tics to run
-//
- 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);
-
-//=============================================================================
-//
-// ideally nettics[0] should be 1 - 3 tics above lowtic
-// if we are consistantly slower, speed up time
-// drones should never hold up the other players
-//
- for (i=0 ; i<MAXPLAYERS ; i++)
- if (playeringame[i])
- break;
- if (consoleplayer == i)
- { // the key player does not adapt
- }
- else
- {
- if (nettics[0] <= nettics[nodeforplayer[i]])
- {
- gametime--;
-// printf ("-");
- }
- frameskip[frameon&3] = (oldnettics > nettics[nodeforplayer[i]]);
- oldnettics = nettics[0];
- if (frameskip[0] && frameskip[1] && frameskip[2] && frameskip[3])
- {
- skiptics = 1;
-// printf ("+");
- }
- }
-//=============================================================================
-
-//
-// wait for new tics if needed
-//
- while (lowtic < gametic + counts)
- {
-
- NetUpdate ();
- lowtic = MAXINT;
-
- for (i=0 ; i<doomcom->numnodes ; i++)
- if (nodeingame[i] && nettics[i] < lowtic)
- lowtic = nettics[i];
-
- if (lowtic < gametic)
- I_Error ("TryRunTics: lowtic < gametic");
-
- // don't stay in here forever -- give the menu a chance to work
- if (I_GetTime () - entertic >= 20)
- return;
- }
-
-
-//
-// run the tics
-//
- while (counts--)
- {
- G_Ticker ();
- NetUpdate (); // check for new console commands
- gametic++;
- }
-}
diff --git a/src/heretic/vgaview.h b/src/heretic/vgaview.h
deleted file mode 100644
index 52d2a0e4..00000000
--- a/src/heretic/vgaview.h
+++ /dev/null
@@ -1,24 +0,0 @@
-
-#import <appkit/appkit.h>
-
-#import "DoomDef.h"
-
-// a few globals
-extern byte *bytebuffer;
-
-
-@interface VGAView:View
-{
- id game;
- int nextpalette[256]; // color lookup table
- int *nextimage; // palette expanded and scaled
- unsigned scale;
- NXWindowDepth depth;
-}
-
-- updateView;
-- (unsigned)scale;
-- setPalette:(byte *)pal;
-- setScale:(int)newscale;
-
-@end
diff --git a/src/hexen/defs.inc b/src/hexen/defs.inc
deleted file mode 100644
index eb83dc27..00000000
--- a/src/hexen/defs.inc
+++ /dev/null
@@ -1,52 +0,0 @@
-SKIPPRIMITIVES = 0 ; set to 1 to skip unwound drawing
-
-
-SCREEN = 0a0000h
-SCREENWIDTH = 320
-SCREENHEIGHT = 200
-PLANEWIDTH = 80
-PLANESIZE = 80*200
-
-PEL_WRITE_ADR = 03c8h
-PEL_DATA = 03c9h
-
-SC_INDEX = 03C4h
-SC_MAPMASK = 2
-
-OP_RET = 0c3h
-OP_MOVAL = 08ah
-OP_MOVDEST = 088h
-
-
- .DATA
-
-EXTRN _dc_colormap:DWORD
-EXTRN _tinttable:DWORD
-EXTRN _dc_x:DWORD
-EXTRN _dc_yl:DWORD
-EXTRN _dc_yh:DWORD
-EXTRN _dc_iscale:DWORD
-EXTRN _dc_texturemid:DWORD
-EXTRN _dc_source:DWORD
-
-EXTRN _ylookup:DWORD
-EXTRN _columnofs:DWORD
-
-
-EXTRN _ds_y:DWORD
-EXTRN _ds_x1:DWORD
-EXTRN _ds_x2:DWORD
-EXTRN _ds_colormap:DWORD
-EXTRN _ds_xfrac:DWORD
-EXTRN _ds_yfrac:DWORD
-EXTRN _ds_xstep:DWORD
-EXTRN _ds_ystep:DWORD
-EXTRN _ds_source:DWORD
-
-PUSHR MACRO
- pushad
-ENDM
-
-POPR MACRO
- popad
-ENDM
diff --git a/src/hexen/drcoord.h b/src/hexen/drcoord.h
deleted file mode 100644
index 7ef9a22a..00000000
--- a/src/hexen/drcoord.h
+++ /dev/null
@@ -1,29 +0,0 @@
-
-//**************************************************************************
-//**
-//** DRCoord.h : Heretic 2 : Raven Software, Corp.
-//**
-//** $RCSfile: DRCoord.h,v $
-//** $Revision: 1.1 $
-//** $Date: 95/05/11 00:19:30 $
-//** $Author: bgokey $
-//**
-//**************************************************************************
-
-#import <appkit/appkit.h>
-
-@interface DRCoord:Object
-{
- id players_i;
- id console_i;
- id skill_i;
- id episode_i;
- id map_i;
-}
-
-- newGame: sender;
-- scale1: sender;
-- scale2: sender;
-- scale4: sender;
-
-@end
diff --git a/src/hexen/dstrings.h b/src/hexen/dstrings.h
deleted file mode 100644
index 982867b0..00000000
--- a/src/hexen/dstrings.h
+++ /dev/null
@@ -1,205 +0,0 @@
-
-//**************************************************************************
-//**
-//** DStrings.H
-//**
-//**************************************************************************
-
-// MN_menu.c ---------------------------------------------------------------
-
-#define PRESSKEY "press a key."
-#define PRESSYN "press y or n."
-#define TXT_PAUSED "PAUSED"
-#define QUITMSG "are you sure you want to\nquit this great game?"
-#define LOADNET "you can't do load while in a net game!\n\n"PRESSKEY
-#define QLOADNET "you can't quickload during a netgame!\n\n"PRESSKEY
-#define QSAVESPOT "you haven't picked a quicksave slot yet!\n\n"PRESSKEY
-#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 to dos.)"
-#define DETAILHI "High detail"
-#define DETAILLO "Low detail"
-#define GAMMALVL0 "Gamma correction OFF"
-#define GAMMALVL1 "Gamma correction level 1"
-#define GAMMALVL2 "Gamma correction level 2"
-#define GAMMALVL3 "Gamma correction level 3"
-#define GAMMALVL4 "Gamma correction level 4"
-#define EMPTYSTRING "empty slot"
-
-// P_inter.c ---------------------------------------------------------------
-
-// Keys
-
-#define TXT_GOTBLUEKEY "BLUE KEY"
-#define TXT_GOTYELLOWKEY "YELLOW KEY"
-#define TXT_GOTGREENKEY "GREEN KEY"
-
-// Artifacts
-
-#define TXT_ARTIHEALTH "QUARTZ FLASK"
-#define TXT_ARTIFLY "WINGS OF WRATH"
-#define TXT_ARTIINVULNERABILITY "RING OF INVINCIBILITY"
-#define TXT_ARTITOMEOFPOWER "TOME OF POWER"
-#define TXT_ARTIINVISIBILITY "SHADOWSPHERE"
-#define TXT_ARTIEGG "MORPH OVUM"
-#define TXT_ARTISUPERHEALTH "MYSTIC URN"
-#define TXT_ARTITORCH "TORCH"
-#define TXT_ARTIFIREBOMB "TIME BOMB OF THE ANCIENTS"
-#define TXT_ARTITELEPORT "CHAOS DEVICE"
-
-// Items
-
-#define TXT_ITEMHEALTH "CRYSTAL VIAL"
-#define TXT_ITEMBAGOFHOLDING "BAG OF HOLDING"
-#define TXT_ITEMSHIELD1 "SILVER SHIELD"
-#define TXT_ITEMSHIELD2 "ENCHANTED SHIELD"
-#define TXT_ITEMSUPERMAP "MAP SCROLL"
-
-// Ammo
-
-#define TXT_AMMOGOLDWAND1 "WAND CRYSTAL"
-#define TXT_AMMOGOLDWAND2 "CRYSTAL GEODE"
-#define TXT_AMMOMACE1 "MACE SPHERES"
-#define TXT_AMMOMACE2 "PILE OF MACE SPHERES"
-#define TXT_AMMOCROSSBOW1 "ETHEREAL ARROWS"
-#define TXT_AMMOCROSSBOW2 "QUIVER OF ETHEREAL ARROWS"
-#define TXT_AMMOBLASTER1 "CLAW ORB"
-#define TXT_AMMOBLASTER2 "ENERGY ORB"
-#define TXT_AMMOSKULLROD1 "LESSER RUNES"
-#define TXT_AMMOSKULLROD2 "GREATER RUNES"
-#define TXT_AMMOPHOENIXROD1 "FLAME ORB"
-#define TXT_AMMOPHOENIXROD2 "INFERNO ORB"
-
-// Weapons
-
-#define TXT_WPNMACE "FIREMACE"
-#define TXT_WPNCROSSBOW "ETHEREAL CROSSBOW"
-#define TXT_WPNBLASTER "DRAGON CLAW"
-#define TXT_WPNSKULLROD "HELLSTAFF"
-#define TXT_WPNPHOENIXROD "PHOENIX ROD"
-#define TXT_WPNGAUNTLETS "GAUNTLETS OF THE NECROMANCER"
-
-// SB_bar.c ----------------------------------------------------------------
-
-#define TXT_CHEATGODON "GOD MODE ON"
-#define TXT_CHEATGODOFF "GOD MODE OFF"
-#define TXT_CHEATNOCLIPON "NO CLIPPING ON"
-#define TXT_CHEATNOCLIPOFF "NO CLIPPING OFF"
-#define TXT_CHEATWEAPONS "ALL WEAPONS"
-#define TXT_CHEATFLIGHTON "FLIGHT ON"
-#define TXT_CHEATFLIGHTOFF "FLIGHT OFF"
-#define TXT_CHEATPOWERON "POWER ON"
-#define TXT_CHEATPOWEROFF "POWER OFF"
-#define TXT_CHEATHEALTH "FULL HEALTH"
-#define TXT_CHEATKEYS "ALL KEYS"
-#define TXT_CHEATSOUNDON "SOUND DEBUG ON"
-#define TXT_CHEATSOUNDOFF "SOUND DEBUG OFF"
-#define TXT_CHEATTICKERON "TICKER ON"
-#define TXT_CHEATTICKEROFF "TICKER OFF"
-#define TXT_CHEATARTIFACTS1 "CHOOSE AN ARTIFACT ( A - J )"
-#define TXT_CHEATARTIFACTS2 "HOW MANY ( 1 - 9 )"
-#define TXT_CHEATARTIFACTS3 "YOU GOT IT"
-#define TXT_CHEATARTIFACTSFAIL "BAD INPUT"
-#define TXT_CHEATWARP "LEVEL WARP"
-#define TXT_CHEATSCREENSHOT "SCREENSHOT"
-#define TXT_CHEATCHICKENON "CHICKEN ON"
-#define TXT_CHEATCHICKENOFF "CHICKEN OFF"
-#define TXT_CHEATMASSACRE "MASSACRE"
-#define TXT_CHEATIDDQD "TRYING TO CHEAT, EH? NOW YOU DIE!"
-#define TXT_CHEATIDKFA "CHEATER - YOU DON'T DESERVE WEAPONS"
-
-// P_doors.c ---------------------------------------------------------------
-
-#define TXT_NEEDBLUEKEY "YOU NEED A BLUE KEY TO OPEN THIS DOOR"
-#define TXT_NEEDGREENKEY "YOU NEED A GREEN KEY TO OPEN THIS DOOR"
-#define TXT_NEEDYELLOWKEY "YOU NEED A YELLOW KEY TO OPEN THIS DOOR"
-
-// G_game.c ----------------------------------------------------------------
-
-#define TXT_GAMESAVED "GAME SAVED"
-
-// M_misc.c ----------------------------------------------------------------
-
-#define HUSTR_CHATMACRO1 "I'm ready to kick butt!"
-#define HUSTR_CHATMACRO2 "I'm OK."
-#define HUSTR_CHATMACRO3 "I'm not looking too good!"
-#define HUSTR_CHATMACRO4 "Help!"
-#define HUSTR_CHATMACRO5 "You suck!"
-#define HUSTR_CHATMACRO6 "Next time, scumbag..."
-#define HUSTR_CHATMACRO7 "Come here!"
-#define HUSTR_CHATMACRO8 "I'll take care of it."
-#define HUSTR_CHATMACRO9 "Yes"
-#define HUSTR_CHATMACRO0 "No"
-
-// AM_map.c ----------------------------------------------------------------
-
-#define AMSTR_FOLLOWON "FOLLOW MODE ON"
-#define AMSTR_FOLLOWOFF "FOLLOW MODE OFF"
-
-// F_finale.c --------------------------------------------------------------
-
-#define E1TEXT "with the destruction of the iron\n"\
- "liches and their minions, the last\n"\
- "of the undead are cleared from this\n"\
- "plane of existence.\n\n"\
- "those creatures had to come from\n"\
- "somewhere, though, and you have the\n"\
- "sneaky suspicion that the fiery\n"\
- "portal of hell's maw opens onto\n"\
- "their home dimension.\n\n"\
- "to make sure that more undead\n"\
- "(or even worse things) don't come\n"\
- "through, you'll have to seal hell's\n"\
- "maw from the other side. of course\n"\
- "this means you may get stuck in a\n"\
- "very unfriendly world, but no one\n"\
- "ever said being a Heretic was easy!"
-
-#define E2TEXT "the mighty maulotaurs have proved\n"\
- "to be no match for you, and as\n"\
- "their steaming corpses slide to the\n"\
- "ground you feel a sense of grim\n"\
- "satisfaction that they have been\n"\
- "destroyed.\n\n"\
- "the gateways which they guarded\n"\
- "have opened, revealing what you\n"\
- "hope is the way home. but as you\n"\
- "step through, mocking laughter\n"\
- "rings in your ears.\n\n"\
- "was some other force controlling\n"\
- "the maulotaurs? could there be even\n"\
- "more horrific beings through this\n"\
- "gate? the sweep of a crystal dome\n"\
- "overhead where the sky should be is\n"\
- "certainly not a good sign...."
-
-#define E3TEXT "the death of d'sparil has loosed\n"\
- "the magical bonds holding his\n"\
- "creatures on this plane, their\n"\
- "dying screams overwhelming his own\n"\
- "cries of agony.\n\n"\
- "your oath of vengeance fulfilled,\n"\
- "you enter the portal to your own\n"\
- "world, mere moments before the dome\n"\
- "shatters into a million pieces.\n\n"\
- "but if d'sparil's power is broken\n"\
- "forever, why don't you feel safe?\n"\
- "was it that last shout just before\n"\
- "his death, the one that sounded\n"\
- "like a curse? or a summoning? you\n"\
- "can't really be sure, but it might\n"\
- "just have been a scream.\n\n"\
- "then again, what about the other\n"\
- "serpent riders?"
diff --git a/src/hexen/i_ibm_a.asm b/src/hexen/i_ibm_a.asm
deleted file mode 100644
index 8b548b5b..00000000
--- a/src/hexen/i_ibm_a.asm
+++ /dev/null
@@ -1,135 +0,0 @@
- .386
- .MODEL small
-
-.DATA
-
-
-
-.CODE
-
-IF 0
-#define PEL_WRITE_ADR 0x3c8
-#define PEL_READ_ADR 0x3c7
-#define PEL_DATA 0x3c9
-ENDIF
-
-;================
-;
-; I_DivException
-;
-;================
-
-PROC I_DivException_
-PUBLIC I_DivException_
- mov edx,03c9h
- mov al,63
- out dx,al
-
- mov ebx,0ffffffh
- mov eax,[ebx]
- retf
-ENDP
-
-;================
-;
-; I_SetDivException
-;
-;================
-
-PROC I_SetDivException_
-PUBLIC I_SetDivException_
- pusha
-
- mov eax,0212h
- mov ebx,0
- mov ecx,cs
- mov edx,OFFSET I_DivException_
- int 31h
- jnc good
-
- popa
- mov eax,0
- ret
-
-good:
- popa
- mov eax,1
- ret
-
-ENDP
-
-
-;================
-;
-; I_ReadJoystick
-;
-; Read the absolute joystick values
-; returns false if not connected
-;================
-
-.data
-
-_joystickx dd 0
-_joysticky dd 0
-PUBLIC _joystickx, _joysticky
-
-.code
-
-PROC I_ReadJoystick_
-PUBLIC I_ReadJoystick_
- pushad
- pushf ; state of interrupt flag
- cli
-
- mov dx,0201h
- in al,dx
- out dx,al ; Clear the resistors
-
- mov ah,1 ; Get masks into registers
- mov ch,2
-
- xor esi,esi ; Clear count registers
- xor edi,edi
- xor ebx,ebx ; Clear high byte of bx for later
-
- mov ebp,10000 ; joystick is disconnected if value is this big
-
-jloop:
- in al,dx ; Get bits indicating whether all are finished
-
- dec ebp ; Check bounding register
- jz bad ; We have a silly value - abort
-
- mov bl,al ; Duplicate the bits
- and bl,ah ; Mask off useless bits (in [xb])
- add esi,ebx ; Possibly increment count register
- mov cl,bl ; Save for testing later
-
- mov bl,al
- and bl,ch ; [yb]
- add edi,ebx
-
- add cl,bl
- jnz jloop ; If both bits were 0, drop out
-
-done:
- mov [_joystickx],esi
- shr edi,1 ; because 2s were added
- mov [_joysticky],edi
-
- popf ; restore interrupt flag
- popad
- mov eax,1 ; read was ok
- ret
-
-bad:
- popf ; restore interrupt flag
- popad
- xor eax, eax ; read was bad
- ret
-
-ENDP
-
-
-END
-
diff --git a/src/hexen/linear.asm b/src/hexen/linear.asm
deleted file mode 100644
index d57c0cfa..00000000
--- a/src/hexen/linear.asm
+++ /dev/null
@@ -1,349 +0,0 @@
- .386
- .MODEL small
- INCLUDE defs.inc
-
-
-;============================================================================
-;
-; unwound vertical scaling code
-;
-; eax light table pointer, 0 lowbyte overwritten
-; ebx all 0, low byte overwritten
-; ecx fractional step value
-; edx fractional scale value
-; esi start of source pixels
-; edi bottom pixel in screenbuffer to blit into
-;
-; ebx should be set to 0 0 0 dh to feed the pipeline
-;
-; The graphics wrap vertically at 128 pixels
-;============================================================================
-
-.DATA
-
-EXTRN _centery:DWORD
-
-SCALEDEFINE MACRO number
- dd vscale&number
-ENDM
-
- ALIGN 4
-scalecalls LABEL
-LINE = 0
-REPT SCREENHEIGHT+1
- SCALEDEFINE %LINE
-LINE = LINE+1
-ENDM
-
-FUZZSCALEDEFINE MACRO number
- dd fuzzvscale&number
-ENDM
-
- ALIGN 4
-fuzzscalecalls LABEL
-LINE = 0
-REPT SCREENHEIGHT+1
- FUZZSCALEDEFINE %LINE
-LINE = LINE+1
-ENDM
-
-calladdr dd ?
-
-;=================================
-
-
-.CODE
-
-;================
-;
-; R_DrawColumn
-;
-;================
-
-PROC R_DrawColumn_
-PUBLIC R_DrawColumn_
- PUSHR
-
- mov ebp,[_dc_yh]
- mov ebx,ebp
- mov edi,[_ylookup+ebx*4]
- mov ebx,[_dc_x]
- add edi,[_columnofs + ebx*4]
-
- mov eax,[_dc_yl]
- sub ebp,eax ; ebp = pixel count
- or ebp,ebp
- js done
-
- mov ecx,[_dc_iscale]
-
- sub eax,[_centery]
- imul ecx
- mov edx,[_dc_texturemid]
- add edx,eax
- shl edx,9 ; 7 significant bits, 25 frac
-
- shl ecx,9 ; 7 significant bits, 25 frac
- mov esi,[_dc_source]
-
- mov eax,[_dc_colormap]
-
- xor ebx,ebx
- shld ebx,edx,7 ; get address of first location
- call [scalecalls+4+ebp*4]
-
-done:
- POPR
- ret
-
-;============ HIGH DETAIL ============
-
-SCALELABEL MACRO number
-vscale&number:
-ENDM
-
-LINE = SCREENHEIGHT
-REPT SCREENHEIGHT-1
- SCALELABEL %LINE
- mov al,[esi+ebx] ; get source pixel
- add edx,ecx ; calculate next location
- mov al,[eax] ; translate the color
-; xor ebx,ebx
-; shld ebx,edx,7 ; get address of next location
- mov ebx,edx
- shr ebx,25
- mov [edi-(LINE-1)*SCREENWIDTH],al ; draw a pixel to the buffer
-LINE = LINE-1
-ENDM
-vscale1:
- mov al,[esi+ebx]
- mov al,[eax]
- mov [edi],al
-vscale0:
- ret
-
-ENDP
-
-
-;================
-;
-; R_DrawFuzz
-;
-;================
-
-PROC R_DrawFuzzColumn_
-PUBLIC R_DrawFuzzColumn_
- PUSHR
-
- mov ebp,[_dc_yh]
- mov ebx,ebp
- mov edi,[_ylookup+ebx*4]
- mov ebx,[_dc_x]
- add edi,[_columnofs + ebx*4]
-
- mov eax,[_dc_yl]
- sub ebp,eax ; ebp = pixel count
- or ebp,ebp
- js fuzzdone
-
- mov ecx,[_dc_iscale]
-
- sub eax,[_centery]
- imul ecx
- mov edx,[_dc_texturemid]
- add edx,eax
- shl edx,9 ; 7 significant bits, 25 frac
-
- shl ecx,9 ; 7 significant bits, 25 frac
- mov esi,[_dc_source]
- mov eax,[_dc_colormap]
- xor ebx,ebx
- shld ebx,edx,7 ;get address of first location
-
- mov ebp, [fuzzscalecalls+4+ebp*4]
- mov calladdr, ebp
- mov ebp, ecx
- xor ecx, ecx
-
- call [calladdr]
-
-fuzzdone:
- POPR
- ret
-
-
-FUZZSCALELABEL MACRO number
-fuzzvscale&number:
-ENDM
-
-LINE = SCREENHEIGHT
-REPT SCREENHEIGHT-1
- FUZZSCALELABEL %LINE
- mov al, byte ptr [esi+ebx] ; get source pixel
- add edx, ebp ; calculate next location
-
- mov cl, byte ptr [edi-(LINE-1)*SCREENWIDTH]
- mov ch, [eax]
- add ecx, [_tinttable]
- mov ebx, edx
- shr ebx, 25
- mov al, [ecx]
- mov [edi-(LINE-1)*SCREENWIDTH],al ; draw a pixel to the buffer
- xor ecx, ecx
-LINE = LINE-1
-ENDM
-fuzzvscale1:
- mov al,[esi+ebx]
- mov cl, byte ptr [edi-(LINE-1)*SCREENWIDTH]
- mov ch, [eax]
- add ecx, [_tinttable]
- mov al, [ecx]
- mov [edi],al
-fuzzvscale0:
- ret
-
-ENDP
-
-;============================================================================
-;
-; unwound horizontal texture mapping code
-;
-; eax lighttable
-; ebx scratch register
-; ecx position 6.10 bits x, 6.10 bits y
-; edx step 6.10 bits x, 6.10 bits y
-; esi start of block
-; edi dest
-; ebp fff to mask bx
-;
-; ebp should by preset from ebx / ecx before calling
-;============================================================================
-
-OP_SHLD = 0fh
-
-
-.DATA
-
-
-MAPDEFINE MACRO number
- dd hmap&number
-ENDM
-
- ALIGN 4
-mapcalls LABEL
-LINE = 0
-REPT SCREENWIDTH+1
- MAPDEFINE %LINE
-LINE = LINE+1
-ENDM
-
-
-callpoint dd 0
-returnpoint dd 0
-
-
-.CODE
-
-;================
-;
-; R_DrawSpan
-;
-; Horizontal texture mapping
-;
-;================
-
-
-PROC R_DrawSpan_
-PUBLIC R_DrawSpan_
- PUSHR
-
-IFE SKIPPRIMITIVES
-
- mov eax,[_ds_x1]
- mov ebx,[_ds_x2]
- mov eax,[mapcalls+eax*4]
- mov [callpoint],eax ; spot to jump into unwound
- mov eax,[mapcalls+4+ebx*4]
- mov [returnpoint],eax ; spot to patch a ret at
- mov BYTE PTR [eax], OP_RET
-
-;
-; build composite position
-;
- mov ecx,[_ds_xfrac]
- shl ecx,10
- and ecx,0ffff0000h
- mov eax,[_ds_yfrac]
- shr eax,6
- and eax,0ffffh
- or ecx,eax
-
-;
-; build composite step
-;
- mov edx,[_ds_xstep]
- shl edx,10
- and edx,0ffff0000h
- mov eax,[_ds_ystep]
- shr eax,6
- and eax,0ffffh
- or edx,eax
-
- mov esi,[_ds_source]
-
- mov edi,[_ds_y]
- mov edi,[_ylookup+edi*4]
- add edi,[_columnofs]
-
- mov eax,[_ds_colormap]
-
-;
-; feed the pipeline and jump in
-;
- mov ebp,0fffh ; used to mask off slop high bits from position
- shld ebx,ecx,22 ; shift y units in
- shld ebx,ecx,6 ; shift x units in
- and ebx,ebp ; mask off slop bits
- call [callpoint]
-
- mov ebx,[returnpoint]
- mov BYTE PTR [ebx],OP_MOVAL ; remove the ret patched in
-
-ENDIF
- POPR
- ret
-
-
-;============= HIGH DETAIL ============
-
-.CODE
-
-MAPLABEL MACRO number
-hmap&number:
-ENDM
-
-LINE = 0
-PCOL = 0
-REPT SCREENWIDTH/4
-PLANE = 0
-REPT 4
- MAPLABEL %LINE
-LINE = LINE + 1
-
- mov al,[esi+ebx] ; get source pixel
- shld ebx,ecx,22 ; shift y units in
- shld ebx,ecx,6 ; shift x units in
- mov al,[eax] ; translate color
- and ebx,ebp ; mask off slop bits
- add ecx,edx ; position += step
- mov [edi+PLANE+PCOL*4],al ; write pixel
-PLANE = PLANE + 1
-ENDM
-PCOL = PCOL + 1
-ENDM
-hmap320:
- ret
-
-ENDP
-
-END
diff --git a/src/hexen/oldd_net.c b/src/hexen/oldd_net.c
deleted file mode 100644
index 73bba9c1..00000000
--- a/src/hexen/oldd_net.c
+++ /dev/null
@@ -1,790 +0,0 @@
-// I_pcnet.m
-
-#include "DoomDef.h"
-
-#define NCMD_EXIT 0x80000000
-#define NCMD_RETRANSMIT 0x40000000
-#define NCMD_SETUP 0x20000000
-#define NCMD_CHECKSUM 0x0fffffff
-
-/*
-if more space needs to be crunched out of the protocol...
-
-1 drone
-2 player
-8 tic
-5 numtics
-
-#define NCMD_EXIT 0x80000000
-#define NCMD_RETRANSMIT 0x40000000 // a retransmit will have 0 tics
-#define NCMD_DRONE 0x20000000
-#define NCMD_PLAYER 0x18000000
-#define NCMD_PLAYERSHIFT 27
-#define NCMD_TIC 0x00ff0000
-#define NCMD_TICSHIFT 16
-#define NCMD_NUMTICS 0x0000ff00
-#define NCMD_NUMTICSSHIFT 8
-#define NCMD_CHECKSUM 0x000000ff
-
-*/
-
-
-
-
-
-doomcom_t *doomcom;
-doomdata_t *netbuffer; // points inside doomcom
-
-
-/*
-==============================================================================
-
- NETWORKING
-
-gametic is the tic about to (or currently being) run
-maketic is the tick that hasn't had control made for it yet
-nettics[] has the maketics for all players
-
-a gametic cannot be run until nettics[] > gametic for all players
-
-==============================================================================
-*/
-
-#define RESENDCOUNT 10
-#define PL_DRONE 0x80 // bit flag in doomdata->player
-
-ticcmd_t localcmds[BACKUPTICS];
-
-ticcmd_t netcmds[MAXPLAYERS][BACKUPTICS];
-int nettics[MAXNETNODES];
-boolean nodeingame[MAXNETNODES]; // set false as nodes leave game
-boolean remoteresend[MAXNETNODES]; // set when local needs tics
-int resendto[MAXNETNODES]; // set when remote needs tics
-int resendcount[MAXNETNODES];
-
-int nodeforplayer[MAXPLAYERS];
-
-int gametime;
-int maketic;
-int lastnettic, skiptics;
-int ticdup;
-
-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 NeXT
- return 0; // byte order problems
-#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;
-}
-
-
-//============================================================================
-
-
-/*
-==============
-=
-= HSendPacket
-=
-==============
-*/
-
-void HSendPacket (int node, int flags)
-{
- netbuffer->checksum = NetbufferChecksum () | flags;
-
- if (!node)
- {
- reboundstore = *netbuffer;
- reboundpacket = true;
- 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;
- int realretrans;
- if (netbuffer->checksum & NCMD_RETRANSMIT)
- 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 ();
-}
-
-/*
-==============
-=
-= HGetPacket
-=
-= Returns false if no packet is waiting
-=
-==============
-*/
-
-boolean HGetPacket (void)
-{
- if (reboundpacket)
- {
- *netbuffer = reboundstore;
- doomcom->remotenode = 0;
- reboundpacket = false;
- return true;
- }
-
- if (!netgame)
- 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
- {
- if (netbuffer->checksum & NCMD_RETRANSMIT)
- 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");
- }
-}
- return true;
-}
-
-
-/*
-===================
-=
-= GetPackets
-=
-===================
-*/
-
-char exitmsg[80];
-
-void GetPackets (void)
-{
- int netconsole;
- int netnode;
- int netdrone;
- int j;
- ticcmd_t *src, *dest;
- int dupedstart, dupedend;
- int skiptics;
- int realstart;
-
- while (HGetPacket ())
- {
- if (netbuffer->checksum & NCMD_SETUP)
- continue; // extra setup packet
-
- netdrone = netbuffer->player & PL_DRONE;
- netconsole = netbuffer->player & ~PL_DRONE;
- netnode = doomcom->remotenode;
- //
- // to save bytes, only the low byte of tic numbers are sent
- // Figure out what the rest of the bytes are
- //
- realstart = ExpandTics (netbuffer->starttic);
- dupedstart = realstart*doomcom->ticdup;
- dupedend = (realstart+netbuffer->numtics)*doomcom->ticdup;
-
- //
- // check for exiting the game
- //
- if (netbuffer->checksum & NCMD_EXIT)
- {
- if (!nodeingame[netnode])
- continue;
- nodeingame[netnode] = false;
- if (!netdrone)
- {
- playeringame[netconsole] = false;
- strcpy (exitmsg, "Player 1 left the game");
- exitmsg[7] += netconsole;
- players[consoleplayer].message = exitmsg;
- }
- continue;
- }
-
- //
- // drone packets are just notifications
- //
- if (netdrone)
- {
- nettics[netnode] = dupedend;
- continue;
- }
-
- nodeforplayer[netconsole] = netnode;
-
- //
- // check for retransmit request
- //
- if ( resendcount[netnode] <= 0
- && (netbuffer->checksum & NCMD_RETRANSMIT) )
- {
- resendto[netnode] = ExpandTics(netbuffer->retransmitfrom);
-if (debugfile)
-fprintf (debugfile,"retransmit from %i\n", resendto[netnode]);
- resendcount[netnode] = RESENDCOUNT;
- }
- else
- resendcount[netnode]--;
-
- //
- // check for out of order / duplicated packet
- //
- if (dupedend == nettics[netnode])
- continue;
-
- if (dupedend < nettics[netnode])
- {
-if (debugfile)
-fprintf (debugfile,"out of order packet (%i + %i)\n" ,realstart,netbuffer->numtics);
- continue;
- }
-
- //
- // check for a missed packet
- //
- if (dupedstart > nettics[netnode])
- {
- // stop processing until the other system resends the missed tics
-if (debugfile)
-fprintf (debugfile,"missed tics from %i (%i - %i)\n", netnode, dupedstart, nettics[netnode]);
- remoteresend[netnode] = true;
- continue;
- }
-
-//
-// update command store from the packet
-//
- remoteresend[netnode] = false;
-
- skiptics = nettics[netnode]/doomcom->ticdup - realstart;
- src = &netbuffer->cmds[skiptics];
-
- while (nettics[netnode] < dupedend)
- {
- for (j=0 ; j<doomcom->ticdup ; j++)
- {
- dest = &netcmds[netconsole][nettics[netnode]%BACKUPTICS];
- nettics[netnode]++;
- *dest = *src;
- src->chatchar = 0;
- if (src->buttons & BT_SPECIAL)
- src->buttons = 0;
- }
- src++;
- }
- }
-}
-
-/*
-=============
-=
-= NetUpdate
-=
-= Builds ticcmds for console player
-= sends out a packet
-=============
-*/
-
-void NetUpdate (void)
-{
- int nowtime;
- int newtics;
- int i,j;
- int gameticdiv;
- int realstart;
-
- if (singletics)
- return; // singletic update is syncronous
-
-//
-// check time
-//
- nowtime = I_GetTime ()/doomcom->ticdup;
- newtics = nowtime - gametime;
- gametime = nowtime;
- if (newtics <= 0) // nothing new to update
- goto listen;
-
- if (skiptics <= newtics)
- {
- newtics -= skiptics;
- skiptics = 0;
- }
- else
- {
- skiptics -= newtics;
- newtics = 0;
- }
-
-
- netbuffer->player = consoleplayer;
- if (doomcom->drone)
- netbuffer->player |= PL_DRONE;
-
-//
-// drone packets
-//
- if (doomcom->drone)
- {
- I_StartTic ();
- D_ProcessEvents ();
- goto sendit;
- }
-
-//
-// build new ticcmds for console player
-//
- gameticdiv = (gametic+doomcom->ticdup-1)/doomcom->ticdup;
- for (i=0 ; i<newtics ; i++)
- {
- I_StartTic ();
- D_ProcessEvents ();
- if (maketic - gameticdiv >= BACKUPTICS/2 /* /doomcom->ticdup */- 1)
- {
- newtics = i;
- break; // can't hold any more
- }
-//printf ("mk:%i ",maketic);
- G_BuildTiccmd (&localcmds[maketic%BACKUPTICS]);
- maketic++;
- }
-
-//
-// send the packet to the other nodes
-//
-sendit:
- for (i=0 ; i<doomcom->numnodes ; i++)
- if (nodeingame[i])
- {
- if (doomcom->drone)
- {
- netbuffer->starttic = realstart = maketic + BACKUPTICS/2;
- netbuffer->numtics = 0;
- }
- else
- {
- netbuffer->starttic = realstart = resendto[i];
- netbuffer->numtics = maketic - realstart;
- resendto[i] = maketic - doomcom->extratics;
- }
-
- if (netbuffer->numtics > BACKUPTICS)
- I_Error ("NetUpdate: netbuffer->numtics > BACKUPTICS");
-
- for (j=0 ; j< netbuffer->numtics ; j++)
- netbuffer->cmds[j] =
- localcmds[(realstart+j)%BACKUPTICS];
-
- if (remoteresend[i])
- {
- netbuffer->retransmitfrom = nettics[i]/doomcom->ticdup;
- HSendPacket (i, NCMD_RETRANSMIT);
- }
- else
- {
- netbuffer->retransmitfrom = 0;
- HSendPacket (i, 0);
- }
- }
-
-//
-// listen for other packets
-//
-listen:
-
- GetPackets ();
-}
-
-
-/*
-=====================
-=
-= CheckAbort
-=
-=====================
-*/
-
-void CheckAbort (void)
-{
- event_t *ev;
-
- I_WaitVBL(2);
-
- I_StartTic ();
- for ( ; eventtail != eventhead
- ; eventtail = (++eventtail)&(MAXEVENTS-1) )
- {
- ev = &events[eventtail];
- if (ev->type == ev_keydown && ev->data1 == KEY_ESCAPE)
- I_Error ("Network game synchronization aborted.");
- }
-}
-
-/*
-=====================
-=
-= D_ArbitrateNetStart
-=
-=====================
-*/
-
-void D_ArbitrateNetStart (void)
-{
- int i;
- boolean gotinfo[MAXNETNODES];
-
- autostart = true;
- memset (gotinfo,0,sizeof(gotinfo));
-
- if (doomcom->consoleplayer)
- { // listen for setup info from key player
- printf ("listening for network start info...\n");
- while (1)
- {
- CheckAbort ();
- if (!HGetPacket ())
- continue;
- if (netbuffer->checksum & NCMD_SETUP)
- {
- if (netbuffer->player != VERSION)
- I_Error ("Different DOOM versions cannot play a net game!");
- startskill = netbuffer->retransmitfrom & 15;
- deathmatch = (netbuffer->retransmitfrom & 0x80) > 0;
- nomonsters = (netbuffer->retransmitfrom & 0x40) > 0;
- respawnparm = (netbuffer->retransmitfrom & 0x20) > 0;
- startmap = netbuffer->starttic & 15;
- startepisode = netbuffer->starttic >> 4;
- return;
- }
- }
- }
- else
- { // key player, send the setup info
- printf ("sending network start info...\n");
- do
- {
- CheckAbort ();
- for (i=0 ; i<doomcom->numnodes ; i++)
- {
- netbuffer->retransmitfrom = startskill;
- if (deathmatch)
- netbuffer->retransmitfrom |= 0x80;
- if (nomonsters)
- netbuffer->retransmitfrom |= 0x40;
- if (respawnparm)
- netbuffer->retransmitfrom |= 0x20;
- netbuffer->starttic = startepisode * 16 + startmap;
- netbuffer->player = VERSION;
- netbuffer->numtics = 0;
- HSendPacket (i, NCMD_SETUP);
- }
-
- while (HGetPacket ())
- {
- gotinfo[netbuffer->player&0x7f] = true;
- }
-
- for (i=1 ; i<doomcom->numnodes ; i++)
- if (!gotinfo[i])
- break;
- } while (i < doomcom->numnodes);
- }
-}
-
-/*
-===================
-=
-= D_CheckNetGame
-=
-= Works out player numbers among the net participants
-===================
-*/
-
-extern int viewangleoffset;
-
-void D_CheckNetGame (void)
-{
- int i;
-
- for (i=0 ; i<MAXNETNODES ; i++)
- {
- nodeingame[i] = false;
- nettics[i] = 0;
- remoteresend[i] = false; // set when local needs tics
- resendto[i] = 0; // which tic to start sending
- }
-
-// I_InitNetwork sets doomcom and netgame
- 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);
-
-// read values out of doomcom
- ticdup = doomcom->ticdup;
-
- 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);
-
-}
-
-/*
-==================
-=
-= D_QuitNetGame
-=
-= Called before quitting to leave a net game without hanging the
-= other players
-=
-==================
-*/
-
-void D_QuitNetGame (void)
-{
- int i, j;
-
- if (debugfile)
- fclose (debugfile);
-
- if (!netgame || !usergame || consoleplayer == -1)
- return;
-
-// send a bunch of packets for security
- netbuffer->player = consoleplayer;
- if (doomcom->drone)
- netbuffer->player |= PL_DRONE;
- netbuffer->numtics = 0;
- for (i=0 ; i<4 ; i++)
- {
- for (j=1 ; j<doomcom->numnodes ; j++)
- if (nodeingame[j])
- HSendPacket (j, NCMD_EXIT);
- I_WaitVBL (1);
- }
-}
-
-
-
-/*
-===============
-=
-= TryRunTics
-=
-===============
-*/
-
-int frametics[4], frameon;
-int frameskip[4];
-int oldnettics;
-extern boolean advancedemo;
-
-void TryRunTics (void)
-{
- int i;
- int lowtic, nextlowest;
- int entertic;
- int static oldentertics;
- int realtics, availabletics;
- int counts;
- int numplaying;
-
-//
-// get real tics
-//
- entertic = I_GetTime ();
- realtics = entertic - oldentertics;
- oldentertics = entertic;
-
-//
-// get available tics
-//
- NetUpdate ();
-
- lowtic = nextlowest = MAXINT;
- numplaying = 0;
- for (i=0 ; i<doomcom->numnodes ; i++)
- if (nodeingame[i])
- {
- numplaying++;
- if (nettics[i] < lowtic)
- {
- nextlowest = lowtic;
- lowtic = nettics[i];
- }
- else if (nettics[i] < nextlowest)
- nextlowest = nettics[i];
- }
- availabletics = lowtic - gametic;
-
-
-//
-// decide how many tics to run
-//
- 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);
-
-//=============================================================================
-//
-// ideally nettics[0] should be 1 - 3 tics above lowtic
-// if we are consistantly slower, speed up time
-// drones should never hold up the other players
-//
- for (i=0 ; i<MAXPLAYERS ; i++)
- if (playeringame[i])
- break;
- if (consoleplayer == i)
- { // the key player does not adapt
- }
- else
- {
- if (nettics[0] <= nettics[nodeforplayer[i]])
- {
- gametime--;
-// printf ("-");
- }
- frameskip[frameon&3] = (oldnettics > nettics[nodeforplayer[i]]);
- oldnettics = nettics[0];
- if (frameskip[0] && frameskip[1] && frameskip[2] && frameskip[3])
- {
- skiptics = 1;
-// printf ("+");
- }
- }
-//=============================================================================
-
-//
-// wait for new tics if needed
-//
- while (lowtic < gametic + counts)
- {
-
- NetUpdate ();
- lowtic = MAXINT;
-
- for (i=0 ; i<doomcom->numnodes ; i++)
- if (nodeingame[i] && nettics[i] < lowtic)
- lowtic = nettics[i];
-
- if (lowtic < gametic)
- I_Error ("TryRunTics: lowtic < gametic");
-
- // don't stay in here forever -- give the menu a chance to work
- if (I_GetTime () - entertic >= 20)
- return;
- }
-
-
-//
-// run the tics
-//
- while (counts--)
- {
- G_Ticker ();
- NetUpdate (); // check for new console commands
- gametic++;
- }
-}
diff --git a/src/hexen/template.c b/src/hexen/template.c
deleted file mode 100644
index 358517bc..00000000
--- a/src/hexen/template.c
+++ /dev/null
@@ -1,32 +0,0 @@
-
-//**************************************************************************
-//**
-//** TEMPLATE.C
-//**
-//**************************************************************************
-
-// HEADER FILES ------------------------------------------------------------
-
-// MACROS ------------------------------------------------------------------
-
-// TYPES -------------------------------------------------------------------
-
-// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
-
-// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
-
-// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
-
-// EXTERNAL DATA DECLARATIONS ----------------------------------------------
-
-// PUBLIC DATA DEFINITIONS -------------------------------------------------
-
-// PRIVATE DATA DEFINITIONS ------------------------------------------------
-
-// CODE --------------------------------------------------------------------
-
-//==========================================================================
-//
-//
-//
-//==========================================================================
diff --git a/src/hexen/vgaview.h b/src/hexen/vgaview.h
deleted file mode 100644
index b880833b..00000000
--- a/src/hexen/vgaview.h
+++ /dev/null
@@ -1,34 +0,0 @@
-
-//**************************************************************************
-//**
-//** VGAView.h : Heretic 2 : Raven Software, Corp.
-//**
-//** $RCSfile: VGAView.h,v $
-//** $Revision: 1.1 $
-//** $Date: 95/05/11 00:19:48 $
-//** $Author: bgokey $
-//**
-//**************************************************************************
-
-#import <appkit/appkit.h>
-#import "h2def.h"
-
-// a few globals
-extern byte *bytebuffer;
-
-
-@interface VGAView:View
-{
- id game;
- int nextpalette[256]; // color lookup table
- int *nextimage; // palette expanded and scaled
- unsigned scale;
- NXWindowDepth depth;
-}
-
-- updateView;
-- (unsigned)scale;
-- setPalette:(byte *)pal;
-- setScale:(int)newscale;
-
-@end