as released 2013-07-08

This commit is contained in:
archive 2023-05-09 09:39:24 +00:00
commit f2e814ff9c
87 changed files with 64212 additions and 0 deletions

2309
3D_ACT1.C Normal file

File diff suppressed because it is too large Load diff

6007
3D_ACT2.C Normal file

File diff suppressed because it is too large Load diff

5291
3D_AGENT.C Normal file

File diff suppressed because it is too large Load diff

1057
3D_DEBUG.C Normal file

File diff suppressed because it is too large Load diff

3331
3D_DEF.H Normal file

File diff suppressed because it is too large Load diff

2214
3D_DRAW.C Normal file

File diff suppressed because it is too large Load diff

248
3D_DRAW2.C Normal file
View file

@ -0,0 +1,248 @@
// WOLFHACK.C
#include "3D_DEF.H"
#define MAXVIEWHEIGHT 200
#define GAMESTATE_TEST (true)
unsigned CeilingTile=126, FloorTile=126;
void (*MapRowPtr)();
int far spanstart[MAXVIEWHEIGHT/2]; // jtr - far
fixed stepscale[MAXVIEWHEIGHT/2];
fixed basedist[MAXVIEWHEIGHT/2];
extern char far planepics[8192]; // 4k of ceiling, 4k of floor
int halfheight = 0;
byte far *planeylookup[MAXVIEWHEIGHT/2];
unsigned far mirrorofs[MAXVIEWHEIGHT/2];
fixed psin, pcos;
fixed FixedMul (fixed a, fixed b)
{
return (a>>8)*(b>>8);
}
int mr_rowofs;
int mr_count;
int mr_xstep;
int mr_ystep;
int mr_xfrac;
int mr_yfrac;
int mr_dest;
/*
==============
=
= DrawSpans
=
= Height ranges from 0 (infinity) to viewheight/2 (nearest)
==============
*/
extern byte far * lightsource;
extern byte far * shadingtable;
void DrawSpans (int x1, int x2, int height)
{
fixed length;
int ofs;
int prestep;
fixed startxfrac, startyfrac;
int x, startx, count, plane, startplane;
byte far *toprow, far *dest;
long i;
toprow = planeylookup[height]+bufferofs;
mr_rowofs = mirrorofs[height];
mr_xstep = (psin<<1)/height;
mr_ystep = (pcos<<1)/height;
length = basedist[height];
startxfrac = (viewx + FixedMul(length,pcos));
startyfrac = (viewy - FixedMul(length,psin));
// draw two spans simultaniously
if (gamestate.flags & GS_LIGHTING)
{
i=shade_max-(63l*(unsigned long)height/(unsigned long)normalshade);
if (i<0)
i=0;
else
if (i>63)
i = 63;
shadingtable=lightsource+(i<<8);
plane = startplane = x1&3;
prestep = viewwidth/2 - x1;
do
{
outportb (SC_INDEX+1,1<<plane);
mr_xfrac = startxfrac - (mr_xstep>>2)*prestep;
mr_yfrac = startyfrac - (mr_ystep>>2)*prestep;
startx = x1>>2;
mr_dest = (unsigned)toprow + startx;
mr_count = ((x2-plane)>>2) - startx + 1;
x1++;
prestep--;
#if GAMESTATE_TEST
if (mr_count)
MapRowPtr();
#else
if (mr_count)
MapLSRow ();
#endif
plane = (plane+1)&3;
} while (plane != startplane);
}
else
{
plane = startplane = x1&3;
prestep = viewwidth/2 - x1;
do
{
outportb (SC_INDEX+1,1<<plane);
mr_xfrac = startxfrac - (mr_xstep>>2)*prestep;
mr_yfrac = startyfrac - (mr_ystep>>2)*prestep;
startx = x1>>2;
mr_dest = (unsigned)toprow + startx;
mr_count = ((x2-plane)>>2) - startx + 1;
x1++;
prestep--;
#if GAMESTATE_TEST
if (mr_count)
MapRowPtr();
#else
if (mr_count)
MapRow ();
#endif
plane = (plane+1)&3;
} while (plane != startplane);
}
}
/*
===================
=
= SetPlaneViewSize
=
===================
*/
void SetPlaneViewSize (void)
{
int x,y;
byte far *dest, far *src;
halfheight = viewheight>>1;
for (y=0 ; y<halfheight ; y++)
{
planeylookup[y] = (byte far *)0xa0000000l + (halfheight-1-y)*SCREENBWIDE;;
mirrorofs[y] = (y*2+1)*SCREENBWIDE;
stepscale[y] = y*GLOBAL1/32;
if (y>0)
basedist[y] = GLOBAL1/2*scale/y;
}
src = PM_GetPage(CeilingTile);
dest = planepics;
for (x=0 ; x<4096 ; x++)
{
*dest = *src++;
dest += 2;
}
src = PM_GetPage(FloorTile);
dest = planepics+1;
for (x=0 ; x<4096 ; x++)
{
*dest = *src++;
dest += 2;
}
}
/*
===================
=
= DrawPlanes
=
===================
*/
void DrawPlanes (void)
{
int height, lastheight;
int x;
#if IN_DEVELOPMENT
if (!MapRowPtr)
DRAW2_ERROR(NULL_FUNC_PTR_PASSED);
#endif
if (viewheight>>1 != halfheight)
SetPlaneViewSize (); // screen size has changed
psin = viewsin;
if (psin < 0)
psin = -(psin&0xffff);
pcos = viewcos;
if (pcos < 0)
pcos = -(pcos&0xffff);
//
// loop over all columns
//
lastheight = halfheight;
for (x=0 ; x<viewwidth ; x++)
{
height = wallheight[x]>>3;
if (height < lastheight)
{ // more starts
do
{
spanstart[--lastheight] = x;
} while (lastheight > height);
}
else if (height > lastheight)
{ // draw spans
if (height > halfheight)
height = halfheight;
for ( ; lastheight < height ; lastheight++)
if (lastheight>0)
DrawSpans (spanstart[lastheight], x-1, lastheight);
}
}
height = halfheight;
for ( ; lastheight < height ; lastheight++)
if (lastheight>0)
DrawSpans (spanstart[lastheight], x-1, lastheight);
}

3522
3D_GAME.C Normal file

File diff suppressed because it is too large Load diff

357
3D_INTER.C Normal file
View file

@ -0,0 +1,357 @@
// 3D_INTER.C
#include "3D_DEF.H"
#pragma hdrstop
//==========================================================================
//
// LOCAL CONSTANTS
//
//==========================================================================
//==========================================================================
//
// LOCAL VARABLES
//
//==========================================================================
#ifndef ID_CACHE_BRIEFS
char BreifingText[13] = {"BRIEF_Wx.TXT"};
#endif
//==========================================================================
/*
==================
=
= CLearSplitVWB
=
==================
*/
void ClearSplitVWB (void)
{
memset (update,0,sizeof(update));
WindowX = 0;
WindowY = 0;
WindowW = 320;
WindowH = 152;
}
//==========================================================================
/*
==================
=
= Breifing
=
==================
*/
boolean Breifing(breifing_type BreifingType,unsigned episode)
{
#ifndef ID_CACHE_BRIEFS
char chars[3] = {'L','W','I'};
BreifingText[6] = chars[BreifingType];
BreifingText[7] = '1'+episode;
HelpPresenter(BreifingText,true,0,false);
#else
HelpPresenter(NULL,true,BRIEF_W1+(episode*2)+BreifingType-1,false);
#endif
return(EscPressed);
}
//==========================================================================
/*
=================
=
= PreloadGraphics
=
= Fill the cache up
=
=================
*/
void ShPrint(char far *text, char shadow_color, boolean single_char)
{
unsigned old_color=fontcolor,old_x=px,old_y=py;
char far *str,buf[2]={0,0};
if (single_char)
{
str = buf;
buf[0]=*text;
}
else
str = text;
fontcolor = shadow_color;
py++;
px++;
USL_DrawString(str); // JTR - This marks blocks!
fontcolor = old_color;
py = old_y;
px = old_x;
USL_DrawString(str); // JTR - This marks blocks!
}
void PreloadUpdate(unsigned current, unsigned total)
{
unsigned w=WindowW-10;
if (current > total)
current=total;
w = ((long)w * current) / total;
if (w)
VWB_Bar(WindowX,WindowY,w-1,1,BORDER_TEXT_COLOR);
VW_UpdateScreen();
}
char far prep_msg[]="^ST1^CEGet Ready, Blake!\r^XX";
void DisplayPrepingMsg(char far *text)
{
#if GAME_VERSION != SHAREWARE_VERSION
// Bomb out if FILE_ID.DIZ is bad!!
//
if (((gamestate.mapon != 1) || (gamestate.episode != 0)) &&
(gamestate.flags & GS_BAD_DIZ_FILE))
Quit(NULL);
#endif
// Cache-in font
//
fontnumber=1;
CA_CacheGrChunk(STARTFONT+1);
BMAmsg(text);
UNCACHEGRCHUNK(STARTFONT+1);
// Set thermometer boundaries
//
WindowX = 36;
WindowY = 188;
WindowW = 260;
WindowH = 32;
// Init MAP and GFX thermometer areas
//
VWB_Bar(WindowX,WindowY-7,WindowW-10,2,BORDER_LO_COLOR);
VWB_Bar(WindowX,WindowY-7,WindowW-11,1,BORDER_TEXT_COLOR-15);
VWB_Bar(WindowX,WindowY,WindowW-10,2,BORDER_LO_COLOR);
VWB_Bar(WindowX,WindowY,WindowW-11,1,BORDER_TEXT_COLOR-15);
// Update screen and fade in
//
VW_UpdateScreen();
if (screenfaded)
VW_FadeIn();
}
void PreloadGraphics(void)
{
WindowY=188;
if (!(gamestate.flags & GS_QUICKRUN))
VW_FadeIn ();
PM_Preload(PreloadUpdate);
IN_UserInput(70);
if (playstate != ex_transported)
VW_FadeOut ();
DrawPlayBorder ();
VW_UpdateScreen ();
}
//==========================================================================
/*
==================
=
= DrawHighScores
=
==================
*/
#define SCORE_Y_SPACING 7 //
void DrawHighScores(void)
{
char buffer[16],*str;
word i,
w,h;
HighScore *s;
ClearMScreen();
CA_CacheScreen (BACKGROUND_SCREENPIC);
DrawMenuTitle("HIGH SCORES");
if (playstate != ex_title)
DrawInstructions(IT_HIGHSCORES);
fontnumber=2;
SETFONTCOLOR(ENABLED_TEXT_COLOR,TERM_BACK_COLOR);
ShadowPrint("NAME",86,60);
// ShadowPrint("MISSION",150,60);
ShadowPrint("SCORE",175,60);
ShadowPrint("MISSION",247,53);
ShadowPrint("RATIO",254,60);
for (i = 0,s = Scores;i < MaxScores;i++,s++)
{
SETFONTCOLOR(HIGHLIGHT_TEXT_COLOR-1,TERM_BACK_COLOR);
//
// name
//
if (*s->name)
ShadowPrint(s->name,45,68 + (SCORE_Y_SPACING * i));
#if 0
//
// mission
//
ltoa(s->episode+1,buffer,10);
ShadowPrint(buffer,165,68 + (SCORE_Y_SPACING * i));
#endif
//
// score
//
if (s->score > 9999999)
SETFONTCOLOR(HIGHLIGHT_TEXT_COLOR+1,TERM_BACK_COLOR);
ltoa(s->score,buffer,10);
USL_MeasureString(buffer,&w,&h);
ShadowPrint(buffer,205 - w,68 + (SCORE_Y_SPACING * i)); // 235
//
// mission ratio
//
ltoa(s->ratio,buffer,10);
USL_MeasureString(buffer,&w,&h);
ShadowPrint(buffer,272-w,68 + (SCORE_Y_SPACING * i));
}
VW_UpdateScreen ();
}
//===========================================================================
/*
=======================
=
= CheckHighScore
=
=======================
*/
void CheckHighScore (long score,word other)
{
word i,j;
int n;
HighScore myscore;
US_CursorStruct TermCursor = {'@',0,HIGHLIGHT_TEXT_COLOR,2};
// Check for cheaters
if (DebugOk)
{
SD_PlaySound(NOWAYSND);
return;
}
strcpy(myscore.name,"");
myscore.score = score;
myscore.episode = gamestate.episode;
myscore.completed = other;
myscore.ratio = ShowStats(0,0,ss_justcalc,&gamestuff.level[gamestate.mapon].stats);
for (i = 0,n = -1;i < MaxScores;i++)
{
if ((myscore.score > Scores[i].score) || ((myscore.score == Scores[i].score)
&& (myscore.completed > Scores[i].completed)))
{
for (j = MaxScores;--j > i;)
Scores[j] = Scores[j - 1];
Scores[i] = myscore;
n = i;
break;
}
}
StartCPMusic (ROSTER_MUS);
DrawHighScores ();
VW_FadeIn ();
if (n != -1)
{
//
// got a high score
//
DrawInstructions(IT_ENTER_HIGHSCORE);
SETFONTCOLOR(HIGHLIGHT_TEXT_COLOR,TERM_BACK_COLOR);
PrintY = 68+(SCORE_Y_SPACING * n);
PrintX = 45;
use_custom_cursor = true;
allcaps = true;
US_CustomCursor = TermCursor;
US_LineInput(PrintX,PrintY,Scores[n].name,nil,true,MaxHighName,100);
}
else
{
IN_ClearKeysDown ();
IN_UserInput(500);
}
StopMusic();
use_custom_cursor = false;
}
//===========================================================================
//--------------------------------------------------------------------------
// Random()
//--------------------------------------------------------------------------
unsigned Random(unsigned Max)
{
unsigned returnval;
if (Max)
{
if (Max > 255)
returnval = (US_RndT()<<8) + US_RndT();
else
returnval = US_RndT();
return(returnval % Max);
}
else
return(0);
}

1905
3D_MAIN.C Normal file

File diff suppressed because it is too large Load diff

3846
3D_MENU.C Normal file

File diff suppressed because it is too large Load diff

301
3D_MENU.H Normal file
View file

@ -0,0 +1,301 @@
//
// WL_MENU.H
//
#include "id_heads.h"
#define GAME_DESCRIPTION_LEN 31
//
// Menu Color Defines
//
#define HIGHLIGHT_BOX_COLOR 0x52 // Box behind text for cursor
#define HIGHLIGHT_TEXT_COLOR 0x59 // Text color for text on cursor
#define HIGHLIGHT_DISABLED_COLOR 0x56 // Text color for text on cursor for a turned off item
#define HIGHLIGHT_DEACTIAVED_COLOR 0x55
#define ENABLED_TEXT_COLOR 0x56
#define DISABLED_TEXT_COLOR 0x53
#define DEACTIAVED_TEXT_COLOR 0x52
#define INSTRUCTIONS_TEXT_COLOR 0x53
#define TERM_BACK_COLOR 0x02
#define TERM_SHADOW_COLOR 0x01
//
// Clearable Menu Terminal Area
//
#define SCREEN_X 32
#define SCREEN_Y 28
#define SCREEN_W 244
#define SCREEN_H 132
#define BORDCOLOR (0x78)
#define BORD2COLOR (0x74)
#define DEACTIVE (0x72)
#define BKGDCOLOR (0x76)
#define STRIPE 0x2c
#define MenuFadeOut() VL_FadeOut(0,255,40,44,44,10)
#define READCOLOR 0x4a
#define READHCOLOR 0x47
#define VIEWCOLOR 0x7f
#define TEXTCOLOR WHITE
#define HIGHLIGHT 0x13
#define MenuFadeIn() VL_FadeIn(0,255,&vgapal,10)
#define MENUSONG LASTLAFF_MUS
#define ROSTER_MUS HISCORE_MUS
#define TEXTSONG TOHELL_MUS
#define QUITSUR "Are you sure you want\n"\
"to quit this great game? (Y/N)"
#define CURGAME " Continuing past this\n"\
" point will end the game\n"\
" you're currently playing.\n"\
"\n"\
" Start a NEW game? (Y/N)"
#if 0
#define CURGAME "You are currently in\n"\
"a game. Continuing will\n"\
"erase the old game.\n"\
"Start a NEW game? (Y/N)"
#endif
#define GAMESVD "There's already a game\n"\
"saved at this position.\n"\
"\n"\
" Overwrite? (Y/N)"
#define SENSITIVE 60
#define CENTER SENSITIVE*2
#define MENU_X 111
#define MENU_Y 50
#define SM_X 121
#define SM_Y 64
#define SM_W 54
#define CTL_X 100
#define CTL_Y 70
#define LSM_X 85
#define LSM_Y 55
#define LSM_W 144
#define LSM_H 10*13+10
#define NM_X 71
#define NM_Y 66
#define NE_X 58
#define NE_Y 54
#define CST_X 77
#define CST_Y 60
#define CST_START 77
#define CST_SPC 41
#define LSA_X 96
#define LSA_Y 80
#define LSA_W 130
#define LSA_H 42
typedef enum mm_labels {MM_NEW_MISSION,
MM_ORDERING_INFO,
MM_READ_THIS,
MM_BLAKE_STONE_SAGA,
MM_BLANK1,
MM_GAME_OPTIONS,
MM_VIEW_SCORES,
MM_LOAD_MISSION,
MM_SAVE_MISSION,
MM_BLANK2,
MM_BACK_TO_DEMO,
MM_LOGOFF,
} mm_labels;
// CP_Switch() menu labels
//
typedef enum
{
SW_LIGHTING,
SW_REBA_ATTACK_INFO,
SW_CEILING,
SW_FLOORS,
} sw_labels;
//
// ActiveType flags for menu options (SEE CP_itemtype.active)
//
typedef enum
{
AT_DISABLED = 0,
AT_ENABLED,
AT_READIT,
AT_NON_SELECTABLE, // Menu Bar/Separator - Not a selectable item.
} activetypes;
//
// TYPEDEFS
//
typedef struct
{
unsigned char x;
char y_ofs;
unsigned char width;
unsigned char height;
char on;
} CP_cursortype;
typedef struct
{
unsigned char x;
unsigned char y;
unsigned char amount;
char curpos;
unsigned char indent;
unsigned char y_spacing;
CP_cursortype cursor;
} CP_iteminfo;
typedef struct
{
activetypes active;
char string[36];
void (* routine)(int temp1);
unsigned char fontnumber; // Font to print text in
unsigned char height; // Hight of text (Y_Offset from previous line)
} CP_itemtype;
typedef struct
{
int allowed[4];
} CustomCtrls;
extern CP_itemtype far MainMenu[],far NewEMenu[];
extern CP_iteminfo far MainItems;
//
// FUNCTION PROTOTYPES
//
void SetupControlPanel(void);
void CleanupControlPanel(void);
void ControlPanelFree(void);
void ControlPanelAlloc(void);
void DrawMenu(CP_iteminfo far *item_i,CP_itemtype far *items);
int HandleMenu(CP_iteminfo far *item_i,CP_itemtype far *items,void (*routine)(int w));
void ClearMScreen(void);
void DrawWindow(int x,int y,int w,int h,int wcolor);
void DrawOutline(int x,int y,int w,int h,int color1,int color2);
void WaitKeyUp(void);
void ReadAnyControl(ControlInfo *ci);
void TicDelay(int count);
void CacheLump(int lumpstart,int lumpend);
void UnCacheLump(int lumpstart,int lumpend);
void StartCPMusic(int song);
int Confirm(char far *string);
void Message(char far *string);
void CheckPause(void);
void ShootSnd(void);
void CheckSecretMissions(void);
void DrawGun(CP_iteminfo far *item_i,CP_itemtype far *items,int x,int *y,int which,int basey,void (*routine)(int w));
void DrawHalfStep(int x,int y,int y_spacing);
void EraseGun(CP_iteminfo far *item_i,CP_itemtype far *items,int x,int y,int which);
void SetTextColor(CP_itemtype far *items,int hlight);
void DrawMenuGun(CP_iteminfo far *iteminfo);
void DrawStripes(int y);
void DefineMouseBtns(void);
void DefineJoyBtns(void);
void DefineKeyBtns(void);
void DefineKeyMove(void);
void EnterCtrlData(int index,CustomCtrls *cust,void (*DrawRtn)(int),void (*PrintRtn)(int),int type);
void DrawMainMenu(void);
void DrawSoundMenu(void);
void DrawLoadSaveScreen(int loadsave);
void DrawNewEpisode(void);
void DrawNewGame(void);
void DrawChangeView(int view);
void DrawMouseSens(void);
void DrawCtlScreen(void);
void DrawCustomScreen(void);
void DrawLSAction(int which);
void DrawCustMouse(int hilight);
void DrawCustJoy(int hilight);
void DrawCustKeybd(int hilight);
void DrawCustKeys(int hilight);
void PrintCustMouse(int i);
void PrintCustJoy(int i);
void PrintCustKeybd(int i);
void PrintCustKeys(int i);
void PrintLSEntry(int w,int color);
void TrackWhichGame(int w);
void DrawNewGameDiff(int w);
void FixupCustom(int w);
void CP_BlakeStoneSaga(void);
void CP_NewGame(void);
void CP_Sound(void);
int CP_LoadGame(int quick);
int CP_SaveGame(int quick);
void CP_Control(void);
void CP_ChangeView(void);
void CP_ExitOptions(void);
void CP_Quit(void);
void CP_ViewScores(void);
int CP_EndGame(void);
int CP_CheckQuick(unsigned scancode);
void CustomControls(void);
void MouseSensitivity(void);
void DrawMenuTitle(char *title);
void CheckForEpisodes(void);
void HelpPresenter(char *fname,boolean continuekeys, unsigned id_cache, boolean startmusic);
void ShadowPrint(char far *string, int x, int y);
//
// VARIABLES
//
extern int SaveGamesAvail[10],StartGame,SoundStatus;
extern char far SaveGameNames[10][GAME_DESCRIPTION_LEN+1], far SaveName[13];
enum {MOUSE,JOYSTICK,KEYBOARDBTNS,KEYBOARDMOVE}; // FOR INPUT TYPES
//
// WL_INTER
//
typedef struct {
int kill,secret,treasure;
long time;
} LRstruct;
extern LRstruct LevelRatios[];
void Write (int x,int y,char *string);

607
3D_MSGS.C Normal file
View file

@ -0,0 +1,607 @@
#include "3d_def.h"
//---------------------------------------------------------------------------
//
// FOOD MACHINE MESSAGES
//
//---------------------------------------------------------------------------
char far food_msg1[]="\r FOOD UNIT DISPENSES\r"
" SOMETHING EDIBLE.\r"
"\r TOKENS: XX";
//---------------------------------------------------------------------------
//
// BEVERAGE MACHINE MESSAGES
//
//---------------------------------------------------------------------------
char far bevs_msg1[]="\r FOOD UNIT DISPENSES\r"
" A COLD BEVERAGE.\r"
"\r TOKENS: XX";
//---------------------------------------------------------------------------
//
// GENERAL HINT MESSAGES
//
//---------------------------------------------------------------------------
#ifdef CON_HINTS
char far genhint_msg1[]="\r\rTERMINALS ACCESS\rALL INFORMATION.";
char far genhint_msg2[]="\r\rALL FLOORS ARE ON-LINE.";
char far genhint_msg3[]="\r\rSOME SCIENTIST\rARE INFORMANTS.";
char far genhint_msg4[]="\r\rELEVATOR CODES ARE\rINFORMATION.";
char far genhint_msg5[]="\r\rTOO MUCH CANDY IS\rBAD FOR YOUR TEETH.";
char far genhint_msg6[]="\r\rINFORMANTS ARE\rEVERYWHERE!";
char far genhint_msg7[]="\r\rINFORMANTS ARE\rINTERACTIVE.";
char far genhint_msg8[]="\r\rBEWARE OF EXPERIMENTS!";
char far genhint_msg9[]="\r\rBEWARE OF GOLDFIRE!";
char far genhint_msg10[]="\r\rTHERE ARE HIDDEN\rROOMS BEHIND PANELS.";
char far genhint_msg11[]="\r\rSOME WALLS ARE PANELS.";
char far genhint_msg12[]="\r\rORDER ALL 6 MISSIONS\rOF BLAKE STONE TODAY!";
char far genhint_msg13[]="\r\rCALL APOGEE AND REGISTER!";
char far genhint_msg14[]="\r\rTALK TO SCIENTISTS.\r";
char far genhint_msg15[]="\r\rSOME SCIENTISTS\rARE INFORMANTS.";
char far genhint_msg16[]="\r\rLEVEL BLUEPRINTS\rARE INFORMATION.";
char far genhint_msg17[]="\r\rUSE TRANSPORTERS WHEN\rAVAILABLE.";
char far * far ConcessionGenHints[NUM_GEN_HINTS]=
{
genhint_msg1,genhint_msg2,genhint_msg3,genhint_msg4,genhint_msg5,
genhint_msg6,genhint_msg7,genhint_msg8,genhint_msg9,genhint_msg10,
genhint_msg11,genhint_msg12,genhint_msg13,genhint_msg14,genhint_msg15,
genhint_msg16,genhint_msg17,
};
#endif
//---------------------------------------------------------------------------
//
// NO EAT MESSAGES
//
//---------------------------------------------------------------------------
char far noeat_msg1[]="\r\r CAN'T EAT NOW,"
"\r NOT HUNGRY.";
//---------------------------------------------------------------------------
//
// GENERAL MESSAGES
//
//---------------------------------------------------------------------------
char far NoAdLibCard[]="^FC57\r MUSIC:\r"
"^FCA6 YOU DON'T HAVE AN\r"
" ADLIB COMPATABLE\r"
" SOUND CARD.";
char far MusicOn[] = "^FC57\r\r MUSIC:\r"
"^FCA6 BACKGROUND MUSIC\r"
" IS XXXX";
char far SoundOn[] = "^FC57\r\r SOUNDS:\r"
"^FCA6 SOUND EFFECTS\r"
" ARE XXXX";
char far ekg_heartbeat_enabled[] = "\r\r EKG HEART BEAT\r"
" SOUND ENABLED.";
char far ekg_heartbeat_disabled[] = "\r\r EKG HEART BEAT\r"
" SOUND DISABLED.";
char far attacker_info_enabled[] = "\r\rDETAILED ATTACKER INFO\r"
" DISPLAY ENABLED.";
char far attacker_info_disabled[] = "\r\rDETAILED ATTACKER INFO\r"
" DISPLAY DISABLED.";
char far WeaponNotAvailMsg[] = "\r\r SELECTED WEAPON NOT\r"
" CURRENTLY AVAILABLE.";
char far WeaponAvailMsg[] = "\r\r SELECTED WEAPON\r"
" ACTIVATED AND READY.";
char far RadarEnergyGoneMsg[] = "\r\r RADAR MAGNIFICATION\r"
" ENERGY DEPLETED.";
char far EnergyPackDepleted[] = "^FC19\r WARNING:\r"
"^FC17ENERGY PACK DEPLETED\r"
"^FCA6 SWITCHING TO\r"
" AUTOCHARGE PISTOL.";
char far WeaponMalfunction[] = "^FC19\r WARNING:\r\r"
"^FC17 WEAPON MALFUNCTION!\r";
char far NotEnoughEnergyForWeapon[] = "^FC17\r NOT ENOUGH ENERGY\r"
" FOR SELECTED WEAPON\r"
"^FCA6 SWITCHING TO\r"
" AUTOCHARGE PISTOL.";
char far SwitchNotActivateMsg[] = "\r\r WALL SWITCH NOT\r"
" OPERATIONAL!!";
char far NoFoodTokens[] = "\r\r YOU DON'T HAVE ANY\r"
" FOOD TOKENS!";
//---------------------------------------------------------------------------
//
// FISSION DETONATOR(S) MESSAGES
//
//---------------------------------------------------------------------------
char far pd_dropped[]="^FC19\r WARNING:\r"
"^FCA6 FISSION DETONATOR\r"
" DROPPED!";
char far pd_nomore[]="^FCA6\r\r NO FISSION\r"
" DETONATORS AVAIL.";
char far pd_notnear[]= "^SH035^FCA6\r YOU MUST\r"
" FIND THE\r"
" SECURITY\r"
" CUBE.";
char far pd_getcloser[]= "^SH035^FCA6\r TRANSPORTER\r"
" SECURITY OUT\r"
" OF RANGE";
char far pd_floorunlocked[]= "^SH035^FCA6\r TRANSPORTER\r"
" SECURITY\r"
" DISABLED.";
char far pd_donthaveany[]="^SH0E6^FCA6\r NO FISSION\r"
" DETONATOR\r"
" AVAILABLE.";
char far pd_no_computer[]= "^SH035^FCA6\r A SECURITY \r"
" CUBE IS NOT\r"
" LOCATED IN\r"
" THIS SECTOR.";
char far pd_floornotlocked[] ="^SH035^FCA6\r TRANSPORTER\r"
" SECURITY\r"
" ALREADY\r"
" DISABLED.";
//---------------------------------------------------------------------------
//
// BONUS MSGS
//
//---------------------------------------------------------------------------
char far bonus_msg1[]="^SH001^FC57\r\r ACCESS CARD:\r"
"^FCA6 RED LEVEL";
char far bonus_msg2[]="^SH002^FC57\r\r ACCESS CARD:\r"
"^FCA6 YELLOW LEVEL";
char far bonus_msg4[]="^SH004^FC57\r\r ACCESS CARD:\r"
"^FCA6 BLUE LEVEL";
char far bonus_msg7[]= "^SH006^FC57\r WEAPON:\r"
"^FCA6 ENERGY PACK\r"
" ( UNITS)";
char far bonus_msg8[]="^SH007^FC57\r\r WEAPON:\r"
"^FCA6 SLOW FIRE\r"
" PROTECTOR\r";
char far bonus_msg9[]="^SH008^FC57\r\r WEAPON:\r"
"^FCA6 RAPID ASSAULT\r"
" WEAPON";
char far bonus_msg10[]= "^SH009^FC57\r\r WEAPON:\r"
"^FCA6 DUAL NEUTRON\r"
" DISRUPTER";
char far bonus_msg13[]="^SH00C^FC57\r\r BONUS:\r"
"^FCA6 MONEY BAG";
char far bonus_msg14[]="^SH00D^FC57\r\r BONUS:\r"
"^FCA6 LOOT";
char far bonus_msg15[]="^SH00E^FC57\r\r BONUS:\r"
"^FCA6 GOLD BARS";
char far bonus_msg16[]="^SH00F^FC57\r\r BONUS:\r"
"^FCA6 XYLAN ORB";
char far bonus_msg21[]="^SH08A^FC57\r WEAPON:\r"
"^FCA6 PLASMA\r"
" DISCHARGE\r"
" UNIT";
char far bonus_msg21a[]="^SH0E4^FC57\r\r WEAPON:\r"
"^FCA6 ANTI-PLASMA\r"
" CANNON";
char far bonus_msg24[]="^SH020^FC57\r FOOD TOKEN:\r"
"^FCA6 1 CREDIT\r"
"\r TOKENS: XX";
char far bonus_msg25[]="^SH021^FC57\r FOOD TOKEN:\r"
"^FCA6 5 CREDITS"
"\r TOKENS: XX";
char far bonus_msg12[]="^SH00B^FC57\r\r HEALTH:\r"
"^FCA6 PLASMA BAG";
char far bonus_msg11[]="^SH00A^FC57\r\r HEALTH:\r"
"^FCA6 FIRST AID\r"
" KIT";
char far bonus_msg17[]="^SH010^FC57\r\r FOOD:\r"
"^FCA6 RAW MEAT";
char far bonus_msg18[]="^SH011^FC57\r\r FOOD:\r"
"^FCA6 RAW MEAT";
char far bonus_msg23[]="^SH089^FC57\r\r FOOD:\r"
"^FCA6 SANDWICH";
char far bonus_msg22[]="^SH088^FC57\r\r FOOD:\r"
"^FCA6 CANDY BAR";
char far bonus_msg19[]="^SH012^FC57\r\r FOOD:\r"
"^FCA6 FRESH WATER";
char far bonus_msg20[]="^SH013^FC57\r\r FOOD:\r"
"^FCA6 WATER PUDDLE";
char far bonus_msg26[]= "^SH0D8^FC57 FISSION\r"
" DETONATOR\r\r"
"^FCA6PRESS TILDE OR\r"
"SPACE TO DROP";
char far bonus_msg27[]= "^SH0D9^FC57\r RADAR: \r"
"^FCA6MAGNIFICATION\r"
" ENERGY";
char far * far BonusMsg[]=
{
bonus_msg1,bonus_msg2,bonus_msg4,
bonus_msg7,bonus_msg7,bonus_msg8,bonus_msg9,bonus_msg10,bonus_msg21,bonus_msg21a,
bonus_msg12,bonus_msg11,
bonus_msg18,bonus_msg17,bonus_msg23,bonus_msg22,bonus_msg19,
bonus_msg20,
bonus_msg13,bonus_msg14,bonus_msg15,
bonus_msg15,bonus_msg15,bonus_msg15,
bonus_msg16,
0,0,0,
bonus_msg24,bonus_msg25,
bonus_msg26,bonus_msg27,
};
//---------------------------------------------------------------------------
//
// ACTOR MSGS (ATTACKING & GEN INFO)
//
//---------------------------------------------------------------------------
// Sector Patrol
char far actor_info4[]="^AN04^FC17\r\r ATTACKING:\r"
"^FCA6 SECTOR GUARD";
// hang_terrotobj,
char far actor_info5[]="^AN05^FC17\r ATTACKING:\r"
"^FCA6 AUTOMATED\r"
"HEAVY ARMORED\r"
" ROBOT TURRET";
// Bio-Tech
char far actor_info9[]="^AN09^FC17\r\r ATTACKING:\r"
"^FCA6 BIO-TECH";
// podobj,
char far actor_info10[]="^AN0A^FC17\r\r ATTACKING:\r"
"^FCA6 POD ALIEN";
// electroobj,
char far actor_info11[]="^AN0B^FC17\r ATTACKING:\r"
"^FCA6 HIGH ENERGY\r"
" PLASMA ALIEN";
// electrosphereobj,
char far actor_info12[]="^AN0C^FC17\r\r ATTACKING:\r"
"^FCA6PLASMA SPHERE";
// STAR Sentinel
char far actor_info13[]="^AN0D^FC17\r\r ATTACKING:\r"
"^FCA6 TECH WARRIOR";
// genetic_guardobj,
char far actor_info14[]="^AN0E^FC17\r ATTACKING:\r"
"^FCA6 HIGH-SECURITY\r"
" GENETIC GUARD";
// mutant_human1obj,
char far actor_info15[]="^AN0F^FC17\r ATTACKING:\r"
"^FCA6 EXPERIMENTAL\r"
" MECH-SENTINEL";
// mutant_human2obj,
char far actor_info16[]="^AN10^FC17\r ATTACKING:\r"
"^FCA6 EXPERIMENTAL\r"
" MUTANT HUMAN";
// lcan_alienobj,
char far actor_info18[]="^AN12^FC17\r ATTACKING:\r"
"^FCA6 EXPERIMENTAL\r"
" GENETIC ALIEN";
// scan_alienobj,
char far actor_info20[]="^AN14^FC17\r ATTACKING:\r"
"^FCA6 EXPERIMENTAL\r"
" GENETIC ALIEN";
// gurneyobj,
char far actor_info22[]="^AN16^FC17\r ATTACKING:\r"
"^FCA6 MUTATED\r"
" GUARD";
// Alien Protector (old STAR Trooper)
char far actor_info24[]="^AN18^FC17\r ATTACKING:\r"
"^FCA6 ALIEN\r"
" PROTECTOR";
// goldsternobj,
char far actor_info25[]="^AN19^FC17\r\r ATTACKING:\r"
"^FCA6 DR GOLDFIRE";
// gold_morphobj,
char far actor_info25m[]="^AN28^FC17\r\r ATTACKING:\r"
"^FCA6 MORPHED\r"
" DR GOLDFIRE";
// volatiletransportobj,
char far actor_info27[]="^SH072^FC17\r ATTACKING:\r"
"^FCA6 VOLATILE MAT.\r"
" TRANSPORT\r"
" EXPLOSION";
// floatingbombobj,
char far actor_info28[]="^SH076^FC17\r ATTACKING:\r"
"^FCA6PERSCAN DRONE\r"
" EXPLOSION";
// electroshotobj,
char far actor_info31[]="^AN0B^FC17\r ATTACKING:\r"
"^FCA6 HIGH ENERGY\r"
" PLASMA ALIEN";
// explosionobj,
char far actor_info33[]="^SH08B^FC17\r ATTACKING:\r"
"^FCA6 EXPLOSION\r"
" BLAST";
// liquidshotobj,
char far actor_info36[]="^AN17^FC17\r\r ATTACKING:\r"
"^FCA6 FLUID ALIEN";
char far actor_info41[]="^SH000^FC17\r ATTACKING:\r"
"^FCA6 STANDING IN\r"
" BIO TOXIC\r"
" WASTE.";
char far actor_info42[]="^SH08C^FC17\r ATTACKING:\r"
"^FCA6 STANDING IN\r"
" TOXIC SLUDGE.";
char far actor_info41a[]="^SH0E2^FC17\r ATTACKING:\r"
"^FCA6 STANDING IN\r"
" TOXIC SLUDGE.";
char far actor_info42a[]="^SH0E3^FC17\r ATTACKING:\r"
"^FCA6 STANDING IN\r"
" BIO TOXIC\r"
" WASTE.";
char far actor_info43[]="^AN1D^FC17\r ATTACKING:\r"
"^FCA6 ELECTRIC ARC\r"
" BARRIER.";
char far actor_info43a[]="^SH0F4^FC17\r ATTACKING:\r"
"^FCA6 POST\r"
" BARRIER.";
char far actor_info43b[]="^SH0FC^FC17\r ATTACKING:\r"
"^FCA6 SPIKE\r"
" BARRIER.";
char far actor_info44[]="^AN1e^FC17\r ATTACKING:\r"
"^FCA6 SPIDER\r"
" MUTANT";
char far actor_info45[]="^AN1f^FC17\r ATTACKING:\r"
"^FCA6 BREATHER\r"
" BEAST";
char far actor_info46[]="^AN20^FC17\r ATTACKING:\r"
"^FCA6 CYBORG\r"
" WARRIOR";
char far actor_info47[]="^AN21^FC17\r ATTACKING:\r"
"^FCA6 REPTILIAN\r"
" WARRIOR";
char far actor_info48[]="^AN22^FC17\r\r ATTACKING:\r"
"^FCA6 ACID DRAGON";
char far actor_info49[]="^AN23^FC17\r ATTACKING:\r"
"^FCA6 BIO-MECH\r"
" GUARDIAN";
char far actor_info50[]="^SH07A^FC17\r ATTACKING:\r"
"^FCA6 SECURITY\r"
" CUBE\r"
" EXPLOSION";
// explosionobj,
char far actor_info51[]="^SH08B^FC17\r ATTACKING:\r"
"^FCA6 ANTI-PLASMA\r"
" EXPLOSION\r"
" BLAST";
// pd_explosionobj,
char far actor_info52[]="^SH0E6^FC17\r ATTACKING:\r"
"^FCA6 DETONATOR\r"
" EXPLOSION";
// Final Boss #1
char far actor_info53[]="^AN29^FC17\r ATTACKING:\r"
"^FCA6 THE GIANT\r"
" STALKER";
// Final Boss #2
char far actor_info54[]="^AN2A^FC17\r ATTACKING:\r"
"^FCA6 THE SPECTOR\r"
" DEMON";
// Final Boss #3
char far actor_info55[]="^AN2b^FC17\r ATTACKING:\r"
"^FCA6 THE ARMORED\r"
" STALKER";
// Final Boss #4
char far actor_info56[]="^AN2c^FC17\r ATTACKING:\r"
"^FCA6 THE CRAWLER\r"
" BEAST";
char far * far ActorInfoMsg[]=
{
// 0,0, // nothing,player
// 0,0,0, // inert,fixup,dead
actor_info4, // Sector Patrol
actor_info5, // Turret
actor_info9, // Bio-Tech
actor_info10, // Pod
actor_info11, // Electro-Alien
actor_info12, // Electro-Sphere
actor_info13, // STAR Sentinel
actor_info14, // Genetic Guard
actor_info15, // Mutant Human 1
actor_info16, // Mutant Human 2
0, // lg canister wait
actor_info18, // Lg Canister Alien
0, // sm canister wait
actor_info20, // Sm canister Alien
0, // gurney wait
actor_info22, // Gurney Mutant
actor_info36, // Liquid Alien
actor_info24, // Alien Protector (old STAR Trooper)
actor_info25, // Goldstern
actor_info25m, // Goldstern Morphed
actor_info27, // Volatile Transport
actor_info28, // Floating Bomb
actor_info50, // vital defence
actor_info44, // Spider Mutant
actor_info45, // breather beast
actor_info46, // cyborg warrior
actor_info47, // reptilian warrior
actor_info48, // acid dragon
actor_info49, // mech guardian
actor_info53, // Final Boss 1
actor_info54, // Final Boss 2
actor_info55, // Final Boss 3
actor_info56, // Final Boss 4
0,0,0,0, // blake,crate 1, crate 2, crate 3,
actor_info41, // Green Ooze
actor_info42, // Black Ooze
actor_info41a, // Green2 Ooze
actor_info42a, // Black2 Ooze
0, // Pod Egg
actor_info44, // morphing_spider mutant
actor_info47, // morphing_reptilian warrior
actor_info16, // morphing_Mutant Human 2
0, // SPACER
actor_info31, // Electro-Alien SHOT
0, // Post Barrier
actor_info43, // Arc Barrier
actor_info43a, // VPost Barrier
actor_info43b, // VSpike Barrier
actor_info25m, // Gold Morph Shot obj
0, // Security Light
actor_info33, // Explosion
0, 0, // Steam Grate, Steam Pipe
actor_info36, // Liquid SHOT
actor_info18, // Lg Canister Alien SHOT
actor_info10, // POD Alien SHOT
actor_info20, // Genetic Alien SHOT
actor_info16, // Mutant Human 2 SHOT
actor_info15, // Mutant Human 1 SHOT
0,0, // vent drip, player sp shot,
0, // flicker light,
0,0, // Door Bomb, Door Bomb reserve
0, // grenade,
0, // BFG Shot
actor_info51, // BFG Explosion
actor_info52, // BFG Explosion
actor_info44, // Boss 1 SHOT
actor_info45, // Boss 2 SHOT
actor_info46, // Boss 3 SHOT
actor_info47, // Boss 4 SHOT
actor_info48, // Boss 5 SHOT
actor_info49, // Boss 6 SHOT
actor_info54, // Boss 8 SHOT
actor_info56, // Boss 10 SHOT
0, // Doorexplosion
actor_info52, // gr_explosion
};

1880
3D_PLAY.C Normal file

File diff suppressed because it is too large Load diff

971
3D_SCALE.C Normal file
View file

@ -0,0 +1,971 @@
// 3D_SCALE.C
#include "3D_DEF.H"
#pragma hdrstop
#define OP_RETF 0xcb
#define CLOAKED_SHAPES (true)
/*
=============================================================================
GLOBALS
=============================================================================
*/
//t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1];
//long fullscalefarcall[MAXSCALEHEIGHT+1];
int maxscale,maxscaleshl2;
unsigned centery;
int normalshade;
int normalshade_div = 1;
int shade_max = 1;
int nsd_table[] = { 1, 6, 3, 4, 1, 2};
int sm_table[] = {36,51,62,63,18,52};
/*
=============================================================================
LOCALS
=============================================================================
*/
//t_compscale _seg *work;
unsigned BuildCompScale (int height, memptr *finalspot);
int stepbytwo;
//===========================================================================
#if 0
/*
==============
=
= BadScale
=
==============
*/
void far BadScale (void)
{
SCALE_ERROR(BADSCALE_ERROR);
}
#endif
/*
==========================
=
= SetupScaling
=
==========================
*/
void SetupScaling (int maxscaleheight)
{
int i,x,y;
byte far *dest;
maxscaleheight/=2; // one scaler every two pixels
maxscale = maxscaleheight-1;
maxscaleshl2 = maxscale<<2;
normalshade=(3*(maxscale>>2))/normalshade_div;
centery=viewheight>>1;
}
//===========================================================================
/*
========================
=
= BuildCompScale
=
= Builds a compiled scaler object that will scale a 64 tall object to
= the given height (centered vertically on the screen)
=
= height should be even
=
= Call with
= ---------
= DS:SI Source for scale
= ES:DI Dest for scale
=
= Calling the compiled scaler only destroys AL
=
========================
*/
#if 0
unsigned BuildCompScale (int height, memptr *finalspot)
{
byte far *code;
int i;
long fix,step;
unsigned src,totalscaled,totalsize;
int startpix,endpix,toppix;
step = ((long)height<<16) / 64;
code = &work->code[0];
toppix = (viewheight-height)/2;
fix = 0;
for (src=0;src<=64;src++)
{
startpix = fix>>16;
fix += step;
endpix = fix>>16;
if (endpix>startpix)
work->width[src] = endpix-startpix;
else
work->width[src] = 0;
//
// mark the start of the code
//
work->codeofs[src] = FP_OFF(code);
//
// compile some code if the source pixel generates any screen pixels
//
startpix+=toppix;
endpix+=toppix;
if (startpix == endpix || endpix < 0 || startpix >= viewheight || src == 64)
continue;
//
// mov al,[si+src]
//
*code++ = 0x8a;
*code++ = 0x44;
*code++ = src;
for (;startpix<endpix;startpix++)
{
if (startpix >= viewheight)
break; // off the bottom of the view area
if (startpix < 0)
continue; // not into the view area
//
// mov [es:di+heightofs],al
//
*code++ = 0x26;
*code++ = 0x88;
*code++ = 0x85;
*((unsigned far *)code)++ = startpix*SCREENBWIDE;
}
}
//
// retf
//
*code++ = 0xcb;
totalsize = FP_OFF(code);
MM_GetPtr (finalspot,totalsize);
_fmemcpy ((byte _seg *)(*finalspot),(byte _seg *)work,totalsize);
return totalsize;
}
#endif
// Draw Column vars
longword dc_iscale;
longword dc_frac;
unsigned dc_source;
unsigned dc_seg;
unsigned dc_length;
unsigned dc_dest;
#define SFRACUNIT 0x10000
extern unsigned far * linecmds;
extern boolean useBounceOffset;
fixed bounceOffset=0;
/*
=======================
=
= ScaleMaskedLSPost with Light sourcing
=
=======================
*/
void ScaleMaskedLSPost (int height, unsigned buf)
{
int length;
unsigned end;
unsigned start;
long sprtopoffset;
long topscreen;
long bottomscreen;
longword screenstep;
long dc_yl,dc_yh;
unsigned far * srcpost;
fixed bounce;
if (useBounceOffset)
bounce=bounceOffset;
else
bounce=0;
srcpost=linecmds;
dc_iscale=(64u*65536u)/(longword)height;
screenstep = ((longword)height)<<10;
sprtopoffset=((long)viewheight<<15)-((long)height<<15)+(bounce>>1);
dc_seg=*(((unsigned *)&srcpost)+1);
end=(*(srcpost++))>>1;
for (;end!=0;)
{
dc_source=*(srcpost++);
start=(*(srcpost++))>>1;
dc_source+=start;
length=end-start;
topscreen = sprtopoffset + (long)(screenstep*(long)start);
bottomscreen = topscreen + (long)(screenstep*(long)length);
dc_yl = (topscreen+SFRACUNIT-1)>>16;
dc_yh = (bottomscreen-1)>>16;
if (dc_yh >= viewheight)
dc_yh = viewheight-1;
if (dc_yl < 0)
{
dc_frac=dc_iscale*(-dc_yl);
dc_yl = 0;
}
else
dc_frac=0;
if (dc_yl<=dc_yh)
{
dc_dest=buf+(unsigned)ylookup[(unsigned)dc_yl];
dc_length=(unsigned)(dc_yh-dc_yl+1);
#if CLOAKED_SHAPES
if (cloaked_shape)
R_DrawSLSColumn();
else
#endif
R_DrawLSColumn();
}
end=(*(srcpost++))>>1;
}
}
/*
=======================
=
= ScaleMaskedWideLSPost with Light sourcing
=
=======================
*/
void ScaleMaskedWideLSPost (int height, unsigned buf, unsigned xx, unsigned pwidth)
{
byte ofs;
byte msk;
unsigned ii;
buf+=(unsigned)xx>>2;
ofs=((byte)(xx&3)<<3)+(byte)pwidth-1;
outp(SC_INDEX+1,(byte)*((byte *)mapmasks1+ofs));
ScaleMaskedLSPost(height,buf);
msk=(byte)*((byte *)mapmasks2+ofs);
if (msk==0)
return;
buf++;
outp(SC_INDEX+1,msk);
ScaleMaskedLSPost(height,buf);
msk=(byte)*((byte *)mapmasks3+ofs);
if (msk==0)
return;
buf++;
outp(SC_INDEX+1,msk);
ScaleMaskedLSPost(height,buf);
}
/*
=======================
=
= ScaleMaskedPost without Light sourcing
=
=======================
*/
void ScaleMaskedPost (int height, unsigned buf)
{
int length;
unsigned end;
unsigned start;
long sprtopoffset;
long topscreen;
long bottomscreen;
longword screenstep;
long dc_yl,dc_yh;
unsigned far * srcpost;
fixed bounce;
if (useBounceOffset)
bounce=bounceOffset;
else
bounce=0;
srcpost=linecmds;
dc_iscale=(64u*65536u)/(longword)height;
screenstep = ((longword)height)<<10;
sprtopoffset=((long)viewheight<<15)-((long)height<<15)+(bounce>>1);
dc_seg=*(((unsigned *)&srcpost)+1);
end=(*(srcpost++))>>1;
for (;end!=0;)
{
dc_source=*(srcpost++);
start=(*(srcpost++))>>1;
dc_source+=start;
length=end-start;
topscreen = sprtopoffset + (long)(screenstep*(long)start);
bottomscreen = topscreen + (long)(screenstep*(long)length);
dc_yl = (topscreen+SFRACUNIT-1)>>16;
dc_yh = (bottomscreen-1)>>16;
if (dc_yh >= viewheight)
dc_yh = viewheight-1;
if (dc_yl < 0)
{
dc_frac=dc_iscale*(-dc_yl);
dc_yl = 0;
}
else
dc_frac=0;
if (dc_yl<=dc_yh)
{
dc_dest=buf+(unsigned)ylookup[(unsigned)dc_yl];
dc_length=(unsigned)(dc_yh-dc_yl+1);
R_DrawColumn();
}
end=(*(srcpost++))>>1;
}
}
/*
=======================
=
= ScaleMaskedWidePost without Light sourcing
=
=======================
*/
void ScaleMaskedWidePost (int height, unsigned buf, unsigned xx, unsigned pwidth)
{
byte ofs;
byte msk;
unsigned ii;
buf+=(unsigned)xx>>2;
ofs=((byte)(xx&3)<<3)+(byte)pwidth-1;
outp(SC_INDEX+1,(byte)*((byte *)mapmasks1+ofs));
ScaleMaskedPost(height,buf);
msk=(byte)*((byte *)mapmasks2+ofs);
if (msk==0)
return;
buf++;
outp(SC_INDEX+1,msk);
ScaleMaskedPost(height,buf);
msk=(byte)*((byte *)mapmasks3+ofs);
if (msk==0)
return;
buf++;
outp(SC_INDEX+1,msk);
ScaleMaskedPost(height,buf);
}
/*
=======================
=
= ScaleLSShape with Light sourcing
=
= Draws a compiled shape at [scale] pixels high
=
= each vertical line of the shape has a pointer to segment data:
= end of segment pixel*2 (0 terminates line) used to patch rtl in scaler
= top of virtual line with segment in proper place
= start of segment pixel*2, used to jsl into compiled scaler
= <repeat>
=
= Setup for call
= --------------
= GC_MODE read mode 1, write mode 2
= GC_COLORDONTCARE set to 0, so all reads from video memory return 0xff
= GC_INDEX pointing at GC_BITMASK
=
=======================
*/
extern byte far * shadingtable;
extern byte far * lightsource;
void ScaleLSShape (int xcenter, int shapenum, unsigned height, char lighting)
{
t_compshape _seg *shape;
int dest;
int i;
longword frac;
unsigned width;
int x1,x2;
longword xscale;
longword screenscale;
long texturecolumn;
long lastcolumn;
int startx;
unsigned swidth;
long xcent;
if ((height>>1>maxscaleshl2)||(!(height>>1)))
return;
shape = PM_GetSpritePage (shapenum);
*(((unsigned *)&linecmds)+1)=(unsigned)shape; // seg of shape
xscale=(longword)height<<12;
xcent=(long)((long)xcenter<<20)-((long)height<<17)+0x80000;
//
// calculate edges of the shape
//
x1 = (int)((long)(xcent+((long)shape->leftpix*xscale))>>20);
if (x1 >= viewwidth)
return; // off the right side
x2 = (int)((long)(xcent+((long)shape->rightpix*xscale))>>20);
if (x2 < 0)
return; // off the left side
screenscale=(256L<<20L)/(longword)height;
//
// store information in a vissprite
//
if (x1<0)
{
frac=((long)-x1)*(long)screenscale;
x1=0;
}
else
frac=screenscale>>1;
x2 = x2 >= viewwidth ? viewwidth-1 : x2;
i=shade_max-(63l*(unsigned long)(height>>3)/(unsigned long)normalshade)+lighting;
if (i<0)
i=0;
else
if (i > 63)
i = 63;
shadingtable=lightsource+(i<<8);
swidth=shape->rightpix-shape->leftpix;
if (height>256)
{
width=1;
startx=0;
lastcolumn=-1;
for (; x1<=x2 ; x1++, frac += screenscale)
{
if (wallheight[x1]>height)
{
if (lastcolumn>=0)
{
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)lastcolumn];
ScaleMaskedWideLSPost(height>>2,(unsigned)bufferofs,(unsigned)startx,width);
width=1;
lastcolumn=-1;
}
continue;
}
texturecolumn = (long)(frac>>20);
if (texturecolumn>swidth)
texturecolumn=swidth;
if (texturecolumn==lastcolumn)
{
width++;
continue;
}
else
{
if (lastcolumn>=0)
{
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)lastcolumn];
ScaleMaskedWideLSPost(height>>2,(unsigned)bufferofs,(unsigned)startx,width);
width=1;
startx=x1;
lastcolumn=texturecolumn;
}
else
{
startx=x1;
width=1;
lastcolumn=texturecolumn;
}
}
}
if (lastcolumn!=-1)
{
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)lastcolumn];
ScaleMaskedWideLSPost(height>>2,bufferofs,(unsigned)startx,width);
}
}
else
{
for (; x1<=x2 ; x1++, frac += screenscale)
{
if (wallheight[x1]>height)
continue;
outp(SC_INDEX+1,1<<(byte)(x1&3));
texturecolumn=frac>>20;
if (texturecolumn>swidth)
texturecolumn=swidth;
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)texturecolumn];
ScaleMaskedLSPost(height>>2,bufferofs+((unsigned)x1>>2));
}
}
}
/*
=======================
=
= ScaleShape
=
= Draws a compiled shape at [scale] pixels high
=
= each vertical line of the shape has a pointer to segment data:
= end of segment pixel*2 (0 terminates line) used to patch rtl in scaler
= top of virtual line with segment in proper place
= start of segment pixel*2, used to jsl into compiled scaler
= <repeat>
=
= Setup for call
= --------------
= GC_MODE read mode 1, write mode 2
= GC_COLORDONTCARE set to 0, so all reads from video memory return 0xff
= GC_INDEX pointing at GC_BITMASK
=
=======================
*/
void ScaleShape (int xcenter, int shapenum, unsigned height)
{
t_compshape _seg *shape;
int dest;
int i;
longword frac;
unsigned width;
int x1,x2;
longword xscale;
longword screenscale;
long texturecolumn;
long lastcolumn;
int startx;
long xcent;
unsigned swidth;
if ((height>>1>maxscaleshl2)||(!(height>>1)))
return;
shape = PM_GetSpritePage (shapenum);
*(((unsigned *)&linecmds)+1)=(unsigned)shape; // seg of shape
xscale=(longword)height<<12;
xcent=(long)((long)xcenter<<20)-((long)height<<(17))+0x80000;
//
// calculate edges of the shape
//
x1 = (int)((long)(xcent+((long)shape->leftpix*xscale))>>20);
if (x1 >= viewwidth)
return; // off the right side
x2 = (int)((long)(xcent+((long)shape->rightpix*xscale))>>20);
if (x2 < 0)
return; // off the left side
screenscale=(256L<<20L)/(longword)height;
//
// store information in a vissprite
//
if (x1<0)
{
frac=((long)-x1)*(long)screenscale;
x1=0;
}
else
frac=screenscale>>1;
x2 = x2 >= viewwidth ? viewwidth-1 : x2;
swidth=shape->rightpix-shape->leftpix;
if (height>256)
{
width=1;
startx=0;
lastcolumn=-1;
for (; x1<=x2 ; x1++, frac += screenscale)
{
if (wallheight[x1]>height)
{
if (lastcolumn>=0)
{
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)lastcolumn];
ScaleMaskedWidePost(height>>2,(unsigned)bufferofs,(unsigned)startx,width);
width=1;
lastcolumn=-1;
}
continue;
}
texturecolumn = (long)(frac>>20);
if (texturecolumn>swidth)
texturecolumn=swidth;
if (texturecolumn==lastcolumn)
{
width++;
continue;
}
else
{
if (lastcolumn>=0)
{
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)lastcolumn];
ScaleMaskedWidePost(height>>2,(unsigned)bufferofs,(unsigned)startx,width);
width=1;
startx=x1;
lastcolumn=texturecolumn;
}
else
{
startx=x1;
width=1;
lastcolumn=texturecolumn;
}
}
}
if (lastcolumn!=-1)
{
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)lastcolumn];
ScaleMaskedWidePost(height>>2,bufferofs,(unsigned)startx,width);
}
}
else
{
for (; x1<=x2 ; x1++, frac += screenscale)
{
if (wallheight[x1]>height)
continue;
outp(SC_INDEX+1,1<<(byte)(x1&3));
texturecolumn=frac>>20;
if (texturecolumn>swidth)
texturecolumn=swidth;
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)texturecolumn];
ScaleMaskedPost(height>>2,bufferofs+((unsigned)x1>>2));
}
}
}
/*
=======================
=
= SimpleScaleShape
=
= NO CLIPPING, height in pixels
=
= Draws a compiled shape at [scale] pixels high
=
= each vertical line of the shape has a pointer to segment data:
= end of segment pixel*2 (0 terminates line) used to patch rtl in scaler
= top of virtual line with segment in proper place
= start of segment pixel*2, used to jsl into compiled scaler
= <repeat>
=
= Setup for call
= --------------
= GC_MODE read mode 1, write mode 2
= GC_COLORDONTCARE set to 0, so all reads from video memory return 0xff
= GC_INDEX pointing at GC_BITMASK
=
=======================
*/
void SimpleScaleShape (int xcenter, int shapenum, unsigned height)
{
t_compshape _seg *shape;
int dest;
int i;
longword frac;
int width;
int x1,x2;
longword xscale;
longword screenscale;
long texturecolumn;
long lastcolumn;
int startx;
long xcent;
unsigned swidth;
shape = PM_GetSpritePage (shapenum);
*(((unsigned *)&linecmds)+1)=(unsigned)shape; // seg of shape
xscale=(longword)height<<10;
xcent=(long)((long)xcenter<<16)-((long)height<<(15))+0x8000;
//
// calculate edges of the shape
//
x1 = (int)((long)(xcent+((long)shape->leftpix*xscale))>>16);
if (x1 >= viewwidth)
return; // off the right side
x2 = (int)((long)(xcent+((long)shape->rightpix*xscale))>>16);
if (x2 < 0)
return; // off the left side
screenscale=(64*65536)/(longword)height;
//
// store information in a vissprite
//
if (x1<0)
{
frac=screenscale*((long)-x1);
x1=0;
}
else
frac=screenscale>>1;
x2 = x2 >= viewwidth ? viewwidth-1 : x2;
swidth=shape->rightpix-shape->leftpix;
if (height>64)
{
width=1;
startx=0;
lastcolumn=-1;
for (; x1<=x2 ; x1++, frac += screenscale)
{
texturecolumn = (long)(frac>>16);
if (texturecolumn>swidth)
texturecolumn=swidth;
if (texturecolumn==lastcolumn)
{
width++;
continue;
}
else
{
if (lastcolumn>=0)
{
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)lastcolumn];
ScaleMaskedWidePost(height,bufferofs,startx,width);
width=1;
startx=x1;
lastcolumn=texturecolumn;
}
else
{
startx=x1;
lastcolumn=texturecolumn;
}
}
}
if (lastcolumn!=-1)
{
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)lastcolumn];
ScaleMaskedWidePost(height,bufferofs,startx,width);
}
}
else
{
for (; x1<=x2 ; x1++, frac += screenscale)
{
outp(SC_INDEX+1,1<<(x1&3));
texturecolumn=frac>>16;
if (texturecolumn>swidth)
texturecolumn=swidth;
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)texturecolumn];
ScaleMaskedPost(height,bufferofs+(x1>>2));
}
}
}
//-------------------------------------------------------------------------
// MegaSimpleScaleShape()
//
// NOTE: Parameter SHADE determines which Shade palette to use on the shape.
// 0 == NO Shading
// 63 == Max Shade (BLACK or near)
//-------------------------------------------------------------------------
void MegaSimpleScaleShape (int xcenter, int ycenter, int shapenum, unsigned height, unsigned shade)
{
t_compshape _seg *shape;
int dest;
int i;
longword frac;
int width;
int x1,x2;
longword xscale;
longword screenscale;
long texturecolumn;
long lastcolumn;
int startx;
long xcent;
unsigned old_bufferofs;
int swidth;
old_bufferofs = bufferofs;
ycenter -=34;
bufferofs -= ((viewheight-64)>>1)*SCREENBWIDE;
bufferofs += SCREENBWIDE*ycenter;
shape = PM_GetSpritePage (shapenum);
*(((unsigned *)&linecmds)+1)=(unsigned)shape; // seg of shape
xscale=(longword)height<<14;
xcent=(long)((long)xcenter<<20)-((long)height<<(19))+0x80000;
//
// calculate edges of the shape
//
x1 = (int)((long)(xcent+((long)shape->leftpix*xscale))>>20);
if (x1 >= viewwidth)
return; // off the right side
x2 = (int)((long)(xcent+((long)shape->rightpix*xscale))>>20);
if (x2 < 0)
return; // off the left side
screenscale=(64L<<20L)/(longword)height;
//
// Choose shade table.
//
shadingtable=lightsource+(shade<<8);
//
// store information in a vissprite
//
if (x1<0)
{
frac=screenscale*((long)-x1);
x1=0;
}
else
frac=screenscale>>1;
x2 = x2 >= viewwidth ? viewwidth-1 : x2;
swidth=shape->rightpix-shape->leftpix;
if (height>64)
{
width=1;
startx=0;
lastcolumn=-1;
for (; x1<=x2 ; x1++, frac += screenscale)
{
texturecolumn = (long)(frac>>20);
if (texturecolumn==lastcolumn)
{
width++;
continue;
}
else
{
if (lastcolumn>=0)
{
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)lastcolumn];
ScaleMaskedWideLSPost(height,bufferofs,startx,width);
width=1;
startx=x1;
lastcolumn=texturecolumn;
}
else
{
startx=x1;
lastcolumn=texturecolumn;
}
}
}
if (lastcolumn!=-1)
{
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)lastcolumn];
ScaleMaskedWideLSPost(height,bufferofs,startx,width);
}
}
else
{
for (; x1<=x2 ; x1++, frac += screenscale)
{
outp(SC_INDEX+1,1<<(x1&3));
texturecolumn=frac>>20;
if (texturecolumn>swidth)
texturecolumn=swidth;
(unsigned)linecmds=(unsigned)shape->dataofs[(unsigned)texturecolumn];
ScaleMaskedLSPost(height,bufferofs+(x1>>2));
}
}
bufferofs = old_bufferofs;
}
//
// bit mask tables for drawing scaled strips up to eight pixels wide
//
// down here so the STUPID inline assembler doesn't get confused!
//
byte mapmasks1[4][8] = {
{1 ,3 ,7 ,15,15,15,15,15},
{2 ,6 ,14,14,14,14,14,14},
{4 ,12,12,12,12,12,12,12},
{8 ,8 ,8 ,8 ,8 ,8 ,8 ,8} };
byte mapmasks2[4][8] = {
{0 ,0 ,0 ,0 ,1 ,3 ,7 ,15},
{0 ,0 ,0 ,1 ,3 ,7 ,15,15},
{0 ,0 ,1 ,3 ,7 ,15,15,15},
{0 ,1 ,3 ,7 ,15,15,15,15} };
byte mapmasks3[4][8] = {
{0 ,0 ,0 ,0 ,0 ,0 ,0 ,0},
{0 ,0 ,0 ,0 ,0 ,0 ,0 ,1},
{0 ,0 ,0 ,0 ,0 ,0 ,1 ,3},
{0 ,0 ,0 ,0 ,0 ,1 ,3 ,7} };
#if 0
unsigned wordmasks[8][8] = {
{0x0080,0x00c0,0x00e0,0x00f0,0x00f8,0x00fc,0x00fe,0x00ff},
{0x0040,0x0060,0x0070,0x0078,0x007c,0x007e,0x007f,0x807f},
{0x0020,0x0030,0x0038,0x003c,0x003e,0x003f,0x803f,0xc03f},
{0x0010,0x0018,0x001c,0x001e,0x001f,0x801f,0xc01f,0xe01f},
{0x0008,0x000c,0x000e,0x000f,0x800f,0xc00f,0xe00f,0xf00f},
{0x0004,0x0006,0x0007,0x8007,0xc007,0xe007,0xf007,0xf807},
{0x0002,0x0003,0x8003,0xc003,0xe003,0xf003,0xf803,0xfc03},
{0x0001,0x8001,0xc001,0xe001,0xf001,0xf801,0xfc01,0xfe01} };
#endif
int slinex,slinewidth;
unsigned far *linecmds;
long linescale;
unsigned maskword;

2565
3D_STATE.C Normal file

File diff suppressed because it is too large Load diff

50
AN_CODES.H Normal file
View file

@ -0,0 +1,50 @@
#ifndef _AN_CODES_H_
#define _AN_CODES_H_
//--------------------------------------------------------------------------
//
// ANIM CODES - DOCS
//
//--------------------------------------------------------------------------
//
// FI - Fade In the current frame (Last Frame grabbed)
// FO - Fade Out the current frame (Last Frame grabbed)
// FB - Fade In with rate (a numeral value should follow in the script)
// ** MUST be a divisor of 64
// FE - Fade Out with rate (a numeral value should follow in the script)
// ** MUST be a divisor of 64
// SD - Play sounds (a numeral value should follow in the script)
// GR - Graphic Page (full screen)
//
// PA - Pause/Delay 'xxxxxx' number of VBLs
//
//
//
//
//
//--------------------------------------------------------------------------
//
// MACROS
//
//--------------------------------------------------------------------------
#define MV_CNVT_CODE(c1,c2) ((unsigned)((c1)|(c2<<8)))
#define AN_PAUSE MV_CNVT_CODE('P','A')
#define AN_SOUND MV_CNVT_CODE('S','D')
#define AN_MUSIC MV_CNVT_CODE('M','U')
#define AN_PAGE MV_CNVT_CODE('G','R')
#define AN_FADE_IN_FRAME MV_CNVT_CODE('F','I')
#define AN_FADE_OUT_FRAME MV_CNVT_CODE('F','O')
#define AN_FADE_IN MV_CNVT_CODE('F','B')
#define AN_FADE_OUT MV_CNVT_CODE('F','E')
#define AN_PALETTE MV_CNVT_CODE('P','L')
#define AN_PRELOAD_BEGIN MV_CNVT_CODE('L','B')
#define AN_PRELOAD_END MV_CNVT_CODE('L','E')
#define AN_END_OF_ANIM MV_CNVT_CODE('X','X')
#endif

32
AUDIO.H Normal file
View file

@ -0,0 +1,32 @@
/////////////////////////////////////////////////
//
// MUSE Header for .
// Created Wed Aug 19 11:58:30 1992
//
/////////////////////////////////////////////////
#define NUMSOUNDS 1
#define NUMSNDCHUNKS 3
//
// Sound names & indexes
//
typedef enum {
UNTITLED0SND, // 0
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 1
#define STARTDIGISOUNDS 2
#define STARTMUSIC 3
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////

156
AUDIOBS1.H Normal file
View file

@ -0,0 +1,156 @@
/////////////////////////////////////////////////
//
// MUSE Header for .BS1
// Created Tue Jan 04 11:44:31 1994
//
/////////////////////////////////////////////////
#define NUMSOUNDS 100
#define NUMSNDCHUNKS 319
//
// Sound names & indexes
//
typedef enum {
HITWALLSND, // 0
TERM_TYPESND, // 1
GETPISTOLSND, // 2
LIQUIDDIESND, // 3
MOVEGUN2SND, // 4
MOVEGUN1SND, // 5
NOWAYSND, // 6
SCOUT_ALERTSND, // 7
GURNEYSND, // 8
PLAYERDEATHSND, // 9
CONCESSIONSSND, // 10
ATKIONCANNONSND, // 11
GETKEYSND, // 12
WARPOUTSND, // 13
WARPINSND, // 14
ROBOT_SERVOSND, // 15
INFORMANTDEATHSND, // 16
GOLDSTERNHALTSND, // 17
OPENDOORSND, // 18
CLOSEDOORSND, // 19
__UNUSED__SND, // 20
HALTSND, // 21
RENTDEATH2SND, // 22
ATKAUTOCHARGESND, // 23
ATKCHARGEDSND, // 24
RENTDEATH3SND, // 25
ATKBURSTRIFLESND, // 26
VITAL_GONESND, // 27
SHOOTDOORSND, // 28
RENTDEATH1SND, // 29
GETBURSTRIFLESND, // 30
GETAMMOSND, // 31
SHOOTSND, // 32
HEALTH1SND, // 33
HEALTH2SND, // 34
BONUS1SND, // 35
BONUS2SND, // 36
BONUS3SND, // 37
GETIONCANNONSND, // 38
ESCPRESSEDSND, // 39
ELECAPPEARSND, // 40
EXTRA_MANSND, // 41
ELEV_BUTTONSND, // 42
INTERROGATESND, // 43
BONUS5SND, // 44
BONUS4SND, // 45
PUSHWALLSND, // 46
TERM_BEEPSND, // 47
ROLL_SCORESND, // 48
TURRETSND, // 49
EXPLODE1SND, // 50
__UNUSED_2__SND, // 51
SWATDIESND, // 52
GGUARDHALTSND, // 53
EXPLODE2SND, // 54
BLUEBOYHALTSND, // 55
PROGUARDDEATHSND, // 56
DOGBOYHALTSND, // 57
ENGINE_THRUSTSND, // 58
SCANHALTSND, // 59
GETCANNONSND, // 60
LCANHALTSND, // 61
PROHALTSND, // 62
GGUARDDEATHSND, // 63
BLUEBOYDEATHSND, // 64
GOLDSTERNLAUGHSND, // 65
SCIENTISTHALTSND, // 66
SCIENTISTDEATHSND, // 67
DOGBOYDEATHSND, // 68
H_BEATSND, // 69
SWATHALTSND, // 70
SCANDEATHSND, // 71
LCANDEATHSND, // 72
INFORMDEATH2SND, // 73
INFORMDEATH3SND, // 74
GURNEYDEATHSND, // 75
PRODEATH2SND, // 76
PRODEATH3SND, // 77
SWATDEATH2SND, // 78
LCANBREAKSND, // 79
SCANBREAKSND, // 80
HTECHDOOROPENSND, // 81
HTECHDOORCLOSESND, // 82
ELECARCDAMAGESND, // 83
PODHATCHSND, // 84
ELECTSHOTSND, // 85
ELECDIESND, // 86
ATKGRENADESND, // 87
CLAWATTACKSND, // 88
PUNCHATTACKSND, // 89
SPITATTACKSND, // 90
PODDEATHSND, // 91
PODHALTSND, // 92
SWATDEATH3SND, // 93
SCIDEATH2SND, // 94
SCIDEATH3SND, // 95
GOTTOKENSND, // 96
SWITCHSND, // 97
STATS1SND, // 98
STATS2SND, // 99
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 100
#define STARTDIGISOUNDS 200
#define STARTMUSIC 300
//
// Music names & indexes
//
typedef enum {
S2100A_MUS, // 0
GOLDA_MUS, // 1
APOGFNFM_MUS, // 2
DRKHALLA_MUS, // 3
FREEDOMA_MUS, // 4
GENEFUNK_MUS, // 5
TIMEA_MUS, // 6
HIDINGA_MUS, // 7
INCNRATN_MUS, // 8
JUNGLEA_MUS, // 9
LEVELA_MUS, // 10
MEETINGA_MUS, // 11
STRUTA_MUS, // 12
RACSHUFL_MUS, // 13
RUMBAA_MUS, // 14
SEARCHNA_MUS, // 15
THEME_MUS, // 16
THEWAYA_MUS, // 17
INTRIGEA_MUS, // 18
LASTMUSIC
} musicnames;
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////

158
AUDIOFIR.H Normal file
View file

@ -0,0 +1,158 @@
/////////////////////////////////////////////////
//
// MUSE Header for .FIR
// Created Wed Jul 06 15:43:15 1994
//
/////////////////////////////////////////////////
#define NUMSOUNDS 100
#define NUMSNDCHUNKS 321
//
// Sound names & indexes
//
typedef enum {
HITWALLSND, // 0
TERM_TYPESND, // 1
GETPISTOLSND, // 2
LIQUIDDIESND, // 3
MOVEGUN2SND, // 4
MOVEGUN1SND, // 5
NOWAYSND, // 6
SCOUT_ALERTSND, // 7
GURNEYSND, // 8
PLAYERDEATHSND, // 9
CONCESSIONSSND, // 10
ATKIONCANNONSND, // 11
GETKEYSND, // 12
WARPOUTSND, // 13
WARPINSND, // 14
ROBOT_SERVOSND, // 15
INFORMANTDEATHSND, // 16
GOLDSTERNHALTSND, // 17
OPENDOORSND, // 18
CLOSEDOORSND, // 19
GETDETONATORSND, // 20
HALTSND, // 21
RENTDEATH2SND, // 22
ATKAUTOCHARGESND, // 23
ATKCHARGEDSND, // 24
RADAR_POWERUPSND, // 25
ATKBURSTRIFLESND, // 26
VITAL_GONESND, // 27
SHOOTDOORSND, // 28
RENTDEATH1SND, // 29
GETBURSTRIFLESND, // 30
GETAMMOSND, // 31
SHOOTSND, // 32
HEALTH1SND, // 33
HEALTH2SND, // 34
BONUS1SND, // 35
BONUS2SND, // 36
BONUS3SND, // 37
GETIONCANNONSND, // 38
ESCPRESSEDSND, // 39
ELECAPPEARSND, // 40
EXTRA_MANSND, // 41
ELEV_BUTTONSND, // 42
INTERROGATESND, // 43
BONUS5SND, // 44
BONUS4SND, // 45
PUSHWALLSND, // 46
TERM_BEEPSND, // 47
ROLL_SCORESND, // 48
TURRETSND, // 49
EXPLODE1SND, // 50
__UNUSED_51__SND, // 51
SWATDIESND, // 52
GGUARDHALTSND, // 53
EXPLODE2SND, // 54
BLUEBOYHALTSND, // 55
PROGUARDDEATHSND, // 56
DOGBOYHALTSND, // 57
ENGINE_THRUSTSND, // 58
SCANHALTSND, // 59
GETCANNONSND, // 60
LCANHALTSND, // 61
PROHALTSND, // 62
GGUARDDEATHSND, // 63
BLUEBOYDEATHSND, // 64
GOLDSTERNLAUGHSND, // 65
SCIENTISTHALTSND, // 66
SCIENTISTDEATHSND, // 67
DOGBOYDEATHSND, // 68
H_BEATSND, // 69
SWATHALTSND, // 70
SCANDEATHSND, // 71
LCANDEATHSND, // 72
INFORMDEATH2SND, // 73
INFORMDEATH3SND, // 74
GURNEYDEATHSND, // 75
PRODEATH2SND, // 76
__UNUSED_77__SND, // 77
SWATDEATH2SND, // 78
LCANBREAKSND, // 79
SCANBREAKSND, // 80
HTECHDOOROPENSND, // 81
HTECHDOORCLOSESND, // 82
ELECARCDAMAGESND, // 83
PODHATCHSND, // 84
ELECTSHOTSND, // 85
ELECDIESND, // 86
ATKGRENADESND, // 87
CLAWATTACKSND, // 88
PUNCHATTACKSND, // 89
SPITATTACKSND, // 90
PODDEATHSND, // 91
PODHALTSND, // 92
__UNUSED_93__SND, // 93
SCIDEATH2SND, // 94
SCIDEATH3SND, // 95
GOTTOKENSND, // 96
SWITCHSND, // 97
STATS1SND, // 98
STATS2SND, // 99
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 100
#define STARTDIGISOUNDS 200
#define STARTMUSIC 300
//
// Music names & indexes
//
typedef enum {
CATACOMB_MUS, // 0
STICKS_MUS, // 1
APOGFNFM_MUS, // 2
PLOT_MUS, // 3
CIRCLES_MUS, // 4
LASTLAFF_MUS, // 5
TOHELL_MUS, // 6
FORTRESP_MUS, // 7
GIVING_MUS, // 8
HARTBEAT_MUS, // 9
LURKING_MUS, // 10
MAJMIN_MUS, // 11
VACCINAP_MUS, // 12
DARKNESS_MUS, // 13
MONASTRY_MUS, // 14
TOMBP_MUS, // 15
TIME_MUS, // 16
MOURNING_MUS, // 17
SERPENT_MUS, // 18
HISCORE_MUS, // 19
THEME_MUS, // 20
LASTMUSIC
} musicnames;
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////

158
AUDIOVSI.H Normal file
View file

@ -0,0 +1,158 @@
/////////////////////////////////////////////////
//
// MUSE Header for .VSI
// Created Tue Aug 23 16:07:48 1994
//
/////////////////////////////////////////////////
#define NUMSOUNDS 100
#define NUMSNDCHUNKS 321
//
// Sound names & indexes
//
typedef enum {
HITWALLSND, // 0
TERM_TYPESND, // 1
GETPISTOLSND, // 2
LIQUIDDIESND, // 3
MOVEGUN2SND, // 4
MOVEGUN1SND, // 5
NOWAYSND, // 6
SCOUT_ALERTSND, // 7
GURNEYSND, // 8
PLAYERDEATHSND, // 9
CONCESSIONSSND, // 10
ATKIONCANNONSND, // 11
GETKEYSND, // 12
WARPOUTSND, // 13
WARPINSND, // 14
ROBOT_SERVOSND, // 15
INFORMANTDEATHSND, // 16
GOLDSTERNHALTSND, // 17
OPENDOORSND, // 18
CLOSEDOORSND, // 19
GETDETONATORSND, // 20
HALTSND, // 21
RENTDEATH2SND, // 22
ATKAUTOCHARGESND, // 23
ATKCHARGEDSND, // 24
RADAR_POWERUPSND, // 25
ATKBURSTRIFLESND, // 26
VITAL_GONESND, // 27
SHOOTDOORSND, // 28
RENTDEATH1SND, // 29
GETBURSTRIFLESND, // 30
GETAMMOSND, // 31
SHOOTSND, // 32
HEALTH1SND, // 33
HEALTH2SND, // 34
BONUS1SND, // 35
BONUS2SND, // 36
BONUS3SND, // 37
GETIONCANNONSND, // 38
ESCPRESSEDSND, // 39
ELECAPPEARSND, // 40
EXTRA_MANSND, // 41
ELEV_BUTTONSND, // 42
INTERROGATESND, // 43
BONUS5SND, // 44
BONUS4SND, // 45
PUSHWALLSND, // 46
TERM_BEEPSND, // 47
ROLL_SCORESND, // 48
TURRETSND, // 49
EXPLODE1SND, // 50
__UNUSED_51__SND, // 51
SWATDIESND, // 52
GGUARDHALTSND, // 53
EXPLODE2SND, // 54
BLUEBOYHALTSND, // 55
PROGUARDDEATHSND, // 56
DOGBOYHALTSND, // 57
ENGINE_THRUSTSND, // 58
SCANHALTSND, // 59
GETCANNONSND, // 60
LCANHALTSND, // 61
PROHALTSND, // 62
GGUARDDEATHSND, // 63
BLUEBOYDEATHSND, // 64
GOLDSTERNLAUGHSND, // 65
SCIENTISTHALTSND, // 66
SCIENTISTDEATHSND, // 67
DOGBOYDEATHSND, // 68
H_BEATSND, // 69
SWATHALTSND, // 70
SCANDEATHSND, // 71
LCANDEATHSND, // 72
INFORMDEATH2SND, // 73
INFORMDEATH3SND, // 74
GURNEYDEATHSND, // 75
PRODEATH2SND, // 76
__UNUSED_77__SND, // 77
SWATDEATH2SND, // 78
LCANBREAKSND, // 79
SCANBREAKSND, // 80
HTECHDOOROPENSND, // 81
HTECHDOORCLOSESND, // 82
ELECARCDAMAGESND, // 83
PODHATCHSND, // 84
ELECTSHOTSND, // 85
ELECDIESND, // 86
ATKGRENADESND, // 87
CLAWATTACKSND, // 88
PUNCHATTACKSND, // 89
SPITATTACKSND, // 90
PODDEATHSND, // 91
PODHALTSND, // 92
__UNUSED_93__SND, // 93
SCIDEATH2SND, // 94
SCIDEATH3SND, // 95
GOTTOKENSND, // 96
SWITCHSND, // 97
STATS1SND, // 98
STATS2SND, // 99
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 100
#define STARTDIGISOUNDS 200
#define STARTMUSIC 300
//
// Music names & indexes
//
typedef enum {
CATACOMB_MUS, // 0
STICKS_MUS, // 1
APOGFNFM_MUS, // 2
PLOT_MUS, // 3
CIRCLES_MUS, // 4
LASTLAFF_MUS, // 5
TOHELL_MUS, // 6
FORTRESS_MUS, // 7
GIVING_MUS, // 8
HARTBEAT_MUS, // 9
LURKING_MUS, // 10
MAJMIN_MUS, // 11
VACCINAP_MUS, // 12
DARKNESS_MUS, // 13
MONASTRY_MUS, // 14
TOMBP_MUS, // 15
TIME_MUS, // 16
MOURNING_MUS, // 17
SERPENT_MUS, // 18
HISCORE_MUS, // 19
THEME_MUS, // 20
LASTMUSIC
} musicnames;
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////

Binary file not shown.

841
C0.ASM Normal file
View file

@ -0,0 +1,841 @@
NAME c0
PAGE 60,132
LOCALS
;[]------------------------------------------------------------[]
;| C0.ASM -- Start Up Code |
;| |
;| Turbo C++ Run Time Library |
;| |
;| Copyright (c) 1987, 1991 by Borland International Inc. |
;| All Rights Reserved. |
;[]------------------------------------------------------------[]
__C0__ = 1
INCLUDE RULES.ASI
; Segment and Group declarations
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ENDS
_FARDATA SEGMENT PARA PUBLIC 'FAR_DATA'
ENDS
_FARBSS SEGMENT PARA PUBLIC 'FAR_BSS'
ENDS
IFNDEF __TINY__
_OVERLAY_ SEGMENT PARA PUBLIC 'OVRINFO'
ENDS
_1STUB_ SEGMENT PARA PUBLIC 'STUBSEG'
ENDS
ENDIF
_DATA SEGMENT PARA PUBLIC 'DATA'
ENDS
_INIT_ SEGMENT WORD PUBLIC 'INITDATA'
InitStart label byte
ENDS
_INITEND_ SEGMENT BYTE PUBLIC 'INITDATA'
InitEnd label byte
ENDS
_EXIT_ SEGMENT WORD PUBLIC 'EXITDATA'
ExitStart label byte
ENDS
_EXITEND_ SEGMENT BYTE PUBLIC 'EXITDATA'
ExitEnd label byte
ENDS
_CVTSEG SEGMENT WORD PUBLIC 'DATA'
ENDS
_SCNSEG SEGMENT WORD PUBLIC 'DATA'
ENDS
IFNDEF __HUGE__
_BSS SEGMENT WORD PUBLIC 'BSS'
ENDS
_BSSEND SEGMENT BYTE PUBLIC 'BSSEND'
ENDS
ENDIF
IFNDEF __TINY__
_STACK SEGMENT STACK 'STACK'
ENDS
ENDIF
ASSUME CS:_TEXT, DS:DGROUP
; External References
extrn _main:DIST
extrn _exit:DIST
extrn __exit:DIST
extrn __nfile:word
extrn __setupio:near ;required!
extrn __stklen:word
IF LDATA EQ false
extrn __heaplen:word
ENDIF
SUBTTL Start Up Code
PAGE
;/* */
;/*-----------------------------------------------------*/
;/* */
;/* Start Up Code */
;/* ------------- */
;/* */
;/*-----------------------------------------------------*/
;/* */
PSPHigh equ 00002h
PSPEnv equ 0002ch
PSPCmd equ 00080h
public __AHINCR
__AHINCR equ 1000h
public __AHSHIFT
__AHSHIFT equ 12
IFDEF __NOFLOAT__
MINSTACK equ 128 ; minimal stack size in words
ELSE
MINSTACK equ 256 ; minimal stack size in words
ENDIF
;
; At the start, DS and ES both point to the segment prefix.
; SS points to the stack segment except in TINY model where
; SS is equal to CS
;
_TEXT SEGMENT
IFDEF __TINY__
ORG 100h
ENDIF
STARTX PROC NEAR
; Save general information, such as :
; DGROUP segment address
; DOS version number
; Program Segment Prefix address
; Environment address
; Top of far heap
IFDEF __TINY__
mov dx, cs ; DX = GROUP Segment address
ELSE
mov dx, DGROUP ; DX = GROUP Segment address
ENDIF
IFNDEF __BOSS__
mov cs:DGROUP@@, dx ; __BOSS__
ENDIF
mov ah, 30h
int 21h ; get DOS version number
mov bp, ds:[PSPHigh]; BP = Highest Memory Segment Addr
mov bx, ds:[PSPEnv] ; BX = Environment Segment address
mov ds, dx
mov _version@, ax ; Keep major and minor version number
mov _psp@, es ; Keep Program Segment Prefix address
mov _envseg@, bx ; Keep Environment Segment address
mov word ptr _heaptop@ + 2, bp
;
; Save several vectors and install default divide by zero handler.
;
call SaveVectors
;===================
;
; IDsoft - Check to make sure that we're running on a 286 or better
pushf ; Save original flags
xor ax,ax ; Clear AX
push ax
popf ; Try to pop the 0
pushf
pop ax ; Get results of popping 0 into flags
popf ; Restore original flags
or ax,ax
jns @@Have286 ; If no sign bit, have a 286
mov cx, lgth_no286MSG
mov dx, offset DGROUP: no286MSG
jmp MsgExit3
@@Have286:
; IDsoft - End of modifications (there's also a code segment string)
;
;===================
IFDEF __BOSS__
; Determine if in real mode
mov ax,0FB42h ; find out if DPMI loader is here
mov bx,1 ; get info function
int 2fh ;
push ax ;
mov ax, cs ; now, save DGROUP
add ax, cx ;
mov es, ax ;
mov dx, ds ;
mov es:DGROUP@@, dx ;
mov es:CSalias@@, ax ;
pop ax ;
; cmp ax,0001h ; if not "TRUE"
; JNE InRealMode
; 8 is the value of the alias selector
; in this system
MOV _protected@, cx
MOV _hugeincval@, cx
clc
mov ax, cx
xor cx, cx
or ax, ax
je @@gotshift
@@shiftcnt:
rcr ax,1
jc @@gotshift
inc cx
jmp @@shiftcnt
@@gotshift:
mov _shiftcount@,cx
; used by emulator
; PUSH DS
; MOV AX, 0E502H ; prot kernel function, get LDT alias
; INT 21H
; POP DS
; MOV _LDT@, AX
; cmp _protected@,0001h ; if not "TRUE"
; JNE InRealMode
.286P
IFE LDATA
mov dx, ds ;
; LSL AX, DX ;
; DEC AX ;
MOV AX, 0FFFEh ;
MOV SP, AX ;
MOV SS, DX ;
ENDIF
.8086
; JMP BossSkip
InRealMode label near
ENDIF
; Count the number of environment variables and compute the size.
; Each variable is ended by a 0 and a zero-length variable stops
; the environment. The environment can NOT be greater than 32k.
les di, dword ptr _envLng@
mov ax, di
mov bx, ax
mov cx, 07FFFh ; Environment cannot be > 32 Kbytes
cld
@@EnvLoop:
repnz scasb
jcxz InitFailed ; Bad environment !!!
IFDEF __BOSS__
jmp InitOK
InitFailed: jmp near ptr _abort
InitOK:
ENDIF
inc bx ; BX = Nb environment variables
cmp es:[di], al
jne @@EnvLoop ; Next variable ...
or ch, 10000000b
neg cx
mov _envLng@, cx ; Save Environment size
mov cx, dPtrSize / 2
shl bx, cl
add bx, dPtrSize * 4
and bx, not ((dPtrSize * 4) - 1)
mov _envSize@, bx ; Save Environment Variables Nb.
IFNDEF __BOSS__
; Determine the amount of memory that we need to keep
IFDEF _DSSTACK_
mov dx, ds
ELSE
mov dx, ss
ENDIF
sub bp, dx ; BP = remaining size in paragraphs
IF LDATA
mov di, seg __stklen
mov es, di
mov di, es:__stklen ; DI = Requested stack size
ELSE
mov di, __stklen ; DI = Requested stack size
ENDIF
;
; Make sure that the requested stack size is at least MINSTACK words.
;
cmp di, 2*MINSTACK ; requested stack big enough ?
jae AskedStackOK
mov di, 2*MINSTACK ; no --> use minimal value
IF LDATA
mov es:__stklen, di ; override requested stack size
ELSE
mov __stklen, di ; override requested stack size
ENDIF
AskedStackOK label near
IFDEF _DSSTACK_
add di, offset DGROUP: edata@
jb InitFailed ; DATA segment can NOT be > 64 Kbytes
ENDIF
IF LDATA EQ false
add di, __heaplen
jb InitFailed ; DATA segment can NOT be > 64 Kbytes
ENDIF
mov cl, 4
shr di, cl ; $$$ Do not destroy CL $$$
inc di ; DI = DS size in paragraphs
cmp bp, di
IF LDATA EQ false
jb InitFailed ; Not enough memory
cmp __stklen, 0
je ExpandDS ; Expand DS up to 64 Kb
cmp __heaplen, 0
jne ExcessOfMemory ; Much more available than needed
ExpandDS label near
mov di, 1000h
cmp bp, di
ja ExcessOfMemory ; Enough to run the program
mov di, bp
jmp short ExcessOfMemory ; Enough to run the program
ELSE
jnb ExcessOfMemory ; Much more available than needed
ENDIF
; All initialization errors arrive here
InitFailed label near
jmp near ptr _abort
; Return to DOS the amount of memory in excess
; Set far heap base and pointer
ExcessOfMemory label near
mov bx, di
add bx, dx
mov word ptr _heapbase@ + 2, bx
mov word ptr _brklvl@ + 2, bx
mov ax, _psp@
sub bx, ax ; BX = Number of paragraphs to keep
mov es, ax ; ES = Program Segment Prefix address
mov ah, 04Ah
push di ; preserve DI
int 021h ; this call clobbers SI,DI,BP !!!!!!
pop di ; restore DI
shl di, cl ; $$$ CX is still equal to 4 $$$
cli ; req'd for pre-1983 88/86s
mov ss, dx ; Set the program stack
mov sp, di
sti
IFNDEF _DSSTACK_
mov ax, seg __stklen
mov es, ax
mov es:__stklen, di ; If separate stack segment, save size
ENDIF
ENDIF ; __BOSS__
IFNDEF __HUGE__
; Reset uninitialized data area
xor ax, ax
mov es, cs:DGROUP@@
mov di, offset DGROUP: bdata@
mov cx, offset DGROUP: edata@
sub cx, di
cld
rep stosb
ENDIF
; If default number of file handles have changed then tell DOS
cmp __nfile, 20
jbe @@NoChange
cmp _osmajor@, 3 ; Check for >= DOS 3.3
jb @@NoChange
ja @@DoChange
cmp _osminor@, 1Eh
jb @@NoChange
@@DoChange:
mov ax, 5801h ; Set last fit allocation
mov bx, 2
int 21h
jc @@BadInit
mov ah, 67h ; Expand handle table
mov bx, __nfile
int 21h
jc @@BadInit
mov ah, 48h ; Allocate 16 bytes to find new
mov bx, 1 ; top of memory address
int 21h
jc @@BadInit
inc ax ; Adjust address to point after block
mov word ptr _heaptop@ + 2, ax
dec ax ; Change back and release block
mov es, ax
mov ah, 49h
int 21h
jc @@BadInit
mov ax, 5801h ; Set first fit allocation
mov bx, 0
int 21h
jnc @@NoChange
@@BadInit: jmp near ptr _abort
@@NoChange:
; Prepare main arguments
mov ah, 0
int 1ah ; get current BIOS time in ticks
mov word ptr _StartTime@,dx ; save it for clock() fn
mov word ptr _StartTime@+2,cx
or al,al ; was midnight flag set?
jz @@NotMidnight
mov ax,40h ; set BIOS midnight flag
mov es,ax ; at 40:70
mov bx,70h
mov byte ptr es:[bx],1
@@NotMidnight:
xor bp,bp ; set BP to 0 for overlay mgr
mov es, cs:DGROUP@@
mov si,offset DGROUP:InitStart ;si = start of table
mov di,offset DGROUP:InitEnd ;di = end of table
call StartExit
; ExitCode = main(argc,argv,envp);
IF LDATA
push word ptr __C0environ+2
push word ptr __C0environ
push word ptr __C0argv+2
push word ptr __C0argv
ELSE
push word ptr __C0environ
push word ptr __C0argv
ENDIF
push __C0argc
call _main
; Flush and close streams and files
push ax
call _exit
;---------------------------------------------------------------------------
; _cleanup() call all #pragma exit cleanup routines.
; _checknull() check for null pointer zapping copyright message
; _terminate(int) exit program with error code
;
; These functions are called by exit(), _exit(), _cexit(),
; and _c_exit().
;---------------------------------------------------------------------------
; Call cleanup routines
__cleanup PROC DIST
PUBLIC __cleanup
mov es, cs:DGROUP@@
push si
push di
mov si,offset DGROUP:ExitStart
mov di,offset DGROUP:ExitEnd
call StartExit
pop di
pop si
ret
__cleanup ENDP
; Check for null pointers before exit
__checknull PROC DIST
PUBLIC __checknull
IF LDATA EQ false
IFNDEF __TINY__
push si
push di
mov es, cs:DGROUP@@
xor ax, ax
mov si, ax
mov cx, lgth_CopyRight
ComputeChecksum label near
add al, es:[si]
adc ah, 0
inc si
loop ComputeChecksum
sub ax, CheckSum
jz @@SumOk
mov cx, lgth_NullCheck
mov dx, offset DGROUP: NullCheck
call ErrorDisplay
@@SumOK: pop di
pop si
ENDIF
ENDIF
ret
__checknull ENDP
; Exit to DOS
__terminate PROC DIST
PUBLIC __terminate
mov bp,sp
mov ah,4Ch
mov al,[bp+cPtrSize]
int 21h ; Exit to DOS
__terminate ENDP
STARTX ENDP
SUBTTL Vector save/restore & default Zero divide routines
PAGE
;[]------------------------------------------------------------[]
;| |
;| Interrupt Save/Restore routines and default divide by zero |
;| handler. |
;| |
;[]------------------------------------------------------------[]
ZeroDivision PROC FAR
mov cx, lgth_ZeroDivMSG
mov dx, offset DGROUP: ZeroDivMSG
jmp MsgExit3
ZeroDivision ENDP
;--------------------------------------------------------------------------
; savevectors()
;
; Save vectors for 0, 4, 5 & 6 interrupts. This is for extended
; signal()/raise() support as the signal functions can steal these
; vectors during runtime.
;--------------------------------------------------------------------------
SaveVectors PROC NEAR
push ds
; Save INT 0
mov ax, 3500h
int 021h
mov word ptr _Int0Vector@, bx
mov word ptr _Int0Vector@+2, es
; Save INT 4
mov ax, 3504h
int 021h
mov word ptr _Int4Vector@, bx
mov word ptr _Int4Vector@+2, es
; Save INT 5
mov ax, 3505h
int 021h
mov word ptr _Int5Vector@, bx
mov word ptr _Int5Vector@+2, es
; Save INT 6
mov ax, 3506h
int 021h
mov word ptr _Int6Vector@, bx
mov word ptr _Int6Vector@+2, es
;
; Install default divide by zero handler.
;
mov ax, 2500h
mov dx, cs
mov ds, dx
mov dx, offset ZeroDivision
int 21h
pop ds
ret
SaveVectors ENDP
;--------------------------------------------------------------------------
; _restorezero() puts back all the vectors that SaveVectors took.
;
;NOTE : TSRs must BE AWARE that signal() functions which take these
; vectors will be deactivated if the keep() function is executed.
; If a TSR wants to use the signal functions when it is active it
; will have to save/restore these vectors itself when activated and
; deactivated.
;--------------------------------------------------------------------------
__restorezero PROC DIST
PUBLIC __restorezero
IFDEF __HUGE__
push ds
mov ds, cs: DGROUP@@
ENDIF
push ds
mov ax, 2500h
lds dx, _Int0Vector@
int 21h
pop ds
push ds
mov ax, 2504h
lds dx, _Int4Vector@
int 21h
pop ds
push ds
mov ax, 2505h
lds dx, _Int5Vector@
int 21h
pop ds
IFNDEF __HUGE__
push ds
ENDIF
mov ax, 2506h
lds dx, _Int6Vector@
int 21h
pop ds
ret
ENDP
;------------------------------------------------------------------
; Loop through a startup/exit (SE) table,
; calling functions in order of priority.
; ES:SI is assumed to point to the beginning of the SE table
; ES:DI is assumed to point to the end of the SE table
; First 64 priorities are reserved by Borland
;------------------------------------------------------------------
PNEAR EQU 0
PFAR EQU 1
NOTUSED EQU 0ffh
SE STRUC
calltype db ? ; 0=near,1=far,ff=not used
priority db ? ; 0=highest,ff=lowest
addrlow dw ?
addrhigh dw ?
SE ENDS
StartExit proc near
@@Start: cmp si,offset DGROUP:InitStart ; startup or exit?
je @@StartLow ; it's startup
xor ah,ah ; start with high priority
jmp short @@SaveEnd
@@StartLow: mov ah,0ffh ;start with lowest priority
@@SaveEnd: mov dx,di ;set sentinel to end of table
mov bx,si ;bx = start of table
@@TopOfTable: cmp bx,di ;and the end of the table?
je @@EndOfTable ;yes, exit the loop
cmp es:[bx.calltype],NOTUSED;check the call type
je @@Next
cmp si,offset DGROUP:InitStart ; startup or exit?
je @@CompareHigh ; it's startup
cmp ah,es:[bx.priority] ; it's exit
jmp short @@CheckPrior ; if priority too low, skip
@@CompareHigh: cmp es:[bx.priority],ah ;check the priority
@@CheckPrior: ja @@Next ;too high? skip
mov ah,es:[bx.priority] ;keep priority
mov dx,bx ;keep index in dx
@@Next: add bx,SIZE SE ;bx = next item in table
jmp @@TopOfTable
@@EndOfTable: cmp dx,di ;did we exhaust the table?
je @@Done ;yes, quit
mov bx,dx ;bx = highest priority item
cmp es:[bx.calltype],PNEAR ;is it near or far?
mov es:[bx.calltype],NOTUSED;wipe the call type
push es ;save es
je @@NearCall
@@FarCall: call DWORD PTR es:[bx.addrlow]
pop es ;restore es
jmp short @@Start
@@NearCall: call WORD PTR es:[bx.addrlow]
pop es ;restore es
jmp short @@Start
@@Done: ret
endp
;------------------------------------------------------------------
ErrorDisplay PROC NEAR
mov ah, 040h
mov bx, 2
int 021h
ret
ErrorDisplay ENDP
_abort PROC DIST
PUBLIC _abort
mov cx, lgth_abortMSG
mov dx, offset DGROUP: abortMSG
MsgExit3 label near
mov ds, cs: DGROUP@@
call ErrorDisplay
CallExit3 label near
mov ax, 3
push ax
call __exit ; _exit(3);
ENDP
; The DGROUP@ variable is used to reload DS with DGROUP
PubSym@ DGROUP@, <dw ?>, __PASCAL__
IFDEF __BOSS__
PubSym@ CSalias@,<dw ?>, __PASCAL__
ENDIF
; __MMODEL is used to determine the memory model or the default
; pointer types at run time.
public __MMODEL
__MMODEL dw MMODEL
_TEXT ENDS
SUBTTL Start Up Data Area
PAGE
;[]------------------------------------------------------------[]
;| Start Up Data Area |
;| |
;| WARNING Do not move any variables in the data |
;| segment unless you're absolutely sure |
;| that it does not matter. |
;[]------------------------------------------------------------[]
_DATA SEGMENT
; Magic symbol used by the debug info to locate the data segment
public DATASEG@
DATASEG@ label byte
; The CopyRight string must NOT be moved or changed without
; changing the null pointer check logic
CopyRight db 4 dup(0)
db 'Borland C++ - Copyright 1991 Borland Intl.',0
lgth_CopyRight equ $ - CopyRight
IF LDATA EQ false
IFNDEF __TINY__
CheckSum equ 00D5Ch
NullCheck db 'Null pointer assignment', 13, 10
lgth_NullCheck equ $ - NullCheck
ENDIF
ENDIF
ZeroDivMSG db 'Divide error', 13, 10
lgth_ZeroDivMSG equ $ - ZeroDivMSG
abortMSG db 'Abnormal program termination', 13, 10
lgth_abortMSG equ $ - abortMSG
; JAB - Added string for no 286
no286MSG db 'Sorry, this program requires a 286 or better.', 13, 10
lgth_no286MSG equ $ - no286MSG
; JAB - End of modifications
;
; Interrupt vector save areas
;
; Interrupt vectors 0,4,5 & 6 are saved at startup and then restored
; when the program terminates. The signal/raise functions might
; steal these vectors during execution.
;
; Note: These vectors save area must not be altered
; without changing the save/restore logic.
;
PubSym@ _Int0Vector <dd 0>, __CDECL__
PubSym@ _Int4Vector <dd 0>, __CDECL__
PubSym@ _Int5Vector <dd 0>, __CDECL__
PubSym@ _Int6Vector <dd 0>, __CDECL__
;
; Miscellaneous variables
;
PubSym@ _C0argc, <dw 0>, __CDECL__
dPtrPub@ _C0argv, 0, __CDECL__
dPtrPub@ _C0environ, 0, __CDECL__
PubSym@ _envLng, <dw 0>, __CDECL__
PubSym@ _envseg, <dw 0>, __CDECL__
PubSym@ _envSize, <dw 0>, __CDECL__
PubSym@ _psp, <dw 0>, __CDECL__
PubSym@ _version, <label word>, __CDECL__
PubSym@ _osversion, <label word>, __CDECL__
PubSym@ _osmajor, <db 0>, __CDECL__
PubSym@ _osminor, <db 0>, __CDECL__
PubSym@ errno, <dw 0>, __CDECL__
PubSym@ _StartTime, <dw 0,0>, __CDECL__
IFDEF __BOSS__
PubSym@ _protected <dw 0>, __CDECL__
PubSym@ _shiftcount, <dw 12>, __CDECL__
PubSym@ _hugeincval, <dw 1000h>, __CDECL__
ENDIF
; Memory management variables
IF LDATA EQ false
PubSym@ __heapbase, <dw DGROUP:edata@>, __CDECL__
ENDIF
IFNDEF __HUGE__
PubSym@ __brklvl, <dw DGROUP:edata@>, __CDECL__
ENDIF
PubSym@ _heapbase, <dd 0>, __CDECL__
PubSym@ _brklvl, <dd 0>, __CDECL__
PubSym@ _heaptop, <dd 0>, __CDECL__
; If stack in DS and Large data model then override location of __emu
IFDEF _DSSTACK_
IF LDATA
public __emu
__emu db 044h DUP (0)
db 0CCh DUP (?)
ENDIF
ENDIF
_DATA ENDS
_CVTSEG SEGMENT
PubSym@ _RealCvtVector, <label word>, __CDECL__
ENDS
_SCNSEG SEGMENT
PubSym@ _ScanTodVector, <label word>, __CDECL__
ENDS
IFNDEF __HUGE__
_BSS SEGMENT
bdata@ label byte
ENDS
_BSSEND SEGMENT
edata@ label byte
ENDS
ENDIF
IFNDEF __TINY__
_STACK SEGMENT
IFDEF __BOSS__
IF LDATA
db 1400h dup(?)
ENDIF
ELSE
db 128 dup(?) ;minimum stack size
ENDIF ; __BOSS__
ENDS
ENDIF ; __TINY__
END STARTX

66
D3_ASM.ASM Normal file
View file

@ -0,0 +1,66 @@
; JABHACK.ASM
.386C
IDEAL
MODEL MEDIUM
EXTRN LDIV@:far
;============================================================================
DATASEG
;============================================================================
CODESEG
; Hacked up Juan Jimenez's code a bit to just return 386/not 386
PROC _CheckIs386
PUBLIC _CheckIs386
pushf ; Save flag registers, we use them here
xor ax,ax ; Clear AX and...
push ax ; ...push it onto the stack
popf ; Pop 0 into flag registers (all bits to 0),
pushf ; attempting to set bits 12-15 of flags to 0's
pop ax ; Recover the save flags
and ax,08000h ; If bits 12-15 of flags are set to
cmp ax,08000h ; zero then it's 8088/86 or 80188/186
jz not386
mov ax,07000h ; Try to set flag bits 12-14 to 1's
push ax ; Push the test value onto the stack
popf ; Pop it into the flag register
pushf ; Push it back onto the stack
pop ax ; Pop it into AX for check
and ax,07000h ; if bits 12-14 are cleared then
jz not386 ; the chip is an 80286
mov ax,1 ; We now assume it's a 80386 or better
popf
retf
not386:
xor ax,ax
popf
retf
ENDP
PROC _jabhack2
PUBLIC _jabhack2
push es
mov ax,seg LDIV@
mov es,ax
mov ax,9090h ;Two NOP's
mov [WORD FAR es:LDIV@],ax ;Patch over XOR AX,AX
mov [WORD FAR es:LDIV@+2],ax ;and over JMP SHORT COMMON
pop es
retf
ENDP
END

414
D3_DASM2.ASM Normal file
View file

@ -0,0 +1,414 @@
.386C
IDEAL
MODEL MEDIUM,C
;============================================================================
DATASEG
EXTRN mr_rowofs:WORD
EXTRN mr_count:WORD
EXTRN mr_xstep:WORD
EXTRN mr_ystep:WORD
EXTRN mr_xfrac:WORD
EXTRN mr_yfrac:WORD
EXTRN mr_dest:WORD
EXTRN jimflags:WORD
EXTRN shadingtable:DWORD
FARDATA
planepics db 8192 dup(?) ; // 4k of ceiling, 4k of floor
PUBLIC planepics
;============================================================================
CODESEG
;============================
;
; MapLSRow
;
;============================
PROC MapLSRow
PUBLIC MapLSRow
push esi
push edi
push ebp
push ds
mov ax,[WORD shadingtable + 2]
mov fs,ax
mov bp,[mr_rowofs]
mov cx,[mr_count]
mov dx,[mr_ystep]
shl edx,16
mov dx,[mr_xstep]
mov si,[mr_yfrac]
shl esi,16
mov si,[mr_xfrac]
mov di,[mr_dest]
mov ax,SEG planepics
mov ds,ax
mov ax,0a000h
mov es,ax
; eax and mask
; ebx scratch offset and pixel values
; ecx loop counter
; edx packed x / y step values
; esi packed x / y fractional values
; edi write pointer
; ebp toprow to bottomrow delta
; es: screenseg
; ds: pictures
@@pixelloop:
shld ebx,esi,22 ; shift y units in
shld ebx,esi,7 ; shift x units in and one extra bit
and bx,1111111111110b ; mask off extra top bits and 0 low bit
add esi,edx ; position += step
mov ax,[bx] ; get two source pixel
mov bx,ss:[WORD shadingtable]
mov bl,al ; map ceiling pixel
mov al,[fs:bx] ; map ceiling pixel
mov [es:di],al ; write ceiling pixel
mov bl,ah ; map floor pixel
mov ah,[fs:bx] ; map floor pixel
mov [es:di+bp],ah ; write floor pixel
inc di
loop @@pixelloop
pop ds
pop ebp
pop edi
pop esi
retf
ENDP
;============================
;
; F_MapLSRow
;
;============================
PROC F_MapLSRow
PUBLIC F_MapLSRow
push esi
push edi
push ebp
push ds
mov ax,[WORD shadingtable + 2]
mov fs,ax
mov bp,[mr_rowofs]
mov cx,[mr_count]
mov dx,[mr_ystep]
shl edx,16
mov dx,[mr_xstep]
mov si,[mr_yfrac]
shl esi,16
mov si,[mr_xfrac]
mov di,[mr_dest]
mov ax,SEG planepics
mov ds,ax
mov ax,0a000h
mov es,ax
; eax and mask
; ebx scratch offset and pixel values
; ecx loop counter
; edx packed x / y step values
; esi packed x / y fractional values
; edi write pointer
; ebp toprow to bottomrow delta
; es: screenseg
; ds: pictures
@@pixelloop:
shld ebx,esi,22 ; shift y units in
shld ebx,esi,7 ; shift x units in and one extra bit
and bx,1111111111110b ; mask off extra top bits and 0 low bit
add esi,edx ; position += step
mov ax,[bx] ; get two source pixel
mov bx,ss:[WORD shadingtable]
mov bl,ah ; map floor pixel
mov ah,[fs:bx] ; map floor pixel
mov [es:di+bp],ah ; write floor pixel
inc di
loop @@pixelloop
pop ds
pop ebp
pop edi
pop esi
retf
ENDP
;============================
;
; C_MapLSRow
;
;============================
PROC C_MapLSRow
PUBLIC C_MapLSRow
push esi
push edi
push ebp
push ds
mov ax,[WORD shadingtable + 2]
mov fs,ax
mov bp,[mr_rowofs]
mov cx,[mr_count]
mov dx,[mr_ystep]
shl edx,16
mov dx,[mr_xstep]
mov si,[mr_yfrac]
shl esi,16
mov si,[mr_xfrac]
mov di,[mr_dest]
mov ax,SEG planepics
mov ds,ax
mov ax,0a000h
mov es,ax
; eax and mask
; ebx scratch offset and pixel values
; ecx loop counter
; edx packed x / y step values
; esi packed x / y fractional values
; edi write pointer
; ebp toprow to bottomrow delta
; es: screenseg
; ds: pictures
@@pixelloop:
shld ebx,esi,22 ; shift y units in
shld ebx,esi,7 ; shift x units in and one extra bit
and bx,1111111111110b ; mask off extra top bits and 0 low bit
add esi,edx ; position += step
mov ax,[bx] ; get two source pixel
mov bx,ss:[WORD shadingtable]
mov bl,al ; map ceiling pixel
mov al,[fs:bx] ; map ceiling pixel
mov [es:di],al ; write ceiling pixel
inc di
loop @@pixelloop
pop ds
pop ebp
pop edi
pop esi
retf
ENDP
;============================
;
; MapRow
;
;============================
PROC MapRow
PUBLIC MapRow
push esi
push edi
push ebp
push ds
mov bp,[mr_rowofs]
mov cx,[mr_count]
mov dx,[mr_ystep]
shl edx,16
mov dx,[mr_xstep]
mov si,[mr_yfrac]
shl esi,16
mov si,[mr_xfrac]
mov di,[mr_dest]
mov ax,SEG planepics
mov ds,ax
mov ax,0a000h
mov es,ax
; eax and mask
; ebx scratch offset and pixel values
; ecx loop counter
; edx packed x / y step values
; esi packed x / y fractional values
; edi write pointer
; ebp toprow to bottomrow delta
; es: screenseg
; ds: pictures
@@pixelloop:
shld ebx,esi,22 ; shift y units in
shld ebx,esi,7 ; shift x units in and one extra bit
and bx,1111111111110b ; mask off extra top bits and 0 low bit
add esi,edx ; position += step
mov ax,[bx] ; get two source pixel
mov [es:di],al ; write ceiling pixel
mov [es:di+bp],ah ; write floor pixel
inc di
loop @@pixelloop
pop ds
pop ebp
pop edi
pop esi
retf
ENDP
;============================
;
; F_MapRow
;
;============================
PROC F_MapRow
PUBLIC F_MapRow
push esi
push edi
push ebp
push ds
mov bp,[mr_rowofs]
mov cx,[mr_count]
mov dx,[mr_ystep]
shl edx,16
mov dx,[mr_xstep]
mov si,[mr_yfrac]
shl esi,16
mov si,[mr_xfrac]
mov di,[mr_dest]
mov ax,SEG planepics
mov ds,ax
mov ax,0a000h
mov es,ax
; eax and mask
; ebx scratch offset and pixel values
; ecx loop counter
; edx packed x / y step values
; esi packed x / y fractional values
; edi write pointer
; ebp toprow to bottomrow delta
; es: screenseg
; ds: pictures
@@pixelloop:
shld ebx,esi,22 ; shift y units in
shld ebx,esi,7 ; shift x units in and one extra bit
and bx,1111111111110b ; mask off extra top bits and 0 low bit
add esi,edx ; position += step
mov ax,[bx] ; get two source pixel
mov [es:di+bp],ah ; write floor pixel
inc di
loop @@pixelloop
pop ds
pop ebp
pop edi
pop esi
retf
ENDP
;============================
;
; C_MapRow
;
;============================
PROC C_MapRow
PUBLIC C_MapRow
push esi
push edi
push ebp
push ds
mov bp,[mr_rowofs]
mov cx,[mr_count]
mov dx,[mr_ystep]
shl edx,16
mov dx,[mr_xstep]
mov si,[mr_yfrac]
shl esi,16
mov si,[mr_xfrac]
mov di,[mr_dest]
mov ax,SEG planepics
mov ds,ax
mov ax,0a000h
mov es,ax
; eax and mask
; ebx scratch offset and pixel values
; ecx loop counter
; edx packed x / y step values
; esi packed x / y fractional values
; edi write pointer
; ebp toprow to bottomrow delta
; es: screenseg
; ds: pictures
@@pixelloop:
shld ebx,esi,22 ; shift y units in
shld ebx,esi,7 ; shift x units in and one extra bit
and bx,1111111111110b ; mask off extra top bits and 0 low bit
add esi,edx ; position += step
mov ax,[bx] ; get two source pixel
mov [es:di],al ; write ceiling pixel
inc di
loop @@pixelloop
pop ds
pop ebp
pop edi
pop esi
retf
ENDP
END

754
D3_DR_A.ASM Normal file
View file

@ -0,0 +1,754 @@
IDEAL
MODEL MEDIUM,C
P286
SCREENSEG = 0a000h
FINEANGLES = 3600
DEG90 = 900
DEG180 = 1800
DEG270 = 2700
DEG360 = 3600
OP_JLE = 07eh
OP_JGE = 07dh
EXTRN finetangent:DWORD ; far array, starts at offset 0
EXTRN HitHorizWall:FAR
EXTRN HitVertWall:FAR
EXTRN HitHorizDoor:FAR
EXTRN HitVertDoor:FAR
EXTRN HitHorizPWall:FAR
EXTRN HitVertPWall:FAR
DATASEG
EXTRN viewwidth:WORD
EXTRN tilemap:BYTE
EXTRN spotvis:BYTE
EXTRN pixelangle:WORD
EXTRN midangle:WORD
EXTRN angle:WORD
EXTRN focaltx:WORD
EXTRN focalty:WORD
EXTRN viewtx:WORD
EXTRN viewty:WORD
EXTRN viewx:DWORD
EXTRN viewy:DWORD
EXTRN xpartialup:WORD
EXTRN ypartialup:WORD
EXTRN xpartialdown:WORD
EXTRN ypartialdown:WORD
EXTRN tilehit:WORD
EXTRN pixx:WORD
EXTRN wallheight:WORD ; array of VIEWWIDTH entries
EXTRN xtile:WORD
EXTRN ytile:WORD
EXTRN xtilestep:WORD
EXTRN ytilestep:WORD
EXTRN xintercept:DWORD
EXTRN yintercept:DWORD
EXTRN xstep:DWORD
EXTRN ystep:DWORD
EXTRN doorposition:WORD ; table of door position values
EXTRN pwallpos:WORD ; amound a pushable wall has been moved
CODESEG
;-------------------
;
; xpartialbyystep
;
; multiplies long [ystep] (possibly negative), by word [xpartial] (in BX)
;
; returns dx:ax
; trashes bx,cx,di
;
;-------------------
PROC xpartialbyystep NEAR
;
; setup
;
mov ax,[WORD ystep]
mov cx,[WORD ystep+2]
or cx,cx ; is ystep negatice?
jns @@multpos
;
; multiply negative cx:ax by bx
;
neg cx
neg ax
sbb cx,0
mul bx ; fraction*fraction
mov di,dx ; di is low word of result
mov ax,cx ;
mul bx ; units*fraction
add ax,di
adc dx,0
neg dx
neg ax
sbb dx,0
ret
;
; multiply positive cx:ax by bx
;
EVEN
@@multpos:
mul bx ; fraction*fraction
mov di,dx ; di is low word of result
mov ax,cx ;
mul bx ; units*fraction
add ax,di
adc dx,0
ret
ENDP
;-------------------
;
; ypartialbyxstep
;
; multiplies long [xstep] (possibly negative), by word [ypartial] (in BP)
;
; returns dx:ax
; trashes cx,di,bp
;
;-------------------
PROC ypartialbyxstep NEAR
;
; setup
;
mov ax,[WORD xstep]
mov cx,[WORD xstep+2]
or cx,cx ; is ystep negatice?
jns @@multpos
;
; multiply negative cx:ax by bx
;
neg cx
neg ax
sbb cx,0
mul bp ; fraction*fraction
mov di,dx ; di is low word of result
mov ax,cx ;
mul bp ; units*fraction
add ax,di
adc dx,0
neg dx
neg ax
sbb dx,0
ret
;
; multiply positive cx:ax by bx
;
EVEN
@@multpos:
mul bp ; fraction*fraction
mov di,dx ; di is low word of result
mov ax,cx ;
mul bp ; units*fraction
add ax,di
adc dx,0
ret
ENDP
IF 1
;============================
;
; AsmRefresh
;
;
;============================
PROC AsmRefresh
PUBLIC AsmRefresh
push si
push di
push bp
mov [pixx],0
;---------------------------------------------------------------------------
;
; Setup to trace a ray through pixx view pixel
;
; CX : angle of the ray through pixx
; ES : points to segment of finetangent array for this block of code
;
; Upon entrance to initialize block
;
; BX : xpartial
; BP : ypartial
;
;---------------------------------------------------------------------------
EVEN
pixxloop:
mov ax,SEG finetangent
mov es,ax
mov cx,[midangle] ; center of view area
mov bx,[pixx]
shl bx,1
add cx,[pixelangle+bx] ; delta for this pixel
cmp cx,0
jge not0
;----------
;
; -90 - -1 degree arc
;
;----------
add cx,FINEANGLES ; -90 is the same as 270
jmp entry360
not0:
cmp cx,DEG90
jge not90
;----------
;
; 0-89 degree arc
;
;----------
entry90:
mov [xtilestep],1 ; xtilestep = 1
mov [ytilestep],-1 ; ytilestep = -1
mov [BYTE cs:horizop],OP_JGE ; patch a jge in
mov [BYTE cs:vertop],OP_JLE ; patch a jle in
mov bx,DEG90-1
sub bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
mov [WORD xstep],ax
mov [WORD xstep+2],dx ; xstep = finetangent[DEG90-1-angle]
mov bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
neg dx
neg ax
sbb dx,0
mov [WORD ystep],ax
mov [WORD ystep+2],dx ; ystep = -finetangent[angle]
mov bx,[xpartialup] ; xpartial = xpartialup
mov bp,[ypartialdown] ; ypartial = ypartialdown
jmp initvars
not90:
cmp cx,DEG180
jge not180
;----------
;
; 90-179 degree arc
;
;----------
mov ax,-1
mov [xtilestep],ax ; xtilestep = -1
mov [ytilestep],ax ; ytilestep = -1
mov [BYTE cs:horizop],OP_JLE ; patch a jle in
mov [BYTE cs:vertop],OP_JLE ; patch a jle in
mov bx,cx
shl bx,2
mov ax,[es:bx-DEG90*4]
mov dx,[es:bx+2-DEG90*4]
neg dx
neg ax
sbb dx,0
mov [WORD xstep],ax
mov [WORD xstep+2],dx ; xstep = -finetangent[angle-DEG90]
mov bx,DEG180-1
sub bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
neg dx
neg ax
sbb dx,0
mov [WORD ystep],ax
mov [WORD ystep+2],dx ; ystep = -finetangent[DEG180-1-angle]
mov bx,[xpartialdown] ; xpartial = xpartialdown
mov bp,[ypartialdown] ; ypartial = ypartialdown
jmp initvars
not180:
cmp cx,DEG270
jge not270
;----------
;
; 180-269 degree arc
;
;----------
mov [xtilestep],-1 ; xtilestep = -1
mov [ytilestep],1 ; ytilestep = 1
mov [BYTE cs:horizop],OP_JLE ; patch a jle in
mov [BYTE cs:vertop],OP_JGE ; patch a jge in
mov bx,DEG270-1
sub bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
neg dx
neg ax
sbb dx,0
mov [WORD xstep],ax
mov [WORD xstep+2],dx ; xstep = -finetangent[DEG270-1-angle]
mov bx,cx
shl bx,2
mov ax,[es:bx-DEG180*4]
mov dx,[es:bx+2-DEG180*4]
mov [WORD ystep],ax
mov [WORD ystep+2],dx ; ystep = finetangent[angle-DEG180]
mov bx,[xpartialdown] ; xpartial = xpartialdown
mov bp,[ypartialup] ; ypartial = ypartialup
jmp initvars
not270:
cmp cx,DEG360
jge not360
;----------
;
; 270-359 degree arc
;
;----------
entry360:
mov ax,1
mov [xtilestep],ax ; xtilestep = 1
mov [ytilestep],ax ; ytilestep = 1
mov [BYTE cs:horizop],OP_JGE ; patch a jge in
mov [BYTE cs:vertop],OP_JGE ; patch a jge in
mov bx,cx
shl bx,2
mov ax,[es:bx-DEG270*4]
mov dx,[es:bx+2-DEG270*4]
mov [WORD xstep],ax
mov [WORD xstep+2],dx ; xstep = finetangent[angle-DEG270]
mov bx,DEG360-1
sub bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
mov [WORD ystep],ax
mov [WORD ystep+2],dx ; ystep = finetangent[DEG360-1-angle]
mov bx,[xpartialup] ; xpartial = xpartialup
mov bp,[ypartialup] ; ypartial = ypartialup
jmp initvars
not360:
;----------
;
; 360-449 degree arc
;
;----------
sub cx,FINEANGLES ; -449 is the same as 89
jmp entry90
;---------------------------------------------------------------------------
;
; initialise variables for intersection testing
;
;---------------------------------------------------------------------------
initvars:
call NEAR xpartialbyystep ; xpartial is in BX
add ax,[WORD viewy]
adc dx,[WORD viewy+2]
mov [WORD yintercept],ax
mov [WORD yintercept+2],dx
mov si,[focaltx]
add si,[xtilestep]
mov [xtile],si ; xtile = focaltx+xtilestep
shl si,6
add si,dx ; xspot = (xtile<<6) + yinttile
call NEAR ypartialbyxstep ; ypartial is in BP
add ax,[WORD viewx]
adc dx,[WORD viewx+2]
mov [WORD xintercept],ax
mov cx,dx
mov bx,[focalty]
add bx,[ytilestep]
mov bp,bx ; ytile = focalty+ytilestep
mov di,dx
shl di,6
add di,bx ; yspot = (xinttile<<6) + ytile
mov bx,[xtile]
mov dx,[WORD yintercept+2]
mov ax,SCREENSEG
mov es,ax ; faster than mov es,[screenseg]
;---------------------------------------------------------------------------
;
; trace along this angle until we hit a wall
;
; CORE LOOP!
;
; All variables are killed when a wall is hit
;
; AX : scratch
; BX : xtile
; CX : high word of xintercept
; DX : high word of yintercept
; SI : xspot (yinttile<<6)+xtile (index into tilemap and spotvis)
; DI : yspot (xinttile<<6)+ytile (index into tilemap and spotvis)
; BP : ytile
; ES : screenseg
;
;---------------------------------------------------------------------------
;-----------------------------------------
;
; check intersections with vertical walls
;
;-----------------------------------------
EVEN
vertcheck:
cmp dx,bp
vertop: ; 0x7e = jle (ytilestep==-1)
jle horizentry ; 0x7d = jge (ytilestep==1)
vertentry:
test [BYTE tilemap+si],0ffh ; tilehit = *((byte *)tilemap+xspot);
jnz hitvert
passvert:
mov [BYTE spotvis+si],1 ; *((byte *)spotvis+xspot) = true;
add bx,[xtilestep] ; xtile+=xtilestep
mov ax,[WORD ystep]
add [WORD yintercept],ax ; yintercept += ystep
adc dx,[WORD ystep+2]
mov si,bx
shl si,6
add si,dx ; xspot = (xtile<<6)+yinttile
jmp vertcheck
EVEN
hitvert:
mov al,[BYTE tilemap+si] ; tilehit = *((byte *)tilemap+xspot);
mov [BYTE tilehit],al
or al,al ; set flags
jns notvertdoor
jmp vertdoor
notvertdoor:
mov [WORD xintercept],0
mov [WORD xintercept+2],bx
mov [xtile],bx
mov [WORD yintercept+2],dx
mov [ytile],dx
call FAR HitVertWall
jmp nextpix
;-----------
;
; check intersections with horizontal walls
;
;-----------
EVEN
horizcheck:
cmp cx,bx
horizop: ; 0x7e = jle (xtilestep==-1)
jle vertentry ; 0x7d = jge (xtilestep==1)
horizentry:
test [BYTE tilemap+di],0ffh ; tilehit = *((byte *)tilemap+yspot);
jnz hithoriz
passhoriz:
mov [BYTE spotvis+di],1 ; *((byte *)spotvis+yspot) = true;
add bp,[ytilestep] ; ytile+=ytilestep
mov ax,[WORD xstep]
add [WORD xintercept],ax ; xintercept += xstep
adc cx,[WORD xstep+2]
mov di,cx
shl di,6
add di,bp ; yspot = (xinttile<<6)+ytile
jmp horizcheck
EVEN
hithoriz:
mov al,[BYTE tilemap+di] ; tilehit = *((byte *)tilemap+yspot);
mov [BYTE tilehit],al
or al,al ; set flags
js horizdoor
mov [WORD xintercept+2],cx
mov [xtile],cx
mov [WORD yintercept],0
mov [WORD yintercept+2],bp
mov [ytile],bp
call FAR HitHorizWall
jmp nextpix
;---------------------------------------------------------------------------
;
; next pixel over
;
;---------------------------------------------------------------------------
nextpix:
mov ax,[pixx]
inc ax
mov [pixx],ax
cmp ax,[viewwidth]
jge done
jmp pixxloop
done:
pop bp
pop di
pop si
retf
ENDIF
;===========================================================================
;=============
;
; hit a special horizontal wall, so find which coordinate a door would be
; intersected at, and check to see if the door is open past that point
;
;=============
horizdoor:
mov [xtile],bx ; save off live register variables
mov [WORD yintercept+2],dx
test al,040h ; both high bits set == pushable wall
jnz horizpushwall
mov bx,ax
and bx,7fh ; strip high bit
shl bx,1 ; index into word width door table
mov ax,[WORD xstep]
mov dx,[WORD xstep+2]
sar dx,1
rcr ax,1 ; half a step gets to door position
add ax,[WORD xintercept] ; add half step to current intercept pos
adc dx,cx ; CX hold high word of xintercept
cmp cx,dx ; is it still in the same tile?
je hithmid
;
; midpoint is outside tile, so it hit the side of the wall before a door
;
continuehoriz:
mov bx,[xtile] ; reload register variables
mov dx,[WORD yintercept+2]
jmp passhoriz ; continue tracing
;
; the trace hit the door plane at pixel position AX, see if the door is
; closed that much
;
hithmid:
cmp ax,[doorposition+bx] ; position of leading edge of door
jb continuehoriz
;
; draw the door
;
mov [WORD xintercept],ax ; save pixel intercept position
mov [WORD xintercept+2],cx
mov [WORD yintercept],8000h ; intercept in middle of tile
mov [WORD yintercept+2],bp
call FAR HitHorizDoor
jmp nextpix
;============
;
; hit a sliding horizontal wall
;
;============
horizpushwall:
mov ax,[WORD xstep+2] ; multiply xstep by pwallmove (0-63)
mul [pwallpos]
mov bx,ax
mov ax,[WORD xstep]
mul [pwallpos]
add dx,bx
sar dx,1 ; then divide by 64 to accomplish a
rcr ax,1 ; fixed point multiplication
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
add ax,[WORD xintercept] ; add partial step to current intercept
adc dx,cx ; CX hold high word of xintercept
cmp cx,dx ; is it still in the same tile?
jne continuehoriz ; no, it hit the side
;
; draw the pushable wall at the new height
;
mov [WORD xintercept],ax ; save pixel intercept position
mov [WORD xintercept+2],dx
mov [WORD yintercept+2],bp
mov [WORD yintercept],0
call FAR HitHorizPWall
jmp nextpix
;===========================================================================
;=============
;
; hit a special vertical wall, so find which coordinate a door would be
; intersected at, and check to see if the door is open past that point
;
;=============
vertdoor:
mov [xtile],bx ; save off live register variables
mov [WORD yintercept+2],dx
test al,040h ; both high bits set == pushable wall
jnz vertpushwall
mov bx,ax
and bx,7fh ; strip high bit
shl bx,1 ; index into word width doorposition
mov ax,[WORD ystep]
mov dx,[WORD ystep+2]
sar dx,1
rcr ax,1 ; half a step gets to door position
add ax,[WORD yintercept] ; add half step to current intercept pos
adc dx,[WORD yintercept+2]
cmp [WORD yintercept+2],dx ; is it still in the same tile?
je hitvmid
;
; midpoint is outside tile, so it hit the side of the wall before a door
;
continuevert:
mov bx,[xtile] ; reload register variables
mov dx,[WORD yintercept+2]
jmp passvert ; continue tracing
;
; the trace hit the door plane at pixel position AX, see if the door is
; closed that much
;
hitvmid:
cmp ax,[doorposition+bx] ; position of leading edge of door
jb continuevert
;
; draw the door
;
mov [WORD yintercept],ax ; save pixel intercept position
mov [WORD xintercept],8000h ; intercept in middle of tile
mov ax,[xtile]
mov [WORD xintercept+2],ax
call FAR HitVertDoor
jmp nextpix
;============
;
; hit a sliding vertical wall
;
;============
vertpushwall:
mov ax,[WORD ystep+2] ; multiply ystep by pwallmove (0-63)
mul [pwallpos]
mov bx,ax
mov ax,[WORD ystep]
mul [pwallpos]
add dx,bx
sar dx,1 ; then divide by 64 to accomplish a
rcr ax,1 ; fixed point multiplication
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
add ax,[WORD yintercept] ; add partial step to current intercept
adc dx,[WORD yintercept+2]
cmp [WORD yintercept+2],dx ; is it still in the same tile?
jne continuevert ; no, it hit the side
;
; draw the pushable wall at the new height
;
mov [WORD yintercept],ax ; save pixel intercept position
mov [WORD yintercept+2],dx
mov bx,[xtile]
mov [WORD xintercept+2],bx
mov [WORD xintercept],0
call FAR HitVertPWall
jmp nextpix
ENDP
END

779
D3_DR_A2.ASM Normal file
View file

@ -0,0 +1,779 @@
IDEAL
MODEL MEDIUM,C
P286
SCREENSEG = 0a000h
FINEANGLES = 3600
DEG90 = 900
DEG180 = 1800
DEG270 = 2700
DEG360 = 3600
OP_JLE = 07eh
OP_JGE = 07dh
EXTRN finetangent:DWORD ; far array, starts at offset 0
EXTRN HitHorizWall:FAR
EXTRN HitVertWall:FAR
EXTRN HitHorizDoor:FAR
EXTRN HitVertDoor:FAR
EXTRN HitHorizPWall:FAR
EXTRN HitVertPWall:FAR
DATASEG
EXTRN viewwidth:WORD
EXTRN tilemap:BYTE
EXTRN spotvis:BYTE
EXTRN pixelangle:WORD
EXTRN midangle:WORD
EXTRN angle:WORD
EXTRN focaltx:WORD
EXTRN focalty:WORD
EXTRN viewtx:WORD
EXTRN viewty:WORD
EXTRN viewx:DWORD
EXTRN viewy:DWORD
EXTRN xpartialup:WORD
EXTRN ypartialup:WORD
EXTRN xpartialdown:WORD
EXTRN ypartialdown:WORD
EXTRN tilehit:WORD
EXTRN pixx:WORD
EXTRN wallheight:WORD ; array of VIEWWIDTH entries
EXTRN xtile:WORD
EXTRN ytile:WORD
EXTRN xtilestep:WORD
EXTRN ytilestep:WORD
EXTRN xintercept:DWORD
EXTRN yintercept:DWORD
EXTRN xstep:DWORD
EXTRN ystep:DWORD
EXTRN doorposition:WORD ; table of door position values
EXTRN pwallpos:WORD ; amound a pushable wall has been moved
CODESEG
;-------------------
;
; xpartialbyystep
;
; multiplies long [ystep] (possibly negative), by word [xpartial] (in BX)
;
; returns dx:ax
; trashes bx,cx,di
;
;-------------------
PROC xpartialbyystep NEAR
;
; setup
;
mov ax,[WORD ystep]
mov cx,[WORD ystep+2]
or cx,cx ; is ystep negatice?
jns @@multpos
;
; multiply negative cx:ax by bx
;
neg cx
neg ax
sbb cx,0
mul bx ; fraction*fraction
mov di,dx ; di is low word of result
mov ax,cx ;
mul bx ; units*fraction
add ax,di
adc dx,0
neg dx
neg ax
sbb dx,0
ret
;
; multiply positive cx:ax by bx
;
EVEN
@@multpos:
mul bx ; fraction*fraction
mov di,dx ; di is low word of result
mov ax,cx ;
mul bx ; units*fraction
add ax,di
adc dx,0
ret
ENDP
;-------------------
;
; ypartialbyxstep
;
; multiplies long [xstep] (possibly negative), by word [ypartial] (in BP)
;
; returns dx:ax
; trashes cx,di,bp
;
;-------------------
PROC ypartialbyxstep NEAR
;
; setup
;
mov ax,[WORD xstep]
mov cx,[WORD xstep+2]
or cx,cx ; is ystep negatice?
jns @@multpos
;
; multiply negative cx:ax by bx
;
neg cx
neg ax
sbb cx,0
mul bp ; fraction*fraction
mov di,dx ; di is low word of result
mov ax,cx ;
mul bp ; units*fraction
add ax,di
adc dx,0
neg dx
neg ax
sbb dx,0
ret
;
; multiply positive cx:ax by bx
;
EVEN
@@multpos:
mul bp ; fraction*fraction
mov di,dx ; di is low word of result
mov ax,cx ;
mul bp ; units*fraction
add ax,di
adc dx,0
ret
ENDP
;============================
;
; AsmRefresh
;
;
;============================
PROC AsmRefresh
PUBLIC AsmRefresh
push si
push di
push bp
mov [pixx],0
;---------------------------------------------------------------------------
;
; Setup to trace a ray through pixx view pixel
;
; CX : angle of the ray through pixx
; ES : points to segment of finetangent array for this block of code
;
; Upon entrance to initialize block
;
; BX : xpartial
; BP : ypartial
;
;---------------------------------------------------------------------------
EVEN
pixxloop:
mov ax,SEG finetangent
mov es,ax
mov cx,[midangle] ; center of view area
mov bx,[pixx]
shl bx,1
add cx,[pixelangle+bx] ; delta for this pixel
cmp cx,0
jge not0
;----------
;
; -90 - -1 degree arc
;
;----------
add cx,FINEANGLES ; -90 is the same as 270
jmp entry360
not0:
cmp cx,DEG90
jge not90
;----------
;
; 0-89 degree arc
;
;----------
entry90:
mov [xtilestep],1 ; xtilestep = 1
mov [ytilestep],-1 ; ytilestep = -1
mov [BYTE cs:horizop],OP_JGE ; patch a jge in
mov [BYTE cs:vertop],OP_JLE ; patch a jle in
mov bx,DEG90-1
sub bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
mov [WORD xstep],ax
mov [WORD xstep+2],dx ; xstep = finetangent[DEG90-1-angle]
mov bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
neg dx
neg ax
sbb dx,0
mov [WORD ystep],ax
mov [WORD ystep+2],dx ; ystep = -finetangent[angle]
mov bx,[xpartialup] ; xpartial = xpartialup
mov bp,[ypartialdown] ; ypartial = ypartialdown
jmp initvars
not90:
cmp cx,DEG180
jge not180
;----------
;
; 90-179 degree arc
;
;----------
mov ax,-1
mov [xtilestep],ax ; xtilestep = -1
mov [ytilestep],ax ; ytilestep = -1
mov [BYTE cs:horizop],OP_JLE ; patch a jle in
mov [BYTE cs:vertop],OP_JLE ; patch a jle in
mov bx,cx
shl bx,2
mov ax,[es:bx-DEG90*4]
mov dx,[es:bx+2-DEG90*4]
neg dx
neg ax
sbb dx,0
mov [WORD xstep],ax
mov [WORD xstep+2],dx ; xstep = -finetangent[angle-DEG90]
mov bx,DEG180-1
sub bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
neg dx
neg ax
sbb dx,0
mov [WORD ystep],ax
mov [WORD ystep+2],dx ; ystep = -finetangent[DEG180-1-angle]
mov bx,[xpartialdown] ; xpartial = xpartialdown
mov bp,[ypartialdown] ; ypartial = ypartialdown
jmp initvars
not180:
cmp cx,DEG270
jge not270
;----------
;
; 180-269 degree arc
;
;----------
mov [xtilestep],-1 ; xtilestep = -1
mov [ytilestep],1 ; ytilestep = 1
mov [BYTE cs:horizop],OP_JLE ; patch a jle in
mov [BYTE cs:vertop],OP_JGE ; patch a jge in
mov bx,DEG270-1
sub bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
neg dx
neg ax
sbb dx,0
mov [WORD xstep],ax
mov [WORD xstep+2],dx ; xstep = -finetangent[DEG270-1-angle]
mov bx,cx
shl bx,2
mov ax,[es:bx-DEG180*4]
mov dx,[es:bx+2-DEG180*4]
mov [WORD ystep],ax
mov [WORD ystep+2],dx ; ystep = finetangent[angle-DEG180]
mov bx,[xpartialdown] ; xpartial = xpartialdown
mov bp,[ypartialup] ; ypartial = ypartialup
jmp initvars
not270:
cmp cx,DEG360
jge not360
;----------
;
; 270-359 degree arc
;
;----------
entry360:
mov ax,1
mov [xtilestep],ax ; xtilestep = 1
mov [ytilestep],ax ; ytilestep = 1
mov [BYTE cs:horizop],OP_JGE ; patch a jge in
mov [BYTE cs:vertop],OP_JGE ; patch a jge in
mov bx,cx
shl bx,2
mov ax,[es:bx-DEG270*4]
mov dx,[es:bx+2-DEG270*4]
mov [WORD xstep],ax
mov [WORD xstep+2],dx ; xstep = finetangent[angle-DEG270]
mov bx,DEG360-1
sub bx,cx
shl bx,2
mov ax,[es:bx]
mov dx,[es:bx+2]
mov [WORD ystep],ax
mov [WORD ystep+2],dx ; ystep = finetangent[DEG360-1-angle]
mov bx,[xpartialup] ; xpartial = xpartialup
mov bp,[ypartialup] ; ypartial = ypartialup
jmp initvars
not360:
;----------
;
; 360-449 degree arc
;
;----------
sub cx,FINEANGLES ; -449 is the same as 89
jmp entry90
;---------------------------------------------------------------------------
;
; initialise variables for intersection testing
;
;---------------------------------------------------------------------------
initvars:
call NEAR xpartialbyystep ; xpartial is in BX
add ax,[WORD viewy]
adc dx,[WORD viewy+2]
mov [WORD yintercept],ax
mov [WORD yintercept+2],dx
mov si,[focaltx]
add si,[xtilestep]
mov [xtile],si ; xtile = focaltx+xtilestep
shl si,6
add si,dx ; xspot = (xtile<<6) + yinttile
call NEAR ypartialbyxstep ; ypartial is in BP
add ax,[WORD viewx]
adc dx,[WORD viewx+2]
mov [WORD xintercept],ax
mov cx,dx
mov bx,[focalty]
add bx,[ytilestep]
mov bp,bx ; ytile = focalty+ytilestep
mov di,dx
shl di,6
add di,bx ; yspot = (xinttile<<6) + ytile
mov bx,[xtile]
mov dx,[WORD yintercept+2]
mov ax,SCREENSEG
mov es,ax ; faster than mov es,[screenseg]
;---------------------------------------------------------------------------
;
; trace along this angle until we hit a wall
;
; CORE LOOP!
;
; All variables are killed when a wall is hit
;
; AX : scratch
; BX : xtile
; CX : high word of xintercept
; DX : high word of yintercept
; SI : xspot (yinttile<<6)+xtile (index into tilemap and spotvis)
; DI : yspot (xinttile<<6)+ytile (index into tilemap and spotvis)
; BP : ytile
; ES : screenseg
;
;---------------------------------------------------------------------------
;-----------
;
; check intersections with vertical walls
;
;-----------
EVEN
vertcheck:
cmp dx,bp
vertop: ; 0x7e = jle (ytilestep==-1)
jle horizentry ; 0x7d = jge (ytilestep==1)
vertentry:
test [BYTE tilemap+si],0ffh ; tilehit = *((byte *)tilemap+xspot);
jnz hitvert
passvert:
mov [BYTE spotvis+si],1 ; *((byte *)spotvis+xspot) = true;
add bx,[xtilestep] ; xtile+=xtilestep
mov ax,[WORD ystep]
add [WORD yintercept],ax ; yintercept += ystep
adc dx,[WORD ystep+2]
mov si,bx
shl si,6
add si,dx ; xspot = (xtile<<6)+yinttile
jmp vertcheck
EVEN
hitvert:
mov al,[BYTE tilemap+si] ; tilehit = *((byte *)tilemap+xspot);
mov [BYTE tilehit],al
or al,al ; set flags
jns notvertdoor
jmp vertdoor
notvertdoor:
mov [WORD xintercept],0
mov [WORD xintercept+2],bx
mov [xtile],bx
mov [WORD yintercept+2],dx
mov [ytile],dx
call FAR HitVertWall
jmp nextpix
;-----------
;
; check intersections with horizontal walls
;
;-----------
EVEN
horizcheck:
cmp cx,bx
horizop: ; 0x7e = jle (xtilestep==-1)
jle vertentry ; 0x7d = jge (xtilestep==1)
horizentry:
test [BYTE tilemap+di],0ffh ; tilehit = *((byte *)tilemap+yspot);
jnz hithoriz
passhoriz:
mov [BYTE spotvis+di],1 ; *((byte *)spotvis+yspot) = true;
add bp,[ytilestep] ; ytile+=ytilestep
mov ax,[WORD xstep]
add [WORD xintercept],ax ; xintercept += xstep
adc cx,[WORD xstep+2]
mov di,cx
shl di,6
add di,bp ; yspot = (xinttile<<6)+ytile
jmp horizcheck
EVEN
hithoriz:
mov al,[BYTE tilemap+di] ; tilehit = *((byte *)tilemap+yspot);
mov [BYTE tilehit],al
or al,al ; set flags
js horizdoor
mov [WORD xintercept+2],cx
mov [xtile],cx
mov [WORD yintercept],0
mov [WORD yintercept+2],bp
mov [ytile],bp
call FAR HitHorizWall
jmp nextpix
;---------------------------------------------------------------------------
;
; next pixel over
;
;---------------------------------------------------------------------------
nextpix:
mov ax,[pixx]
inc ax
mov [pixx],ax
cmp ax,[viewwidth]
jge done
jmp pixxloop
done:
pop bp
pop di
pop si
retf
;===========================================================================
;=============
;
; hit a special horizontal wall, so find which coordinate a door would be
; intersected at, and check to see if the door is open past that point
;
;=============
horizdoor:
mov [xtile],bx ; save off live register variables
mov [WORD yintercept+2],dx
test al,040h ; both high bits set == pushable wall
jnz horizpushwall
mov bx,ax
and bx,7fh ; strip high bit
shl bx,1 ; index into word width door table
mov ax,[WORD xstep]
mov dx,[WORD xstep+2]
sar dx,1
rcr ax,1 ; half a step gets to door position
add ax,[WORD xintercept] ; add half step to current intercept pos
adc dx,cx ; CX hold high word of xintercept
cmp cx,dx ; is it still in the same tile?
je hithmid
;
; midpoint is outside tile, so it hit the side of the wall before a door
;
continuehoriz:
mov bx,[xtile] ; reload register variables
mov dx,[WORD yintercept+2]
jmp passhoriz ; continue tracing
;
; the trace hit the door plane at pixel position AX, see if the door is
; closed that much
;
; draw the door
;
hithmid:
cmp ax,8000h
jb horiztrekfirst
; ax is in second half of door
mov dx,[doorposition+bx] ; position of leading edge of door
shr dx,1
add dx,8000h
cmp ax,dx
jb continuehoriz
jmp horiztrekdraw
horiztrekfirst:
; ax is in first half of door
mov dx,[doorposition+bx] ; position of leading edge of door
shr dx,1
mov bx,07fffh
sub bx,dx
cmp ax,bx
jg continuehoriz
;
; draw the trek door
;
horiztrekdraw:
mov [WORD xintercept],ax ; save pixel intercept position
mov [WORD xintercept+2],cx
mov [WORD yintercept],8000h ; intercept in middle of tile
mov [WORD yintercept+2],bp
call FAR HitHorizDoor
jmp nextpix
;============
;
; hit a sliding horizontal wall
;
;============
horizpushwall:
mov ax,[WORD xstep+2] ; multiply xstep by pwallmove (0-63)
mul [pwallpos]
mov bx,ax
mov ax,[WORD xstep]
mul [pwallpos]
add dx,bx
sar dx,1 ; then divide by 64 to accomplish a
rcr ax,1 ; fixed point multiplication
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
add ax,[WORD xintercept] ; add partial step to current intercept
adc dx,cx ; CX hold high word of xintercept
cmp cx,dx ; is it still in the same tile?
jne continuehoriz ; no, it hit the side
;
; draw the pushable wall at the new height
;
mov [WORD xintercept],ax ; save pixel intercept position
mov [WORD xintercept+2],dx
mov [WORD yintercept+2],bp
mov [WORD yintercept],0
call FAR HitHorizPWall
jmp nextpix
;===========================================================================
;=============
;
; hit a special vertical wall, so find which coordinate a door would be
; intersected at, and check to see if the door is open past that point
;
;=============
vertdoor:
mov [xtile],bx ; save off live register variables
mov [WORD yintercept+2],dx
test al,040h ; both high bits set == pushable wall
jnz vertpushwall
mov bx,ax
and bx,7fh ; strip high bit
shl bx,1 ; index into word width doorposition
mov ax,[WORD ystep]
mov dx,[WORD ystep+2]
sar dx,1
rcr ax,1 ; half a step gets to door position
add ax,[WORD yintercept] ; add half step to current intercept pos
adc dx,[WORD yintercept+2]
cmp [WORD yintercept+2],dx ; is it still in the same tile?
je hitvmid
;
; midpoint is outside tile, so it hit the side of the wall before a door
;
continuevert:
mov bx,[xtile] ; reload register variables
mov dx,[WORD yintercept+2]
jmp passvert ; continue tracing
;
; the trace hit the door plane at pixel position AX, see if the door is
; closed that much
;
;
; draw the door
;
hitvmid:
cmp ax,08000h
jb verttrekfirst
; ax is in second half of door
mov dx,[doorposition+bx] ; position of leading edge of door
shr dx,1
add dx,08000h
cmp ax,dx
jb continuevert
jmp verttrekdraw
verttrekfirst:
; ax is in first half of door
mov dx,[doorposition+bx] ; position of leading edge of door
shr dx,1
mov bx,07fffh
sub bx,dx
cmp ax,bx
jg continuevert
;
; draw the trek door
;
verttrekdraw:
mov [WORD yintercept],ax ; save pixel intercept position
mov [WORD xintercept],8000h ; intercept in middle of tile
mov ax,[xtile]
mov [WORD xintercept+2],ax
call FAR HitVertDoor
jmp nextpix
;============
;
; hit a sliding vertical wall
;
;============
vertpushwall:
mov ax,[WORD ystep+2] ; multiply ystep by pwallmove (0-63)
mul [pwallpos]
mov bx,ax
mov ax,[WORD ystep]
mul [pwallpos]
add dx,bx
sar dx,1 ; then divide by 64 to accomplish a
rcr ax,1 ; fixed point multiplication
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
sar dx,1
rcr ax,1
add ax,[WORD yintercept] ; add partial step to current intercept
adc dx,[WORD yintercept+2]
cmp [WORD yintercept+2],dx ; is it still in the same tile?
je drawvertpushw
jmp continuevert ; no, it hit the side
;
; draw the pushable wall at the new height
;
drawvertpushw:
mov [WORD yintercept],ax ; save pixel intercept position
mov [WORD yintercept+2],dx
mov bx,[xtile]
mov [WORD xintercept+2],bx
mov [WORD xintercept],0
call FAR HitVertPWall
jmp nextpix
ENDP
END

53
GFXE_BS1.H Normal file
View file

@ -0,0 +1,53 @@
//////////////////////////////////////
//
// Graphics .H file for .BS1
// IGRAB-ed on Thu Mar 17 09:56:41 1994
//
//////////////////////////////////////
typedef enum {
ENUMEND
} graphicnums;
//
// Data LUMPs
//
//
// Amount of each data item
//
#define NUMCHUNKS 864
#define NUMFONT 0
#define NUMFONTM 0
#define NUMPICS 0
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 0
#define NUMTILE8M 0
#define NUMTILE16 216
#define NUMTILE16M 648
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 0
//
// File offsets for data items
//
#define STARTFONT 0
#define STARTFONTM 0
#define STARTPICS 0
#define STARTPICM 0
#define STARTSPRITES 0
#define STARTTILE8 0
#define STARTTILE8M 0
#define STARTTILE16 0
#define STARTTILE16M 216
#define STARTTILE32 864
#define STARTTILE32M 864
#define STARTEXTERNS 864
//
// Thank you for using IGRAB!
//

53
GFXE_FIR.H Normal file
View file

@ -0,0 +1,53 @@
//////////////////////////////////////
//
// Graphics .H file for .FIR
// IGRAB-ed on Tue Aug 23 15:56:06 1994
//
//////////////////////////////////////
typedef enum {
ENUMEND
} graphicnums;
//
// Data LUMPs
//
//
// Amount of each data item
//
#define NUMCHUNKS 864
#define NUMFONT 0
#define NUMFONTM 0
#define NUMPICS 0
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 0
#define NUMTILE8M 0
#define NUMTILE16 216
#define NUMTILE16M 648
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 0
//
// File offsets for data items
//
#define STARTFONT 0
#define STARTFONTM 0
#define STARTPICS 0
#define STARTPICM 0
#define STARTSPRITES 0
#define STARTTILE8 0
#define STARTTILE8M 0
#define STARTTILE16 0
#define STARTTILE16M 216
#define STARTTILE32 864
#define STARTTILE32M 864
#define STARTEXTERNS 864
//
// Thank you for using IGRAB!
//

53
GFXE_VSI.H Normal file
View file

@ -0,0 +1,53 @@
//////////////////////////////////////
//
// Graphics .H file for .VSI
// IGRAB-ed on Tue Aug 23 15:58:29 1994
//
//////////////////////////////////////
typedef enum {
ENUMEND
} graphicnums;
//
// Data LUMPs
//
//
// Amount of each data item
//
#define NUMCHUNKS 864
#define NUMFONT 0
#define NUMFONTM 0
#define NUMPICS 0
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 0
#define NUMTILE8M 0
#define NUMTILE16 216
#define NUMTILE16M 648
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 0
//
// File offsets for data items
//
#define STARTFONT 0
#define STARTFONTM 0
#define STARTPICS 0
#define STARTPICM 0
#define STARTSPRITES 0
#define STARTTILE8 0
#define STARTTILE8M 0
#define STARTTILE16 0
#define STARTTILE16M 216
#define STARTTILE32 864
#define STARTTILE32M 864
#define STARTEXTERNS 864
//
// Thank you for using IGRAB!
//

319
GFXV_BS1.H Normal file
View file

@ -0,0 +1,319 @@
//////////////////////////////////////
//
// Graphics .H file for .BS1
// IGRAB-ed on Wed Mar 30 18:12:07 1994
//
//////////////////////////////////////
typedef enum {
TELEPORTBACKPIC=6,
// Lump Start
TELEPORT1ONPIC, // 7
TELEPORT2ONPIC, // 8
TELEPORT3ONPIC, // 9
TELEPORT4ONPIC, // 10
TELEPORT5ONPIC, // 11
TELEPORT6ONPIC, // 12
TELEPORT7ONPIC, // 13
TELEPORT8ONPIC, // 14
TELEPORT9ONPIC, // 15
TELEPORT10ONPIC, // 16
TELEPORT11ONPIC, // 17
TELEPORT12ONPIC, // 18
TELEPORT13ONPIC, // 19
TELEPORT14ONPIC, // 20
TELEPORT15ONPIC, // 21
TELEPORT16ONPIC, // 22
TELEPORT17ONPIC, // 23
TELEPORT18ONPIC, // 24
TELEPORT19ONPIC, // 25
TELEPORT20ONPIC, // 26
TELEUPONPIC, // 27
TELEDNONPIC, // 28
TELEUPOFFPIC, // 29
TELEDNOFFPIC, // 30
TELEPORT1OFFPIC, // 31
TELEPORT2OFFPIC, // 32
TELEPORT3OFFPIC, // 33
TELEPORT4OFFPIC, // 34
TELEPORT5OFFPIC, // 35
TELEPORT6OFFPIC, // 36
TELEPORT7OFFPIC, // 37
TELEPORT8OFFPIC, // 38
TELEPORT9OFFPIC, // 39
TELEPORT10OFFPIC, // 40
TELEPORT11OFFPIC, // 41
TELEPORT12OFFPIC, // 42
TELEPORT13OFFPIC, // 43
TELEPORT14OFFPIC, // 44
TELEPORT15OFFPIC, // 45
TELEPORT16OFFPIC, // 46
TELEPORT17OFFPIC, // 47
TELEPORT18OFFPIC, // 48
TELEPORT19OFFPIC, // 49
TELEPORT20OFFPIC, // 50
BACKGROUND_SCREENPIC, // 51
APOGEEPIC, // 52
PIRACYPIC, // 53
PC13PIC, // 54
LOSEPIC, // 55
AUTOMAPPIC, // 56
AUTOMAP_MAG1PIC, // 57
AUTOMAP_MAG2PIC, // 58
AUTOMAP_MAG4PIC, // 59
// Lump Start
H_ALTPIC, // 60
H_CTRLPIC, // 61
H_SPACEPIC, // 62
H_PAUSEPIC, // 63
H_ESCPIC, // 64
H_LTARROWPIC, // 65
H_UPARROWPIC, // 66
H_DNARROWPIC, // 67
H_RTARROWPIC, // 68
H_ENTERPIC, // 69
H_QPIC, // 70
H_WPIC, // 71
H_EPIC, // 72
H_IPIC, // 73
H_HPIC, // 74
H_1PIC, // 75
H_2PIC, // 76
H_3PIC, // 77
H_4PIC, // 78
H_5PIC, // 79
H_F1PIC, // 80
H_F2PIC, // 81
H_F3PIC, // 82
H_F4PIC, // 83
H_F5PIC, // 84
H_F6PIC, // 85
H_F7PIC, // 86
H_F8PIC, // 87
H_F9PIC, // 88
H_F10PIC, // 89
H_TABPIC, // 90
H_CPIC, // 91
H_FPIC, // 92
H_PPIC, // 93
H_MPIC, // 94
H_LPIC, // 95
H_SHIFTPIC, // 96
H_6PIC, // 97
H_TILDEPIC, // 98
APOGEE_LOGOPIC, // 99
VISAPIC, // 100
MCPIC, // 101
FAXPIC, // 102
H_TOPWINDOWPIC, // 103
H_LEFTWINDOWPIC, // 104
H_RIGHTWINDOWPIC, // 105
H_BOTTOMINFOPIC, // 106
// Lump Start
C_NOTSELECTEDPIC, // 107
C_SELECTEDPIC, // 108
C_NOTSELECTED_HIPIC, // 109
C_SELECTED_HIPIC, // 110
C_BABYMODEPIC, // 111
C_EASYPIC, // 112
C_NORMALPIC, // 113
C_HARDPIC, // 114
C_EPISODE1PIC, // 115
C_EPISODE2PIC, // 116
C_EPISODE3PIC, // 117
C_EPISODE4PIC, // 118
C_EPISODE5PIC, // 119
C_EPISODE6PIC, // 120
BIGGOLDSTERNPIC, // 121
STARLOGOPIC, // 122
BLAKEWITHGUNPIC, // 123
STARINSTITUTEPIC, // 124
MEDALOFHONORPIC, // 125
SMALLGOLDSTERNPIC, // 126
BLAKEWINPIC, // 127
SHUTTLEEXPPIC, // 128
PLANETSPIC, // 129
MOUSEPIC, // 130
JOYSTICKPIC, // 131
GRAVISPADPIC, // 132
STARPORTPIC, // 133
BOSSPIC, // 134
THREEPLANETSPIC, // 135
SOLARSYSTEMPIC, // 136
AOGENDINGPIC, // 137
GFLOGOSPIC, // 138
BLAKEHEADPIC, // 139
PROJECTFOLDERPIC, // 140
TITLEPIC, // 141
// Lump Start
WEAPON1PIC, // 142
WEAPON2PIC, // 143
WEAPON3PIC, // 144
WEAPON4PIC, // 145
WEAPON5PIC, // 146
WEAPON6PIC, // 147
WEAPON7PIC, // 148
W1_CORNERPIC, // 149
W2_CORNERPIC, // 150
W3_CORNERPIC, // 151
W4_CORNERPIC, // 152
W5_CORNERPIC, // 153
W6_CORNERPIC, // 154
WAITPIC, // 155
READYPIC, // 156
N_BLANKPIC, // 157
N_0PIC, // 158
N_1PIC, // 159
N_2PIC, // 160
N_3PIC, // 161
N_4PIC, // 162
N_5PIC, // 163
N_6PIC, // 164
N_7PIC, // 165
N_8PIC, // 166
N_9PIC, // 167
N_RPIC, // 168
N_OPIC, // 169
N_LPIC, // 170
N_DASHPIC, // 171
NG_BLANKPIC, // 172
NG_0PIC, // 173
NG_1PIC, // 174
NG_2PIC, // 175
NG_3PIC, // 176
NG_4PIC, // 177
NG_5PIC, // 178
NG_6PIC, // 179
NG_7PIC, // 180
NG_8PIC, // 181
NG_9PIC, // 182
DIM_LIGHTPIC, // 183
BRI_LIGHTPIC, // 184
INFOAREAPIC, // 185
TOP_STATUSBARPIC, // 186
STATUSBARPIC, // 187
ONEXZOOMPIC, // 188
TWOXZOOMPIC, // 189
FOURXZOOMPIC, // 190
NO_KEYPIC, // 191
RED_KEYPIC, // 192
YEL_KEYPIC, // 193
BLU_KEYPIC, // 194
POWERBALLTEXT=196,
PIRACYPALETTE, // 197
APOGEEPALETTE, // 198
ENDINGPALETTE, // 199
TITLEPALETTE, // 200
ORDERSCREEN, // 201
ERRORSCREEN, // 202
NO386SCREEN, // 203
MUSICTEXT, // 204
RADARTEXT, // 205
TICSTEXT, // 206
T_DEMO0, // 207
T_DEMO1, // 208
T_DEMO2, // 209
T_DEMO3, // 210
T_DEMO4, // 211
T_DEMO5, // 212
INFORMANT_HINTS, // 213
NICE_SCIE_HINTS, // 214
MEAN_SCIE_HINTS, // 215
BRIEF_W1, // 216
BRIEF_I1, // 217
BRIEF_W2, // 218
BRIEF_I2, // 219
BRIEF_W3, // 220
BRIEF_I3, // 221
BRIEF_W4, // 222
BRIEF_I4, // 223
BRIEF_W5, // 224
BRIEF_I5, // 225
BRIEF_W6, // 226
BRIEF_I6, // 227
LEVEL_DESCS, // 228
DECOY, // 229
DECOY2, // 230
DECOY3, // 231
DECOY4, // 232
HELPTEXT, // 233
SAGATEXT, // 234
LOSETEXT, // 235
ORDERTEXT, // 236
CREDITSTEXT, // 237
MUSTBE386TEXT, // 238
QUICK_INFO1_TEXT, // 239
QUICK_INFO2_TEXT, // 240
BADINFO_TEXT, // 241
CALJOY1_TEXT, // 242
CALJOY2_TEXT, // 243
READTHIS_TEXT, // 244
ELEVMSG0_TEXT, // 245
ELEVMSG1_TEXT, // 246
ELEVMSG4_TEXT, // 247
ELEVMSG5_TEXT, // 248
FLOORMSG_TEXT, // 249
YOUWIN_TEXT, // 250
CHANGEVIEW_TEXT, // 251
DIZ_ERR_TEXT, // 252
BADLEVELSTEXT, // 253
BADSAVEGAME_TEXT, // 254
ENUMEND
} graphicnums;
//
// Data LUMPs
//
#define TELEPORT_LUMP_START 7
#define TELEPORT_LUMP_END 50
#define README_LUMP_START 60
#define README_LUMP_END 106
#define CONTROLS_LUMP_START 107
#define CONTROLS_LUMP_END 120
#define LATCHPICS_LUMP_START 142
#define LATCHPICS_LUMP_END 194
//
// Amount of each data item
//
#define NUMCHUNKS 255
#define NUMFONT 5
#define NUMFONTM 0
#define NUMPICS 189
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 72
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 59
//
// File offsets for data items
//
#define STRUCTPIC 0
#define STARTFONT 1
#define STARTFONTM 6
#define STARTPICS 6
#define STARTPICM 195
#define STARTSPRITES 195
#define STARTTILE8 195
#define STARTTILE8M 196
#define STARTTILE16 196
#define STARTTILE16M 196
#define STARTTILE32 196
#define STARTTILE32M 196
#define STARTEXTERNS 196
//
// Thank you for using IGRAB!
//

312
GFXV_FIR.H Normal file
View file

@ -0,0 +1,312 @@
//////////////////////////////////////
//
// Graphics .H file for .FIR
// IGRAB-ed on Tue Aug 23 15:49:54 1994
//
//////////////////////////////////////
typedef enum {
TELEPORTBACKTOPPIC=6,
TELEPORTBACKBOTPIC, // 7
// Lump Start
TELEPORT1ONPIC, // 8
TELEPORT2ONPIC, // 9
TELEPORT3ONPIC, // 10
TELEPORT4ONPIC, // 11
TELEPORT5ONPIC, // 12
TELEPORT6ONPIC, // 13
TELEPORT7ONPIC, // 14
TELEPORT8ONPIC, // 15
TELEPORT9ONPIC, // 16
TELEPORT10ONPIC, // 17
TELEPORT11ONPIC, // 18
TELEPORT12ONPIC, // 19
TELEPORT13ONPIC, // 20
TELEPORT14ONPIC, // 21
TELEPORT15ONPIC, // 22
TELEPORT16ONPIC, // 23
TELEPORT17ONPIC, // 24
TELEPORT18ONPIC, // 25
TELEPORT19ONPIC, // 26
TELEPORT20ONPIC, // 27
TELEUPONPIC, // 28
TELEDNONPIC, // 29
TELEUPOFFPIC, // 30
TELEDNOFFPIC, // 31
TELEPORT1OFFPIC, // 32
TELEPORT2OFFPIC, // 33
TELEPORT3OFFPIC, // 34
TELEPORT4OFFPIC, // 35
TELEPORT5OFFPIC, // 36
TELEPORT6OFFPIC, // 37
TELEPORT7OFFPIC, // 38
TELEPORT8OFFPIC, // 39
TELEPORT9OFFPIC, // 40
TELEPORT10OFFPIC, // 41
TELEPORT11OFFPIC, // 42
TELEPORT12OFFPIC, // 43
TELEPORT13OFFPIC, // 44
TELEPORT14OFFPIC, // 45
TELEPORT15OFFPIC, // 46
TELEPORT16OFFPIC, // 47
TELEPORT17OFFPIC, // 48
TELEPORT18OFFPIC, // 49
TELEPORT19OFFPIC, // 50
TELEPORT20OFFPIC, // 51
BACKGROUND_SCREENPIC, // 52
APOGEEPIC, // 53
PC13PIC, // 54
LOSEPIC, // 55
AUTOMAPPIC, // 56
AUTOMAP_MAG1PIC, // 57
AUTOMAP_MAG2PIC, // 58
AUTOMAP_MAG4PIC, // 59
// Lump Start
H_ALTPIC, // 60
H_CTRLPIC, // 61
H_SPACEPIC, // 62
H_PAUSEPIC, // 63
H_ESCPIC, // 64
H_LTARROWPIC, // 65
H_UPARROWPIC, // 66
H_DNARROWPIC, // 67
H_RTARROWPIC, // 68
H_ENTERPIC, // 69
H_QPIC, // 70
H_WPIC, // 71
H_EPIC, // 72
H_IPIC, // 73
H_HPIC, // 74
H_1PIC, // 75
H_2PIC, // 76
H_3PIC, // 77
H_4PIC, // 78
H_5PIC, // 79
H_F1PIC, // 80
H_F2PIC, // 81
H_F3PIC, // 82
H_F4PIC, // 83
H_F5PIC, // 84
H_F6PIC, // 85
H_F7PIC, // 86
H_F8PIC, // 87
H_F9PIC, // 88
H_F10PIC, // 89
H_TABPIC, // 90
H_CPIC, // 91
H_FPIC, // 92
H_PPIC, // 93
H_MPIC, // 94
H_LPIC, // 95
H_SHIFTPIC, // 96
H_6PIC, // 97
H_TILDEPIC, // 98
H_PLUSPIC, // 99
H_MINUSPIC, // 100
APOGEE_LOGOPIC, // 101
VISAPIC, // 102
MCPIC, // 103
FAXPIC, // 104
H_TOPWINDOWPIC, // 105
H_LEFTWINDOWPIC, // 106
H_RIGHTWINDOWPIC, // 107
H_BOTTOMINFOPIC, // 108
// Lump Start
C_NOTSELECTEDPIC, // 109
C_SELECTEDPIC, // 110
C_NOTSELECTED_HIPIC, // 111
C_SELECTED_HIPIC, // 112
C_BABYMODEPIC, // 113
C_EASYPIC, // 114
C_NORMALPIC, // 115
C_HARDPIC, // 116
C_EPISODE1PIC, // 117
C_EPISODE2PIC, // 118
C_EPISODE3PIC, // 119
C_EPISODE4PIC, // 120
C_EPISODE5PIC, // 121
C_EPISODE6PIC, // 122
BIGGOLDSTERNPIC, // 123
STARLOGOPIC, // 124
BLAKEWITHGUNPIC, // 125
STARINSTITUTEPIC, // 126
MEDALOFHONORPIC, // 127
SMALLGOLDSTERNPIC, // 128
BLAKEWINPIC, // 129
SHUTTLEEXPPIC, // 130
PLANETSPIC, // 131
MOUSEPIC, // 132
JOYSTICKPIC, // 133
GRAVISPADPIC, // 134
STARPORTPIC, // 135
BOSSPIC, // 136
THREEPLANETSPIC, // 137
SOLARSYSTEMPIC, // 138
AOGENDINGPIC, // 139
GFLOGOSPIC, // 140
BLAKEHEADPIC, // 141
PROJECTFOLDERPIC, // 142
TITLE1PIC, // 143
TITLE2PIC, // 144
// Lump Start
WEAPON1PIC, // 145
WEAPON2PIC, // 146
WEAPON3PIC, // 147
WEAPON4PIC, // 148
WEAPON5PIC, // 149
WEAPON6PIC, // 150
WEAPON7PIC, // 151
W1_CORNERPIC, // 152
W2_CORNERPIC, // 153
W3_CORNERPIC, // 154
W4_CORNERPIC, // 155
W5_CORNERPIC, // 156
W6_CORNERPIC, // 157
WAITPIC, // 158
READYPIC, // 159
N_BLANKPIC, // 160
N_0PIC, // 161
N_1PIC, // 162
N_2PIC, // 163
N_3PIC, // 164
N_4PIC, // 165
N_5PIC, // 166
N_6PIC, // 167
N_7PIC, // 168
N_8PIC, // 169
N_9PIC, // 170
N_RPIC, // 171
N_OPIC, // 172
N_LPIC, // 173
N_DASHPIC, // 174
NG_BLANKPIC, // 175
NG_0PIC, // 176
NG_1PIC, // 177
NG_2PIC, // 178
NG_3PIC, // 179
NG_4PIC, // 180
NG_5PIC, // 181
NG_6PIC, // 182
NG_7PIC, // 183
NG_8PIC, // 184
NG_9PIC, // 185
DIM_LIGHTPIC, // 186
BRI_LIGHTPIC, // 187
INFOAREAPIC, // 188
TOP_STATUSBARPIC, // 189
STATUSBARPIC, // 190
ONEXZOOMPIC, // 191
TWOXZOOMPIC, // 192
FOURXZOOMPIC, // 193
NO_KEYPIC, // 194
RED_KEYPIC, // 195
YEL_KEYPIC, // 196
BLU_KEYPIC, // 197
POWERBALLTEXT=199,
PIRACYPALETTE, // 200
APOGEEPALETTE, // 201
ENDINGPALETTE, // 202
TITLEPALETTE, // 203
ORDERSCREEN, // 204
ERRORSCREEN, // 205
NO386SCREEN, // 206
MUSICTEXT, // 207
RADARTEXT, // 208
TICSTEXT, // 209
T_DEMO0, // 210
T_DEMO1, // 211
T_DEMO2, // 212
T_DEMO3, // 213
T_DEMO4, // 214
T_DEMO5, // 215
INFORMANT_HINTS, // 216
NICE_SCIE_HINTS, // 217
MEAN_SCIE_HINTS, // 218
BRIEF_W1, // 219
BRIEF_I1, // 220
LEVEL_DESCS, // 221
DECOY, // 222
DECOY2, // 223
DECOY3, // 224
DECOY4, // 225
HELPTEXT, // 226
SAGATEXT, // 227
LOSETEXT, // 228
ORDERTEXT, // 229
CREDITSTEXT, // 230
MUSTBE386TEXT, // 231
QUICK_INFO1_TEXT, // 232
QUICK_INFO2_TEXT, // 233
BADINFO_TEXT, // 234
CALJOY1_TEXT, // 235
CALJOY2_TEXT, // 236
READTHIS_TEXT, // 237
ELEVMSG0_TEXT, // 238
ELEVMSG1_TEXT, // 239
ELEVMSG4_TEXT, // 240
ELEVMSG5_TEXT, // 241
FLOORMSG_TEXT, // 242
YOUWIN_TEXT, // 243
CHANGEVIEW_TEXT, // 244
DIZ_ERR_TEXT, // 245
BADLEVELSTEXT, // 246
BADSAVEGAME_TEXT, // 247
ENUMEND
} graphicnums;
//
// Data LUMPs
//
#define TELEPORT_LUMP_START 8
#define TELEPORT_LUMP_END 51
#define README_LUMP_START 60
#define README_LUMP_END 108
#define CONTROLS_LUMP_START 109
#define CONTROLS_LUMP_END 122
#define LATCHPICS_LUMP_START 145
#define LATCHPICS_LUMP_END 197
//
// Amount of each data item
//
#define NUMCHUNKS 248
#define NUMFONT 5
#define NUMFONTM 0
#define NUMPICS 192
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 72
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 49
//
// File offsets for data items
//
#define STRUCTPIC 0
#define STARTFONT 1
#define STARTFONTM 6
#define STARTPICS 6
#define STARTPICM 198
#define STARTSPRITES 198
#define STARTTILE8 198
#define STARTTILE8M 199
#define STARTTILE16 199
#define STARTTILE16M 199
#define STARTTILE32 199
#define STARTTILE32M 199
#define STARTEXTERNS 199
//
// Thank you for using IGRAB!
//

215
GFXV_SOD.EQU Normal file
View file

@ -0,0 +1,215 @@
;=====================================
;
; Graphics .EQU file for .SOD
; IGRAB-ed on Fri Jun 12 18:28:09 1992
;
;=====================================
H_BJPIC = 3
H_CASTLEPIC = 4
H_KEYBOARDPIC = 5
H_JOYPIC = 6
H_HEALPIC = 7
H_TREASUREPIC = 8
H_GUNPIC = 9
H_KEYPIC = 10
H_BLAZEPIC = 11
H_WEAPON1234PIC = 12
H_WOLFLOGOPIC = 13
H_VISAPIC = 14
H_MCPIC = 15
H_IDLOGOPIC = 16
H_TOPWINDOWPIC = 17
H_LEFTWINDOWPIC = 18
H_RIGHTWINDOWPIC = 19
H_BOTTOMINFOPIC = 20
C_OPTIONSPIC = 21
C_CURSOR1PIC = 22
C_CURSOR2PIC = 23
C_NOTSELECTEDPIC = 24
C_SELECTEDPIC = 25
C_FXTITLEPIC = 26
C_DIGITITLEPIC = 27
C_MUSICTITLEPIC = 28
C_MOUSELBACKPIC = 29
C_BABYMODEPIC = 30
C_EASYPIC = 31
C_NORMALPIC = 32
C_HARDPIC = 33
C_LOADSAVEDISKPIC = 34
C_DISKLOADING1PIC = 35
C_DISKLOADING2PIC = 36
C_CONTROLPIC = 37
C_CUSTOMIZEPIC = 38
C_LOADGAMEPIC = 39
C_SAVEGAMEPIC = 40
C_EPISODE1PIC = 41
C_EPISODE2PIC = 42
C_EPISODE3PIC = 43
C_EPISODE4PIC = 44
C_EPISODE5PIC = 45
C_EPISODE6PIC = 46
C_CODEPIC = 47
C_TIMECODEPIC = 48
C_LEVELPIC = 49
C_NAMEPIC = 50
C_SCOREPIC = 51
L_GUYPIC = 52
L_COLONPIC = 53
L_NUM0PIC = 54
L_NUM1PIC = 55
L_NUM2PIC = 56
L_NUM3PIC = 57
L_NUM4PIC = 58
L_NUM5PIC = 59
L_NUM6PIC = 60
L_NUM7PIC = 61
L_NUM8PIC = 62
L_NUM9PIC = 63
L_PERCENTPIC = 64
L_APIC = 65
L_BPIC = 66
L_CPIC = 67
L_DPIC = 68
L_EPIC = 69
L_FPIC = 70
L_GPIC = 71
L_HPIC = 72
L_IPIC = 73
L_JPIC = 74
L_KPIC = 75
L_LPIC = 76
L_MPIC = 77
L_NPIC = 78
L_OPIC = 79
L_PPIC = 80
L_QPIC = 81
L_RPIC = 82
L_SPIC = 83
L_TPIC = 84
L_UPIC = 85
L_VPIC = 86
L_WPIC = 87
L_XPIC = 88
L_YPIC = 89
L_ZPIC = 90
L_EXPOINTPIC = 91
L_APOSTROPHEPIC = 92
L_GUY2PIC = 93
L_BJWINSPIC = 94
STATUSBARPIC = 95
TITLEPIC = 96
PG13PIC = 97
CREDITSPIC = 98
HIGHSCORESPIC = 99
KNIFEPIC = 100
GUNPIC = 101
MACHINEGUNPIC = 102
GATLINGGUNPIC = 103
NOKEYPIC = 104
GOLDKEYPIC = 105
SILVERKEYPIC = 106
N_BLANKPIC = 107
N_0PIC = 108
N_1PIC = 109
N_2PIC = 110
N_3PIC = 111
N_4PIC = 112
N_5PIC = 113
N_6PIC = 114
N_7PIC = 115
N_8PIC = 116
N_9PIC = 117
FACE1APIC = 118
FACE1BPIC = 119
FACE1CPIC = 120
FACE2APIC = 121
FACE2BPIC = 122
FACE2CPIC = 123
FACE3APIC = 124
FACE3BPIC = 125
FACE3CPIC = 126
FACE4APIC = 127
FACE4BPIC = 128
FACE4CPIC = 129
FACE5APIC = 130
FACE5BPIC = 131
FACE5CPIC = 132
FACE6APIC = 133
FACE6BPIC = 134
FACE6CPIC = 135
FACE7APIC = 136
FACE7BPIC = 137
FACE7CPIC = 138
FACE8APIC = 139
GOTGATLINGPIC = 140
MUTANTBJPIC = 141
PAUSEDPIC = 142
GETPSYCHEDPIC = 143
ORDERSCREEN = 145
ERRORSCREEN = 146
T_HELPART = 147
T_DEMO0 = 148
T_DEMO1 = 149
T_DEMO2 = 150
T_DEMO3 = 151
T_ENDART1 = 152
T_ENDART2 = 153
T_ENDART3 = 154
T_ENDART4 = 155
T_ENDART5 = 156
T_ENDART6 = 157
README_LUMP_START = 3
README_LUMP_END = 20
CONTROLS_LUMP_START = 21
CONTROLS_LUMP_END = 51
LEVELEND_LUMP_START = 52
LEVELEND_LUMP_END = 94
LATCHPICS_LUMP_START = 100
LATCHPICS_LUMP_END = 143
;
; Amount of each data item
;
NUMCHUNKS = 158
NUMFONT = 2
NUMFONTM = 0
NUMPICS = 141
NUMPICM = 0
NUMSPRITES = 0
NUMTILE8 = 72
NUMTILE8M = 0
NUMTILE16 = 0
NUMTILE16M = 0
NUMTILE32 = 0
NUMTILE32M = 0
NUMEXTERN = 13
;
; File offsets for data items
;
STRUCTPIC = 0
STARTFONT = 1
STARTFONTM = 3
STARTPICS = 3
STARTPICM = 144
STARTSPRITES = 144
STARTTILE8 = 144
STARTTILE8M = 145
STARTTILE16 = 145
STARTTILE16M = 145
STARTTILE32 = 145
STARTTILE32M = 145
STARTEXTERN = 145
;
; Thank you for using IGRAB!
;

312
GFXV_VSI.H Normal file
View file

@ -0,0 +1,312 @@
//////////////////////////////////////
//
// Graphics .H file for .VSI
// IGRAB-ed on Thu Sep 01 14:02:37 1994
//
//////////////////////////////////////
typedef enum {
TELEPORTBACKTOPPIC=6,
TELEPORTBACKBOTPIC, // 7
// Lump Start
TELEPORT1ONPIC, // 8
TELEPORT2ONPIC, // 9
TELEPORT3ONPIC, // 10
TELEPORT4ONPIC, // 11
TELEPORT5ONPIC, // 12
TELEPORT6ONPIC, // 13
TELEPORT7ONPIC, // 14
TELEPORT8ONPIC, // 15
TELEPORT9ONPIC, // 16
TELEPORT10ONPIC, // 17
TELEPORT11ONPIC, // 18
TELEPORT12ONPIC, // 19
TELEPORT13ONPIC, // 20
TELEPORT14ONPIC, // 21
TELEPORT15ONPIC, // 22
TELEPORT16ONPIC, // 23
TELEPORT17ONPIC, // 24
TELEPORT18ONPIC, // 25
TELEPORT19ONPIC, // 26
TELEPORT20ONPIC, // 27
TELEUPONPIC, // 28
TELEDNONPIC, // 29
TELEUPOFFPIC, // 30
TELEDNOFFPIC, // 31
TELEPORT1OFFPIC, // 32
TELEPORT2OFFPIC, // 33
TELEPORT3OFFPIC, // 34
TELEPORT4OFFPIC, // 35
TELEPORT5OFFPIC, // 36
TELEPORT6OFFPIC, // 37
TELEPORT7OFFPIC, // 38
TELEPORT8OFFPIC, // 39
TELEPORT9OFFPIC, // 40
TELEPORT10OFFPIC, // 41
TELEPORT11OFFPIC, // 42
TELEPORT12OFFPIC, // 43
TELEPORT13OFFPIC, // 44
TELEPORT14OFFPIC, // 45
TELEPORT15OFFPIC, // 46
TELEPORT16OFFPIC, // 47
TELEPORT17OFFPIC, // 48
TELEPORT18OFFPIC, // 49
TELEPORT19OFFPIC, // 50
TELEPORT20OFFPIC, // 51
BACKGROUND_SCREENPIC, // 52
APOGEEPIC, // 53
PC13PIC, // 54
LOSEPIC, // 55
AUTOMAPPIC, // 56
AUTOMAP_MAG1PIC, // 57
AUTOMAP_MAG2PIC, // 58
AUTOMAP_MAG4PIC, // 59
// Lump Start
H_ALTPIC, // 60
H_CTRLPIC, // 61
H_SPACEPIC, // 62
H_PAUSEPIC, // 63
H_ESCPIC, // 64
H_LTARROWPIC, // 65
H_UPARROWPIC, // 66
H_DNARROWPIC, // 67
H_RTARROWPIC, // 68
H_ENTERPIC, // 69
H_QPIC, // 70
H_WPIC, // 71
H_EPIC, // 72
H_IPIC, // 73
H_HPIC, // 74
H_1PIC, // 75
H_2PIC, // 76
H_3PIC, // 77
H_4PIC, // 78
H_5PIC, // 79
H_F1PIC, // 80
H_F2PIC, // 81
H_F3PIC, // 82
H_F4PIC, // 83
H_F5PIC, // 84
H_F6PIC, // 85
H_F7PIC, // 86
H_F8PIC, // 87
H_F9PIC, // 88
H_F10PIC, // 89
H_TABPIC, // 90
H_CPIC, // 91
H_FPIC, // 92
H_PPIC, // 93
H_MPIC, // 94
H_LPIC, // 95
H_SHIFTPIC, // 96
H_6PIC, // 97
H_TILDEPIC, // 98
H_PLUSPIC, // 99
H_MINUSPIC, // 100
APOGEE_LOGOPIC, // 101
VISAPIC, // 102
MCPIC, // 103
FAXPIC, // 104
H_TOPWINDOWPIC, // 105
H_LEFTWINDOWPIC, // 106
H_RIGHTWINDOWPIC, // 107
H_BOTTOMINFOPIC, // 108
// Lump Start
C_NOTSELECTEDPIC, // 109
C_SELECTEDPIC, // 110
C_NOTSELECTED_HIPIC, // 111
C_SELECTED_HIPIC, // 112
C_BABYMODEPIC, // 113
C_EASYPIC, // 114
C_NORMALPIC, // 115
C_HARDPIC, // 116
C_EPISODE1PIC, // 117
C_EPISODE2PIC, // 118
C_EPISODE3PIC, // 119
C_EPISODE4PIC, // 120
C_EPISODE5PIC, // 121
C_EPISODE6PIC, // 122
BIGGOLDSTERNPIC, // 123
STARLOGOPIC, // 124
BLAKEWITHGUNPIC, // 125
STARINSTITUTEPIC, // 126
MEDALOFHONORPIC, // 127
SMALLGOLDSTERNPIC, // 128
BLAKEWINPIC, // 129
SHUTTLEEXPPIC, // 130
PLANETSPIC, // 131
MOUSEPIC, // 132
JOYSTICKPIC, // 133
GRAVISPADPIC, // 134
STARPORTPIC, // 135
BOSSPIC, // 136
THREEPLANETSPIC, // 137
SOLARSYSTEMPIC, // 138
AOGENDINGPIC, // 139
GFLOGOSPIC, // 140
BLAKEHEADPIC, // 141
PROJECTFOLDERPIC, // 142
TITLE1PIC, // 143
TITLE2PIC, // 144
// Lump Start
WEAPON1PIC, // 145
WEAPON2PIC, // 146
WEAPON3PIC, // 147
WEAPON4PIC, // 148
WEAPON5PIC, // 149
WEAPON6PIC, // 150
WEAPON7PIC, // 151
W1_CORNERPIC, // 152
W2_CORNERPIC, // 153
W3_CORNERPIC, // 154
W4_CORNERPIC, // 155
W5_CORNERPIC, // 156
W6_CORNERPIC, // 157
WAITPIC, // 158
READYPIC, // 159
N_BLANKPIC, // 160
N_0PIC, // 161
N_1PIC, // 162
N_2PIC, // 163
N_3PIC, // 164
N_4PIC, // 165
N_5PIC, // 166
N_6PIC, // 167
N_7PIC, // 168
N_8PIC, // 169
N_9PIC, // 170
N_RPIC, // 171
N_OPIC, // 172
N_LPIC, // 173
N_DASHPIC, // 174
NG_BLANKPIC, // 175
NG_0PIC, // 176
NG_1PIC, // 177
NG_2PIC, // 178
NG_3PIC, // 179
NG_4PIC, // 180
NG_5PIC, // 181
NG_6PIC, // 182
NG_7PIC, // 183
NG_8PIC, // 184
NG_9PIC, // 185
DIM_LIGHTPIC, // 186
BRI_LIGHTPIC, // 187
INFOAREAPIC, // 188
TOP_STATUSBARPIC, // 189
STATUSBARPIC, // 190
ONEXZOOMPIC, // 191
TWOXZOOMPIC, // 192
FOURXZOOMPIC, // 193
NO_KEYPIC, // 194
RED_KEYPIC, // 195
YEL_KEYPIC, // 196
BLU_KEYPIC, // 197
POWERBALLTEXT=199,
PIRACYPALETTE, // 200
APOGEEPALETTE, // 201
ENDINGPALETTE, // 202
TITLEPALETTE, // 203
ORDERSCREEN, // 204
ERRORSCREEN, // 205
NO386SCREEN, // 206
MUSICTEXT, // 207
RADARTEXT, // 208
TICSTEXT, // 209
T_DEMO0, // 210
T_DEMO1, // 211
T_DEMO2, // 212
T_DEMO3, // 213
T_DEMO4, // 214
T_DEMO5, // 215
INFORMANT_HINTS, // 216
NICE_SCIE_HINTS, // 217
MEAN_SCIE_HINTS, // 218
BRIEF_W1, // 219
BRIEF_I1, // 220
LEVEL_DESCS, // 221
DECOY, // 222
DECOY2, // 223
DECOY3, // 224
DECOY4, // 225
HELPTEXT, // 226
SAGATEXT, // 227
LOSETEXT, // 228
ORDERTEXT, // 229
CREDITSTEXT, // 230
MUSTBE386TEXT, // 231
QUICK_INFO1_TEXT, // 232
QUICK_INFO2_TEXT, // 233
BADINFO_TEXT, // 234
CALJOY1_TEXT, // 235
CALJOY2_TEXT, // 236
READTHIS_TEXT, // 237
ELEVMSG0_TEXT, // 238
ELEVMSG1_TEXT, // 239
ELEVMSG4_TEXT, // 240
ELEVMSG5_TEXT, // 241
FLOORMSG_TEXT, // 242
YOUWIN_TEXT, // 243
CHANGEVIEW_TEXT, // 244
DIZ_ERR_TEXT, // 245
BADLEVELSTEXT, // 246
BADSAVEGAME_TEXT, // 247
ENUMEND
} graphicnums;
//
// Data LUMPs
//
#define TELEPORT_LUMP_START 8
#define TELEPORT_LUMP_END 51
#define README_LUMP_START 60
#define README_LUMP_END 108
#define CONTROLS_LUMP_START 109
#define CONTROLS_LUMP_END 122
#define LATCHPICS_LUMP_START 145
#define LATCHPICS_LUMP_END 197
//
// Amount of each data item
//
#define NUMCHUNKS 248
#define NUMFONT 5
#define NUMFONTM 0
#define NUMPICS 192
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 72
#define NUMTILE8M 0
#define NUMTILE16 0
#define NUMTILE16M 0
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 49
//
// File offsets for data items
//
#define STRUCTPIC 0
#define STARTFONT 1
#define STARTFONTM 6
#define STARTPICS 6
#define STARTPICM 198
#define STARTSPRITES 198
#define STARTTILE8 198
#define STARTTILE8M 199
#define STARTTILE16 199
#define STARTTILE16M 199
#define STARTTILE32 199
#define STARTTILE32M 199
#define STARTEXTERNS 199
//
// Thank you for using IGRAB!
//

199
GFXV_WL1.EQU Normal file
View file

@ -0,0 +1,199 @@
;=====================================
;
; Graphics .EQU file for .WL1
; IGRAB-ed on Sun May 03 01:19:32 1992
;
;=====================================
H_BJPIC = 3
H_CASTLEPIC = 4
H_KEYBOARDPIC = 5
H_JOYPIC = 6
H_HEALPIC = 7
H_TREASUREPIC = 8
H_GUNPIC = 9
H_KEYPIC = 10
H_BLAZEPIC = 11
H_WEAPON1234PIC = 12
H_WOLFLOGOPIC = 13
H_VISAPIC = 14
H_MCPIC = 15
H_IDLOGOPIC = 16
H_TOPWINDOWPIC = 17
H_LEFTWINDOWPIC = 18
H_RIGHTWINDOWPIC = 19
H_BOTTOMINFOPIC = 20
C_OPTIONSPIC = 21
C_CURSOR1PIC = 22
C_CURSOR2PIC = 23
C_NOTSELECTEDPIC = 24
C_SELECTEDPIC = 25
C_FXTITLEPIC = 26
C_DIGITITLEPIC = 27
C_MUSICTITLEPIC = 28
C_MOUSELBACKPIC = 29
C_BABYMODEPIC = 30
C_EASYPIC = 31
C_NORMALPIC = 32
C_HARDPIC = 33
C_LOADSAVEDISKPIC = 34
C_DISKLOADING1PIC = 35
C_DISKLOADING2PIC = 36
C_CONTROLPIC = 37
C_CUSTOMIZEPIC = 38
C_LOADGAMEPIC = 39
C_SAVEGAMEPIC = 40
C_EPISODE1PIC = 41
C_EPISODE2PIC = 42
C_EPISODE3PIC = 43
C_EPISODE4PIC = 44
C_EPISODE5PIC = 45
C_EPISODE6PIC = 46
C_CODEPIC = 47
L_GUYPIC = 48
L_COLONPIC = 49
L_NUM0PIC = 50
L_NUM1PIC = 51
L_NUM2PIC = 52
L_NUM3PIC = 53
L_NUM4PIC = 54
L_NUM5PIC = 55
L_NUM6PIC = 56
L_NUM7PIC = 57
L_NUM8PIC = 58
L_NUM9PIC = 59
L_PERCENTPIC = 60
L_APIC = 61
L_BPIC = 62
L_CPIC = 63
L_DPIC = 64
L_EPIC = 65
L_FPIC = 66
L_GPIC = 67
L_HPIC = 68
L_IPIC = 69
L_JPIC = 70
L_KPIC = 71
L_LPIC = 72
L_MPIC = 73
L_NPIC = 74
L_OPIC = 75
L_PPIC = 76
L_QPIC = 77
L_RPIC = 78
L_SPIC = 79
L_TPIC = 80
L_UPIC = 81
L_VPIC = 82
L_WPIC = 83
L_XPIC = 84
L_YPIC = 85
L_ZPIC = 86
L_EXPOINTPIC = 87
L_GUY2PIC = 88
L_BJWINSPIC = 89
STATUSBARPIC = 90
TITLEPIC = 91
PG13PIC = 92
CREDITSPIC = 93
HIGHSCORESPIC = 94
KNIFEPIC = 95
GUNPIC = 96
MACHINEGUNPIC = 97
GATLINGGUNPIC = 98
NOKEYPIC = 99
GOLDKEYPIC = 100
SILVERKEYPIC = 101
N_BLANKPIC = 102
N_0PIC = 103
N_1PIC = 104
N_2PIC = 105
N_3PIC = 106
N_4PIC = 107
N_5PIC = 108
N_6PIC = 109
N_7PIC = 110
N_8PIC = 111
N_9PIC = 112
FACE1APIC = 113
FACE1BPIC = 114
FACE1CPIC = 115
FACE2APIC = 116
FACE2BPIC = 117
FACE2CPIC = 118
FACE3APIC = 119
FACE3BPIC = 120
FACE3CPIC = 121
FACE4APIC = 122
FACE4BPIC = 123
FACE4CPIC = 124
FACE5APIC = 125
FACE5BPIC = 126
FACE5CPIC = 127
FACE6APIC = 128
FACE6BPIC = 129
FACE6CPIC = 130
FACE7APIC = 131
FACE7BPIC = 132
FACE7CPIC = 133
FACE8APIC = 134
GOTGATLINGPIC = 135
MUTANTBJPIC = 136
PAUSEDPIC = 137
GETPSYCHEDPIC = 138
ORDERSCREEN = 554
ERRORSCREEN = 555
README_LUMP_START = 3
README_LUMP_END = 20
CONTROLS_LUMP_START = 21
CONTROLS_LUMP_END = 47
LEVELEND_LUMP_START = 48
LEVELEND_LUMP_END = 89
LATCHPICS_LUMP_START = 95
LATCHPICS_LUMP_END = 138
;
; Amount of each data item
;
NUMCHUNKS = 556
NUMFONT = 2
NUMFONTM = 0
NUMPICS = 136
NUMPICM = 0
NUMSPRITES = 0
NUMTILE8 = 72
NUMTILE8M = 0
NUMTILE16 = 144
NUMTILE16M = 270
NUMTILE32 = 0
NUMTILE32M = 0
NUMEXTERN = 2
;
; File offsets for data items
;
STRUCTPIC = 0
STARTFONT = 1
STARTFONTM = 3
STARTPICS = 3
STARTPICM = 139
STARTSPRITES = 139
STARTTILE8 = 139
STARTTILE8M = 140
STARTTILE16 = 140
STARTTILE16M = 284
STARTTILE32 = 554
STARTTILE32M = 554
STARTEXTERN = 554
;
; Thank you for using IGRAB!
;

215
GFXV_WL6.EQU Normal file
View file

@ -0,0 +1,215 @@
;=====================================
;
; Graphics .EQU file for .WL6
; IGRAB-ed on Sun Jun 07 16:51:46 1992
;
;=====================================
H_BJPIC = 3
H_CASTLEPIC = 4
H_KEYBOARDPIC = 5
H_JOYPIC = 6
H_HEALPIC = 7
H_TREASUREPIC = 8
H_GUNPIC = 9
H_KEYPIC = 10
H_BLAZEPIC = 11
H_WEAPON1234PIC = 12
H_WOLFLOGOPIC = 13
H_VISAPIC = 14
H_MCPIC = 15
H_IDLOGOPIC = 16
H_TOPWINDOWPIC = 17
H_LEFTWINDOWPIC = 18
H_RIGHTWINDOWPIC = 19
H_BOTTOMINFOPIC = 20
C_OPTIONSPIC = 21
C_CURSOR1PIC = 22
C_CURSOR2PIC = 23
C_NOTSELECTEDPIC = 24
C_SELECTEDPIC = 25
C_FXTITLEPIC = 26
C_DIGITITLEPIC = 27
C_MUSICTITLEPIC = 28
C_MOUSELBACKPIC = 29
C_BABYMODEPIC = 30
C_EASYPIC = 31
C_NORMALPIC = 32
C_HARDPIC = 33
C_LOADSAVEDISKPIC = 34
C_DISKLOADING1PIC = 35
C_DISKLOADING2PIC = 36
C_CONTROLPIC = 37
C_CUSTOMIZEPIC = 38
C_LOADGAMEPIC = 39
C_SAVEGAMEPIC = 40
C_EPISODE1PIC = 41
C_EPISODE2PIC = 42
C_EPISODE3PIC = 43
C_EPISODE4PIC = 44
C_EPISODE5PIC = 45
C_EPISODE6PIC = 46
C_CODEPIC = 47
C_TIMECODEPIC = 48
C_LEVELPIC = 49
C_NAMEPIC = 50
C_SCOREPIC = 51
L_GUYPIC = 52
L_COLONPIC = 53
L_NUM0PIC = 54
L_NUM1PIC = 55
L_NUM2PIC = 56
L_NUM3PIC = 57
L_NUM4PIC = 58
L_NUM5PIC = 59
L_NUM6PIC = 60
L_NUM7PIC = 61
L_NUM8PIC = 62
L_NUM9PIC = 63
L_PERCENTPIC = 64
L_APIC = 65
L_BPIC = 66
L_CPIC = 67
L_DPIC = 68
L_EPIC = 69
L_FPIC = 70
L_GPIC = 71
L_HPIC = 72
L_IPIC = 73
L_JPIC = 74
L_KPIC = 75
L_LPIC = 76
L_MPIC = 77
L_NPIC = 78
L_OPIC = 79
L_PPIC = 80
L_QPIC = 81
L_RPIC = 82
L_SPIC = 83
L_TPIC = 84
L_UPIC = 85
L_VPIC = 86
L_WPIC = 87
L_XPIC = 88
L_YPIC = 89
L_ZPIC = 90
L_EXPOINTPIC = 91
L_APOSTROPHEPIC = 92
L_GUY2PIC = 93
L_BJWINSPIC = 94
STATUSBARPIC = 95
TITLEPIC = 96
PG13PIC = 97
CREDITSPIC = 98
HIGHSCORESPIC = 99
KNIFEPIC = 100
GUNPIC = 101
MACHINEGUNPIC = 102
GATLINGGUNPIC = 103
NOKEYPIC = 104
GOLDKEYPIC = 105
SILVERKEYPIC = 106
N_BLANKPIC = 107
N_0PIC = 108
N_1PIC = 109
N_2PIC = 110
N_3PIC = 111
N_4PIC = 112
N_5PIC = 113
N_6PIC = 114
N_7PIC = 115
N_8PIC = 116
N_9PIC = 117
FACE1APIC = 118
FACE1BPIC = 119
FACE1CPIC = 120
FACE2APIC = 121
FACE2BPIC = 122
FACE2CPIC = 123
FACE3APIC = 124
FACE3BPIC = 125
FACE3CPIC = 126
FACE4APIC = 127
FACE4BPIC = 128
FACE4CPIC = 129
FACE5APIC = 130
FACE5BPIC = 131
FACE5CPIC = 132
FACE6APIC = 133
FACE6BPIC = 134
FACE6CPIC = 135
FACE7APIC = 136
FACE7BPIC = 137
FACE7CPIC = 138
FACE8APIC = 139
GOTGATLINGPIC = 140
MUTANTBJPIC = 141
PAUSEDPIC = 142
GETPSYCHEDPIC = 143
ORDERSCREEN = 145
ERRORSCREEN = 146
T_HELPART = 147
T_DEMO0 = 148
T_DEMO1 = 149
T_DEMO2 = 150
T_DEMO3 = 151
T_ENDART1 = 152
T_ENDART2 = 153
T_ENDART3 = 154
T_ENDART4 = 155
T_ENDART5 = 156
T_ENDART6 = 157
README_LUMP_START = 3
README_LUMP_END = 20
CONTROLS_LUMP_START = 21
CONTROLS_LUMP_END = 51
LEVELEND_LUMP_START = 52
LEVELEND_LUMP_END = 94
LATCHPICS_LUMP_START = 100
LATCHPICS_LUMP_END = 143
;
; Amount of each data item
;
NUMCHUNKS = 158
NUMFONT = 2
NUMFONTM = 0
NUMPICS = 141
NUMPICM = 0
NUMSPRITES = 0
NUMTILE8 = 72
NUMTILE8M = 0
NUMTILE16 = 0
NUMTILE16M = 0
NUMTILE32 = 0
NUMTILE32M = 0
NUMEXTERN = 13
;
; File offsets for data items
;
STRUCTPIC = 0
STARTFONT = 1
STARTFONTM = 3
STARTPICS = 3
STARTPICM = 144
STARTSPRITES = 144
STARTTILE8 = 144
STARTTILE8M = 145
STARTTILE16 = 145
STARTTILE16M = 145
STARTTILE32 = 145
STARTTILE32M = 145
STARTEXTERN = 145
;
; Thank you for using IGRAB!
;

231
H_LDIV.ASM Normal file
View file

@ -0,0 +1,231 @@
;[]-----------------------------------------------------------------[]
;| H_LDIV.ASM -- long division routine |
;| |
;| C/C++ Run Time Library Version 4.0 |
;| |
;| Copyright (c) 1987, 1991 by Borland International Inc. |
;| All Rights Reserved. |
;[]-----------------------------------------------------------------[]
INCLUDE RULES.ASI
.386C ;JAB - we use 386 instructions
_TEXT segment public byte 'CODE'
assume cs:_TEXT
public LDIV@
public F_LDIV@
public N_LDIV@
public LUDIV@
public F_LUDIV@
public N_LUDIV@
public LMOD@
public F_LMOD@
public N_LMOD@
public LUMOD@
public F_LUMOD@
public N_LUMOD@
N_LDIV@:
pop cx ;fix up far return
push cs
push cx
LDIV@:
F_LDIV@:
xor cx,cx ; signed divide
jmp short common
; JAB
;
; If we're using a 386 or better, the two instructions above get patched
; to be NOP's (4 of them). So, instead of using the looping code,
; we use the 386's long divide instruction.
;
; The stack after setting up the stack frame:
; 12[bp]: divisor (high word)
; 10[bp]: divisor (low word)
; 8[bp]: dividend (high word)
; 6[bp]: dividend (low word)
; 4[bp]: return CS
; 2[bp]: return IP
; 0[bp]: previous BP
;
IDEAL
push bp
mov bp,sp ;Save BP, and set it equal to stack
mov eax,[DWORD PTR bp+6]
cdq
; cmp [DWORD PTR bp+10],0 ; divide-by-zero break code
; jne short mike ;
; mov [DWORD PTR bp+10],1 ;
;mike: ;
idiv [DWORD PTR bp+10]
mov edx,eax
shr edx,16
pop bp ;Restore BP
retf 8 ;Return to original caller
MASM
N_LUDIV@:
pop cx ;fix up far return
push cs
push cx
LUDIV@:
F_LUDIV@:
mov cx,1 ; unsigned divide
jmp short common
N_LMOD@:
pop cx ;fix up far return
push cs
push cx
LMOD@:
F_LMOD@:
mov cx,2 ; signed remainder
jmp short common
N_LUMOD@:
pop cx ;fix up far return
push cs
push cx
LUMOD@:
F_LUMOD@:
mov cx,3 ; unsigned remainder
;
; di now contains a two bit control value. The low order
; bit (test mask of 1) is on if the operation is unsigned,
; signed otherwise. The next bit (test mask of 2) is on if
; the operation returns the remainder, quotient otherwise.
;
common:
push bp
push si
push di
mov bp,sp ; set up frame
mov di,cx
;
; dividend is pushed last, therefore the first in the args
; divisor next.
;
mov ax,10[bp] ; get the first low word
mov dx,12[bp] ; get the first high word
mov bx,14[bp] ; get the second low word
mov cx,16[bp] ; get the second high word
or cx,cx
jnz slow@ldiv ; both high words are zero
or dx,dx
jz quick@ldiv
or bx,bx
jz quick@ldiv ; if cx:bx == 0 force a zero divide
; we don't expect this to actually
; work
slow@ldiv:
test di,1 ; signed divide?
jnz positive ; no: skip
;
; Signed division should be done. Convert negative
; values to positive and do an unsigned division.
; Store the sign value in the next higher bit of
; di (test mask of 4). Thus when we are done, testing
; that bit will determine the sign of the result.
;
or dx,dx ; test sign of dividend
jns onepos
neg dx
neg ax
sbb dx,0 ; negate dividend
or di,0Ch
onepos:
or cx,cx ; test sign of divisor
jns positive
neg cx
neg bx
sbb cx,0 ; negate divisor
xor di,4
positive:
mov bp,cx
mov cx,32 ; shift counter
push di ; save the flags
;
; Now the stack looks something like this:
;
; 16[bp]: divisor (high word)
; 14[bp]: divisor (low word)
; 12[bp]: dividend (high word)
; 10[bp]: dividend (low word)
; 8[bp]: return CS
; 6[bp]: return IP
; 4[bp]: previous BP
; 2[bp]: previous SI
; [bp]: previous DI
; -2[bp]: control bits
; 01 - Unsigned divide
; 02 - Remainder wanted
; 04 - Negative quotient
; 08 - Negative remainder
;
xor di,di ; fake a 64 bit dividend
xor si,si ;
xloop:
shl ax,1 ; shift dividend left one bit
rcl dx,1
rcl si,1
rcl di,1
cmp di,bp ; dividend larger?
jb nosub
ja subtract
cmp si,bx ; maybe
jb nosub
subtract:
sub si,bx
sbb di,bp ; subtract the divisor
inc ax ; build quotient
nosub:
loop xloop
;
; When done with the loop the four register value look like:
;
; | di | si | dx | ax |
; | remainder | quotient |
;
pop bx ; get control bits
test bx,2 ; remainder?
jz usequo
mov ax,si
mov dx,di ; use remainder
shr bx,1 ; shift in the remainder sign bit
usequo:
test bx,4 ; needs negative
jz finish
neg dx
neg ax
sbb dx,0 ; negate
finish:
pop di
pop si
pop bp
retf 8
quick@ldiv:
div bx ; unsigned divide
; DX = remainder AX = quotient
test di,2 ; want remainder?
jz quick@quo
xchg ax,dx
quick@quo:
xor dx,dx
jmp short finish
_TEXT ends
end

1691
ID_CA.C Normal file

File diff suppressed because it is too large Load diff

143
ID_CA.H Normal file
View file

@ -0,0 +1,143 @@
// ID_CA.H
//===========================================================================
#define NUM_EPISODES 1
#define MAPS_PER_EPISODE 25
#define MAPS_WITH_STATS 20
#define NUMMAPS NUM_EPISODES*MAPS_PER_EPISODE
#define MAPPLANES 2
#define UNCACHEGRCHUNK(chunk) {MM_FreePtr(&grsegs[chunk]);grneeded[chunk]&=~ca_levelbit;}
#define THREEBYTEGRSTARTS
#ifdef THREEBYTEGRSTARTS
#define FILEPOSSIZE 3
#else
#define FILEPOSSIZE 4
#endif
//===========================================================================
typedef struct
{
long planestart[3];
unsigned planelength[3];
unsigned width,height;
char name[16];
} maptype;
typedef struct
{
unsigned bit0,bit1; // 0-255 is a character, > is a pointer to a node
} huffnode;
typedef struct
{
unsigned RLEWtag;
long headeroffsets[100];
byte tileinfo[];
} mapfiletype;
//===========================================================================
extern char audioname[13];
extern byte _seg *tinf;
extern int mapon;
extern unsigned _seg *mapsegs[MAPPLANES];
extern maptype _seg *mapheaderseg[NUMMAPS];
extern byte _seg *audiosegs[NUMSNDCHUNKS];
extern void _seg *grsegs[NUMCHUNKS];
extern byte far grneeded[NUMCHUNKS];
extern byte ca_levelbit,ca_levelnum;
extern char *titleptr[8];
extern int profilehandle,debughandle;
extern char extension[5],
gheadname[10],
gfilename[10],
gdictname[10],
mheadname[10],
mfilename[10],
aheadname[10],
afilename[10];
extern long _seg *grstarts; // array of offsets in egagraph, -1 for sparse
extern long _seg *audiostarts; // array of offsets in audio / audiot
//
// hooks for custom cache dialogs
//
extern void (*drawcachebox) (char *title, unsigned numcache);
extern void (*updatecachebox) (void);
extern void (*finishcachebox) (void);
extern int grhandle; // handle to EGAGRAPH
extern int maphandle; // handle to MAPTEMP / GAMEMAPS
extern int audiohandle; // handle to AUDIOT / AUDIO
extern long chunkcomplen,chunkexplen;
#ifdef GRHEADERLINKED
extern huffnode *grhuffman;
#else
extern huffnode grhuffman[255];
#endif
//===========================================================================
// just for the score box reshifting
void CAL_ShiftSprite (unsigned segment,unsigned source,unsigned dest,
unsigned width, unsigned height, unsigned pixshift);
//===========================================================================
void CA_OpenDebug (void);
void CA_CloseDebug (void);
boolean CA_FarRead (int handle, byte far *dest, long length);
boolean CA_FarWrite (int handle, byte far *source, long length);
boolean CA_ReadFile (char *filename, memptr *ptr);
boolean CA_LoadFile (char *filename, memptr *ptr);
boolean CA_WriteFile (char *filename, void far *ptr, long length);
long CA_RLEWCompress (unsigned huge *source, long length, unsigned huge *dest,
unsigned rlewtag);
void CA_RLEWexpand (unsigned huge *source, unsigned huge *dest,long length,
unsigned rlewtag);
void CA_Startup (void);
void CA_Shutdown (void);
void CA_SetGrPurge (void);
void CA_CacheAudioChunk (int chunk);
void CA_LoadAllSounds (void);
void CA_UpLevel (void);
void CA_DownLevel (void);
void CA_SetAllPurge (void);
void CA_ClearMarks (void);
void CA_ClearAllMarks (void);
#define CA_MarkGrChunk(chunk) grneeded[chunk]|=ca_levelbit
void CA_CacheGrChunk (int chunk);
void CA_CacheMap (int mapnum);
void CA_CacheMarks (void);
void CAL_SetupAudioFile (void);
void CAL_SetupGrFile (void);
void CAL_SetupMapFile (void);
void CAL_HuffExpand (byte huge *source, byte huge *dest,
long length,huffnode far *hufftable, boolean screenhack);
void CloseGrFile(void);
void OpenGrFile(void);

32
ID_HEAD.H Normal file
View file

@ -0,0 +1,32 @@
// ID_HEAD.H
#define WOLF
#define FREE_FUNCTIONS (true)
#define TEXTGR 0
#define CGAGR 1
#define EGAGR 2
#define VGAGR 3
#define GRMODE VGAGR
typedef enum {false,true} boolean;
typedef unsigned char byte;
typedef unsigned int word;
typedef unsigned long longword;
typedef byte * Ptr;
typedef struct
{
int x,y;
} Point;
typedef struct
{
Point ul,lr;
} Rect;
void Quit (char *error,...); // defined in user program

161
ID_HEADS.H Normal file
View file

@ -0,0 +1,161 @@
#ifndef _ID_HEADS_H_
#define _ID_HEADS_H_
// ID_GLOB.H
#include <ALLOC.H>
#include <CTYPE.H>
#include <DOS.H>
#include <ERRNO.H>
#include <FCNTL.H>
#include <IO.H>
#include <MEM.H>
#include <PROCESS.H>
#include <STDIO.H>
#include <STDLIB.H>
#include <STRING.H>
#include <SYS\STAT.H>
#include <VALUES.H>
#include <DIR.H>
#define __ID_GLOB__
//--------------------------------------------------------------------------
#define DEBUG_VALUE
#define CEILING_FLOOR_COLORS
//#define CARMACIZED
#define WOLF
#define FREE_FUNCTIONS (false)
#define FREE_DATA (false)
#define DEMOS_ENABLED (true)
#define RESTART_PICTURE_PAUSE (false)
#define GEORGE_CHEAT (false)
#define FORCE_FILE_CLOSE (true) // true - forces all files closed once they are used
//
// GAME VERSION TYPES
//
#define SHAREWARE_VERSION 0x0001
#define MISSIONS_1_THR_3 0x0003
#define MISSIONS_4_THR_6 0x0004
#define MISSIONS_1_THR_6 0x0007
//
// CURRENT GAME VERSION DEFINE - Change this define according to the
// game release versions 1,1-3,4-6, or 1-6.
#define GAME_VERSION (MISSIONS_1_THR_6)
//#define GAME_VERSION (MISSIONS_1_THR_3)
//#define GAME_VERSION (SHAREWARE_VERSION)
#define TECH_SUPPORT_VERSION (false)
#define IN_DEVELOPMENT (false)
#define ERROR_LOG "ERROR.LOG" // Text filename for critical memory errors
#define DUAL_SWAP_FILES (false) //(GAME_VERSION != SHAREWARE_VERSION) // Support for Shadowed and NonShadowed page files
extern char far signonv1;
#define introscn signonv1
#ifndef SPEAR
#include "GFXV_vsi.H"
#include "AUDIOvsi.H"
#include "MAPSvsi.H"
#else
#include "GFXV_SOD.H"
#include "AUDIOSOD.H"
#include "MAPSSOD.H"
#endif
//-----------------
#define GREXT "VGA"
//
// ID Engine
// Types.h - Generic types, #defines, etc.
// v1.0d1
//
typedef enum {false,true} boolean;
typedef unsigned char byte;
typedef unsigned int word;
typedef unsigned long longword;
typedef byte * Ptr;
typedef struct
{
int x,y;
} Point;
typedef struct
{
Point ul,lr;
} Rect;
#define nil (0l)
#include "ID_MM.H"
#include "ID_PM.H"
#include "ID_CA.H"
#include "ID_VL.H"
#include "ID_VH.H"
#include "ID_IN.H"
#include "ID_SD.H"
#include "ID_US.H"
#include "jm_tp.h"
#include "jm_debug.h"
#include "jm_error.h"
#include "movie.h"
void Quit (char *error,...); // defined in user program
extern void CalcMemFree(void);
//
// replacing refresh manager with custom routines
//
#define PORTTILESWIDE 20 // all drawing takes place inside a
#define PORTTILESHIGH 13 // non displayed port of this size
#define UPDATEWIDE PORTTILESWIDE
#define UPDATEHIGH PORTTILESHIGH
#define MAXTICS 10
#define DEMOTICS 4
#define UPDATETERMINATE 0x0301
extern unsigned mapwidth,mapheight,tics,realtics;
extern boolean compatability;
extern byte *updateptr;
extern unsigned uwidthtable[UPDATEHIGH];
extern unsigned blockstarts[UPDATEWIDE*UPDATEHIGH];
extern byte fontcolor,backcolor;
#define SETFONTCOLOR(f,b) fontcolor=f;backcolor=b;
#include "3D_MENU.H"
#define CA_FarRead(h,d,s) IO_FarRead((int)h,(byte far *)d,(long)s)
#endif

1173
ID_IN.C Normal file

File diff suppressed because it is too large Load diff

221
ID_IN.H Normal file
View file

@ -0,0 +1,221 @@
//
// ID Engine
// ID_IN.h - Header file for Input Manager
// v1.0d1
// By Jason Blochowiak
//
#ifndef __ID_IN__
#define __ID_IN__
#ifdef __DEBUG__
#define __DEBUG_InputMgr__
#endif
#define MaxPlayers 4
#define MaxKbds 2
#define MaxJoys 2
#define NumCodes 128
typedef byte ScanCode;
#define sc_None 0
#define sc_Bad 0xff
#define sc_Return 0x1c
#define sc_Enter sc_Return
#define sc_Escape 0x01
#define sc_Space 0x39
#define sc_Minus 0x0C
#define sc_Plus 0x0D
#define sc_BackSpace 0x0e
#define sc_Tab 0x0f
#define sc_Alt 0x38
#define sc_LBrace 0x1A
#define sc_RBrace 0x1B
#define sc_Control 0x1d
#define sc_CapsLock 0x3a
#define sc_LShift 0x2a
#define sc_RShift 0x36
#define sc_UpArrow 0x48
#define sc_DownArrow 0x50
#define sc_LeftArrow 0x4b
#define sc_RightArrow 0x4d
#define sc_Insert 0x52
#define sc_Delete 0x53
#define sc_Home 0x47
#define sc_End 0x4f
#define sc_PgUp 0x49
#define sc_PgDn 0x51
#define sc_Slash 0x35
#define sc_F1 0x3b
#define sc_F2 0x3c
#define sc_F3 0x3d
#define sc_F4 0x3e
#define sc_F5 0x3f
#define sc_F6 0x40
#define sc_F7 0x41
#define sc_F8 0x42
#define sc_F9 0x43
#define sc_F10 0x44
#define sc_F11 0x57
#define sc_F12 0x59
#define sc_Tilde 0x29
#define sc_1 0x02
#define sc_2 0x03
#define sc_3 0x04
#define sc_4 0x05
#define sc_5 0x06
#define sc_6 0x07
#define sc_7 0x08
#define sc_8 0x09
#define sc_9 0x0a
#define sc_0 0x0b
#define sc_A 0x1e
#define sc_B 0x30
#define sc_C 0x2e
#define sc_D 0x20
#define sc_E 0x12
#define sc_F 0x21
#define sc_G 0x22
#define sc_H 0x23
#define sc_I 0x17
#define sc_J 0x24
#define sc_K 0x25
#define sc_L 0x26
#define sc_M 0x32
#define sc_N 0x31
#define sc_O 0x18
#define sc_P 0x19
#define sc_Q 0x10
#define sc_R 0x13
#define sc_S 0x1f
#define sc_T 0x14
#define sc_U 0x16
#define sc_V 0x2f
#define sc_W 0x11
#define sc_X 0x2d
#define sc_Y 0x15
#define sc_Z 0x2c
#define sc_kpMinus 0x4a
#define sc_kpPlus 0x4e
#define key_None 0
#define key_Return 0x0d
#define key_Enter key_Return
#define key_Escape 0x1b
#define key_Space 0x20
#define key_BackSpace 0x08
#define key_Tab 0x09
#define key_Delete 0x7f
#define key_UnderScore 0x0c
// Stuff for the mouse
#define MReset 0
#define MButtons 3
#define MDelta 11
#define MouseInt 0x33
#define Mouse(x) _AX = x,geninterrupt(MouseInt)
#define NGint 0x15
#define NGjoy(com) _AH=0x84;_DX=com;geninterrupt(NGint);
#define MaxJoyValue 5000 // JAM
typedef enum {
demo_Off,demo_Record,demo_Playback,demo_PlayDone
} Demo;
typedef enum {
ctrl_None, // JAM - added
ctrl_Keyboard,
ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,
ctrl_Joystick,
ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,
ctrl_Mouse
} ControlType;
typedef enum {
motion_Left = -1,motion_Up = -1,
motion_None = 0,
motion_Right = 1,motion_Down = 1
} Motion;
typedef enum {
dir_North,dir_NorthEast,
dir_East,dir_SouthEast,
dir_South,dir_SouthWest,
dir_West,dir_NorthWest,
dir_None
} Direction;
typedef struct {
boolean button0,button1,button2,button3;
int x,y;
Motion xaxis,yaxis;
Direction dir;
} CursorInfo;
typedef CursorInfo ControlInfo;
typedef struct {
ScanCode button0,button1,
upleft, up, upright,
left, right,
downleft, down, downright;
} KeyboardDef;
typedef struct {
word joyMinX,joyMinY,
threshMinX,threshMinY,
threshMaxX,threshMaxY,
joyMaxX,joyMaxY,
joyMultXL,joyMultYL,
joyMultXH,joyMultYH;
} JoystickDef;
// Global variables
extern boolean NGinstalled; // JAM
extern boolean JoystickCalibrated; // JAM - added
extern ControlType ControlTypeUsed; // JAM - added
extern boolean Keyboard[],
MousePresent,
JoysPresent[];
extern boolean Paused;
extern char LastASCII;
extern ScanCode LastScan;
extern KeyboardDef KbdDefs;
extern JoystickDef JoyDefs[];
extern ControlType Controls[MaxPlayers];
extern byte _seg *DemoBuffer;
extern word DemoOffset,DemoSize;
// Function prototypes
#define IN_KeyDown(code) (Keyboard[(code)])
#define IN_ClearKey(code) {Keyboard[code] = false;\
if (code == LastScan) LastScan = sc_None;}
// DEBUG - put names in prototypes
extern void IN_Startup(void),IN_Shutdown(void),
IN_Default(boolean gotit,ControlType in),
IN_SetKeyHook(void (*)()),
IN_ClearKeysDown(void),
IN_ReadCursor(CursorInfo *),
IN_ReadControl(int,ControlInfo *),
IN_SetControlType(int,ControlType),
IN_GetJoyAbs(word joy,word *xp,word *yp),
IN_SetupJoy(word joy,word minx,word maxx,
word miny,word maxy),
IN_StopDemo(void),IN_FreeDemoBuffer(void),
IN_Ack(void),IN_AckBack(void);
extern boolean IN_UserInput(longword delay);
extern char IN_WaitForASCII(void);
extern ScanCode IN_WaitForKey(void);
extern word IN_GetJoyButtonsDB(word joy);
extern byte far*IN_GetScanName(ScanCode);
byte IN_MouseButtons (void);
byte IN_JoyButtons (void);
#endif

1134
ID_MM.C Normal file

File diff suppressed because it is too large Load diff

121
ID_MM.H Normal file
View file

@ -0,0 +1,121 @@
// ID_MM.H
#ifndef __ID_CA__
#define __ID_CA__
#define SAVENEARHEAP 0x400 // space to leave in data segment
#define SAVEFARHEAP 0 // space to leave in far heap
#define BUFFERSIZE 0x1000 // miscelanious, allways available buffer
#define MAXBLOCKS 600
//--------
#define EMS_INT 0x67
#define EMS_STATUS 0x40
#define EMS_GETFRAME 0x41
#define EMS_GETPAGES 0x42
#define EMS_ALLOCPAGES 0x43
#define EMS_MAPPAGE 0x44
#define EMS_FREEPAGES 0x45
#define EMS_VERSION 0x46
//--------
#define XMS_INT 0x2f
#define XMS_CALL(v) _AH = (v);\
asm call [DWORD PTR XMSDriver]
#define XMS_VERSION 0x00
#define XMS_ALLOCHMA 0x01
#define XMS_FREEHMA 0x02
#define XMS_GENABLEA20 0x03
#define XMS_GDISABLEA20 0x04
#define XMS_LENABLEA20 0x05
#define XMS_LDISABLEA20 0x06
#define XMS_QUERYA20 0x07
#define XMS_QUERYFREE 0x08
#define XMS_ALLOC 0x09
#define XMS_FREE 0x0A
#define XMS_MOVE 0x0B
#define XMS_LOCK 0x0C
#define XMS_UNLOCK 0x0D
#define XMS_GETINFO 0x0E
#define XMS_RESIZE 0x0F
#define XMS_ALLOCUMB 0x10
#define XMS_FREEUMB 0x11
//==========================================================================
typedef void _seg * memptr;
typedef struct
{
long nearheap,farheap,EMSmem,XMSmem,mainmem;
} mminfotype;
//==========================================================================
extern unsigned blockcount;
extern mminfotype mminfo;
extern memptr bufferseg;
extern boolean mmerror;
//unsigned __SEGS_AVAILABLE__;
unsigned long __PUR_MEM_AVAIL__;
unsigned long __FREE_MEM_AVAIL__;
extern void (* beforesort) (void);
extern void (* aftersort) (void);
extern char far *gp_fartext;
//==========================================================================
void MM_Startup (void);
void MM_Shutdown (void);
void MM_MapEMS (void);
void MM_GetPtr (memptr *baseptr,unsigned long size);
void MM_FreePtr (memptr *baseptr);
void MM_SetPurge (memptr *baseptr, int purge);
void MM_SetLock (memptr *baseptr, boolean locked);
void MM_SortMem (void);
void MM_ShowMemory (void);
long MM_UnusedMemory (void);
long MM_TotalFree (void);
long MM_LargestAvail (void);
void MM_BombOnError (boolean bomb);
void MML_UseSpace (unsigned segstart, unsigned seglength);
#define LOCKBIT 0x80 // if set in attributes, block cannot be moved
#if IN_DEVELOPMENT
#define GETNEWBLOCK {if(!mmfree)MML_ClearBlock();mmnew=mmfree;mmfree=mmfree->next;blockcount++;}
#else
#define GETNEWBLOCK {if(!mmfree)MML_ClearBlock();mmnew=mmfree;mmfree=mmfree->next;}
#endif
typedef struct mmblockstruct
{
unsigned start,length;
unsigned attributes;
memptr *useptr; // pointer to the segment start
struct mmblockstruct far *next;
} mmblocktype;
#endif

1306
ID_PM.C Normal file

File diff suppressed because it is too large Load diff

93
ID_PM.H Normal file
View file

@ -0,0 +1,93 @@
//
// ID_PM.H
// Header file for Id Engine's Page Manager
//
// NOTE! PMPageSize must be an even divisor of EMSPageSize, and >= 1024
#define EMSPageSize 16384
#define EMSPageSizeSeg (EMSPageSize >> 4)
#define EMSPageSizeKB (EMSPageSize >> 10)
#define EMSFrameCount 4
#define PMPageSize 4096
#define PMPageSizeSeg (PMPageSize >> 4)
#define PMPageSizeKB (PMPageSize >> 10)
#define PMEMSSubPage (EMSPageSize / PMPageSize)
#define PMMinMainMem 10 // Min acceptable # of pages from main
#define PMMaxMainMem 100 // Max number of pages in main memory
#define PMThrashThreshold 1 // Number of page thrashes before panic mode
#define PMUnThrashThreshold 5 // Number of non-thrashing frames before leaving panic mode
typedef enum
{
pml_Unlocked,
pml_Locked
} PMLockType;
typedef enum
{
pmba_Unused = 0,
pmba_Used = 1,
pmba_Allocated = 2
} PMBlockAttr;
typedef enum
{
sd_NONE,
sd_NO_SHADOWS,
sd_SHADOWS,
} shadfile_t;
typedef struct
{
longword offset; // Offset of chunk into file
word length; // Length of the chunk
int xmsPage; // If in XMS, (xmsPage * PMPageSize) gives offset into XMS handle
PMLockType locked; // If set, this page can't be purged
int emsPage; // If in EMS, logical page/offset into page
int mainPage; // If in Main, index into handle array
longword lastHit; // Last frame number of hit
} PageListStruct;
typedef struct
{
int baseEMSPage; // Base EMS page for this phys frame
longword lastHit; // Last frame number of hit
} EMSListStruct;
extern boolean XMSPresent,EMSPresent,PageManagerInstalled;
extern word XMSPagesAvail,EMSPagesAvail;
extern word ChunksInFile,
PMSpriteStart,PMSoundStart;
extern PageListStruct far *PMPages;
#define PM_GetSoundPage(v) PM_GetPage(PMSoundStart + (v))
#define PM_GetSpritePage(v) PM_GetPage(PMSpriteStart + (v))
#define PM_LockMainMem() PM_SetMainMemPurge(0)
#define PM_UnlockMainMem() PM_SetMainMemPurge(3)
extern char PageFileName[13];
extern char AltPageFileName[13];
extern boolean ShadowsAvail;
extern shadfile_t FileUsed;
extern void PM_Startup(void),
PM_Shutdown(void),
PM_Reset(void),
PM_Preload(void (*update)(word current,word total)),
PM_NextFrame(void),
PM_SetPageLock(int pagenum,PMLockType lock),
PM_SetMainPurge(int level),
PM_CheckMainMem(void);
extern memptr PM_GetPageAddress(int pagenum),
PM_GetPage(int pagenum); // Use this one to cache page

2525
ID_SD.C Normal file

File diff suppressed because it is too large Load diff

38
ID_SD.EQU Normal file
View file

@ -0,0 +1,38 @@
;
; ID_SD.EQU
; Id Sound Manager assembly equates
;
INCLUDE 'ID_VL.EQU' ; For screen color debugging stuff
; Modes
sdm_Off = 0
sdm_PC = 1
sdm_AdLib = 2
smm_Off = 0
smm_AdLib = 1
sds_Off = 0
sds_SoundSource = 1
sds_SoundBlaster = 2
; Stuff for the PC speaker
pcTimer = 42h
pcTAccess = 43h
pcSpeaker = 61h
pcSpkBits = 3
; Stuff for the AdLib
; Operator registers
alChar = 20h
alScale = 40h
alAttack = 60h
alSus = 80h
alWave = 0e0h
; Channel registers
alFreqL = 0a0h
alFreqH = 0b0h
alFeedCon = 0c0h
; Global registers
alEffects = 0bdh

240
ID_SD.H Normal file
View file

@ -0,0 +1,240 @@
//
// ID Engine
// ID_SD.h - Sound Manager Header
// Version for Wolfenstein
// By Jason Blochowiak
//
#ifndef __ID_SD__
#define __ID_SD__
void alOut(byte n,byte b);
#ifdef __DEBUG__
#define __DEBUG_SoundMgr__
#endif
#define TickBase 70 // 70Hz per tick - used as a base for timer 0
typedef enum {
sdm_Off,
sdm_PC,sdm_AdLib,
} SDMode;
typedef enum {
smm_Off,smm_AdLib
} SMMode;
typedef enum {
sds_Off,sds_PC,sds_SoundSource,sds_SoundBlaster
} SDSMode;
typedef struct
{
longword length;
word priority;
} SoundCommon;
// PC Sound stuff
#define pcTimer 0x42
#define pcTAccess 0x43
#define pcSpeaker 0x61
#define pcSpkBits 3
typedef struct
{
SoundCommon common;
byte data[1];
} PCSound;
// Registers for the Sound Blaster card - needs to be offset by n0 (0x10,0x20,0x30,0x40,0x50,0x60)
#define sbReset 0x206 // W
#define sbFMStatus 0x208 // R
#define sbFMAddr 0x208 // W
#define sbFMData 0x209 // W
#define sbReadData 0x20a // R
#define sbWriteCmd 0x20c // W
#define sbWriteData 0x20c // W
#define sbWriteStat 0x20c // R
#define sbDataAvail 0x20e // R
// Registers for the Sound Blaster Pro card - needs to be offset by n0 (0x20 or 0x40)
#define sbpLFMStatus 0x200 // R
#define sbpLFMAddr 0x200 // W
#define sbpLFMData 0x201 // W
#define sbpRFMStatus 0x202 // R
#define sbpRFMAddr 0x202 // W
#define sbpRFMData 0x203 // W
#define sbpMixerAddr 0x204 // W
#define sbpMixerData 0x205 // RW
#define sbpCDData 0x210 // R
#define sbpCDCommand 0x210 // W
#define sbpCDStatus 0x211 // R
#define sbpCDReset 0x212 // W
// SBPro Mixer addresses
#define sbpmReset 0x00
#define sbpmVoiceVol 0x04
#define sbpmMicMix 0x0a
#define sbpmFilterADC 0x0c
#define sbpmControl 0x0e
#define sbpmMasterVol 0x22
#define sbpmFMVol 0x26
#define sbpmCDVol 0x28
#define sbpmLineVol 0x2e
typedef struct
{
SoundCommon common;
word hertz;
byte bits,
reference,
data[1];
} SampledSound;
// Registers for the AdLib card
#define alFMStatus 0x388 // R
#define alFMAddr 0x388 // W
#define alFMData 0x389 // W
// Register addresses
// Operator stuff
#define alChar 0x20
#define alScale 0x40
#define alAttack 0x60
#define alSus 0x80
#define alWave 0xe0
// Channel stuff
#define alFreqL 0xa0
#define alFreqH 0xb0
#define alFeedCon 0xc0
// Global stuff
#define alEffects 0xbd
typedef struct
{
byte mChar,cChar,
mScale,cScale,
mAttack,cAttack,
mSus,cSus,
mWave,cWave,
nConn,
// These are only for Muse - these bytes are really unused
voice,
mode,
unused[3];
} Instrument;
typedef struct
{
SoundCommon common;
Instrument inst;
byte block,
data[1];
} AdLibSound;
//
// Sequencing stuff
//
#define sqMaxTracks 10
#define sqMaxMoods 1 // DEBUG
#define sev_Null 0 // Does nothing
#define sev_NoteOff 1 // Turns a note off
#define sev_NoteOn 2 // Turns a note on
#define sev_NotePitch 3 // Sets the pitch of a currently playing note
#define sev_NewInst 4 // Installs a new instrument
#define sev_NewPerc 5 // Installs a new percussive instrument
#define sev_PercOn 6 // Turns a percussive note on
#define sev_PercOff 7 // Turns a percussive note off
#define sev_SeqEnd -1 // Terminates a sequence
// Flags for MusicGroup.flags
#define sf_Melodic 0
#define sf_Percussive 1
#if 1
typedef struct
{
word length,
values[1];
} MusicGroup;
#else
typedef struct
{
word flags,
count,
offsets[1];
} MusicGroup;
#endif
typedef struct
{
/* This part needs to be set up by the user */
word mood,far *moods[sqMaxMoods];
/* The rest is set up by the code */
Instrument inst;
boolean percussive;
word far *seq;
longword nextevent;
} ActiveTrack;
#define sqmode_Normal 0
#define sqmode_FadeIn 1
#define sqmode_FadeOut 2
#define sqMaxFade 64 // DEBUG
// Global variables
extern boolean AdLibPresent,
SoundSourcePresent,
SoundBlasterPresent,
NeedsMusic, // For Caching Mgr
SoundPositioned;
extern SDMode SoundMode;
extern SDSMode DigiMode;
extern SMMode MusicMode;
extern volatile boolean DigiPlaying;
extern int DigiMap[];
extern longword TimeCount; // Global time in ticks
extern boolean sqActive;
extern boolean sqPlayedOnce;
// Function prototypes
extern void SD_Startup(void),
SD_Shutdown(void),
SD_Default(boolean gotit,SDMode sd,SMMode sm),
SD_PositionSound(int leftvol,int rightvol);
extern boolean SD_PlaySound(soundnames sound);
extern void SD_SetPosition(int leftvol,int rightvol),
SD_StopSound(void),
SD_WaitSoundDone(void),
SD_StartMusic(MusicGroup far *music),
SD_MusicOn(void),
SD_MusicOff(void),
SD_FadeOutMusic(void),
SD_SetUserHook(void (*hook)(void));
extern boolean SD_MusicPlaying(void),
SD_SetSoundMode(SDMode mode),
SD_SetMusicMode(SMMode mode);
extern word SD_SoundPlaying(void);
extern void SD_SetDigiDevice(SDSMode),
SD_PlayDigitized(word which,int leftpos,int rightpos),
SD_StopDigitized(void),
SD_Poll(void);
#ifdef _MUSE_ // MUSE Goes directly to the lower level routines
extern void SDL_PCPlaySound(PCSound far *sound),
SDL_PCStopSound(void),
SDL_ALPlaySound(AdLibSound far *sound),
SDL_ALStopSound(void);
#endif
#endif

13
ID_SDD.C Normal file
View file

@ -0,0 +1,13 @@
//
// ID Engine
// ID_SDD.c - Sound Manager dummy file
//
#include "ID_HEADS.H"
#pragma hdrstop
word sdStartPCSounds = STARTPCSOUNDS;
word sdStartALSounds = STARTADLIBSOUNDS;
int sdLastSound = LASTSOUND;
int DigiMap[LASTSOUND];

538
ID_SD_A.ASM Normal file
View file

@ -0,0 +1,538 @@
;
; ID_SD_A.ASM
; Id Sound Manager assembly stuff
.286C
IDEAL
MODEL MEDIUM,C
JUMPS
INCLUDE 'ID_SD.EQU'
DEBUG = 0
EXTRN SDL_DigitizedDone:FAR
EXTRN alOut:FAR
;============================================================================
DATASEG
EXTRN sqActive:WORD
EXTRN ssSample:DWORD
EXTRN ssLengthLeft:WORD
EXTRN ssControl:WORD
EXTRN ssStatus:WORD
EXTRN ssData:WORD
EXTRN ssOn:BYTE
EXTRN ssOff:BYTE
EXTRN pcSound:DWORD
EXTRN pcLengthLeft:WORD
EXTRN pcLastSample:BYTE
EXTRN pcSoundLookup:WORD
EXTRN alSound:DWORD
EXTRN alBlock:WORD
EXTRN alLengthLeft:WORD
EXTRN alTimeCount:DWORD
EXTRN sqHack:DWORD
EXTRN sqHackPtr:DWORD
EXTRN sqHackLen:WORD
EXTRN sqHackSeqLen:WORD
EXTRN sqHackTime:DWORD
EXTRN sqPlayedOnce:WORD
EXTRN HackCount:WORD
EXTRN TimeCount:WORD
EXTRN LocalTime:WORD
EXTRN TimerCount:WORD
EXTRN TimerDivisor:WORD
EXTRN t0OldService:DWORD
EXTRN SoundMode:WORD
EXTRN DigiMode:WORD
EXTRN SoundNumber:WORD
EXTRN SoundPriority:WORD
count_time dw ?
count_fx dw ?
IF 0
pcdtab db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b,00b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
db 10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b,10b
ENDIF
;============================================================================
CODESEG
MyDS dw ?
pcindicate dw ?
extreme dw ?
PROC SDL_SetDS
PUBLIC SDL_SetDS
mov ax,ds
mov [cs:MyDS],ds
ret
ENDP
;
; COMMONSTART
; Macro used for common prefix code
;
MACRO COMMONSTART
IF DEBUG
push dx
push ax
mov dx,STATUS_REGISTER_1
in al,dx
mov dx,ATR_INDEX
mov al,ATR_OVERSCAN
out dx,al
mov al,4 ; red
out dx,al
ENDIF
push ds
push ax
mov ds,[cs:MyDS]
inc [HackCount]
ENDM
;
; DOFX
; Macro used to do the sound effects code
;
MACRO DOFX
les di,[pcSound] ; PC sound effects
mov ax,es
or ax,di
jz @@nopc ; nil pointer - no PC sound effect going
mov bl,[es:di] ; Get the byte
inc [WORD PTR pcSound] ; Increment pointer
cmp [pcLastSample],bl ; Is this sample the same as last?
jz @@pcsame ; Yep - don't do anything
mov [pcLastSample],bl ; No, save it for next time
or bl,bl
jz @@pcoff ; If 0, turn sounds off
xor bh,bh
shl bx,1
mov bx,[pcSoundLookup+bx] ; Use byte as index into frequency table
mov al,0b6h ; Write to channel 2 (speaker) timer
out pcTAccess,al
mov al,bl
out pcTimer,al ; Low byte
mov al,bh
out pcTimer,al ; High byte
in al,pcSpeaker ; Turn the speaker & gate on
or al,3
out pcSpeaker,al
jmp @@pcsame
@@pcoff:
in al,pcSpeaker ; Turn the speaker & gate off
and al,0fch ; ~3
out pcSpeaker,al
@@pcsame:
dec [pcLengthLeft] ; Decrement length
jnz @@nopc ; If not 0, we're not done with the sound
mov ax,0
mov [WORD PTR pcSound],ax ; Zero the pointer
mov [WORD PTR pcSound + 2],ax
mov [SoundNumber],ax ; Indicate no sound
mov [SoundPriority],ax ; with no priority
in al,pcSpeaker ; Turn the speaker off
and al,0fdh ; ~2
out pcSpeaker,al
@@nopc:
les di,[alSound] ; AdLib sound effects
mov ax,es
or ax,di
jz @@noal ; nil pointer - no AdLib effect going
xor ah,ah
mov al,[es:di]
or al,al
jz @@aldone
CALL alOut C,alFreqL,ax
mov ax,[alBlock]
@@aldone:
CALL alOut C,alFreqH,ax
inc [WORD PTR alSound]
dec [alLengthLeft]
jnz @@noal
mov ax,0
mov [WORD PTR alSound],ax ; Zero the pointer
mov [WORD PTR alSound + 2],ax
mov [SoundNumber],ax ; Indicate no sound
mov [SoundPriority],ax ; with no priority
CALL alOut C,alFreqH,ax ; Turn off the sound
@@noal:
ENDM
;
;
;
MACRO TIME
cmp [count_time],2
jb @@notime
add [LocalTime],1
adc [LocalTime+2],0
add [TimeCount],1
adc [TimeCount+2],0
mov [count_time],0
@@notime:
ENDM
;
; COMMONEND
; Macro used for common suffix code
;
MACRO COMMONEND
@@fullexit:
pop es
popa
@@nosave:
mov ax,[TimerDivisor]
add [TimerCount],ax
jnc @@myack
pushf
call [t0OldService]
jmp @@out
@@myack:
mov al,20h
out 20h,al
@@out:
pop ax
pop ds
IF DEBUG
mov dx,STATUS_REGISTER_1
in al,dx
mov dx,ATR_INDEX
mov al,ATR_OVERSCAN
out dx,al
mov al,3 ; blue
out dx,al
mov al,20h ; normal
out dx,al
pop ax
pop dx
ENDIF
iret
ENDM
IF 0
;
; SDL_IndicatePC
;
PROC SDL_IndicatePC on:WORD
PUBLIC SDL_IndicatePC
mov ax,[on]
mov [cs:pcindicate],ax
ret
ENDP
;
; SDL_t0ExtremeAsmService
; Timer 0 ISR 7000Hz interrupts
;
PROC SDL_t0ExtremeAsmService
PUBLIC SDL_t0ExtremeAsmService
push ax
mov al,[BYTE PTR cs:pcindicate]
or al,al
jz @@done
push ds
push es
pusha
mov ds,[cs:MyDS]
les di,[pcSound]
mov ax,es
or ax,di
jz @@donereg ; nil pointer
mov bl,[es:di] ; Get the byte
inc [WORD PTR pcSound] ; Increment pointer
and bl,11100000b ; Nuke some of the precision (DEBUG - do this in the table)
xor bh,bh
mov ah,[pcdtab+bx] ; Translate the byte
in al,pcSpeaker
and al,11111100b
or al,ah
out pcSpeaker,al
dec [pcLengthLeft]
jnz @@donereg
mov [WORD PTR pcSound],0 ; We're done with this sample
mov [WORD PTR pcSound+2],0
in al,pcSpeaker
and al,11111100b
out pcSpeaker,al
call SDL_DigitizedDone
@@donereg:
popa
pop es
pop ds
@@done:
inc [cs:extreme]
cmp [cs:extreme],10
jae @@tofast
mov al,20h
out 20h,al
pop ax
iret
@@tofast:
mov [cs:extreme],0
pop ax
; jmp SDL_t0FastAsmService ; Drops through to SDL_t0FastAsmService
ENDP
ENDIF
;
; SDL_t0FastAsmService
; Timer 0 ISR for 700Hz interrupts
;
PROC SDL_t0FastAsmService
PUBLIC SDL_t0FastAsmService
COMMONSTART
inc [count_fx] ; Time to do PC/AdLib effects & time?
cmp [count_fx],5
jae @@dofull
mov ax,[sqActive] ; Is the sequencer active?
or ax,ax
jnz @@dofull
mov ax,[WORD PTR ssSample] ; Is there a sample for the Sound Src?
or ax,[WORD PTR ssSample+2]
jz @@nosave
@@dofull:
pusha
push es
cmp [count_fx],5
jb @@nofx
mov [count_fx],0
DOFX
inc [count_time]
TIME
@@nofx:
mov ax,[sqActive]
or ax,ax
jz @@nosq
mov ax,[sqHackLen]
or ax,ax
jz @@sqdone
les di,[sqHackPtr]
@@sqloop:
mov ax,[WORD PTR sqHackTime+2]
cmp ax,[WORD PTR alTimeCount+2]
ja @@sqdone
mov ax,[WORD PTR sqHackTime]
cmp ax,[WORD PTR alTimeCount]
ja @@sqdone
mov ax,[es:di+2] ; Get time to next event
add ax,[WORD PTR alTimeCount]
mov [WORD PTR sqHackTime],ax
mov ax,[WORD PTR alTimeCount+2]
adc ax,0
mov [WORD PTR sqHackTime+2],ax
mov ax,[es:di] ; Get register/value pair
xor bh,bh
mov bl,ah
xor ah,ah
CALL alOut C,ax,bx
add di,4
mov [WORD PTR sqHackPtr],di
sub [sqHackLen],4
jnz @@sqloop
@@sqdone:
add [WORD PTR alTimeCount],1
adc [WORD PTR alTimeCount+2],0
mov ax,[sqHackLen]
or ax,ax
jnz @@nosq
mov ax,[WORD PTR sqHack] ; Copy pointer
mov [WORD PTR sqHackPtr],ax
mov ax,[WORD PTR sqHack+2]
mov [WORD PTR sqHackPtr+2],ax
mov ax,[sqHackSeqLen] ; Copy length
mov [sqHackLen],ax
mov [WORD PTR sqPlayedOnce],1
mov ax,0
mov [WORD PTR alTimeCount],ax ; Reset time counts
mov [WORD PTR alTimeCount+2],ax
mov [WORD PTR sqHackTime],ax
mov [WORD PTR sqHackTime+2],ax
@@nosq:
les di,[ssSample] ; Get pointer to Sound Source sample
mov ax,es
or ax,di
jz @@ssdone ; If nil, skip this
@@ssloop:
mov dx,[ssStatus] ; Check to see if FIFO has any empty slots
in al,dx
test al,40h
jnz @@ssdone ; Nope - don't push any more data out
mov dx,[ssData]
mov al,[es:di] ; al = *ssSample
out dx,al ; Pump the value out
mov dx,[ssControl] ; Pulse printer select
mov al,[ssOff]
out dx,al
push ax
pop ax
mov al,[ssOn]
out dx,al
push ax ; Delay a short while
pop ax
inc di
mov [WORD PTR ssSample],di ; ssSample++
dec [ssLengthLeft]
jnz @@ssloop
mov [WORD PTR ssSample],0 ; We're done with this sample
mov [WORD PTR ssSample+2],0
call SDL_DigitizedDone
@@ssdone:
COMMONEND
ENDP
;
; SDL_t0SlowAsmService
; Timer 0 ISR for 140Hz interrupts
;
PROC SDL_t0SlowAsmService
PUBLIC SDL_t0SlowAsmService
IF DEBUG
push dx
push ax
mov dx,STATUS_REGISTER_1
in al,dx
mov dx,ATR_INDEX
mov al,ATR_OVERSCAN
out dx,al
mov al,4 ; red
out dx,al
ENDIF
push ds
push ax
mov ds,[cs:MyDS]
inc [count_time]
TIME
mov ax,[WORD PTR pcSound] ; Is there a PC sound effect going?
or ax,[WORD PTR pcSound+2]
jnz @@dofull
mov ax,[WORD PTR alSound] ; Is there an AdLib sound effect going?
or ax,[WORD PTR alSound+2]
jz @@nosave
@@dofull:
pusha
push es
DOFX
COMMONEND
ENDP
END

137
ID_US.H Normal file
View file

@ -0,0 +1,137 @@
//
// ID Engine
// ID_US.h - Header file for the User Manager
// v1.0d1
// By Jason Blochowiak
//
#ifndef __ID_US__
#define __ID_US__
#ifdef __DEBUG__
#define __DEBUG_UserMgr__
#endif
//#define HELPTEXTLINKED
#define MaxX 320
#define MaxY 200
#define MaxHelpLines 500
#define MaxHighName 57
#define MaxScores 10
typedef struct
{
char name[MaxHighName + 1];
long score;
word completed,episode,ratio;
} HighScore;
#define MaxGameName 32
#define MaxSaveGames 6
typedef struct
{
char signature[4];
word *oldtest;
boolean present;
char name[MaxGameName + 1];
} SaveGame;
#define MaxString 128 // Maximum input string size
typedef struct
{
int x,y,
w,h,
px,py;
} WindowRec; // Record used to save & restore screen windows
typedef enum
{
gd_Continue,
gd_Easy,
gd_Normal,
gd_Hard
} GameDiff;
// Custom Cursor struct type for US_LineInput()
typedef struct // JAM - Custom Cursor Support
{
char cursor_char;
char do_not_use; // Space holder for ASCZ string
unsigned cursor_color;
unsigned font_number;
} US_CursorStruct;
// Hack import for TED launch support
//extern boolean tedlevel;
//extern word tedlevelnum;
extern void TEDDeath(void);
extern boolean ingame, // Set by game code if a game is in progress
abortgame, // Set if a game load failed
loadedgame, // Set if the current game was loaded
NoWait,
HighScoresDirty;
extern char *abortprogram; // Set to error msg if program is dying
extern GameDiff restartgame; // Normally gd_Continue, else starts game
extern word PrintX,PrintY; // Current printing location in the window
extern word WindowX,WindowY,// Current location of window
WindowW,WindowH;// Current size of window
extern boolean Button0,Button1,
CursorBad;
extern int CursorX,CursorY;
extern void (*USL_MeasureString)(char far *,word *,word *),
(*USL_DrawString)(char far *);
extern boolean (*USL_SaveGame)(int),(*USL_LoadGame)(int);
extern void (*USL_ResetGame)(void);
extern SaveGame Games[MaxSaveGames];
extern HighScore Scores[];
extern US_CursorStruct US_CustomCursor; // JAM
extern boolean use_custom_cursor; // JAM
#define US_HomeWindow() {PrintX = WindowX; PrintY = WindowY;}
extern void US_Startup(void),
US_Setup(void),
US_Shutdown(void),
US_InitRndT(boolean randomize),
US_SetLoadSaveHooks(boolean (*load)(int),
boolean (*save)(int),
void (*reset)(void)),
US_TextScreen(void),
US_UpdateTextScreen(void),
US_FinishTextScreen(void),
US_DrawWindow(word x,word y,word w,word h),
US_CenterWindow(word,word),
US_SaveWindow(WindowRec *win),
US_RestoreWindow(WindowRec *win),
US_ClearWindow(void),
US_SetPrintRoutines(void (*measure)(char far *,word *,word *),
void (*print)(char far *)),
US_PrintCentered(char far *s),
US_CPrint(char far *s),
US_CPrintLine(char far *s),
US_Print(char far *s),
US_PrintUnsigned(longword n),
US_PrintSigned(long n),
US_StartCursor(void),
US_ShutCursor(void),
US_CheckHighScore(long score,word other),
US_DisplayHighScores(int which);
extern boolean US_UpdateCursor(void),
US_LineInput(int x,int y,char far *buf,char far *def,boolean escok,
int maxchars,int maxwidth);
extern int US_CheckParm(char far *parm,char far * far * strings),
US_RndT(void);
void USL_PrintInCenter(char far *s,Rect r);
char *USL_GiveSaveName(word game);
#endif

780
ID_US_1.C Normal file
View file

@ -0,0 +1,780 @@
//
// 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
// Global variables
char *abortprogram;
// boolean NoWait;
word PrintX,PrintY;
word WindowX,WindowY,WindowW,WindowH;
US_CursorStruct US_CustomCursor; // JAM
boolean use_custom_cursor=false; // JAM
// Internal variables
#define ConfigVersion 1
char far * far US_ParmStrings[] = {"TEDLEVEL","NOWAIT"},
far * far US_ParmStrings2[] = {"COMP","NOCOMP"};
boolean US_Started;
boolean Button0,Button1,
CursorBad;
int CursorX,CursorY;
void (*USL_MeasureString)(char far *,word *,word *) = VW_MeasurePropString,
(*USL_DrawString)(char far *) = VWB_DrawPropString;
SaveGame Games[MaxSaveGames];
HighScore Scores[MaxScores] =
{
{"JAM PRODUCTIONS INC.", 10000,1,0},
{"", 10000,1,0},
{"JERRY JONES", 10000,1,0},
{"MICHAEL MAYNARD", 10000,1,0},
{"JAMES T. ROW", 10000,1,0},
{"", 10000,1,0},
{"", 10000,1,0},
{"TO REGISTER CALL", 10000,1,0},
{" 1-800-GAME123", 10000,1,0},
{"", 10000,1,0},
};
// Internal routines
// 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
fontnumber = 4;
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);
return(ABORT);
#undef IGNORE
#undef RETRY
#undef ABORT
}
#pragma warn +par
#pragma warn +rch
///////////////////////////////////////////////////////////////////////////
//
// US_Shutdown() - Shuts down the User Mgr
//
///////////////////////////////////////////////////////////////////////////
void
US_Shutdown(void)
{
if (!US_Started)
return;
US_Started = false;
}
///////////////////////////////////////////////////////////////////////////
//
// US_CheckParm() - checks to see if a string matches one of a set of
// strings. The check is case insensitive. The routine returns the
// index of the string that matched, or -1 if no matches were found
//
///////////////////////////////////////////////////////////////////////////
int US_CheckParm(char far *parm,char far * far * strings)
{
char cp,cs,
far *p,far *s;
int i;
while (!isalpha(*parm)) // Skip non-alphas
parm++;
for (i = 0;*strings && **strings;i++)
{
for (s = *strings++,p = parm,cs = cp = 0;cs == cp;)
{
cs = *s++;
if (!cs)
return(i);
cp = *p++;
if (isupper(cs))
cs = tolower(cs);
if (isupper(cp))
cp = tolower(cp);
}
}
return(-1);
}
// Window/Printing routines
#if 0
///////////////////////////////////////////////////////////////////////////
//
// US_SetPrintRoutines() - Sets the routines used to measure and print
// from within the User Mgr. Primarily provided to allow switching
// between masked and non-masked fonts
//
///////////////////////////////////////////////////////////////////////////
void
US_SetPrintRoutines(void (*measure)(char far *,word *,word *),void (*print)(char far *))
{
USL_MeasureString = measure;
USL_DrawString = print;
}
#endif
///////////////////////////////////////////////////////////////////////////
//
// US_Print() - Prints a string in the current window. Newlines are
// supported.
//
///////////////////////////////////////////////////////////////////////////
void
US_Print(char far *s)
{
char c,far *se;
word w,h;
while (*s)
{
se = s;
while ((c = *se) && (c != '\n'))
se++;
*se = '\0';
USL_MeasureString(s,&w,&h);
px = PrintX;
py = PrintY;
USL_DrawString(s);
s = se;
if (c)
{
*se = c;
s++;
PrintX = WindowX;
PrintY += h;
}
else
PrintX += w;
}
}
///////////////////////////////////////////////////////////////////////////
//
// US_PrintUnsigned() - Prints an unsigned long
//
///////////////////////////////////////////////////////////////////////////
void
US_PrintUnsigned(longword n)
{
char buffer[32];
US_Print(ultoa(n,buffer,10));
}
#if 0
///////////////////////////////////////////////////////////////////////////
//
// US_PrintSigned() - Prints a signed long
//
///////////////////////////////////////////////////////////////////////////
void
US_PrintSigned(long n)
{
char buffer[32];
US_Print(ltoa(n,buffer,10));
}
#endif
///////////////////////////////////////////////////////////////////////////
//
// USL_PrintInCenter() - Prints a string in the center of the given rect
//
///////////////////////////////////////////////////////////////////////////
void
USL_PrintInCenter(char far *s,Rect r)
{
word w,h,
rw,rh;
USL_MeasureString(s,&w,&h);
rw = r.lr.x - r.ul.x;
rh = r.lr.y - r.ul.y;
px = r.ul.x + ((rw - w) / 2);
py = r.ul.y + ((rh - h) / 2);
USL_DrawString(s);
}
///////////////////////////////////////////////////////////////////////////
//
// US_PrintCentered() - Prints a string centered in the current window.
//
///////////////////////////////////////////////////////////////////////////
void
US_PrintCentered(char far *s)
{
Rect r;
r.ul.x = WindowX;
r.ul.y = WindowY;
r.lr.x = r.ul.x + WindowW;
r.lr.y = r.ul.y + WindowH;
USL_PrintInCenter(s,r);
}
///////////////////////////////////////////////////////////////////////////
//
// US_CPrintLine() - Prints a string centered on the current line and
// advances to the next line. Newlines are not supported.
//
///////////////////////////////////////////////////////////////////////////
void
US_CPrintLine(char far *s)
{
word w,h;
USL_MeasureString(s,&w,&h);
if (w > WindowW)
US1_ERROR(US_CPRINTLINE_WIDTH);
px = WindowX + ((WindowW - w) / 2);
py = PrintY;
USL_DrawString(s);
PrintY += h;
}
///////////////////////////////////////////////////////////////////////////
//
// US_CPrint() - Prints a string in the current window. Newlines are
// supported.
//
///////////////////////////////////////////////////////////////////////////
void
US_CPrint(char far *s)
{
char c,far *se;
while (*s)
{
se = s;
while ((c = *se) && (c != '\n'))
se++;
*se = '\0';
US_CPrintLine(s);
s = se;
if (c)
{
*se = c;
s++;
}
}
}
///////////////////////////////////////////////////////////////////////////
//
// US_ClearWindow() - Clears the current window to white and homes the
// cursor
//
///////////////////////////////////////////////////////////////////////////
void
US_ClearWindow(void)
{
VWB_Bar(WindowX,WindowY,WindowW,WindowH,0xEF);
PrintX = WindowX;
PrintY = WindowY;
}
///////////////////////////////////////////////////////////////////////////
//
// US_DrawWindow() - Draws a frame and sets the current window parms
//
///////////////////////////////////////////////////////////////////////////
void
US_DrawWindow(word x,word y,word w,word h)
{
word i,
sx,sy,sw,sh;
WindowX = x * 8;
WindowY = y * 8;
WindowW = w * 8;
WindowH = h * 8;
PrintX = WindowX;
PrintY = WindowY;
sx = (x - 1) * 8;
sy = (y - 1) * 8;
sw = (w + 1) * 8;
sh = (h + 1) * 8;
US_ClearWindow();
VWB_DrawTile8(sx,sy,0),VWB_DrawTile8(sx,sy + sh,5);
for (i = sx + 8;i <= sx + sw - 8;i += 8)
VWB_DrawTile8(i,sy,1),VWB_DrawTile8(i,sy + sh,6);
VWB_DrawTile8(i,sy,2),VWB_DrawTile8(i,sy + sh,7);
for (i = sy + 8;i <= sy + sh - 8;i += 8)
VWB_DrawTile8(sx,i,3),VWB_DrawTile8(sx + sw,i,4);
}
///////////////////////////////////////////////////////////////////////////
//
// US_CenterWindow() - Generates a window of a given width & height in the
// middle of the screen
//
///////////////////////////////////////////////////////////////////////////
void
US_CenterWindow(word w,word h)
{
US_DrawWindow(((MaxX / 8) - w) / 2,((MaxY / 8) - h) / 2,w,h);
}
///////////////////////////////////////////////////////////////////////////
//
// US_SaveWindow() - Saves the current window parms into a record for
// later restoration
//
///////////////////////////////////////////////////////////////////////////
void
US_SaveWindow(WindowRec *win)
{
win->x = WindowX;
win->y = WindowY;
win->w = WindowW;
win->h = WindowH;
win->px = PrintX;
win->py = PrintY;
}
///////////////////////////////////////////////////////////////////////////
//
// US_RestoreWindow() - Sets the current window parms to those held in the
// record
//
///////////////////////////////////////////////////////////////////////////
void
US_RestoreWindow(WindowRec *win)
{
WindowX = win->x;
WindowY = win->y;
WindowW = win->w;
WindowH = win->h;
PrintX = win->px;
PrintY = win->py;
}
// Input routines
///////////////////////////////////////////////////////////////////////////
//
// USL_XORICursor() - XORs the I-bar text cursor. Used by US_LineInput()
//
///////////////////////////////////////////////////////////////////////////
static void
USL_XORICursor(int x,int y,char *s,word cursor)
{
static boolean status; // VGA doesn't XOR...
char buf[MaxString];
int temp;
word w,h;
strcpy(buf,s);
buf[cursor] = '\0';
USL_MeasureString(buf,&w,&h);
px = x + w - 1;
py = y;
VL_WaitVBL(1);
if (status^=1)
{
USL_DrawString("\x80");
}
else
{
temp = fontcolor;
fontcolor = backcolor;
USL_DrawString("\x80");
fontcolor = temp;
}
}
// JAM BEGIN - New Function
///////////////////////////////////////////////////////////////////////////
//
// USL_CustomCursor() - Toggle Displays the custom text cursor.
// Used by US_LineInput()
//
///////////////////////////////////////////////////////////////////////////
static void USL_CustomCursor(int x,int y,char *s,word cursor)
{
static boolean status; // VGA doesn't XOR...
char buf[MaxString];
int temp,temp_font;
word w,h;
strcpy(buf,s);
buf[cursor] = '\0';
USL_MeasureString(buf,&w,&h);
px = x + w - 1;
py = y;
temp = fontcolor;
temp_font = fontnumber;
fontnumber = US_CustomCursor.font_number;
if (status^=1)
fontcolor = US_CustomCursor.cursor_color;
else
fontcolor = backcolor;
VL_WaitVBL(1);
USL_DrawString(&US_CustomCursor.cursor_char);
fontcolor = temp;
fontnumber = temp_font;
}
// JAM END - New Function
///////////////////////////////////////////////////////////////////////////
//
// US_LineInput() - Gets a line of user input at (x,y), the string defaults
// to whatever is pointed at by def. Input is restricted to maxchars
// chars or maxwidth pixels wide. If the user hits escape (and escok is
// true), nothing is copied into buf, and false is returned. If the
// user hits return, the current string is copied into buf, and true is
// returned
//
///////////////////////////////////////////////////////////////////////////
boolean US_LineInput(int x,int y,char far *buf,char far *def,boolean escok,
int maxchars,int maxwidth)
{
boolean redraw,
cursorvis,cursormoved,
done,result;
ScanCode sc;
char c,
s[MaxString],olds[MaxString];
word i,
cursor,
w,h,
len,temp;
longword lasttime;
if (def)
_fstrcpy(s,def);
else
*s = '\0';
*olds = '\0';
cursor = strlen(s);
cursormoved = redraw = true;
cursorvis = done = false;
lasttime = TimeCount;
LastASCII = key_None;
LastScan = sc_None;
while (!done)
{
if (cursorvis)
{
if (use_custom_cursor) // JAM
USL_CustomCursor(x,y,s,cursor); // JAM
else
USL_XORICursor(x,y,s,cursor);
}
asm pushf
asm cli
sc = LastScan;
LastScan = sc_None;
c = LastASCII;
LastASCII = key_None;
asm popf
switch (sc)
{
#if 0
case sc_LeftArrow:
if (cursor)
cursor--;
c = key_None;
cursormoved = true;
redraw = use_custom_cursor; // JAM -
break;
case sc_RightArrow:
if (s[cursor])
cursor++;
c = key_None;
cursormoved = true;
redraw = use_custom_cursor; // JAM -
break;
case sc_Home:
cursor = 0;
c = key_None;
cursormoved = true;
redraw = use_custom_cursor; // JAM -
break;
case sc_End:
cursor = strlen(s);
c = key_None;
cursormoved = true;
break;
#endif
case sc_Return:
_fstrcpy(buf,s);
done = true;
result = true;
c = key_None;
break;
case sc_Escape:
if (escok)
{
done = true;
result = false;
}
c = key_None;
break;
case sc_BackSpace:
if (cursor)
{
strcpy(s + cursor - 1,s + cursor);
cursor--;
redraw = true;
}
c = key_None;
cursormoved = true;
break;
#if 0
case sc_Delete:
if (s[cursor])
{
strcpy(s + cursor,s + cursor + 1);
redraw = true;
}
c = key_None;
cursormoved = true;
break;
#endif
case 0x4c: // Keypad 5
case sc_UpArrow:
case sc_DownArrow:
case sc_PgUp:
case sc_PgDn:
case sc_Insert:
c = key_None;
break;
}
if (c)
{
len = strlen(s);
USL_MeasureString(s,&w,&h);
if ( isprint(c) && (len < MaxString - 1)
&& ((!maxchars) || (len < maxchars))
&& ((!maxwidth) || (w < maxwidth)))
{
for (i = len + 1;i > cursor;i--)
s[i] = s[i - 1];
s[cursor++] = c;
redraw = true;
}
}
if (redraw)
{
px = x;
py = y;
temp = fontcolor;
fontcolor = backcolor;
USL_DrawString(olds);
fontcolor = temp;
strcpy(olds,s);
px = x;
py = y;
USL_DrawString(s);
redraw = false;
}
if (cursormoved)
{
cursorvis = false;
lasttime = TimeCount - TickBase;
cursormoved = false;
}
if (TimeCount - lasttime > TickBase / 2)
{
lasttime = TimeCount;
cursorvis ^= true;
}
if (cursorvis)
if (use_custom_cursor) // JAM
USL_CustomCursor(x,y,s,cursor); // JAM
else
USL_XORICursor(x,y,s,cursor);
VW_UpdateScreen();
}
if (cursorvis)
if (use_custom_cursor) // JAM
USL_CustomCursor(x,y,s,cursor); // JAM
else
USL_XORICursor(x,y,s,cursor);
if (!result)
{
px = x;
py = y;
USL_DrawString(olds);
}
VW_UpdateScreen();
IN_ClearKeysDown();
return(result);
}

101
ID_US_A.ASM Normal file
View file

@ -0,0 +1,101 @@
IDEAL
MODEL MEDIUM,C
; Assembly portion of the User Mgr. This is just John Carmack's table
; driven pseudo-random number generator, and we put it in the User Mgr
; because we couldn't figure out where it should go
;============================================================================
;
; RANDOM ROUTINES
;
;============================================================================
FARDATA
rndindex dw ?
rndtable db 0, 8, 109, 220, 222, 241, 149, 107, 75, 248, 254, 140, 16, 66
db 74, 21, 211, 47, 80, 242, 154, 27, 205, 128, 161, 89, 77, 36
db 95, 110, 85, 48, 212, 140, 211, 249, 22, 79, 200, 50, 28, 188
db 52, 140, 202, 120, 68, 145, 62, 70, 184, 190, 91, 197, 152, 224
db 149, 104, 25, 178, 252, 182, 202, 182, 141, 197, 4, 81, 181, 242
db 145, 42, 39, 227, 156, 198, 225, 193, 219, 93, 122, 175, 249, 0
db 175, 143, 70, 239, 46, 246, 163, 53, 163, 109, 168, 135, 2, 235
db 25, 92, 20, 145, 138, 77, 69, 166, 78, 176, 173, 212, 166, 113
db 94, 161, 41, 50, 239, 49, 111, 164, 70, 60, 2, 37, 171, 75
db 136, 156, 11, 56, 42, 146, 138, 229, 73, 146, 77, 61, 98, 196
db 135, 106, 63, 197, 195, 86, 96, 203, 113, 101, 170, 247, 181, 113
db 80, 250, 108, 7, 255, 237, 129, 226, 79, 107, 112, 166, 103, 241
db 24, 223, 239, 120, 198, 58, 60, 82, 128, 3, 184, 66, 143, 224
db 145, 224, 81, 206, 163, 45, 63, 90, 168, 114, 59, 33, 159, 95
db 28, 139, 123, 98, 125, 196, 15, 70, 194, 253, 54, 14, 109, 226
db 71, 17, 161, 93, 186, 87, 244, 138, 20, 52, 123, 251, 26, 36
db 17, 46, 52, 231, 232, 76, 31, 221, 84, 37, 216, 165, 212, 106
db 197, 242, 98, 43, 39, 175, 254, 145, 190, 84, 118, 222, 187, 136
db 120, 163, 236, 249
PUBLIC rndtable
CODESEG
LastRnd dw ?
;=================================================
;
; void US_InitRndT (boolean randomize)
; Init table based RND generator
; if randomize is false, the counter is set to 0
;
;=================================================
PROC US_InitRndT randomize:word
uses si,di
public US_InitRndT
mov ax,SEG rndtable
mov es,ax
mov ax,[randomize]
or ax,ax
jne @@timeit ;if randomize is true, really random
mov dx,0 ;set to a definite value
jmp @@setit
@@timeit:
mov ah,2ch
int 21h ;GetSystemTime
and dx,0ffh
@@setit:
mov [es:rndindex],dx
ret
ENDP
;=================================================
;
; int US_RndT (void)
; Return a random # between 0-255
; Exit : AX = value
;
;=================================================
PROC US_RndT
public US_RndT
mov ax,SEG rndtable
mov es,ax
mov bx,[es:rndindex]
inc bx
and bx,0ffh
mov [es:rndindex],bx
mov al,[es:rndtable+BX]
xor ah,ah
ret
ENDP
END

523
ID_VH.C Normal file
View file

@ -0,0 +1,523 @@
// ID_VH.C
#include "ID_HEADS.H"
#define SCREENWIDTH 80
#define CHARWIDTH 2
#define TILEWIDTH 4
#define GRPLANES 4
#define BYTEPIXELS 4
#define SCREENXMASK (~3)
#define SCREENXPLUS (3)
#define SCREENXDIV (4)
#define VIEWWIDTH 80
#define PIXTOBLOCK 4 // 16 pixels to an update block
#define UNCACHEGRCHUNK(chunk) {MM_FreePtr(&grsegs[chunk]);grneeded[chunk]&=~ca_levelbit;}
//byte update[UPDATEHIGH][UPDATEWIDE]; // MIKE this is the second declaration for this variable!?!?
//==========================================================================
pictabletype _seg *pictable;
pictabletype _seg *picmtable;
int px,py;
byte fontcolor,backcolor;
int fontnumber;
int bufferwidth,bufferheight;
boolean allcaps = false;
//==========================================================================
void VWL_UpdateScreenBlocks (void);
//==========================================================================
void VW_DrawPropString (char far *string)
{
fontstruct far *font;
int width,step,height,i;
byte far *source, far *dest, far *origdest;
byte ch,mask;
font = (fontstruct far *)grsegs[STARTFONT+fontnumber];
height = bufferheight = font->height;
dest = origdest = MK_FP(SCREENSEG,bufferofs+ylookup[py]+(px>>2));
mask = 1<<(px&3);
while ((ch = *string++)!=0)
{
width = step = font->width[ch];
source = ((byte far *)font)+font->location[ch];
while (width--)
{
VGAMAPMASK(mask);
asm mov ah,[BYTE PTR fontcolor]
asm mov bx,[step]
asm mov cx,[height]
asm mov dx,[linewidth]
asm lds si,[source]
asm les di,[dest]
vertloop:
asm mov al,[si]
asm or al,al
asm je next
asm mov [es:di],ah // draw color
next:
asm add si,bx
asm add di,dx
asm loop vertloop
asm mov ax,ss
asm mov ds,ax
source++;
px++;
mask <<= 1;
if (mask == 16)
{
mask = 1;
dest++;
}
}
}
bufferheight = height;
bufferwidth = ((dest+1)-origdest)*4;
}
//==========================================================================
#if 0
/*
=================
=
= VL_MungePic
=
=================
*/
void VL_MungePic (byte far *source, unsigned width, unsigned height)
{
unsigned x,y,plane,size,pwidth;
byte _seg *temp, far *dest, far *srcline;
size = width*height;
if (width&3)
VH_ERROR(VL_MUNGEPIC_NO_DIV_FOUR);
//
// copy the pic to a temp buffer
//
MM_GetPtr (&(memptr)temp,size);
_fmemcpy (temp,source,size);
//
// munge it back into the original buffer
//
dest = source;
pwidth = width/4;
for (plane=0;plane<4;plane++)
{
srcline = temp;
for (y=0;y<height;y++)
{
for (x=0;x<pwidth;x++)
*dest++ = *(srcline+x*4+plane);
srcline+=width;
}
}
MM_FreePtr (&(memptr)temp);
}
#endif
void VWL_MeasureString (char far *string, word *width, word *height
, fontstruct _seg *font)
{
*height = font->height;
for (*width = 0;*string;string++)
*width += font->width[*((byte far *)string)]; // proportional width
}
void VW_MeasurePropString (char far *string, word *width, word *height)
{
VWL_MeasureString(string,width,height,(fontstruct _seg *)grsegs[STARTFONT+fontnumber]);
}
#if 0
void VW_MeasureMPropString (char far *string, word *width, word *height)
{
VWL_MeasureString(string,width,height,(fontstruct _seg *)grsegs[STARTFONTM+fontnumber]);
}
#endif
/*
=============================================================================
Double buffer management routines
=============================================================================
*/
/*
=======================
=
= VW_MarkUpdateBlock
=
= Takes a pixel bounded block and marks the tiles in bufferblocks
= Returns 0 if the entire block is off the buffer screen
=
=======================
*/
int VW_MarkUpdateBlock (int x1, int y1, int x2, int y2)
{
int x,y,xt1,yt1,xt2,yt2,nextline;
byte *mark;
xt1 = x1>>PIXTOBLOCK;
yt1 = y1>>PIXTOBLOCK;
xt2 = x2>>PIXTOBLOCK;
yt2 = y2>>PIXTOBLOCK;
if (xt1<0)
xt1=0;
else if (xt1>=UPDATEWIDE)
return 0;
if (yt1<0)
yt1=0;
else if (yt1>UPDATEHIGH)
return 0;
if (xt2<0)
return 0;
else if (xt2>=UPDATEWIDE)
xt2 = UPDATEWIDE-1;
if (yt2<0)
return 0;
else if (yt2>=UPDATEHIGH)
yt2 = UPDATEHIGH-1;
mark = updateptr + uwidthtable[yt1] + xt1;
nextline = UPDATEWIDE - (xt2-xt1) - 1;
for (y=yt1;y<=yt2;y++)
{
for (x=xt1;x<=xt2;x++)
*mark++ = 1; // this tile will need to be updated
mark += nextline;
}
return 1;
}
void VWB_DrawTile8 (int x, int y, int tile)
{
if (VW_MarkUpdateBlock (x,y,x+7,y+7))
LatchDrawChar(x,y,tile);
}
#if 0
void VWB_DrawTile8M (int x, int y, int tile)
{
if (VW_MarkUpdateBlock (x,y,x+7,y+7))
VL_MemToScreen (((byte far *)grsegs[STARTTILE8M])+tile*64,8,8,x,y);
}
#endif
void VWB_DrawPic (int x, int y, int chunknum)
{
int picnum = chunknum - STARTPICS;
unsigned width,height;
x &= ~7;
width = pictable[picnum].width;
height = pictable[picnum].height;
if (VW_MarkUpdateBlock (x,y,x+width-1,y+height-1))
VL_MemToScreen (grsegs[chunknum],width,height,x,y);
}
//--------------------------------------------------------------------------
// VWB_DrawMPic()
//--------------------------------------------------------------------------
void VWB_DrawMPic (int x, int y, int chunknum)
{
int picnum = chunknum - STARTPICS;
unsigned width,height;
width = pictable[picnum].width;
height = pictable[picnum].height;
if (VW_MarkUpdateBlock (x,y,x+width-1,y+height-1))
VL_MaskMemToScreen (grsegs[chunknum],width,height,x,y,255);
}
void VWB_DrawPropString (char far *string)
{
int x;
x=px;
VW_DrawPropString (string);
VW_MarkUpdateBlock(x,py,px-1,py+bufferheight-1);
}
void VWB_Bar (int x, int y, int width, int height, int color)
{
if (VW_MarkUpdateBlock (x,y,x+width,y+height-1) )
VW_Bar (x,y,width,height,color);
}
void VWB_Plot (int x, int y, int color)
{
if (VW_MarkUpdateBlock (x,y,x,y))
VW_Plot(x,y,color);
}
void VWB_Hlin (int x1, int x2, int y, int color)
{
if (VW_MarkUpdateBlock (x1,y,x2,y))
VW_Hlin(x1,x2,y,color);
}
void VWB_Vlin (int y1, int y2, int x, int color)
{
if (VW_MarkUpdateBlock (x,y1,x,y2))
VW_Vlin(y1,y2,x,color);
}
#if 0 /// MADE A MACRO
void VW_UpdateScreen (void)
{
VH_UpdateScreen ();
}
#endif
/*
=============================================================================
WOLFENSTEIN STUFF
=============================================================================
*/
/*
=====================
=
= LatchDrawPic
=
=====================
*/
void LatchDrawPic (unsigned x, unsigned y, unsigned picnum)
{
unsigned wide, height, source;
x <<= 3;
wide = pictable[picnum-STARTPICS].width;
height = pictable[picnum-STARTPICS].height;
source = latchpics[2+picnum-LATCHPICS_LUMP_START];
if (VW_MarkUpdateBlock (x,y,x+wide-1,y+height-1))
VL_LatchToScreen (source,wide/4,height,x,y);
}
//==========================================================================
/*
===================
=
= LoadLatchMem
=
===================
*/
//unsigned LatchMemFree = 0xffff;
unsigned destoff;
void LoadLatchMem (void)
{
int i,j,p,m,width,height;
byte far *src;
unsigned picnum=0;
//
// tile 8s
//
latchpics[picnum++] = freelatch;
CA_CacheGrChunk (STARTTILE8);
src = (byte _seg *)grsegs[STARTTILE8];
destoff = freelatch;
for (i=0;i<NUMTILE8;i++)
{
VL_MemToLatch (src,8,8,destoff);
src += 64;
destoff +=16;
}
UNCACHEGRCHUNK (STARTTILE8);
#if 0 // ran out of latch space!
//
// tile 16s
//
src = (byte _seg *)grsegs[STARTTILE16];
latchpics[picnum++] = destoff;
for (i=0;i<NUMTILE16;i++)
{
CA_CacheGrChunk (STARTTILE16+i);
src = (byte _seg *)grsegs[STARTTILE16+i];
VL_MemToLatch (src,16,16,destoff);
destoff+=64;
if (src)
UNCACHEGRCHUNK (STARTTILE16+i);
}
#endif
//
// pics
//
picnum++;
for (i=LATCHPICS_LUMP_START;i<=LATCHPICS_LUMP_END;i++)
{
latchpics[picnum++] = destoff;
CA_CacheGrChunk (i);
width = pictable[i-STARTPICS].width;
height = pictable[i-STARTPICS].height;
VL_MemToLatch (grsegs[i],width,height,destoff);
destoff += width/4 *height;
UNCACHEGRCHUNK(i);
}
EGAMAPMASK(15);
}
//==========================================================================
/*
===================
=
= FizzleFade
=
= returns true if aborted
=
===================
*/
extern ControlInfo c;
boolean FizzleFade (unsigned source, unsigned dest,
unsigned width,unsigned height, unsigned frames, boolean abortable)
{
int pixperframe;
unsigned drawofs,pagedelta;
byte mask,maskb[8] = {1,2,4,8};
unsigned x,y,p,frame;
long rndval;
pagedelta = dest-source;
rndval = 1;
y = 0;
pixperframe = 64000/frames;
IN_StartAck ();
TimeCount=frame=0;
do // while (1)
{
if (abortable && IN_CheckAck () )
return true;
asm mov es,[screenseg]
for (p=0;p<pixperframe;p++)
{
//
// seperate random value into x/y pair
//
asm mov ax,[WORD PTR rndval]
asm mov dx,[WORD PTR rndval+2]
asm mov bx,ax
asm dec bl
asm mov [BYTE PTR y],bl // low 8 bits - 1 = y xoordinate
asm mov bx,ax
asm mov cx,dx
asm mov [BYTE PTR x],ah // next 9 bits = x xoordinate
asm mov [BYTE PTR x+1],dl
//
// advance to next random element
//
asm shr dx,1
asm rcr ax,1
asm jnc noxor
asm xor dx,0x0001
asm xor ax,0x2000
noxor:
asm mov [WORD PTR rndval],ax
asm mov [WORD PTR rndval+2],dx
if (x>width || y>height)
continue;
drawofs = source+ylookup[y] + (x>>2);
//
// copy one pixel
//
mask = x&3;
VGAREADMAP(mask);
mask = maskb[mask];
VGAMAPMASK(mask);
asm mov di,[drawofs]
asm mov al,[es:di]
asm add di,[pagedelta]
asm mov [es:di],al
if (rndval == 1) // entire sequence has been completed
return false;
}
frame++;
while (TimeCount<frame) // don't go too fast
;
CalcTics();
if (!(frame&3))
ForceUpdateStatusBar();
} while (1);
}

143
ID_VH.H Normal file
View file

@ -0,0 +1,143 @@
// ID_VH.H
#define WHITE 15 // graphics mode independant colors
#define BLACK 0
#define FIRSTCOLOR 1
#define SECONDCOLOR 12
#define F_WHITE 15
#define F_BLACK 0
#define F_FIRSTCOLOR 1
#define F_SECONDCOLOR 12
//===========================================================================
#define MAXSHIFTS 1
typedef struct
{
int width,
height,
orgx,orgy,
xl,yl,xh,yh,
shifts;
} spritetabletype;
typedef struct
{
unsigned sourceoffset[MAXSHIFTS];
unsigned planesize[MAXSHIFTS];
unsigned width[MAXSHIFTS];
byte data[];
} spritetype; // the memptr for each sprite points to this
typedef struct
{
int width,height;
} pictabletype;
typedef struct
{
int height;
int location[256];
char width[256];
} fontstruct;
//===========================================================================
extern pictabletype _seg *pictable;
extern pictabletype _seg *picmtable;
extern spritetabletype _seg *spritetable;
extern byte fontcolor;
extern int fontnumber;
extern int px,py;
extern boolean allcaps;
//
// Double buffer management routines
//
void VW_InitDoubleBuffer (void);
int VW_MarkUpdateBlock (int x1, int y1, int x2, int y2);
//void VW_UpdateScreen (void); // Made a macro
//
// mode independant routines
// coordinates in pixels, rounded to best screen res
// regions marked in double buffer
//
void VWB_DrawTile8 (int x, int y, int tile);
void VWB_DrawTile8M (int x, int y, int tile);
void VWB_DrawTile16 (int x, int y, int tile);
void VWB_DrawTile16M (int x, int y, int tile);
void VWB_DrawPic (int x, int y, int chunknum);
void VWB_DrawMPic(int x, int y, int chunknum);
void VWB_Bar (int x, int y, int width, int height, int color);
void VWB_DrawPropString (char far *string);
void VW_DrawPropString (char far *string);
void VWB_DrawMPropString (char far *string);
void VWB_DrawSprite (int x, int y, int chunknum);
void VWB_Plot (int x, int y, int color);
void VWB_Hlin (int x1, int x2, int y, int color);
void VWB_Vlin (int y1, int y2, int x, int color);
//
// wolfenstein EGA compatability stuff
//
extern byte far vgapal;
void VH_SetDefaultColors (void);
#define VW_Startup VL_Startup
#define VW_Shutdown VL_Shutdown
#define VW_SetCRTC VL_SetCRTC
#define VW_SetScreen VL_SetScreen
#define VW_Bar VL_Bar
#define VW_Plot VL_Plot
#define VW_Hlin(x,z,y,c) VL_Hlin(x,y,(z)-(x)+1,c)
#define VW_Vlin(y,z,x,c) VL_Vlin(x,y,(z)-(y)+1,c)
#define VW_DrawPic VH_DrawPic
#define VW_SetSplitScreen VL_SetSplitScreen
#define VW_SetLineWidth VL_SetLineWidth
#define VW_ColorBorder VL_ColorBorder
#define VW_WaitVBL VL_WaitVBL
#define VW_FadeIn() VL_FadeIn(0,255,&vgapal,30);
#define VW_FadeOut() VL_FadeOut(0,255,0,0,0,30);
#define VW_ScreenToScreen VL_ScreenToScreen
#define VW_SetDefaultColors VH_SetDefaultColors
void VW_MeasurePropString (char far *string, word *width, word *height);
#define EGAMAPMASK(x) VGAMAPMASK(x)
#define EGAWRITEMODE(x) VGAWRITEMODE(x)
//#define VW_MemToScreen VL_MemToLatch
#define VW_UpdateScreen() VH_UpdateScreen()
#define MS_Quit Quit
#define LatchDrawChar(x,y,p) VL_LatchToScreen(latchpics[0]+(p)*16,2,8,x,y)
#define LatchDrawTile(x,y,p) VL_LatchToScreen(latchpics[1]+(p)*64,4,16,x,y)
void LatchDrawPic (unsigned x, unsigned y, unsigned picnum);
void LoadLatchMem (void);
boolean FizzleFade (unsigned source, unsigned dest,
unsigned width,unsigned height, unsigned frames,boolean abortable);
#define NUMLATCHPICS 100
extern unsigned latchpics[NUMLATCHPICS];
extern unsigned freelatch;
extern unsigned LatchMemFree;

110
ID_VH_A.ASM Normal file
View file

@ -0,0 +1,110 @@
; ID_VL.ASM
IDEAL
MODEL MEDIUM,C
INCLUDE 'ID_VL.EQU'
SCREENSEG = 0a000h
UPDATEWIDE = 20
UPDATEHIGH = 13
DATASEG
EXTRN bufferofs :WORD
EXTRN displayofs :WORD
EXTRN ylookup :WORD
EXTRN linewidth :WORD
EXTRN blockstarts :WORD ;offsets from drawofs for each update block
EXTRN update :BYTE
CODESEG
;=================
;
; VH_UpdateScreen
;
;=================
PROC VH_UpdateScreen
PUBLIC VH_UpdateScreen
USES si,di
mov dx,SC_INDEX
mov ax,SC_MAPMASK+15*256
out dx,ax
mov dx,GC_INDEX
mov al,GC_MODE
out dx,al
inc dx
in al,dx
and al,252
or al,1
out dx,al
mov bx,UPDATEWIDE*UPDATEHIGH-1 ; bx is the tile number
mov dx,[linewidth]
;
; see if the tile needs to be copied
;
@@checktile:
test [update+bx],1
jnz @@copytile
@@next:
dec bx
jns @@checktile
;
; done
;
mov dx,GC_INDEX+1
in al,dx
and al,NOT 3
or al,0
out dx,al
ret
;
; copy a tile
;
@@copytile:
mov [update+bx],0
shl bx,1
mov si,[blockstarts+bx]
shr bx,1
mov di,si
add si,[bufferofs]
add di,[displayofs]
mov ax,SCREENSEG
mov ds,ax
REPT 16
mov al,[si]
mov [di],al
mov al,[si+1]
mov [di+1],al
mov al,[si+2]
mov [di+2],al
mov al,[si+3]
mov [di+3],al
add si,dx
add di,dx
ENDM
mov ax,ss
mov ds,ax
jmp @@next
ENDP
END

1176
ID_VL.C Normal file

File diff suppressed because it is too large Load diff

58
ID_VL.EQU Normal file
View file

@ -0,0 +1,58 @@
; ID_VL.EQU
SC_INDEX = 03C4h
SC_RESET = 0
SC_CLOCK = 1
SC_MAPMASK = 2
SC_CHARMAP = 3
SC_MEMMODE = 4
CRTC_INDEX = 03D4h
CRTC_H_TOTAL = 0
CRTC_H_DISPEND = 1
CRTC_H_BLANK = 2
CRTC_H_ENDBLANK = 3
CRTC_H_RETRACE = 4
CRTC_H_ENDRETRACE = 5
CRTC_V_TOTAL = 6
CRTC_OVERFLOW = 7
CRTC_ROWSCAN = 8
CRTC_MAXSCANLINE = 9
CRTC_CURSORSTART = 10
CRTC_CURSOREND = 11
CRTC_STARTHIGH = 12
CRTC_STARTLOW = 13
CRTC_CURSORHIGH = 14
CRTC_CURSORLOW = 15
CRTC_V_RETRACE = 16
CRTC_V_ENDRETRACE = 17
CRTC_V_DISPEND = 18
CRTC_OFFSET = 19
CRTC_UNDERLINE = 20
CRTC_V_BLANK = 21
CRTC_V_ENDBLANK = 22
CRTC_MODE = 23
CRTC_LINECOMPARE = 24
GC_INDEX = 03CEh
GC_SETRESET = 0
GC_ENABLESETRESET = 1
GC_COLORCOMPARE = 2
GC_DATAROTATE = 3
GC_READMAP = 4
GC_MODE = 5
GC_MISCELLANEOUS = 6
GC_COLORDONTCARE = 7
GC_BITMASK = 8
ATR_INDEX = 03c0h
ATR_MODE = 16
ATR_OVERSCAN = 17
ATR_COLORPLANEENABLE = 18
ATR_PELPAN = 19
ATR_COLORSELECT = 20
STATUS_REGISTER_1 = 03dah

165
ID_VL.H Normal file
View file

@ -0,0 +1,165 @@
// ID_VL.H
// wolf compatability
#define MS_Quit Quit
void Quit (char *error,...);
//===========================================================================
#define SC_INDEX 0x3C4
#define SC_RESET 0
#define SC_CLOCK 1
#define SC_MAPMASK 2
#define SC_CHARMAP 3
#define SC_MEMMODE 4
#define CRTC_INDEX 0x3D4
#define CRTC_H_TOTAL 0
#define CRTC_H_DISPEND 1
#define CRTC_H_BLANK 2
#define CRTC_H_ENDBLANK 3
#define CRTC_H_RETRACE 4
#define CRTC_H_ENDRETRACE 5
#define CRTC_V_TOTAL 6
#define CRTC_OVERFLOW 7
#define CRTC_ROWSCAN 8
#define CRTC_MAXSCANLINE 9
#define CRTC_CURSORSTART 10
#define CRTC_CURSOREND 11
#define CRTC_STARTHIGH 12
#define CRTC_STARTLOW 13
#define CRTC_CURSORHIGH 14
#define CRTC_CURSORLOW 15
#define CRTC_V_RETRACE 16
#define CRTC_V_ENDRETRACE 17
#define CRTC_V_DISPEND 18
#define CRTC_OFFSET 19
#define CRTC_UNDERLINE 20
#define CRTC_V_BLANK 21
#define CRTC_V_ENDBLANK 22
#define CRTC_MODE 23
#define CRTC_LINECOMPARE 24
#define GC_INDEX 0x3CE
#define GC_SETRESET 0
#define GC_ENABLESETRESET 1
#define GC_COLORCOMPARE 2
#define GC_DATAROTATE 3
#define GC_READMAP 4
#define GC_MODE 5
#define GC_MISCELLANEOUS 6
#define GC_COLORDONTCARE 7
#define GC_BITMASK 8
#define ATR_INDEX 0x3c0
#define ATR_MODE 16
#define ATR_OVERSCAN 17
#define ATR_COLORPLANEENABLE 18
#define ATR_PELPAN 19
#define ATR_COLORSELECT 20
#define STATUS_REGISTER_1 0x3da
#define PEL_WRITE_ADR 0x3c8
#define PEL_READ_ADR 0x3c7
#define PEL_DATA 0x3c9
//===========================================================================
#define SCREENSEG 0xa000
#define NOFADE_CODE
#define SCREENWIDTH 80 // default screen width in bytes
#define MAXSCANLINES 200 // size of ylookup table
#define CHARWIDTH 2
#define TILEWIDTH 4
//===========================================================================
extern unsigned bufferofs; // all drawing is reletive to this
extern unsigned displayofs,pelpan; // last setscreen coordinates
extern unsigned screenseg; // set to 0xa000 for asm convenience
extern unsigned linewidth;
extern unsigned ylookup[MAXSCANLINES];
extern boolean screenfaded;
extern unsigned bordercolor;
//===========================================================================
//
// VGA hardware routines
//
#define VGAWRITEMODE(x) asm{\
cli;\
mov dx,GC_INDEX;\
mov al,GC_MODE;\
out dx,al;\
inc dx;\
in al,dx;\
and al,252;\
or al,x;\
out dx,al;\
sti;}
#define VGAMAPMASK(x) asm{cli;mov dx,SC_INDEX;mov al,SC_MAPMASK;mov ah,x;out dx,ax;sti;}
#define VGAREADMAP(x) asm{cli;mov dx,GC_INDEX;mov al,GC_READMAP;mov ah,x;out dx,ax;sti;}
void VL_Startup (void);
void VL_Shutdown (void);
void VL_SetVGAPlane (void);
void VL_SetTextMode (void);
void VL_DePlaneVGA (void);
void VL_SetVGAPlaneMode (void);
void VL_ClearVideo (byte color);
void VL_SetLineWidth (unsigned width);
void VL_SetSplitScreen (int linenum);
void WaitVBL (int vbls);
void VL_WaitVBL (int vbls);
void VL_CrtcStart (int crtc);
void VL_SetScreen (int crtc, int pelpan);
void VL_FillPalette (int red, int green, int blue);
void VL_SetColor (int color, int red, int green, int blue);
void VL_GetColor (int color, int *red, int *green, int *blue);
void VL_SetPalette (byte firstreg, unsigned numregs, byte far *palette);
void VL_GetPalette (byte firstreg, unsigned numregs, byte far *palette);
void VL_SetPaletteIntensity(int start, int end, byte far *palette, char intensity);
void VL_FadeOut (int start, int end, int red, int green, int blue, int steps);
void VL_FadeIn (int start, int end, byte far *palette, int steps);
void VL_ColorBorder (int color);
void VL_Plot (int x, int y, int color);
void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color);
void VL_Vlin (int x, int y, int height, int color);
void VL_Bar (int x, int y, int width, int height, int color);
void VL_MungePic (byte far *source, unsigned width, unsigned height);
void VL_DrawPicBare (int x, int y, byte far *pic, int width, int height);
void VL_MemToLatch (byte far *source, int width, int height, unsigned dest);
void VL_ScreenToScreen (unsigned source, unsigned dest,int width, int height);
void VL_MemToScreen (byte far *source, int width, int height, int x, int y);
void VL_MaskMemToScreen (byte far *source, int width, int height, int x, int y, byte mask);
void VL_ScreenToMem(byte far *dest, int width, int height, int x, int y);
void VL_DrawTile8String (char *str, char far *tile8ptr, int printx, int printy);
void VL_DrawLatch8String (char *str, unsigned tile8ptr, int printx, int printy);
void VL_SizeTile8String (char *str, int *width, int *height);
void VL_DrawPropString (char *str, unsigned tile8ptr, int printx, int printy);
void VL_SizePropString (char *str, int *width, int *height, char far *font);

851
ID_VL_A.ASM Normal file
View file

@ -0,0 +1,851 @@
; ID_VL.ASM
IDEAL
MODEL MEDIUM,C
INCLUDE 'ID_VL.EQU'
SCREENSEG = 0a000h
DATASEG
EXTRN TimeCount:WORD ; incremented every 70th of a second
EXTRN linewidth:WORD
starttime dw ?
CODESEG
;===========================================================================
IF 1
;
; WaitVBL
; Wait for the vertical retrace (returns before the actual vertical sync)
; By Jason Blochowiak
;
PROC VL_WaitVBL num:WORD
PUBLIC VL_WaitVBL
@@wait:
mov dx,STATUS_REGISTER_1
mov bl,8 ; test VBL
mov bh,1 ; test DE
@@waitno:
in al,dx
test al,bl ; VBL?
jnz @@waitno ; Yep, keep waiting
mov cx,400 ; for 320x200 mode (200 lines are double-scanned)
@@waityes:
in al,dx
test al,bl ; VBL?
jnz @@done ; Yep, we're done
test al,bh ; No. Display enabled?
jz @@waityes ; Yes, keep checking
@@waitenable:
in al,dx ; No, wait for Display not enabled or VBL
test al,bl ; VBL?
jnz @@done ; Yep, done
test al,bh ; No. Display enabled?
jnz @@waitenable ; No, keep waiting
dec cx ; DE toggled state - decrement line abort count
jnz @@waityes ; If 0, we missed the VBL, so drop out,
; otherwise, go back to waiting for the VBL
@@done:
dec [num] ; wait multiple VBLs?
jnz @@wait
ret
ENDP
ELSE
;==============
;
; VL_WaitVBL
;
; Wait for the vertical retrace (returns before the actual vertical sync)
;
;==============
PROC VL_WaitVBL num:WORD
PUBLIC VL_WaitVBL
@@wait:
mov cx,[TimeCount] ; if timecount goes up by two, the retrace
add cx,2 ; period was missed (an interrupt covered it)
mov dx,STATUS_REGISTER_1
;
; wait for a display signal to make sure the raster isn't in the middle
; of a sync
;
@@waitdisplay:
in al,dx
test al,1 ;1 = display is disabled (HBL / VBL)
jnz @@waitdisplay
@@loop:
sti
jmp $+2
cli
cmp [timecount],cx ; will only happen if an interrupt is
jae @@done ; straddling the entire retrace period
;
; when several succesive display not enableds occur,
; the bottom of the screen has been hit
;
in al,dx
test al,8
jnz @@waitdisplay
test al,1
jz @@loop
in al,dx
test al,8
jnz @@waitdisplay
test al,1
jz @@loop
in al,dx
test al,8
jnz @@waitdisplay
test al,1
jz @@loop
in al,dx
test al,8
jnz @@waitdisplay
test al,1
jz @@loop
in al,dx
test al,8
jnz @@waitdisplay
test al,1
jz @@loop
in al,dx
test al,8
jnz @@waitdisplay
test al,1
jz @@loop
in al,dx
test al,8
jnz @@waitdisplay
test al,1
jz @@loop
in al,dx
test al,8
jnz @@waitdisplay
test al,1
jz @@loop
@@done:
dec [num] ; wait multiple VBLs?
jnz @@wait
sti
ret
ENDP
ENDIF
;===========================================================================
;==============
;
; VL_SetCRTC
;
;==============
PROC VL_SetCRTC crtc:WORD
PUBLIC VL_SetCRTC
;
; wait for a display signal to make sure the raster isn't in the middle
; of a sync
;
cli
mov dx,STATUS_REGISTER_1
@@waitdisplay:
in al,dx
test al,1 ;1 = display is disabled (HBL / VBL)
jnz @@waitdisplay
;
; set CRTC start
;
; for some reason, my XT's EGA card doesn't like word outs to the CRTC
; index...
;
mov cx,[crtc]
mov dx,CRTC_INDEX
mov al,0ch ;start address high register
out dx,al
inc dx
mov al,ch
out dx,al
dec dx
mov al,0dh ;start address low register
out dx,al
mov al,cl
inc dx
out dx,al
sti
ret
ENDP
;===========================================================================
;==============
;
; VL_SetScreen
;
;==============
PROC VL_SetScreen crtc:WORD, pel:WORD
PUBLIC VL_SetScreen
mov cx,[timecount] ; if timecount goes up by two, the retrace
add cx,2 ; period was missed (an interrupt covered it)
mov dx,STATUS_REGISTER_1
;
; wait for a display signal to make sure the raster isn't in the middle
; of a sync
;
@@waitdisplay:
in al,dx
test al,1 ;1 = display is disabled (HBL / VBL)
jnz @@waitdisplay
@@loop:
sti
jmp $+2
cli
cmp [timecount],cx ; will only happen if an interrupt is
jae @@setcrtc ; straddling the entire retrace period
;
; when several succesive display not enableds occur,
; the bottom of the screen has been hit
;
in al,dx
test al,8
jnz @@waitdisplay
test al,1
jz @@loop
in al,dx
test al,8
jnz @@waitdisplay
test al,1
jz @@loop
in al,dx
test al,8
jnz @@waitdisplay
test al,1
jz @@loop
in al,dx
test al,8
jnz @@waitdisplay
test al,1
jz @@loop
in al,dx
test al,8
jnz @@waitdisplay
test al,1
jz @@loop
@@setcrtc:
;
; set CRTC start
;
; for some reason, my XT's EGA card doesn't like word outs to the CRTC
; index...
;
mov cx,[crtc]
mov dx,CRTC_INDEX
mov al,0ch ;start address high register
out dx,al
inc dx
mov al,ch
out dx,al
dec dx
mov al,0dh ;start address low register
out dx,al
mov al,cl
inc dx
out dx,al
;
; set horizontal panning
;
mov dx,ATR_INDEX
mov al,ATR_PELPAN or 20h
out dx,al
jmp $+2
mov al,[BYTE pel] ;pel pan value
out dx,al
sti
ret
ENDP
;===========================================================================
;============================================================================
;
; VL_ScreenToScreen
;
; Basic block copy routine. Copies one block of screen memory to another,
; using write mode 1 (sets it and returns with write mode 0). bufferofs is
; NOT accounted for.
;
;============================================================================
PROC VL_ScreenToScreen source:WORD, dest:WORD, wide:WORD, height:WORD
PUBLIC VL_ScreenToScreen
USES SI,DI
pushf
cli
mov dx,SC_INDEX
mov ax,SC_MAPMASK+15*256
out dx,ax
mov dx,GC_INDEX
mov al,GC_MODE
out dx,al
inc dx
in al,dx
and al,NOT 3
or al,1
out dx,al
popf
mov bx,[linewidth]
sub bx,[wide]
mov ax,SCREENSEG
mov es,ax
mov ds,ax
mov si,[source]
mov di,[dest] ;start at same place in all planes
mov dx,[height] ;scan lines to draw
mov ax,[wide]
@@lineloop:
mov cx,ax
rep movsb
add si,bx
add di,bx
dec dx
jnz @@lineloop
mov dx,GC_INDEX+1
in al,dx
and al,NOT 3
out dx,al
mov ax,ss
mov ds,ax ;restore turbo's data segment
ret
ENDP
;===========================================================================
MASM
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
;
; Name: VL_VideoID
;
; Function: Detects the presence of various video subsystems
;
; int VideoID;
;
; Subsystem ID values:
; 0 = (none)
; 1 = MDA
; 2 = CGA
; 3 = EGA
; 4 = MCGA
; 5 = VGA
; 80h = HGC
; 81h = HGC+
; 82h = Hercules InColor
;
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
;
; Equates
;
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
VIDstruct STRUC ; corresponds to C data structure
Video0Type DB ? ; first subsystem type
Display0Type DB ? ; display attached to first subsystem
Video1Type DB ? ; second subsystem type
Display1Type DB ? ; display attached to second subsystem
VIDstruct ENDS
Device0 EQU word ptr Video0Type[di]
Device1 EQU word ptr Video1Type[di]
MDA EQU 1 ; subsystem types
CGA EQU 2
EGA EQU 3
MCGA EQU 4
VGA EQU 5
HGC EQU 80h
HGCPlus EQU 81h
InColor EQU 82h
MDADisplay EQU 1 ; display types
CGADisplay EQU 2
EGAColorDisplay EQU 3
PS2MonoDisplay EQU 4
PS2ColorDisplay EQU 5
TRUE EQU 1
FALSE EQU 0
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
;
; Program
;
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
Results VIDstruct <> ;results go here!
EGADisplays DB CGADisplay ; 0000b, 0001b (EGA switch values)
DB EGAColorDisplay ; 0010b, 0011b
DB MDADisplay ; 0100b, 0101b
DB CGADisplay ; 0110b, 0111b
DB EGAColorDisplay ; 1000b, 1001b
DB MDADisplay ; 1010b, 1011b
DCCtable DB 0,0 ; translate table for INT 10h func 1Ah
DB MDA,MDADisplay
DB CGA,CGADisplay
DB 0,0
DB EGA,EGAColorDisplay
DB EGA,MDADisplay
DB 0,0
DB VGA,PS2MonoDisplay
DB VGA,PS2ColorDisplay
DB 0,0
DB MCGA,EGAColorDisplay
DB MCGA,PS2MonoDisplay
DB MCGA,PS2ColorDisplay
TestSequence DB TRUE ; this list of flags and addresses
DW FindPS2 ; determines the order in which this
; program looks for the various
EGAflag DB ? ; subsystems
DW FindEGA
CGAflag DB ?
DW FindCGA
Monoflag DB ?
DW FindMono
NumberOfTests EQU ($-TestSequence)/3
PUBLIC VL_VideoID
VL_VideoID PROC
push bp ; preserve caller registers
mov bp,sp
push ds
push si
push di
push cs
pop ds
ASSUME DS:@Code
; initialize the data structure that will contain the results
lea di,Results ; DS:DI -> start of data structure
mov Device0,0 ; zero these variables
mov Device1,0
; look for the various subsystems using the subroutines whose addresses are
; tabulated in TestSequence; each subroutine sets flags in TestSequence
; to indicate whether subsequent subroutines need to be called
mov byte ptr CGAflag,TRUE
mov byte ptr EGAflag,TRUE
mov byte ptr Monoflag,TRUE
mov cx,NumberOfTests
mov si,offset TestSequence
@@L01: lodsb ; AL := flag
test al,al
lodsw ; AX := subroutine address
jz @@L02 ; skip subroutine if flag is false
push si
push cx
call ax ; call subroutine to detect subsystem
pop cx
pop si
@@L02: loop @@L01
; determine which subsystem is active
call FindActive
mov al,Results.Video0Type
mov ah,0 ; was: Results.Display0Type
pop di ; restore caller registers and return
pop si
pop ds
mov sp,bp
pop bp
ret
VL_VideoID ENDP
;
; FindPS2
;
; This subroutine uses INT 10H function 1Ah to determine the video BIOS
; Display Combination Code (DCC) for each video subsystem present.
;
FindPS2 PROC near
mov ax,1A00h
int 10h ; call video BIOS for info
cmp al,1Ah
jne @@L13 ; exit if function not supported (i.e.,
; no MCGA or VGA in system)
; convert BIOS DCCs into specific subsystems & displays
mov cx,bx
xor bh,bh ; BX := DCC for active subsystem
or ch,ch
jz @@L11 ; jump if only one subsystem present
mov bl,ch ; BX := inactive DCC
add bx,bx
mov ax,[bx+offset DCCtable]
mov Device1,ax
mov bl,cl
xor bh,bh ; BX := active DCC
@@L11: add bx,bx
mov ax,[bx+offset DCCtable]
mov Device0,ax
; reset flags for subsystems that have been ruled out
mov byte ptr CGAflag,FALSE
mov byte ptr EGAflag,FALSE
mov byte ptr Monoflag,FALSE
lea bx,Video0Type[di] ; if the BIOS reported an MDA ...
cmp byte ptr [bx],MDA
je @@L12
lea bx,Video1Type[di]
cmp byte ptr [bx],MDA
jne @@L13
@@L12: mov word ptr [bx],0 ; ... Hercules can't be ruled out
mov byte ptr Monoflag,TRUE
@@L13: ret
FindPS2 ENDP
;
; FindEGA
;
; Look for an EGA. This is done by making a call to an EGA BIOS function
; which doesn't exist in the default (MDA, CGA) BIOS.
FindEGA PROC near ; Caller: AH = flags
; Returns: AH = flags
; Video0Type and
; Display0Type updated
mov bl,10h ; BL := 10h (return EGA info)
mov ah,12h ; AH := INT 10H function number
int 10h ; call EGA BIOS for info
; if EGA BIOS is present,
; BL <> 10H
; CL = switch setting
cmp bl,10h
je @@L22 ; jump if EGA BIOS not present
mov al,cl
shr al,1 ; AL := switches/2
mov bx,offset EGADisplays
xlat ; determine display type from switches
mov ah,al ; AH := display type
mov al,EGA ; AL := subystem type
call FoundDevice
cmp ah,MDADisplay
je @@L21 ; jump if EGA has a monochrome display
mov CGAflag,FALSE ; no CGA if EGA has color display
jmp short @@L22
@@L21: mov Monoflag,FALSE ; EGA has a mono display, so MDA and
; Hercules are ruled out
@@L22: ret
FindEGA ENDP
;
; FindCGA
;
; This is done by looking for the CGA's 6845 CRTC at I/O port 3D4H.
;
FindCGA PROC near ; Returns: VIDstruct updated
mov dx,3D4h ; DX := CRTC address port
call Find6845
jc @@L31 ; jump if not present
mov al,CGA
mov ah,CGADisplay
call FoundDevice
@@L31: ret
FindCGA ENDP
;
; FindMono
;
; This is done by looking for the MDA's 6845 CRTC at I/O port 3B4H. If
; a 6845 is found, the subroutine distinguishes between an MDA
; and a Hercules adapter by monitoring bit 7 of the CRT Status byte.
; This bit changes on Hercules adapters but does not change on an MDA.
;
; The various Hercules adapters are identified by bits 4 through 6 of
; the CRT Status value:
;
; 000b = HGC
; 001b = HGC+
; 101b = InColor card
;
FindMono PROC near ; Returns: VIDstruct updated
mov dx,3B4h ; DX := CRTC address port
call Find6845
jc @@L44 ; jump if not present
mov dl,0BAh ; DX := 3BAh (status port)
in al,dx
and al,80h
mov ah,al ; AH := bit 7 (vertical sync on HGC)
mov cx,8000h ; do this 32768 times
@@L41: in al,dx
and al,80h ; isolate bit 7
cmp ah,al
loope @@L41 ; wait for bit 7 to change
jne @@L42 ; if bit 7 changed, it's a Hercules
mov al,MDA ; if bit 7 didn't change, it's an MDA
mov ah,MDADisplay
call FoundDevice
jmp short @@L44
@@L42: in al,dx
mov dl,al ; DL := value from status port
and dl,01110000b ; mask bits 4 thru 6
mov ah,MDADisplay ; assume it's a monochrome display
mov al,HGCPlus ; look for an HGC+
cmp dl,00010000b
je @@L43 ; jump if it's an HGC+
mov al,HGC ; look for an InColor card or HGC
cmp dl,01010000b
jne @@L43 ; jump if it's not an InColor card
mov al,InColor ; it's an InColor card
mov ah,EGAColorDisplay
@@L43: call FoundDevice
@@L44: ret
FindMono ENDP
;
; Find6845
;
; This routine detects the presence of the CRTC on a MDA, CGA or HGC.
; The technique is to write and read register 0Fh of the chip (cursor
; low). If the same value is read as written, assume the chip is
; present at the specified port addr.
;
Find6845 PROC near ; Caller: DX = port addr
; Returns: cf set if not present
mov al,0Fh
out dx,al ; select 6845 reg 0Fh (Cursor Low)
inc dx
in al,dx ; AL := current Cursor Low value
mov ah,al ; preserve in AH
mov al,66h ; AL := arbitrary value
out dx,al ; try to write to 6845
mov cx,100h
@@L51: loop @@L51 ; wait for 6845 to respond
in al,dx
xchg ah,al ; AH := returned value
; AL := original value
out dx,al ; restore original value
cmp ah,66h ; test whether 6845 responded
je @@L52 ; jump if it did (cf is reset)
stc ; set carry flag if no 6845 present
@@L52: ret
Find6845 ENDP
;
; FindActive
;
; This subroutine stores the currently active device as Device0. The
; current video mode determines which subsystem is active.
;
FindActive PROC near
cmp word ptr Device1,0
je @@L63 ; exit if only one subsystem
cmp Video0Type[di],4 ; exit if MCGA or VGA present
jge @@L63 ; (INT 10H function 1AH
cmp Video1Type[di],4 ; already did the work)
jge @@L63
mov ah,0Fh
int 10h ; AL := current BIOS video mode
and al,7
cmp al,7 ; jump if monochrome
je @@L61 ; (mode 7 or 0Fh)
cmp Display0Type[di],MDADisplay
jne @@L63 ; exit if Display0 is color
jmp short @@L62
@@L61: cmp Display0Type[di],MDADisplay
je @@L63 ; exit if Display0 is monochrome
@@L62: mov ax,Device0 ; make Device0 currently active
xchg ax,Device1
mov Device0,ax
@@L63: ret
FindActive ENDP
;
; FoundDevice
;
; This routine updates the list of subsystems.
;
FoundDevice PROC near ; Caller: AH = display #
; AL = subsystem #
; Destroys: BX
lea bx,Video0Type[di]
cmp byte ptr [bx],0
je @@L71 ; jump if 1st subsystem
lea bx,Video1Type[di] ; must be 2nd subsystem
@@L71: mov [bx],ax ; update list entry
ret
FoundDevice ENDP
IDEAL
END

98
JABHACK.ASM Normal file
View file

@ -0,0 +1,98 @@
; JABHACK.ASM
.386C
IDEAL
MODEL MEDIUM
EXTRN LDIV@:far
;============================================================================
DATASEG
EXTRN _intaddr:word
;============================================================================
CODESEG
; Hacked up Juan Jimenez's code a bit to just return 386/not 386
PROC _CheckIs386
PUBLIC _CheckIs386
pushf ; Save flag registers, we use them here
xor ax,ax ; Clear AX and...
push ax ; ...push it onto the stack
popf ; Pop 0 into flag registers (all bits to 0),
pushf ; attempting to set bits 12-15 of flags to 0's
pop ax ; Recover the save flags
and ax,08000h ; If bits 12-15 of flags are set to
cmp ax,08000h ; zero then it's 8088/86 or 80188/186
jz not386
mov ax,07000h ; Try to set flag bits 12-14 to 1's
push ax ; Push the test value onto the stack
popf ; Pop it into the flag register
pushf ; Push it back onto the stack
pop ax ; Pop it into AX for check
and ax,07000h ; if bits 12-14 are cleared then
jz not386 ; the chip is an 80286
mov ax,1 ; We now assume it's a 80386 or better
popf
retf
not386:
xor ax,ax
popf
retf
ENDP
PROC _jabhack2
PUBLIC _jabhack2
jmp @@skip
@@where:
int 060h
retf
@@skip:
push es
mov ax,seg LDIV@
mov es,ax
mov ax,[WORD PTR @@where]
mov [WORD FAR es:LDIV@],ax
mov ax,[WORD PTR @@where+2]
mov [WORD FAR es:LDIV@+2],ax
mov ax,offset @@jabdiv
mov [_intaddr],ax
mov ax,seg @@jabdiv
mov [_intaddr+2],ax
pop es
retf
@@jabdiv:
add sp,4 ;Nuke IRET address, but leave flags
push bp
mov bp,sp ;Save BP, and set it equal to stack
cli
mov eax,[bp+8]
cdq
idiv [DWORD PTR bp+12]
mov edx,eax
shr edx,16
pop bp ;Restore BP
popf ;Restore flags (from INT)
retf 8 ;Return to original caller
ENDP
END

92
JAM_IO.H Normal file
View file

@ -0,0 +1,92 @@
//
// UNIT : JAM_IO.h
//
// FUNCTION : General defines, prototypes, typedefs used in all the
// supported compression techniques used in JAMPAK Ver x.x
//
//
#ifndef _ID_HEADS_H_
typedef enum boolean {false,true} boolean;
#endif
//==========================================================================
//
// PARAMETER PASSING TYPES
//
//
// SOURCE PARAMS (LO BYTE)
#define SRC_FILE (0x0001) // GE Buffered IO
#define SRC_FFILE (0x0002) // Stdio File IO (fwrite etc.)
#define SRC_MEM (0x0004) // Std void ptr (alloc etc)
#define SRC_BFILE (0x0008) // Buffered File I/O
#define SRC_TYPES (SRC_FILE | SRC_FFILE | SRC_MEM | SRC_BFILE)
// DESTINATION PARAMS (HI BYTE)
#define DEST_FILE (0x0100) // GE Buffered IO
#define DEST_FFILE (0x0200) // Stdio File IO (fwrite etc.)
#define DEST_MEM (0x0400) // Std void ptr (alloc etc)
#define DEST_IMEM (0x0800) // ID Memory alloc
#define DEST_TYPES (DEST_FILE | DEST_FFILE | DEST_MEM | DEST_IMEM)
//=========================================================================
//
// FILE CHUNK IDs
//
// NOTE: The only reason for changing from COMP to CMP1 and having multi
// comp header structs is for downward compatablity.
//
#define COMP ("COMP") // Comp type is ct_LZW ALWAYS!
#define JAMP ("JAMP") // New Version different from SOFTDISK.
//
// COMPRESSION TYPES
//
typedef enum ct_TYPES
{
ct_NONE = 0, // No compression - Just data..Rarely used!
ct_LZW, // LZW data compression
ct_LZH,
} ct_TYPES;
//
// FILE CHUNK HEADER FORMATS
//
struct COMPStruct
{
unsigned long DecompLen;
};
struct JAMPHeader
{
unsigned long OrginalLen; // Orginal FileLength of compressed Data.
ct_TYPES CompType; // SEE: ct_TYPES above for list of pos.
unsigned long CompressLen; // Length of data after compression (A MUST for LZHUFF!)
};
//---------------------------------------------------------------------------
//
// FUNCTION PROTOTYPEING
//
//---------------------------------------------------------------------------
char WritePtr(long outfile, unsigned char data, unsigned PtrType);
int ReadPtr(long infile, unsigned PtrType);

103
JM_CIO.C Normal file
View file

@ -0,0 +1,103 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <alloc.h>
#include <fcntl.h>
#include <dos.h>
#include <io.h>
#include "jm_cio.h"
//----------------------------------------------------------------------------
//
// PTR/PTR COMPRESSION ROUTINES
//
//
//----------------------------------------------------------------------------
//---------------------------------------------------------------------------
// CIO_WritePtr() -- Outputs data to a particular ptr type
//
// PtrType MUST be of type DEST_TYPE.
//
// NOTE : For PtrTypes DEST_MEM a ZERO (0) is always returned.
//
//---------------------------------------------------------------------------
char CIO_WritePtr(long outfile, unsigned char data, unsigned PtrType)
{
int returnval = 0;
switch (PtrType & DEST_TYPES)
{
case DEST_FILE:
write(*(int far *)outfile,(char *)&data,1);
break;
case DEST_FFILE:
returnval = putc(data, *(FILE **)outfile);
break;
case DEST_IMEM:
printf("CIO_WritePtr - unsupported ptr type\n");
exit(0);
break;
case DEST_MEM:
*((char far *)*(char far **)outfile)++ = data;
break;
}
return(returnval);
}
//---------------------------------------------------------------------------
// CIO_ReadPtr() -- Reads data from a particular ptr type
//
// PtrType MUST be of type SRC_TYPE.
//
// RETURNS :
// The char read in or EOF for SRC_FFILE type of reads.
//
//
//---------------------------------------------------------------------------
int CIO_ReadPtr(long infile, unsigned PtrType)
{
int returnval = 0;
switch (PtrType & SRC_TYPES)
{
case SRC_FILE:
read(*(int far *)infile,(char *)&returnval,1);
break;
case SRC_FFILE:
returnval = getc(*(FILE **)infile);
break;
#if 0
case SRC_BFILE:
returnval = bio_readch((BufferedIO *)*(void far **)infile);
break;
#endif
// case SRC_IMEM:
// printf("CIO_WritePtr - unsupported ptr type\n");
// exit(0);
// break;
case SRC_MEM:
returnval = (unsigned char)*((char far *)*(char far **)infile)++;
break;
}
return(returnval);
}

108
JM_CIO.H Normal file
View file

@ -0,0 +1,108 @@
#ifndef _JM_CIO_H_
#define _JM_CIO_H_
//
// UNIT : JM_CIO.h
//
// FUNCTION : General defines, prototypes, typedefs used in all the
// supported compression techniques used in JAMPAK Ver x.x
//
//
#ifndef _ID_HEADS_H_
typedef enum boolean {false,true} boolean;
#endif
//==========================================================================
//
// PARAMETER PASSING TYPES
//
//
// SOURCE PARAMS (LO BYTE)
#define SRC_FILE (0x0001) // GE Buffered IO
#define SRC_FFILE (0x0002) // Stdio File IO (fwrite etc.)
#define SRC_MEM (0x0004) // Std void ptr (alloc etc)
#define SRC_BFILE (0x0008) // Buffered File I/O
#define SRC_TYPES (SRC_FILE | SRC_FFILE | SRC_MEM | SRC_BFILE)
// DESTINATION PARAMS (HI BYTE)
#define DEST_FILE (0x0100) // GE Buffered IO
#define DEST_FFILE (0x0200) // Stdio File IO (fwrite etc.)
#define DEST_MEM (0x0400) // Std void ptr (alloc etc)
#define DEST_IMEM (0x0800) // ID Memory alloc
#define DEST_TYPES (DEST_FILE | DEST_FFILE | DEST_MEM | DEST_IMEM)
//=========================================================================
//
// FILE CHUNK IDs
//
// NOTE: The only reason for changing from COMP to CMP1 and having multi
// comp header structs is for downward compatablity.
//
#define COMP ("COMP") // Comp type is ct_LZW ALWAYS!
#define JAMP ("JAMP") // New Version different from SOFTDISK.
//
// COMPRESSION TYPES
//
typedef enum ct_TYPES
{
ct_NONE = 0, // No compression - Just data..Rarely used!
ct_LZW, // LZW data compression
ct_LZH,
} ct_TYPES;
//
// FILE CHUNK HEADER FORMATS
//
struct COMPStruct
{
unsigned long DecompLen;
};
struct JAMPHeader
{
unsigned long OriginalLen; // Original FileLength of compressed Data.
ct_TYPES CompType; // SEE: ct_TYPES above for list of pos.
unsigned long CompressLen; // Length of data after compression (A MUST for LZHUFF!)
};
//
// Header on JAMPAKd Data
//
typedef struct
{
char NameId[4];
unsigned long OriginalLen; // Original FileLength of compressed Data.
ct_TYPES CompType; // SEE: ct_TYPES above for list of pos.
unsigned long CompressLen; // Length of data after compression (A MUST for LZHUFF!)
} CompHeader_t;
//---------------------------------------------------------------------------
//
// FUNCTION PROTOTYPEING
//
//---------------------------------------------------------------------------
char CIO_WritePtr(long outfile, unsigned char data, unsigned PtrType);
int CIO_ReadPtr(long infile, unsigned PtrType);
#endif

84
JM_DEBUG.C Normal file
View file

@ -0,0 +1,84 @@
#include "3D_DEF.H"
#include "jm_error.h"
#include "jm_debug.h"
#pragma hdrstop
#ifdef __MPRINTF__
static char x=0;
static char y=0;
static char far *video = MK_FP(0xb000,0x0000);
//-------------------------------------------------------------------------
// mclear()
//-------------------------------------------------------------------------
void mclear(void)
{
short length = 80*25*2;
video = MK_FP(0xb000,0x0000);
while (length--)
*(short *)video++ = 0x0f20;
x=y=0;
video = MK_FP(0xb000,0x0000);
}
//-------------------------------------------------------------------------
// mprintf()
//-------------------------------------------------------------------------
void mprintf(char *msg, ...)
{
char buffer[100],*ptr;
va_list(ap);
va_start(ap,msg);
vsprintf(buffer,msg,ap);
ptr = buffer;
while (*ptr)
{
switch (*ptr)
{
case '\n':
if (y >= 23)
{
video -= (x<<1);
_fmemcpy(MK_FP(0xb000,0x0000),MK_FP(0xb000,0x00a0),3840);
}
else
{
y++;
video += ((80-x)<<1);
}
x=0;
break;
default:
*video = *ptr;
video[1] = 15;
video += 2;
x++;
break;
}
ptr++;
}
va_end(ap);
}
//-------------------------------------------------------------------------
// fmprint()
//-------------------------------------------------------------------------
void fmprint(char far *text)
{
while (*text)
mprintf("%c",*text++);
}
#endif

24
JM_DEBUG.H Normal file
View file

@ -0,0 +1,24 @@
#ifndef _JM_DEBUG_H_
#define _JM_DEBUG_H_
//-------------------------------------------------------------------------
// defines
//-------------------------------------------------------------------------
#if IN_DEVELOPMENT
#define __MPRINTF__
#endif
//-------------------------------------------------------------------------
// typedefs
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// Function prototypes
//-------------------------------------------------------------------------
void mclear(void);
void mprintf(char *msg, ...);
void fmprint(char far *text);
#endif

283
JM_ERROR.H Normal file
View file

@ -0,0 +1,283 @@
#ifndef _JM_ERROR_H_
#define _JM_ERROR_H_
enum ERROR_Units {
JM_IO_ERROR=0x01, // JAM Units
JM_TP_ERROR,
JM_AN_ERROR,
D3_MAIN_ERROR=0x81, // ID Units
D3_STATE_ERROR,
D3_ACT1_ERROR,
D3_ACT2_ERROR,
D3_GAME_ERROR,
D3_AGENT_ERROR,
D3_SCALE_ERROR,
ID_US1_ERROR,
D3_PLAY_ERROR,
D3_DEBUG_ERROR,
ID_IN_ERROR,
ID_VL_ERROR,
ID_VH_ERROR,
ID_CA_ERROR,
ID_PM_ERROR,
ID_MM_ERROR,
ID_SD_ERROR,
DRAW2_ERROR,
MENU_ERROR,
};
enum ERROR_Msgs {
// UNIT: JM_IO
//
IO_LOADFILE_NO_LZW=0x01, // No code for LZW compression.
IO_LOADFILE_UNKNOWN, // Unknown compression type.
IO_COPYFILE_OPEN_SRC, // IO_CopyFile(): Error opening source file.
IO_COPYFILE_OPEN_DEST, // IO_COpyFile(): Error opening destination file.
// UNIT: JM_TP
//
TP_PRESENTER_EP_RECURSE=0x01, // Use of ^EP when recursing.
TP_PRESENTER_LONG_TEXT, // String too long to print.
TP_CACHEPAGE_ANIM_OF, // Too many anims on one page.
TP_INITSCRIPT_PAGES_OF, // Too many pages in presenter.
TP_DISPLAY_STR_NUM_BAD, // String number exceeds max array size.
TP_CANT_FIND_XX_TERMINATOR, // Can't find the ^XX doc terminator string.
// UNIT: JM_AN
//
AN_BAD_ANIM_FILE=0x01, // Animation file is corrupt or truncated.
HANDLEPAGE_BAD_CODE, // Unrecognized anim code.
AN_SHOW_FRAME_NULL, // MOVIE_ShowFrame() was passed a NULL ptr
// UNIT: 3D_MAIN
//
READINFO_BAD_DECOMP=0x01, // Bad decompression during game load.
WRITEINFO_BIGGER_BUF, // Save game compression buffer too small.
SAVELEVEL_DISKERR, // Disk error while changing levels.
CHECKDISK_GDFREE, // Error in _dos_getdiskfree call.
INITACCESS_NOFILE, // Error loading 'ACCESS.xxx' file.
PREDEMO_NOJAM, // JAM animation (IANIM.BSx) does not exist.
INITPLAYTEMP_OPEN_ERR, // InitPlaytemp(): Error opening PLAYTEMP file.
CHECK_FILENAME_TOO_LONG, // CheckValidity(): Filename is too long.
// UNIT: 3D_STATE
//
TRYWALK_BAD_DIR=0x01, // Illegal direction passed.
MOVEOBJ_BAD_DIR, // Illegal direction passed.
SIGHTPLAYER_IN_ATKMODE, // Actor is in ATTACKMODE.
// UNIT: 3D_ACT1
//
SPAWNSTATIC_TOO_MANY=0x01, // Too many static objects.
PLACEITEMTYPE_NO_TYPE, // Couldn't find type.
SPAWNDOOR_TOO_MANY, // Too many doors in level.
SPAWNCONCESSION_TOO_MANY, // Too many concession machines in level.
UNRECOGNIZED_CON_CODE, // Concession Code (Upper Byte) is unrecognized (Hint Or Food PAL!)
INVALID_CACHE_MSG_NUM, // Invalid 'Cached Message' number
HINT_BUFFER_OVERFLOW, // Cached Hint Message is to Long for allocated space
CACHEMSG_TOO_MANY, // Too many messages in current level.
LINKAREA_BAD_LINK, // Invalid linkable area.
CHECKLINKED_BAD_LINK, // Linked door is linked to a non-door.
SPAWNCON_CACHE_MSG_OVERFLOW, // Too many 'cached msgs' loaded. (CONCESSIONS)
TRANSFORM_AREA1_OUT_OF_RANGE, // Area1 out of table range.
TRANSFORM_AREA2_OUT_OF_RANGE, // Area2 out of table range.
SPAWNSTATIC_ON_WALL, // Static spawned on a wall.
NO_DOORBOMB_SPARES, // Could not find Fision/Plasma Detonator reserve object.
CANT_FIND_LEVELCOMPUTER, // Cound not find level computer - Need to have one pal!
CANT_FIND_RESERVE_STATIC, // Count not find a reserved static at location 0,0 with shape num == 1
// UNIT: 3D_ACT2
//
T_PATH_HIT_WALL=0x01, // Actor walked out of map.
TOGGLE_BARRIER_NULL, // ToggleBarrier() was passed a NULL ptr!
TOGGLE_NON_BARRIER, // ToggleBarrier() was passed a non-barrier object pointer! Oh...Gubs!
BAD_BARRIER_THINK, // barrier is ON but thinking using T_BarrierTransistion!
ACTOR_ON_WALL, // An actor has been spawned on an invalid area number
TOO_MANY_DETONATORS, // Too many Fission/Plasma Detonators are placed in this map! You can only have one!
CANT_FIND_HIDDEN_OBJ, // Unable to find a "Hidden Actor" at location 0,0
SWITCH_DOES_NOT_MATCH, // Barrier ON/OFF Switch does not match the connecting barrier object.
// UNIT: 3D_GAME
//
SETUPGAME_BAD_MAP_SIZE=0x01, // Map not 64 x 64.
SETUPGAME_MAX_EA_WALLS, // Too many Electro-Alien walls in level.
SETUPGAME_MAX_GOLDIE_SPAWNS, // Too many Dr. Goldfire Spawn sites in level.
SCANINFO_CACHE_MSG_OVERFLOW, // Too many 'cached msgs' loaded. (INFORMANTS)
SCANINFO_INVALID_ACTOR, // Invalid actor in shareware version!
NO_SPACE_ANIM, // SPACE Animation file (SANIM.BSx) does not exist.
NO_GROUND_ANIM, // GROUND Animation file (GANIM.BSx) does not exists.
CEILING_TILE_OUT_OF_RANGE, // CEILING TILE/TEXTURE IS OUT OF RANGE
FLOOR_TILE_OUT_OF_RANGE, // FLOOR TILE/TEXTURE IS OUT OF RANGE
TOO_MANY_FAST_GOLD_SPAWNS, // Too many FAST Goldfire spawn sites in map.
UNSUPPORTED_BARRIER_LINK, // Barrier Link has a NON 0xF8FF value - No longer supported in retail!
NO_DETONATORS_IN_LEVEL, // No Fision/Plasma Detonator in level! - Go put one in the map PAL!
// UNIT: 3D_AGENT
//
INTERROGATE_LONG_MSG=0x01, // Interrogation message too long.
BAD_TERMINAL_MSG_NUM, // Bad Cached Terminal Message number
SWITCH_TABLE_OVERFLOW, // Too many DIFFERENT(coords) barriers hooked up to switches
UPDATE_SWITCH_BAD_LEVEL, // Bad level number passed to UpdateBarrierTable
GETAREANUMBER_ON_WALL, // Can't GetAreaNumber() of object on wall!
BAD_SMART_TRIGGER_PTR, // A Smart Floor Trigger points to nothing!
INVALID_SMART_SWITCH_LINK, // A Smart floor trigger points to a non-supported actor
BARRIER_SWITCH_NOT_CONNECTED, // A barrier switch was not connect to any barriers.
NORMAL_SHADE_TOO_BIG, // Shade Div (normalshade) TOO large! Must be 1-12!
SHADEMAX_VALUE_BAD, // Shade Max (shademax) Value BAD! Must be 5-63!
// UNIT: 3D_SCALE
//
BADSCALE_ERROR=0x01, // Bad scale called.
// UNIT: ID_US_1
//
US_CPRINTLINE_WIDTH=0x01, // String exceeds width.
// UNIT: 3D_PLAY
//
POLLCONTROLS_DEMO_OV=0x01, // Demo buffer overflowed.
GETNEWACTOR_NO_FREE_SPOTS, // No free spots in objlist.
REMOVEOBJ_REMOVED_PLAYER, // Tried to remove the player.
// UNIT: 3D_DEBUG
//
// UNIT: ID_IN
//
IN_READCONTROL_PLAY_EXC=0x01, // Demo playback exceeded.
IN_READCONTROL_BUF_OV, // Demo buffer overflow.
// UNIT: ID_VL
//
VL_MUNGEPIC_NO_DIV_FOUR=0x01, // Not divisible by 4.
// UNIT: ID_VH
//
// UNIT: ID_CA
//
CA_SETUPAUDIO_CANT_OPEN=0x01, // Can't open audio file.
CA_UPLEVEL_PAST_MAX, // Up past level 7.
CA_DOWNLEVEL_PAST_MIN, // Down past level 0.
// UNIT: ID_PM
//
PML_MAPEMS_MAPPING_FAIL=0x01, // Page mapping failed.
PML_SHUTDOWNEMS_FREE, // Error freeing EMS.
PML_XMSCOPY_ZERO_ADRS, // Zero address.
PML_XMSCOPY_COPY_ERROR, // Error on copy.
PML_SHUTDOWNXMS_FREE, // Error freeing XMS.
PML_STARTUPMAINMEM_LOW, // Not enough main memory.
PML_READFROMFILE_NULL, // Null pointer.
PML_READFROMFILE_ZERO, // Zero offset.
PML_READFROMFILE_SEEK, // Seek failed.
PML_READFROMFILE_READ, // Read failed.
PML_OPENPAGEFILE_OPEN, // Unable to open page file.
PML_OPENPAGEFILE_OFF, // Offset read failed.
PML_OPENPAGEFILE_LEN, // Length read failed.
PML_GETEMSADDRESS_FIND, // EMS find failed.
PML_GIVELRUPAGE_SEARCH, // LRU search failed.
PML_PUTPAGEINXMS_NO_LRU, // No XMS LRU.
PML_TRANSFERPAGE_IDENT, // Identity replacement.
PML_TRANSFERPAGE_KILL, // Killing locked page.
PML_TRANSFERPAGE_REUSE, // Reusing non-existent page.
PML_TRANSFERPAGE_ZERO, // Zero replacement.
PML_GETPAGEBUFFER_LIED, // MainPagesAvail lied.
PML_GETPAGEBUFFER_PURGE, // Purged main block.
PML_GETPAGEBUFFER_SEARC, // Search failed.
PML_GETPAGEFROMXMS_SEG, // Non segment pointer.
PM_GETPAGE_BAD_PAGE, // Invalid page request.
PM_GETPAGE_SPARSE_PAGE, // Tried to load a sparse page.
PM_SETPAGELOCK_NON_SND, // Locking/unlocking non-sound page.
PM_PRELOAD_PAGES_OV, // More pages than chunks in file.
PM_PRELOAD_XMS_FAIL, // XMS buffer failed.
PM_PRELOAD_EXCEED, // Exceeded XMS pages.
PM_PRELOAD_TOO_LONG, // Page too long.
PM_STARTUP_NO_MAIN_EMS, // No main or EMS.
// UNIT: ID_MM
//
MML_USESPACE_TWO_BLOCKS=0x01, // Segment spans two blocks.
MML_CLEARBLOCK_NO_PURGE_BLKS, // No purgable blocks.
MM_GETPTR_OUT_OF_MEMORY, // Out of memory.
MM_FREEPTR_BLOCK_NOT_FOUND, // Block not found.
MM_SETPURGE_BLOCK_NOT_FOUND, // Block not found.
MM_SETLOCK_BLOCK_NOT_FOUND, // Block not found.
MM_SHOWMEMORY_BLK_CORRUPT, // Memory block order corrupted.
MM_DUMPDATA_FILE_ERROR, // Couldn't open MMDUMP.TXT.
MM_DUMPDATA_FILE_CREATED, // MMDUMP.TXT created.
MM_GETMEM_WITH_PAGEMANAGER, // MM_GetPtr() was called while PageManager was installed
// UNIT: ID_SD
//
SD_PLAYSOUND_ZERO_LEN=0x01, // Zero length sound.
SD_PLAYSOUND_PRI_NO_SOUND, // Priority without a sound.
SD_PLAYSOUND_UNCACHED, // Uncached sound.
SD_STARTUP_BAD_DMA, // Unsupported DMA value in BLASTER.
SD_STARTUP_BAD_INTERRUPT, // Unsupported interrupt value in BLASTER.
SD_STARTUP_BAD_ADDRESS, // Unsupported address value in BLASTER.
SDL_ALPLAYSOUND_BAD_INST, // Bad instrument.
SD_PLAYDIGITIZED_BAD_SOUND, // Bad sound number.
SD_SETPOSITION_BAD_POSITION, // Illegal position.
SDL_STARTSB_BAD_INTERRUPT, // Illegal or unsupported interrupt number for SoundBlaster.
SDL_SBSETDMA_BAD_DMA, // Invalid SoundBlaster DMA channel.
// UNIT: 3D_DRAW2
//
NULL_FUNC_PTR_PASSED=0x01, // Null Function Pointer passed - MapRowPtr was NOT initalized!!!
// UNIT: 3D_MENU
//
CACHE_MESSAGE_NO_END_MARKER, // A cached message was NOT terminated with "^XX"
};
// Use ERROR() when passing "Unit: Msg:" info -- this keeps Quit()
// flexible and optimizes _DATA usage.
//
// Also, other xxx_ERROR macros are included.
//
extern char QuitMsg[];
#define ERROR(Unit,Error) Quit(QuitMsg,Unit,Error)
#define IO_ERROR(Error) ERROR(JM_IO_ERROR,Error)
#define TP_ERROR(Error) ERROR(JM_TP_ERROR,Error)
#define AN_ERROR(Error) ERROR(JM_AN_ERROR,Error)
#define MAIN_ERROR(Error) ERROR(D3_MAIN_ERROR,Error)
#define STATE_ERROR(Error) ERROR(D3_STATE_ERROR,Error)
#define DEBUG_ERROR(Error) ERROR(D3_DEBUG_ERROR,Error)
#define PLAY_ERROR(Error) ERROR(D3_PLAY_ERROR,Error)
#define ACT1_ERROR(Error) ERROR(D3_ACT1_ERROR,Error)
#define ACT2_ERROR(Error) ERROR(D3_ACT2_ERROR,Error)
#define GAME_ERROR(Error) ERROR(D3_GAME_ERROR,Error)
#define AGENT_ERROR(Error) ERROR(D3_AGENT_ERROR,Error)
#define SCALE_ERROR(Error) ERROR(D3_SCALE_ERROR,Error)
#define US1_ERROR(Error) ERROR(ID_US1_ERROR,Error)
#define IN_ERROR(Error) ERROR(ID_IN_ERROR,Error)
#define CA_ERROR(Error) ERROR(ID_CA_ERROR,Error)
#define PM_ERROR(Error) ERROR(ID_PM_ERROR,Error)
#define VH_ERROR(Error) ERROR(ID_VH_ERROR,Error)
#define SD_ERROR(Error) ERROR(ID_SD_ERROR,Error)
#define MM_ERROR(Error) ERROR(ID_MM_ERROR,Error)
#define DRAW2_ERROR(Error) ERROR(DRAW2_ERROR,Error)
#define MENU_ERROR(Error) ERROR(MENU_ERROR,Error)
#endif

2350
JM_FREE.C Normal file

File diff suppressed because it is too large Load diff

216
JM_IO.C Normal file
View file

@ -0,0 +1,216 @@
#include "id_heads.h"
#include <io.h>
#include "jm_io.h"
#include "jm_cio.h"
#include "jm_lzh.h"
#include "jm_error.h"
//--------------------------------------------------------------------------
// IO_FarRead()
//--------------------------------------------------------------------------
boolean IO_FarRead (int handle, byte far *dest, long length)
{
unsigned readlen,nread;
while (length)
{
if (length > 0xffff)
readlen=0xffff;
else
readlen=length;
_dos_read(handle,dest,readlen,&nread);
if (nread != readlen)
return(false);
length -= readlen;
}
return(true);
}
//--------------------------------------------------------------------------
// IO_FarWrite()
//--------------------------------------------------------------------------
boolean IO_FarWrite (int handle, byte far *source, long length)
{
unsigned writelen,nwritten;
while (length)
{
if (length > 0xffff)
writelen=0xffff;
else
writelen=length;
_dos_write(handle,source,writelen,&nwritten);
if (nwritten != writelen)
return(false);
length -= writelen;
}
return(true);
}
#if DEMOS_EXTERN
//--------------------------------------------------------------------------
// IO_WriteFile()
//--------------------------------------------------------------------------
boolean IO_WriteFile(char *filename, void far *ptr, long length)
{
int handle;
long size;
handle = open(filename,O_CREAT | O_BINARY | O_WRONLY,
S_IREAD | S_IWRITE | S_IFREG);
if (handle == -1)
return(false);
if (!IO_FarWrite (handle,ptr,length))
{
close (handle);
return(false);
}
close (handle);
return(true);
}
#endif
//--------------------------------------------------------------------------
// IO_LoadFile()
//--------------------------------------------------------------------------
long IO_LoadFile (char *filename, memptr *dst)
{
char buffer[5]={0,0,0,0,0};
int handle;
long size=0;
if ((handle = open(filename,O_RDONLY | O_BINARY, S_IREAD)) == -1)
return(size);
read(handle,buffer,4);
if (!strcmp(buffer,"JAMP"))
{
struct JAMPHeader head;
read(handle,&head,sizeof(head));
size = head.OriginalLen;
switch (head.CompType)
{
case ct_LZH:
LZH_Startup();
MM_GetPtr(dst,head.OriginalLen);
if (mmerror)
return(0);
LZH_Decompress((void far *)handle,*dst,size,head.CompressLen,SRC_FILE|DEST_MEM);
LZH_Shutdown();
break;
case ct_LZW:
IO_ERROR(IO_LOADFILE_NO_LZW);
break;
default:
IO_ERROR(IO_LOADFILE_UNKNOWN);
break;
}
}
else
{
lseek(handle,0,SEEK_SET);
size = filelength(handle);
MM_GetPtr(dst,size);
if (!IO_FarRead(handle,*dst,size))
{
close(handle);
return(size);
}
}
close(handle);
return(size);
}
#if 0
//--------------------------------------------------------------------------
// IO_CopyFile()
//--------------------------------------------------------------------------
void IO_CopyFile(char *sFilename, char *dFilename)
{
int sHandle,dHandle;
unsigned length;
// Allocate memory for buffer.
//
if ((sHandle = open(sFilename,O_RDONLY | O_BINARY, S_IREAD)) == -1)
IO_ERROR(IO_COPYFILE_OPEN_SRC);
if ((dHandle=open(dFilename,O_CREAT|O_RDWR|O_BINARY,S_IREAD|S_IWRITE))==-1)
IO_ERROR(IO_COPYFILE_OPEN_DEST);
// Copy that file!
//
IO_CopyHandle(sHandle,dHandle,-1);
// Close files.
//
close(sHandle);
close(dHandle);
}
#endif
//--------------------------------------------------------------------------
// IO_CopyHandle()
//--------------------------------------------------------------------------
void IO_CopyHandle(int sHandle, int dHandle, long num_bytes)
{
extern boolean bombonerror;
#define CF_BUFFER_SIZE 8192
long fsize;
memptr src;
unsigned length;
// Allocate memory for buffer.
//
MM_GetPtr(&src,CF_BUFFER_SIZE);
if (num_bytes == -1)
fsize=filelength(sHandle);
else
fsize=num_bytes;
// Copy that file!
//
do
{
// Determine length to read/write.
//
if (fsize >= CF_BUFFER_SIZE)
length = CF_BUFFER_SIZE;
else
length = fsize;
// Read it, write it and decrement length.
//
IO_FarRead(sHandle,src,length);
IO_FarWrite(dHandle,src,length);
fsize -= length;
}
while (fsize);
// Free buffer.
//
MM_FreePtr(&src);
}

15
JM_IO.H Normal file
View file

@ -0,0 +1,15 @@
#ifndef _JM_IO_H_
#define _JM_IO_H_
//-------------------------------------------------------------------------
// Function Prototypes
//-------------------------------------------------------------------------
boolean IO_FarRead (int handle, byte far *dest, long length);
boolean IO_FarWrite (int handle, byte far *source, long length);
boolean IO_ReadFile (char *filename, memptr *ptr);
boolean IO_WriteFile(char *filename, void far *ptr, long length);
long IO_LoadFile (char *filename, memptr *dst);
void IO_CopyFile(char *sFilename, char *dFilename);
void IO_CopyHandle(int sHandle, int dHandle, long num_bytes);
#endif

1220
JM_LZH.C Normal file

File diff suppressed because it is too large Load diff

21
JM_LZH.H Normal file
View file

@ -0,0 +1,21 @@
#ifndef _JM_LZH_H_
#define _JM_LZH_H_
extern void (*LZH_CompressDisplayVector)(unsigned long, unsigned long);
extern void (*LZH_DecompressDisplayVector)(unsigned long, unsigned long);
//===========================================================================
//
// PROTOTYPES
//
//===========================================================================
boolean LZH_Startup(void);
void LZH_Shutdown(void);
long LZH_Compress(void far *infile, void far *outfile,unsigned long DataLength,unsigned PtrTypes);
long LZH_Decompress(void far *infile, void far *outfile, unsigned long OrginalLength, unsigned long CompressLength, unsigned PtrTypes);
#endif

2200
JM_TP.C Normal file

File diff suppressed because it is too large Load diff

160
JM_TP.H Normal file
View file

@ -0,0 +1,160 @@
#ifndef _JM_TP_H_
#define _JM_TP_H_
//-------------------------------------------------------------------------
// defines
//-------------------------------------------------------------------------
#define PI_MAX_NUM_DISP_STRS 1 // Num display str ptrs allocated for text presenter
#define TP_CASE_SENSITIVE // ctrl codes are case sensitive
#define TP_640x200 0 // is presenter in 640 x 200 mode?
#define TP_RETURN_CHAR '\r'
#define TP_CONTROL_CHAR '^'
#define TP_CURSOR_SAVES 8 // MAX different points to save
#define TP_CNVT_CODE(c1,c2) ((c1)|(c2<<8))
#define TP_MAX_ANIMS 10
#define TP_MAX_PAGES 41
#define TP_MARGIN 1 // distance between xl/xh/yl/yh points and text
#define is_shadowed ((flags & fl_shadowtext) == fl_shadowtext)
#define ch_width(ch) (font->width[ch]) // +((flags & fl_shadowtext) == fl_shadowtext))
#define font_height (font->height) //+((flags & fl_shadowtext) == fl_shadowtext))
#define TP_INIT_DISPLAY_STR(num,str_ptr) {if ((num)<PI_MAX_NUM_DISP_STRS) \
piStringTable[(num)]=(str_ptr); \
else \
TP_ERROR(TP_DISPLAY_STR_NUM_BAD);}
//
// global static flags
//
#define fl_center 0x0001
#define fl_uncachefont 0x0002
#define fl_boxshape 0x0004
#define fl_shadowtext 0x0008
#define fl_presenting 0x0010
#define fl_startofline 0x0020
#define fl_upreleased 0x0040
#define fl_dnreleased 0x0080
#define fl_pagemanager 0x0100
#define fl_hidecursor 0x0200
#define fl_shadowpic 0x0400
#define fl_clearscback 0x0800
//
// PresenterInfo structure flags
//
#define TPF_CACHED_SCRIPT 0x0001
#define TPF_CACHE_NO_GFX 0x0002
#define TPF_CONTINUE 0x0004
#define TPF_USE_CURRENT 0x0008
#define TPF_SHOW_CURSOR 0x0010
#define TPF_SCROLL_REGION 0x0020
#define TPF_SHOW_PAGES 0x0040
#define TPF_TERM_SOUND 0x0080
#define TPF_ABORTABLE 0x0100
//-------------------------------------------------------------------------
// typedefs
//-------------------------------------------------------------------------
typedef struct {
unsigned flags,gflags;
char far *script[TP_MAX_PAGES];
memptr scriptstart;
char numpages,pagenum;
unsigned xl,yl,xh,yh;
char fontnumber;
char bgcolor,ltcolor,dkcolor,shcolor;
unsigned cur_x,cur_y;
char print_delay;
byte highlight_color,fontcolor;
short id_cache;
char far *infoline;
} PresenterInfo;
typedef enum tpCacheType {ct_scaled,
ct_chunk,
ct_marks,
ct_music,
} tpCacheType;
typedef enum pisType {pis_pic,
pis_sprite,
pis_scaled,
pis_scwall,
pis_latchpic,
#if TP_640x200
pis_pic2x,
pis_sprite2x,
#endif
} pisType;
typedef struct {
unsigned shapenum;
pisType shapetype;
} piShapeInfo;
typedef enum piaType {pia_grabscript,
pia_shapetable,
} piaType;
typedef enum pidType {pid_cycle,
pid_rebound,
} pidType;
typedef struct {
short baseshape;
char frame;
char maxframes;
short delay;
short maxdelay;
piaType animtype;
pidType dirtype;
short x,y;
char diradd;
} piAnimInfo;
//-------------------------------------------------------------------------
// variable externs
//-------------------------------------------------------------------------
extern piShapeInfo far piShapeTable[];
extern piAnimInfo far piAnimTable[];
extern piAnimInfo far piAnimList[TP_MAX_ANIMS];
extern char far * far piStringTable[PI_MAX_NUM_DISP_STRS];
extern byte TPscan;
//-------------------------------------------------------------------------
// Function prototypes
//-------------------------------------------------------------------------
void TP_Presenter(PresenterInfo *pi);
void TP_WrapText(void);
void TP_HandleCodes(void);
short TP_DrawShape(short x, short y, short shapenum, pisType type);
unsigned TP_VALUE(char far *ptr,char num_nybbles);
long TP_LoadScript(char *filename,PresenterInfo *pi, unsigned id_cache);
void TP_FreeScript(PresenterInfo *pi,unsigned id_cache);
void TP_InitScript(PresenterInfo *pi);
void TP_AnimatePage(short numanims);
short TP_BoxAroundShape(short x1, short y1, unsigned shapenum, pisType shapetype);
void TP_JumpCursor(void);
void TP_Print(char far *str,boolean single_char);
boolean TP_SlowPrint(char far *str, char delay);
void TP_PurgeAllGfx(void);
void TP_CachePage(char far *script);
void TP_CacheIn(tpCacheType type, short chunk);
void TP_ResetPagePointers(void);
short TP_LineCommented(char far *s);
void TP_PrintPageNumber(void);
#endif

99
JM_VL.ASM Normal file
View file

@ -0,0 +1,99 @@
;===========================================================================
;
; JM_VL.ASM
;
;===========================================================================
IDEAL
MODEL MEDIUM,C
SCREENSEG = 0a000h
DATASEG
EXTRN bufferofs:WORD
CODESEG
;===========================================================================
;--------------------------------------------------------------------------
; JM_VGALinearFill() - Clears a linear section of latched VGA memory
;--------------------------------------------------------------------------
PROC JM_VGALinearFill start:WORD, len:WORD, fill:BYTE
PUBLIC JM_VGALinearFill
USES SI,DI,DS
;
; ES = screen memory segment (dest)
mov ax,SCREENSEG
mov es,ax
;
; Store off the staring address for later reference
;
mov ds,[WORD PTR start]
; Init our direction flag once for our STOS
cld
;
; PRE INIT 'bx' for a VGA MAP MASK (BH will be shifted per plane loop)
;
mov bx,0102h
mov dx,03c4h ; Init our VGA register num..
mov si,4
;
; VGA 'PLANE' LOOP (4 times)
;
; Loop for 4 Planes of VGA Latch memory
;
@@loop:
;
; DI -> screen memory offset (dest)
;
mov di,ds
;
; Set the VGAMAPMASK
;
cli
mov ax,bx
out dx,ax
sti
shl bh,1
;
; INDIVIDUAL PLANE LOOP
;
; Get ready to move length/2 WORDS for this MAPMASK
;
mov cx,[WORD PTR len]
shr cx,1
mov al,[BYTE PTR fill]
mov ah,al
rep stosw
;
; Check to see if we have done all planes
;
dec si
jnz @@loop
ret
ENDP
END

24
JM_VL.H Normal file
View file

@ -0,0 +1,24 @@
#ifndef _JM_VL_H_
#define _JM_VL_H_
//==========================================================================
//
// JM_VL.h - Headerfile for JM_VL.ASM
//
//
//
//
//
//--------------------------------------------------------------------------
// Copyright (c) 1993 - JAM Productions Inc, All rights reserved.
//==========================================================================
//---------------------------------------------------------------------
// VGA Routines
//---------------------------------------------------------------------
void JM_VGALinearFill(unsigned start,unsigned length, char fill);
#endif

108
MAPSBS1.H Normal file
View file

@ -0,0 +1,108 @@
///////////////////////////////////////
//
// TED5 Map Header for BS1
//
///////////////////////////////////////
//
// Map Names
//
typedef enum {
GAME1_BASEMENT_MAP, // 0
GAME1_FLOOR1_MAP, // 1
GAME1_FLOOR2_MAP, // 2
GAME1_FLOOR3_MAP, // 3
GAME1_FLOOR4_MAP, // 4
GAME1_FLOOR5_MAP, // 5
GAME1_FLOOR6_MAP, // 6
GAME1_FLOOR7_MAP, // 7
GAME1_FLOOR8_MAP, // 8
GAME1_FLOOR9_MAP, // 9
GAME1_FLOOR10_MAP, // 10
GAME1_SPACE_MAP, // 11
GAME1_SECRET2_MAP, // 12
GAME1_SECRET3_MAP, // 13
GAME1_SECRET4_MAP, // 14
GAME2_BASEMENT_MAP, // 15
GAME2_FLOOR1_MAP, // 16
GAME2_FLOOR2_MAP, // 17
GAME2_FLOOR3_MAP, // 18
GAME2_FLOOR4_MAP, // 19
GAME2_FLOOR5_MAP, // 20
GAME2_FLOOR6_MAP, // 21
GAME2_FLOOR7_MAP, // 22
GAME2_FLOOR8_MAP, // 23
GAME2_FLOOR9_MAP, // 24
GAME2_FLOOR10_MAP, // 25
GAME2_SECRET1_MAP, // 26
GAME2_SECRET2_MAP, // 27
GAME2_SECRET3_MAP, // 28
GAME2_SECRET4_MAP, // 29
GAME3_BASEMENT_MAP, // 30
GAME3_FLOOR1_MAP, // 31
GAME3_FLOOR2_MAP, // 32
GAME3_FLOOR3_MAP, // 33
GAME3_FLOOR4_MAP, // 34
GAME3_FLOOR5_MAP, // 35
GAME3_FLOOR6_MAP, // 36
GAME3_FLOOR7_MAP, // 37
GAME3_FLOOR8_MAP, // 38
GAME3_FLOOR9_MAP, // 39
GAME3_FLOOR10_MAP, // 40
GAME3_SECRET1_MAP, // 41
GAME3_SECRET2_MAP, // 42
GAME3_SECRET3_MAP, // 43
GAME3_SECRET4_MAP, // 44
GAME4_BASEMENT_MAP, // 45
GAME4_FLOOR1_MAP, // 46
GAME4_FLOOR2_MAP, // 47
GAME4_FLOOR3_MAP, // 48
GAME4_FLOOR4_MAP, // 49
GAME4_FLOOR5_MAP, // 50
GAME4_FLOOR6_MAP, // 51
GAME4_FLOOR7_MAP, // 52
GAME4_FLOOR8_MAP, // 53
GAME4_FLOOR9_MAP, // 54
GAME4_FLOOR10_MAP, // 55
GAME4_SECRET1_MAP, // 56
GAME4_SECRET2_MAP, // 57
GAME4_SECRET3_MAP, // 58
GAME4_SECRET4_MAP, // 59
GAME5_BASEMENT_MAP, // 60
GAME5_FLOOR1_MAP, // 61
GAME5_FLOOR2_MAP, // 62
GAME5_FLOOR3_MAP, // 63
GAME5_FLOOR4_MAP, // 64
GAME5_FLOOR5_MAP, // 65
GAME5_FLOOR6_MAP, // 66
GAME5_FLOOR7_MAP, // 67
GAME5_FLOOR8_MAP, // 68
GAME5_FLOOR9_MAP, // 69
GAME5_FLOOR10_MAP, // 70
GAME5_SECRET1_MAP, // 71
GAME5_SECRET2_MAP, // 72
GAME5_SECRET3_MAP, // 73
GAME5_SECRET4_MAP, // 74
GAME6_BASEMENT_MAP, // 75
GAME6_FLOOR1_MAP, // 76
GAME6_FLOOR2_MAP, // 77
GAME6_FLOOR3_MAP, // 78
GAME6_FLOOR4_MAP, // 79
GAME6_FLOOR5_MAP, // 80
GAME6_FLOOR6_MAP, // 81
GAME6_FLOOR7_MAP, // 82
GAME6_FLOOR8_MAP, // 83
GAME6_FLOOR9_MAP, // 84
GAME6_FLOOR10_MAP, // 85
GAME6_SECRET1_MAP, // 86
GAME6_SECRET2_MAP, // 87
GAME6_SECRET3_MAP, // 88
GAME6_SECRET4_MAP, // 89
LASTMAP
} mapnames;
//
// TILEINFO offsets
//
#define ANIM 402
#define SPEED (ANIM+NUMTILE16)

42
MAPSVSI.H Normal file
View file

@ -0,0 +1,42 @@
///////////////////////////////////////
//
// TED5 Map Header for FIR
//
///////////////////////////////////////
//
// Map Names
//
typedef enum {
AREA0_MAP, // 0
AREA1_MAP, // 1
AREA2_MAP, // 2
AREA3_MAP, // 3
AREA4_MAP, // 4
AREA5_MAP, // 5
AREA6_MAP, // 6
AREA7_MAP, // 7
AREA8_MAP, // 8
AREA9_MAP, // 9
AREA10_MAP, // 10
AREA11_MAP, // 11
AREA12_MAP, // 12
AREA13_MAP, // 13
AREA14_MAP, // 14
AREA15_MAP, // 15
AREA16_MAP, // 16
AREA17_MAP, // 17
AREA18_MAP, // 18
AREA19_MAP, // 19
SECRET1_MAP, // 20
SECRET2_MAP, // 21
SECRET3_MAP, // 22
SECRET4_MAP, // 23
LASTMAP
} mapnames;
//
// TILEINFO offsets
//
#define ANIM 402
#define SPEED (ANIM+NUMTILE16)

637
MARKHACK.ASM Normal file
View file

@ -0,0 +1,637 @@
.386C
IDEAL
MODEL MEDIUM,C
SC_INDEX = 03C4h
SC_RESET = 0
SC_CLOCK = 1
SC_MAPMASK = 2
CRTC_INDEX = 03D4h
SCREENBWIDE= 80
SCREENSEG = 0a000h
MISC_OUTPUT= 03c2h
MASK_COLOR = 254
DATASEG
EXTRN viewwidth:WORD
EXTRN viewheight:WORD
EXTRN bufferofs:WORD
EXTRN ylookup:WORD
EXTRN centery:WORD
EXTRN postsource:DWORD
EXTRN bufx:WORD
EXTRN postheight:WORD
EXTRN shadingtable:DWORD
CODESEG
;----------------------------------------------------------------------------
;
; DrawPost - Draws an unmasked post centered in the viewport
;
; ecx - height to scale post to
; esi - source pointer to proper column (x offsetted)
; edi - destination pointer to proper screen column (xoffsetted)
;
;----------------------------------------------------------------------------
;ALIGN 16
PROC DrawPost
PUBLIC DrawPost
; ECX - loop variable (height and counter)
; EDI - top offset + bufferofs
; EDX - destination offset
; EBX - high word contains bottom offset, low word contains source data
; EBP - fraction
push si
push di
push bp
mov ax,[WORD postsource + 2]
mov gs,ax
mov si,[WORD postsource]
mov ecx,0
mov cx,[postheight]
SETFLAG cx,cx
jz donedraw
mov edx,0
mov eax,32*65536
idiv ecx
mov edx,eax
; edx holds fractional step
mov [DWORD PTR cs:patch1+3],edx ; JTR Self modifing cod
shr edx,1
mov ax,SCREENSEG
mov es,ax
mov di,OFFSET ylookup
mov ax,[centery]
shl ax,1
add di,ax
mov di,[di]
add di,[bufferofs]
add di,[bufx]
mov bp,SCREENBWIDE
sub di,SCREENBWIDE
shr ax,1
cmp cx,ax
jle heightok
mov cx,ax
heightok: ; height is ok.. < viewheigth
drawloop:
mov eax,edx
shr eax,16
mov ebx,31
patch1:
add edx,12345678h ; JTR Self Modifing Code
sub ebx,eax
mov bl,[BYTE PTR gs:si+bx]
mov [es:di],bl
mov ebx,32
add ebx,eax
mov bl,[BYTE PTR gs:si+bx]
mov [es:di+bp],bl
sub di,SCREENBWIDE
add bp,SCREENBWIDE*2
dec cx
jnz drawloop
donedraw:
pop bp
pop di
pop si
ret
ENDP DrawPost
;----------------------------------------------------------------------------
;
; DrawLSPost - Draws an unmasked light sourced post centered in the viewport
;
; ecx - height to scale post to
; esi - source pointer to proper column (x offsetted)
; edi - destination pointer to proper screen column (xoffsetted)
;
;----------------------------------------------------------------------------
;ALIGN 16
PROC DrawLSPost
PUBLIC DrawLSPost
; ECX - loop variable (height and counter)
; EDI - top offset + bufferofs
; EDX - destination offset
; EBX - high word contains bottom offset, low word contains source data
; EBP - fraction
push si
push di
push bp
mov ax,[WORD postsource + 2]
mov gs,ax
mov si,[WORD postsource]
mov ecx,0
mov ax,[WORD shadingtable + 2]
mov fs,ax
mov cx,[postheight]
SETFLAG cx,cx
jz donedraw
mov edx,0
mov eax,32*65536
idiv ecx
mov edx,eax
; edx holds fractional step
mov [DWORD PTR cs:patch1ls+3],edx ; JTR: Self Modifing Code!
shr edx,1
mov ax,SCREENSEG
mov es,ax
mov di,OFFSET ylookup
mov ax,[centery]
shl ax,1
add di,ax
mov di,[di]
add di,[bufferofs]
add di,[bufx]
mov bp,SCREENBWIDE
sub di,SCREENBWIDE
shr ax,1
cmp cx,ax
jle heightokls
mov cx,ax
heightokls: ; height is ok.. < viewheigth
drawloopls:
mov eax,edx
shr eax,16
mov ebx,31
patch1ls:
add edx,12345678h ; JTR This value 1234... will change to contain the frac inc value.
sub ebx,eax
shl eax,16
mov al,[BYTE PTR gs:si+bx]
mov bx,[WORD shadingtable]
mov bl,al
mov al,[fs:bx]
mov [es:di],al
mov ebx,32
shr eax,16
add ebx,eax
mov al,[BYTE PTR gs:si+bx]
mov bx,[WORD shadingtable]
mov bl,al
mov al,[fs:bx]
mov [es:di+bp],al
sub di,SCREENBWIDE
add bp,SCREENBWIDE*2
dec cx
jnz drawloopls
donedrawls:
pop bp
pop di
pop si
ret
ENDP DrawLSPost
IF 0 ; JIM Add line
;----------------------------------------------------------------------------
;
; DrawMPost - Draws an masked post centered in the viewport
;
; ecx - height to scale post to
; esi - source pointer to proper column (x offsetted)
; edi - destination pointer to proper screen column (xoffsetted)
;
;----------------------------------------------------------------------------
;ALIGN 16
PROC DrawMPost
PUBLIC DrawMPost
; ECX - loop variable (height and counter)
; EDI - top offset + bufferofs
; EDX - destination offset
; EBX - high word contains bottom offset, low word contains source data
; EBP - fraction
push si
push di
push bp
;
; 'postsource' is a ptr to the source image.
;
; Setup ptr to source image
; GS:SI will be address of veritacal post to draw.
;
mov ax,[WORD postsource + 2]
mov gs,ax
mov si,[WORD postsource]
;
; Clear out our high word of our loop counter
;
mov ecx,0
;
; Store height and test for 0
;
mov cx,[postheight]
SETFLAG cx,cx
jz donedrawm
;
; Calc fractional step values to be stored in EDX
;
; (Height/Max_View??)
;
;
mov edx,0
mov eax,32*65536
idiv ecx
mov edx,eax
;
; Self modify the asm code to use the fractional step
; value. Stored at patch1mls+3
;
mov [DWORD PTR cs:patch1m+3],edx ; Self modifing code
;
; Compute position on screen to draw pixel
;
shr edx,1
mov ax,SCREENSEG
mov es,ax
mov di,OFFSET ylookup
mov ax,[centery]
shl ax,1
add di,ax
mov di,[di]
add di,[bufferofs]
add di,[bufx]
mov bp,SCREENBWIDE
sub di,SCREENBWIDE
shr ax,1
cmp cx,ax
jle heightokm
mov cx,ax
heightokm: ; height is ok.. < viewheigth
;
; Get ready to draw post
;
drawloopm:
mov eax,edx
shr eax,16 ; restore contents of AX from high word
mov ebx,31
patch1m:
add edx,12345678h ; Self Modifing Code
sub ebx,eax
;
; move source pixel into BL
;
mov bl,[BYTE PTR gs:si+bx]
;
; BL now contains our source pixel to draw
;
; Test for mask color
;
cmp bl,MASK_COLOR
je skip1_maskcolor
;
; Draw source pixel to screen
;
mov [es:di],bl
skip1_maskcolor:
mov ebx,32
add ebx,eax
;
; Get pixel from source image.
;
mov bl,[BYTE PTR gs:si+bx]
;
; Test for mask color
;
cmp bl,MASK_COLOR
je skip2_maskcolor
;
; Draw Pixel
;
mov [es:di+bp],bl
skip2_maskcolor:
sub di,SCREENBWIDE
add bp,SCREENBWIDE*2
dec cx
jnz drawloopm
donedrawm:
pop bp
pop di
pop si
ret
ENDP DrawMPost
;----------------------------------------------------------------------------
;
; DrawMLSPost - Draws a masked light sourced post centered in the viewport
;
; ecx - height to scale post to
; esi - source pointer to proper column (x offsetted)
; edi - destination pointer to proper screen column (xoffsetted)
;
;----------------------------------------------------------------------------
;ALIGN 16
PROC DrawMLSPost
PUBLIC DrawMLSPost
; ECX - loop variable (height and counter)
; EDI - top offset + bufferofs
; EDX - destination offset
; EBX - high word contains bottom offset, low word contains source data
; EBP - fraction
push si
push di
push bp
;
; Setup ptr to source image
; GS:SI will be address of veritacal post to draw.
;
mov ax,[WORD postsource + 2]
mov gs,ax
mov si,[WORD postsource]
;
; Clear out our high word of our loop counter
;
mov ecx,0
;
; Init FS to hold SEGMENT for the shading table
;
; (shading table is on WORD boundries?)
;
mov ax,[WORD shadingtable + 2]
mov fs,ax ; FS - Holds SEG to Far shading table
;
; Store height and test for 0
;
mov cx,[postheight]
SETFLAG cx,cx
jz donedrawmls ; Nothing to draw...Exit this mofo.
;
; Calc fractional step values to be stored in EDX
;
; (Height/Max_View??)
;
;
mov edx,0
mov eax,32*65536
idiv ecx
mov edx,eax
;
; Self modify the asm code to use the fractional step
; value. Stored at patch1mls+3
;
mov [DWORD PTR cs:patch1mls+3],edx
;
; Divide the fractional step in half
;
shr edx,1
;
; Calc screen position to draw vert post
;
; ES:DI - dest Screen ptr
;
mov ax,SCREENSEG
mov es,ax
mov di,OFFSET ylookup
mov ax,[centery]
shl ax,1
add di,ax
mov di,[di]
add di,[bufferofs]
add di,[bufx]
mov bp,SCREENBWIDE
sub di,SCREENBWIDE
;
; Test boundries of drawing....?
;
shr ax,1
cmp cx,ax
jle heightokmls
mov cx,ax
heightokmls: ; height is ok.. < viewheigth
;
; Get ready to draw this Mofo!
;
;
drawloopmls:
mov eax,edx
shr eax,16
mov ebx,31
;
; NOTE: The value 12345678 will be Modified to hold the
; fractional inc value.
;
patch1mls:
add edx,12345678h
sub ebx,eax
shl eax,16 ; Store AX into the high word of EAX
;
; AL will contain the source pixel to draw
;
mov al,[BYTE PTR gs:si+bx]
;
; Now test AL for a mask color, if so, lets skip it.
;
cmp al,MASK_COLOR
je skip1_ls_maskcolor
;
; Nope, Not the mask color....
;
; Get the offset to the shading table
;
; BX = offset to shading table
;
;
mov bx,[WORD shadingtable] ; Get offset for shading table
;
; Adjust the offset into the shading table to index
; using the source pixel color (currently being held in
; AL.
;
mov bl,al
;
; FS:BX points to the shaded color
;
; Move into AL
;
mov al,[fs:bx]
;
; Draw the shaded pixel to the screen.
;
mov [es:di],al
;
; Do some adjustments for ??????????
;
;
skip1_ls_maskcolor:
mov ebx,32
shr eax,16 ; Restore the Old AX which was stored in the hi word
add ebx,eax
;
; Move the source pixel into AL
;
;
mov al,[BYTE PTR gs:si+bx]
;
; Test AL for a mask color
;
cmp al,MASK_COLOR
je skip2_ls_maskcolor
;
; Get the offset for the Shading table ... again
;
; BX = Offset into shading table
;
mov bx,[WORD shadingtable]
;
; Adjust BX to index with the source pixel color to
; get the shaded pixel color.
;
mov bl,al
mov al,[fs:bx]
;
; AL now contains the shaded pixel... Draw that mofo!
;
mov [es:di+bp],al
;
; Move to next pixel(s)
;
skip2_ls_maskcolor:
sub di,SCREENBWIDE
add bp,SCREENBWIDE*2
dec cx
jnz drawloopmls
donedrawmls:
pop bp
pop di
pop si
ret
ENDP DrawMLSPost
ENDIF ; JIM Add line
END

643
MOVIE.C Normal file
View file

@ -0,0 +1,643 @@
//===========================================================================
//
//
//
//
//===========================================================================
#include <io.h>
#include <alloc.h>
#include <mem.h>
#include <stdio.h>
#include <string.h>
#include <dos.h>
#include <FCNTL.H>
#include "3d_def.h"
#include "jm_io.h"
#include "an_codes.h"
//===========================================================================
//
//
//
//
//===========================================================================
//#define DRAW_TO_FRONT
//
// Various types for various purposes...
//
typedef enum
{
FADE_NONE,
FADE_SET,
FADE_IN,
FADE_OUT,
FADE_IN_FRAME,
FADE_OUT_FRAME,
} FADES;
typedef enum
{
MV_NONE,
MV_FILL,
MV_SKIP,
MV_READ,
} MOVIE_FLAGS;
//===========================================================================
//
// VARIABLES
//
//===========================================================================
// Movie File variables
int Movie_FHandle;
// Fade Variables
FADES fade_flags, fi_type, fo_type;
byte fi_rate,fo_rate;
// MOVIE_GetFrame & MOVIE_LoadBuffer variables
memptr MovieBuffer; // Ptr to Allocated Memory for Buffer
unsigned long BufferLen; // Len of MovieBuffer (Ammount of RAM allocated)
unsigned long PageLen; // Len of data loaded into MovieBuffer
char huge * BufferPtr; // Ptr to next frame in MovieBuffer
char huge * NextPtr; // Ptr Ofs to next frame after BufferOfs
boolean MorePagesAvail; // More Pages avail on disk?
//
MOVIE_FLAGS movie_flag;
boolean ExitMovie;
boolean EverFaded;
long seek_pos;
char movie_reps;
ControlInfo ci;
memptr movie_palette;
//
// MOVIE Definations for external movies
//
// NOTE: This list is ordered according to mv_???? enum list.
//
MovieStuff_t Movies[] =
{
{{"IANIM."},1,3,0,0,200}, //mv_intro
{{"EANIM."},1,30,0,0,200}, //mv_final
};
//===========================================================================
//
// LOCAL PROTO TYPES
//
//===========================================================================
void JM_MemToScreen(void);
void JM_ClearVGAScreen(byte fill);
void FlipPages(void);
boolean CheckFading(void);
boolean CheckPostFade(void);
//===========================================================================
//
// FUNCTIONS
//
//===========================================================================
//---------------------------------------------------------------------------
// SetupMovie() - Inits all the internal routines for the Movie Presenter
//
//
//
//---------------------------------------------------------------------------
void SetupMovie(MovieStuff_t *MovieStuff)
{
#ifdef DRAW_TO_FRONT
bufferofs=displayofs;
#endif
movie_reps = MovieStuff->rep;
movie_flag = MV_FILL;
LastScan = 0;
PageLen = 0;
MorePagesAvail = true;
ExitMovie = false;
EverFaded = false;
IN_ClearKeysDown();
movie_palette = MovieStuff->palette;
JM_VGALinearFill(screenloc[0],3*80*208,0);
VL_FillPalette (0,0,0);
LastScan = 0;
// Find out how much memory we have to work with..
BufferLen = MM_LargestAvail();
BufferLen -= 65535; // HACK: Save some room for sounds - This is cludgey
if (BufferLen < 64256)
BufferLen = 64256;
MM_GetPtr(&MovieBuffer,BufferLen);
PM_CheckMainMem();
}
//---------------------------------------------------------------------------
// void ShutdownMovie(void)
//---------------------------------------------------------------------------
void ShutdownMovie(void)
{
MM_FreePtr(&MovieBuffer);
close (Movie_FHandle);
}
//---------------------------------------------------------------------------
// void JM_DrawBlock()
//
// dest_offset = Correct offset value for memory location for Paged/Latch mem
//
// byte_offset = Offset for the image to be drawn - This address is NOT
// a calculated Paged/Latch value but a byte offset in
// conventional memory.
//
// source = Source image of graphic to be blasted to latch memory. This
// pic is NOT 'munged'
//
// length = length of the source image in bytes
//---------------------------------------------------------------------------
void JM_DrawBlock(unsigned dest_offset,unsigned byte_offset,char far *source,unsigned length)
{
byte numplanes;
byte mask,plane;
char huge *dest_ptr;
char huge *source_ptr;
char huge *dest;
char huge *end_ptr;
unsigned count,total_len;
end_ptr = source+length;
//
// Byte offset to determine our starting page to write to...
//
mask = 1<<(byte_offset & 3);
//
// Check to see if we are writting more than 4 bytes (to loop pages...)
//
if (length >= 4)
numplanes = 4;
else
numplanes = length;
//
// Compute our DEST memory location
//
dest = MK_FP(0xA000,dest_offset+(byte_offset>>2));
//
// Move that memory.
//
for (plane = 0; plane<numplanes; plane++)
{
dest_ptr = dest;
source_ptr = source+plane;
VGAMAPMASK(mask);
mask <<= 1;
if (mask == 16)
{
mask = 1;
dest++;
}
for (count=0;count<length,source_ptr < end_ptr;count+=4,dest_ptr++,source_ptr+=4)
*dest_ptr = *source_ptr;
}
}
//---------------------------------------------------------------------------
// MOVIE_ShowFrame() - Shows an animation frame
//
// PARAMETERS: pointer to animpic
//---------------------------------------------------------------------------
void MOVIE_ShowFrame (char huge *inpic)
{
anim_chunk huge *ah;
if (inpic == NULL)
return;
for (;;)
{
ah = (anim_chunk huge *)inpic;
if (ah->opt == 0)
break;
inpic += sizeof(anim_chunk);
JM_DrawBlock(bufferofs, ah->offset, (char far *)inpic, ah->length);
inpic += ah->length;
}
}
//---------------------------------------------------------------------------
// MOVIE_LoadBuffer() - Loads the RAM Buffer full of graphics...
//
// RETURNS: true - MORE Pages avail on disk..
// false - LAST Pages from disk..
//
// PageLen = Length of data loaded into buffer
//
//---------------------------------------------------------------------------
boolean MOVIE_LoadBuffer()
{
anim_frame blk;
long chunkstart;
char huge *frame;
unsigned long free_space;
NextPtr = BufferPtr = frame = MK_FP(MovieBuffer,0);
free_space = BufferLen;
while (free_space)
{
chunkstart = tell(Movie_FHandle);
if (!IO_FarRead(Movie_FHandle, (byte far *)&blk, sizeof(anim_frame)))
AN_ERROR(AN_BAD_ANIM_FILE);
if (blk.code == AN_END_OF_ANIM)
return(false);
if (free_space>=(blk.recsize+sizeof(anim_frame)))
{
_fmemcpy(frame, (byte far *)&blk, sizeof(anim_frame));
free_space -= sizeof(anim_frame);
frame += sizeof(anim_frame);
PageLen += sizeof(anim_frame);
if (!IO_FarRead(Movie_FHandle, (byte far *)frame, blk.recsize))
AN_ERROR(AN_BAD_ANIM_FILE);
free_space -= blk.recsize;
frame += blk.recsize;
PageLen += blk.recsize;
}
else
{
lseek(Movie_FHandle,chunkstart,SEEK_SET);
free_space = 0;
}
}
return(true);
}
//---------------------------------------------------------------------------
// MOVIE_GetFrame() - Returns pointer to next Block/Screen of animation
//
// PURPOSE: This function "Buffers" the movie presentation from allocated
// ram. It loads and buffers incomming frames of animation..
//
// RETURNS: 0 - Ok
// 1 - End Of File
//---------------------------------------------------------------------------
short MOVIE_GetFrame()
{
unsigned ReturnVal;
anim_frame blk;
if (PageLen == 0)
{
if (MorePagesAvail)
MorePagesAvail = MOVIE_LoadBuffer(Movie_FHandle);
else
return(1);
}
BufferPtr = NextPtr;
_fmemcpy(&blk, BufferPtr, sizeof(anim_frame));
PageLen-=sizeof(anim_frame);
PageLen-=blk.recsize;
NextPtr = BufferPtr+sizeof(anim_frame)+blk.recsize;
return(0);
}
//---------------------------------------------------------------------------
// MOVIE_HandlePage() - This handles the current page of data from the
// ram buffer...
//
// PURPOSE: Process current Page of anim.
//
//
// RETURNS:
//
//---------------------------------------------------------------------------
void MOVIE_HandlePage(MovieStuff_t *MovieStuff)
{
anim_frame blk;
char huge *frame;
unsigned wait_time;
_fmemcpy(&blk,BufferPtr,sizeof(anim_frame));
BufferPtr+=sizeof(anim_frame);
frame = BufferPtr;
IN_ReadControl(0,&ci);
switch (blk.code)
{
//-------------------------------------------
//
//
//-------------------------------------------
case AN_SOUND: // Sound Chunk
{
unsigned sound_chunk;
sound_chunk = *(unsigned far *)frame;
SD_PlaySound(sound_chunk);
BufferPtr+=blk.recsize;
}
break;
//-------------------------------------------
//
//
//-------------------------------------------
#if 0
case MV_CNVT_CODE('P','M'): // Play Music
{
unsigned song_chunk;
song_chunk = *(unsigned far *)frame;
SD_MusicOff();
if (!audiosegs[STARTMUSIC+musicchunk])
{
// MM_BombOnError(false);
CA_CacheAudioChunk(STARTMUSIC + musicchunk);
// MM_BombOnError(true);
}
if (mmerror)
mmerror = false;
else
{
MM_SetLock(&((memptr)audiosegs[STARTMUSIC + musicchunk]),true);
SD_StartMusic((MusicGroup far *)audiosegs[STARTMUSIC + musicchunk]);
}
BufferPtr+=blk.recsize;
}
break;
#endif
//-------------------------------------------
//
//
//-------------------------------------------
case AN_FADE_IN_FRAME: // Fade In Page
VL_FadeIn(0,255,MK_FP(movie_palette,0),30);
fade_flags = FADE_NONE;
EverFaded = true;
screenfaded = false;
break;
//-------------------------------------------
//
//
//-------------------------------------------
case AN_FADE_OUT_FRAME: // Fade Out Page
VW_FadeOut();
screenfaded = true;
fade_flags = FADE_NONE;
break;
//-------------------------------------------
//
//
//-------------------------------------------
case AN_PAUSE: // Pause
{
unsigned vbls;
vbls = *(unsigned far *)frame;
IN_UserInput(vbls);
BufferPtr+=blk.recsize;
}
break;
//-------------------------------------------
//
//
//-------------------------------------------
case AN_PAGE: // Graphics Chunk
#if 1
if (movie_flag == MV_FILL)
{
// First page comming in.. Fill screen with fill color...
//
// movie_flag = MV_READ; // Set READ flag to skip the first frame on an anim repeat
movie_flag = MV_NONE; // Set READ flag to skip the first frame on an anim repeat
JM_VGALinearFill(screenloc[0],3*80*208,*frame);
frame++;
}
else
#endif
VL_LatchToScreen(displayofs+ylookup[MovieStuff->start_line], 320>>2, MovieStuff->end_line-MovieStuff->start_line, 0, MovieStuff->start_line);
MOVIE_ShowFrame(frame);
#if 0
if (movie_flag == MV_READ)
{
seek_pos = tell(Movie_FHandle);
movie_flag = MV_NONE;
}
#endif
FlipPages();
if (TimeCount < MovieStuff->ticdelay)
{
wait_time = MovieStuff->ticdelay - TimeCount;
VL_WaitVBL(wait_time);
}
else
VL_WaitVBL(1);
TimeCount = 0;
if ((!screenfaded) && (ci.button0 || ci.button1 || LastScan))
{
ExitMovie = true;
if (EverFaded) // This needs to be a passed flag...
{
VW_FadeOut();
screenfaded = true;
}
}
break;
#if 0
//-------------------------------------------
//
//
//-------------------------------------------
case AN_PRELOAD_BEGIN: // These are NOT handled YET!
case AN_PRELOAD_END:
break;
#endif
//-------------------------------------------
//
//
//-------------------------------------------
case AN_END_OF_ANIM:
ExitMovie = true;
break;
//-------------------------------------------
//
//
//-------------------------------------------
default:
AN_ERROR(HANDLEPAGE_BAD_CODE);
break;
}
}
//---------------------------------------------------------------------------
// MOVIE_Play() - Playes an Animation
//
// RETURNS: true - Movie File was found and "played"
// false - Movie file was NOT found!
//---------------------------------------------------------------------------
boolean MOVIE_Play(MovieStuff_t *MovieStuff)
{
// Init our Movie Stuff...
//
SetupMovie(MovieStuff);
// Start the anim process
//
if ((Movie_FHandle = open(MovieStuff->FName, O_RDONLY|O_BINARY, S_IREAD)) == -1)
return(false);
while (movie_reps && (!ExitMovie))
{
#if 0
if (movie_flag == MV_SKIP)
if (lseek(Movie_FHandle, seek_pos, SEEK_SET) == -1)
return(false);
#endif
for (;!ExitMovie;)
{
if (MOVIE_GetFrame(Movie_FHandle))
break;
MOVIE_HandlePage(MovieStuff);
}
movie_reps--;
movie_flag = MV_SKIP;
}
ShutdownMovie();
return(true);
}
//--------------------------------------------------------------------------
// FlipPages()
//---------------------------------------------------------------------------
void FlipPages(void)
{
#ifndef DRAW_TO_FRONT
displayofs = bufferofs;
asm cli
asm mov cx,[displayofs]
asm mov dx,3d4h // CRTC address register
asm mov al,0ch // start address high register
asm out dx,al
asm inc dx
asm mov al,ch
asm out dx,al // set the high byte
#if 0
asm dec dx
asm mov al,0dh // start address low register
asm out dx,al
asm inc dx
asm mov al,cl
asm out dx,al // set the low byte
#endif
asm sti
bufferofs += SCREENSIZE;
if (bufferofs > PAGE3START)
bufferofs = PAGE1START;
#endif
}

77
MOVIE.H Normal file
View file

@ -0,0 +1,77 @@
#ifndef _MOVIE_H_
#define _MOVIE_H_
#include "JM_VL.H"
//==========================================================================
//
// UNIT: MOVIE.H
//
//==========================================================================
typedef struct
{
unsigned code;
long block_num;
long recsize;
}anim_frame;
typedef struct
{
unsigned short opt;
unsigned short offset;
unsigned short length;
} anim_chunk;
//-------------------------------------------------------------------------
// MovieStuff Anim Stucture...
//
//
// fname -- File Name of the Anim to be played..
// rep -- Number of repetitions to play the anim
// ticdelay -- Tic wait between frames
// maxmembuffer -- Maximum ammount to use as a ram buffer
// start_line -- Starting line of screen to copy to other pages
// end_line -- Ending line " " " " " " " "
//
typedef struct
{
char FName[13];
char rep;
char ticdelay;
unsigned long MaxMemBuffer;
short start_line;
short end_line;
memptr palette;
} MovieStuff_t;
//=========================================================================
//
// EXTERNS
//
//=========================================================================
extern memptr displaybuffer;
extern MovieStuff_t Movies[];
//===========================================================================
//
// Prototypes
//
//===========================================================================
void MOVIE_ShowFrame (char huge *inpic);
boolean MOVIE_Play(MovieStuff_t *MovieStuff);
void SetupMovie(MovieStuff_t *MovieStuff);
void ShutdownMovie(void);
#endif

48
MUNGE.C Normal file
View file

@ -0,0 +1,48 @@
/*
=================
=
= VL_MungePic
=
=================
*/
void VL_MungePic (unsigned char far *source, unsigned width, unsigned height)
{
unsigned x,y,plane,size,pwidth;
unsigned char far *temp, far *dest, far *srcline;
size = width*height;
if (width&3)
errout ("VL_MungePic: Not divisable by 4!\n");
//
// copy the pic to a temp buffer
//
temp = (unsigned char far *)farmalloc (size);
if (!temp)
errout ("Non enough memory for munge buffer!\n");
_fmemcpy (temp,source,size);
//
// munge it back into the original buffer
//
dest = source;
pwidth = width/4;
for (plane=0;plane<4;plane++)
{
srcline = temp;
for (y=0;y<height;y++)
{
for (x=0;x<pwidth;x++)
*dest++ = *(srcline+x*4+plane);
srcline+=width;
}
}
free (temp);
}

109
RND.ASM Normal file
View file

@ -0,0 +1,109 @@
;**************************************************************************
;
; This code was taken from FRED FISH 20. - Michael D. Maynard
;
; 11-Jan-92 - MDM - C entry points changed to use registers specified
; by Lattice's __asm keyword.
;
;**************************************************************************
IDNT "RND"
XDEF RandomSeed,Random ;assembler entry points
XDEF _RandomSeed,_Random ;C entry points
;=============================================================================
; NAME
; RandomSeed - seed random number generator, call once at beginning of
; your program. CurrentTime provides useful values for this
;
; SYSNOPSIS
; RandomSeed( SeedValue )
; D0
;
; FUNCTION
; Seeds the random number generator
;
; INPUTS
; SeedValue - a longword containing any value you like
;
; RESULT
; Random number generator is initialised
;
; BUGS/LIMITATIONS
; None that I know of
;
; SEE ALSO
;
;============================================================================
;_RandomSeed MOVE.L 4(SP),D0 ;entry point for C functions
_RandomSeed
RandomSeed ADD.L D0,D1 ;user seed in d0 (d1 too)
MOVEM.L D0/D1,RND
; drops through to the main random function (not user callable)
LongRnd MOVEM.L D2-D3,-(SP)
MOVEM.L RND,D0/D1 ;D0=LSB's, D1=MSB's of random number
ANDI.B #$0E,D0 ;ensure upper 59 bits are an...
ORI.B #$20,D0 ;...odd binary number
MOVE.L D0,D2
MOVE.L D1,D3
ADD.L D2,D2 ;accounts for 1 of 17 left shifts
ADDX.L D3,D3 ;[D2/D3] = RND*2
ADD.L D2,D0
ADDX.L D3,D1 ;[D0/D1] = RND*3
SWAP D3 ;shift [D2/D3] additional 16 times
SWAP D2
MOVE.W D2,D3
CLR.W D2
ADD.L D2,D0 ;add to [D0/D1]
ADDX.L D3,D1
MOVEM.L D0/D1,RND ;save for next time through
MOVE.L D1,D0 ;most random part to D0
MOVEM.L (SP)+,D2-D3
RTS
;=============================================================================
; NAME
; Random - returns a random integer in the specified range
;
; SYSNOPSIS
; RndNum = Random( UpperLimit )
; D0 D0
;
; FUNCTION
; returns a random integer in the range 0 to UpperLimit-1
;
; INPUTS
; UpperLimit - a long(or short will do) in the range 1-65535
;
; RESULT
; a random integer is returned to you, real quick!
;
; BUGS/LIMITATIONS
; range was limited to 1-65535 to avoid problems with the DIVU instruction
; which can return real wierd values if the result is larger than 16 bits.
;
; SEE ALSO
;
;============================================================================
;_Random MOVE.L 4(SP),D0 ;C entry point
_Random
Random MOVE.W D2,-(SP)
MOVE.W D0,D2 ;save upper limit
BEQ.S 10$ ;range of 0 returns 0 always
BSR.S LongRnd ;get a longword random number
CLR.W D0 ;use upper word (it's most random)
SWAP D0
DIVU.W D2,D0 ;divide by range...
CLR.W D0 ;...and use remainder for the value
SWAP D0 ;result in D0.W
10$ MOVE.W (SP)+,D2
RTS
RND DS.L 2 ;random number

156
SCALE.ASM Normal file
View file

@ -0,0 +1,156 @@
.386C
IDEAL
MODEL MEDIUM,C
SCREENWIDTH = 80
DATASEG
EXTRN dc_length:WORD
EXTRN dc_iscale:DWORD
EXTRN dc_frac:DWORD
EXTRN dc_source:WORD
EXTRN dc_dest:WORD
EXTRN dc_seg:WORD
EXTRN shadingtable:DWORD
codeseg
;================
;
; R_DrawColumn
;
;================
PROC R_DrawColumn
PUBLIC R_DrawColumn
push ebp
push esi
push edi
mov ax,[dc_seg]
mov fs,ax
mov ax,0a000h
mov es,ax
mov cx,[dc_length]
mov si,[dc_source]
mov di,[dc_dest]
mov eax,[dc_iscale]
mov [DWORD PTR cs:patch1+3],eax
mov ebp,[dc_frac]
pixelloop:
mov ebx,ebp ; begin calculating first pixel
shr ebx,16
patch1:
add ebp,12345678h ; advance frac pointer
mov al,[fs:si+bx]
mov [es:di],al
add di,SCREENWIDTH
dec cx
jnz pixelloop
done:
pop edi
pop esi
pop ebp
ret
ENDP R_DrawColumn
;================
;
; R_DrawSLSColumn
;
;================
PROC R_DrawSLSColumn
PUBLIC R_DrawSLSColumn
push ebp
push esi
push edi
mov ax,[WORD shadingtable + 2]
mov gs,ax
mov ax,0a000h
mov es,ax
mov cx,[dc_length]
mov di,[dc_dest]
spixelloopls:
mov al,[es:di]
mov bx,[WORD shadingtable]
mov bl,al
add bh,10
cmp bh,62
jle okshade
mov bh,62
okshade:
mov al,[gs:bx]
mov [es:di],al
add di,SCREENWIDTH
dec cx
jnz spixelloopls
sdonels:
pop edi
pop esi
pop ebp
ret
ENDP R_DrawSLSColumn
;================
;
; R_DrawLSColumn
;
;================
PROC R_DrawLSColumn
PUBLIC R_DrawLSColumn
push ebp
push esi
push edi
mov ax,[dc_seg]
mov fs,ax
mov ax,[WORD shadingtable + 2]
mov gs,ax
mov ax,0a000h
mov es,ax
mov cx,[dc_length]
mov si,[dc_source]
mov di,[dc_dest]
mov eax,[dc_iscale]
mov [DWORD PTR cs:patch1ls+3],eax
mov ebp,[dc_frac]
pixelloopls:
mov ebx,ebp ; begin calculating first pixel
shr ebx,16
patch1ls:
add ebp,12345678h ; advance frac pointer
mov al,[fs:si+bx]
mov bx,[WORD shadingtable]
mov bl,al
mov al,[gs:bx]
mov [es:di],al
add di,SCREENWIDTH
dec cx
jnz pixelloopls
donels:
pop edi
pop esi
pop ebp
ret
ENDP R_DrawLSColumn
END

41
WAITVBL.ASM Normal file
View file

@ -0,0 +1,41 @@
;
; WaitVBL
; Wait for the vertical retrace (returns before the actual vertical sync)
; By Jason Blochowiak
;
PROC WaitVBL num:WORD
PUBLIC WaitVBL
@@wait:
mov dx,status_Reg1
mov bl,8 ; test VBL
mov bh,1 ; test DE
@@waitno:
in al,dx
test al,bl ; VBL?
jnz @@waitno ; Yep, keep waiting
mov cx,400 ; for 320x200 mode (200 lines are double-scanned)
@@waityes:
in al, dx
test al,bl ; VBL?
jnz @@done ; Yep, we're done
test al,bh ; No. Display enabled?
jz @@waityes ; Yes, keep checking
@@waitenable:
in al,dx ; No, wait for Display not enabled or VBL
test al,bl ; VBL?
jnz @@done ; Yep, done
test al,bh ; No. Display enabled?
jnz @@waitenable ; No, keep waiting
dec cx ; DE toggled state - decrement line abort count
jnz @@waityes ; If 0, we missed the VBL, so drop out,
; otherwise, go back to waiting for the VBL
@@done:
dec [num] ; wait multiple VBLs?
jnz @@wait
ret
ENDP