as released 1995-07-21

This commit is contained in:
archive 1995-07-21 00:00:00 +00:00
commit c8940ef65f
107 changed files with 48051 additions and 0 deletions

142
AUDIOSDM.H Normal file
View file

@ -0,0 +1,142 @@
/////////////////////////////////////////////////
//
// MUSE Header for .SDM
// Created Thu Aug 27 07:12:39 1992
//
/////////////////////////////////////////////////
#define NUMSOUNDS 81
#define NUMSNDCHUNKS 267
//
// Sound names & indexes
//
typedef enum {
HITWALLSND, // 0
MISSILEHITSND, // 1
SELECTITEMSND, // 2
GHOSTSIGHTSND, // 3
MOVEGUN2SND, // 4
MOVEGUN1SND, // 5
NOWAYSND, // 6
NAZIHITPLAYERSND, // 7
MISSILEFIRESND, // 8
PLAYERDEATHSND, // 9
DOGDEATHSND, // 10
ATKGATLINGSND, // 11
GETKEYSND, // 12
NOITEMSND, // 13
WALK1SND, // 14
WALK2SND, // 15
TAKEDAMAGESND, // 16
GAMEOVERSND, // 17
OPENDOORSND, // 18
CLOSEDOORSND, // 19
DONOTHINGSND, // 20
HALTSND, // 21
DEATHSCREAM2SND, // 22
ATKKNIFESND, // 23
ATKPISTOLSND, // 24
DEATHSCREAM3SND, // 25
ATKMACHINEGUNSND, // 26
HITENEMYSND, // 27
SHOOTDOORSND, // 28
DEATHSCREAM1SND, // 29
GETMACHINESND, // 30
GETAMMOSND, // 31
SHOOTSND, // 32
HEALTH1SND, // 33
HEALTH2SND, // 34
BONUS1SND, // 35
BONUS2SND, // 36
BONUS3SND, // 37
GETGATLINGSND, // 38
ESCPRESSEDSND, // 39
LEVELDONESND, // 40
DOGBARKSND, // 41
ENDBONUS1SND, // 42
ENDBONUS2SND, // 43
BONUS1UPSND, // 44
BONUS4SND, // 45
PUSHWALLSND, // 46
NOBONUSSND, // 47
PERCENT100SND, // 48
BOSSACTIVESND, // 49
DEATHSCREAM4SND, // 50
SCHUTZADSND, // 51
AHHHGSND, // 52
DEATHSCREAM5SND, // 53
DEATHSCREAM7SND, // 54
DEATHSCREAM8SND, // 55
LEBENSND, // 56
DEATHSCREAM6SND, // 57
NAZIFIRESND, // 58
BOSSFIRESND, // 59
SSFIRESND, // 60
SLURPIESND, // 61
GHOSTFADESND, // 62
DEATHSCREAM9SND, // 63
GETAMMOBOXSND, // 64
ANGELSIGHTSND, // 65
SPIONSND, // 66
NEINSOVASSND, // 67
DOGATTACKSND, // 68
ANGELFIRESND, // 69
TRANSSIGHTSND, // 70
TRANSDEATHSND, // 71
WILHELMSIGHTSND, // 72
WILHELMDEATHSND, // 73
UBERDEATHSND, // 74
KNIGHTSIGHTSND, // 75
KNIGHTDEATHSND, // 76
ANGELDEATHSND, // 77
KNIGHTMISSILESND, // 78
GETSPEARSND, // 79
ANGELTIREDSND, // 80
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 81
#define STARTDIGISOUNDS 162
#define STARTMUSIC 243
//
// Music names & indexes
//
typedef enum {
XFUNKIE_MUS, // 0
DUNGEON_MUS, // 1
XDEATH_MUS, // 2
GETTHEM_MUS, // 3
XTIPTOE_MUS, // 4
GOINGAFT_MUS, // 5
URAHERO_MUS, // 6
XTHEEND_MUS, // 7
NAZI_OMI_MUS, // 8
POW_MUS, // 9
TWELFTH_MUS, // 10
SEARCHN_MUS, // 11
SUSPENSE_MUS, // 12
ZEROHOUR_MUS, // 13
WONDERIN_MUS, // 14
ULTIMATE_MUS, // 15
ENDLEVEL_MUS, // 16
XEVIL_MUS, // 17
XJAZNAZI_MUS, // 18
COPYPRO_MUS, // 19
XAWARD_MUS, // 20
XPUTIT_MUS, // 21
XGETYOU_MUS, // 22
XTOWER2_MUS, // 23
LASTMUSIC
} musicnames;
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////

142
AUDIOSOD.H Normal file
View file

@ -0,0 +1,142 @@
/////////////////////////////////////////////////
//
// MUSE Header for .SOD
// Created Thu Aug 13 09:25:58 1992
//
/////////////////////////////////////////////////
#define NUMSOUNDS 81
#define NUMSNDCHUNKS 267
//
// Sound names & indexes
//
typedef enum {
HITWALLSND, // 0
MISSILEHITSND, // 1
SELECTITEMSND, // 2
GHOSTSIGHTSND, // 3
MOVEGUN2SND, // 4
MOVEGUN1SND, // 5
NOWAYSND, // 6
NAZIHITPLAYERSND, // 7
MISSILEFIRESND, // 8
PLAYERDEATHSND, // 9
DOGDEATHSND, // 10
ATKGATLINGSND, // 11
GETKEYSND, // 12
NOITEMSND, // 13
WALK1SND, // 14
WALK2SND, // 15
TAKEDAMAGESND, // 16
GAMEOVERSND, // 17
OPENDOORSND, // 18
CLOSEDOORSND, // 19
DONOTHINGSND, // 20
HALTSND, // 21
DEATHSCREAM2SND, // 22
ATKKNIFESND, // 23
ATKPISTOLSND, // 24
DEATHSCREAM3SND, // 25
ATKMACHINEGUNSND, // 26
HITENEMYSND, // 27
SHOOTDOORSND, // 28
DEATHSCREAM1SND, // 29
GETMACHINESND, // 30
GETAMMOSND, // 31
SHOOTSND, // 32
HEALTH1SND, // 33
HEALTH2SND, // 34
BONUS1SND, // 35
BONUS2SND, // 36
BONUS3SND, // 37
GETGATLINGSND, // 38
ESCPRESSEDSND, // 39
LEVELDONESND, // 40
DOGBARKSND, // 41
ENDBONUS1SND, // 42
ENDBONUS2SND, // 43
BONUS1UPSND, // 44
BONUS4SND, // 45
PUSHWALLSND, // 46
NOBONUSSND, // 47
PERCENT100SND, // 48
BOSSACTIVESND, // 49
DEATHSCREAM4SND, // 50
SCHUTZADSND, // 51
AHHHGSND, // 52
DEATHSCREAM5SND, // 53
DEATHSCREAM7SND, // 54
DEATHSCREAM8SND, // 55
LEBENSND, // 56
DEATHSCREAM6SND, // 57
NAZIFIRESND, // 58
BOSSFIRESND, // 59
SSFIRESND, // 60
SLURPIESND, // 61
GHOSTFADESND, // 62
DEATHSCREAM9SND, // 63
GETAMMOBOXSND, // 64
ANGELSIGHTSND, // 65
SPIONSND, // 66
NEINSOVASSND, // 67
DOGATTACKSND, // 68
ANGELFIRESND, // 69
TRANSSIGHTSND, // 70
TRANSDEATHSND, // 71
WILHELMSIGHTSND, // 72
WILHELMDEATHSND, // 73
UBERDEATHSND, // 74
KNIGHTSIGHTSND, // 75
KNIGHTDEATHSND, // 76
ANGELDEATHSND, // 77
KNIGHTMISSILESND, // 78
GETSPEARSND, // 79
ANGELTIREDSND, // 80
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 81
#define STARTDIGISOUNDS 162
#define STARTMUSIC 243
//
// Music names & indexes
//
typedef enum {
XFUNKIE_MUS, // 0
DUNGEON_MUS, // 1
XDEATH_MUS, // 2
GETTHEM_MUS, // 3
XTIPTOE_MUS, // 4
GOINGAFT_MUS, // 5
URAHERO_MUS, // 6
XTHEEND_MUS, // 7
NAZI_OMI_MUS, // 8
POW_MUS, // 9
TWELFTH_MUS, // 10
SEARCHN_MUS, // 11
SUSPENSE_MUS, // 12
ZEROHOUR_MUS, // 13
WONDERIN_MUS, // 14
ULTIMATE_MUS, // 15
ENDLEVEL_MUS, // 16
XEVIL_MUS, // 17
XJAZNAZI_MUS, // 18
COPYPRO_MUS, // 19
XAWARD_MUS, // 20
XPUTIT_MUS, // 21
XGETYOU_MUS, // 22
XTOWER2_MUS, // 23
LASTMUSIC
} musicnames;
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////

133
AUDIOWL1.H Normal file
View file

@ -0,0 +1,133 @@
/////////////////////////////////////////////////
//
// MUSE Header for .WL1
// Created Tue Apr 28 23:57:08 1992
//
/////////////////////////////////////////////////
#define NUMSOUNDS 69
#define NUMSNDCHUNKS 234
//
// Sound names & indexes
//
typedef enum {
HITWALLSND, // 0
SELECTWPNSND, // 1
SELECTITEMSND, // 2
HEARTBEATSND, // 3
MOVEGUN2SND, // 4
MOVEGUN1SND, // 5
NOWAYSND, // 6
NAZIHITPLAYERSND, // 7
NAZIMISSSND, // 8
PLAYERDEATHSND, // 9
DOGDEATHSND, // 10
ATKGATLINGSND, // 11
GETKEYSND, // 12
NOITEMSND, // 13
WALK1SND, // 14
WALK2SND, // 15
TAKEDAMAGESND, // 16
GAMEOVERSND, // 17
OPENDOORSND, // 18
CLOSEDOORSND, // 19
DONOTHINGSND, // 20
HALTSND, // 21
DEATHSCREAM2SND, // 22
ATKKNIFESND, // 23
ATKPISTOLSND, // 24
DEATHSCREAM3SND, // 25
ATKMACHINEGUNSND, // 26
HITENEMYSND, // 27
SHOOTDOORSND, // 28
DEATHSCREAM1SND, // 29
GETMACHINESND, // 30
GETAMMOSND, // 31
SHOOTSND, // 32
HEALTH1SND, // 33
HEALTH2SND, // 34
BONUS1SND, // 35
BONUS2SND, // 36
BONUS3SND, // 37
GETGATLINGSND, // 38
ESCPRESSEDSND, // 39
LEVELDONESND, // 40
DOGBARKSND, // 41
ENDBONUS1SND, // 42
ENDBONUS2SND, // 43
BONUS1UPSND, // 44
BONUS4SND, // 45
PUSHWALLSND, // 46
NOBONUSSND, // 47
PERCENT100SND, // 48
BOSSACTIVESND, // 49
BOSSDIESSND, // 50
SCHUTZADSND, // 51
AHHHGSND, // 52
DIESND, // 53
EVASND, // 54
GUTENTAGSND, // 55
LEBENSND, // 56
MUTTISND, // 57
NAZIFIRESND, // 58
BOSSFIRESND, // 59
SSFIRESND, // 60
SLURPIESND, // 61
TOT_HUNDSND, // 62
MEINGOTTSND, // 63
SCHABBSHASND, // 64
HILTERHASND, // 65
SPIONSND, // 66
NEINSOVASSND, // 67
DOGATTACKSND, // 68
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 69
#define STARTDIGISOUNDS 138
#define STARTMUSIC 207
//
// Music names & indexes
//
typedef enum {
CORNER_MUS, // 0
DUNGEON_MUS, // 1
GETOUT_MUS, // 2
GETTHEM_MUS, // 3
HEADACHE_MUS, // 4
HITLWLTZ_MUS, // 5
INTROCW3_MUS, // 6
NAZI_NOR_MUS, // 7
NAZI_OMI_MUS, // 8
POW_MUS, // 9
SALUTE_MUS, // 10
SEARCHN_MUS, // 11
SUSPENSE_MUS, // 12
VICTORS_MUS, // 13
WONDERIN_MUS, // 14
FUNKYOU_MUS, // 15
ENDLEVEL_MUS, // 16
GOINGAFT_MUS, // 17
PREGNANT_MUS, // 18
ULTIMATE_MUS, // 19
NAZI_RAP_MUS, // 20
ZEROHOUR_MUS, // 21
TWELFTH_MUS, // 22
ROSTER_MUS, // 23
URAHERO_MUS, // 24
VICMARCH_MUS, // 25
WARMRCH1_MUS, // 26
LASTMUSIC
} musicnames;
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////

151
AUDIOWL6.H Normal file
View file

@ -0,0 +1,151 @@
/////////////////////////////////////////////////
//
// MUSE Header for .WL6
// Created Tue Jul 14 15:04:53 1992
//
/////////////////////////////////////////////////
#define NUMSOUNDS 87
#define NUMSNDCHUNKS 288
//
// Sound names & indexes
//
typedef enum {
HITWALLSND, // 0
SELECTWPNSND, // 1
SELECTITEMSND, // 2
HEARTBEATSND, // 3
MOVEGUN2SND, // 4
MOVEGUN1SND, // 5
NOWAYSND, // 6
NAZIHITPLAYERSND, // 7
SCHABBSTHROWSND, // 8
PLAYERDEATHSND, // 9
DOGDEATHSND, // 10
ATKGATLINGSND, // 11
GETKEYSND, // 12
NOITEMSND, // 13
WALK1SND, // 14
WALK2SND, // 15
TAKEDAMAGESND, // 16
GAMEOVERSND, // 17
OPENDOORSND, // 18
CLOSEDOORSND, // 19
DONOTHINGSND, // 20
HALTSND, // 21
DEATHSCREAM2SND, // 22
ATKKNIFESND, // 23
ATKPISTOLSND, // 24
DEATHSCREAM3SND, // 25
ATKMACHINEGUNSND, // 26
HITENEMYSND, // 27
SHOOTDOORSND, // 28
DEATHSCREAM1SND, // 29
GETMACHINESND, // 30
GETAMMOSND, // 31
SHOOTSND, // 32
HEALTH1SND, // 33
HEALTH2SND, // 34
BONUS1SND, // 35
BONUS2SND, // 36
BONUS3SND, // 37
GETGATLINGSND, // 38
ESCPRESSEDSND, // 39
LEVELDONESND, // 40
DOGBARKSND, // 41
ENDBONUS1SND, // 42
ENDBONUS2SND, // 43
BONUS1UPSND, // 44
BONUS4SND, // 45
PUSHWALLSND, // 46
NOBONUSSND, // 47
PERCENT100SND, // 48
BOSSACTIVESND, // 49
MUTTISND, // 50
SCHUTZADSND, // 51
AHHHGSND, // 52
DIESND, // 53
EVASND, // 54
GUTENTAGSND, // 55
LEBENSND, // 56
SCHEISTSND, // 57
NAZIFIRESND, // 58
BOSSFIRESND, // 59
SSFIRESND, // 60
SLURPIESND, // 61
TOT_HUNDSND, // 62
MEINGOTTSND, // 63
SCHABBSHASND, // 64
HITLERHASND, // 65
SPIONSND, // 66
NEINSOVASSND, // 67
DOGATTACKSND, // 68
FLAMETHROWERSND, // 69
MECHSTEPSND, // 70
GOOBSSND, // 71
YEAHSND, // 72
DEATHSCREAM4SND, // 73
DEATHSCREAM5SND, // 74
DEATHSCREAM6SND, // 75
DEATHSCREAM7SND, // 76
DEATHSCREAM8SND, // 77
DEATHSCREAM9SND, // 78
DONNERSND, // 79
EINESND, // 80
ERLAUBENSND, // 81
KEINSND, // 82
MEINSND, // 83
ROSESND, // 84
MISSILEFIRESND, // 85
MISSILEHITSND, // 86
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 87
#define STARTDIGISOUNDS 174
#define STARTMUSIC 261
//
// Music names & indexes
//
typedef enum {
CORNER_MUS, // 0
DUNGEON_MUS, // 1
WARMARCH_MUS, // 2
GETTHEM_MUS, // 3
HEADACHE_MUS, // 4
HITLWLTZ_MUS, // 5
INTROCW3_MUS, // 6
NAZI_NOR_MUS, // 7
NAZI_OMI_MUS, // 8
POW_MUS, // 9
SALUTE_MUS, // 10
SEARCHN_MUS, // 11
SUSPENSE_MUS, // 12
VICTORS_MUS, // 13
WONDERIN_MUS, // 14
FUNKYOU_MUS, // 15
ENDLEVEL_MUS, // 16
GOINGAFT_MUS, // 17
PREGNANT_MUS, // 18
ULTIMATE_MUS, // 19
NAZI_RAP_MUS, // 20
ZEROHOUR_MUS, // 21
TWELFTH_MUS, // 22
ROSTER_MUS, // 23
URAHERO_MUS, // 24
VICMARCH_MUS, // 25
PACMAN_MUS, // 26
LASTMUSIC
} musicnames;
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////

142
BUDIOSOD.H Normal file
View file

@ -0,0 +1,142 @@
/////////////////////////////////////////////////
//
// MUSE Header for .SOD
// Created Thu Aug 13 09:25:58 1992
//
/////////////////////////////////////////////////
#define NUMSOUNDS 81
#define NUMSNDCHUNKS 267
//
// Sound names & indexes
//
typedef enum {
HITWALLSND, // 0
MISSILEHITSND, // 1
SELECTITEMSND, // 2
GHOSTSIGHTSND, // 3
MOVEGUN2SND, // 4
MOVEGUN1SND, // 5
NOWAYSND, // 6
NAZIHITPLAYERSND, // 7
MISSILEFIRESND, // 8
PLAYERDEATHSND, // 9
DOGDEATHSND, // 10
ATKGATLINGSND, // 11
GETKEYSND, // 12
NOITEMSND, // 13
WALK1SND, // 14
WALK2SND, // 15
TAKEDAMAGESND, // 16
GAMEOVERSND, // 17
OPENDOORSND, // 18
CLOSEDOORSND, // 19
DONOTHINGSND, // 20
HALTSND, // 21
DEATHSCREAM2SND, // 22
ATKKNIFESND, // 23
ATKPISTOLSND, // 24
DEATHSCREAM3SND, // 25
ATKMACHINEGUNSND, // 26
HITENEMYSND, // 27
SHOOTDOORSND, // 28
DEATHSCREAM1SND, // 29
GETMACHINESND, // 30
GETAMMOSND, // 31
SHOOTSND, // 32
HEALTH1SND, // 33
HEALTH2SND, // 34
BONUS1SND, // 35
BONUS2SND, // 36
BONUS3SND, // 37
GETGATLINGSND, // 38
ESCPRESSEDSND, // 39
LEVELDONESND, // 40
DOGBARKSND, // 41
ENDBONUS1SND, // 42
ENDBONUS2SND, // 43
BONUS1UPSND, // 44
BONUS4SND, // 45
PUSHWALLSND, // 46
NOBONUSSND, // 47
PERCENT100SND, // 48
BOSSACTIVESND, // 49
DEATHSCREAM4SND, // 50
SCHUTZADSND, // 51
AHHHGSND, // 52
DEATHSCREAM5SND, // 53
DEATHSCREAM7SND, // 54
DEATHSCREAM8SND, // 55
LEBENSND, // 56
DEATHSCREAM6SND, // 57
NAZIFIRESND, // 58
BOSSFIRESND, // 59
SSFIRESND, // 60
SLURPIESND, // 61
GHOSTFADESND, // 62
DEATHSCREAM9SND, // 63
GETAMMOBOXSND, // 64
ANGELSIGHTSND, // 65
SPIONSND, // 66
NEINSOVASSND, // 67
DOGATTACKSND, // 68
ANGELFIRESND, // 69
TRANSSIGHTSND, // 70
TRANSDEATHSND, // 71
WILHELMSIGHTSND, // 72
WILHELMDEATHSND, // 73
UBERDEATHSND, // 74
KNIGHTSIGHTSND, // 75
KNIGHTDEATHSND, // 76
ANGELDEATHSND, // 77
KNIGHTMISSILESND, // 78
GETSPEARSND, // 79
ANGELTIREDSND, // 80
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 81
#define STARTDIGISOUNDS 162
#define STARTMUSIC 243
//
// Music names & indexes
//
typedef enum {
XFUNKIE_MUS, // 0
DUNGEON_MUS, // 1
XDEATH_MUS, // 2
GETTHEM_MUS, // 3
XTIPTOE_MUS, // 4
GOINGAFT_MUS, // 5
URAHERO_MUS, // 6
XTHEEND_MUS, // 7
NAZI_OMI_MUS, // 8
POW_MUS, // 9
TWELFTH_MUS, // 10
SEARCHN_MUS, // 11
SUSPENSE_MUS, // 12
ZEROHOUR_MUS, // 13
WONDERIN_MUS, // 14
ULTIMATE_MUS, // 15
ENDLEVEL_MUS, // 16
XEVIL_MUS, // 17
XJAZNAZI_MUS, // 18
COPYPRO_MUS, // 19
XAWARD_MUS, // 20
XPUTIT_MUS, // 21
XGETYOU_MUS, // 22
XTOWER2_MUS, // 23
LASTMUSIC
} musicnames;
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////

151
BUDIOWL6.H Normal file
View file

@ -0,0 +1,151 @@
/////////////////////////////////////////////////
//
// MUSE Header for .WL6
// Created Sat May 30 18:41:31 1992
//
/////////////////////////////////////////////////
#define NUMSOUNDS 87
#define NUMSNDCHUNKS 288
//
// Sound names & indexes
//
typedef enum {
HITWALLSND, // 0
SELECTWPNSND, // 1
SELECTITEMSND, // 2
HEARTBEATSND, // 3
MOVEGUN2SND, // 4
MOVEGUN1SND, // 5
NOWAYSND, // 6
NAZIHITPLAYERSND, // 7
SCHABBSTHROWSND, // 8
PLAYERDEATHSND, // 9
DOGDEATHSND, // 10
ATKGATLINGSND, // 11
GETKEYSND, // 12
NOITEMSND, // 13
WALK1SND, // 14
WALK2SND, // 15
TAKEDAMAGESND, // 16
GAMEOVERSND, // 17
OPENDOORSND, // 18
CLOSEDOORSND, // 19
DONOTHINGSND, // 20
HALTSND, // 21
DEATHSCREAM2SND, // 22
ATKKNIFESND, // 23
ATKPISTOLSND, // 24
DEATHSCREAM3SND, // 25
ATKMACHINEGUNSND, // 26
HITENEMYSND, // 27
SHOOTDOORSND, // 28
DEATHSCREAM1SND, // 29
GETMACHINESND, // 30
GETAMMOSND, // 31
SHOOTSND, // 32
HEALTH1SND, // 33
HEALTH2SND, // 34
BONUS1SND, // 35
BONUS2SND, // 36
BONUS3SND, // 37
GETGATLINGSND, // 38
ESCPRESSEDSND, // 39
LEVELDONESND, // 40
DOGBARKSND, // 41
ENDBONUS1SND, // 42
ENDBONUS2SND, // 43
BONUS1UPSND, // 44
BONUS4SND, // 45
PUSHWALLSND, // 46
NOBONUSSND, // 47
PERCENT100SND, // 48
BOSSACTIVESND, // 49
MUTTISND, // 50
SCHUTZADSND, // 51
AHHHGSND, // 52
DIESND, // 53
EVASND, // 54
GUTENTAGSND, // 55
LEBENSND, // 56
SCHEISTSND, // 57
NAZIFIRESND, // 58
BOSSFIRESND, // 59
SSFIRESND, // 60
SLURPIESND, // 61
TOT_HUNDSND, // 62
MEINGOTTSND, // 63
SCHABBSHASND, // 64
HITLERHASND, // 65
SPIONSND, // 66
NEINSOVASSND, // 67
DOGATTACKSND, // 68
FLAMETHROWERSND, // 69
MECHSTEPSND, // 70
GOOBSSND, // 71
YEAHSND, // 72
DEATHSCREAM4SND, // 73
DEATHSCREAM5SND, // 74
DEATHSCREAM6SND, // 75
DEATHSCREAM7SND, // 76
DEATHSCREAM8SND, // 77
DEATHSCREAM9SND, // 78
DONNERSND, // 79
EINESND, // 80
ERLAUBENSND, // 81
KEINSND, // 82
MEINSND, // 83
ROSESND, // 84
MISSILEFIRESND, // 85
MISSILEHITSND, // 86
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS 87
#define STARTDIGISOUNDS 174
#define STARTMUSIC 261
//
// Music names & indexes
//
typedef enum {
CORNER_MUS, // 0
DUNGEON_MUS, // 1
WARMARCH_MUS, // 2
GETTHEM_MUS, // 3
HEADACHE_MUS, // 4
HITLWLTZ_MUS, // 5
INTROCW3_MUS, // 6
NAZI_NOR_MUS, // 7
NAZI_OMI_MUS, // 8
POW_MUS, // 9
SALUTE_MUS, // 10
SEARCHN_MUS, // 11
SUSPENSE_MUS, // 12
VICTORS_MUS, // 13
WONDERIN_MUS, // 14
FUNKYOU_MUS, // 15
ENDLEVEL_MUS, // 16
GOINGAFT_MUS, // 17
PREGNANT_MUS, // 18
ULTIMATE_MUS, // 19
NAZI_RAP_MUS, // 20
ZEROHOUR_MUS, // 21
TWELFTH_MUS, // 22
ROSTER_MUS, // 23
URAHERO_MUS, // 24
VICMARCH_MUS, // 25
PACMAN_MUS, // 26
LASTMUSIC
} musicnames;
/////////////////////////////////////////////////
//
// Thanks for playing with MUSE!
//
/////////////////////////////////////////////////

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

733
CONTIGSC.C Normal file
View file

@ -0,0 +1,733 @@
// WL_SCALE.C
#include "WL_DEF.H"
#pragma hdrstop
#define OP_RETF 0xcb
/*
=============================================================================
GLOBALS
=============================================================================
*/
t_compscale far *scaledirectory[MAXSCALEHEIGHT+1];
long fullscalefarcall[MAXSCALEHEIGHT+1];
int maxscale,maxscaleshl2;
byte far *scalermemory;
byte _seg *endscalermemory;
long freescalermemory;
/*
=============================================================================
LOCALS
=============================================================================
*/
unsigned BuildCompScale (int height, byte far *code);
int stepbytwo;
//===========================================================================
/*
==============
=
= BadScale
=
==============
*/
void far BadScale (void)
{
Quit ("BadScale called!");
}
/*
==========================
=
= SetupScaling
=
==========================
*/
long SetupScaling (int maxscaleheight)
{
int i,x,y;
byte far *dest;
unsigned seg,ofs;
long size;
maxscaleheight/=2; // one scaler every two pixels
maxscale = maxscaleheight-1;
maxscaleshl2 = maxscale<<2;
dest = scalermemory;
//
// build the compiled scalers
//
stepbytwo = viewheight/2; // save space by double stepping
for (i=1;i<=maxscaleheight;i++)
{
seg = FP_SEG(dest);
ofs = (FP_OFF(dest)+15)&~15;
dest = MK_FP(seg+ofs/16,0);
scaledirectory[i] = (t_compscale far *)dest;
size = BuildCompScale (i*2,dest);
dest += size;
if ((byte huge *)dest-(byte huge *)scalermemory > MAXSCALERMEMORY)
Quit ("Compiled scalars exceeded allocated space!");
if (i>=stepbytwo)
i+= 2;
}
//
// get far call addresses
//
for (i=1;i<=maxscaleheight;i++)
{
fullscalefarcall[i] = (long)scaledirectory[i] + scaledirectory[i]->codeofs[0];
if (i>=stepbytwo)
{
scaledirectory[i+1] = scaledirectory[i];
fullscalefarcall[i+1] = (long)scaledirectory[i] + scaledirectory[i]->codeofs[0];
scaledirectory[i+2] = scaledirectory[i];
fullscalefarcall[i+2] = (long)scaledirectory[i] + scaledirectory[i]->codeofs[0];
i+=2;
}
}
scaledirectory[0] = scaledirectory[1];
fullscalefarcall[0] = fullscalefarcall[1];
//
// check for oversize wall drawing
//
for (i=maxscaleheight;i<MAXSCALEHEIGHT;i++)
fullscalefarcall[i] = (long)BadScale;
seg = FP_SEG(dest);
ofs = (FP_OFF(dest)+15)&~15;
endscalermemory = (void _seg *)(seg+ofs/16);
size = (byte huge *)dest-(byte huge *)scalermemory;
freescalermemory = MAXSCALERMEMORY-16-size;
return size;
}
//===========================================================================
/*
========================
=
= 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
=
========================
*/
unsigned BuildCompScale (int height, byte far *code)
{
t_compscale far *work;
int i;
long fix,step;
unsigned src,totalscaled,totalsize;
int startpix,endpix,toppix;
work = (t_compscale far *)code;
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);
return totalsize;
}
/*
=======================
=
= ScaleLine
=
= linescale should have the high word set to the segment of the scaler
=
=======================
*/
extern int slinex,slinewidth;
extern unsigned far *linecmds;
extern long linescale;
extern unsigned maskword;
byte mask1,mask2,mask3;
void near ScaleLine (void)
{
asm mov cx,WORD PTR [linescale+2]
asm mov es,cx // segment of scaler
asm mov bp,WORD PTR [linecmds]
asm mov dx,SC_INDEX+1 // to set SC_MAPMASK
asm mov bx,[slinex]
asm mov di,bx
asm shr di,2 // X in bytes
asm add di,[bufferofs]
asm and bx,3
asm shl bx,3
asm add bx,[slinewidth] // bx = (pixel*8+pixwidth)
asm mov al,BYTE [mapmasks3-1+bx] // -1 because pixwidth of 1 is first
asm mov ds,WORD PTR [linecmds+2]
asm or al,al
asm jz notthreebyte // scale across three bytes
asm jmp threebyte
notthreebyte:
asm mov al,BYTE PTR ss:[mapmasks2-1+bx] // -1 because pixwidth of 1 is first
asm or al,al
asm jnz twobyte // scale across two bytes
//
// one byte scaling
//
asm mov al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first
asm out dx,al // set map mask register
scalesingle:
asm mov bx,[ds:bp] // table location of rtl to patch
asm or bx,bx
asm jz linedone // 0 signals end of segment list
asm mov bx,[es:bx]
asm mov dl,[es:bx] // save old value
asm mov BYTE PTR es:[bx],OP_RETF // patch a RETF in
asm mov si,[ds:bp+4] // table location of entry spot
asm mov ax,[es:si]
asm mov WORD PTR ss:[linescale],ax // call here to start scaling
asm mov si,[ds:bp+2] // corrected top of shape for this segment
asm add bp,6 // next segment list
asm mov ax,SCREENSEG
asm mov es,ax
asm call ss:[linescale] // scale the segment of pixels
asm mov es,cx // segment of scaler
asm mov BYTE PTR es:[bx],dl // unpatch the RETF
asm jmp scalesingle // do the next segment
//
// done
//
linedone:
asm mov ax,ss
asm mov ds,ax
return;
//
// two byte scaling
//
twobyte:
asm mov ss:[mask2],al
asm mov al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first
asm mov ss:[mask1],al
scaledouble:
asm mov bx,[ds:bp] // table location of rtl to patch
asm or bx,bx
asm jz linedone // 0 signals end of segment list
asm mov bx,[es:bx]
asm mov cl,[es:bx] // save old value
asm mov BYTE PTR es:[bx],OP_RETF // patch a RETF in
asm mov si,[ds:bp+4] // table location of entry spot
asm mov ax,[es:si]
asm mov WORD PTR ss:[linescale],ax // call here to start scaling
asm mov si,[ds:bp+2] // corrected top of shape for this segment
asm add bp,6 // next segment list
asm mov ax,SCREENSEG
asm mov es,ax
asm mov al,ss:[mask1]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm inc di
asm mov al,ss:[mask2]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm dec di
asm mov es,WORD PTR ss:[linescale+2] // segment of scaler
asm mov BYTE PTR es:[bx],cl // unpatch the RETF
asm jmp scaledouble // do the next segment
//
// three byte scaling
//
threebyte:
asm mov ss:[mask3],al
asm mov al,BYTE PTR ss:[mapmasks2-1+bx] // -1 because pixwidth of 1 is first
asm mov ss:[mask2],al
asm mov al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first
asm mov ss:[mask1],al
scaletriple:
asm mov bx,[ds:bp] // table location of rtl to patch
asm or bx,bx
asm jz linedone // 0 signals end of segment list
asm mov bx,[es:bx]
asm mov cl,[es:bx] // save old value
asm mov BYTE PTR es:[bx],OP_RETF // patch a RETF in
asm mov si,[ds:bp+4] // table location of entry spot
asm mov ax,[es:si]
asm mov WORD PTR ss:[linescale],ax // call here to start scaling
asm mov si,[ds:bp+2] // corrected top of shape for this segment
asm add bp,6 // next segment list
asm mov ax,SCREENSEG
asm mov es,ax
asm mov al,ss:[mask1]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm inc di
asm mov al,ss:[mask2]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm inc di
asm mov al,ss:[mask3]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm dec di
asm dec di
asm mov es,WORD PTR ss:[linescale+2] // segment of scaler
asm mov BYTE PTR es:[bx],cl // unpatch the RETF
asm jmp scaletriple // do the next segment
}
/*
=======================
=
= 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
=
=======================
*/
static long longtemp;
void ScaleShape (int xcenter, int shapenum, unsigned height)
{
t_compshape _seg *shape;
t_compscale far *comptable;
unsigned scale,srcx,stopx,tempx;
int t;
unsigned far *cmdptr;
boolean leftvis,rightvis;
shape = PM_GetSpritePage (shapenum);
scale = height>>3; // low three bits are fractional
if (!scale || scale>maxscale)
return; // too close or far away
comptable = scaledirectory[scale];
*(((unsigned *)&linescale)+1)=FP_SEG(comptable); // seg of far call
*(((unsigned *)&linecmds)+1)=(unsigned)shape; // seg of shape
//
// scale to the left (from pixel 31 to shape->leftpix)
//
srcx = 32;
slinex = xcenter;
stopx = shape->leftpix;
cmdptr = &shape->dataofs[31-stopx];
while ( --srcx >=stopx && slinex>0)
{
(unsigned)linecmds = *cmdptr--;
if ( !(slinewidth = comptable->width[srcx]) )
continue;
if (slinewidth == 1)
{
slinex--;
if (slinex<viewwidth)
{
if (wallheight[slinex] >= height)
continue; // obscured by closer wall
ScaleLine ();
}
continue;
}
//
// handle multi pixel lines
//
if (slinex>viewwidth)
{
slinex -= slinewidth;
slinewidth = viewwidth-slinex;
if (slinewidth<1)
continue; // still off the right side
}
else
{
if (slinewidth>slinex)
slinewidth = slinex;
slinex -= slinewidth;
}
leftvis = (wallheight[slinex] < height);
rightvis = (wallheight[slinex+slinewidth-1] < height);
if (leftvis)
{
if (rightvis)
ScaleLine ();
else
{
while (wallheight[slinex+slinewidth-1] >= height)
slinewidth--;
ScaleLine ();
}
}
else
{
if (!rightvis)
continue; // totally obscured
while (wallheight[slinex] >= height)
{
slinex++;
slinewidth--;
}
ScaleLine ();
break; // the rest of the shape is gone
}
}
//
// scale to the right
//
slinex = xcenter;
stopx = shape->rightpix;
if (shape->leftpix<31)
{
srcx = 31;
cmdptr = &shape->dataofs[32-shape->leftpix];
}
else
{
srcx = shape->leftpix-1;
cmdptr = &shape->dataofs[0];
}
slinewidth = 0;
while ( ++srcx <= stopx && (slinex+=slinewidth)<viewwidth)
{
(unsigned)linecmds = *cmdptr++;
if ( !(slinewidth = comptable->width[srcx]) )
continue;
if (slinewidth == 1)
{
if (slinex>=0 && wallheight[slinex] < height)
{
ScaleLine ();
}
continue;
}
//
// handle multi pixel lines
//
if (slinex<0)
{
if (slinewidth <= -slinex)
continue; // still off the left edge
slinewidth += slinex;
slinex = 0;
}
else
{
if (slinex + slinewidth > viewwidth)
slinewidth = viewwidth-slinex;
}
leftvis = (wallheight[slinex] < height);
rightvis = (wallheight[slinex+slinewidth-1] < height);
if (leftvis)
{
if (rightvis)
{
ScaleLine ();
}
else
{
while (wallheight[slinex+slinewidth-1] >= height)
slinewidth--;
ScaleLine ();
break; // the rest of the shape is gone
}
}
else
{
if (rightvis)
{
while (wallheight[slinex] >= height)
{
slinex++;
slinewidth--;
}
ScaleLine ();
}
else
continue; // totally obscured
}
}
}
/*
=======================
=
= 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;
t_compscale far *comptable;
unsigned scale,srcx,stopx,tempx;
int t;
unsigned far *cmdptr;
boolean leftvis,rightvis;
shape = PM_GetSpritePage (shapenum);
scale = height>>1;
comptable = scaledirectory[scale];
*(((unsigned *)&linescale)+1)=FP_SEG(comptable); // seg of far call
*(((unsigned *)&linecmds)+1)=(unsigned)shape; // seg of shape
//
// scale to the left (from pixel 31 to shape->leftpix)
//
srcx = 32;
slinex = xcenter;
stopx = shape->leftpix;
cmdptr = &shape->dataofs[31-stopx];
while ( --srcx >=stopx )
{
(unsigned)linecmds = *cmdptr--;
if ( !(slinewidth = comptable->width[srcx]) )
continue;
slinex -= slinewidth;
ScaleLine ();
}
//
// scale to the right
//
slinex = xcenter;
stopx = shape->rightpix;
if (shape->leftpix<31)
{
srcx = 31;
cmdptr = &shape->dataofs[32-shape->leftpix];
}
else
{
srcx = shape->leftpix-1;
cmdptr = &shape->dataofs[0];
}
slinewidth = 0;
while ( ++srcx <= stopx )
{
(unsigned)linecmds = *cmdptr++;
if ( !(slinewidth = comptable->width[srcx]) )
continue;
ScaleLine ();
slinex+=slinewidth;
}
}
//
// 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} };
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} };
int slinex,slinewidth;
unsigned far *linecmds;
long linescale;
unsigned maskword;

87
DETECT.C Normal file
View file

@ -0,0 +1,87 @@
///////////////////////////////////////////////////////////////////////////
//
// SDL_CheckSB() - Checks to see if a SoundBlaster resides at a
// particular I/O location
//
///////////////////////////////////////////////////////////////////////////
static boolean
SDL_CheckSB(int port)
{
int i;
sbLocation = port << 4; // Initialize stuff for later use
sbOut(sbReset,true); // Reset the SoundBlaster DSP
asm mov dx,0x388 // Wait >4usec
asm in al, dx
asm in al, dx
asm in al, dx
asm in al, dx
asm in al, dx
asm in al, dx
asm in al, dx
asm in al, dx
asm in al, dx
sbOut(sbReset,false); // Turn off sb DSP reset
asm mov dx,0x388 // Wait >100usec
asm mov cx,100
usecloop:
asm in al,dx
asm loop usecloop
for (i = 0;i < 100;i++)
{
if (sbIn(sbDataAvail) & 0x80) // If data is available...
{
if (sbIn(sbReadData) == 0xaa) // If it matches correct value
return(true);
else
{
sbLocation = -1; // Otherwise not a SoundBlaster
return(false);
}
}
}
sbLocation = -1; // Retry count exceeded - fail
return(false);
}
///////////////////////////////////////////////////////////////////////////
//
// Checks to see if a SoundBlaster is in the system. If the port passed is
// -1, then it scans through all possible I/O locations. If the port
// passed is 0, then it uses the default (2). If the port is >0, then
// it just passes it directly to SDL_CheckSB()
//
///////////////////////////////////////////////////////////////////////////
static boolean
SDL_DetectSoundBlaster(int port)
{
int i;
if (port == 0) // If user specifies default, use 2
port = 2;
if (port == -1)
{
if (SDL_CheckSB(2)) // Check default before scanning
return(true);
if (SDL_CheckSB(4)) // Check other SB Pro location before scan
return(true);
for (i = 1;i <= 6;i++) // Scan through possible SB locations
{
if ((i == 2) || (i == 4))
continue;
if (SDL_CheckSB(i)) // If found at this address,
return(true); // return success
}
return(false); // All addresses failed, return failure
}
else
return(SDL_CheckSB(port)); // User specified address or default
}


110
FOREIGN.H Normal file
View file

@ -0,0 +1,110 @@
#define QUITSUR "Are you sure you want\n"\
"to quit this great game?"
#define CURGAME "You are currently in\n"\
"a game. Continuing will\n"\
"erase old game. Ok?"
#define GAMESVD "There's already a game\n"\
"saved at this position.\n"\
" Overwrite?"
#define ENDGAMESTR "Are you sure you want\n"\
"to end the game you\n"\
"are playing? (Y or N):"
#define STR_NG "New Game"
#define STR_SD "Sound"
#define STR_CL "Control"
#define STR_LG "Load Game"
#define STR_SG "Save Game"
#define STR_CV "Change View"
#define STR_VS "View Scores"
#define STR_EG "End Game"
#define STR_BD "Back to Demo"
#define STR_QT "Quit"
#define STR_LOADING "Loading"
#define STR_SAVING "Saving"
#define STR_GAME "Game"
#define STR_DEMO "Demo"
#define STR_LGC "Load Game called\n\""
#define STR_EMPTY "empty"
#define STR_CALIB "Calibrate"
#define STR_JOYST "Joystick"
#define STR_MOVEJOY "Move joystick to\nupper left and\npress button 0\n"
#define STR_MOVEJOY2 "Move joystick to\nlower right and\npress button 1\n"
#define STR_ESCEXIT "ESC to exit"
#define STR_NONE "None"
#define STR_PC "PC Speaker"
#define STR_ALSB "AdLib/Sound Blaster"
#define STR_DISNEY "Disney Sound Source"
#define STR_SB "Sound Blaster"
#define STR_MOUSEEN "Mouse Enabled"
#define STR_JOYEN "Joystick Enabled"
#define STR_PORT2 "Use joystick port 2"
#define STR_GAMEPAD "Gravis GamePad Enabled"
#define STR_SENS "Mouse Sensitivity"
#define STR_CUSTOM "Customize controls"
#define STR_DADDY "Can I play, Daddy?"
#define STR_HURTME "Don't hurt me."
#define STR_BRINGEM "Bring 'em on!"
#define STR_DEATH "I am Death incarnate!"
#define STR_MOUSEADJ "Adjust Mouse Sensitivity"
#define STR_SLOW "Slow"
#define STR_FAST "Fast"
#define STR_CRUN "Run"
#define STR_COPEN "Open"
#define STR_CFIRE "Fire"
#define STR_CSTRAFE "Strafe"
#define STR_LEFT "Left"
#define STR_RIGHT "Right"
#define STR_FRWD "Frwd"
#define STR_BKWD "Bkwrd"
#define STR_THINK "Thinking"
#define STR_SIZE1 "Use arrows to size"
#define STR_SIZE2 "ENTER to accept"
#define STR_SIZE3 "ESC to cancel"
#define STR_YOUWIN "you win!"
#define STR_TOTALTIME "total time"
#define STR_RATKILL "kill %"
#define STR_RATSECRET "secret %"
#define STR_RATTREASURE "treasure %"
#define STR_BONUS "bonus"
#define STR_TIME "time"
#define STR_PAR " par"
#define STR_RAT2KILL "kill ratio %"
#define STR_RAT2SECRET "secret ratio %"
#define STR_RAT2TREASURE "treasure ratio %"
#define STR_DEFEATED "defeated!"
#define STR_CHEATER1 "You now have 100% Health,"
#define STR_CHEATER2 "99 Ammo and both Keys!"
#define STR_CHEATER3 "Note that you have basically"
#define STR_CHEATER4 "eliminated your chances of"
#define STR_CHEATER5 "getting a high score!"
#define STR_NOSPACE1 "There is not enough space"
#define STR_NOSPACE2 "on your disk to Save Game!"
#define STR_SAVECHT1 "Your Save Game file is,"
#define STR_SAVECHT2 "shall we say, \"corrupted\"."
#define STR_SAVECHT3 "But I'll let you go on and"
#define STR_SAVECHT4 "play anyway...."
#define STR_SEEAGAIN "Let's see that again!"


87
F_SPEAR.H Normal file
View file

@ -0,0 +1,87 @@
#define ENDSTR1 "Heroes don't quit, but\ngo ahead and press Y\nif you aren't one."
#define ENDSTR2 "Press Y to quit,\nor press N to enjoy\nmore violent diversion."
#define ENDSTR3 "Depressing the Y key means\nyou must return to the\nhumdrum workday world."
#define ENDSTR4 "Hey, quit or play,\nY or N:\nit's your choice."
#define ENDSTR5 "Sure you don't want to\nwaste a few more\nproductive hours?"
#define ENDSTR6 "I think you had better\nplay some more. Please\npress N...please?"
#define ENDSTR7 "If you are tough, press N.\nIf not, press Y daintily."
#define ENDSTR8 "I'm thinkin' that\nyou might wanna press N\nto play more. You do it."
#define ENDSTR9 "Sure. Fine. Quit.\nSee if we care.\nGet it over with.\nPress Y."
#define STR_ENDGAME1 "We owe you a great debt, Mr. Blazkowicz."
#define STR_ENDGAME2 "You have served your country well."
#define STR_ENDGAME3 "With the spear gone, the Allies will finally"
#define STR_ENDGAME4 "by able to destroy Hitler..."
#define STR_COPY1 "That's close, but not close enough to get"
#define STR_COPY2 "you into the game."
#define STR_COPY3 "Wow, you must have the early version of the"
#define STR_COPY4 "manual with the totally false information in it."
#define STR_COPY5 "I would let you into the game, but seeing"
#define STR_COPY6 "as that was not at all the right answer..."
#define STR_COPY7 "It's just too bad we can't get together on"
#define STR_COPY8 "this one. Sorry."
#define STR_COPY9 "Hey, you're just SO off base!"
#define STR_COPY10 "You know, I once typed that myself when"
#define STR_COPY11 "I was your age."
#define STR_COPY12 "Nops. Zero points. Zugga."
#define STR_COPY13 "Yeah...right."
#define STR_COPY14 "You must like these quizzes."
#define STR_COPY15 "Could be called \"PixelMeister\"?"
#define STR_COPY16 "Might engineer some software?"
#define STR_COPY17 "Would be found"
#define STR_COPY18 "directing creatively?"
#define STR_COPY19 "Might be found"
#define STR_COPY20 "handling operations?"
#define STR_COPY21 "Has a name familiar"
#define STR_COPY22 "to your weatherman?"
#define STR_NOPE1 "Welcome to the DOS prompt, pirate!"
#define STR_NOPE2 "Eat hot DOS prompt, goober!"
#define STR_NOPE3 "Ya know, this program doesn't cost that much."
#define STR_NOPE4 "Hey...weren't you just AT this DOS prompt?"
#define STR_NOPE5 "What's a nice user like you doin' at a DOS prompt like this?"
#define STR_NOPE6 "Well, I'm sure you just \"misplaced\" the manual..."
#define STR_NOPE7 "Run me again when you've boned up on your manual a bit."
#define STR_NOPE8 "Nice try, but no Spear."
#define STR_NOPE9 "That information is in the Spear of Destiny manual, by the way."
#define STR_MISC1 "Under \"Killing the Enemy\", what"
#define STR_MISC2 "type of enemy is pictured?"
#define STR_MISC3 "How many eyelets are on B.J.'s"
#define STR_MISC4 "boots? (see page 2)"
#define STR_MISC5 "The word \"minister\" appears in"
#define STR_MISC6 "what gray shape on page 2?"
#define STR_MISC7 "How many bullets does B.J. have"
#define STR_MISC8 "on the screen-shot in the middle"
#define STR_MISC9 "of page 9?"
#define STR_STAR "star"
#define STR_DEBRIEF " DEBRIEFING\n SESSION\n"
#define STR_ENEMY1 "Name the member of the"
#define STR_ENEMY2 "enemy forces shown above"
#define STR_CHECKMAN "CHECK YER MANUAL!"
#define STR_MAN1 "Which manual page"
#define STR_MAN2 "is the Options Menu"
#define STR_MAN3 "function"
#define STR_MAN4 "on?"
#define STR_ID1 "Which member of Id Software:"


47
GFXE_SOD.EQU Normal file
View file

@ -0,0 +1,47 @@
;=====================================
;
; Graphics .EQU file for .SOD
; IGRAB-ed on Fri Jul 31 18:31:00 1992
;
;=====================================
;
; Amount of each data item
;
NUMCHUNKS = 414
NUMFONT = 0
NUMFONTM = 0
NUMPICS = 0
NUMPICM = 0
NUMSPRITES = 0
NUMTILE8 = 0
NUMTILE8M = 0
NUMTILE16 = 144
NUMTILE16M = 270
NUMTILE32 = 0
NUMTILE32M = 0
NUMEXTERN = 0
;
; File offsets for data items
;
STARTFONT = 0
STARTFONTM = 0
STARTPICS = 0
STARTPICM = 0
STARTSPRITES = 0
STARTTILE8 = 0
STARTTILE8M = 0
STARTTILE16 = 0
STARTTILE16M = 144
STARTTILE32 = 414
STARTTILE32M = 414
STARTEXTERN = 414
;
; Thank you for using IGRAB!
;

53
GFXE_SOD.H Normal file
View file

@ -0,0 +1,53 @@
//////////////////////////////////////
//
// Graphics .H file for .SOD
// IGRAB-ed on Fri Jul 31 18:31:00 1992
//
//////////////////////////////////////
typedef enum {
ENUMEND
} graphicnums;
//
// Data LUMPs
//
//
// Amount of each data item
//
#define NUMCHUNKS 414
#define NUMFONT 0
#define NUMFONTM 0
#define NUMPICS 0
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 0
#define NUMTILE8M 0
#define NUMTILE16 144
#define NUMTILE16M 270
#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 144
#define STARTTILE32 414
#define STARTTILE32M 414
#define STARTEXTERNS 414
//
// Thank you for using IGRAB!
//

201
GFXE_WL1.EQU Normal file
View file

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

211
GFXE_WL1.H Normal file
View file

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

47
GFXE_WL6.EQU Normal file
View file

@ -0,0 +1,47 @@
;=====================================
;
; Graphics .EQU file for .WL6
; IGRAB-ed on Sun Aug 09 22:17:20 1992
;
;=====================================
;
; Amount of each data item
;
NUMCHUNKS = 414
NUMFONT = 0
NUMFONTM = 0
NUMPICS = 0
NUMPICM = 0
NUMSPRITES = 0
NUMTILE8 = 0
NUMTILE8M = 0
NUMTILE16 = 144
NUMTILE16M = 270
NUMTILE32 = 0
NUMTILE32M = 0
NUMEXTERN = 0
;
; File offsets for data items
;
STARTFONT = 0
STARTFONTM = 0
STARTPICS = 0
STARTPICM = 0
STARTSPRITES = 0
STARTTILE8 = 0
STARTTILE8M = 0
STARTTILE16 = 0
STARTTILE16M = 144
STARTTILE32 = 414
STARTTILE32M = 414
STARTEXTERN = 414
;
; Thank you for using IGRAB!
;

53
GFXE_WL6.H Normal file
View file

@ -0,0 +1,53 @@
//////////////////////////////////////
//
// Graphics .H file for .WL6
// IGRAB-ed on Sun Aug 09 22:17:20 1992
//
//////////////////////////////////////
typedef enum {
ENUMEND
} graphicnums;
//
// Data LUMPs
//
//
// Amount of each data item
//
#define NUMCHUNKS 414
#define NUMFONT 0
#define NUMFONTM 0
#define NUMPICS 0
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 0
#define NUMTILE8M 0
#define NUMTILE16 144
#define NUMTILE16M 270
#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 144
#define STARTTILE32 414
#define STARTTILE32M 414
#define STARTEXTERNS 414
//
// Thank you for using IGRAB!
//

208
GFXV_SDM.EQU Normal file
View file

@ -0,0 +1,208 @@
;=====================================
;
; Graphics .EQU file for .SDM
; IGRAB-ed on Mon Sep 21 14:20:19 1992
;
;=====================================
C_BACKDROPPIC = 3
C_MOUSELBACKPIC = 4
C_CURSOR1PIC = 5
C_CURSOR2PIC = 6
C_NOTSELECTEDPIC = 7
C_SELECTEDPIC = 8
C_CUSTOMIZEPIC = 9
C_JOY1PIC = 10
C_JOY2PIC = 11
C_MOUSEPIC = 12
C_JOYSTICKPIC = 13
C_KEYBOARDPIC = 14
C_CONTROLPIC = 15
C_OPTIONSPIC = 16
C_FXTITLEPIC = 17
C_DIGITITLEPIC = 18
C_MUSICTITLEPIC = 19
C_HOWTOUGHPIC = 20
C_BABYMODEPIC = 21
C_EASYPIC = 22
C_NORMALPIC = 23
C_HARDPIC = 24
C_DISKLOADING1PIC = 25
C_DISKLOADING2PIC = 26
C_LOADGAMEPIC = 27
C_SAVEGAMEPIC = 28
HIGHSCORESPIC = 29
C_WONSPEARPIC = 30
L_GUYPIC = 31
L_COLONPIC = 32
L_NUM0PIC = 33
L_NUM1PIC = 34
L_NUM2PIC = 35
L_NUM3PIC = 36
L_NUM4PIC = 37
L_NUM5PIC = 38
L_NUM6PIC = 39
L_NUM7PIC = 40
L_NUM8PIC = 41
L_NUM9PIC = 42
L_PERCENTPIC = 43
L_APIC = 44
L_BPIC = 45
L_CPIC = 46
L_DPIC = 47
L_EPIC = 48
L_FPIC = 49
L_GPIC = 50
L_HPIC = 51
L_IPIC = 52
L_JPIC = 53
L_KPIC = 54
L_LPIC = 55
L_MPIC = 56
L_NPIC = 57
L_OPIC = 58
L_PPIC = 59
L_QPIC = 60
L_RPIC = 61
L_SPIC = 62
L_TPIC = 63
L_UPIC = 64
L_VPIC = 65
L_WPIC = 66
L_XPIC = 67
L_YPIC = 68
L_ZPIC = 69
L_EXPOINTPIC = 70
L_APOSTROPHEPIC = 71
L_GUY2PIC = 72
L_BJWINSPIC = 73
TITLE1PIC = 74
TITLE2PIC = 75
STATUSBARPIC = 76
PG13PIC = 77
CREDITSPIC = 78
KNIFEPIC = 79
GUNPIC = 80
MACHINEGUNPIC = 81
GATLINGGUNPIC = 82
NOKEYPIC = 83
GOLDKEYPIC = 84
SILVERKEYPIC = 85
N_BLANKPIC = 86
N_0PIC = 87
N_1PIC = 88
N_2PIC = 89
N_3PIC = 90
N_4PIC = 91
N_5PIC = 92
N_6PIC = 93
N_7PIC = 94
N_8PIC = 95
N_9PIC = 96
FACE1APIC = 97
FACE1BPIC = 98
FACE1CPIC = 99
FACE2APIC = 100
FACE2BPIC = 101
FACE2CPIC = 102
FACE3APIC = 103
FACE3BPIC = 104
FACE3CPIC = 105
FACE4APIC = 106
FACE4BPIC = 107
FACE4CPIC = 108
FACE5APIC = 109
FACE5BPIC = 110
FACE5CPIC = 111
FACE6APIC = 112
FACE6BPIC = 113
FACE6CPIC = 114
FACE7APIC = 115
FACE7BPIC = 116
FACE7CPIC = 117
FACE8APIC = 118
GOTGATLINGPIC = 119
GODMODEFACE1PIC = 120
GODMODEFACE2PIC = 121
GODMODEFACE3PIC = 122
BJWAITING1PIC = 123
BJWAITING2PIC = 124
BJOUCHPIC = 125
PAUSEDPIC = 126
GETPSYCHEDPIC = 127
ORDERSCREEN = 129
ERRORSCREEN = 130
TITLEPALETTE = 131
T_DEMO0 = 132
BACKDROP_LUMP_START = 3
BACKDROP_LUMP_END = 8
CONTROL_LUMP_START = 9
CONTROL_LUMP_END = 15
OPTIONS_LUMP_START = 16
OPTIONS_LUMP_END = 16
SOUND_LUMP_START = 17
SOUND_LUMP_END = 19
NEWGAME_LUMP_START = 20
NEWGAME_LUMP_END = 24
LOADSAVE_LUMP_START = 25
LOADSAVE_LUMP_END = 28
HIGHSCORES_LUMP_START = 29
HIGHSCORES_LUMP_END = 30
LEVELEND_LUMP_START = 31
LEVELEND_LUMP_END = 73
TITLESCREEN_LUMP_START = 74
TITLESCREEN_LUMP_END = 75
LATCHPICS_LUMP_START = 79
LATCHPICS_LUMP_END = 127
;
; Amount of each data item
;
NUMCHUNKS = 133
NUMFONT = 2
NUMFONTM = 0
NUMPICS = 125
NUMPICM = 0
NUMSPRITES = 0
NUMTILE8 = 72
NUMTILE8M = 0
NUMTILE16 = 0
NUMTILE16M = 0
NUMTILE32 = 0
NUMTILE32M = 0
NUMEXTERN = 4
;
; File offsets for data items
;
STRUCTPIC = 0
STARTFONT = 1
STARTFONTM = 3
STARTPICS = 3
STARTPICM = 128
STARTSPRITES = 128
STARTTILE8 = 128
STARTTILE8M = 129
STARTTILE16 = 129
STARTTILE16M = 129
STARTTILE32 = 129
STARTTILE32M = 129
STARTEXTERN = 129
;
; Thank you for using IGRAB!
;

224
GFXV_SDM.H Normal file
View file

@ -0,0 +1,224 @@
//////////////////////////////////////
//
// Graphics .H file for .SDM
// IGRAB-ed on Mon Sep 21 14:20:19 1992
//
//////////////////////////////////////
typedef enum {
// Lump Start
C_BACKDROPPIC=3,
C_MOUSELBACKPIC, // 4
C_CURSOR1PIC, // 5
C_CURSOR2PIC, // 6
C_NOTSELECTEDPIC, // 7
C_SELECTEDPIC, // 8
// Lump Start
C_CUSTOMIZEPIC, // 9
C_JOY1PIC, // 10
C_JOY2PIC, // 11
C_MOUSEPIC, // 12
C_JOYSTICKPIC, // 13
C_KEYBOARDPIC, // 14
C_CONTROLPIC, // 15
// Lump Start
C_OPTIONSPIC, // 16
// Lump Start
C_FXTITLEPIC, // 17
C_DIGITITLEPIC, // 18
C_MUSICTITLEPIC, // 19
// Lump Start
C_HOWTOUGHPIC, // 20
C_BABYMODEPIC, // 21
C_EASYPIC, // 22
C_NORMALPIC, // 23
C_HARDPIC, // 24
// Lump Start
C_DISKLOADING1PIC, // 25
C_DISKLOADING2PIC, // 26
C_LOADGAMEPIC, // 27
C_SAVEGAMEPIC, // 28
// Lump Start
HIGHSCORESPIC, // 29
C_WONSPEARPIC, // 30
// Lump Start
L_GUYPIC, // 31
L_COLONPIC, // 32
L_NUM0PIC, // 33
L_NUM1PIC, // 34
L_NUM2PIC, // 35
L_NUM3PIC, // 36
L_NUM4PIC, // 37
L_NUM5PIC, // 38
L_NUM6PIC, // 39
L_NUM7PIC, // 40
L_NUM8PIC, // 41
L_NUM9PIC, // 42
L_PERCENTPIC, // 43
L_APIC, // 44
L_BPIC, // 45
L_CPIC, // 46
L_DPIC, // 47
L_EPIC, // 48
L_FPIC, // 49
L_GPIC, // 50
L_HPIC, // 51
L_IPIC, // 52
L_JPIC, // 53
L_KPIC, // 54
L_LPIC, // 55
L_MPIC, // 56
L_NPIC, // 57
L_OPIC, // 58
L_PPIC, // 59
L_QPIC, // 60
L_RPIC, // 61
L_SPIC, // 62
L_TPIC, // 63
L_UPIC, // 64
L_VPIC, // 65
L_WPIC, // 66
L_XPIC, // 67
L_YPIC, // 68
L_ZPIC, // 69
L_EXPOINTPIC, // 70
L_APOSTROPHEPIC, // 71
L_GUY2PIC, // 72
L_BJWINSPIC, // 73
// Lump Start
TITLE1PIC, // 74
TITLE2PIC, // 75
STATUSBARPIC, // 76
PG13PIC, // 77
CREDITSPIC, // 78
// Lump Start
KNIFEPIC, // 79
GUNPIC, // 80
MACHINEGUNPIC, // 81
GATLINGGUNPIC, // 82
NOKEYPIC, // 83
GOLDKEYPIC, // 84
SILVERKEYPIC, // 85
N_BLANKPIC, // 86
N_0PIC, // 87
N_1PIC, // 88
N_2PIC, // 89
N_3PIC, // 90
N_4PIC, // 91
N_5PIC, // 92
N_6PIC, // 93
N_7PIC, // 94
N_8PIC, // 95
N_9PIC, // 96
FACE1APIC, // 97
FACE1BPIC, // 98
FACE1CPIC, // 99
FACE2APIC, // 100
FACE2BPIC, // 101
FACE2CPIC, // 102
FACE3APIC, // 103
FACE3BPIC, // 104
FACE3CPIC, // 105
FACE4APIC, // 106
FACE4BPIC, // 107
FACE4CPIC, // 108
FACE5APIC, // 109
FACE5BPIC, // 110
FACE5CPIC, // 111
FACE6APIC, // 112
FACE6BPIC, // 113
FACE6CPIC, // 114
FACE7APIC, // 115
FACE7BPIC, // 116
FACE7CPIC, // 117
FACE8APIC, // 118
GOTGATLINGPIC, // 119
GODMODEFACE1PIC, // 120
GODMODEFACE2PIC, // 121
GODMODEFACE3PIC, // 122
BJWAITING1PIC, // 123
BJWAITING2PIC, // 124
BJOUCHPIC, // 125
PAUSEDPIC, // 126
GETPSYCHEDPIC, // 127
ORDERSCREEN=129,
ERRORSCREEN, // 130
TITLEPALETTE, // 131
T_DEMO0, // 132
ENUMEND
} graphicnums;
//
// Data LUMPs
//
#define BACKDROP_LUMP_START 3
#define BACKDROP_LUMP_END 8
#define CONTROL_LUMP_START 9
#define CONTROL_LUMP_END 15
#define OPTIONS_LUMP_START 16
#define OPTIONS_LUMP_END 16
#define SOUND_LUMP_START 17
#define SOUND_LUMP_END 19
#define NEWGAME_LUMP_START 20
#define NEWGAME_LUMP_END 24
#define LOADSAVE_LUMP_START 25
#define LOADSAVE_LUMP_END 28
#define HIGHSCORES_LUMP_START 29
#define HIGHSCORES_LUMP_END 30
#define LEVELEND_LUMP_START 31
#define LEVELEND_LUMP_END 73
#define TITLESCREEN_LUMP_START 74
#define TITLESCREEN_LUMP_END 75
#define LATCHPICS_LUMP_START 79
#define LATCHPICS_LUMP_END 127
//
// Amount of each data item
//
#define NUMCHUNKS 133
#define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS 125
#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 4
//
// File offsets for data items
//
#define STRUCTPIC 0
#define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3
#define STARTPICM 128
#define STARTSPRITES 128
#define STARTTILE8 128
#define STARTTILE8M 129
#define STARTTILE16 129
#define STARTTILE16M 129
#define STARTTILE32 129
#define STARTTILE32M 129
#define STARTEXTERNS 129
//
// Thank you for using IGRAB!
//

259
GFXV_SOD.EQU Normal file
View file

@ -0,0 +1,259 @@
;=====================================
;
; Graphics .EQU file for .SOD
; IGRAB-ed on Thu Oct 08 20:38:29 1992
;
;=====================================
C_BACKDROPPIC = 3
C_MOUSELBACKPIC = 4
C_CURSOR1PIC = 5
C_CURSOR2PIC = 6
C_NOTSELECTEDPIC = 7
C_SELECTEDPIC = 8
C_CUSTOMIZEPIC = 9
C_JOY1PIC = 10
C_JOY2PIC = 11
C_MOUSEPIC = 12
C_JOYSTICKPIC = 13
C_KEYBOARDPIC = 14
C_CONTROLPIC = 15
C_OPTIONSPIC = 16
C_FXTITLEPIC = 17
C_DIGITITLEPIC = 18
C_MUSICTITLEPIC = 19
C_HOWTOUGHPIC = 20
C_BABYMODEPIC = 21
C_EASYPIC = 22
C_NORMALPIC = 23
C_HARDPIC = 24
C_DISKLOADING1PIC = 25
C_DISKLOADING2PIC = 26
C_LOADGAMEPIC = 27
C_SAVEGAMEPIC = 28
HIGHSCORESPIC = 29
C_WONSPEARPIC = 30
BJCOLLAPSE1PIC = 31
BJCOLLAPSE2PIC = 32
BJCOLLAPSE3PIC = 33
BJCOLLAPSE4PIC = 34
ENDPICPIC = 35
L_GUYPIC = 36
L_COLONPIC = 37
L_NUM0PIC = 38
L_NUM1PIC = 39
L_NUM2PIC = 40
L_NUM3PIC = 41
L_NUM4PIC = 42
L_NUM5PIC = 43
L_NUM6PIC = 44
L_NUM7PIC = 45
L_NUM8PIC = 46
L_NUM9PIC = 47
L_PERCENTPIC = 48
L_APIC = 49
L_BPIC = 50
L_CPIC = 51
L_DPIC = 52
L_EPIC = 53
L_FPIC = 54
L_GPIC = 55
L_HPIC = 56
L_IPIC = 57
L_JPIC = 58
L_KPIC = 59
L_LPIC = 60
L_MPIC = 61
L_NPIC = 62
L_OPIC = 63
L_PPIC = 64
L_QPIC = 65
L_RPIC = 66
L_SPIC = 67
L_TPIC = 68
L_UPIC = 69
L_VPIC = 70
L_WPIC = 71
L_XPIC = 72
L_YPIC = 73
L_ZPIC = 74
L_EXPOINTPIC = 75
L_APOSTROPHEPIC = 76
L_GUY2PIC = 77
L_BJWINSPIC = 78
TITLE1PIC = 79
TITLE2PIC = 80
ENDSCREEN11PIC = 81
ENDSCREEN12PIC = 82
ENDSCREEN3PIC = 83
ENDSCREEN4PIC = 84
ENDSCREEN5PIC = 85
ENDSCREEN6PIC = 86
ENDSCREEN7PIC = 87
ENDSCREEN8PIC = 88
ENDSCREEN9PIC = 89
STATUSBARPIC = 90
PG13PIC = 91
CREDITSPIC = 92
IDGUYS1PIC = 93
IDGUYS2PIC = 94
COPYPROTTOPPIC = 95
COPYPROTBOXPIC = 96
BOSSPIC1PIC = 97
BOSSPIC2PIC = 98
BOSSPIC3PIC = 99
BOSSPIC4PIC = 100
KNIFEPIC = 101
GUNPIC = 102
MACHINEGUNPIC = 103
GATLINGGUNPIC = 104
NOKEYPIC = 105
GOLDKEYPIC = 106
SILVERKEYPIC = 107
N_BLANKPIC = 108
N_0PIC = 109
N_1PIC = 110
N_2PIC = 111
N_3PIC = 112
N_4PIC = 113
N_5PIC = 114
N_6PIC = 115
N_7PIC = 116
N_8PIC = 117
N_9PIC = 118
FACE1APIC = 119
FACE1BPIC = 120
FACE1CPIC = 121
FACE2APIC = 122
FACE2BPIC = 123
FACE2CPIC = 124
FACE3APIC = 125
FACE3BPIC = 126
FACE3CPIC = 127
FACE4APIC = 128
FACE4BPIC = 129
FACE4CPIC = 130
FACE5APIC = 131
FACE5BPIC = 132
FACE5CPIC = 133
FACE6APIC = 134
FACE6BPIC = 135
FACE6CPIC = 136
FACE7APIC = 137
FACE7BPIC = 138
FACE7CPIC = 139
FACE8APIC = 140
GOTGATLINGPIC = 141
GODMODEFACE1PIC = 142
GODMODEFACE2PIC = 143
GODMODEFACE3PIC = 144
BJWAITING1PIC = 145
BJWAITING2PIC = 146
BJOUCHPIC = 147
PAUSEDPIC = 148
GETPSYCHEDPIC = 149
ORDERSCREEN = 151
ERRORSCREEN = 152
TITLEPALETTE = 153
END1PALETTE = 154
END2PALETTE = 155
END3PALETTE = 156
END4PALETTE = 157
END5PALETTE = 158
END6PALETTE = 159
END7PALETTE = 160
END8PALETTE = 161
END9PALETTE = 162
IDGUYSPALETTE = 163
T_DEMO0 = 164
T_DEMO1 = 165
T_DEMO2 = 166
T_DEMO3 = 167
T_ENDART1 = 168
BACKDROP_LUMP_START = 3
BACKDROP_LUMP_END = 8
CONTROL_LUMP_START = 9
CONTROL_LUMP_END = 15
OPTIONS_LUMP_START = 16
OPTIONS_LUMP_END = 16
SOUND_LUMP_START = 17
SOUND_LUMP_END = 19
NEWGAME_LUMP_START = 20
NEWGAME_LUMP_END = 24
LOADSAVE_LUMP_START = 25
LOADSAVE_LUMP_END = 28
HIGHSCORES_LUMP_START = 29
HIGHSCORES_LUMP_END = 30
ENDGAME_LUMP_START = 31
ENDGAME_LUMP_END = 35
LEVELEND_LUMP_START = 36
LEVELEND_LUMP_END = 78
TITLESCREEN_LUMP_START = 79
TITLESCREEN_LUMP_END = 80
ENDGAME1_LUMP_START = 81
ENDGAME1_LUMP_END = 81
ENDGAME2_LUMP_START = 82
ENDGAME2_LUMP_END = 82
EASTEREGG_LUMP_START = 93
EASTEREGG_LUMP_END = 94
COPYPROT_LUMP_START = 95
COPYPROT_LUMP_END = 100
LATCHPICS_LUMP_START = 101
LATCHPICS_LUMP_END = 149
;
; Amount of each data item
;
NUMCHUNKS = 169
NUMFONT = 2
NUMFONTM = 0
NUMPICS = 147
NUMPICM = 0
NUMSPRITES = 0
NUMTILE8 = 72
NUMTILE8M = 0
NUMTILE16 = 0
NUMTILE16M = 0
NUMTILE32 = 0
NUMTILE32M = 0
NUMEXTERN = 18
;
; File offsets for data items
;
STRUCTPIC = 0
STARTFONT = 1
STARTFONTM = 3
STARTPICS = 3
STARTPICM = 150
STARTSPRITES = 150
STARTTILE8 = 150
STARTTILE8M = 151
STARTTILE16 = 151
STARTTILE16M = 151
STARTTILE32 = 151
STARTTILE32M = 151
STARTEXTERN = 151
;
; Thank you for using IGRAB!
;

280
GFXV_SOD.H Normal file
View file

@ -0,0 +1,280 @@
//////////////////////////////////////
//
// Graphics .H file for .SOD
// IGRAB-ed on Thu Oct 08 20:38:29 1992
//
//////////////////////////////////////
typedef enum {
// Lump Start
C_BACKDROPPIC=3,
C_MOUSELBACKPIC, // 4
C_CURSOR1PIC, // 5
C_CURSOR2PIC, // 6
C_NOTSELECTEDPIC, // 7
C_SELECTEDPIC, // 8
// Lump Start
C_CUSTOMIZEPIC, // 9
C_JOY1PIC, // 10
C_JOY2PIC, // 11
C_MOUSEPIC, // 12
C_JOYSTICKPIC, // 13
C_KEYBOARDPIC, // 14
C_CONTROLPIC, // 15
// Lump Start
C_OPTIONSPIC, // 16
// Lump Start
C_FXTITLEPIC, // 17
C_DIGITITLEPIC, // 18
C_MUSICTITLEPIC, // 19
// Lump Start
C_HOWTOUGHPIC, // 20
C_BABYMODEPIC, // 21
C_EASYPIC, // 22
C_NORMALPIC, // 23
C_HARDPIC, // 24
// Lump Start
C_DISKLOADING1PIC, // 25
C_DISKLOADING2PIC, // 26
C_LOADGAMEPIC, // 27
C_SAVEGAMEPIC, // 28
// Lump Start
HIGHSCORESPIC, // 29
C_WONSPEARPIC, // 30
// Lump Start
BJCOLLAPSE1PIC, // 31
BJCOLLAPSE2PIC, // 32
BJCOLLAPSE3PIC, // 33
BJCOLLAPSE4PIC, // 34
ENDPICPIC, // 35
// Lump Start
L_GUYPIC, // 36
L_COLONPIC, // 37
L_NUM0PIC, // 38
L_NUM1PIC, // 39
L_NUM2PIC, // 40
L_NUM3PIC, // 41
L_NUM4PIC, // 42
L_NUM5PIC, // 43
L_NUM6PIC, // 44
L_NUM7PIC, // 45
L_NUM8PIC, // 46
L_NUM9PIC, // 47
L_PERCENTPIC, // 48
L_APIC, // 49
L_BPIC, // 50
L_CPIC, // 51
L_DPIC, // 52
L_EPIC, // 53
L_FPIC, // 54
L_GPIC, // 55
L_HPIC, // 56
L_IPIC, // 57
L_JPIC, // 58
L_KPIC, // 59
L_LPIC, // 60
L_MPIC, // 61
L_NPIC, // 62
L_OPIC, // 63
L_PPIC, // 64
L_QPIC, // 65
L_RPIC, // 66
L_SPIC, // 67
L_TPIC, // 68
L_UPIC, // 69
L_VPIC, // 70
L_WPIC, // 71
L_XPIC, // 72
L_YPIC, // 73
L_ZPIC, // 74
L_EXPOINTPIC, // 75
L_APOSTROPHEPIC, // 76
L_GUY2PIC, // 77
L_BJWINSPIC, // 78
// Lump Start
TITLE1PIC, // 79
TITLE2PIC, // 80
// Lump Start
ENDSCREEN11PIC, // 81
// Lump Start
ENDSCREEN12PIC, // 82
ENDSCREEN3PIC, // 83
ENDSCREEN4PIC, // 84
ENDSCREEN5PIC, // 85
ENDSCREEN6PIC, // 86
ENDSCREEN7PIC, // 87
ENDSCREEN8PIC, // 88
ENDSCREEN9PIC, // 89
STATUSBARPIC, // 90
PG13PIC, // 91
CREDITSPIC, // 92
// Lump Start
IDGUYS1PIC, // 93
IDGUYS2PIC, // 94
// Lump Start
COPYPROTTOPPIC, // 95
COPYPROTBOXPIC, // 96
BOSSPIC1PIC, // 97
BOSSPIC2PIC, // 98
BOSSPIC3PIC, // 99
BOSSPIC4PIC, // 100
// Lump Start
KNIFEPIC, // 101
GUNPIC, // 102
MACHINEGUNPIC, // 103
GATLINGGUNPIC, // 104
NOKEYPIC, // 105
GOLDKEYPIC, // 106
SILVERKEYPIC, // 107
N_BLANKPIC, // 108
N_0PIC, // 109
N_1PIC, // 110
N_2PIC, // 111
N_3PIC, // 112
N_4PIC, // 113
N_5PIC, // 114
N_6PIC, // 115
N_7PIC, // 116
N_8PIC, // 117
N_9PIC, // 118
FACE1APIC, // 119
FACE1BPIC, // 120
FACE1CPIC, // 121
FACE2APIC, // 122
FACE2BPIC, // 123
FACE2CPIC, // 124
FACE3APIC, // 125
FACE3BPIC, // 126
FACE3CPIC, // 127
FACE4APIC, // 128
FACE4BPIC, // 129
FACE4CPIC, // 130
FACE5APIC, // 131
FACE5BPIC, // 132
FACE5CPIC, // 133
FACE6APIC, // 134
FACE6BPIC, // 135
FACE6CPIC, // 136
FACE7APIC, // 137
FACE7BPIC, // 138
FACE7CPIC, // 139
FACE8APIC, // 140
GOTGATLINGPIC, // 141
GODMODEFACE1PIC, // 142
GODMODEFACE2PIC, // 143
GODMODEFACE3PIC, // 144
BJWAITING1PIC, // 145
BJWAITING2PIC, // 146
BJOUCHPIC, // 147
PAUSEDPIC, // 148
GETPSYCHEDPIC, // 149
ORDERSCREEN=151,
ERRORSCREEN, // 152
TITLEPALETTE, // 153
END1PALETTE, // 154
END2PALETTE, // 155
END3PALETTE, // 156
END4PALETTE, // 157
END5PALETTE, // 158
END6PALETTE, // 159
END7PALETTE, // 160
END8PALETTE, // 161
END9PALETTE, // 162
IDGUYSPALETTE, // 163
T_DEMO0, // 164
T_DEMO1, // 165
T_DEMO2, // 166
T_DEMO3, // 167
T_ENDART1, // 168
ENUMEND
} graphicnums;
//
// Data LUMPs
//
#define BACKDROP_LUMP_START 3
#define BACKDROP_LUMP_END 8
#define CONTROL_LUMP_START 9
#define CONTROL_LUMP_END 15
#define OPTIONS_LUMP_START 16
#define OPTIONS_LUMP_END 16
#define SOUND_LUMP_START 17
#define SOUND_LUMP_END 19
#define NEWGAME_LUMP_START 20
#define NEWGAME_LUMP_END 24
#define LOADSAVE_LUMP_START 25
#define LOADSAVE_LUMP_END 28
#define HIGHSCORES_LUMP_START 29
#define HIGHSCORES_LUMP_END 30
#define ENDGAME_LUMP_START 31
#define ENDGAME_LUMP_END 35
#define LEVELEND_LUMP_START 36
#define LEVELEND_LUMP_END 78
#define TITLESCREEN_LUMP_START 79
#define TITLESCREEN_LUMP_END 80
#define ENDGAME1_LUMP_START 81
#define ENDGAME1_LUMP_END 81
#define ENDGAME2_LUMP_START 82
#define ENDGAME2_LUMP_END 82
#define EASTEREGG_LUMP_START 93
#define EASTEREGG_LUMP_END 94
#define COPYPROT_LUMP_START 95
#define COPYPROT_LUMP_END 100
#define LATCHPICS_LUMP_START 101
#define LATCHPICS_LUMP_END 149
//
// Amount of each data item
//
#define NUMCHUNKS 169
#define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS 147
#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 18
//
// File offsets for data items
//
#define STRUCTPIC 0
#define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3
#define STARTPICM 150
#define STARTSPRITES 150
#define STARTTILE8 150
#define STARTTILE8M 151
#define STARTTILE16 151
#define STARTTILE16M 151
#define STARTTILE32 151
#define STARTTILE32M 151
#define STARTEXTERNS 151
//
// 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!
;

209
GFXV_WL1.H Normal file
View file

@ -0,0 +1,209 @@
//////////////////////////////////////
//
// Graphics .H file for .WL1
// IGRAB-ed on Sun May 03 01:19:32 1992
//
//////////////////////////////////////
typedef enum {
// Lump Start
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
// Lump Start
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
// Lump Start
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
// Lump Start
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
ENUMEND
} graphicnums;
//
// Data LUMPs
//
#define README_LUMP_START 3
#define README_LUMP_END 20
#define CONTROLS_LUMP_START 21
#define CONTROLS_LUMP_END 47
#define LEVELEND_LUMP_START 48
#define LEVELEND_LUMP_END 89
#define LATCHPICS_LUMP_START 95
#define LATCHPICS_LUMP_END 138
//
// Amount of each data item
//
#define NUMCHUNKS 556
#define NUMFONT 2
#define NUMFONTM 0
#define NUMPICS 136
#define NUMPICM 0
#define NUMSPRITES 0
#define NUMTILE8 72
#define NUMTILE8M 0
#define NUMTILE16 144
#define NUMTILE16M 270
#define NUMTILE32 0
#define NUMTILE32M 0
#define NUMEXTERNS 2
//
// File offsets for data items
//
#define STRUCTPIC 0
#define STARTFONT 1
#define STARTFONTM 3
#define STARTPICS 3
#define STARTPICM 139
#define STARTSPRITES 139
#define STARTTILE8 139
#define STARTTILE8M 140
#define STARTTILE16 140
#define STARTTILE16M 284
#define STARTTILE32 554
#define STARTTILE32M 554
#define STARTEXTERNS 554
//
// Thank you for using IGRAB!
//

206
GFXV_WL6.EQU Normal file
View file

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

216
GFXV_WL6.H Normal file
View file

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

5
GO.BAT Normal file
View file

@ -0,0 +1,5 @@
sv readme\license.doc
sv readme\release.txt
sv readme\readme.txt
@ECHO Get to Work!

56
GOODSTUF.TXT Normal file
View file

@ -0,0 +1,56 @@
To: ROMERO,TOM
From: LOTHAR/JAY
Date: 9 Aug 92 21:06:46
Subject: AOL Message
X-mailer: Pegasus Mail v2.3 (R2).
Subj: DREAMS, FLASHBACKS
Date: 92-08-09 03:59:55 EDT
From: Tug Hill 2
Posted on: America Online
On a serious note...
As a former POW (Vietnam), I hesitated to play WOLF for over a
month after downloading as I feared flashbacks. I didn't want to
remember all that I had been through all those years ago, when, as
POW's, my friend and I decided an escape attempt would be better than
a slow death by torture and starvation.
My friend and I made crude maps and hoarded food. The day of the
escape we clubbed the guard with stones, took his gun and fought our
way through two levels of underground tunnels (only a few guards and
had to crawl). I made it, my friend didn't.
Dreams...NO! NIGHTMARES...YES!! However, the more I play
WOLF the less frequently I have nightmares. The chilling part is
turning a corner and seeing a guard with his gun drawn.
WOLF is a powerful game. Fearful as well. I believe that a
person should face the past. So... when I can play EPISODE 1
comfortably (no nightmares), I plan on ordering the full series.
Don't let a few bad dreams make you discard this game.
-------------------------------------------------------------------------
Subj: Wolf-3D Section: Action/Arcade Games
From: Ty Graham 72350,2636 # 191387, * No Replies *
To: Id Software 72600,1333 Date: 24-Jul-92 18:27:27
Jay, just thought I'd drop a note to let you know how popular Wolf3D is
here at Microsoft. It seems like I can't walk down a hall without hearing
'Mein Leben' from someone's office. I hope you guys are getting revenue
from all this.
Anyway, we were sitting around talking the other day, discussing games for
Windows, and someone said 'What are those cool guys at Id doing?'. So how
about it. Are you guys looking at Win games at all? Win32?
In a perfect world, I'd have you guys port the Wolf engine to a multiuser
maze game for Windows for Workgroups. We need a good M'user Win game.
Anyway some thoughts.
Ty Graham (Microsoft)

227
H_LDIV.ASM Normal file
View file

@ -0,0 +1,227 @@
;[]-----------------------------------------------------------------[]
;| 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. |
;[]-----------------------------------------------------------------[]
.model medium
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
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

1768
ID_CA.C Normal file

File diff suppressed because it is too large Load diff

101
ID_CA.H Normal file
View file

@ -0,0 +1,101 @@
// ID_CA.H
//===========================================================================
#define NUMMAPS 60
#define MAPPLANES 2
#define UNCACHEGRCHUNK(chunk) {MM_FreePtr(&grsegs[chunk]);grneeded[chunk]&=~ca_levelbit;}
//===========================================================================
typedef struct
{
long planestart[3];
unsigned planelength[3];
unsigned width,height;
char name[16];
} maptype;
//===========================================================================
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);
//===========================================================================
// 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 CA_CacheScreen (int chunk);

34
ID_HEAD.H Normal file
View file

@ -0,0 +1,34 @@
// ID_HEAD.H
#define EXTENSION "WLF"
#define WOLF
#define TEXTGR 0
#define CGAGR 1
#define EGAGR 2
#define VGAGR 3
#define GRMODE VGAGR
#include "VERSION.H"
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

123
ID_HEADS.H Normal file
View file

@ -0,0 +1,123 @@
// 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__
#include "VERSION.H"
//--------------------------------------------------------------------------
extern char far signon;
#define introscn signon
#ifdef JAPAN
#ifdef JAPDEMO
#include "FOREIGN\JAPAN\GFXV_WJ1.H"
#else
#include "FOREIGN\JAPAN\GFXV_WJ6.H"
#endif
#include "AUDIOWL6.H"
#include "MAPSWL6.H"
#else
#ifndef SPEAR
#include "GFXV_WL6.H"
#include "AUDIOWL6.H"
#include "MAPSWL6.H"
#else
#ifndef SPEARDEMO
#include "GFXV_SOD.H"
#include "AUDIOSOD.H"
#include "MAPSSOD.H"
#else
#include "GFXV_SDM.H"
#include "AUDIOSDM.H"
#include "MAPSSDM.H"
#endif
#endif
#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 ((void *)0)
#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"
void Quit (char *error); // defined in user program
//
// 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;
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;

990
ID_IN.C Normal file
View file

@ -0,0 +1,990 @@
//
// ID Engine
// ID_IN.c - Input Manager
// v1.0d1
// By Jason Blochowiak
//
//
// This module handles dealing with the various input devices
//
// Depends on: Memory Mgr (for demo recording), Sound Mgr (for timing stuff),
// User Mgr (for command line parms)
//
// Globals:
// LastScan - The keyboard scan code of the last key pressed
// LastASCII - The ASCII value of the last key pressed
// DEBUG - there are more globals
//
#include "ID_HEADS.H"
#pragma hdrstop
#define KeyInt 9 // The keyboard ISR number
//
// mouse constants
//
#define MReset 0
#define MButtons 3
#define MDelta 11
#define MouseInt 0x33
#define Mouse(x) _AX = x,geninterrupt(MouseInt)
//
// joystick constants
//
#define JoyScaleMax 32768
#define JoyScaleShift 8
#define MaxJoyValue 5000
/*
=============================================================================
GLOBAL VARIABLES
=============================================================================
*/
//
// configuration variables
//
boolean MousePresent;
boolean JoysPresent[MaxJoys];
boolean JoyPadPresent;
// Global variables
boolean Keyboard[NumCodes];
boolean Paused;
char LastASCII;
ScanCode LastScan;
KeyboardDef KbdDefs = {0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51};
JoystickDef JoyDefs[MaxJoys];
ControlType Controls[MaxPlayers];
longword MouseDownCount;
Demo DemoMode = demo_Off;
byte _seg *DemoBuffer;
word DemoOffset,DemoSize;
/*
=============================================================================
LOCAL VARIABLES
=============================================================================
*/
static byte far ASCIINames[] = // Unshifted ASCII for scan codes
{
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 ,27 ,'1','2','3','4','5','6','7','8','9','0','-','=',8 ,9 , // 0
'q','w','e','r','t','y','u','i','o','p','[',']',13 ,0 ,'a','s', // 1
'd','f','g','h','j','k','l',';',39 ,'`',0 ,92 ,'z','x','c','v', // 2
'b','n','m',',','.','/',0 ,'*',0 ,' ',0 ,0 ,0 ,0 ,0 ,0 , // 3
0 ,0 ,0 ,0 ,0 ,0 ,0 ,'7','8','9','-','4','5','6','+','1', // 4
'2','3','0',127,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7
},
far ShiftNames[] = // Shifted ASCII for scan codes
{
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 ,27 ,'!','@','#','$','%','^','&','*','(',')','_','+',8 ,9 , // 0
'Q','W','E','R','T','Y','U','I','O','P','{','}',13 ,0 ,'A','S', // 1
'D','F','G','H','J','K','L',':',34 ,'~',0 ,'|','Z','X','C','V', // 2
'B','N','M','<','>','?',0 ,'*',0 ,' ',0 ,0 ,0 ,0 ,0 ,0 , // 3
0 ,0 ,0 ,0 ,0 ,0 ,0 ,'7','8','9','-','4','5','6','+','1', // 4
'2','3','0',127,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7
},
far SpecialNames[] = // ASCII for 0xe0 prefixed codes
{
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 0
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,13 ,0 ,0 ,0 , // 1
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 2
0 ,0 ,0 ,0 ,0 ,'/',0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 3
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 4
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7
};
static boolean IN_Started;
static boolean CapsLock;
static ScanCode CurCode,LastCode;
static Direction DirTable[] = // Quick lookup for total direction
{
dir_NorthWest, dir_North, dir_NorthEast,
dir_West, dir_None, dir_East,
dir_SouthWest, dir_South, dir_SouthEast
};
static void (*INL_KeyHook)(void);
static void interrupt (*OldKeyVect)(void);
static char *ParmStrings[] = {"nojoys","nomouse",nil};
// Internal routines
///////////////////////////////////////////////////////////////////////////
//
// INL_KeyService() - Handles a keyboard interrupt (key up/down)
//
///////////////////////////////////////////////////////////////////////////
static void interrupt
INL_KeyService(void)
{
static boolean special;
byte k,c,
temp;
int i;
k = inportb(0x60); // Get the scan code
// Tell the XT keyboard controller to clear the key
outportb(0x61,(temp = inportb(0x61)) | 0x80);
outportb(0x61,temp);
if (k == 0xe0) // Special key prefix
special = true;
else if (k == 0xe1) // Handle Pause key
Paused = true;
else
{
if (k & 0x80) // Break code
{
k &= 0x7f;
// DEBUG - handle special keys: ctl-alt-delete, print scrn
Keyboard[k] = false;
}
else // Make code
{
LastCode = CurCode;
CurCode = LastScan = k;
Keyboard[k] = true;
if (special)
c = SpecialNames[k];
else
{
if (k == sc_CapsLock)
{
CapsLock ^= true;
// DEBUG - make caps lock light work
}
if (Keyboard[sc_LShift] || Keyboard[sc_RShift]) // If shifted
{
c = ShiftNames[k];
if ((c >= 'A') && (c <= 'Z') && CapsLock)
c += 'a' - 'A';
}
else
{
c = ASCIINames[k];
if ((c >= 'a') && (c <= 'z') && CapsLock)
c -= 'a' - 'A';
}
}
if (c)
LastASCII = c;
}
special = false;
}
if (INL_KeyHook && !special)
INL_KeyHook();
outportb(0x20,0x20);
}
///////////////////////////////////////////////////////////////////////////
//
// INL_GetMouseDelta() - Gets the amount that the mouse has moved from the
// mouse driver
//
///////////////////////////////////////////////////////////////////////////
static void
INL_GetMouseDelta(int *x,int *y)
{
Mouse(MDelta);
*x = _CX;
*y = _DX;
}
///////////////////////////////////////////////////////////////////////////
//
// INL_GetMouseButtons() - Gets the status of the mouse buttons from the
// mouse driver
//
///////////////////////////////////////////////////////////////////////////
static word
INL_GetMouseButtons(void)
{
word buttons;
Mouse(MButtons);
buttons = _BX;
return(buttons);
}
///////////////////////////////////////////////////////////////////////////
//
// IN_GetJoyAbs() - Reads the absolute position of the specified joystick
//
///////////////////////////////////////////////////////////////////////////
void
IN_GetJoyAbs(word joy,word *xp,word *yp)
{
byte xb,yb,
xs,ys;
word x,y;
x = y = 0;
xs = joy? 2 : 0; // Find shift value for x axis
xb = 1 << xs; // Use shift value to get x bit mask
ys = joy? 3 : 1; // Do the same for y axis
yb = 1 << ys;
// Read the absolute joystick values
asm pushf // Save some registers
asm push si
asm push di
asm cli // Make sure an interrupt doesn't screw the timings
asm mov dx,0x201
asm in al,dx
asm out dx,al // Clear the resistors
asm mov ah,[xb] // Get masks into registers
asm mov ch,[yb]
asm xor si,si // Clear count registers
asm xor di,di
asm xor bh,bh // Clear high byte of bx for later
asm push bp // Don't mess up stack frame
asm mov bp,MaxJoyValue
loop:
asm in al,dx // Get bits indicating whether all are finished
asm dec bp // Check bounding register
asm jz done // We have a silly value - abort
asm mov bl,al // Duplicate the bits
asm and bl,ah // Mask off useless bits (in [xb])
asm add si,bx // Possibly increment count register
asm mov cl,bl // Save for testing later
asm mov bl,al
asm and bl,ch // [yb]
asm add di,bx
asm add cl,bl
asm jnz loop // If both bits were 0, drop out
done:
asm pop bp
asm mov cl,[xs] // Get the number of bits to shift
asm shr si,cl // and shift the count that many times
asm mov cl,[ys]
asm shr di,cl
asm mov [x],si // Store the values into the variables
asm mov [y],di
asm pop di
asm pop si
asm popf // Restore the registers
*xp = x;
*yp = y;
}
///////////////////////////////////////////////////////////////////////////
//
// INL_GetJoyDelta() - Returns the relative movement of the specified
// joystick (from +/-127)
//
///////////////////////////////////////////////////////////////////////////
void INL_GetJoyDelta(word joy,int *dx,int *dy)
{
word x,y;
longword time;
JoystickDef *def;
static longword lasttime;
IN_GetJoyAbs(joy,&x,&y);
def = JoyDefs + joy;
if (x < def->threshMinX)
{
if (x < def->joyMinX)
x = def->joyMinX;
x = -(x - def->threshMinX);
x *= def->joyMultXL;
x >>= JoyScaleShift;
*dx = (x > 127)? -127 : -x;
}
else if (x > def->threshMaxX)
{
if (x > def->joyMaxX)
x = def->joyMaxX;
x = x - def->threshMaxX;
x *= def->joyMultXH;
x >>= JoyScaleShift;
*dx = (x > 127)? 127 : x;
}
else
*dx = 0;
if (y < def->threshMinY)
{
if (y < def->joyMinY)
y = def->joyMinY;
y = -(y - def->threshMinY);
y *= def->joyMultYL;
y >>= JoyScaleShift;
*dy = (y > 127)? -127 : -y;
}
else if (y > def->threshMaxY)
{
if (y > def->joyMaxY)
y = def->joyMaxY;
y = y - def->threshMaxY;
y *= def->joyMultYH;
y >>= JoyScaleShift;
*dy = (y > 127)? 127 : y;
}
else
*dy = 0;
lasttime = TimeCount;
}
///////////////////////////////////////////////////////////////////////////
//
// INL_GetJoyButtons() - Returns the button status of the specified
// joystick
//
///////////////////////////////////////////////////////////////////////////
static word
INL_GetJoyButtons(word joy)
{
register word result;
result = inportb(0x201); // Get all the joystick buttons
result >>= joy? 6 : 4; // Shift into bits 0-1
result &= 3; // Mask off the useless bits
result ^= 3;
return(result);
}
///////////////////////////////////////////////////////////////////////////
//
// IN_GetJoyButtonsDB() - Returns the de-bounced button status of the
// specified joystick
//
///////////////////////////////////////////////////////////////////////////
word
IN_GetJoyButtonsDB(word joy)
{
longword lasttime;
word result1,result2;
do
{
result1 = INL_GetJoyButtons(joy);
lasttime = TimeCount;
while (TimeCount == lasttime)
;
result2 = INL_GetJoyButtons(joy);
} while (result1 != result2);
return(result1);
}
///////////////////////////////////////////////////////////////////////////
//
// INL_StartKbd() - Sets up my keyboard stuff for use
//
///////////////////////////////////////////////////////////////////////////
static void
INL_StartKbd(void)
{
INL_KeyHook = NULL; // no key hook routine
IN_ClearKeysDown();
OldKeyVect = getvect(KeyInt);
setvect(KeyInt,INL_KeyService);
}
///////////////////////////////////////////////////////////////////////////
//
// INL_ShutKbd() - Restores keyboard control to the BIOS
//
///////////////////////////////////////////////////////////////////////////
static void
INL_ShutKbd(void)
{
poke(0x40,0x17,peek(0x40,0x17) & 0xfaf0); // Clear ctrl/alt/shift flags
setvect(KeyInt,OldKeyVect);
}
///////////////////////////////////////////////////////////////////////////
//
// INL_StartMouse() - Detects and sets up the mouse
//
///////////////////////////////////////////////////////////////////////////
static boolean
INL_StartMouse(void)
{
#if 0
if (getvect(MouseInt))
{
Mouse(MReset);
if (_AX == 0xffff)
return(true);
}
return(false);
#endif
union REGS regs;
unsigned char far *vector;
if ((vector=MK_FP(peek(0,0x33*4+2),peek(0,0x33*4)))==NULL)
return false;
if (*vector == 207)
return false;
Mouse(MReset);
return true;
}
///////////////////////////////////////////////////////////////////////////
//
// INL_ShutMouse() - Cleans up after the mouse
//
///////////////////////////////////////////////////////////////////////////
static void
INL_ShutMouse(void)
{
}
//
// INL_SetJoyScale() - Sets up scaling values for the specified joystick
//
static void
INL_SetJoyScale(word joy)
{
JoystickDef *def;
def = &JoyDefs[joy];
def->joyMultXL = JoyScaleMax / (def->threshMinX - def->joyMinX);
def->joyMultXH = JoyScaleMax / (def->joyMaxX - def->threshMaxX);
def->joyMultYL = JoyScaleMax / (def->threshMinY - def->joyMinY);
def->joyMultYH = JoyScaleMax / (def->joyMaxY - def->threshMaxY);
}
///////////////////////////////////////////////////////////////////////////
//
// IN_SetupJoy() - Sets up thresholding values and calls INL_SetJoyScale()
// to set up scaling values
//
///////////////////////////////////////////////////////////////////////////
void
IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy)
{
word d,r;
JoystickDef *def;
def = &JoyDefs[joy];
def->joyMinX = minx;
def->joyMaxX = maxx;
r = maxx - minx;
d = r / 3;
def->threshMinX = ((r / 2) - d) + minx;
def->threshMaxX = ((r / 2) + d) + minx;
def->joyMinY = miny;
def->joyMaxY = maxy;
r = maxy - miny;
d = r / 3;
def->threshMinY = ((r / 2) - d) + miny;
def->threshMaxY = ((r / 2) + d) + miny;
INL_SetJoyScale(joy);
}
///////////////////////////////////////////////////////////////////////////
//
// INL_StartJoy() - Detects & auto-configures the specified joystick
// The auto-config assumes the joystick is centered
//
///////////////////////////////////////////////////////////////////////////
static boolean
INL_StartJoy(word joy)
{
word x,y;
IN_GetJoyAbs(joy,&x,&y);
if
(
((x == 0) || (x > MaxJoyValue - 10))
|| ((y == 0) || (y > MaxJoyValue - 10))
)
return(false);
else
{
IN_SetupJoy(joy,0,x * 2,0,y * 2);
return(true);
}
}
///////////////////////////////////////////////////////////////////////////
//
// INL_ShutJoy() - Cleans up the joystick stuff
//
///////////////////////////////////////////////////////////////////////////
static void
INL_ShutJoy(word joy)
{
JoysPresent[joy] = false;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_Startup() - Starts up the Input Mgr
//
///////////////////////////////////////////////////////////////////////////
void
IN_Startup(void)
{
boolean checkjoys,checkmouse;
word i;
if (IN_Started)
return;
checkjoys = true;
checkmouse = true;
for (i = 1;i < _argc;i++)
{
switch (US_CheckParm(_argv[i],ParmStrings))
{
case 0:
checkjoys = false;
break;
case 1:
checkmouse = false;
break;
}
}
INL_StartKbd();
MousePresent = checkmouse? INL_StartMouse() : false;
for (i = 0;i < MaxJoys;i++)
JoysPresent[i] = checkjoys? INL_StartJoy(i) : false;
IN_Started = true;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_Default() - Sets up default conditions for the Input Mgr
//
///////////////////////////////////////////////////////////////////////////
void
IN_Default(boolean gotit,ControlType in)
{
if
(
(!gotit)
|| ((in == ctrl_Joystick1) && !JoysPresent[0])
|| ((in == ctrl_Joystick2) && !JoysPresent[1])
|| ((in == ctrl_Mouse) && !MousePresent)
)
in = ctrl_Keyboard1;
IN_SetControlType(0,in);
}
///////////////////////////////////////////////////////////////////////////
//
// IN_Shutdown() - Shuts down the Input Mgr
//
///////////////////////////////////////////////////////////////////////////
void
IN_Shutdown(void)
{
word i;
if (!IN_Started)
return;
INL_ShutMouse();
for (i = 0;i < MaxJoys;i++)
INL_ShutJoy(i);
INL_ShutKbd();
IN_Started = false;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_SetKeyHook() - Sets the routine that gets called by INL_KeyService()
// everytime a real make/break code gets hit
//
///////////////////////////////////////////////////////////////////////////
void
IN_SetKeyHook(void (*hook)())
{
INL_KeyHook = hook;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_ClearKeysDown() - Clears the keyboard array
//
///////////////////////////////////////////////////////////////////////////
void
IN_ClearKeysDown(void)
{
int i;
LastScan = sc_None;
LastASCII = key_None;
memset (Keyboard,0,sizeof(Keyboard));
}
///////////////////////////////////////////////////////////////////////////
//
// IN_ReadControl() - Reads the device associated with the specified
// player and fills in the control info struct
//
///////////////////////////////////////////////////////////////////////////
void
IN_ReadControl(int player,ControlInfo *info)
{
boolean realdelta;
byte dbyte;
word buttons;
int dx,dy;
Motion mx,my;
ControlType type;
register KeyboardDef *def;
dx = dy = 0;
mx = my = motion_None;
buttons = 0;
if (DemoMode == demo_Playback)
{
dbyte = DemoBuffer[DemoOffset + 1];
my = (dbyte & 3) - 1;
mx = ((dbyte >> 2) & 3) - 1;
buttons = (dbyte >> 4) & 3;
if (!(--DemoBuffer[DemoOffset]))
{
DemoOffset += 2;
if (DemoOffset >= DemoSize)
DemoMode = demo_PlayDone;
}
realdelta = false;
}
else if (DemoMode == demo_PlayDone)
Quit("Demo playback exceeded");
else
{
switch (type = Controls[player])
{
case ctrl_Keyboard:
def = &KbdDefs;
if (Keyboard[def->upleft])
mx = motion_Left,my = motion_Up;
else if (Keyboard[def->upright])
mx = motion_Right,my = motion_Up;
else if (Keyboard[def->downleft])
mx = motion_Left,my = motion_Down;
else if (Keyboard[def->downright])
mx = motion_Right,my = motion_Down;
if (Keyboard[def->up])
my = motion_Up;
else if (Keyboard[def->down])
my = motion_Down;
if (Keyboard[def->left])
mx = motion_Left;
else if (Keyboard[def->right])
mx = motion_Right;
if (Keyboard[def->button0])
buttons += 1 << 0;
if (Keyboard[def->button1])
buttons += 1 << 1;
realdelta = false;
break;
case ctrl_Joystick1:
case ctrl_Joystick2:
INL_GetJoyDelta(type - ctrl_Joystick,&dx,&dy);
buttons = INL_GetJoyButtons(type - ctrl_Joystick);
realdelta = true;
break;
case ctrl_Mouse:
INL_GetMouseDelta(&dx,&dy);
buttons = INL_GetMouseButtons();
realdelta = true;
break;
}
}
if (realdelta)
{
mx = (dx < 0)? motion_Left : ((dx > 0)? motion_Right : motion_None);
my = (dy < 0)? motion_Up : ((dy > 0)? motion_Down : motion_None);
}
else
{
dx = mx * 127;
dy = my * 127;
}
info->x = dx;
info->xaxis = mx;
info->y = dy;
info->yaxis = my;
info->button0 = buttons & (1 << 0);
info->button1 = buttons & (1 << 1);
info->button2 = buttons & (1 << 2);
info->button3 = buttons & (1 << 3);
info->dir = DirTable[((my + 1) * 3) + (mx + 1)];
if (DemoMode == demo_Record)
{
// Pack the control info into a byte
dbyte = (buttons << 4) | ((mx + 1) << 2) | (my + 1);
if
(
(DemoBuffer[DemoOffset + 1] == dbyte)
&& (DemoBuffer[DemoOffset] < 255)
)
(DemoBuffer[DemoOffset])++;
else
{
if (DemoOffset || DemoBuffer[DemoOffset])
DemoOffset += 2;
if (DemoOffset >= DemoSize)
Quit("Demo buffer overflow");
DemoBuffer[DemoOffset] = 1;
DemoBuffer[DemoOffset + 1] = dbyte;
}
}
}
///////////////////////////////////////////////////////////////////////////
//
// IN_SetControlType() - Sets the control type to be used by the specified
// player
//
///////////////////////////////////////////////////////////////////////////
void
IN_SetControlType(int player,ControlType type)
{
// DEBUG - check that requested type is present?
Controls[player] = type;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_WaitForKey() - Waits for a scan code, then clears LastScan and
// returns the scan code
//
///////////////////////////////////////////////////////////////////////////
ScanCode
IN_WaitForKey(void)
{
ScanCode result;
while (!(result = LastScan))
;
LastScan = 0;
return(result);
}
///////////////////////////////////////////////////////////////////////////
//
// IN_WaitForASCII() - Waits for an ASCII char, then clears LastASCII and
// returns the ASCII value
//
///////////////////////////////////////////////////////////////////////////
char
IN_WaitForASCII(void)
{
char result;
while (!(result = LastASCII))
;
LastASCII = '\0';
return(result);
}
///////////////////////////////////////////////////////////////////////////
//
// IN_Ack() - waits for a button or key press. If a button is down, upon
// calling, it must be released for it to be recognized
//
///////////////////////////////////////////////////////////////////////////
boolean btnstate[8];
void IN_StartAck(void)
{
unsigned i,buttons;
//
// get initial state of everything
//
IN_ClearKeysDown();
memset (btnstate,0,sizeof(btnstate));
buttons = IN_JoyButtons () << 4;
if (MousePresent)
buttons |= IN_MouseButtons ();
for (i=0;i<8;i++,buttons>>=1)
if (buttons&1)
btnstate[i] = true;
}
boolean IN_CheckAck (void)
{
unsigned i,buttons;
//
// see if something has been pressed
//
if (LastScan)
return true;
buttons = IN_JoyButtons () << 4;
if (MousePresent)
buttons |= IN_MouseButtons ();
for (i=0;i<8;i++,buttons>>=1)
if ( buttons&1 )
{
if (!btnstate[i])
return true;
}
else
btnstate[i]=false;
return false;
}
void IN_Ack (void)
{
IN_StartAck ();
while (!IN_CheckAck ())
;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_UserInput() - Waits for the specified delay time (in ticks) or the
// user pressing a key or a mouse button. If the clear flag is set, it
// then either clears the key or waits for the user to let the mouse
// button up.
//
///////////////////////////////////////////////////////////////////////////
boolean IN_UserInput(longword delay)
{
longword lasttime;
lasttime = TimeCount;
IN_StartAck ();
do
{
if (IN_CheckAck())
return true;
} while (TimeCount - lasttime < delay);
return(false);
}
//===========================================================================
/*
===================
=
= IN_MouseButtons
=
===================
*/
byte IN_MouseButtons (void)
{
if (MousePresent)
{
Mouse(MButtons);
return _BX;
}
else
return 0;
}
/*
===================
=
= IN_JoyButtons
=
===================
*/
byte IN_JoyButtons (void)
{
unsigned joybits;
joybits = inportb(0x201); // Get all the joystick buttons
joybits >>= 4; // only the high bits are useful
joybits ^= 15; // return with 1=pressed
return joybits;
}

202
ID_IN.H Normal file
View file

@ -0,0 +1,202 @@
//
// 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_BackSpace 0x0e
#define sc_Tab 0x0f
#define sc_Alt 0x38
#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_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_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 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
// Stuff for the mouse
#define MReset 0
#define MButtons 3
#define MDelta 11
#define MouseInt 0x33
#define Mouse(x) _AX = x,geninterrupt(MouseInt)
typedef enum {
demo_Off,demo_Record,demo_Playback,demo_PlayDone
} Demo;
typedef enum {
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 Keyboard[],
MousePresent,
JoysPresent[];
extern boolean Paused;
extern char LastASCII;
extern ScanCode LastScan;
extern KeyboardDef KbdDefs;
extern JoystickDef JoyDefs[];
extern ControlType Controls[MaxPlayers];
extern Demo DemoMode;
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 *IN_GetScanName(ScanCode);
byte IN_MouseButtons (void);
byte IN_JoyButtons (void);
void INL_GetJoyDelta(word joy,int *dx,int *dy);
void IN_StartAck(void);
boolean IN_CheckAck (void);
#endif

953
ID_MM.C Normal file
View file

@ -0,0 +1,953 @@
// NEWMM.C
/*
=============================================================================
ID software memory manager
--------------------------
Primary coder: John Carmack
RELIES ON
---------
Quit (char *error) function
WORK TO DO
----------
MM_SizePtr to change the size of a given pointer
Multiple purge levels utilized
EMS / XMS unmanaged routines
=============================================================================
*/
#include "ID_HEADS.H"
#pragma hdrstop
#pragma warn -pro
#pragma warn -use
/*
=============================================================================
LOCAL INFO
=============================================================================
*/
#define LOCKBIT 0x80 // if set in attributes, block cannot be moved
#define PURGEBITS 3 // 0-3 level, 0= unpurgable, 3= purge first
#define PURGEMASK 0xfffc
#define BASEATTRIBUTES 0 // unlocked, non purgable
#define MAXUMBS 10
typedef struct mmblockstruct
{
unsigned start,length;
unsigned attributes;
memptr *useptr; // pointer to the segment start
struct mmblockstruct far *next;
} mmblocktype;
//#define GETNEWBLOCK {if(!(mmnew=mmfree))Quit("MM_GETNEWBLOCK: No free blocks!")\
// ;mmfree=mmfree->next;}
#define GETNEWBLOCK {if(!mmfree)MML_ClearBlock();mmnew=mmfree;mmfree=mmfree->next;}
#define FREEBLOCK(x) {*x->useptr=NULL;x->next=mmfree;mmfree=x;}
/*
=============================================================================
GLOBAL VARIABLES
=============================================================================
*/
mminfotype mminfo;
memptr bufferseg;
boolean mmerror;
void (* beforesort) (void);
void (* aftersort) (void);
/*
=============================================================================
LOCAL VARIABLES
=============================================================================
*/
boolean mmstarted;
void far *farheap;
void *nearheap;
mmblocktype far mmblocks[MAXBLOCKS]
,far *mmhead,far *mmfree,far *mmrover,far *mmnew;
boolean bombonerror;
//unsigned totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle;
void (* XMSaddr) (void); // far pointer to XMS driver
unsigned numUMBs,UMBbase[MAXUMBS];
//==========================================================================
//
// local prototypes
//
boolean MML_CheckForEMS (void);
void MML_ShutdownEMS (void);
void MM_MapEMS (void);
boolean MML_CheckForXMS (void);
void MML_ShutdownXMS (void);
void MML_UseSpace (unsigned segstart, unsigned seglength);
void MML_ClearBlock (void);
//==========================================================================
/*
======================
=
= MML_CheckForXMS
=
= Check for XMM driver
=
=======================
*/
boolean MML_CheckForXMS (void)
{
numUMBs = 0;
asm {
mov ax,0x4300
int 0x2f // query status of installed diver
cmp al,0x80
je good
}
return false;
good:
return true;
}
/*
======================
=
= MML_SetupXMS
=
= Try to allocate all upper memory block
=
=======================
*/
void MML_SetupXMS (void)
{
unsigned base,size;
asm {
mov ax,0x4310
int 0x2f
mov [WORD PTR XMSaddr],bx
mov [WORD PTR XMSaddr+2],es // function pointer to XMS driver
}
getmemory:
asm {
mov ah,XMS_ALLOCUMB
mov dx,0xffff // try for largest block possible
call [DWORD PTR XMSaddr]
or ax,ax
jnz gotone
cmp bl,0xb0 // error: smaller UMB is available
jne done;
mov ah,XMS_ALLOCUMB
call [DWORD PTR XMSaddr] // DX holds largest available UMB
or ax,ax
jz done // another error...
}
gotone:
asm {
mov [base],bx
mov [size],dx
}
MML_UseSpace (base,size);
mminfo.XMSmem += size*16;
UMBbase[numUMBs] = base;
numUMBs++;
if (numUMBs < MAXUMBS)
goto getmemory;
done:;
}
/*
======================
=
= MML_ShutdownXMS
=
======================
*/
void MML_ShutdownXMS (void)
{
int i;
unsigned base;
for (i=0;i<numUMBs;i++)
{
base = UMBbase[i];
asm mov ah,XMS_FREEUMB
asm mov dx,[base]
asm call [DWORD PTR XMSaddr]
}
}
//==========================================================================
/*
======================
=
= MML_UseSpace
=
= Marks a range of paragraphs as usable by the memory manager
= This is used to mark space for the near heap, far heap, ems page frame,
= and upper memory blocks
=
======================
*/
void MML_UseSpace (unsigned segstart, unsigned seglength)
{
mmblocktype far *scan,far *last;
unsigned oldend;
long extra;
scan = last = mmhead;
mmrover = mmhead; // reset rover to start of memory
//
// search for the block that contains the range of segments
//
while (scan->start+scan->length < segstart)
{
last = scan;
scan = scan->next;
}
//
// take the given range out of the block
//
oldend = scan->start + scan->length;
extra = oldend - (segstart+seglength);
if (extra < 0)
Quit ("MML_UseSpace: Segment spans two blocks!");
if (segstart == scan->start)
{
last->next = scan->next; // unlink block
FREEBLOCK(scan);
scan = last;
}
else
scan->length = segstart-scan->start; // shorten block
if (extra > 0)
{
GETNEWBLOCK;
mmnew->useptr = NULL;
mmnew->next = scan->next;
scan->next = mmnew;
mmnew->start = segstart+seglength;
mmnew->length = extra;
mmnew->attributes = LOCKBIT;
}
}
//==========================================================================
/*
====================
=
= MML_ClearBlock
=
= We are out of blocks, so free a purgable block
=
====================
*/
void MML_ClearBlock (void)
{
mmblocktype far *scan,far *last;
scan = mmhead->next;
while (scan)
{
if (!(scan->attributes&LOCKBIT) && (scan->attributes&PURGEBITS) )
{
MM_FreePtr(scan->useptr);
return;
}
scan = scan->next;
}
Quit ("MM_ClearBlock: No purgable blocks!");
}
//==========================================================================
/*
===================
=
= MM_Startup
=
= Grabs all space from turbo with malloc/farmalloc
= Allocates bufferseg misc buffer
=
===================
*/
static char *ParmStrings[] = {"noems","noxms",""};
void MM_Startup (void)
{
int i;
unsigned long length;
void far *start;
unsigned segstart,seglength,endfree;
if (mmstarted)
MM_Shutdown ();
mmstarted = true;
bombonerror = true;
//
// set up the linked list (everything in the free list;
//
mmhead = NULL;
mmfree = &mmblocks[0];
for (i=0;i<MAXBLOCKS-1;i++)
mmblocks[i].next = &mmblocks[i+1];
mmblocks[i].next = NULL;
//
// locked block of all memory until we punch out free space
//
GETNEWBLOCK;
mmhead = mmnew; // this will allways be the first node
mmnew->start = 0;
mmnew->length = 0xffff;
mmnew->attributes = LOCKBIT;
mmnew->next = NULL;
mmrover = mmhead;
//
// get all available near conventional memory segments
//
length=coreleft();
start = (void far *)(nearheap = malloc(length));
length -= 16-(FP_OFF(start)&15);
length -= SAVENEARHEAP;
seglength = length / 16; // now in paragraphs
segstart = FP_SEG(start)+(FP_OFF(start)+15)/16;
MML_UseSpace (segstart,seglength);
mminfo.nearheap = length;
//
// get all available far conventional memory segments
//
length=farcoreleft();
start = farheap = farmalloc(length);
length -= 16-(FP_OFF(start)&15);
length -= SAVEFARHEAP;
seglength = length / 16; // now in paragraphs
segstart = FP_SEG(start)+(FP_OFF(start)+15)/16;
MML_UseSpace (segstart,seglength);
mminfo.farheap = length;
mminfo.mainmem = mminfo.nearheap + mminfo.farheap;
//
// allocate the misc buffer
//
mmrover = mmhead; // start looking for space after low block
MM_GetPtr (&bufferseg,BUFFERSIZE);
}
//==========================================================================
/*
====================
=
= MM_Shutdown
=
= Frees all conventional, EMS, and XMS allocated
=
====================
*/
void MM_Shutdown (void)
{
if (!mmstarted)
return;
farfree (farheap);
free (nearheap);
// MML_ShutdownXMS ();
}
//==========================================================================
/*
====================
=
= MM_GetPtr
=
= Allocates an unlocked, unpurgable block
=
====================
*/
void MM_GetPtr (memptr *baseptr,unsigned long size)
{
mmblocktype far *scan,far *lastscan,far *endscan
,far *purge,far *next;
int search;
unsigned needed,startseg;
needed = (size+15)/16; // convert size from bytes to paragraphs
GETNEWBLOCK; // fill in start and next after a spot is found
mmnew->length = needed;
mmnew->useptr = baseptr;
mmnew->attributes = BASEATTRIBUTES;
tryagain:
for (search = 0; search<3; search++)
{
//
// first search: try to allocate right after the rover, then on up
// second search: search from the head pointer up to the rover
// third search: compress memory, then scan from start
if (search == 1 && mmrover == mmhead)
search++;
switch (search)
{
case 0:
lastscan = mmrover;
scan = mmrover->next;
endscan = NULL;
break;
case 1:
lastscan = mmhead;
scan = mmhead->next;
endscan = mmrover;
break;
case 2:
MM_SortMem ();
lastscan = mmhead;
scan = mmhead->next;
endscan = NULL;
break;
}
startseg = lastscan->start + lastscan->length;
while (scan != endscan)
{
if (scan->start - startseg >= needed)
{
//
// got enough space between the end of lastscan and
// the start of scan, so throw out anything in the middle
// and allocate the new block
//
purge = lastscan->next;
lastscan->next = mmnew;
mmnew->start = *(unsigned *)baseptr = startseg;
mmnew->next = scan;
while ( purge != scan)
{ // free the purgable block
next = purge->next;
FREEBLOCK(purge);
purge = next; // purge another if not at scan
}
mmrover = mmnew;
return; // good allocation!
}
//
// if this block is purge level zero or locked, skip past it
//
if ( (scan->attributes & LOCKBIT)
|| !(scan->attributes & PURGEBITS) )
{
lastscan = scan;
startseg = lastscan->start + lastscan->length;
}
scan=scan->next; // look at next line
}
}
if (bombonerror)
{
extern char configname[];
extern boolean insetupscaling;
extern int viewsize;
boolean SetViewSize (unsigned width, unsigned height);
#define HEIGHTRATIO 0.50
//
// wolf hack -- size the view down
//
if (!insetupscaling && viewsize>10)
{
mmblocktype far *savedmmnew;
savedmmnew = mmnew;
viewsize -= 2;
SetViewSize (viewsize*16,viewsize*16*HEIGHTRATIO);
mmnew = savedmmnew;
goto tryagain;
}
// unlink(configname);
Quit ("MM_GetPtr: Out of memory!");
}
else
mmerror = true;
}
//==========================================================================
/*
====================
=
= MM_FreePtr
=
= Deallocates an unlocked, purgable block
=
====================
*/
void MM_FreePtr (memptr *baseptr)
{
mmblocktype far *scan,far *last;
last = mmhead;
scan = last->next;
if (baseptr == mmrover->useptr) // removed the last allocated block
mmrover = mmhead;
while (scan->useptr != baseptr && scan)
{
last = scan;
scan = scan->next;
}
if (!scan)
Quit ("MM_FreePtr: Block not found!");
last->next = scan->next;
FREEBLOCK(scan);
}
//==========================================================================
/*
=====================
=
= MM_SetPurge
=
= Sets the purge level for a block (locked blocks cannot be made purgable)
=
=====================
*/
void MM_SetPurge (memptr *baseptr, int purge)
{
mmblocktype far *start;
start = mmrover;
do
{
if (mmrover->useptr == baseptr)
break;
mmrover = mmrover->next;
if (!mmrover)
mmrover = mmhead;
else if (mmrover == start)
Quit ("MM_SetPurge: Block not found!");
} while (1);
mmrover->attributes &= ~PURGEBITS;
mmrover->attributes |= purge;
}
//==========================================================================
/*
=====================
=
= MM_SetLock
=
= Locks / unlocks the block
=
=====================
*/
void MM_SetLock (memptr *baseptr, boolean locked)
{
mmblocktype far *start;
start = mmrover;
do
{
if (mmrover->useptr == baseptr)
break;
mmrover = mmrover->next;
if (!mmrover)
mmrover = mmhead;
else if (mmrover == start)
Quit ("MM_SetLock: Block not found!");
} while (1);
mmrover->attributes &= ~LOCKBIT;
mmrover->attributes |= locked*LOCKBIT;
}
//==========================================================================
/*
=====================
=
= MM_SortMem
=
= Throws out all purgable stuff and compresses movable blocks
=
=====================
*/
void MM_SortMem (void)
{
mmblocktype far *scan,far *last,far *next;
unsigned start,length,source,dest;
int playing;
//
// lock down a currently playing sound
//
playing = SD_SoundPlaying ();
if (playing)
{
switch (SoundMode)
{
case sdm_PC:
playing += STARTPCSOUNDS;
break;
case sdm_AdLib:
playing += STARTADLIBSOUNDS;
break;
}
MM_SetLock(&(memptr)audiosegs[playing],true);
}
SD_StopSound();
if (beforesort)
beforesort();
scan = mmhead;
last = NULL; // shut up compiler warning
while (scan)
{
if (scan->attributes & LOCKBIT)
{
//
// block is locked, so try to pile later blocks right after it
//
start = scan->start + scan->length;
}
else
{
if (scan->attributes & PURGEBITS)
{
//
// throw out the purgable block
//
next = scan->next;
FREEBLOCK(scan);
last->next = next;
scan = next;
continue;
}
else
{
//
// push the non purgable block on top of the last moved block
//
if (scan->start != start)
{
length = scan->length;
source = scan->start;
dest = start;
while (length > 0xf00)
{
movedata(source,0,dest,0,0xf00*16);
length -= 0xf00;
source += 0xf00;
dest += 0xf00;
}
movedata(source,0,dest,0,length*16);
scan->start = start;
*(unsigned *)scan->useptr = start;
}
start = scan->start + scan->length;
}
}
last = scan;
scan = scan->next; // go to next block
}
mmrover = mmhead;
if (aftersort)
aftersort();
if (playing)
MM_SetLock(&(memptr)audiosegs[playing],false);
}
//==========================================================================
/*
=====================
=
= MM_ShowMemory
=
=====================
*/
void MM_ShowMemory (void)
{
mmblocktype far *scan;
unsigned color,temp,x,y;
long end,owner;
char scratch[80],str[10];
temp = bufferofs;
bufferofs = displayofs;
scan = mmhead;
end = -1;
while (scan)
{
if (scan->attributes & PURGEBITS)
color = 5; // dark purple = purgable
else
color = 9; // medium blue = non purgable
if (scan->attributes & LOCKBIT)
color = 12; // red = locked
if (scan->start<=end)
Quit ("MM_ShowMemory: Memory block order currupted!");
end = scan->length-1;
y = scan->start/320;
x = scan->start%320;
VW_Hlin(x,x+end,y,color);
VW_Plot(x,y,15);
if (scan->next && scan->next->start > end+1)
VW_Hlin(x+end+1,x+(scan->next->start-scan->start),y,0); // black = free
scan = scan->next;
}
VW_FadeIn ();
IN_Ack();
bufferofs = temp;
}
//==========================================================================
/*
=====================
=
= MM_DumpData
=
=====================
*/
void MM_DumpData (void)
{
mmblocktype far *scan,far *best;
long lowest,oldlowest;
unsigned owner;
char lock,purge;
FILE *dumpfile;
free (nearheap);
dumpfile = fopen ("MMDUMP.TXT","w");
if (!dumpfile)
Quit ("MM_DumpData: Couldn't open MMDUMP.TXT!");
lowest = -1;
do
{
oldlowest = lowest;
lowest = 0xffff;
scan = mmhead;
while (scan)
{
owner = (unsigned)scan->useptr;
if (owner && owner<lowest && owner > oldlowest)
{
best = scan;
lowest = owner;
}
scan = scan->next;
}
if (lowest != 0xffff)
{
if (best->attributes & PURGEBITS)
purge = 'P';
else
purge = '-';
if (best->attributes & LOCKBIT)
lock = 'L';
else
lock = '-';
fprintf (dumpfile,"0x%p (%c%c) = %u\n"
,(unsigned)lowest,lock,purge,best->length);
}
} while (lowest != 0xffff);
fclose (dumpfile);
Quit ("MMDUMP.TXT created.");
}
//==========================================================================
/*
======================
=
= MM_UnusedMemory
=
= Returns the total free space without purging
=
======================
*/
long MM_UnusedMemory (void)
{
unsigned free;
mmblocktype far *scan;
free = 0;
scan = mmhead;
while (scan->next)
{
free += scan->next->start - (scan->start + scan->length);
scan = scan->next;
}
return free*16l;
}
//==========================================================================
/*
======================
=
= MM_TotalFree
=
= Returns the total free space with purging
=
======================
*/
long MM_TotalFree (void)
{
unsigned free;
mmblocktype far *scan;
free = 0;
scan = mmhead;
while (scan->next)
{
if ((scan->attributes&PURGEBITS) && !(scan->attributes&LOCKBIT))
free += scan->length;
free += scan->next->start - (scan->start + scan->length);
scan = scan->next;
}
return free*16l;
}
//==========================================================================
/*
=====================
=
= MM_BombOnError
=
=====================
*/
void MM_BombOnError (boolean bomb)
{
bombonerror = bomb;
}

96
ID_MM.H Normal file
View file

@ -0,0 +1,96 @@
// 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 700
//--------
#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 mminfotype mminfo;
extern memptr bufferseg;
extern boolean mmerror;
extern void (* beforesort) (void);
extern void (* aftersort) (void);
//==========================================================================
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);
void MM_BombOnError (boolean bomb);
void MML_UseSpace (unsigned segstart, unsigned seglength);
#endif

1199
ID_PM.C Normal file

File diff suppressed because it is too large Load diff

83
ID_PM.H Normal file
View file

@ -0,0 +1,83 @@
//
// 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 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;
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 void PM_Startup(void),
PM_Shutdown(void),
PM_Reset(void),
PM_Preload(boolean (*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
void PM_SetMainMemPurge(int level);

2367
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

237
ID_SD.H Normal file
View file

@ -0,0 +1,237 @@
//
// 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 boolean DigiPlaying;
extern int DigiMap[];
extern longword TimeCount; // Global time in ticks
// 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

526
ID_SD_A.ASM Normal file
View file

@ -0,0 +1,526 @@
;
; 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 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 ?
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
;============================================================================
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
;
; 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
;
; 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 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

123
ID_US.H Normal file
View file

@ -0,0 +1,123 @@
//
// 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 7
typedef struct
{
char name[MaxHighName + 1];
long score;
word completed,episode;
} 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;
// Hack import for TED launch support
extern boolean tedlevel;
extern int 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[];
#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 *buf,char *def,boolean escok,
int maxchars,int maxwidth);
extern int US_CheckParm(char *parm,char **strings),
US_RndT(void);
void USL_PrintInCenter(char far *s,Rect r);
char *USL_GiveSaveName(word game);
#endif

755
ID_US_1.C Normal file
View file

@ -0,0 +1,755 @@
//
// 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;
// Internal variables
#define ConfigVersion 1
static char *ParmStrings[] = {"TEDLEVEL","NOWAIT"},
*ParmStrings2[] = {"COMP","NOCOMP"};
static 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] =
{
{"id software-'92",10000,1},
{"Adrian Carmack",10000,1},
{"John Carmack",10000,1},
{"Kevin Cloud",10000,1},
{"Tom Hall",10000,1},
{"John Romero",10000,1},
{"Jay Wilbur",10000,1},
};
// 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
US_SaveWindow(&wr);
US_CenterWindow(30,3);
US_CPrint(s);
US_CPrint("(R)etry or (A)bort?");
VW_UpdateScreen();
IN_ClearKeysDown();
asm sti // Let the keyboard interrupts come through
while (true)
{
switch (IN_WaitForASCII())
{
case key_Escape:
case 'a':
case 'A':
goto oh_kill_me;
break;
case key_Return:
case key_Space:
case 'r':
case 'R':
US_ClearWindow();
VW_UpdateScreen();
US_RestoreWindow(&wr);
return(RETRY);
break;
}
}
oh_kill_me:
abortprogram = s;
ShutdownId();
fprintf(stderr,"Terminal Error: %s\n",s);
if (tedlevel)
fprintf(stderr,"You launched from TED. I suggest that you reboot...\n");
return(ABORT);
#undef IGNORE
#undef RETRY
#undef ABORT
}
#pragma warn +par
#pragma warn +rch
///////////////////////////////////////////////////////////////////////////
//
// US_Startup() - Starts the User Mgr
//
///////////////////////////////////////////////////////////////////////////
void
US_Startup(void)
{
int i,n;
if (US_Started)
return;
harderr(USL_HardError); // Install the fatal error handler
US_InitRndT(true); // Initialize the random number generator
for (i = 1;i < _argc;i++)
{
switch (US_CheckParm(_argv[i],ParmStrings2))
{
case 0:
compatability = true;
break;
case 1:
compatability = false;
break;
}
}
// Check for TED launching here
for (i = 1;i < _argc;i++)
{
n = US_CheckParm(_argv[i],ParmStrings);
switch(n)
{
case 0:
tedlevelnum = atoi(_argv[i + 1]);
if (tedlevelnum >= 0)
tedlevel = true;
break;
case 1:
NoWait = true;
break;
}
}
US_Started = true;
}
///////////////////////////////////////////////////////////////////////////
//
// 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 *parm,char **strings)
{
char cp,cs,
*p,*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
///////////////////////////////////////////////////////////////////////////
//
// 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;
}
///////////////////////////////////////////////////////////////////////////
//
// 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));
}
///////////////////////////////////////////////////////////////////////////
//
// US_PrintSigned() - Prints a signed long
//
///////////////////////////////////////////////////////////////////////////
void
US_PrintSigned(long n)
{
char buffer[32];
US_Print(ltoa(n,buffer,10));
}
///////////////////////////////////////////////////////////////////////////
//
// 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)
Quit("US_CPrintLine() - String exceeds 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,WHITE);
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;
if (status^=1)
USL_DrawString("\x80");
else
{
temp = fontcolor;
fontcolor = backcolor;
USL_DrawString("\x80");
fontcolor = temp;
}
}
///////////////////////////////////////////////////////////////////////////
//
// 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 *buf,char *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)
strcpy(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)
USL_XORICursor(x,y,s,cursor);
asm pushf
asm cli
sc = LastScan;
LastScan = sc_None;
c = LastASCII;
LastASCII = key_None;
asm popf
switch (sc)
{
case sc_LeftArrow:
if (cursor)
cursor--;
c = key_None;
cursormoved = true;
break;
case sc_RightArrow:
if (s[cursor])
cursor++;
c = key_None;
cursormoved = true;
break;
case sc_Home:
cursor = 0;
c = key_None;
cursormoved = true;
break;
case sc_End:
cursor = strlen(s);
c = key_None;
cursormoved = true;
break;
case sc_Return:
strcpy(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;
case sc_Delete:
if (s[cursor])
{
strcpy(s + cursor,s + cursor + 1);
redraw = true;
}
c = key_None;
cursormoved = true;
break;
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)
USL_XORICursor(x,y,s,cursor);
VW_UpdateScreen();
}
if (cursorvis)
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

547
ID_VH.C Normal file
View file

@ -0,0 +1,547 @@
// 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];
//==========================================================================
pictabletype _seg *pictable;
int px,py;
byte fontcolor,backcolor;
int fontnumber;
int bufferwidth,bufferheight;
//==========================================================================
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;
}
void VW_DrawColorPropString (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 rcr cx,1 // inc font color
asm jc cont
asm inc ah
cont:
asm rcl cx,1
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;
}
//==========================================================================
/*
=================
=
= 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)
MS_Quit ("VL_MungePic: Not divisable by 4!");
//
// 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);
}
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]);
}
void VW_MeasureMPropString (char far *string, word *width, word *height)
{
VWL_MeasureString(string,width,height,(fontstruct _seg *)grsegs[STARTFONTM+fontnumber]);
}
/*
=============================================================================
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);
}
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);
}
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);
}
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);
}
void VW_UpdateScreen (void)
{
VH_UpdateScreen ();
}
/*
=============================================================================
WOLFENSTEIN STUFF
=============================================================================
*/
/*
=====================
=
= LatchDrawPic
=
=====================
*/
void LatchDrawPic (unsigned x, unsigned y, unsigned picnum)
{
unsigned wide, height, source;
wide = pictable[picnum-STARTPICS].width;
height = pictable[picnum-STARTPICS].height;
source = latchpics[2+picnum-LATCHPICS_LUMP_START];
VL_LatchToScreen (source,wide/4,height,x*8,y);
}
//==========================================================================
/*
===================
=
= LoadLatchMem
=
===================
*/
void LoadLatchMem (void)
{
int i,j,p,m,width,height,start,end;
byte far *src;
unsigned destoff;
//
// tile 8s
//
latchpics[0] = 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[1] = 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
//
start = LATCHPICS_LUMP_START;
end = LATCHPICS_LUMP_END;
for (i=start;i<=end;i++)
{
latchpics[2+i-start] = 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
;
} while (1);
}

134
ID_VH.H Normal file
View file

@ -0,0 +1,134 @@
// 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;
//
// Double buffer management routines
//
void VW_InitDoubleBuffer (void);
int VW_MarkUpdateBlock (int x1, int y1, int x2, int y2);
void VW_UpdateScreen (void);
//
// 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 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 gamepal;
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,&gamepal,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 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;

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

1084
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

161
ID_VL.H Normal file
View file

@ -0,0 +1,161 @@
// 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 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 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 far *palette);
void VL_GetPalette (byte far *palette);
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_MaskedToScreen (byte far *source, 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);
void VL_TestPaletteSet (void);

742
ID_VL_A.ASM Normal file
View file

@ -0,0 +1,742 @@
; 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
;===========================================================================
;==============
;
; VL_WaitVBL ******** NEW *********
;
; Wait for the vertical retrace (returns before the actual vertical sync)
;
;==============
PROC VL_WaitVBL num:WORD
PUBLIC VL_WaitVBL
@@wait:
mov dx,STATUS_REGISTER_1
mov cx,[num]
;
; wait for a display signal to make sure the raster isn't in the middle
; of a sync
;
@@waitnosync:
in al,dx
test al,8
jnz @@waitnosync
@@waitsync:
in al,dx
test al,8
jz @@waitsync
loop @@waitnosync
ret
ENDP
;===========================================================================
;==============
;
; 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

14
MAPSSDM.H Normal file
View file

@ -0,0 +1,14 @@
///////////////////////////////////////
//
// TED5 Map Header for SDM
//
///////////////////////////////////////
//
// Map Names
//
typedef enum {
TUNNELS_1_MAP, // 0
TUNNELS_2_MAP, // 1
LASTMAP
} mapnames;

33
MAPSSOD.H Normal file
View file

@ -0,0 +1,33 @@
///////////////////////////////////////
//
// TED5 Map Header for SOD
//
///////////////////////////////////////
//
// Map Names
//
typedef enum {
TUNNELS_1_MAP, // 0
TUNNELS_2_MAP, // 1
TUNNELS_3_MAP, // 2
TUNNELS_4_MAP, // 3
TUNNEL_BOSS_MAP, // 4
DUNGEONS_1_MAP, // 5
DUNGEONS_2_MAP, // 6
DUNGEONS_3_MAP, // 7
DUNGEONS_4_MAP, // 8
DUNGEON_BOSS_MAP, // 9
CASTLE_1_MAP, // 10
CASTLE_2_MAP, // 11
CASTLE_3_MAP, // 12
CASTLE_4_MAP, // 13
CASTLE_5_MAP, // 14
CASTLE_BOSS_MAP, // 15
RAMPARTS_MAP, // 16
DEATH_KNIGHT_MAP, // 17
SECRET_1_MAP, // 18
SECRET_2_MAP, // 19
ANGEL_OF_DEATH_MAP, // 20
LASTMAP
} mapnames;

42
MAPSWL1.H Normal file
View file

@ -0,0 +1,42 @@
///////////////////////////////////////
//
// TED5 Map Header for WL1
//
///////////////////////////////////////
//
// Map Names
//
typedef enum {
WOLF1_MAP1_MAP, // 0
WOLF1_MAP2_MAP, // 1
WOLF1_MAP3_MAP, // 2
WOLF1_MAP4_MAP, // 3
WOLF1_MAP5_MAP, // 4
WOLF1_MAP6_MAP, // 5
WOLF1_MAP7_MAP, // 6
WOLF1_MAP8_MAP, // 7
WOLF1_BOSS_MAP, // 8
WOLF1_SECRET_MAP, // 9
WOLF2_MAP1_MAP, // 10
WOLF2_MAP2_MAP, // 11
WOLF2_MAP3_MAP, // 12
WOLF2_MAP4_MAP, // 13
WOLF2_MAP5_MAP, // 14
WOLF2_MAP6_MAP, // 15
WOLF2_MAP7_MAP, // 16
WOLF2_MAP8_MAP, // 17
WOLF2_BOSS_MAP, // 18
WOLF2_SECRET_MAP, // 19
WOLF3_MAP1_MAP, // 20
WOLF3_MAP2_MAP, // 21
WOLF3_MAP3_MAP, // 22
WOLF3_MAP4_MAP, // 23
WOLF3_MAP5_MAP, // 24
WOLF3_MAP6_MAP, // 25
WOLF3_MAP7_MAP, // 26
WOLF3_MAP8_MAP, // 27
WOLF3_BOSS_MAP, // 28
WOLF3_SECRET_MAP, // 29
LASTMAP
} mapnames;

73
MAPSWL6.H Normal file
View file

@ -0,0 +1,73 @@
///////////////////////////////////////
//
// TED5 Map Header for WL6
//
///////////////////////////////////////
//
// Map Names
//
typedef enum {
WOLF1_MAP1_MAP, // 0
WOLF1_MAP2_MAP, // 1
WOLF1_MAP3_MAP, // 2
WOLF1_MAP4_MAP, // 3
WOLF1_MAP5_MAP, // 4
WOLF1_MAP6_MAP, // 5
WOLF1_MAP7_MAP, // 6
WOLF1_MAP8_MAP, // 7
WOLF1_BOSS_MAP, // 8
WOLF1_SECRET_MAP, // 9
WOLF2_MAP1_MAP, // 10
WOLF2_MAP2_MAP, // 11
WOLF2_MAP3_MAP, // 12
WOLF2_MAP4_MAP, // 13
WOLF2_MAP5_MAP, // 14
WOLF2_MAP6_MAP, // 15
WOLF2_MAP7_MAP, // 16
WOLF2_MAP8_MAP, // 17
WOLF2_BOSS_MAP, // 18
WOLF2_SECRET_MAP, // 19
WOLF3_MAP1_MAP, // 20
WOLF3_MAP2_MAP, // 21
WOLF3_MAP3_MAP, // 22
WOLF3_MAP4_MAP, // 23
WOLF3_MAP5_MAP, // 24
WOLF3_MAP6_MAP, // 25
WOLF3_MAP7_MAP, // 26
WOLF3_MAP8_MAP, // 27
WOLF3_BOSS_MAP, // 28
WOLF3_SECRET_MAP, // 29
WOLF4_MAP_1_MAP, // 30
WOLF4_MAP_2_MAP, // 31
WOLF4_MAP_3_MAP, // 32
WOLF4_MAP_4_MAP, // 33
WOLF4_MAP_5_MAP, // 34
WOLF4_MAP_6_MAP, // 35
WOLF4_MAP_7_MAP, // 36
WOLF4_MAP_8_MAP, // 37
WOLF4_BOSS_MAP, // 38
WOLF4_SECRET_MAP, // 39
WOLF5_MAP_1_MAP, // 40
WOLF5_MAP_2_MAP, // 41
WOLF5_MAP_3_MAP, // 42
WOLF5_MAP_4_MAP, // 43
WOLF5_MAP_5_MAP, // 44
WOLF5_MAP_6_MAP, // 45
WOLF5_MAP_7_MAP, // 46
WOLF5_MAP_8_MAP, // 47
WOLF5_BOSS_MAP, // 48
WOLF5_SECRET_MAP, // 49
WOLF6_MAP_1_MAP, // 50
WOLF6_MAP_2_MAP, // 51
WOLF6_MAP_3_MAP, // 52
WOLF6_MAP_4_MAP, // 53
WOLF6_MAP_5_MAP, // 54
WOLF6_MAP_6_MAP, // 55
WOLF6_MAP_7_MAP, // 56
WOLF6_MAP_8_MAP, // 57
WOLF6_BOSS_MAP, // 58
WOLF6_SECRET_MAP, // 59
MAP4L10PATH_MAP, // 60
LASTMAP
} mapnames;

16
MAPSWLF.H Normal file
View file

@ -0,0 +1,16 @@
///////////////////////////////////////
//
// TED5 Map Header for WLF
//
///////////////////////////////////////
//
// Map Names
//
typedef enum {
LEVEL_ONE_MAP, // 0
LEVEL_TWO_MAP, // 1
LEVEL_THREE_MAP, // 2
LEVEL_FOUR_MAP, // 3
LASTMAP
} mapnames;

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);
}

BIN
OBJ/GAMEPAL.OBJ Normal file

Binary file not shown.

BIN
OBJ/SIGNON.OBJ Normal file

Binary file not shown.

737
OLDSCALE.C Normal file
View file

@ -0,0 +1,737 @@
// WL_SCALE.C
#include "WL_DEF.H"
#pragma hdrstop
#define OP_RETF 0xcb
/*
=============================================================================
GLOBALS
=============================================================================
*/
t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1];
long fullscalefarcall[MAXSCALEHEIGHT+1];
int maxscale,maxscaleshl2;
/*
=============================================================================
LOCALS
=============================================================================
*/
t_compscale _seg *work;
unsigned BuildCompScale (int height, memptr *finalspot);
int stepbytwo;
//===========================================================================
/*
==============
=
= BadScale
=
==============
*/
void far BadScale (void)
{
Quit ("BadScale called!");
}
/*
==========================
=
= 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;
//
// free up old scalers
//
for (i=1;i<MAXSCALEHEIGHT;i++)
{
if (scaledirectory[i])
MM_FreePtr (&(memptr)scaledirectory[i]);
if (i>=stepbytwo)
i += 2;
}
memset (scaledirectory,0,sizeof(scaledirectory));
MM_SortMem ();
//
// build the compiled scalers
//
stepbytwo = viewheight/2; // save space by double stepping
MM_GetPtr (&(memptr)work,20000);
if (mmerror)
return;
for (i=1;i<=maxscaleheight;i++)
{
BuildCompScale (i*2,&(memptr)scaledirectory[i]);
if (mmerror)
{
MM_FreePtr (&(memptr)work);
return;
}
if (i>=stepbytwo)
i+= 2;
}
MM_FreePtr (&(memptr)work);
//
// compact memory and lock down scalers
//
MM_SortMem ();
for (i=1;i<=maxscaleheight;i++)
{
MM_SetLock (&(memptr)scaledirectory[i],true);
fullscalefarcall[i] = (unsigned)scaledirectory[i];
fullscalefarcall[i] <<=16;
fullscalefarcall[i] += scaledirectory[i]->codeofs[0];
if (i>=stepbytwo)
{
scaledirectory[i+1] = scaledirectory[i];
fullscalefarcall[i+1] = fullscalefarcall[i];
scaledirectory[i+2] = scaledirectory[i];
fullscalefarcall[i+2] = fullscalefarcall[i];
i+=2;
}
}
scaledirectory[0] = scaledirectory[1];
fullscalefarcall[0] = fullscalefarcall[1];
//
// check for oversize wall drawing
//
for (i=maxscaleheight;i<MAXSCALEHEIGHT;i++)
fullscalefarcall[i] = (long)BadScale;
}
//===========================================================================
/*
========================
=
= 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
=
========================
*/
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);
if (mmerror)
return 0;
_fmemcpy ((byte _seg *)(*finalspot),(byte _seg *)work,totalsize);
return totalsize;
}
/*
=======================
=
= ScaleLine
=
= linescale should have the high word set to the segment of the scaler
=
=======================
*/
extern int slinex,slinewidth;
extern unsigned far *linecmds;
extern long linescale;
extern unsigned maskword;
byte mask1,mask2,mask3;
void near ScaleLine (void)
{
asm mov cx,WORD PTR [linescale+2]
asm mov es,cx // segment of scaler
asm mov bp,WORD PTR [linecmds]
asm mov dx,SC_INDEX+1 // to set SC_MAPMASK
asm mov bx,[slinex]
asm mov di,bx
asm shr di,2 // X in bytes
asm add di,[bufferofs]
asm and bx,3
asm shl bx,3
asm add bx,[slinewidth] // bx = (pixel*8+pixwidth)
asm mov al,BYTE [mapmasks3-1+bx] // -1 because pixwidth of 1 is first
asm mov ds,WORD PTR [linecmds+2]
asm or al,al
asm jz notthreebyte // scale across three bytes
asm jmp threebyte
notthreebyte:
asm mov al,BYTE PTR ss:[mapmasks2-1+bx] // -1 because pixwidth of 1 is first
asm or al,al
asm jnz twobyte // scale across two bytes
//
// one byte scaling
//
asm mov al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first
asm out dx,al // set map mask register
scalesingle:
asm mov bx,[ds:bp] // table location of rtl to patch
asm or bx,bx
asm jz linedone // 0 signals end of segment list
asm mov bx,[es:bx]
asm mov dl,[es:bx] // save old value
asm mov BYTE PTR es:[bx],OP_RETF // patch a RETF in
asm mov si,[ds:bp+4] // table location of entry spot
asm mov ax,[es:si]
asm mov WORD PTR ss:[linescale],ax // call here to start scaling
asm mov si,[ds:bp+2] // corrected top of shape for this segment
asm add bp,6 // next segment list
asm mov ax,SCREENSEG
asm mov es,ax
asm call ss:[linescale] // scale the segment of pixels
asm mov es,cx // segment of scaler
asm mov BYTE PTR es:[bx],dl // unpatch the RETF
asm jmp scalesingle // do the next segment
//
// done
//
linedone:
asm mov ax,ss
asm mov ds,ax
return;
//
// two byte scaling
//
twobyte:
asm mov ss:[mask2],al
asm mov al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first
asm mov ss:[mask1],al
scaledouble:
asm mov bx,[ds:bp] // table location of rtl to patch
asm or bx,bx
asm jz linedone // 0 signals end of segment list
asm mov bx,[es:bx]
asm mov cl,[es:bx] // save old value
asm mov BYTE PTR es:[bx],OP_RETF // patch a RETF in
asm mov si,[ds:bp+4] // table location of entry spot
asm mov ax,[es:si]
asm mov WORD PTR ss:[linescale],ax // call here to start scaling
asm mov si,[ds:bp+2] // corrected top of shape for this segment
asm add bp,6 // next segment list
asm mov ax,SCREENSEG
asm mov es,ax
asm mov al,ss:[mask1]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm inc di
asm mov al,ss:[mask2]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm dec di
asm mov es,WORD PTR ss:[linescale+2] // segment of scaler
asm mov BYTE PTR es:[bx],cl // unpatch the RETF
asm jmp scaledouble // do the next segment
//
// three byte scaling
//
threebyte:
asm mov ss:[mask3],al
asm mov al,BYTE PTR ss:[mapmasks2-1+bx] // -1 because pixwidth of 1 is first
asm mov ss:[mask2],al
asm mov al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first
asm mov ss:[mask1],al
scaletriple:
asm mov bx,[ds:bp] // table location of rtl to patch
asm or bx,bx
asm jz linedone // 0 signals end of segment list
asm mov bx,[es:bx]
asm mov cl,[es:bx] // save old value
asm mov BYTE PTR es:[bx],OP_RETF // patch a RETF in
asm mov si,[ds:bp+4] // table location of entry spot
asm mov ax,[es:si]
asm mov WORD PTR ss:[linescale],ax // call here to start scaling
asm mov si,[ds:bp+2] // corrected top of shape for this segment
asm add bp,6 // next segment list
asm mov ax,SCREENSEG
asm mov es,ax
asm mov al,ss:[mask1]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm inc di
asm mov al,ss:[mask2]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm inc di
asm mov al,ss:[mask3]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm dec di
asm dec di
asm mov es,WORD PTR ss:[linescale+2] // segment of scaler
asm mov BYTE PTR es:[bx],cl // unpatch the RETF
asm jmp scaletriple // do the next segment
}
/*
=======================
=
= 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
=
=======================
*/
static long longtemp;
void ScaleShape (int xcenter, int shapenum, unsigned height)
{
t_compshape _seg *shape;
t_compscale _seg *comptable;
unsigned scale,srcx,stopx,tempx;
int t;
unsigned far *cmdptr;
boolean leftvis,rightvis;
shape = PM_GetSpritePage (shapenum);
scale = height>>3; // low three bits are fractional
if (!scale || scale>maxscale)
return; // too close or far away
comptable = scaledirectory[scale];
*(((unsigned *)&linescale)+1)=(unsigned)comptable; // seg of far call
*(((unsigned *)&linecmds)+1)=(unsigned)shape; // seg of shape
//
// scale to the left (from pixel 31 to shape->leftpix)
//
srcx = 32;
slinex = xcenter;
stopx = shape->leftpix;
cmdptr = &shape->dataofs[31-stopx];
while ( --srcx >=stopx && slinex>0)
{
(unsigned)linecmds = *cmdptr--;
if ( !(slinewidth = comptable->width[srcx]) )
continue;
if (slinewidth == 1)
{
slinex--;
if (slinex<viewwidth)
{
if (wallheight[slinex] >= height)
continue; // obscured by closer wall
ScaleLine ();
}
continue;
}
//
// handle multi pixel lines
//
if (slinex>viewwidth)
{
slinex -= slinewidth;
slinewidth = viewwidth-slinex;
if (slinewidth<1)
continue; // still off the right side
}
else
{
if (slinewidth>slinex)
slinewidth = slinex;
slinex -= slinewidth;
}
leftvis = (wallheight[slinex] < height);
rightvis = (wallheight[slinex+slinewidth-1] < height);
if (leftvis)
{
if (rightvis)
ScaleLine ();
else
{
while (wallheight[slinex+slinewidth-1] >= height)
slinewidth--;
ScaleLine ();
}
}
else
{
if (!rightvis)
continue; // totally obscured
while (wallheight[slinex] >= height)
{
slinex++;
slinewidth--;
}
ScaleLine ();
break; // the rest of the shape is gone
}
}
//
// scale to the right
//
slinex = xcenter;
stopx = shape->rightpix;
if (shape->leftpix<31)
{
srcx = 31;
cmdptr = &shape->dataofs[32-shape->leftpix];
}
else
{
srcx = shape->leftpix-1;
cmdptr = &shape->dataofs[0];
}
slinewidth = 0;
while ( ++srcx <= stopx && (slinex+=slinewidth)<viewwidth)
{
(unsigned)linecmds = *cmdptr++;
if ( !(slinewidth = comptable->width[srcx]) )
continue;
if (slinewidth == 1)
{
if (slinex>=0 && wallheight[slinex] < height)
{
ScaleLine ();
}
continue;
}
//
// handle multi pixel lines
//
if (slinex<0)
{
if (slinewidth <= -slinex)
continue; // still off the left edge
slinewidth += slinex;
slinex = 0;
}
else
{
if (slinex + slinewidth > viewwidth)
slinewidth = viewwidth-slinex;
}
leftvis = (wallheight[slinex] < height);
rightvis = (wallheight[slinex+slinewidth-1] < height);
if (leftvis)
{
if (rightvis)
{
ScaleLine ();
}
else
{
while (wallheight[slinex+slinewidth-1] >= height)
slinewidth--;
ScaleLine ();
break; // the rest of the shape is gone
}
}
else
{
if (rightvis)
{
while (wallheight[slinex] >= height)
{
slinex++;
slinewidth--;
}
ScaleLine ();
}
else
continue; // totally obscured
}
}
}
/*
=======================
=
= 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;
t_compscale _seg *comptable;
unsigned scale,srcx,stopx,tempx;
int t;
unsigned far *cmdptr;
boolean leftvis,rightvis;
shape = PM_GetSpritePage (shapenum);
scale = height>>1;
comptable = scaledirectory[scale];
*(((unsigned *)&linescale)+1)=(unsigned)comptable; // seg of far call
*(((unsigned *)&linecmds)+1)=(unsigned)shape; // seg of shape
//
// scale to the left (from pixel 31 to shape->leftpix)
//
srcx = 32;
slinex = xcenter;
stopx = shape->leftpix;
cmdptr = &shape->dataofs[31-stopx];
while ( --srcx >=stopx )
{
(unsigned)linecmds = *cmdptr--;
if ( !(slinewidth = comptable->width[srcx]) )
continue;
slinex -= slinewidth;
ScaleLine ();
}
//
// scale to the right
//
slinex = xcenter;
stopx = shape->rightpix;
if (shape->leftpix<31)
{
srcx = 31;
cmdptr = &shape->dataofs[32-shape->leftpix];
}
else
{
srcx = shape->leftpix-1;
cmdptr = &shape->dataofs[0];
}
slinewidth = 0;
while ( ++srcx <= stopx )
{
(unsigned)linecmds = *cmdptr++;
if ( !(slinewidth = comptable->width[srcx]) )
continue;
ScaleLine ();
slinex+=slinewidth;
}
}
//
// 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} };
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} };
int slinex,slinewidth;
unsigned far *linecmds;
long linescale;
unsigned maskword;

36
PICLIST.H Normal file
View file

@ -0,0 +1,36 @@
//////////////////////////////////////
//
// Graphics .H file for .WL1
// IGRAB-ed on Sat May 02 02:32:49 1992
//
//////////////////////////////////////
typedef enum {
// Lump Start
H_BJPIC=3,
H_CASTLEPIC, // 4
H_KEYBOARDPIC, // 5
H_JOYPIC, // 6
H_MOUSEPIC, // 7
H_BOTHPIC, // 8
H_GAMEPADPIC, // 9
H_HEALPIC, // 10
H_TREASUREPIC, // 11
H_GUNPIC, // 12
H_KEYPIC, // 13
H_BLAZEPIC, // 14
H_WEAPON1234PIC, // 15
H_WOLFLOGOPIC, // 16
H_VISAPIC, // 17
H_MCPIC, // 18
H_IDLOGOPIC, // 19
H_FAXPIC, // 20
H_GALACTIXPIC, // 21
H_FGODMOMPIC, // 22
H_AUSTRALIAPIC, // 23
H_CANADAPIC, // 24
H_UKPIC, // 25
H_TOPWINDOWPIC, // 26
H_LEFTWINDOWPIC, // 27
H_RIGHTWINDOWPIC, // 28
H_BOTTOMINFOPIC, // 29

129
README/LICENSE.DOC Normal file
View file

@ -0,0 +1,129 @@
LIMITED USE SOFTWARE LICENSE AGREEMENT
This Limited Use Software License Agreement (the "Agreement")
is a legal agreement between you, the end-user, and Id Software, Inc.
("ID"). By continuing the downloading of this Wolfenstein 3D
(the "Trademark") software material, which includes source code
(the "Source Code"), artwork data, music and software tools
(collectively, the "Software"), you are agreeing to be bound by the
terms of this Agreement. If you do not agree to the terms of this
Agreement, promptly destroy the Software you may have downloaded.
ID SOFTWARE LICENSE
Grant of License. ID grants to you the right to use one (1)
copy of the Software on a single computer. You have no ownership or
proprietary rights in or to the Software, or the Trademark. For purposes
of this section, "use" means loading the Software into RAM, as well as
installation on a hard disk or other storage device. The Software,
together with any archive copy thereof, shall be destroyed when no longer
used in accordance with this Agreement, or when the right to use the
Software is terminated. You agree that the Software will not be shipped,
transferred or exported into any country in violation of the U.S.
Export Administration Act (or any other law governing such matters) and
that you will not utilize, in any other manner, the Software in violation
of any applicable law.
Permitted Uses. For educational purposes only, you, the end-user,
may use portions of the Source Code, such as particular routines, to
develop your own software, but may not duplicate the Source Code, except
as noted in paragraph 4. The limited right referenced in the preceding
sentence is hereinafter referred to as "Educational Use." By so exercising
the Educational Use right you shall not obtain any ownership, copyright,
proprietary or other interest in or to the Source Code, or any portion of
the Source Code. You may dispose of your own software in your sole
discretion. With the exception of the Educational Use right, you may not
otherwise use the Software, or an portion of the Software, which includes
the Source Code, for commercial gain.
Prohibited Uses: Under no circumstances shall you, the end-user,
be permitted, allowed or authorized to commercially exploit the Software.
Neither you nor anyone at your direction shall do any of the following acts
with regard to the Software, or any portion thereof:
Rent;
Sell;
Lease;
Offer on a pay-per-play basis;
Distribute for money or any other consideration; or
In any other manner and through any medium whatsoever commercially
exploit or use for any commercial purpose.
Notwithstanding the foregoing prohibitions, you may commercially exploit the
software you develop by exercising the Educational Use right, referenced in
paragraph 2. hereinabove.
Copyright. The Software and all copyrights related thereto
(including all characters and other images generated by the Software
or depicted in the Software) are owned by ID and is protected by
United States copyright laws and international treaty provisions.
Id shall retain exclusive ownership and copyright in and to the Software
and all portions of the Software and you shall have no ownership or other
proprietary interest in such materials. You must treat the Software like
any other copyrighted material, except that you may either (a) make one
copy of the Software solely for back-up or archival purposes, or (b)
transfer the Software to a single hard disk provided you keep the original
solely for back-up or archival purposes. You may not otherwise reproduce,
copy or disclose to others, in whole or in any part, the Software. You
may not copy the written materials accompanying the Software. You agree
to use your best efforts to see that any user of the Software licensed
hereunder complies with this Agreement.
NO WARRANTIES. ID DISCLAIMS ALL WARRANTIES, BOTH EXPRESS IMPLIED,
INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE SOFTWARE. THIS LIMITED
WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH
VARY FROM JURISDICTION TO JURISDICTION. ID DOES NOT WARRANT THAT THE
OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR
SPECIFIC REQUIREMENTS. THE WARRANTY SET FORTH ABOVE IS IN LIEU OF ALL OTHER
EXPRESS WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES,
DISTRIBUTORS, AND DEALERS OF ID ARE NOT AUTHORIZED TO MAKE MODIFICATIONS TO
THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF OF ID.
Exclusive Remedies. The Software is being offered to you free of any
charge. You agree that you have no remedy against ID, its affiliates,
contractors, suppliers, and agents for loss or damage caused by any defect
or failure in the Software regardless of the form of action, whether in
contract, tort, includinegligence, strict liability or otherwise, with
regard to the Software. This Agreement shall be construed in accordance
with and governed by the laws of the State of Texas. Copyright and other
proprietary matters will be governed by United States laws and international
treaties. IN ANY CASE, ID SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF
PROFITS, LOST SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER
SIMILAR DAMAGES ARISING FROM BREACH OF WARRANTY, BREACH OF CONTRACT,
NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF ID OR ITS AGENT HAS BEEN ADVISED
OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
Some jurisdictions do not allow the exclusion or limitation of incidental or
consequential damages, so the above limitation or exclusion may not apply to
you.
General Provisions. Neither this Agreement nor any part or portion
hereof shall be assigned, sublicensed or otherwise transferred by you.
Should any provision of this Agreement be held to be void, invalid,
unenforceable or illegal by a court, the validity and enforceability of the
other provisions shall not be affected thereby. If any provision is
determined to be unenforceable, you agree to a modification of such
provision to provide for enforcement of the provision's intent, to the
extent permitted by applicable law. Failure of a party to enforce any
provision of this Agreement shall not constitute or be construed as a
waiver of such provision or of the right to enforce such provision. If
you fail to comply with any terms of this Agreement, YOUR LICENSE IS
AUTOMATICALLY TERMINATED and you agree to the issuance of an injunction
against you in favor of Id. You agree that Id shall not have to post
bond or other security to obtain an injunction against you to prohibit
you from violating Id's rights.
YOU ACKNOWLEDGE THAT YOU HAVE READ THIS AGREEMENT, THAT YOU
UNDERSTAND THIS AGREEMENT, AND UNDERSTAND THAT BY CONTINUING THE
DOWNLOADING OF THE SOFTWARE, YOU AGREE TO BE BOUND BY THIS AGREEMENT'S
TERMS AND CONDITIONS. YOU FURTHER AGREE THAT, EXCEPT FOR WRITTEN SEPARATE
AGREEMENTS BETWEEN ID AND YOU, THIS AGREEMENT IS A COMPLETE AND EXCLUSIVE
STATEMENT OF THE RIGHTS AND LIABILITIES OF THE PARTIES. THIS AGREEMENT
SUPERSEDES ALL PRIOR ORAL AGREEMENTS, PROPOSALS OR UNDERSTANDINGS, AND
ANY OTHER COMMUNICATIONS BETWEEN ID AND YOU RELATING TO THE SUBJECT MATTER
OF THIS AGREEMENT

8
README/README.TXT Normal file
View file

@ -0,0 +1,8 @@
NOTES:
------
This version will compile under BORLAND C++ 3.0/3.1 and compiled perfectly
before it was uploaded.
Please do not send your questions to id Software.

53
README/RELEASE.TXT Normal file
View file

@ -0,0 +1,53 @@
We are releasing this code for the entertainment of the
user community. We don't guarentee that anything even
builds in here. Projects just seem to rot when you leave
them alone for long periods of time.
This is all the source we have relating to the original
PC wolfenstein 3D project. We haven't looked at this
stuff in years, and I would probably be horribly embarassed
to dig through my old code, so please don't ask any questions
about it. The original project was built in borland c++ 3.0.
I think some minor changes were required for later versions.
You will need the data from a released version of wolf or spear
to use the exe built from this code. You can just use a
shareware version if you are really cheap.
Some coding comments in retrospect:
The ray casting refresh architecture is still reasonably
appropriate for the game. A BSP based texture mapper could
go faster, but ray casting was a lot simpler to do at the time.
The dynamically compiled scaling routines are now a Bad Thing.
On uncached machines (the original target) they are the fastest
possible way to scale walls, but on modern processors you just
wind up thrashing the code cash and wrecking performance.
A simple looping texture mapper would be faster on 486+ machines.
The whole page manager caching scheme is unecessarily complex.
Way too many #ifdefs in the code!
Some project ideas with this code:
Add new monsters or weapons.
Add taller walls and vertical motion. This should only be
done if the texture mapper is rewritten.
Convert to a 32 bit compiler. This would be a fair amount
of work, but I would hate to even mess with crusty old 16
bit code. The code would get a LOT smaller.
Make a multi-player game that runs on DOOM sersetup / ipxsetup drivers.
Have fun...
John Carmack
Technical Director
Id Software

692
RULES.ASI Normal file
View file

@ -0,0 +1,692 @@
;[]-----------------------------------------------------------------[]
;| RULES.ASI -- Rules & Structures for assembler |
;| |
;| Turbo C++ Run Time Library |
;| |
;| Copyright (c) 1987, 1991 by Borland International Inc. |
;| All Rights Reserved. |
;[]-----------------------------------------------------------------[]
;*** First we begin with a few of the major constants of C.
false equ 0 ; Beware ! For incoming parameters, non-false = true.
true equ 1 ; For results, we generate the proper numbers.
lesser equ -1 ; Incoming, lesser < 0
equal equ 0
greater equ 1 ; Incoming, greater > 0
PAGE
;[]------------------------------------------------------------[]
;| |
;| Conditional Assembly Directives |
;| |
;[]------------------------------------------------------------[]
;memory model aliases, for the convenience of building the library
IFDEF __s__
__SMALL__ equ 1
ENDIF
IFDEF __c__
__COMPACT__ equ 1
ENDIF
IFDEF __m__
__MEDIUM__ equ 1
ENDIF
IFDEF __l__
__LARGE__ equ 1
ENDIF
IFDEF __h__
__HUGE__ equ 1
ENDIF
IFNDEF __TINY__
IFNDEF __SMALL__
IFNDEF __MEDIUM__
IFNDEF __COMPACT__
IFNDEF __LARGE__
IFNDEF __HUGE__
%OUT You must supply a model symbol.
.ERR
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
;bit masks to extract default pointer types from MMODEL (at run-time)
FCODE equ 8000h
FDATA equ 4000h
IFDEF __TINY__ ; Small Code - Small Data
LPROG equ false
LDATA equ false
MMODEL equ 0
_DSSTACK_ equ <>
ENDIF
IFDEF __SMALL__ ; Small Code - Small Data
LPROG equ false
LDATA equ false
MMODEL equ 1
_DSSTACK_ equ <>
ENDIF
IFDEF __MEDIUM__ ; Large Code - Small Data
LPROG equ true
LDATA equ false
MMODEL equ FCODE+2
_DSSTACK_ equ <>
ENDIF
IFDEF __COMPACT__ ; Small Code - Large Data
LPROG equ false
LDATA equ true
MMODEL equ FDATA+3
ENDIF
IFDEF __LARGE__ ; Large Code - Large Data
LPROG equ true
LDATA equ true
MMODEL equ FCODE+FDATA+4
ENDIF
IFDEF __HUGE__ ; Large Code - Large Data
LPROG equ true
LDATA equ true
MMODEL equ FCODE+FDATA+5
ENDIF
IF LPROG
DIST equ FAR
ELSE
DIST equ NEAR
ENDIF
PAGE
;[]------------------------------------------------------------[]
;| |
;| Segment Declarations Macros |
;| |
;[]------------------------------------------------------------[]
Code_Seg@ MACRO ;; Open a Code Segment
IFDEF __WINDOWS__
_TEXT SEGMENT WORD PUBLIC 'CODE'
ELSE
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ENDIF
ASSUME CS:_TEXT
ENDM
Code_EndS@ MACRO ;; Close a Code Segment
_TEXT ENDS
ENDM
Data_Seg@ MACRO ;; Open a Data Segment (initialized)
_DATA SEGMENT WORD PUBLIC 'DATA'
ENDM
Data_EndS@ MACRO ;; Close a Data Segment (initialized)
_DATA ENDS
ENDM
IFNDEF __HUGE__
BSS_Seg@ MACRO ;; Open a Data Segment (un-initialized)
_BSS SEGMENT WORD PUBLIC 'BSS'
ENDM
BSS_EndS@ MACRO ;; Close a Data Segment (un-initialized)
_BSS ENDS
ENDM
ENDIF
FarData_Seg@ MACRO ;; Open a FAR Data Segment
_FARDATA SEGMENT PARA PUBLIC 'FAR_DATA'
ENDM
FarData_EndS@ MACRO ;; Close a FAR Data Segment
_FARDATA ENDS
ENDM
FarBSS_Seg@ MACRO ;; Open a FAR BSS Segment
_FARBSS SEGMENT PARA PUBLIC 'FAR_BSS'
ENDM
FarBSS_EndS@ MACRO ;; Close a FAR BSS Segment
_FARBSS ENDS
ENDM
Const_Seg@ MACRO ;; Open a CONST Segment
_CONST SEGMENT WORD PUBLIC 'CONST'
ENDM
Const_EndS@ MACRO ;; Close a CONST Segment
_CONST ENDS
ENDM
Init_Seg@ MACRO ;; Open a INIT Segment
_INIT_ SEGMENT WORD PUBLIC 'INITDATA'
ENDM
Init_EndS@ MACRO ;; Close a INIT Segment
_INIT_ ENDS
ENDM
Exit_Seg@ MACRO ;; Open a EXIT Segment
_EXIT_ SEGMENT WORD PUBLIC 'EXITDATA'
ENDM
Exit_EndS@ MACRO ;; Close a EXIT Segment
_EXIT_ ENDS
ENDM
CVT_Seg@ MACRO
_CVTSEG SEGMENT WORD PUBLIC 'DATA'
ENDM
CVT_EndS@ MACRO
_CVTSEG ENDS
ENDM
SCN_Seg@ MACRO
_SCNSEG SEGMENT WORD PUBLIC 'DATA'
ENDM
SCN_EndS@ MACRO
_SCNSEG ENDS
ENDM
Header@ MACRO
Code_Seg@
Code_EndS@
Data_Seg@
Data_EndS@
BSS_Seg@
BSS_EndS@
ASSUME CS:_TEXT, DS:DGROUP
ENDM
;[]------------------------------------------------------------[]
;| |
;| Segment Definitions |
;| |
;[]------------------------------------------------------------[]
IFDEF __C0__
IFDEF __WINDOWS__
_TEXT SEGMENT WORD PUBLIC 'CODE'
ENDS
ELSE
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ENDS
ENDIF
_FARDATA SEGMENT PARA PUBLIC 'FAR_DATA'
ENDS
_FARBSS SEGMENT PARA PUBLIC 'FAR_BSS'
ENDS
IFNDEF __WINDOWS__
IFNDEF __TINY__
_OVERLAY_ SEGMENT PARA PUBLIC 'OVRINFO'
ENDS
_1STUB_ SEGMENT PARA PUBLIC 'STUBSEG'
ENDS
ENDIF
ENDIF
IFDEF __WINDOWS__
NULL SEGMENT PARA PUBLIC 'BEGDATA'
ENDS
ENDIF
_DATA SEGMENT PARA PUBLIC 'DATA'
ENDS
ENDS
_CONST SEGMENT WORD PUBLIC 'CONST'
ENDS
IFDEF __WINDOWS__
_FPSEG SEGMENT WORD PUBLIC 'DATA'
ENDS
ENDIF
_CVTSEG SEGMENT WORD PUBLIC 'DATA'
ENDS
_SCNSEG SEGMENT WORD 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
IFNDEF __HUGE__
_BSS SEGMENT WORD PUBLIC 'BSS'
BeginBSS label byte
ENDS
_BSSEND SEGMENT BYTE PUBLIC 'BSSEND'
EndBSS label byte
ENDS
ENDIF
IFDEF __WINDOWS__
IFDEF __HUGE__
DGROUP GROUP NULL,_DATA,_CONST,_FPSEG,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_
ELSE
DGROUP GROUP NULL,_DATA,_CONST,_FPSEG,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_,_BSS,_BSSEND
ENDIF
ELSE
IFNDEF __NOFLOAT__
IF LDATA
IFDEF __HUGE__
DGROUP GROUP _DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_
ELSE
DGROUP GROUP _DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_,_BSS,_BSSEND
ENDIF
ELSE
IFDEF __TINY__
DGROUP GROUP _TEXT,_DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_,_BSS,_BSSEND
ELSE
DGROUP GROUP _DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_,_BSS,_BSSEND
ENDIF
ENDIF
ELSE
IF LDATA
IFDEF __HUGE__
DGROUP GROUP _DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_
ELSE
DGROUP GROUP _DATA,_CONST,_CVTSEG,_SCNSEG,_BSS,_BSSEND
ENDIF
ELSE
IFDEF __TINY__
DGROUP GROUP _TEXT,_DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_,_BSS,_BSSEND
ELSE
DGROUP GROUP _DATA,_CONST,_CVTSEG,_SCNSEG,_INIT_,_INITEND_,_EXIT_,_EXITEND_,_BSS,_BSSEND
ENDIF
ENDIF
ENDIF ; __NOFLOAT__
ENDIF ; __WINDOWS__
ELSE
Code_Seg@
Code_EndS@
Data_Seg@
Data_EndS@
DGROUP GROUP _DATA
ENDIF ; __C0__
PAGE
;[]------------------------------------------------------------[]
;| |
;| Old Segment Declarations Macros |
;| |
;[]------------------------------------------------------------[]
CSeg@ MACRO ;; Open a Code Segment
IFDEF __WINDOWS__
_TEXT SEGMENT WORD PUBLIC 'CODE'
ELSE
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ENDIF
ASSUME CS:_TEXT
ENDM
CSegEnd@ MACRO ;; Close a Code Segment
_TEXT ENDS
ENDM
DSeg@ MACRO ;; Open a Data Segment (initialized)
_DATA SEGMENT WORD PUBLIC 'DATA'
ENDM
DSegEnd@ MACRO ;; Close a Data Segment (initialized)
_DATA ENDS
ENDM
IFDEF __BSS__
IFNDEF __HUGE__
BSeg@ MACRO ;; Open a Data Segment (un-initialized)
_BSS SEGMENT WORD PUBLIC 'BSS'
ENDM
BSegEnd@ MACRO ;; Close a Data Segment (un-initialized)
_BSS ENDS
ENDM
ENDIF
ENDIF
Header@ MACRO
IFDEF __WINDOWS__
_TEXT SEGMENT WORD PUBLIC 'CODE'
ELSE
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ENDIF
_TEXT ENDS
_DATA SEGMENT WORD PUBLIC 'DATA'
_DATA ENDS
IFDEF __BSS__
IFNDEF __HUGE__
_BSS SEGMENT WORD PUBLIC 'BSS'
_BSS ENDS
ENDIF
ENDIF
ASSUME CS:_TEXT, DS:DGROUP
ENDM
PAGE
;[]------------------------------------------------------------[]
;| |
;| C Naming Convention Macros |
;| |
;[]------------------------------------------------------------[]
UNDERSCORE EQU 1
ExtSym@ MACRO Sym, sType, sName
IFNB <sName>
IFIDN <sName>, <__PASCAL__>
NAMING = 0
ELSE
NAMING = UNDERSCORE
ENDIF
ENDIF
IF NAMING
EXTRN _&Sym : sType
Sym&@ equ _&Sym
ELSE
EXTRN Sym : sType
Sym&@ equ Sym
ENDIF
ENDM
PubSym@ MACRO Sym, Definition, sName
IFNB <sName>
IFIDN <sName>, <__PASCAL__>
NAMING = 0
ELSE
NAMING = UNDERSCORE
ENDIF
ENDIF
IF NAMING
PUBLIC _&Sym
_&Sym Definition
Sym&@ equ _&Sym
ELSE
PUBLIC Sym
Sym Definition
Sym&@ equ Sym
ENDIF
ENDM
Static@ MACRO Sym, Definition, sName
IFNB <sName>
IFIDN <sName>, <__PASCAL__>
NAMING = 0
ELSE
NAMING = UNDERSCORE
ENDIF
ENDIF
IF NAMING
_&Sym Definition
Sym&@ equ _&Sym
ELSE
Sym Definition
Sym&@ equ Sym
ENDIF
ENDM
PAGE
;[]------------------------------------------------------------[]
;| |
;| Macros which are Data Size Dependent |
;| |
;[]------------------------------------------------------------[]
IF LDATA
DPTR_ equ DWORD PTR
dPtrSize equ 4
LES_ equ LES
ES_ equ ES:
SS_ equ SS:
LDS_ equ LDS
pushDS_ MACRO
PUSH DS
ENDM
popDS_ MACRO
POP DS
ENDM
PushPtr MACRO dPtrOff, dPtrSeg
PUSH dPtrSeg
PUSH dPtrOff
ENDM
dPtr@ MACRO Sym, VALUE, sName ;; Static Data pointer
Static@ Sym, <DD VALUE>, sName
ENDM
dPtrPub@ MACRO Sym, VALUE, sName ;; Global Data Pointer
PubSym@ Sym, <DD VALUE>, sName
ENDM
dPtrExt@ MACRO Sym, sName ;; External Data Pointer
ExtSym@ Sym, DWORD, sName
ENDM
ELSE
DPTR_ equ WORD PTR
dPtrSize equ 2
LES_ equ MOV
ES_ equ DS:
SS_ equ DS:
LDS_ equ MOV
pushDS_ MACRO
ENDM
popDS_ MACRO
ENDM
PushPtr MACRO dPtrOff, dPtrSeg
PUSH dPtrOff
ENDM
dPtr@ MACRO Sym, VALUE, sName ;; Static Data pointer
Static@ Sym, <DW VALUE>, sName
ENDM
dPtrPub@ MACRO Sym, VALUE, sName ;; Global Data Pointer
PubSym@ Sym, <DW VALUE>, sName
ENDM
dPtrExt@ MACRO Sym, sName ;; External Data Pointer
ExtSym@ Sym, WORD, sName
ENDM
ENDIF
PAGE
;[]------------------------------------------------------------[]
;| |
;| Macros which are Code Size Dependent |
;| |
;[]------------------------------------------------------------[]
IF LPROG
CPTR_ equ DWORD PTR
cPtrSize equ 4
Proc@ MACRO Sym, sName ;; Open a Static function
Static@ Sym, <PROC FAR>, sName
ENDM
PubProc@ MACRO Sym, sName ;; Open a Public function
PubSym@ Sym, <PROC FAR>, sName
ENDM
ExtProc@ MACRO Sym, sName ;; External Function
ExtSym@ Sym, FAR, sName
ENDM
cPtr@ MACRO Sym, VALUE, sName ;; Static Function pointer
Static@ Sym, <DD VALUE>, sName
ENDM
cPtrPub@ MACRO Sym, VALUE, sName;; Global Function Pointer
PubSym@ Sym, <DD VALUE>, sName
ENDM
cPtrExt@ MACRO Sym, sName ;; External Function Pointer
ExtSym@ Sym, DWORD, sName
ENDM
ELSE
CPTR_ equ WORD PTR
cPtrSize equ 2
Proc@ MACRO Sym, sName ;; Open a Static function
Static@ Sym, <PROC NEAR>, sName
ENDM
PubProc@ MACRO Sym, sName ;; Open a Public function
PubSym@ Sym, <PROC NEAR>, sName
ENDM
ExtProc@ MACRO Sym, sName ;; External Function
ExtSym@ Sym, NEAR, sName
ENDM
cPtr@ MACRO Sym, VALUE, sName ;; Static Function pointer
Static@ Sym, <DW VALUE>, sName
ENDM
cPtrPub@ MACRO Sym, VALUE, sName ;; Global Function Pointer
PubSym@ Sym, <DW VALUE>, sName
ENDM
cPtrExt@ MACRO Sym, sName ;; External Function Pointer
ExtSym@ Sym, WORD, sName
ENDM
ENDIF
EndProc@ MACRO Sym, sName ;; Close a function
Static@ Sym, ENDP, sName
ENDM
PAGE
;[]------------------------------------------------------------[]
;| |
;| Miscellaneous Definitions |
;| |
;[]------------------------------------------------------------[]
;*** Set up some macros for procedure parameters and export/import
nearCall STRUC
nearBP dw ?
nearIP dw ?
nearParam dw ?
nearCall ENDS
farCall STRUC
farBP dw ?
farCSIP dd ?
aParam dw ?
farCall ENDS
;*** Next, we define some convenient structures to access the parts
; of larger objects.
_twoBytes STRUC
BY0 db ?
BY1 db ?
_twoBytes ENDS
_fourWords STRUC
W0 dw ?
W1 dw ?
W2 dw ?
W3 dw ?
_fourWords ENDS
_twoDwords STRUC
DD0 dd ?
DD1 dd ?
_twoDwords ENDS
_aFloat STRUC
double dq ?
_aFloat ENDS
; How to invoke MSDOS.
MSDOS@ MACRO
int 21h
ENDM
PAGE
; The next section concerns the use of registers. SI and DI are used
; for register variables, and must be conserved.
; Registers AX, BX, CX, DX will not be preserved across function calls.
; Firstly, the registers to be conserved through function calls, including
; the setup of local variables.
link@ MACRO _si,_di,_ES,locals
push bp
mov bp, sp
IFNB <locals>
lea sp, locals
ENDIF
IFNB <_si>
push si
ENDIF
IFNB <_di>
push di
ENDIF
ENDM
unLink@ MACRO _si,_di,_ES,locals
IFNB <_di>
pop di
ENDIF
IFNB <_si>
pop si
ENDIF
IFNB <locals>
mov sp, bp
ENDIF
pop bp
ENDM
.LIST

8
SDMVER.H Normal file
View file

@ -0,0 +1,8 @@
#define SPEAR
#define SPEARDEMO
#define ARTSEXTERN
#define DEMOSEXTERN
#define CARMACIZED
//#define MYPROFILE
//#define DEBCHECK
//#define UPLOAD

9
SHAREMSG.H Normal file
View file

@ -0,0 +1,9 @@
"This game is shareware.\n"
"Share it with everyone.\n"
"Thanks.\n\n"
" Id Software\n"
"This game is NOT shareware.\n"
"Please do not distribute it.\n"
"Thanks.\n\n"
" Id Software\n"

7
SODVER.H Normal file
View file

@ -0,0 +1,7 @@
#define SPEAR
#define ARTSEXTERN
#define DEMOSEXTERN
#define CARMACIZED
//#define MYPROFILE
//#define DEBCHECK
//#define UPLOAD

112
SPANISH.H Normal file
View file

@ -0,0 +1,112 @@
#define QUITSUR "Estas seguro que quieres\n"\
"parar este gran juego?"
#define CURGAME "Ahora estas en\n"\
"un juego. Si continuas\n"\
"borras el juego viejo. O.K.?"
#define GAMESVD "Ya hay un juego\n"\
"guardado en esta posicion.\n"\
"sobre-escribir?"
#define ENDGAMESTR "Estas seguro que quieres\n"\
"terminar el juego que\n"\
"estas jugando? (S o N):"
#define STR_NG "Juego nuevo"
#define STR_SD "Sonido"
#define STR_CL "Control"
#define STR_LG "Cargar juego"
#define STR_SG "Guardar juego"
#define STR_CV "Cambiar vista"
#define STR_VS "Ver anotacion"
#define STR_EG "Abandonar"
#define STR_BD "Regresar al demo"
#define STR_QT "Parar"
#define STR_LOADING "Cargando"
#define STR_SAVING "Guardando"
#define STR_GAME "Regresar, jugar"
#define STR_DEMO "Regresar al Demo"
#define STR_LGC "Cargar juego llamado\n\""
#define STR_EMPTY "vacio"
#define STR_CALIB "Calibrar"
#define STR_JOYST "Joystick"
#define STR_MOVEJOY "Mover joystick a\n"\
"arriba izq y\n"\
"oprimir boton 0\n"
#define STR_MOVEJOY2 "Mover joystick a\n"\
"abajo derecha y\n"\
"oprimir boton 1\n"
#define STR_ESCEXIT "ESC para salir"
#define STR_NONE "Ninguno"
#define STR_PC "P.C. bocina"
#define STR_ALSB "AdLib/Sound Blaster"
#define STR_DISNEY "Disney Sound Source"
#define STR_SB "Sound Blaster"
#define STR_MOUSEEN "Raton activado"
#define STR_JOYEN "Joystick activado"
#define STR_PORT2 "Use joystick puerto 2"
#define STR_GAMEPAD "Gravis Gamepad Activada"
#define STR_SENS "Raton Sensibilidad"
#define STR_CUSTOM "Modificar controles"
#define STR_DADDY "Papi puedo jugar?"
#define STR_HURTME "No me hieras."
#define STR_BRINGEM "­Echamelos!"
#define STR_DEATH "La muerte encarnada"
#define STR_MOUSEADJ "Raton ajustar sensibilidad"
#define STR_SLOW "Lento"
#define STR_FAST "Rapido"
#define STR_CRUN "Corre"
#define STR_COPEN "Abre"
#define STR_CFIRE "Fuego"
#define STR_CSTRAFE "Ametrallar"
#define STR_LEFT "Izquierda"
#define STR_RIGHT "Derecha"
#define STR_FRWD "Adelante"
#define STR_BKWD "Atras"
#define STR_THINK "Pensando"
#define STR_SIZE1 "Use flechas para ajustar"
#define STR_SIZE2 "Enter para aceptar"
#define STR_SIZE3 "Esc para cancelar"
#define STR_YOUWIN "Tu ganas"
#define STR_TOTALTIME "Tiempo total"
#define STR_RATKILL "Muertes %"
#define STR_RATSECRET "Secreto %"
#define STR_RATTREASURE "Tesoros %"
#define STR_BONUS "Bono"
#define STR_TIME "Tiempo"
#define STR_PAR "Par"
#define STR_RAT2KILL "Muertes %" // ratio = promedio
#define STR_RAT2SECRET "Secreto %"
#define STR_RAT2TREASURE "Tesoros %"
#define STR_DEFEATED "Derrotado!"
#define STR_CHEATER1 "Ahora tienes 100% salud"
#define STR_CHEATER2 "99 balas y dos llaves"
#define STR_CHEATER3 "Notar que has basicamente"
#define STR_CHEATER4 "eliminado tus chances de"
#define STR_CHEATER5 "obtener puntos altos"
#define STR_NOSPACE1 "No hay suficiente espacio"
#define STR_NOSPACE2 "en tu disco para guardar juego"
#define STR_SAVECHT1 "Tu archivo para guardar juego es"
#define STR_SAVECHT2 "diremos,\"corrupto\"."
#define STR_SAVECHT3 "Pero te dire, sigue y"
#define STR_SAVECHT4 "de todos modos juega"
#define STR_SEEAGAIN "Veamos eso de nuevo"

8
SPANVER.H Normal file
View file

@ -0,0 +1,8 @@
//#define SPEAR
#define SPANISH
#define ARTSEXTERN
#define DEMOSEXTERN
//#define MYPROFILE
//#define DEBCHECK
#define CARMACIZED
//#define UPLOAD

BIN
SV.EXE Normal file

Binary file not shown.

10
VERSION.H Normal file
View file

@ -0,0 +1,10 @@
//#define SPEAR
//#define JAPAN
#define GOODTIMES
#define ARTSEXTERN
#define DEMOSEXTERN
//#define MYPROFILE
//#define DEBCHECK
#define CARMACIZED
//#define UPLOAD


100
WHACK_A.ASM Normal file
View file

@ -0,0 +1,100 @@
; WOLFHACK.ASM
.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
FARDATA
planepics db 8192 dup(?) ; // 4k of ceiling, 4k of floor
PUBLIC planepics
;============================================================================
CODESEG
;============================
;
; 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
mov ax,1111111111110b
; eax color lookup
; 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
; mov al,[esi]
; mov al,[eax]
; mov [edi],al
; mov ax,[_variable+ebx+2]
pixelloop:
shld ebx,esi,22 ; shift y units in
shld ebx,esi,7 ; shift x units in and one extra bit
and bx,63*65*2 ; mask off extra top bits and 0 low bit
add esi,edx ; position += step
mov al,[bx]
mov al,[eax]
mov [es:di],al ; write ceiling pixel
mov al,[bx+1]
mov al,[eax]
mov [es:di+bp],al ; write floor pixel
inc di
loop pixelloop
pop ds
pop ebp
pop edi
pop esi
retf
ENDP
END

9
WLFJ1VER.H Normal file
View file

@ -0,0 +1,9 @@
//#define SPEAR
#define JAPAN
#define JAPDEMO
#define UPLOAD
#define ARTSEXTERN
#define DEMOSEXTERN
//#define MYPROFILE
//#define DEBCHECK
#define CARMACIZED

900
WL_ACT1.C Normal file
View file

@ -0,0 +1,900 @@
// WL_ACT1.C
#include "WL_DEF.H"
#pragma hdrstop
/*
=============================================================================
STATICS
=============================================================================
*/
statobj_t statobjlist[MAXSTATS],*laststatobj;
struct
{
int picnum;
stat_t type;
} statinfo[] =
{
{SPR_STAT_0}, // puddle spr1v
{SPR_STAT_1,block}, // Green Barrel "
{SPR_STAT_2,block}, // Table/chairs "
{SPR_STAT_3,block}, // Floor lamp "
{SPR_STAT_4}, // Chandelier "
{SPR_STAT_5,block}, // Hanged man "
{SPR_STAT_6,bo_alpo}, // Bad food "
{SPR_STAT_7,block}, // Red pillar "
//
// NEW PAGE
//
{SPR_STAT_8,block}, // Tree spr2v
{SPR_STAT_9}, // Skeleton flat "
{SPR_STAT_10,block}, // Sink " (SOD:gibs)
{SPR_STAT_11,block}, // Potted plant "
{SPR_STAT_12,block}, // Urn "
{SPR_STAT_13,block}, // Bare table "
{SPR_STAT_14}, // Ceiling light "
#ifndef SPEAR
{SPR_STAT_15}, // Kitchen stuff "
#else
{SPR_STAT_15,block}, // Gibs!
#endif
//
// NEW PAGE
//
{SPR_STAT_16,block}, // suit of armor spr3v
{SPR_STAT_17,block}, // Hanging cage "
{SPR_STAT_18,block}, // SkeletoninCage "
{SPR_STAT_19}, // Skeleton relax "
{SPR_STAT_20,bo_key1}, // Key 1 "
{SPR_STAT_21,bo_key2}, // Key 2 "
{SPR_STAT_22,block}, // stuff (SOD:gibs)
{SPR_STAT_23}, // stuff
//
// NEW PAGE
//
{SPR_STAT_24,bo_food}, // Good food spr4v
{SPR_STAT_25,bo_firstaid}, // First aid "
{SPR_STAT_26,bo_clip}, // Clip "
{SPR_STAT_27,bo_machinegun}, // Machine gun "
{SPR_STAT_28,bo_chaingun}, // Gatling gun "
{SPR_STAT_29,bo_cross}, // Cross "
{SPR_STAT_30,bo_chalice}, // Chalice "
{SPR_STAT_31,bo_bible}, // Bible "
//
// NEW PAGE
//
{SPR_STAT_32,bo_crown}, // crown spr5v
{SPR_STAT_33,bo_fullheal}, // one up "
{SPR_STAT_34,bo_gibs}, // gibs "
{SPR_STAT_35,block}, // barrel "
{SPR_STAT_36,block}, // well "
{SPR_STAT_37,block}, // Empty well "
{SPR_STAT_38,bo_gibs}, // Gibs 2 "
{SPR_STAT_39,block}, // flag "
//
// NEW PAGE
//
#ifndef SPEAR
{SPR_STAT_40,block}, // Call Apogee spr7v
#else
{SPR_STAT_40}, // Red light
#endif
//
// NEW PAGE
//
{SPR_STAT_41}, // junk "
{SPR_STAT_42}, // junk "
{SPR_STAT_43}, // junk "
#ifndef SPEAR
{SPR_STAT_44}, // pots "
#else
{SPR_STAT_44,block}, // Gibs!
#endif
{SPR_STAT_45,block}, // stove " (SOD:gibs)
{SPR_STAT_46,block}, // spears " (SOD:gibs)
{SPR_STAT_47}, // vines "
//
// NEW PAGE
//
#ifdef SPEAR
{SPR_STAT_48,block}, // marble pillar
{SPR_STAT_49,bo_25clip}, // bonus 25 clip
{SPR_STAT_50,block}, // truck
{SPR_STAT_51,bo_spear}, // SPEAR OF DESTINY!
#endif
{SPR_STAT_26,bo_clip2}, // Clip "
{-1} // terminator
};
/*
===============
=
= InitStaticList
=
===============
*/
void InitStaticList (void)
{
laststatobj = &statobjlist[0];
}
/*
===============
=
= SpawnStatic
=
===============
*/
void SpawnStatic (int tilex, int tiley, int type)
{
laststatobj->shapenum = statinfo[type].picnum;
laststatobj->tilex = tilex;
laststatobj->tiley = tiley;
laststatobj->visspot = &spotvis[tilex][tiley];
switch (statinfo[type].type)
{
case block:
(unsigned)actorat[tilex][tiley] = 1; // consider it a blocking tile
case dressing:
laststatobj->flags = 0;
break;
case bo_cross:
case bo_chalice:
case bo_bible:
case bo_crown:
case bo_fullheal:
if (!loadedgame)
gamestate.treasuretotal++;
case bo_firstaid:
case bo_key1:
case bo_key2:
case bo_key3:
case bo_key4:
case bo_clip:
case bo_25clip:
case bo_machinegun:
case bo_chaingun:
case bo_food:
case bo_alpo:
case bo_gibs:
case bo_spear:
laststatobj->flags = FL_BONUS;
laststatobj->itemnumber = statinfo[type].type;
break;
}
laststatobj++;
if (laststatobj == &statobjlist[MAXSTATS])
Quit ("Too many static objects!\n");
}
/*
===============
=
= PlaceItemType
=
= Called during game play to drop actors' items. It finds the proper
= item number based on the item type (bo_???). If there are no free item
= spots, nothing is done.
=
===============
*/
void PlaceItemType (int itemtype, int tilex, int tiley)
{
int type;
statobj_t *spot;
//
// find the item number
//
for (type=0 ; ; type++)
{
if (statinfo[type].picnum == -1) // end of list
Quit ("PlaceItemType: couldn't find type!");
if (statinfo[type].type == itemtype)
break;
}
//
// find a spot in statobjlist to put it in
//
for (spot=&statobjlist[0] ; ; spot++)
{
if (spot==laststatobj)
{
if (spot == &statobjlist[MAXSTATS])
return; // no free spots
laststatobj++; // space at end
break;
}
if (spot->shapenum == -1) // -1 is a free spot
break;
}
//
// place it
//
spot->shapenum = statinfo[type].picnum;
spot->tilex = tilex;
spot->tiley = tiley;
spot->visspot = &spotvis[tilex][tiley];
spot->flags = FL_BONUS;
spot->itemnumber = statinfo[type].type;
}
/*
=============================================================================
DOORS
doorobjlist[] holds most of the information for the doors
doorposition[] holds the amount the door is open, ranging from 0 to 0xffff
this is directly accessed by AsmRefresh during rendering
The number of doors is limited to 64 because a spot in tilemap holds the
door number in the low 6 bits, with the high bit meaning a door center
and bit 6 meaning a door side tile
Open doors conect two areas, so sounds will travel between them and sight
will be checked when the player is in a connected area.
Areaconnect is incremented/decremented by each door. If >0 they connect
Every time a door opens or closes the areabyplayer matrix gets recalculated.
An area is true if it connects with the player's current spor.
=============================================================================
*/
#define DOORWIDTH 0x7800
#define OPENTICS 300
doorobj_t doorobjlist[MAXDOORS],*lastdoorobj;
int doornum;
unsigned doorposition[MAXDOORS]; // leading edge of door 0=closed
// 0xffff = fully open
byte far areaconnect[NUMAREAS][NUMAREAS];
boolean areabyplayer[NUMAREAS];
/*
==============
=
= ConnectAreas
=
= Scans outward from playerarea, marking all connected areas
=
==============
*/
void RecursiveConnect (int areanumber)
{
int i;
for (i=0;i<NUMAREAS;i++)
{
if (areaconnect[areanumber][i] && !areabyplayer[i])
{
areabyplayer[i] = true;
RecursiveConnect (i);
}
}
}
void ConnectAreas (void)
{
memset (areabyplayer,0,sizeof(areabyplayer));
areabyplayer[player->areanumber] = true;
RecursiveConnect (player->areanumber);
}
void InitAreas (void)
{
memset (areabyplayer,0,sizeof(areabyplayer));
areabyplayer[player->areanumber] = true;
}
/*
===============
=
= InitDoorList
=
===============
*/
void InitDoorList (void)
{
memset (areabyplayer,0,sizeof(areabyplayer));
_fmemset (areaconnect,0,sizeof(areaconnect));
lastdoorobj = &doorobjlist[0];
doornum = 0;
}
/*
===============
=
= SpawnDoor
=
===============
*/
void SpawnDoor (int tilex, int tiley, boolean vertical, int lock)
{
int areanumber;
unsigned far *map;
if (doornum==64)
Quit ("64+ doors on level!");
doorposition[doornum] = 0; // doors start out fully closed
lastdoorobj->tilex = tilex;
lastdoorobj->tiley = tiley;
lastdoorobj->vertical = vertical;
lastdoorobj->lock = lock;
lastdoorobj->action = dr_closed;
(unsigned)actorat[tilex][tiley] = doornum | 0x80; // consider it a solid wall
//
// make the door tile a special tile, and mark the adjacent tiles
// for door sides
//
tilemap[tilex][tiley] = doornum | 0x80;
map = mapsegs[0] + farmapylookup[tiley]+tilex;
if (vertical)
{
*map = *(map-1); // set area number
tilemap[tilex][tiley-1] |= 0x40;
tilemap[tilex][tiley+1] |= 0x40;
}
else
{
*map = *(map-mapwidth); // set area number
tilemap[tilex-1][tiley] |= 0x40;
tilemap[tilex+1][tiley] |= 0x40;
}
doornum++;
lastdoorobj++;
}
//===========================================================================
/*
=====================
=
= OpenDoor
=
=====================
*/
void OpenDoor (int door)
{
if (doorobjlist[door].action == dr_open)
doorobjlist[door].ticcount = 0; // reset open time
else
doorobjlist[door].action = dr_opening; // start it opening
}
/*
=====================
=
= CloseDoor
=
=====================
*/
void CloseDoor (int door)
{
int tilex,tiley,area;
objtype *check;
//
// don't close on anything solid
//
tilex = doorobjlist[door].tilex;
tiley = doorobjlist[door].tiley;
if (actorat[tilex][tiley])
return;
if (player->tilex == tilex && player->tiley == tiley)
return;
if (doorobjlist[door].vertical)
{
if ( player->tiley == tiley )
{
if ( ((player->x+MINDIST) >>TILESHIFT) == tilex )
return;
if ( ((player->x-MINDIST) >>TILESHIFT) == tilex )
return;
}
check = actorat[tilex-1][tiley];
if (check && ((check->x+MINDIST) >> TILESHIFT) == tilex )
return;
check = actorat[tilex+1][tiley];
if (check && ((check->x-MINDIST) >> TILESHIFT) == tilex )
return;
}
else if (!doorobjlist[door].vertical)
{
if (player->tilex == tilex)
{
if ( ((player->y+MINDIST) >>TILESHIFT) == tiley )
return;
if ( ((player->y-MINDIST) >>TILESHIFT) == tiley )
return;
}
check = actorat[tilex][tiley-1];
if (check && ((check->y+MINDIST) >> TILESHIFT) == tiley )
return;
check = actorat[tilex][tiley+1];
if (check && ((check->y-MINDIST) >> TILESHIFT) == tiley )
return;
}
//
// play door sound if in a connected area
//
area = *(mapsegs[0] + farmapylookup[doorobjlist[door].tiley]
+doorobjlist[door].tilex)-AREATILE;
if (areabyplayer[area])
{
PlaySoundLocTile(CLOSEDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
}
doorobjlist[door].action = dr_closing;
//
// make the door space solid
//
(unsigned)actorat[tilex][tiley]
= door | 0x80;
}
/*
=====================
=
= OperateDoor
=
= The player wants to change the door's direction
=
=====================
*/
void OperateDoor (int door)
{
int lock;
lock = doorobjlist[door].lock;
if (lock >= dr_lock1 && lock <= dr_lock4)
{
if ( ! (gamestate.keys & (1 << (lock-dr_lock1) ) ) )
{
SD_PlaySound (NOWAYSND); // locked
return;
}
}
switch (doorobjlist[door].action)
{
case dr_closed:
case dr_closing:
OpenDoor (door);
break;
case dr_open:
case dr_opening:
CloseDoor (door);
break;
}
}
//===========================================================================
/*
===============
=
= DoorOpen
=
= Close the door after three seconds
=
===============
*/
void DoorOpen (int door)
{
if ( (doorobjlist[door].ticcount += tics) >= OPENTICS)
CloseDoor (door);
}
/*
===============
=
= DoorOpening
=
===============
*/
void DoorOpening (int door)
{
int area1,area2;
unsigned far *map;
long position;
position = doorposition[door];
if (!position)
{
//
// door is just starting to open, so connect the areas
//
map = mapsegs[0] + farmapylookup[doorobjlist[door].tiley]
+doorobjlist[door].tilex;
if (doorobjlist[door].vertical)
{
area1 = *(map+1);
area2 = *(map-1);
}
else
{
area1 = *(map-mapwidth);
area2 = *(map+mapwidth);
}
area1 -= AREATILE;
area2 -= AREATILE;
areaconnect[area1][area2]++;
areaconnect[area2][area1]++;
ConnectAreas ();
if (areabyplayer[area1])
{
PlaySoundLocTile(OPENDOORSND,doorobjlist[door].tilex,doorobjlist[door].tiley); // JAB
}
}
//
// slide the door by an adaptive amount
//
position += tics<<10;
if (position >= 0xffff)
{
//
// door is all the way open
//
position = 0xffff;
doorobjlist[door].ticcount = 0;
doorobjlist[door].action = dr_open;
actorat[doorobjlist[door].tilex][doorobjlist[door].tiley] = 0;
}
doorposition[door] = position;
}
/*
===============
=
= DoorClosing
=
===============
*/
void DoorClosing (int door)
{
int area1,area2,move;
unsigned far *map;
long position;
int tilex,tiley;
tilex = doorobjlist[door].tilex;
tiley = doorobjlist[door].tiley;
if ( ((unsigned)actorat[tilex][tiley] != (door | 0x80))
|| (player->tilex == tilex && player->tiley == tiley) )
{ // something got inside the door
OpenDoor (door);
return;
};
position = doorposition[door];
//
// slide the door by an adaptive amount
//
position -= tics<<10;
if (position <= 0)
{
//
// door is closed all the way, so disconnect the areas
//
position = 0;
doorobjlist[door].action = dr_closed;
map = mapsegs[0] + farmapylookup[doorobjlist[door].tiley]
+doorobjlist[door].tilex;
if (doorobjlist[door].vertical)
{
area1 = *(map+1);
area2 = *(map-1);
}
else
{
area1 = *(map-mapwidth);
area2 = *(map+mapwidth);
}
area1 -= AREATILE;
area2 -= AREATILE;
areaconnect[area1][area2]--;
areaconnect[area2][area1]--;
ConnectAreas ();
}
doorposition[door] = position;
}
/*
=====================
=
= MoveDoors
=
= Called from PlayLoop
=
=====================
*/
void MoveDoors (void)
{
int door;
if (gamestate.victoryflag) // don't move door during victory sequence
return;
for (door = 0 ; door < doornum ; door++)
switch (doorobjlist[door].action)
{
case dr_open:
DoorOpen (door);
break;
case dr_opening:
DoorOpening(door);
break;
case dr_closing:
DoorClosing(door);
break;
}
}
/*
=============================================================================
PUSHABLE WALLS
=============================================================================
*/
unsigned pwallstate;
unsigned pwallpos; // amount a pushable wall has been moved (0-63)
unsigned pwallx,pwally;
int pwalldir;
/*
===============
=
= PushWall
=
===============
*/
void PushWall (int checkx, int checky, int dir)
{
int oldtile;
if (pwallstate)
return;
oldtile = tilemap[checkx][checky];
if (!oldtile)
return;
switch (dir)
{
case di_north:
if (actorat[checkx][checky-1])
{
SD_PlaySound (NOWAYSND);
return;
}
(unsigned)actorat[checkx][checky-1] =
tilemap[checkx][checky-1] = oldtile;
break;
case di_east:
if (actorat[checkx+1][checky])
{
SD_PlaySound (NOWAYSND);
return;
}
(unsigned)actorat[checkx+1][checky] =
tilemap[checkx+1][checky] = oldtile;
break;
case di_south:
if (actorat[checkx][checky+1])
{
SD_PlaySound (NOWAYSND);
return;
}
(unsigned)actorat[checkx][checky+1] =
tilemap[checkx][checky+1] = oldtile;
break;
case di_west:
if (actorat[checkx-1][checky])
{
SD_PlaySound (NOWAYSND);
return;
}
(unsigned)actorat[checkx-1][checky] =
tilemap[checkx-1][checky] = oldtile;
break;
}
gamestate.secretcount++;
pwallx = checkx;
pwally = checky;
pwalldir = dir;
pwallstate = 1;
pwallpos = 0;
tilemap[pwallx][pwally] |= 0xc0;
*(mapsegs[1]+farmapylookup[pwally]+pwallx) = 0; // remove P tile info
SD_PlaySound (PUSHWALLSND);
}
/*
=================
=
= MovePWalls
=
=================
*/
void MovePWalls (void)
{
int oldblock,oldtile;
if (!pwallstate)
return;
oldblock = pwallstate/128;
pwallstate += tics;
if (pwallstate/128 != oldblock)
{
// block crossed into a new block
oldtile = tilemap[pwallx][pwally] & 63;
//
// the tile can now be walked into
//
tilemap[pwallx][pwally] = 0;
(unsigned)actorat[pwallx][pwally] = 0;
*(mapsegs[0]+farmapylookup[pwally]+pwallx) = player->areanumber+AREATILE;
//
// see if it should be pushed farther
//
if (pwallstate>256)
{
//
// the block has been pushed two tiles
//
pwallstate = 0;
return;
}
else
{
switch (pwalldir)
{
case di_north:
pwally--;
if (actorat[pwallx][pwally-1])
{
pwallstate = 0;
return;
}
(unsigned)actorat[pwallx][pwally-1] =
tilemap[pwallx][pwally-1] = oldtile;
break;
case di_east:
pwallx++;
if (actorat[pwallx+1][pwally])
{
pwallstate = 0;
return;
}
(unsigned)actorat[pwallx+1][pwally] =
tilemap[pwallx+1][pwally] = oldtile;
break;
case di_south:
pwally++;
if (actorat[pwallx][pwally+1])
{
pwallstate = 0;
return;
}
(unsigned)actorat[pwallx][pwally+1] =
tilemap[pwallx][pwally+1] = oldtile;
break;
case di_west:
pwallx--;
if (actorat[pwallx-1][pwally])
{
pwallstate = 0;
return;
}
(unsigned)actorat[pwallx-1][pwally] =
tilemap[pwallx-1][pwally] = oldtile;
break;
}
tilemap[pwallx][pwally] = oldtile | 0xc0;
}
}
pwallpos = (pwallstate/2)&63;
}

3872
WL_ACT2.C Normal file

File diff suppressed because it is too large Load diff

1421
WL_AGENT.C Normal file

File diff suppressed because it is too large Load diff

67
WL_ASM.ASM Normal file
View file

@ -0,0 +1,67 @@
; 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

722
WL_DEBUG.C Normal file
View file

@ -0,0 +1,722 @@
// WL_DEBUG.C
#include "WL_DEF.H"
#pragma hdrstop
#include <BIOS.H>
/*
=============================================================================
LOCAL CONSTANTS
=============================================================================
*/
#define VIEWTILEX (viewwidth/16)
#define VIEWTILEY (viewheight/16)
/*
=============================================================================
GLOBAL VARIABLES
=============================================================================
*/
int DebugKeys (void);
/*
=============================================================================
LOCAL VARIABLES
=============================================================================
*/
int maporgx;
int maporgy;
enum {mapview,tilemapview,actoratview,visview} viewtype;
void ViewMap (void);
//===========================================================================
/*
==================
=
= DebugMemory
=
==================
*/
void DebugMemory (void)
{
int i;
char scratch[80],str[10];
long mem;
spritetype _seg *block;
CenterWindow (16,7);
US_CPrint ("Memory Usage");
US_CPrint ("------------");
US_Print ("Total :");
US_PrintUnsigned (mminfo.mainmem/1024);
US_Print ("k\nFree :");
US_PrintUnsigned (MM_UnusedMemory()/1024);
US_Print ("k\nWith purge:");
US_PrintUnsigned (MM_TotalFree()/1024);
US_Print ("k\n");
VW_UpdateScreen();
IN_Ack ();
}
//===========================================================================
/*
==================
=
= CountObjects
=
==================
*/
void CountObjects (void)
{
int i,total,count,active,inactive,doors;
objtype *obj;
CenterWindow (16,7);
active = inactive = count = doors = 0;
US_Print ("Total statics :");
total = laststatobj-&statobjlist[0];
US_PrintUnsigned (total);
US_Print ("\nIn use statics:");
for (i=0;i<total;i++)
if (statobjlist[i].shapenum != -1)
count++;
else
doors++; //debug
US_PrintUnsigned (count);
US_Print ("\nDoors :");
US_PrintUnsigned (doornum);
for (obj=player->next;obj;obj=obj->next)
{
if (obj->active)
active++;
else
inactive++;
}
US_Print ("\nTotal actors :");
US_PrintUnsigned (active+inactive);
US_Print ("\nActive actors :");
US_PrintUnsigned (active);
VW_UpdateScreen();
IN_Ack ();
}
//===========================================================================
/*
================
=
= PicturePause
=
================
*/
void PicturePause (void)
{
int i;
byte p;
unsigned x;
byte far *dest,far *src;
memptr buffer;
VW_ColorBorder (15);
FinishPaletteShifts ();
LastScan = 0;
while (!LastScan)
;
if (LastScan != sc_Enter)
{
VW_ColorBorder (0);
return;
}
VW_ColorBorder (1);
VW_SetScreen (0,0);
//
// vga stuff...
//
ClearMemory ();
CA_SetAllPurge();
MM_GetPtr (&buffer,64000);
for (p=0;p<4;p++)
{
src = MK_FP(0xa000,displayofs);
dest = (byte far *)buffer+p;
VGAREADMAP(p);
for (x=0;x<16000;x++,dest+=4)
*dest = *src++;
}
#if 0
for (p=0;p<4;p++)
{
src = MK_FP(0xa000,0);
dest = (byte far *)buffer+51200+p;
VGAREADMAP(p);
for (x=0;x<3200;x++,dest+=4)
*dest = *src++;
}
#endif
asm mov ax,0x13
asm int 0x10
dest = MK_FP(0xa000,0);
_fmemcpy (dest,buffer,64000);
VL_SetPalette (&gamepal);
IN_Shutdown ();
VW_WaitVBL(70);
bioskey(0);
VW_WaitVBL(70);
Quit (NULL);
}
//===========================================================================
/*
================
=
= ShapeTest
=
================
*/
#pragma warn -pia
void ShapeTest (void)
{
extern word NumDigi;
extern word _seg *DigiList;
static char buf[10];
boolean done;
ScanCode scan;
int i,j,k,x;
longword l;
memptr addr;
PageListStruct far *page;
CenterWindow(20,16);
VW_UpdateScreen();
for (i = 0,done = false;!done;)
{
US_ClearWindow();
// sound = -1;
page = &PMPages[i];
US_Print(" Page #");
US_PrintUnsigned(i);
if (i < PMSpriteStart)
US_Print(" (Wall)");
else if (i < PMSoundStart)
US_Print(" (Sprite)");
else if (i == ChunksInFile - 1)
US_Print(" (Sound Info)");
else
US_Print(" (Sound)");
US_Print("\n XMS: ");
if (page->xmsPage != -1)
US_PrintUnsigned(page->xmsPage);
else
US_Print("No");
US_Print("\n Main: ");
if (page->mainPage != -1)
US_PrintUnsigned(page->mainPage);
else if (page->emsPage != -1)
{
US_Print("EMS ");
US_PrintUnsigned(page->emsPage);
}
else
US_Print("No");
US_Print("\n Last hit: ");
US_PrintUnsigned(page->lastHit);
US_Print("\n Address: ");
addr = PM_GetPageAddress(i);
sprintf(buf,"0x%04x",(word)addr);
US_Print(buf);
if (addr)
{
if (i < PMSpriteStart)
{
//
// draw the wall
//
bufferofs += 32*SCREENWIDTH;
postx = 128;
postwidth = 1;
postsource = ((long)((unsigned)addr))<<16;
for (x=0;x<64;x++,postx++,postsource+=64)
{
wallheight[postx] = 256;
FarScalePost ();
}
bufferofs -= 32*SCREENWIDTH;
}
else if (i < PMSoundStart)
{
//
// draw the sprite
//
bufferofs += 32*SCREENWIDTH;
SimpleScaleShape (160, i-PMSpriteStart, 64);
bufferofs -= 32*SCREENWIDTH;
}
else if (i == ChunksInFile - 1)
{
US_Print("\n\n Number of sounds: ");
US_PrintUnsigned(NumDigi);
for (l = j = k = 0;j < NumDigi;j++)
{
l += DigiList[(j * 2) + 1];
k += (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize;
}
US_Print("\n Total bytes: ");
US_PrintUnsigned(l);
US_Print("\n Total pages: ");
US_PrintUnsigned(k);
}
else
{
byte far *dp = (byte far *)MK_FP(addr,0);
for (j = 0;j < NumDigi;j++)
{
k = (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize;
if
(
(i >= PMSoundStart + DigiList[j * 2])
&& (i < PMSoundStart + DigiList[j * 2] + k)
)
break;
}
if (j < NumDigi)
{
// sound = j;
US_Print("\n Sound #");
US_PrintUnsigned(j);
US_Print("\n Segment #");
US_PrintUnsigned(i - PMSoundStart - DigiList[j * 2]);
}
for (j = 0;j < page->length;j += 32)
{
byte v = dp[j];
int v2 = (unsigned)v;
v2 -= 128;
v2 /= 4;
if (v2 < 0)
VWB_Vlin(WindowY + WindowH - 32 + v2,
WindowY + WindowH - 32,
WindowX + 8 + (j / 32),BLACK);
else
VWB_Vlin(WindowY + WindowH - 32,
WindowY + WindowH - 32 + v2,
WindowX + 8 + (j / 32),BLACK);
}
}
}
VW_UpdateScreen();
while (!(scan = LastScan))
SD_Poll();
IN_ClearKey(scan);
switch (scan)
{
case sc_LeftArrow:
if (i)
i--;
break;
case sc_RightArrow:
if (++i >= ChunksInFile)
i--;
break;
case sc_W: // Walls
i = 0;
break;
case sc_S: // Sprites
i = PMSpriteStart;
break;
case sc_D: // Digitized
i = PMSoundStart;
break;
case sc_I: // Digitized info
i = ChunksInFile - 1;
break;
case sc_L: // Load all pages
for (j = 0;j < ChunksInFile;j++)
PM_GetPage(j);
break;
case sc_P:
// if (sound != -1)
// SD_PlayDigitized(sound);
break;
case sc_Escape:
done = true;
break;
case sc_Enter:
PM_GetPage(i);
break;
}
}
SD_StopDigitized();
}
#pragma warn +pia
//===========================================================================
/*
================
=
= DebugKeys
=
================
*/
int DebugKeys (void)
{
boolean esc;
int level,i;
if (Keyboard[sc_B]) // B = border color
{
CenterWindow(24,3);
PrintY+=6;
US_Print(" Border color (0-15):");
VW_UpdateScreen();
esc = !US_LineInput (px,py,str,NULL,true,2,0);
if (!esc)
{
level = atoi (str);
if (level>=0 && level<=15)
VW_ColorBorder (level);
}
return 1;
}
if (Keyboard[sc_C]) // C = count objects
{
CountObjects();
return 1;
}
if (Keyboard[sc_E]) // E = quit level
{
if (tedlevel)
Quit (NULL);
playstate = ex_completed;
// gamestate.mapon++;
}
if (Keyboard[sc_F]) // F = facing spot
{
CenterWindow (14,4);
US_Print ("X:");
US_PrintUnsigned (player->x);
US_Print ("\nY:");
US_PrintUnsigned (player->y);
US_Print ("\nA:");
US_PrintUnsigned (player->angle);
VW_UpdateScreen();
IN_Ack();
return 1;
}
if (Keyboard[sc_G]) // G = god mode
{
CenterWindow (12,2);
if (godmode)
US_PrintCentered ("God mode OFF");
else
US_PrintCentered ("God mode ON");
VW_UpdateScreen();
IN_Ack();
godmode ^= 1;
return 1;
}
if (Keyboard[sc_H]) // H = hurt self
{
IN_ClearKeysDown ();
TakeDamage (16,NULL);
}
else if (Keyboard[sc_I]) // I = item cheat
{
CenterWindow (12,3);
US_PrintCentered ("Free items!");
VW_UpdateScreen();
GivePoints (100000);
HealSelf (99);
if (gamestate.bestweapon<wp_chaingun)
GiveWeapon (gamestate.bestweapon+1);
gamestate.ammo += 50;
if (gamestate.ammo > 99)
gamestate.ammo = 99;
DrawAmmo ();
IN_Ack ();
return 1;
}
else if (Keyboard[sc_M]) // M = memory info
{
DebugMemory();
return 1;
}
#ifdef SPEAR
else if (Keyboard[sc_N]) // N = no clip
{
noclip^=1;
CenterWindow (18,3);
if (noclip)
US_PrintCentered ("No clipping ON");
else
US_PrintCentered ("No clipping OFF");
VW_UpdateScreen();
IN_Ack ();
return 1;
}
#endif
#if 0
else if (Keyboard[sc_O]) // O = overhead
{
ViewMap();
return 1;
}
#endif
else if (Keyboard[sc_P]) // P = pause with no screen disruptioon
{
PicturePause ();
return 1;
}
else if (Keyboard[sc_Q]) // Q = fast quit
Quit (NULL);
else if (Keyboard[sc_S]) // S = slow motion
{
singlestep^=1;
CenterWindow (18,3);
if (singlestep)
US_PrintCentered ("Slow motion ON");
else
US_PrintCentered ("Slow motion OFF");
VW_UpdateScreen();
IN_Ack ();
return 1;
}
else if (Keyboard[sc_T]) // T = shape test
{
ShapeTest ();
return 1;
}
else if (Keyboard[sc_V]) // V = extra VBLs
{
CenterWindow(30,3);
PrintY+=6;
US_Print(" Add how many extra VBLs(0-8):");
VW_UpdateScreen();
esc = !US_LineInput (px,py,str,NULL,true,2,0);
if (!esc)
{
level = atoi (str);
if (level>=0 && level<=8)
extravbls = level;
}
return 1;
}
else if (Keyboard[sc_W]) // W = warp to level
{
CenterWindow(26,3);
PrintY+=6;
#ifndef SPEAR
US_Print(" Warp to which level(1-10):");
#else
US_Print(" Warp to which level(1-21):");
#endif
VW_UpdateScreen();
esc = !US_LineInput (px,py,str,NULL,true,2,0);
if (!esc)
{
level = atoi (str);
#ifndef SPEAR
if (level>0 && level<11)
#else
if (level>0 && level<22)
#endif
{
gamestate.mapon = level-1;
playstate = ex_warped;
}
}
return 1;
}
else if (Keyboard[sc_X]) // X = item cheat
{
CenterWindow (12,3);
US_PrintCentered ("Extra stuff!");
VW_UpdateScreen();
// DEBUG: put stuff here
IN_Ack ();
return 1;
}
return 0;
}
#if 0
/*
===================
=
= OverheadRefresh
=
===================
*/
void OverheadRefresh (void)
{
unsigned x,y,endx,endy,sx,sy;
unsigned tile;
endx = maporgx+VIEWTILEX;
endy = maporgy+VIEWTILEY;
for (y=maporgy;y<endy;y++)
for (x=maporgx;x<endx;x++)
{
sx = (x-maporgx)*16;
sy = (y-maporgy)*16;
switch (viewtype)
{
#if 0
case mapview:
tile = *(mapsegs[0]+farmapylookup[y]+x);
break;
case tilemapview:
tile = tilemap[x][y];
break;
case visview:
tile = spotvis[x][y];
break;
#endif
case actoratview:
tile = (unsigned)actorat[x][y];
break;
}
if (tile<MAXWALLTILES)
LatchDrawTile(sx,sy,tile);
else
{
LatchDrawChar(sx,sy,NUMBERCHARS+((tile&0xf000)>>12));
LatchDrawChar(sx+8,sy,NUMBERCHARS+((tile&0x0f00)>>8));
LatchDrawChar(sx,sy+8,NUMBERCHARS+((tile&0x00f0)>>4));
LatchDrawChar(sx+8,sy+8,NUMBERCHARS+(tile&0x000f));
}
}
}
#endif
#if 0
/*
===================
=
= ViewMap
=
===================
*/
void ViewMap (void)
{
boolean button0held;
viewtype = actoratview;
// button0held = false;
maporgx = player->tilex - VIEWTILEX/2;
if (maporgx<0)
maporgx = 0;
if (maporgx>MAPSIZE-VIEWTILEX)
maporgx=MAPSIZE-VIEWTILEX;
maporgy = player->tiley - VIEWTILEY/2;
if (maporgy<0)
maporgy = 0;
if (maporgy>MAPSIZE-VIEWTILEY)
maporgy=MAPSIZE-VIEWTILEY;
do
{
//
// let user pan around
//
PollControls ();
if (controlx < 0 && maporgx>0)
maporgx--;
if (controlx > 0 && maporgx<mapwidth-VIEWTILEX)
maporgx++;
if (controly < 0 && maporgy>0)
maporgy--;
if (controly > 0 && maporgy<mapheight-VIEWTILEY)
maporgy++;
#if 0
if (c.button0 && !button0held)
{
button0held = true;
viewtype++;
if (viewtype>visview)
viewtype = mapview;
}
if (!c.button0)
button0held = false;
#endif
OverheadRefresh ();
} while (!Keyboard[sc_Escape]);
IN_ClearKeysDown ();
}
#endif

1276
WL_DEF.H Normal file

File diff suppressed because it is too large Load diff

1403
WL_DRAW.C Normal file

File diff suppressed because it is too large Load diff

739
WL_DR_A.ASM Normal file
View file

@ -0,0 +1,739 @@
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
;
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

1484
WL_GAME.C Normal file

File diff suppressed because it is too large Load diff

1718
WL_INTER.C Normal file

File diff suppressed because it is too large Load diff

1616
WL_MAIN.C Normal file

File diff suppressed because it is too large Load diff

3986
WL_MENU.C Normal file

File diff suppressed because it is too large Load diff

231
WL_MENU.H Normal file
View file

@ -0,0 +1,231 @@
//
// WL_MENU.H
//
#ifdef SPEAR
#define BORDCOLOR 0x99
#define BORD2COLOR 0x93
#define DEACTIVE 0x9b
#define BKGDCOLOR 0x9d
//#define STRIPE 0x9c
#define MenuFadeOut() VL_FadeOut(0,255,0,0,51,10)
#else
#define BORDCOLOR 0x29
#define BORD2COLOR 0x23
#define DEACTIVE 0x2b
#define BKGDCOLOR 0x2d
#define STRIPE 0x2c
#define MenuFadeOut() VL_FadeOut(0,255,43,0,0,10)
#endif
#define READCOLOR 0x4a
#define READHCOLOR 0x47
#define VIEWCOLOR 0x7f
#define TEXTCOLOR 0x17
#define HIGHLIGHT 0x13
#define MenuFadeIn() VL_FadeIn(0,255,&gamepal,10)
#define MENUSONG WONDERIN_MUS
#ifndef SPEAR
#define INTROSONG NAZI_NOR_MUS
#else
#define INTROSONG XTOWER2_MUS
#endif
#define SENSITIVE 60
#define CENTER SENSITIVE*2
#define MENU_X 76
#define MENU_Y 55
#define MENU_W 178
#ifndef SPEAR
#define MENU_H 13*10+6
#else
#define MENU_H 13*9+6
#endif
#define SM_X 48
#define SM_W 250
#define SM_Y1 20
#define SM_H1 4*13-7
#define SM_Y2 SM_Y1+5*13
#define SM_H2 4*13-7
#define SM_Y3 SM_Y2+5*13
#define SM_H3 3*13-7
#define CTL_X 24
#define CTL_Y 70
#define CTL_W 284
#define CTL_H 13*7-7
#define LSM_X 85
#define LSM_Y 55
#define LSM_W 175
#define LSM_H 10*13+10
#define NM_X 50
#define NM_Y 100
#define NM_W 225
#define NM_H 13*4+15
#define NE_X 10
#define NE_Y 23
#define NE_W 320-NE_X*2
#define NE_H 200-NE_Y*2
#define CST_X 20
#define CST_Y 48
#define CST_START 60
#define CST_SPC 60
//
// TYPEDEFS
//
typedef struct {
int x,y,amount,curpos,indent;
} CP_iteminfo;
typedef struct {
int active;
char string[36];
void (* routine)(int temp1);
} CP_itemtype;
typedef struct {
int allowed[4];
} CustomCtrls;
extern CP_itemtype far MainMenu[],far NewEMenu[];
extern CP_iteminfo MainItems;
//
// FUNCTION PROTOTYPES
//
void SetupControlPanel(void);
void CleanupControlPanel(void);
void DrawMenu(CP_iteminfo *item_i,CP_itemtype far *items);
int HandleMenu(CP_iteminfo *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 BossKey(void);
void DrawGun(CP_iteminfo *item_i,CP_itemtype far *items,int x,int *y,int which,int basey,void (*routine)(int w));
void DrawHalfStep(int x,int y);
void EraseGun(CP_iteminfo *item_i,CP_itemtype far *items,int x,int y,int which);
void SetTextColor(CP_itemtype far *items,int hlight);
void DrawMenuGun(CP_iteminfo *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_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 CheckForEpisodes(void);
//
// VARIABLES
//
extern int SaveGamesAvail[10],StartGame,SoundStatus;
extern char SaveGameNames[10][32],SaveName[13];
enum {MOUSE,JOYSTICK,KEYBOARDBTNS,KEYBOARDMOVE}; // FOR INPUT TYPES
enum
{
newgame,
soundmenu,
control,
loadgame,
savegame,
changeview,
#ifndef GOODTIMES
#ifndef SPEAR
readthis,
#endif
#endif
viewscores,
backtodemo,
quit
} menuitems;
//
// WL_INTER
//
typedef struct {
int kill,secret,treasure;
long time;
} LRstruct;
extern LRstruct LevelRatios[];
void Write (int x,int y,char *string);
void NonShareware(void);
int GetYorN(int x,int y,int pic);

1472
WL_PLAY.C Normal file

File diff suppressed because it is too large Load diff

733
WL_SCALE.C Normal file
View file

@ -0,0 +1,733 @@
// WL_SCALE.C
#include "WL_DEF.H"
#pragma hdrstop
#define OP_RETF 0xcb
/*
=============================================================================
GLOBALS
=============================================================================
*/
t_compscale _seg *scaledirectory[MAXSCALEHEIGHT+1];
long fullscalefarcall[MAXSCALEHEIGHT+1];
int maxscale,maxscaleshl2;
boolean insetupscaling;
/*
=============================================================================
LOCALS
=============================================================================
*/
t_compscale _seg *work;
unsigned BuildCompScale (int height, memptr *finalspot);
int stepbytwo;
//===========================================================================
/*
==============
=
= BadScale
=
==============
*/
void far BadScale (void)
{
Quit ("BadScale called!");
}
/*
==========================
=
= SetupScaling
=
==========================
*/
void SetupScaling (int maxscaleheight)
{
int i,x,y;
byte far *dest;
insetupscaling = true;
maxscaleheight/=2; // one scaler every two pixels
maxscale = maxscaleheight-1;
maxscaleshl2 = maxscale<<2;
//
// free up old scalers
//
for (i=1;i<MAXSCALEHEIGHT;i++)
{
if (scaledirectory[i])
MM_FreePtr (&(memptr)scaledirectory[i]);
if (i>=stepbytwo)
i += 2;
}
memset (scaledirectory,0,sizeof(scaledirectory));
MM_SortMem ();
//
// build the compiled scalers
//
stepbytwo = viewheight/2; // save space by double stepping
MM_GetPtr (&(memptr)work,20000);
for (i=1;i<=maxscaleheight;i++)
{
BuildCompScale (i*2,&(memptr)scaledirectory[i]);
if (i>=stepbytwo)
i+= 2;
}
MM_FreePtr (&(memptr)work);
//
// compact memory and lock down scalers
//
MM_SortMem ();
for (i=1;i<=maxscaleheight;i++)
{
MM_SetLock (&(memptr)scaledirectory[i],true);
fullscalefarcall[i] = (unsigned)scaledirectory[i];
fullscalefarcall[i] <<=16;
fullscalefarcall[i] += scaledirectory[i]->codeofs[0];
if (i>=stepbytwo)
{
scaledirectory[i+1] = scaledirectory[i];
fullscalefarcall[i+1] = fullscalefarcall[i];
scaledirectory[i+2] = scaledirectory[i];
fullscalefarcall[i+2] = fullscalefarcall[i];
i+=2;
}
}
scaledirectory[0] = scaledirectory[1];
fullscalefarcall[0] = fullscalefarcall[1];
//
// check for oversize wall drawing
//
for (i=maxscaleheight;i<MAXSCALEHEIGHT;i++)
fullscalefarcall[i] = (long)BadScale;
insetupscaling = false;
}
//===========================================================================
/*
========================
=
= 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
=
========================
*/
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;
}
/*
=======================
=
= ScaleLine
=
= linescale should have the high word set to the segment of the scaler
=
=======================
*/
extern int slinex,slinewidth;
extern unsigned far *linecmds;
extern long linescale;
extern unsigned maskword;
byte mask1,mask2,mask3;
void near ScaleLine (void)
{
asm mov cx,WORD PTR [linescale+2]
asm mov es,cx // segment of scaler
asm mov bp,WORD PTR [linecmds]
asm mov dx,SC_INDEX+1 // to set SC_MAPMASK
asm mov bx,[slinex]
asm mov di,bx
asm shr di,2 // X in bytes
asm add di,[bufferofs]
asm and bx,3
asm shl bx,3
asm add bx,[slinewidth] // bx = (pixel*8+pixwidth)
asm mov al,BYTE [mapmasks3-1+bx] // -1 because pixwidth of 1 is first
asm mov ds,WORD PTR [linecmds+2]
asm or al,al
asm jz notthreebyte // scale across three bytes
asm jmp threebyte
notthreebyte:
asm mov al,BYTE PTR ss:[mapmasks2-1+bx] // -1 because pixwidth of 1 is first
asm or al,al
asm jnz twobyte // scale across two bytes
//
// one byte scaling
//
asm mov al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first
asm out dx,al // set map mask register
scalesingle:
asm mov bx,[ds:bp] // table location of rtl to patch
asm or bx,bx
asm jz linedone // 0 signals end of segment list
asm mov bx,[es:bx]
asm mov dl,[es:bx] // save old value
asm mov BYTE PTR es:[bx],OP_RETF // patch a RETF in
asm mov si,[ds:bp+4] // table location of entry spot
asm mov ax,[es:si]
asm mov WORD PTR ss:[linescale],ax // call here to start scaling
asm mov si,[ds:bp+2] // corrected top of shape for this segment
asm add bp,6 // next segment list
asm mov ax,SCREENSEG
asm mov es,ax
asm call ss:[linescale] // scale the segment of pixels
asm mov es,cx // segment of scaler
asm mov BYTE PTR es:[bx],dl // unpatch the RETF
asm jmp scalesingle // do the next segment
//
// done
//
linedone:
asm mov ax,ss
asm mov ds,ax
return;
//
// two byte scaling
//
twobyte:
asm mov ss:[mask2],al
asm mov al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first
asm mov ss:[mask1],al
scaledouble:
asm mov bx,[ds:bp] // table location of rtl to patch
asm or bx,bx
asm jz linedone // 0 signals end of segment list
asm mov bx,[es:bx]
asm mov cl,[es:bx] // save old value
asm mov BYTE PTR es:[bx],OP_RETF // patch a RETF in
asm mov si,[ds:bp+4] // table location of entry spot
asm mov ax,[es:si]
asm mov WORD PTR ss:[linescale],ax // call here to start scaling
asm mov si,[ds:bp+2] // corrected top of shape for this segment
asm add bp,6 // next segment list
asm mov ax,SCREENSEG
asm mov es,ax
asm mov al,ss:[mask1]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm inc di
asm mov al,ss:[mask2]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm dec di
asm mov es,WORD PTR ss:[linescale+2] // segment of scaler
asm mov BYTE PTR es:[bx],cl // unpatch the RETF
asm jmp scaledouble // do the next segment
//
// three byte scaling
//
threebyte:
asm mov ss:[mask3],al
asm mov al,BYTE PTR ss:[mapmasks2-1+bx] // -1 because pixwidth of 1 is first
asm mov ss:[mask2],al
asm mov al,BYTE PTR ss:[mapmasks1-1+bx] // -1 because pixwidth of 1 is first
asm mov ss:[mask1],al
scaletriple:
asm mov bx,[ds:bp] // table location of rtl to patch
asm or bx,bx
asm jz linedone // 0 signals end of segment list
asm mov bx,[es:bx]
asm mov cl,[es:bx] // save old value
asm mov BYTE PTR es:[bx],OP_RETF // patch a RETF in
asm mov si,[ds:bp+4] // table location of entry spot
asm mov ax,[es:si]
asm mov WORD PTR ss:[linescale],ax // call here to start scaling
asm mov si,[ds:bp+2] // corrected top of shape for this segment
asm add bp,6 // next segment list
asm mov ax,SCREENSEG
asm mov es,ax
asm mov al,ss:[mask1]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm inc di
asm mov al,ss:[mask2]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm inc di
asm mov al,ss:[mask3]
asm out dx,al // set map mask register
asm call ss:[linescale] // scale the segment of pixels
asm dec di
asm dec di
asm mov es,WORD PTR ss:[linescale+2] // segment of scaler
asm mov BYTE PTR es:[bx],cl // unpatch the RETF
asm jmp scaletriple // do the next segment
}
/*
=======================
=
= 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
=
=======================
*/
static long longtemp;
void ScaleShape (int xcenter, int shapenum, unsigned height)
{
t_compshape _seg *shape;
t_compscale _seg *comptable;
unsigned scale,srcx,stopx,tempx;
int t;
unsigned far *cmdptr;
boolean leftvis,rightvis;
shape = PM_GetSpritePage (shapenum);
scale = height>>3; // low three bits are fractional
if (!scale || scale>maxscale)
return; // too close or far away
comptable = scaledirectory[scale];
*(((unsigned *)&linescale)+1)=(unsigned)comptable; // seg of far call
*(((unsigned *)&linecmds)+1)=(unsigned)shape; // seg of shape
//
// scale to the left (from pixel 31 to shape->leftpix)
//
srcx = 32;
slinex = xcenter;
stopx = shape->leftpix;
cmdptr = &shape->dataofs[31-stopx];
while ( --srcx >=stopx && slinex>0)
{
(unsigned)linecmds = *cmdptr--;
if ( !(slinewidth = comptable->width[srcx]) )
continue;
if (slinewidth == 1)
{
slinex--;
if (slinex<viewwidth)
{
if (wallheight[slinex] >= height)
continue; // obscured by closer wall
ScaleLine ();
}
continue;
}
//
// handle multi pixel lines
//
if (slinex>viewwidth)
{
slinex -= slinewidth;
slinewidth = viewwidth-slinex;
if (slinewidth<1)
continue; // still off the right side
}
else
{
if (slinewidth>slinex)
slinewidth = slinex;
slinex -= slinewidth;
}
leftvis = (wallheight[slinex] < height);
rightvis = (wallheight[slinex+slinewidth-1] < height);
if (leftvis)
{
if (rightvis)
ScaleLine ();
else
{
while (wallheight[slinex+slinewidth-1] >= height)
slinewidth--;
ScaleLine ();
}
}
else
{
if (!rightvis)
continue; // totally obscured
while (wallheight[slinex] >= height)
{
slinex++;
slinewidth--;
}
ScaleLine ();
break; // the rest of the shape is gone
}
}
//
// scale to the right
//
slinex = xcenter;
stopx = shape->rightpix;
if (shape->leftpix<31)
{
srcx = 31;
cmdptr = &shape->dataofs[32-shape->leftpix];
}
else
{
srcx = shape->leftpix-1;
cmdptr = &shape->dataofs[0];
}
slinewidth = 0;
while ( ++srcx <= stopx && (slinex+=slinewidth)<viewwidth)
{
(unsigned)linecmds = *cmdptr++;
if ( !(slinewidth = comptable->width[srcx]) )
continue;
if (slinewidth == 1)
{
if (slinex>=0 && wallheight[slinex] < height)
{
ScaleLine ();
}
continue;
}
//
// handle multi pixel lines
//
if (slinex<0)
{
if (slinewidth <= -slinex)
continue; // still off the left edge
slinewidth += slinex;
slinex = 0;
}
else
{
if (slinex + slinewidth > viewwidth)
slinewidth = viewwidth-slinex;
}
leftvis = (wallheight[slinex] < height);
rightvis = (wallheight[slinex+slinewidth-1] < height);
if (leftvis)
{
if (rightvis)
{
ScaleLine ();
}
else
{
while (wallheight[slinex+slinewidth-1] >= height)
slinewidth--;
ScaleLine ();
break; // the rest of the shape is gone
}
}
else
{
if (rightvis)
{
while (wallheight[slinex] >= height)
{
slinex++;
slinewidth--;
}
ScaleLine ();
}
else
continue; // totally obscured
}
}
}
/*
=======================
=
= 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;
t_compscale _seg *comptable;
unsigned scale,srcx,stopx,tempx;
int t;
unsigned far *cmdptr;
boolean leftvis,rightvis;
shape = PM_GetSpritePage (shapenum);
scale = height>>1;
comptable = scaledirectory[scale];
*(((unsigned *)&linescale)+1)=(unsigned)comptable; // seg of far call
*(((unsigned *)&linecmds)+1)=(unsigned)shape; // seg of shape
//
// scale to the left (from pixel 31 to shape->leftpix)
//
srcx = 32;
slinex = xcenter;
stopx = shape->leftpix;
cmdptr = &shape->dataofs[31-stopx];
while ( --srcx >=stopx )
{
(unsigned)linecmds = *cmdptr--;
if ( !(slinewidth = comptable->width[srcx]) )
continue;
slinex -= slinewidth;
ScaleLine ();
}
//
// scale to the right
//
slinex = xcenter;
stopx = shape->rightpix;
if (shape->leftpix<31)
{
srcx = 31;
cmdptr = &shape->dataofs[32-shape->leftpix];
}
else
{
srcx = shape->leftpix-1;
cmdptr = &shape->dataofs[0];
}
slinewidth = 0;
while ( ++srcx <= stopx )
{
(unsigned)linecmds = *cmdptr++;
if ( !(slinewidth = comptable->width[srcx]) )
continue;
ScaleLine ();
slinex+=slinewidth;
}
}
//
// 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} };
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} };
int slinex,slinewidth;
unsigned far *linecmds;
long linescale;
unsigned maskword;

1480
WL_STATE.C Normal file

File diff suppressed because it is too large Load diff

859
WL_TEXT.C Normal file
View file

@ -0,0 +1,859 @@
// WL_TEXT.C
#include "WL_DEF.H"
#pragma hdrstop
/*
=============================================================================
TEXT FORMATTING COMMANDS
------------------------
^C<hex digit> Change text color
^E[enter] End of layout (all pages)
^G<y>,<x>,<pic>[enter] Draw a graphic and push margins
^P[enter] start new page, must be the first chars in a layout
^L<x>,<y>[ENTER] Locate to a specific spot, x in pixels, y in lines
=============================================================================
*/
/*
=============================================================================
LOCAL CONSTANTS
=============================================================================
*/
#define BACKCOLOR 0x11
#define WORDLIMIT 80
#define FONTHEIGHT 10
#define TOPMARGIN 16
#define BOTTOMMARGIN 32
#define LEFTMARGIN 16
#define RIGHTMARGIN 16
#define PICMARGIN 8
#define TEXTROWS ((200-TOPMARGIN-BOTTOMMARGIN)/FONTHEIGHT)
#define SPACEWIDTH 7
#define SCREENPIXWIDTH 320
#define SCREENMID (SCREENPIXWIDTH/2)
/*
=============================================================================
LOCAL VARIABLES
=============================================================================
*/
int pagenum,numpages;
unsigned leftmargin[TEXTROWS],rightmargin[TEXTROWS];
char far *text;
unsigned rowon;
int picx,picy,picnum,picdelay;
boolean layoutdone;
//===========================================================================
#ifndef JAPAN
/*
=====================
=
= RipToEOL
=
=====================
*/
void RipToEOL (void)
{
while (*text++ != '\n') // scan to end of line
;
}
/*
=====================
=
= ParseNumber
=
=====================
*/
int ParseNumber (void)
{
char ch;
char num[80],*numptr;
//
// scan until a number is found
//
ch = *text;
while (ch < '0' || ch >'9')
ch = *++text;
//
// copy the number out
//
numptr = num;
do
{
*numptr++ = ch;
ch = *++text;
} while (ch >= '0' && ch <= '9');
*numptr = 0;
return atoi (num);
}
/*
=====================
=
= ParsePicCommand
=
= Call with text pointing just after a ^P
= Upon exit text points to the start of next line
=
=====================
*/
void ParsePicCommand (void)
{
picy=ParseNumber();
picx=ParseNumber();
picnum=ParseNumber();
RipToEOL ();
}
void ParseTimedCommand (void)
{
picy=ParseNumber();
picx=ParseNumber();
picnum=ParseNumber();
picdelay=ParseNumber();
RipToEOL ();
}
/*
=====================
=
= TimedPicCommand
=
= Call with text pointing just after a ^P
= Upon exit text points to the start of next line
=
=====================
*/
void TimedPicCommand (void)
{
ParseTimedCommand ();
//
// update the screen, and wait for time delay
//
VW_UpdateScreen ();
//
// wait for time
//
TimeCount = 0;
while (TimeCount < picdelay)
;
//
// draw pic
//
VWB_DrawPic (picx&~7,picy,picnum);
}
/*
=====================
=
= HandleCommand
=
=====================
*/
void HandleCommand (void)
{
int i,margin,top,bottom;
int picwidth,picheight,picmid;
switch (toupper(*++text))
{
case 'B':
picy=ParseNumber();
picx=ParseNumber();
picwidth=ParseNumber();
picheight=ParseNumber();
VWB_Bar(picx,picy,picwidth,picheight,BACKCOLOR);
RipToEOL();
break;
case ';': // comment
RipToEOL();
break;
case 'P': // ^P is start of next page, ^E is end of file
case 'E':
layoutdone = true;
text--; // back up to the '^'
break;
case 'C': // ^c<hex digit> changes text color
i = toupper(*++text);
if (i>='0' && i<='9')
fontcolor = i-'0';
else if (i>='A' && i<='F')
fontcolor = i-'A'+10;
fontcolor *= 16;
i = toupper(*++text);
if (i>='0' && i<='9')
fontcolor += i-'0';
else if (i>='A' && i<='F')
fontcolor += i-'A'+10;
text++;
break;
case '>':
px = 160;
text++;
break;
case 'L':
py=ParseNumber();
rowon = (py-TOPMARGIN)/FONTHEIGHT;
py = TOPMARGIN+rowon*FONTHEIGHT;
px=ParseNumber();
while (*text++ != '\n') // scan to end of line
;
break;
case 'T': // ^Tyyy,xxx,ppp,ttt waits ttt tics, then draws pic
TimedPicCommand ();
break;
case 'G': // ^Gyyy,xxx,ppp draws graphic
ParsePicCommand ();
VWB_DrawPic (picx&~7,picy,picnum);
picwidth = pictable[picnum-STARTPICS].width;
picheight = pictable[picnum-STARTPICS].height;
//
// adjust margins
//
picmid = picx + picwidth/2;
if (picmid > SCREENMID)
margin = picx-PICMARGIN; // new right margin
else
margin = picx+picwidth+PICMARGIN; // new left margin
top = (picy-TOPMARGIN)/FONTHEIGHT;
if (top<0)
top = 0;
bottom = (picy+picheight-TOPMARGIN)/FONTHEIGHT;
if (bottom>=TEXTROWS)
bottom = TEXTROWS-1;
for (i=top;i<=bottom;i++)
if (picmid > SCREENMID)
rightmargin[i] = margin;
else
leftmargin[i] = margin;
//
// adjust this line if needed
//
if (px < leftmargin[rowon])
px = leftmargin[rowon];
break;
}
}
/*
=====================
=
= NewLine
=
=====================
*/
void NewLine (void)
{
char ch;
if (++rowon == TEXTROWS)
{
//
// overflowed the page, so skip until next page break
//
layoutdone = true;
do
{
if (*text == '^')
{
ch = toupper(*(text+1));
if (ch == 'E' || ch == 'P')
{
layoutdone = true;
return;
}
}
text++;
} while (1);
}
px = leftmargin[rowon];
py+= FONTHEIGHT;
}
/*
=====================
=
= HandleCtrls
=
=====================
*/
void HandleCtrls (void)
{
char ch;
ch = *text++; // get the character and advance
if (ch == '\n')
{
NewLine ();
return;
}
}
/*
=====================
=
= HandleWord
=
=====================
*/
void HandleWord (void)
{
char word[WORDLIMIT];
int i,wordindex;
unsigned wwidth,wheight,newpos;
//
// copy the next word into [word]
//
word[0] = *text++;
wordindex = 1;
while (*text>32)
{
word[wordindex] = *text++;
if (++wordindex == WORDLIMIT)
Quit ("PageLayout: Word limit exceeded");
}
word[wordindex] = 0; // stick a null at end for C
//
// see if it fits on this line
//
VW_MeasurePropString (word,&wwidth,&wheight);
while (px+wwidth > rightmargin[rowon])
{
NewLine ();
if (layoutdone)
return; // overflowed page
}
//
// print it
//
newpos = px+wwidth;
VWB_DrawPropString (word);
px = newpos;
//
// suck up any extra spaces
//
while (*text == ' ')
{
px += SPACEWIDTH;
text++;
}
}
/*
=====================
=
= PageLayout
=
= Clears the screen, draws the pics on the page, and word wraps the text.
= Returns a pointer to the terminating command
=
=====================
*/
void PageLayout (boolean shownumber)
{
int i,oldfontcolor;
char ch;
oldfontcolor = fontcolor;
fontcolor = 0;
//
// clear the screen
//
VWB_Bar (0,0,320,200,BACKCOLOR);
VWB_DrawPic (0,0,H_TOPWINDOWPIC);
VWB_DrawPic (0,8,H_LEFTWINDOWPIC);
VWB_DrawPic (312,8,H_RIGHTWINDOWPIC);
VWB_DrawPic (8,176,H_BOTTOMINFOPIC);
for (i=0;i<TEXTROWS;i++)
{
leftmargin[i] = LEFTMARGIN;
rightmargin[i] = SCREENPIXWIDTH-RIGHTMARGIN;
}
px = LEFTMARGIN;
py = TOPMARGIN;
rowon = 0;
layoutdone = false;
//
// make sure we are starting layout text (^P first command)
//
while (*text <= 32)
text++;
if (*text != '^' || toupper(*++text) != 'P')
Quit ("PageLayout: Text not headed with ^P");
while (*text++ != '\n')
;
//
// process text stream
//
do
{
ch = *text;
if (ch == '^')
HandleCommand ();
else
if (ch == 9)
{
px = (px+8)&0xf8;
text++;
}
else if (ch <= 32)
HandleCtrls ();
else
HandleWord ();
} while (!layoutdone);
pagenum++;
if (shownumber)
{
#ifdef SPANISH
strcpy (str,"Hoja ");
itoa (pagenum,str2,10);
strcat (str,str2);
strcat (str," de ");
py = 183;
px = 208;
#else
strcpy (str,"pg ");
itoa (pagenum,str2,10);
strcat (str,str2);
strcat (str," of ");
py = 183;
px = 213;
#endif
itoa (numpages,str2,10);
strcat (str,str2);
fontcolor = 0x4f; //12^BACKCOLOR;
VWB_DrawPropString (str);
}
fontcolor = oldfontcolor;
}
//===========================================================================
/*
=====================
=
= BackPage
=
= Scans for a previous ^P
=
=====================
*/
void BackPage (void)
{
pagenum--;
do
{
text--;
if (*text == '^' && toupper(*(text+1)) == 'P')
return;
} while (1);
}
//===========================================================================
/*
=====================
=
= CacheLayoutGraphics
=
= Scans an entire layout file (until a ^E) marking all graphics used, and
= counting pages, then caches the graphics in
=
=====================
*/
void CacheLayoutGraphics (void)
{
char far *bombpoint, far *textstart;
char ch;
textstart = text;
bombpoint = text+30000;
numpages = pagenum = 0;
do
{
if (*text == '^')
{
ch = toupper(*++text);
if (ch == 'P') // start of a page
numpages++;
if (ch == 'E') // end of file, so load graphics and return
{
CA_MarkGrChunk(H_TOPWINDOWPIC);
CA_MarkGrChunk(H_LEFTWINDOWPIC);
CA_MarkGrChunk(H_RIGHTWINDOWPIC);
CA_MarkGrChunk(H_BOTTOMINFOPIC);
CA_CacheMarks ();
text = textstart;
return;
}
if (ch == 'G') // draw graphic command, so mark graphics
{
ParsePicCommand ();
CA_MarkGrChunk (picnum);
}
if (ch == 'T') // timed draw graphic command, so mark graphics
{
ParseTimedCommand ();
CA_MarkGrChunk (picnum);
}
}
else
text++;
} while (text<bombpoint);
Quit ("CacheLayoutGraphics: No ^E to terminate file!");
}
#endif
/*
=====================
=
= ShowArticle
=
=====================
*/
#ifdef JAPAN
void ShowArticle (int which)
#else
void ShowArticle (char far *article)
#endif
{
#ifdef JAPAN
int snames[10] = { H_HELP1PIC,
H_HELP2PIC,
H_HELP3PIC,
H_HELP4PIC,
H_HELP5PIC,
H_HELP6PIC,
H_HELP7PIC,
H_HELP8PIC,
H_HELP9PIC,
H_HELP10PIC};
int enames[14] = {
0,0,
#ifndef JAPDEMO
C_ENDGAME1APIC,
C_ENDGAME1BPIC,
C_ENDGAME2APIC,
C_ENDGAME2BPIC,
C_ENDGAME3APIC,
C_ENDGAME3BPIC,
C_ENDGAME4APIC,
C_ENDGAME4BPIC,
C_ENDGAME5APIC,
C_ENDGAME5BPIC,
C_ENDGAME6APIC,
C_ENDGAME6BPIC
#endif
};
#endif
unsigned oldfontnumber;
unsigned temp;
boolean newpage,firstpage;
#ifdef JAPAN
pagenum = 1;
if (!which)
numpages = 10;
else
numpages = 2;
#else
text = article;
oldfontnumber = fontnumber;
fontnumber = 0;
CA_MarkGrChunk(STARTFONT);
VWB_Bar (0,0,320,200,BACKCOLOR);
CacheLayoutGraphics ();
#endif
newpage = true;
firstpage = true;
do
{
if (newpage)
{
newpage = false;
#ifdef JAPAN
if (!which)
CA_CacheScreen(snames[pagenum - 1]);
else
CA_CacheScreen(enames[which*2 + pagenum - 1]);
#else
PageLayout (true);
#endif
VW_UpdateScreen ();
if (firstpage)
{
VL_FadeIn(0,255,&gamepal,10);
// VW_FadeIn ()
firstpage = false;
}
}
LastScan = 0;
while (!LastScan)
;
switch (LastScan)
{
case sc_UpArrow:
case sc_PgUp:
case sc_LeftArrow:
if (pagenum>1)
{
#ifndef JAPAN
BackPage ();
BackPage ();
#else
pagenum--;
#endif
newpage = true;
}
break;
case sc_Enter:
case sc_DownArrow:
case sc_PgDn:
case sc_RightArrow: // the text allready points at next page
if (pagenum<numpages)
{
newpage = true;
#ifdef JAPAN
pagenum++;
#endif
}
break;
}
#ifndef SPEAR
if (Keyboard[sc_Tab] && Keyboard[sc_P] && MS_CheckParm("goobers"))
PicturePause();
#endif
} while (LastScan != sc_Escape);
IN_ClearKeysDown ();
fontnumber = oldfontnumber;
}
//===========================================================================
#ifndef JAPAN
#ifdef ARTSEXTERN
int endextern = T_ENDART1;
#ifndef SPEAR
int helpextern = T_HELPART;
#endif
#endif
char helpfilename[13] = "HELPART.",
endfilename[13] = "ENDART1.";
#endif
/*
=================
=
= HelpScreens
=
=================
*/
#ifndef SPEAR
void HelpScreens (void)
{
int artnum;
char far *text;
memptr layout;
CA_UpLevel ();
MM_SortMem ();
#ifdef JAPAN
ShowArticle (0);
VW_FadeOut();
FreeMusic ();
CA_DownLevel ();
MM_SortMem ();
#else
#ifdef ARTSEXTERN
artnum = helpextern;
CA_CacheGrChunk (artnum);
text = (char _seg *)grsegs[artnum];
MM_SetLock (&grsegs[artnum], true);
#else
CA_LoadFile (helpfilename,&layout);
text = (char _seg *)layout;
MM_SetLock (&layout, true);
#endif
ShowArticle (text);
#ifdef ARTSEXTERN
MM_FreePtr (&grsegs[artnum]);
#else
MM_FreePtr (&layout);
#endif
VW_FadeOut();
FreeMusic ();
CA_DownLevel ();
MM_SortMem ();
#endif
}
#endif
//
// END ARTICLES
//
void EndText (void)
{
int artnum;
char far *text;
memptr layout;
ClearMemory ();
CA_UpLevel ();
MM_SortMem ();
#ifdef JAPAN
ShowArticle(gamestate.episode + 1);
VW_FadeOut();
SETFONTCOLOR(0,15);
IN_ClearKeysDown();
if (MousePresent)
Mouse(MDelta); // Clear accumulated mouse movement
FreeMusic ();
CA_DownLevel ();
MM_SortMem ();
#else
#ifdef ARTSEXTERN
artnum = endextern+gamestate.episode;
CA_CacheGrChunk (artnum);
text = (char _seg *)grsegs[artnum];
MM_SetLock (&grsegs[artnum], true);
#else
endfilename[6] = '1'+gamestate.episode;
CA_LoadFile (endfilename,&layout);
text = (char _seg *)layout;
MM_SetLock (&layout, true);
#endif
ShowArticle (text);
#ifdef ARTSEXTERN
MM_FreePtr (&grsegs[artnum]);
#else
MM_FreePtr (&layout);
#endif
VW_FadeOut();
SETFONTCOLOR(0,15);
IN_ClearKeysDown();
if (MousePresent)
Mouse(MDelta); // Clear accumulated mouse movement
FreeMusic ();
CA_DownLevel ();
MM_SortMem ();
#endif
}

BIN
WOLF.DSW Normal file

Binary file not shown.

BIN
WOLF.EXE Normal file

Binary file not shown.

BIN
WOLF.IDE Normal file

Binary file not shown.

BIN
WOLF.OBR Normal file

Binary file not shown.

BIN
WOLF.~DE Normal file

Binary file not shown.

7
WOLF1VER.H Normal file
View file

@ -0,0 +1,7 @@
//#define SPEAR
#define ARTSEXTERN
#define DEMOSEXTERN
//#define MYPROFILE
//#define DEBCHECK
#define CARMACIZED
#define UPLOAD

BIN
WOLF3D.DSK Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more