Commit 9fb3c204 authored by Steven Fuller's avatar Steven Fuller

Forgot about id_us

parent 753697b6
......@@ -4,9 +4,9 @@ CFLAGS = -g -DUSEVGA
#CFLAGS = -g -Wall -DUSEVGA -DDEBUG
#CFLAGS = -g -DUSEVGA -DDEBUG
#CFLAGS = -g -pg -DDEBUG
OBJS = objs.o misc.o id_ca.o id_in.o id_sd.o id_vl.o id_vh.o wl_scale.o \
wl_draw.o wl_act1.o wl_act2.o wl_agent.o wl_game.o wl_inter.o \
wl_menu.o wl_play.o wl_state.o wl_main.o wl_debug.o
OBJS = objs.o misc.o id_ca.o id_in.o id_sd.o id_vl.o id_vh.o id_us.o \
wl_scale.o wl_draw.o wl_act1.o wl_act2.o wl_agent.o wl_game.o \
wl_inter.o wl_menu.o wl_play.o wl_state.o wl_main.o wl_debug.o
#LFLAGS = -lm -lvga -pg
LFLAGS = -lm -lvga
......
//
// ID Engine
// ID_US_1.c - User Manager - General routines
// v1.1d1
// By Jason Blochowiak
// Hacked up for Catacomb 3D
//
//
// This module handles dealing with user input & feedback
//
// Depends on: Input Mgr, View Mgr, some variables from the Sound, Caching,
// and Refresh Mgrs, Memory Mgr for background save/restore
//
// Globals:
// ingame - Flag set by game indicating if a game is in progress
// abortgame - Flag set if the current game should be aborted (if a load
// game fails)
// loadedgame - Flag set if a game was loaded
// abortprogram - Normally nil, this points to a terminal error message
// if the program needs to abort
// restartgame - Normally set to gd_Continue, this is set to one of the
// difficulty levels if a new game should be started
// PrintX, PrintY - Where the User Mgr will print (global coords)
// WindowX,WindowY,WindowW,WindowH - The dimensions of the current
// window
//
#include "ID_HEADS.H"
#pragma hdrstop
#pragma warn -pia
/* id_us.c */
#include "id_heads.h"
// Global variables
char *abortprogram;
......@@ -50,8 +19,8 @@ static boolean US_Started;
CursorBad;
int CursorX,CursorY;
void (*USL_MeasureString)(char far *,word *,word *) = VW_MeasurePropString,
(*USL_DrawString)(char far *) = VWB_DrawPropString;
void (*USL_MeasureString)(char *,word *,word *) = VW_MeasurePropString,
(*USL_DrawString)(char *) = VWB_DrawPropString;
SaveGame Games[MaxSaveGames];
HighScore Scores[MaxScores] =
......@@ -69,112 +38,18 @@ static boolean US_Started;
// Public routines
///////////////////////////////////////////////////////////////////////////
//
// USL_HardError() - Handles the Abort/Retry/Fail sort of errors passed
// from DOS.
//
///////////////////////////////////////////////////////////////////////////
#pragma warn -par
#pragma warn -rch
int
USL_HardError(word errval,int ax,int bp,int si)
{
#define IGNORE 0
#define RETRY 1
#define ABORT 2
extern void ShutdownId(void);
static char buf[32];
static WindowRec wr;
int di;
char c,*s,*t;
di = _DI;
if (ax < 0)
s = "Device Error";
else
{
if ((di & 0x00ff) == 0)
s = "Drive ~ is Write Protected";
else
s = "Error on Drive ~";
for (t = buf;*s;s++,t++) // Can't use sprintf()
if ((*t = *s) == '~')
*t = (ax & 0x00ff) + 'A';
*t = '\0';
s = buf;
}
c = peekb(0x40,0x49); // Get the current screen mode
if ((c < 4) || (c == 7))
goto oh_kill_me;
// DEBUG - handle screen cleanup
US_SaveWindow(&wr);
US_CenterWindow(30,3);
US_CPrint(s);
US_CPrint("(R)etry or (A)bort?");
VW_UpdateScreen();
IN_ClearKeysDown();
asm sti // Let the keyboard interrupts come through
while (true)
{
switch (IN_WaitForASCII())
{
case key_Escape:
case 'a':
case 'A':
goto oh_kill_me;
break;
case key_Return:
case key_Space:
case 'r':
case 'R':
US_ClearWindow();
VW_UpdateScreen();
US_RestoreWindow(&wr);
return(RETRY);
break;
}
}
oh_kill_me:
abortprogram = s;
ShutdownId();
fprintf(stderr,"Terminal Error: %s\n",s);
if (tedlevel)
fprintf(stderr,"You launched from TED. I suggest that you reboot...\n");
return(ABORT);
#undef IGNORE
#undef RETRY
#undef ABORT
}
#pragma warn +par
#pragma warn +rch
///////////////////////////////////////////////////////////////////////////
//
// US_Startup() - Starts the User Mgr
//
///////////////////////////////////////////////////////////////////////////
void
US_Startup(void)
void US_Startup(void)
{
int i,n;
if (US_Started)
return;
harderr(USL_HardError); // Install the fatal error handler
US_InitRndT(true); // Initialize the random number generator
// Check for TED launching here
......@@ -204,8 +79,7 @@ US_Startup(void)
// US_Shutdown() - Shuts down the User Mgr
//
///////////////////////////////////////////////////////////////////////////
void
US_Shutdown(void)
void US_Shutdown(void)
{
if (!US_Started)
return;
......@@ -259,7 +133,7 @@ US_CheckParm(char *parm,char **strings)
//
///////////////////////////////////////////////////////////////////////////
void
US_SetPrintRoutines(void (*measure)(char far *,word *,word *),void (*print)(char far *))
US_SetPrintRoutines(void (*measure)(char *,word *,word *),void (*print)(char *))
{
USL_MeasureString = measure;
USL_DrawString = print;
......@@ -271,10 +145,9 @@ US_SetPrintRoutines(void (*measure)(char far *,word *,word *),void (*print)(char
// supported.
//
///////////////////////////////////////////////////////////////////////////
void
US_Print(char far *s)
void US_Print(char *s)
{
char c,far *se;
char c, *se;
word w,h;
while (*s)
......@@ -308,8 +181,7 @@ US_Print(char far *s)
// US_PrintUnsigned() - Prints an unsigned long
//
///////////////////////////////////////////////////////////////////////////
void
US_PrintUnsigned(longword n)
void US_PrintUnsigned(longword n)
{
char buffer[32];
......@@ -321,8 +193,7 @@ US_PrintUnsigned(longword n)
// US_PrintSigned() - Prints a signed long
//
///////////////////////////////////////////////////////////////////////////
void
US_PrintSigned(long n)
void US_PrintSigned(long n)
{
char buffer[32];
......@@ -334,8 +205,7 @@ US_PrintSigned(long n)
// USL_PrintInCenter() - Prints a string in the center of the given rect
//
///////////////////////////////////////////////////////////////////////////
void
USL_PrintInCenter(char far *s,Rect r)
void USL_PrintInCenter(char *s, Rect r)
{
word w,h,
rw,rh;
......@@ -355,7 +225,7 @@ USL_PrintInCenter(char far *s,Rect r)
//
///////////////////////////////////////////////////////////////////////////
void
US_PrintCentered(char far *s)
US_PrintCentered(char *s)
{
Rect r;
......@@ -374,7 +244,7 @@ US_PrintCentered(char far *s)
//
///////////////////////////////////////////////////////////////////////////
void
US_CPrintLine(char far *s)
US_CPrintLine(char *s)
{
word w,h;
......@@ -395,9 +265,9 @@ US_CPrintLine(char far *s)
//
///////////////////////////////////////////////////////////////////////////
void
US_CPrint(char far *s)
US_CPrint(char *s)
{
char c,far *se;
char c, *se;
while (*s)
{
......@@ -591,16 +461,11 @@ US_LineInput(int x,int y,char *buf,char *def,boolean escok,
if (cursorvis)
USL_XORICursor(x,y,s,cursor);
asm pushf
asm cli
sc = LastScan;
LastScan = sc_None;
c = LastASCII;
LastASCII = key_None;
asm popf
switch (sc)
{
case sc_LeftArrow:
......
//
// ID Engine
// ID_US.h - Header file for the User Manager
// v1.0d1
// By Jason Blochowiak
//
#ifndef __ID_US__
#define __ID_US__
//#define HELPTEXTLINKED
#ifndef __ID_US_H__
#define __ID_US_H__
#define MaxX 320
#define MaxY 200
......@@ -114,4 +105,7 @@ extern int US_CheckParm(char *parm,char **strings),
void USL_PrintInCenter(char *s,Rect r);
char *USL_GiveSaveName(word game);
#elif
#error "fix me: TODO"
#endif
......@@ -17,3 +17,16 @@ long filelength(int handle)
return buf.st_size;
}
char *ltoa(long value, char *string, int radix)
{
sprintf(string, "%d", value);
return string;
}
char *ultoa(unsigned long value, char *string, int radix)
{
sprintf(string, "%u", value);
return string;
}
\ No newline at end of file
......@@ -6,6 +6,9 @@ extern char **_argv;
long filelength(int handle);
char *ltoa(long value, char *string, int radix);
char *ultoa(unsigned long value, char *string, int radix);
#elif
#error "fix me TODO"
#endif
// WL_ACT2.C
/* wl_act2.c */
#include "WL_DEF.H"
#pragma hdrstop
#include "wl_def.h"
/*
=============================================================================
......@@ -846,7 +845,7 @@ statetype s_gretelshoot8 = {false,SPR_GRETEL_SHOOT1,10,NULL,NULL,&s_gretelchase
void SpawnStand (enemy_t which, int tilex, int tiley, int dir)
{
unsigned far *map,tile;
word *map,tile;
switch (which)
{
......@@ -935,7 +934,7 @@ void SpawnDeadGuard (int tilex, int tiley)
void SpawnBoss (int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
SpawnNewObj (tilex,tiley,&s_bossstand);
new->speed = SPDPATROL;
......@@ -958,7 +957,7 @@ void SpawnBoss (int tilex, int tiley)
void SpawnGretel (int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
SpawnNewObj (tilex,tiley,&s_gretelstand);
new->speed = SPDPATROL;
......@@ -1245,7 +1244,7 @@ statetype s_transshoot8 = {false,SPR_TRANS_SHOOT1,10,NULL,NULL,&s_transchase1};
void SpawnTrans (int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
if (SoundBlasterPresent && DigiMode != sds_Off)
s_transdie01.tictime = 105;
......@@ -1326,7 +1325,7 @@ statetype s_ubershoot7 = {false,SPR_UBER_SHOOT1,12,NULL,NULL,&s_uberchase1};
void SpawnUber (int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
if (SoundBlasterPresent && DigiMode != sds_Off)
s_uberdie01.tictime = 70;
......@@ -1425,7 +1424,7 @@ statetype s_willshoot6 = {false,SPR_WILL_SHOOT4,10,NULL,T_Shoot,&s_willchase1};
void SpawnWill (int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
if (SoundBlasterPresent && DigiMode != sds_Off)
s_willdie2.tictime = 70;
......@@ -1600,7 +1599,7 @@ statetype s_deathshoot5 = {false,SPR_DEATH_SHOOT4,10,NULL,T_Shoot,&s_deathchase
void SpawnDeath (int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
if (SoundBlasterPresent && DigiMode != sds_Off)
s_deathdie2.tictime = 105;
......@@ -1771,13 +1770,11 @@ statetype s_spark3 = {false,SPR_SPARK3,6,T_Projectile,NULL,&s_spark4};
statetype s_spark4 = {false,SPR_SPARK4,6,T_Projectile,NULL,&s_spark1};
#pragma argsused
void A_Slurpie (objtype *ob)
{
SD_PlaySound(SLURPIESND);
}
#pragma argsused
void A_Breathing (objtype *ob)
{
SD_PlaySound(ANGELTIREDSND);
......@@ -1793,7 +1790,7 @@ void A_Breathing (objtype *ob)
void SpawnAngel (int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
if (SoundBlasterPresent && DigiMode != sds_Off)
......@@ -1816,7 +1813,6 @@ void SpawnAngel (int tilex, int tiley)
=================
*/
#pragma argsused
void A_Victory (objtype *ob)
{
playstate = ex_victorious;
......@@ -1912,7 +1908,7 @@ statetype s_spectrewake = {false,SPR_SPECTRE_F4,10,NULL,A_Dormant,&s_spectrewake
void SpawnSpectre (int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
SpawnNewObj (tilex,tiley,&s_spectrewait1);
new->obclass = spectreobj;
......@@ -1993,7 +1989,7 @@ moveok:
void SpawnGhosts (int which, int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
switch(which)
{
......@@ -2211,7 +2207,7 @@ statetype s_fatshoot6 = {false,SPR_FAT_SHOOT4,10,NULL,T_Shoot,&s_fatchase1};
void SpawnSchabbs (int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
if (DigiMode != sds_Off)
s_schabbdie2.tictime = 140;
......@@ -2240,7 +2236,7 @@ void SpawnSchabbs (int tilex, int tiley)
void SpawnGift (int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
if (DigiMode != sds_Off)
s_giftdie2.tictime = 140;
......@@ -2269,7 +2265,7 @@ void SpawnGift (int tilex, int tiley)
void SpawnFat (int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
if (DigiMode != sds_Off)
s_fatdie2.tictime = 140;
......@@ -2825,7 +2821,7 @@ statetype s_hitlershoot6 = {false,SPR_HITLER_SHOOT2,10,NULL,T_Shoot,&s_hitlerch
void SpawnFakeHitler (int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
if (DigiMode != sds_Off)
......@@ -2855,7 +2851,7 @@ void SpawnFakeHitler (int tilex, int tiley)
void SpawnHitler (int tilex, int tiley)
{
unsigned far *map,tile;
word *map,tile;
if (DigiMode != sds_Off)
s_hitlerdie2.tictime = 140;
......@@ -2885,7 +2881,7 @@ void SpawnHitler (int tilex, int tiley)
void A_HitlerMorph (objtype *ob)
{
unsigned far *map,tile,hitpoints[4]={500,700,800,900};
word *map,tile,hitpoints[4]={500,700,800,900};
SpawnNewObj (ob->tilex,ob->tiley,&s_hitlerchase1);
......@@ -2916,7 +2912,6 @@ void A_MechaSound (objtype *ob)
}
#pragma argsused
void A_Slurpie (objtype *ob)
{
SD_PlaySound(SLURPIESND);
......@@ -3620,7 +3615,7 @@ statetype s_deathcam = {false,0,0,NULL,NULL,NULL};
void SpawnBJVictory (void)
{
unsigned far *map,tile;
word *map,tile;
SpawnNewObj (player->tilex,player->tiley+1,&s_bjrun1);
new->x = player->x;
......@@ -3709,7 +3704,6 @@ void T_BJYell (objtype *ob)
===============
*/
#pragma argsused
void T_BJDone (objtype *ob)
{
playstate = ex_victorious; // exit castle tile
......
// WL_AGENT.C
#include "WL_DEF.H"
#pragma hdrstop
/* wl_agent.c */
#include "wl_def.h"
/*
=============================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment