Retab files to match style of new code

Were once ugly mess of tabs and spaces
Now using 4 space indents (same as crt.cpp)
This commit is contained in:
theinternetftw 2014-09-07 00:20:38 -04:00
parent 9e1c3d4aa3
commit e9312ba561
25 changed files with 11190 additions and 11190 deletions

View File

@ -5,134 +5,134 @@
//
/////////////////////////////////////////////////
#define NUMSOUNDS 81
#define NUMSNDCHUNKS 267
#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
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
#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
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;
/////////////////////////////////////////////////

View File

@ -9,142 +9,142 @@
// 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
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
#ifndef APOGEE_1_0
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
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
#endif
LASTSOUND
LASTSOUND
} soundnames;
//
// Base offsets
//
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS LASTSOUND
#define STARTDIGISOUNDS (2*LASTSOUND)
#define STARTMUSIC (3*LASTSOUND)
#define STARTPCSOUNDS 0
#define STARTADLIBSOUNDS LASTSOUND
#define STARTDIGISOUNDS (2*LASTSOUND)
#define STARTMUSIC (3*LASTSOUND)
//
// 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
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;
#define NUMSOUNDS LASTSOUND
#define NUMSNDCHUNKS (STARTMUSIC + LASTMUSIC)
#define NUMSOUNDS LASTSOUND
#define NUMSNDCHUNKS (STARTMUSIC + LASTMUSIC)
/////////////////////////////////////////////////
//

108
f_spear.h
View File

@ -1,76 +1,76 @@
#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_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_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_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_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_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_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_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_COPY12 "Nops. Zero points. Zugga."
#define STR_COPY13 "Yeah...right."
#define STR_COPY13 "Yeah...right."
#define STR_COPY14 "You must like these quizzes."
#define STR_COPY14 "You must like these quizzes."
#define STR_COPY15 "Could be called \"PixelMeister\"?"
#define STR_COPY15 "Could be called \"PixelMeister\"?"
#define STR_COPY16 "Might engineer some software?"
#define STR_COPY16 "Might engineer some software?"
#define STR_COPY17 "Would be found"
#define STR_COPY18 "directing creatively?"
#define STR_COPY17 "Would be found"
#define STR_COPY18 "directing creatively?"
#define STR_COPY19 "Might be found"
#define STR_COPY20 "handling operations?"
#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_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_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_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_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_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_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_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_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:"
#define STR_ID1 "Which member of Id Software:"

3024
fmopl.cpp

File diff suppressed because it is too large Load Diff

12
fmopl.h
View File

@ -14,12 +14,12 @@
/* compiler dependence */
#ifndef OSD_CPU_H
#define OSD_CPU_H
typedef unsigned char UINT8; /* unsigned 8bit */
typedef unsigned short UINT16; /* unsigned 16bit */
typedef unsigned int UINT32; /* unsigned 32bit */
typedef signed char INT8; /* signed 8bit */
typedef signed short INT16; /* signed 16bit */
typedef signed int INT32; /* signed 32bit */
typedef unsigned char UINT8; /* unsigned 8bit */
typedef unsigned short UINT16; /* unsigned 16bit */
typedef unsigned int UINT32; /* unsigned 32bit */
typedef signed char INT8; /* signed 8bit */
typedef signed short INT16; /* signed 16bit */
typedef signed int INT32; /* signed 32bit */
typedef int BOOL;
#endif

166
foreign.h
View File

@ -1,112 +1,112 @@
#define QUITSUR "Are you sure you want\n"\
"to quit this great game?"
#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 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 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 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_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_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_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_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_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_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_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_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_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_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_SIZE1 "Use arrows to size"
#define STR_SIZE2 "ENTER to accept"
#define STR_SIZE3 "ESC to cancel"
#define STR_YOUWIN "you win!"
#define STR_YOUWIN "you win!"
#define STR_TOTALTIME "total time"
#define STR_TOTALTIME "total time"
#define STR_RATKILL "kill %"
#define STR_RATSECRET "secret %"
#define STR_RATTREASURE "treasure %"
#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_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_RAT2SECRET "secret ratio %"
#define STR_RAT2TREASURE "treasure ratio %"
#define STR_DEFEATED "defeated!"
#define STR_DEFEATED "defeated!"
#define STR_CHEATER1 "You now have 100% Health,"
#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_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_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_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!"
#define STR_SEEAGAIN "Let's see that again!"
#ifdef SPEAR
#define ENDSTR1 "Heroes don't quit, but\ngo ahead and press " YESBUTTONNAME "\nif you aren't one."

View File

@ -205,50 +205,50 @@ typedef enum {
//
// Data LUMPs
//
#define BACKDROP_LUMP_START 3
#define BACKDROP_LUMP_END 8
#define BACKDROP_LUMP_START 3
#define BACKDROP_LUMP_END 8
#define CONTROL_LUMP_START 9
#define CONTROL_LUMP_END 15
#define CONTROL_LUMP_START 9
#define CONTROL_LUMP_END 15
#define OPTIONS_LUMP_START 16
#define OPTIONS_LUMP_END 16
#define OPTIONS_LUMP_START 16
#define OPTIONS_LUMP_END 16
#define SOUND_LUMP_START 17
#define SOUND_LUMP_END 19
#define SOUND_LUMP_START 17
#define SOUND_LUMP_END 19
#define NEWGAME_LUMP_START 20
#define NEWGAME_LUMP_END 24
#define NEWGAME_LUMP_START 20
#define NEWGAME_LUMP_END 24
#define LOADSAVE_LUMP_START 25
#define LOADSAVE_LUMP_END 28
#define LOADSAVE_LUMP_START 25
#define LOADSAVE_LUMP_END 28
#define HIGHSCORES_LUMP_START 29
#define HIGHSCORES_LUMP_END 30
#define HIGHSCORES_LUMP_START 29
#define HIGHSCORES_LUMP_END 30
#define ENDGAME_LUMP_START 31
#define ENDGAME_LUMP_END 35
#define ENDGAME_LUMP_START 31
#define ENDGAME_LUMP_END 35
#define LEVELEND_LUMP_START L_GUYPIC
#define LEVELEND_LUMP_END L_BJWINSPIC
#define LEVELEND_LUMP_START L_GUYPIC
#define LEVELEND_LUMP_END L_BJWINSPIC
#define TITLESCREEN_LUMP_START TITLE1PIC
#define TITLESCREEN_LUMP_END TITLE2PIC
#define TITLESCREEN_LUMP_START TITLE1PIC
#define TITLESCREEN_LUMP_END TITLE2PIC
#define ENDGAME1_LUMP_START ENDSCREEN11PIC
#define ENDGAME1_LUMP_END ENDSCREEN11PIC
#define ENDGAME1_LUMP_START ENDSCREEN11PIC
#define ENDGAME1_LUMP_END ENDSCREEN11PIC
#define ENDGAME2_LUMP_START ENDSCREEN12PIC
#define ENDGAME2_LUMP_END ENDSCREEN12PIC
#define ENDGAME2_LUMP_START ENDSCREEN12PIC
#define ENDGAME2_LUMP_END ENDSCREEN12PIC
#define EASTEREGG_LUMP_START IDGUYS1PIC
#define EASTEREGG_LUMP_END IDGUYS2PIC
#define EASTEREGG_LUMP_START IDGUYS1PIC
#define EASTEREGG_LUMP_END IDGUYS2PIC
#define COPYPROT_LUMP_START COPYPROTTOPPIC
#define COPYPROT_LUMP_END BOSSPIC4PIC
#define COPYPROT_LUMP_START COPYPROTTOPPIC
#define COPYPROT_LUMP_END BOSSPIC4PIC
#define LATCHPICS_LUMP_START KNIFEPIC
#define LATCHPICS_LUMP_END GETPSYCHEDPIC
#define LATCHPICS_LUMP_END GETPSYCHEDPIC
//

View File

@ -164,17 +164,17 @@ typedef enum {
//
// Data LUMPs
//
#define README_LUMP_START 3
#define README_LUMP_END 9
#define README_LUMP_START 3
#define README_LUMP_END 9
#define CONTROLS_LUMP_START 10
#define CONTROLS_LUMP_END 42
#define CONTROLS_LUMP_START 10
#define CONTROLS_LUMP_END 42
#define LEVELEND_LUMP_START 43
#define LEVELEND_LUMP_END 85
#define LEVELEND_LUMP_START 43
#define LEVELEND_LUMP_END 85
#define LATCHPICS_LUMP_START 91
#define LATCHPICS_LUMP_END 134
#define LATCHPICS_LUMP_START 91
#define LATCHPICS_LUMP_END 134
//

View File

@ -111,8 +111,8 @@ SDMode oldsoundmode;
static int32_t GRFILEPOS(const size_t idx)
{
assert(idx < lengthof(grstarts));
return grstarts[idx];
assert(idx < lengthof(grstarts));
return grstarts[idx];
}
/*
@ -480,9 +480,9 @@ void CAL_SetupGrFile (void)
lseek(handle, 0, SEEK_SET);
#ifndef APOGEE_1_0
int expectedsize = lengthof(grstarts) - numEpisodesMissing;
int expectedsize = lengthof(grstarts) - numEpisodesMissing;
#else
int expectedsize = lengthof(grstarts);
int expectedsize = lengthof(grstarts);
#endif
if(!param_ignorenumchunks && headersize / 3 != (long) expectedsize)

300
id_in.cpp
View File

@ -1,20 +1,20 @@
//
// ID Engine
// ID_IN.c - Input Manager
// v1.0d1
// By Jason Blochowiak
// ID Engine
// ID_IN.c - Input Manager
// v1.0d1
// By Jason Blochowiak
//
//
// This module handles dealing with the various input devices
// 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)
// 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
// 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 "wl_def.h"
@ -23,7 +23,7 @@
/*
=============================================================================
GLOBAL VARIABLES
GLOBAL VARIABLES
=============================================================================
*/
@ -36,13 +36,13 @@ boolean MousePresent;
boolean forcegrabmouse;
// Global variables
// Global variables
volatile boolean Keyboard[SDLK_LAST];
volatile boolean Paused;
volatile char LastASCII;
volatile ScanCode LastScan;
volatile boolean Paused;
volatile char LastASCII;
volatile ScanCode LastScan;
//KeyboardDef KbdDefs = {0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51};
//KeyboardDef KbdDefs = {0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51};
static KeyboardDef KbdDefs = {
sc_Control, // button0
sc_Alt, // button1
@ -65,62 +65,62 @@ static bool GrabInput = false;
/*
=============================================================================
LOCAL VARIABLES
LOCAL VARIABLES
=============================================================================
*/
byte ASCIINames[] = // Unshifted ASCII for scan codes // TODO: keypad
byte ASCIINames[] = // Unshifted ASCII for scan codes // TODO: keypad
{
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,8 ,9 ,0 ,0 ,0 ,13 ,0 ,0 , // 0
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,27 ,0 ,0 ,0 , // 1
' ',0 ,0 ,0 ,0 ,0 ,0 ,39 ,0 ,0 ,'*','+',',','-','.','/', // 2
'0','1','2','3','4','5','6','7','8','9',0 ,';',0 ,'=',0 ,0 , // 3
'`','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', // 4
'p','q','r','s','t','u','v','w','x','y','z','[',92 ,']',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
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,8 ,9 ,0 ,0 ,0 ,13 ,0 ,0 , // 0
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,27 ,0 ,0 ,0 , // 1
' ',0 ,0 ,0 ,0 ,0 ,0 ,39 ,0 ,0 ,'*','+',',','-','.','/', // 2
'0','1','2','3','4','5','6','7','8','9',0 ,';',0 ,'=',0 ,0 , // 3
'`','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', // 4
'p','q','r','s','t','u','v','w','x','y','z','[',92 ,']',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
};
byte ShiftNames[] = // Shifted ASCII for scan codes
byte ShiftNames[] = // Shifted ASCII for scan 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 ,8 ,9 ,0 ,0 ,0 ,13 ,0 ,0 , // 0
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,27 ,0 ,0 ,0 , // 1
' ',0 ,0 ,0 ,0 ,0 ,0 ,34 ,0 ,0 ,'*','+','<','_','>','?', // 2
')','!','@','#','$','%','^','&','*','(',0 ,':',0 ,'+',0 ,0 , // 3
'~','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', // 4
'P','Q','R','S','T','U','V','W','X','Y','Z','{','|','}',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
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,8 ,9 ,0 ,0 ,0 ,13 ,0 ,0 , // 0
0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,27 ,0 ,0 ,0 , // 1
' ',0 ,0 ,0 ,0 ,0 ,0 ,34 ,0 ,0 ,'*','+','<','_','>','?', // 2
')','!','@','#','$','%','^','&','*','(',0 ,':',0 ,'+',0 ,0 , // 3
'~','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', // 4
'P','Q','R','S','T','U','V','W','X','Y','Z','{','|','}',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
};
byte SpecialNames[] = // ASCII for 0xe0 prefixed codes
byte 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
// 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 IN_Started;
static Direction DirTable[] = // Quick lookup for total direction
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
dir_NorthWest, dir_North, dir_NorthEast,
dir_West, dir_None, dir_East,
dir_SouthWest, dir_South, dir_SouthEast
};
///////////////////////////////////////////////////////////////////////////
//
// INL_GetMouseButtons() - Gets the status of the mouse buttons from the
// mouse driver
// INL_GetMouseButtons() - Gets the status of the mouse buttons from the
// mouse driver
//
///////////////////////////////////////////////////////////////////////////
static int
@ -138,8 +138,8 @@ INL_GetMouseButtons(void)
///////////////////////////////////////////////////////////////////////////
//
// IN_GetJoyDelta() - Returns the relative movement of the specified
// joystick (from +/-127)
// IN_GetJoyDelta() - Returns the relative movement of the specified
// joystick (from +/-127)
//
///////////////////////////////////////////////////////////////////////////
void IN_GetJoyDelta(int *dx,int *dy)
@ -180,8 +180,8 @@ void IN_GetJoyDelta(int *dx,int *dy)
///////////////////////////////////////////////////////////////////////////
//
// IN_GetJoyFineDelta() - Returns the relative movement of the specified
// joystick without dividing the results by 256 (from +/-127)
// IN_GetJoyFineDelta() - Returns the relative movement of the specified
// joystick without dividing the results by 256 (from +/-127)
//
///////////////////////////////////////////////////////////////////////////
void IN_GetJoyFineDelta(int *dx, int *dy)
@ -295,7 +295,7 @@ static void processEvent(SDL_Event *event)
if(LastScan == SDLK_PAUSE)
Paused = true;
break;
}
}
case SDL_KEYUP:
{
@ -350,14 +350,14 @@ void IN_ProcessEvents()
///////////////////////////////////////////////////////////////////////////
//
// IN_Startup() - Starts up the Input Mgr
// IN_Startup() - Starts up the Input Mgr
//
///////////////////////////////////////////////////////////////////////////
void
IN_Startup(void)
{
if (IN_Started)
return;
if (IN_Started)
return;
IN_ClearKeysDown();
@ -391,53 +391,53 @@ IN_Startup(void)
///////////////////////////////////////////////////////////////////////////
//
// IN_Shutdown() - Shuts down the Input Mgr
// IN_Shutdown() - Shuts down the Input Mgr
//
///////////////////////////////////////////////////////////////////////////
void
IN_Shutdown(void)
{
if (!IN_Started)
return;
if (!IN_Started)
return;
if(Joystick)
SDL_JoystickClose(Joystick);
IN_Started = false;
IN_Started = false;
}
///////////////////////////////////////////////////////////////////////////
//
// IN_ClearKeysDown() - Clears the keyboard array
// IN_ClearKeysDown() - Clears the keyboard array
//
///////////////////////////////////////////////////////////////////////////
void
IN_ClearKeysDown(void)
{
LastScan = sc_None;
LastASCII = key_None;
memset ((void *) Keyboard,0,sizeof(Keyboard));
LastScan = sc_None;
LastASCII = key_None;
memset ((void *) Keyboard,0,sizeof(Keyboard));
}
///////////////////////////////////////////////////////////////////////////
//
// IN_ReadControl() - Reads the device associated with the specified
// player and fills in the control info struct
// IN_ReadControl() - Reads the device associated with the specified
// player and fills in the control info struct
//
///////////////////////////////////////////////////////////////////////////
void
IN_ReadControl(int player,ControlInfo *info)
{
word buttons;
int dx,dy;
Motion mx,my;
word buttons;
int dx,dy;
Motion mx,my;
dx = dy = 0;
mx = my = motion_None;
buttons = 0;
dx = dy = 0;
mx = my = motion_None;
buttons = 0;
IN_ProcessEvents();
IN_ProcessEvents();
if (Keyboard[KbdDefs.upleft])
mx = motion_Left,my = motion_Up;
@ -463,62 +463,62 @@ IN_ReadControl(int player,ControlInfo *info)
if (Keyboard[KbdDefs.button1])
buttons += 1 << 1;
dx = mx * 127;
dy = my * 127;
dx = mx * 127;
dy = my * 127;
info->x = dx;
info->xaxis = mx;
info->y = dy;
info->yaxis = my;
info->button0 = (buttons & (1 << 0)) != 0;
info->button1 = (buttons & (1 << 1)) != 0;
info->button2 = (buttons & (1 << 2)) != 0;
info->button3 = (buttons & (1 << 3)) != 0;
info->dir = DirTable[((my + 1) * 3) + (mx + 1)];
info->x = dx;
info->xaxis = mx;
info->y = dy;
info->yaxis = my;
info->button0 = (buttons & (1 << 0)) != 0;
info->button1 = (buttons & (1 << 1)) != 0;
info->button2 = (buttons & (1 << 2)) != 0;
info->button3 = (buttons & (1 << 3)) != 0;
info->dir = DirTable[((my + 1) * 3) + (mx + 1)];
}
///////////////////////////////////////////////////////////////////////////
//
// IN_WaitForKey() - Waits for a scan code, then clears LastScan and
// returns the scan code
// IN_WaitForKey() - Waits for a scan code, then clears LastScan and
// returns the scan code
//
///////////////////////////////////////////////////////////////////////////
ScanCode
IN_WaitForKey(void)
{
ScanCode result;
ScanCode result;
while ((result = LastScan)==0)
IN_WaitAndProcessEvents();
LastScan = 0;
return(result);
while ((result = LastScan)==0)
IN_WaitAndProcessEvents();
LastScan = 0;
return(result);
}
///////////////////////////////////////////////////////////////////////////
//
// IN_WaitForASCII() - Waits for an ASCII char, then clears LastASCII and
// returns the ASCII value
// IN_WaitForASCII() - Waits for an ASCII char, then clears LastASCII and
// returns the ASCII value
//
///////////////////////////////////////////////////////////////////////////
char
IN_WaitForASCII(void)
{
char result;
char result;
while ((result = LastASCII)==0)
IN_WaitAndProcessEvents();
LastASCII = '\0';
return(result);
while ((result = LastASCII)==0)
IN_WaitAndProcessEvents();
LastASCII = '\0';
return(result);
}
///////////////////////////////////////////////////////////////////////////
//
// IN_Ack() - waits for a button or key press. If a button is down, upon
// 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[NUMBUTTONS];
boolean btnstate[NUMBUTTONS];
void IN_StartAck(void)
{
@ -526,17 +526,17 @@ void IN_StartAck(void)
//
// get initial state of everything
//
IN_ClearKeysDown();
memset(btnstate, 0, sizeof(btnstate));
IN_ClearKeysDown();
memset(btnstate, 0, sizeof(btnstate));
int buttons = IN_JoyButtons() << 4;
int buttons = IN_JoyButtons() << 4;
if(MousePresent)
buttons |= IN_MouseButtons();
if(MousePresent)
buttons |= IN_MouseButtons();
for(int i = 0; i < NUMBUTTONS; i++, buttons >>= 1)
if(buttons & 1)
btnstate[i] = true;
for(int i = 0; i < NUMBUTTONS; i++, buttons >>= 1)
if(buttons & 1)
btnstate[i] = true;
}
@ -546,19 +546,19 @@ boolean IN_CheckAck (void)
//
// see if something has been pressed
//
if(LastScan)
return true;
if(LastScan)
return true;
int buttons = IN_JoyButtons() << 4;
int buttons = IN_JoyButtons() << 4;
if(MousePresent)
buttons |= IN_MouseButtons();
if(MousePresent)
buttons |= IN_MouseButtons();
for(int i = 0; i < NUMBUTTONS; i++, buttons >>= 1)
{
if(buttons & 1)
{
if(!btnstate[i])
for(int i = 0; i < NUMBUTTONS; i++, buttons >>= 1)
{
if(buttons & 1)
{
if(!btnstate[i])
{
// Wait until button has been released
do
@ -571,51 +571,51 @@ boolean IN_CheckAck (void)
}
while(buttons & (1 << i));
return true;
return true;
}
}
else
btnstate[i] = false;
}
}
else
btnstate[i] = false;
}
return false;
return false;
}
void IN_Ack (void)
{
IN_StartAck ();
IN_StartAck ();
do
{
IN_WaitAndProcessEvents();
}
while(!IN_CheckAck ());
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.
// 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;
longword lasttime;
lasttime = GetTimeCount();
IN_StartAck ();
do
{
lasttime = GetTimeCount();
IN_StartAck ();
do
{
IN_ProcessEvents();
if (IN_CheckAck())
return true;
if (IN_CheckAck())
return true;
SDL_Delay(5);
} while (GetTimeCount() - lasttime < delay);
return(false);
} while (GetTimeCount() - lasttime < delay);
return(false);
}
//===========================================================================
@ -629,10 +629,10 @@ boolean IN_UserInput(longword delay)
*/
int IN_MouseButtons (void)
{
if (MousePresent)
return INL_GetMouseButtons();
else
return 0;
if (MousePresent)
return INL_GetMouseButtons();
else
return 0;
}
bool IN_IsInputGrabbed()

284
id_in.h
View File

@ -1,140 +1,140 @@
//
// ID Engine
// ID_IN.h - Header file for Input Manager
// v1.0d1
// By Jason Blochowiak
// ID Engine
// ID_IN.h - Header file for Input Manager
// v1.0d1
// By Jason Blochowiak
//
#ifndef __ID_IN__
#define __ID_IN__
#ifndef __ID_IN__
#define __ID_IN__
#ifdef __DEBUG__
#define __DEBUG_InputMgr__
#ifdef __DEBUG__
#define __DEBUG_InputMgr__
#endif
typedef int ScanCode;
#define sc_None 0
#define sc_Bad 0xff
#define sc_Return SDLK_RETURN
#define sc_Enter sc_Return
#define sc_Escape SDLK_ESCAPE
#define sc_Space SDLK_SPACE
#define sc_BackSpace SDLK_BACKSPACE
#define sc_Tab SDLK_TAB
#define sc_Alt SDLK_LALT
#define sc_Control SDLK_LCTRL
#define sc_CapsLock SDLK_CAPSLOCK
#define sc_LShift SDLK_LSHIFT
#define sc_RShift SDLK_RSHIFT
#define sc_UpArrow SDLK_UP
#define sc_DownArrow SDLK_DOWN
#define sc_LeftArrow SDLK_LEFT
#define sc_RightArrow SDLK_RIGHT
#define sc_Insert SDLK_INSERT
#define sc_Delete SDLK_DELETE
#define sc_Home SDLK_HOME
#define sc_End SDLK_END
#define sc_PgUp SDLK_PAGEUP
#define sc_PgDn SDLK_PAGEDOWN
#define sc_F1 SDLK_F1
#define sc_F2 SDLK_F2
#define sc_F3 SDLK_F3
#define sc_F4 SDLK_F4
#define sc_F5 SDLK_F5
#define sc_F6 SDLK_F6
#define sc_F7 SDLK_F7
#define sc_F8 SDLK_F8
#define sc_F9 SDLK_F9
#define sc_F10 SDLK_F10
#define sc_F11 SDLK_F11
#define sc_F12 SDLK_F12
typedef int ScanCode;
#define sc_None 0
#define sc_Bad 0xff
#define sc_Return SDLK_RETURN
#define sc_Enter sc_Return
#define sc_Escape SDLK_ESCAPE
#define sc_Space SDLK_SPACE
#define sc_BackSpace SDLK_BACKSPACE
#define sc_Tab SDLK_TAB
#define sc_Alt SDLK_LALT
#define sc_Control SDLK_LCTRL
#define sc_CapsLock SDLK_CAPSLOCK
#define sc_LShift SDLK_LSHIFT
#define sc_RShift SDLK_RSHIFT
#define sc_UpArrow SDLK_UP
#define sc_DownArrow SDLK_DOWN
#define sc_LeftArrow SDLK_LEFT
#define sc_RightArrow SDLK_RIGHT
#define sc_Insert SDLK_INSERT
#define sc_Delete SDLK_DELETE
#define sc_Home SDLK_HOME
#define sc_End SDLK_END
#define sc_PgUp SDLK_PAGEUP
#define sc_PgDn SDLK_PAGEDOWN
#define sc_F1 SDLK_F1
#define sc_F2 SDLK_F2
#define sc_F3 SDLK_F3
#define sc_F4 SDLK_F4
#define sc_F5 SDLK_F5
#define sc_F6 SDLK_F6
#define sc_F7 SDLK_F7
#define sc_F8 SDLK_F8
#define sc_F9 SDLK_F9
#define sc_F10 SDLK_F10
#define sc_F11 SDLK_F11
#define sc_F12 SDLK_F12
#define sc_ScrollLock SDLK_SCROLLOCK
#define sc_PrintScreen SDLK_PRINT
#define sc_ScrollLock SDLK_SCROLLOCK
#define sc_PrintScreen SDLK_PRINT
#define sc_1 SDLK_1
#define sc_2 SDLK_2
#define sc_3 SDLK_3
#define sc_4 SDLK_4
#define sc_5 SDLK_5
#define sc_6 SDLK_6
#define sc_7 SDLK_7
#define sc_8 SDLK_8
#define sc_9 SDLK_9
#define sc_0 SDLK_0
#define sc_1 SDLK_1
#define sc_2 SDLK_2
#define sc_3 SDLK_3
#define sc_4 SDLK_4
#define sc_5 SDLK_5
#define sc_6 SDLK_6
#define sc_7 SDLK_7
#define sc_8 SDLK_8
#define sc_9 SDLK_9
#define sc_0 SDLK_0
#define sc_A SDLK_a
#define sc_B SDLK_b
#define sc_C SDLK_c
#define sc_D SDLK_d
#define sc_E SDLK_e
#define sc_F SDLK_f
#define sc_G SDLK_g
#define sc_H SDLK_h
#define sc_I SDLK_i
#define sc_J SDLK_j
#define sc_K SDLK_k
#define sc_L SDLK_l
#define sc_M SDLK_m
#define sc_N SDLK_n
#define sc_O SDLK_o
#define sc_P SDLK_p
#define sc_Q SDLK_q
#define sc_R SDLK_r
#define sc_S SDLK_s
#define sc_T SDLK_t
#define sc_U SDLK_u
#define sc_V SDLK_v
#define sc_W SDLK_w
#define sc_X SDLK_x
#define sc_Y SDLK_y
#define sc_Z SDLK_z
#define sc_A SDLK_a
#define sc_B SDLK_b
#define sc_C SDLK_c
#define sc_D SDLK_d
#define sc_E SDLK_e
#define sc_F SDLK_f
#define sc_G SDLK_g
#define sc_H SDLK_h
#define sc_I SDLK_i
#define sc_J SDLK_j
#define sc_K SDLK_k
#define sc_L SDLK_l
#define sc_M SDLK_m
#define sc_N SDLK_n
#define sc_O SDLK_o
#define sc_P SDLK_p
#define sc_Q SDLK_q
#define sc_R SDLK_r
#define sc_S SDLK_s
#define sc_T SDLK_t
#define sc_U SDLK_u
#define sc_V SDLK_v
#define sc_W SDLK_w
#define sc_X SDLK_x
#define sc_Y SDLK_y
#define sc_Z SDLK_z
#define key_None 0
#define key_None 0
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;
short 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;
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;
short 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 volatile boolean Keyboard[];
extern boolean MousePresent;
@ -146,24 +146,24 @@ extern boolean forcegrabmouse;
// Function prototypes
#define IN_KeyDown(code) (Keyboard[(code)])
#define IN_ClearKey(code) {Keyboard[code] = false;\
if (code == LastScan) LastScan = sc_None;}
#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);
extern void IN_ClearKeysDown(void);
extern void IN_ReadControl(int,ControlInfo *);
extern void IN_GetJoyAbs(word joy,word *xp,word *yp);
extern void IN_SetupJoy(word joy,word minx,word maxx,
word miny,word maxy);
extern void IN_StopDemo(void),IN_FreeDemoBuffer(void),
IN_Ack(void);
extern boolean IN_UserInput(longword delay);
extern char IN_WaitForASCII(void);
extern ScanCode IN_WaitForKey(void);
extern word IN_GetJoyButtonsDB(word joy);
extern const char *IN_GetScanName(ScanCode);
extern void IN_Startup(void),IN_Shutdown(void);
extern void IN_ClearKeysDown(void);
extern void IN_ReadControl(int,ControlInfo *);
extern void IN_GetJoyAbs(word joy,word *xp,word *yp);
extern void IN_SetupJoy(word joy,word minx,word maxx,
word miny,word maxy);
extern void IN_StopDemo(void),IN_FreeDemoBuffer(void),
IN_Ack(void);
extern boolean IN_UserInput(longword delay);
extern char IN_WaitForASCII(void);
extern ScanCode IN_WaitForKey(void);
extern word IN_GetJoyButtonsDB(word joy);
extern const char *IN_GetScanName(ScanCode);
void IN_WaitAndProcessEvents();
void IN_ProcessEvents();

View File

@ -37,23 +37,23 @@
typedef struct
{
char RIFF[4];
longword filelenminus8;
char WAVE[4];
char fmt_[4];
longword formatlen;
word val0x0001;
word channels;
longword samplerate;
longword bytespersec;
word bytespersample;
word bitspersample;
char RIFF[4];
longword filelenminus8;
char WAVE[4];
char fmt_[4];
longword formatlen;
word val0x0001;
word channels;
longword samplerate;
longword bytespersec;
word bytespersample;
word bitspersample;
} headchunk;
typedef struct
{
char chunkid[4];
longword chunklength;
char chunkid[4];
longword chunklength;
} wavechunk;
typedef struct
@ -115,8 +115,8 @@ static longword sqHackTime;
static void SDL_SoundFinished(void)
{
SoundNumber = (soundnames)0;
SoundPriority = 0;
SoundNumber = (soundnames)0;
SoundPriority = 0;
}
@ -1070,7 +1070,7 @@ SD_Startup(void)
YM3812Write(0,i,0);
YM3812Write(0,1,0x20); // Set WSE=1
// YM3812Write(0,8,0); // Set CSM=0 & SEL=0 // already set in for statement
// YM3812Write(0,8,0); // Set CSM=0 & SEL=0 // already set in for statement
Mix_HookMusic(SDL_IMFMusicPlayer, 0);
Mix_ChannelFinished(SD_ChannelFinished);

View File

@ -149,7 +149,7 @@ extern boolean SD_SetMusicMode(SMMode mode);
extern word SD_SoundPlaying(void);
extern void SD_SetDigiDevice(SDSMode);
extern void SD_PrepareSound(int which);
extern void SD_PrepareSound(int which);
extern int SD_PlayDigitized(word which,int leftpos,int rightpos);
extern void SD_StopDigitized(void);

130
id_us.h
View File

@ -1,99 +1,99 @@
//
// ID Engine
// ID_US.h - Header file for the User Manager
// v1.0d1
// By Jason Blochowiak
// ID Engine
// ID_US.h - Header file for the User Manager
// v1.0d1
// By Jason Blochowiak
//
#ifndef __ID_US__
#define __ID_US__
#ifndef __ID_US__
#define __ID_US__
#ifdef __DEBUG__
#define __DEBUG_UserMgr__
#ifdef __DEBUG__
#define __DEBUG_UserMgr__
#endif
//#define HELPTEXTLINKED
//#define HELPTEXTLINKED
#define MaxX 320
#define MaxY 200
#define MaxX 320
#define MaxY 200
#define MaxHelpLines 500
#define MaxHelpLines 500
#define MaxHighName 57
#define MaxScores 7
typedef struct
#define MaxHighName 57
#define MaxScores 7
typedef struct
{
char name[MaxHighName + 1];
int32_t score;
word completed,episode;
char name[MaxHighName + 1];
int32_t score;
word completed,episode;
} HighScore;
#define MaxGameName 32
#define MaxSaveGames 6
typedef struct
#define MaxGameName 32
#define MaxSaveGames 6
typedef struct
{
char signature[4];
word *oldtest;
boolean present;
char name[MaxGameName + 1];
char signature[4];
word *oldtest;
boolean present;
char name[MaxGameName + 1];
} SaveGame;
#define MaxString 128 // Maximum input string size
#define MaxString 128 // Maximum input string size
typedef struct
typedef struct
{
int x,y,
int x,y,
w,h,
px,py;
} WindowRec; // Record used to save & restore screen windows
} WindowRec; // Record used to save & restore screen windows
extern boolean ingame, // Set by game code if a game is in progress
loadedgame; // Set if the current game was loaded
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 ingame, // Set by game code if a game is in progress
loadedgame; // Set if the current game was loaded
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 void (*USL_MeasureString)(const char *,word *,word *);
extern void (*USL_DrawString)(const char *);
extern void (*USL_MeasureString)(const char *,word *,word *);
extern void (*USL_DrawString)(const char *);
extern boolean (*USL_SaveGame)(int),(*USL_LoadGame)(int);
extern void (*USL_ResetGame)(void);
extern SaveGame Games[MaxSaveGames];
extern HighScore Scores[];
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;}
#define US_HomeWindow() {PrintX = WindowX; PrintY = WindowY;}
void US_Startup(void);
void US_Shutdown(void);
void US_TextScreen(void),
US_UpdateTextScreen(void),
US_FinishTextScreen(void);
void US_DrawWindow(word x,word y,word w,word h);
void US_TextScreen(void),
US_UpdateTextScreen(void),
US_FinishTextScreen(void);
void US_DrawWindow(word x,word y,word w,word h);
void US_SaveWindow(WindowRec *win),
US_RestoreWindow(WindowRec *win);
void US_ClearWindow(void);
void US_SetPrintRoutines(void (*measure)(const char *,word *,word *),
void (*print)(const char *));
void US_PrintCentered(const char *s),
US_CPrint(const char *s),
US_CPrintLine(const char *s),
US_Print(const char *s);
void US_Printf(const char *formatStr, ...);
void US_CPrintf(const char *formatStr, ...);
void US_SaveWindow(WindowRec *win),
US_RestoreWindow(WindowRec *win);
void US_ClearWindow(void);
void US_SetPrintRoutines(void (*measure)(const char *,word *,word *),
void (*print)(const char *));
void US_PrintCentered(const char *s),
US_CPrint(const char *s),
US_CPrintLine(const char *s),
US_Print(const char *s);
void US_Printf(const char *formatStr, ...);
void US_CPrintf(const char *formatStr, ...);
void US_PrintUnsigned(longword n);
void US_PrintSigned(int32_t n);
void US_StartCursor(void),
US_ShutCursor(void);
void US_CheckHighScore(int32_t score,word other);
void US_DisplayHighScores(int which);
extern boolean US_UpdateCursor(void);
void US_PrintUnsigned(longword n);
void US_PrintSigned(int32_t n);
void US_StartCursor(void),
US_ShutCursor(void);
void US_CheckHighScore(int32_t score,word other);
void US_DisplayHighScores(int which);
extern boolean US_UpdateCursor(void);
boolean US_LineInput(int x,int y,char *buf,const char *def,boolean escok,
int maxchars,int maxwidth);
void USL_PrintInCenter(const char *s,Rect r);
char *USL_GiveSaveName(word game);
void USL_PrintInCenter(const char *s,Rect r);
char *USL_GiveSaveName(word game);
void US_InitRndT(int randomize);
int US_RndT();

File diff suppressed because it is too large Load Diff

194
id_vh.cpp
View File

@ -1,51 +1,51 @@
#include "wl_def.h"
pictabletype *pictable;
pictabletype *pictable;
SDL_Surface *latchpics[NUMLATCHPICS];
int px,py;
byte fontcolor,backcolor;
int fontnumber;
int px,py;
byte fontcolor,backcolor;
int fontnumber;
//==========================================================================
void VWB_DrawPropString(const char* string)
{
fontstruct *font;
int width, step, height;
byte *source, *dest;
byte ch;
fontstruct *font;
int width, step, height;
byte *source, *dest;
byte ch;
byte *vbuf = LOCK();
font = (fontstruct *) grsegs[STARTFONT+fontnumber];
height = font->height;
dest = vbuf + scaleFactor * (py * curPitch + px);
font = (fontstruct *) grsegs[STARTFONT+fontnumber];
height = font->height;
dest = vbuf + scaleFactor * (py * curPitch + px);
while ((ch = (byte)*string++)!=0)
{
width = step = font->width[ch];
source = ((byte *)font)+font->location[ch];
while (width--)
{
for(int i=0;i<height;i++)
{
if(source[i*step])
while ((ch = (byte)*string++)!=0)
{
width = step = font->width[ch];
source = ((byte *)font)+font->location[ch];
while (width--)
{
for(int i=0;i<height;i++)
{
if(source[i*step])
{
for(unsigned sy=0; sy<scaleFactor; sy++)
for(unsigned sx=0; sx<scaleFactor; sx++)
dest[(scaleFactor*i+sy)*curPitch+sx]=fontcolor;
dest[(scaleFactor*i+sy)*curPitch+sx]=fontcolor;
}
}
}
source++;
px++;
dest+=scaleFactor;
}
}
source++;
px++;
dest+=scaleFactor;
}
}
UNLOCK();
UNLOCK();
}
/*
@ -58,57 +58,57 @@ void VWB_DrawPropString(const char* string)
void VL_MungePic (byte *source, unsigned width, unsigned height)
{
unsigned x,y,plane,size,pwidth;
byte *temp, *dest, *srcline;
unsigned x,y,plane,size,pwidth;
byte *temp, *dest, *srcline;
size = width*height;
size = width*height;
if (width&3)
Quit ("VL_MungePic: Not divisable by 4!");
if (width&3)
Quit ("VL_MungePic: Not divisable by 4!");
//
// copy the pic to a temp buffer
//
temp=(byte *) malloc(size);
temp=(byte *) malloc(size);
CHECKMALLOCRESULT(temp);
memcpy (temp,source,size);
memcpy (temp,source,size);
//
// munge it back into the original buffer
//
dest = source;
pwidth = width/4;
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;
}
}
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);
free(temp);
}
void VWL_MeasureString (const char *string, word *width, word *height, fontstruct *font)
{
*height = font->height;
for (*width = 0;*string;string++)
*width += font->width[*((byte *)string)]; // proportional width
*height = font->height;
for (*width = 0;*string;string++)
*width += font->width[*((byte *)string)]; // proportional width
}
void VW_MeasurePropString (const char *string, word *width, word *height)
{
VWL_MeasureString(string,width,height,(fontstruct *)grsegs[STARTFONT+fontnumber]);
VWL_MeasureString(string,width,height,(fontstruct *)grsegs[STARTFONT+fontnumber]);
}
/*
=============================================================================
Double buffer management routines
Double buffer management routines
=============================================================================
*/
@ -116,40 +116,40 @@ void VW_MeasurePropString (const char *string, word *width, word *height)
void VH_UpdateScreen()
{
SDL_BlitSurface(screenBuffer, NULL, screen, NULL);
SDL_Flip(screen);
SDL_Flip(screen);
}
void VWB_DrawTile8 (int x, int y, int tile)
{
LatchDrawChar(x,y,tile);
LatchDrawChar(x,y,tile);
}
void VWB_DrawTile8M (int x, int y, int tile)
{
VL_MemToScreen (((byte *)grsegs[STARTTILE8M])+tile*64,8,8,x,y);
VL_MemToScreen (((byte *)grsegs[STARTTILE8M])+tile*64,8,8,x,y);
}
void VWB_DrawPic (int x, int y, int chunknum)
{
int picnum = chunknum - STARTPICS;
unsigned width,height;
int picnum = chunknum - STARTPICS;
unsigned width,height;
x &= ~7;
x &= ~7;
width = pictable[picnum].width;
height = pictable[picnum].height;
width = pictable[picnum].width;
height = pictable[picnum].height;
VL_MemToScreen (grsegs[chunknum],width,height,x,y);
VL_MemToScreen (grsegs[chunknum],width,height,x,y);
}
void VWB_DrawPicScaledCoord (int scx, int scy, int chunknum)
{
int picnum = chunknum - STARTPICS;
unsigned width,height;
int picnum = chunknum - STARTPICS;
unsigned width,height;
width = pictable[picnum].width;
height = pictable[picnum].height;
width = pictable[picnum].width;
height = pictable[picnum].height;
VL_MemToScreenScaledCoord (grsegs[chunknum],width,height,scx,scy);
}
@ -157,7 +157,7 @@ void VWB_DrawPicScaledCoord (int scx, int scy, int chunknum)
void VWB_Bar (int x, int y, int width, int height, int color)
{
VW_Bar (x,y,width,height,color);
VW_Bar (x,y,width,height,color);
}
void VWB_Plot (int x, int y, int color)
@ -171,7 +171,7 @@ void VWB_Plot (int x, int y, int color)
void VWB_Hlin (int x1, int x2, int y, int color)
{
if(scaleFactor == 1)
VW_Hlin(x1,x2,y,color);
VW_Hlin(x1,x2,y,color);
else
VW_Bar(x1, y, x2-x1+1, 1, color);
}
@ -179,7 +179,7 @@ void VWB_Hlin (int x1, int x2, int y, int color)
void VWB_Vlin (int y1, int y2, int x, int color)
{
if(scaleFactor == 1)
VW_Vlin(y1,y2,x,color);
VW_Vlin(y1,y2,x,color);
else
VW_Bar(x, y1, 1, y2-y1+1, color);
}
@ -188,7 +188,7 @@ void VWB_Vlin (int y1, int y2, int x, int color)
/*
=============================================================================
WOLFENSTEIN STUFF
WOLFENSTEIN STUFF
=============================================================================
*/
@ -203,12 +203,12 @@ void VWB_Vlin (int y1, int y2, int x, int color)
void LatchDrawPic (unsigned x, unsigned y, unsigned picnum)
{
VL_LatchToScreen (latchpics[2+picnum-LATCHPICS_LUMP_START], x*8, y);
VL_LatchToScreen (latchpics[2+picnum-LATCHPICS_LUMP_START], x*8, y);
}
void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum)
{
VL_LatchToScreenScaledCoord (latchpics[2+picnum-LATCHPICS_LUMP_START], scx*8, scy);
VL_LatchToScreenScaledCoord (latchpics[2+picnum-LATCHPICS_LUMP_START], scx*8, scy);
}
@ -224,9 +224,9 @@ void LatchDrawPicScaledCoord (unsigned scx, unsigned scy, unsigned picnum)
void LoadLatchMem (void)
{
int i,width,height,start,end;
byte *src;
SDL_Surface *surf;
int i,width,height,start,end;
byte *src;
SDL_Surface *surf;
//
// tile 8s
@ -240,39 +240,39 @@ void LoadLatchMem (void)
}
SDL_SetColors(surf, gamepal, 0, 256);
latchpics[0] = surf;
CA_CacheGrChunk (STARTTILE8);
src = grsegs[STARTTILE8];
latchpics[0] = surf;
CA_CacheGrChunk (STARTTILE8);
src = grsegs[STARTTILE8];
for (i=0;i<NUMTILE8;i++)
{
VL_MemToLatch (src, 8, 8, surf, (i & 7) * 8, (i >> 3) * 8);
src += 64;
}
UNCACHEGRCHUNK (STARTTILE8);
for (i=0;i<NUMTILE8;i++)
{
VL_MemToLatch (src, 8, 8, surf, (i & 7) * 8, (i >> 3) * 8);
src += 64;
}
UNCACHEGRCHUNK (STARTTILE8);
//
// pics
//
start = LATCHPICS_LUMP_START;
end = LATCHPICS_LUMP_END;
start = LATCHPICS_LUMP_START;
end = LATCHPICS_LUMP_END;
for (i=start;i<=end;i++)
{
width = pictable[i-STARTPICS].width;
height = pictable[i-STARTPICS].height;
surf = SDL_CreateRGBSurface(SDL_HWSURFACE, width, height, 8, 0, 0, 0, 0);
for (i=start;i<=end;i++)
{
width = pictable[i-STARTPICS].width;
height = pictable[i-STARTPICS].height;
surf = SDL_CreateRGBSurface(SDL_HWSURFACE, width, height, 8, 0, 0, 0, 0);
if(surf == NULL)
{
Quit("Unable to create surface for picture!");
}
SDL_SetColors(surf, gamepal, 0, 256);
latchpics[2+i-start] = surf;
CA_CacheGrChunk (i);
VL_MemToLatch (grsegs[i], width, height, surf, 0, 0);
UNCACHEGRCHUNK(i);
}
latchpics[2+i-start] = surf;
CA_CacheGrChunk (i);
VL_MemToLatch (grsegs[i], width, height, surf, 0, 0);
UNCACHEGRCHUNK(i);
}
}
//==========================================================================
@ -420,7 +420,7 @@ boolean FizzleFade (SDL_Surface *source, int x1, int y1,
&fullcol, screen->format->BytesPerPixel);
}
if(rndval == 0) // entire sequence has been completed
if(rndval == 0) // entire sequence has been completed
goto finished;
}

62
id_vh.h
View File

@ -1,42 +1,42 @@
// 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 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
#define MAXSHIFTS 1
typedef struct
{
int16_t width,height;
int16_t width,height;
} pictabletype;
typedef struct
{
int16_t height;
int16_t location[256];
int8_t width[256];
int16_t height;
int16_t location[256];
int8_t width[256];
} fontstruct;
//===========================================================================
extern pictabletype *pictable;
extern pictabletype *picmtable;
extern pictabletype *pictable;
extern pictabletype *picmtable;
extern byte fontcolor,backcolor;
extern int fontnumber;
extern int px,py;
extern int fontnumber;
extern int px,py;
#define SETFONTCOLOR(f,b) fontcolor=f;backcolor=b;
@ -46,7 +46,7 @@ extern int px,py;
// regions marked in double buffer
//
void VWB_DrawPropString (const char *string);
void VWB_DrawPropString (const char *string);
void VWB_DrawTile8 (int x, int y, int tile);
void VWB_DrawTile8M (int x, int y, int tile);
@ -72,17 +72,17 @@ void VH_UpdateScreen();
//
#define VW_Shutdown VL_Shutdown
#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_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
void VW_MeasurePropString (const char *string, word *width, word *height);
#define VW_Shutdown VL_Shutdown
#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_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
void VW_MeasurePropString (const char *string, word *width, word *height);
#define LatchDrawChar(x,y,p) VL_LatchToScreen(latchpics[0],((p)&7)*8,((p)>>3)*8*64,8,8,x,y)
#define LatchDrawTile(x,y,p) VL_LatchToScreen(latchpics[1],(p)*64,0,16,16,x,y)
@ -95,5 +95,5 @@ void VH_Startup();
boolean FizzleFade (SDL_Surface *source, int x1, int y1,
unsigned width, unsigned height, unsigned frames, boolean abortable);
#define NUMLATCHPICS 100
extern SDL_Surface *latchpics[NUMLATCHPICS];
#define NUMLATCHPICS 100
extern SDL_Surface *latchpics[NUMLATCHPICS];

174
id_vl.cpp
View File

@ -37,7 +37,7 @@ unsigned curPitch;
unsigned scaleFactor;
boolean screenfaded;
boolean screenfaded;
unsigned bordercolor;
SDL_Color palette1[256], palette2[256];
@ -68,9 +68,9 @@ CASSERT(lengthof(gamepal) == 256)
=======================
*/
void VL_Shutdown (void)
void VL_Shutdown (void)
{
//VL_SetTextMode ();
//VL_SetTextMode ();
}
@ -82,7 +82,7 @@ void VL_Shutdown (void)
=======================
*/
void VL_SetVGAPlaneMode (void)
void VL_SetVGAPlaneMode (void)
{
#ifdef SPEAR
SDL_WM_SetCaption("Spear of Destiny", NULL);
@ -155,9 +155,9 @@ void VL_SetVGAPlaneMode (void)
/*
=============================================================================
PALETTE OPS
PALETTE OPS
To avoid snow, do a WaitVBL BEFORE calling these
To avoid snow, do a WaitVBL BEFORE calling these
=============================================================================
*/
@ -213,7 +213,7 @@ void VL_FillPalette (int red, int green, int blue)
=================
*/
void VL_SetColor (int color, int red, int green, int blue)
void VL_SetColor (int color, int red, int green, int blue)
{
SDL_Color col = { red, green, blue };
curpal[color] = col;
@ -238,7 +238,7 @@ void VL_SetColor (int color, int red, int green, int blue)
=================
*/
void VL_GetColor (int color, int *red, int *green, int *blue)
void VL_GetColor (int color, int *red, int *green, int *blue)
{
SDL_Color *col = &curpal[color];
*red = col->r;
@ -304,49 +304,49 @@ void VL_GetPalette (SDL_Color *palette)
void VL_FadeOut (int start, int end, int red, int green, int blue, int steps)
{
int i,j,orig,delta;
SDL_Color *origptr, *newptr;
int i,j,orig,delta;
SDL_Color *origptr, *newptr;
red = red * 255 / 63;
green = green * 255 / 63;
blue = blue * 255 / 63;
VL_WaitVBL(1);
VL_GetPalette(palette1);
memcpy(palette2, palette1, sizeof(SDL_Color) * 256);
VL_WaitVBL(1);
VL_GetPalette(palette1);
memcpy(palette2, palette1, sizeof(SDL_Color) * 256);
//
// fade through intermediate frames
//
for (i=0;i<steps;i++)
{
origptr = &palette1[start];
newptr = &palette2[start];
for (j=start;j<=end;j++)
{
orig = origptr->r;
delta = red-orig;
newptr->r = orig + delta * i / steps;
orig = origptr->g;
delta = green-orig;
newptr->g = orig + delta * i / steps;
orig = origptr->b;
delta = blue-orig;
newptr->b = orig + delta * i / steps;
origptr++;
newptr++;
}
for (i=0;i<steps;i++)
{
origptr = &palette1[start];
newptr = &palette2[start];
for (j=start;j<=end;j++)
{
orig = origptr->r;
delta = red-orig;
newptr->r = orig + delta * i / steps;
orig = origptr->g;
delta = green-orig;
newptr->g = orig + delta * i / steps;
orig = origptr->b;
delta = blue-orig;
newptr->b = orig + delta * i / steps;
origptr++;
newptr++;
}
if(!usedoublebuffering || screenBits == 8) VL_WaitVBL(1);
VL_SetPalette (palette2, true);
}
if(!usedoublebuffering || screenBits == 8) VL_WaitVBL(1);
VL_SetPalette (palette2, true);
}
//
// final color
//
VL_FillPalette (red,green,blue);
VL_FillPalette (red,green,blue);
screenfaded = true;
screenfaded = true;
}
@ -360,42 +360,42 @@ void VL_FadeOut (int start, int end, int red, int green, int blue, int steps)
void VL_FadeIn (int start, int end, SDL_Color *palette, int steps)
{
int i,j,delta;
int i,j,delta;
VL_WaitVBL(1);
VL_GetPalette(palette1);
memcpy(palette2, palette1, sizeof(SDL_Color) * 256);
VL_WaitVBL(1);
VL_GetPalette(palette1);
memcpy(palette2, palette1, sizeof(SDL_Color) * 256);
//
// fade through intermediate frames
//
for (i=0;i<steps;i++)
{
for (j=start;j<=end;j++)
{
delta = palette[j].r-palette1[j].r;
palette2[j].r = palette1[j].r + delta * i / steps;
delta = palette[j].g-palette1[j].g;
palette2[j].g = palette1[j].g + delta * i / steps;
delta = palette[j].b-palette1[j].b;
palette2[j].b = palette1[j].b + delta * i / steps;
}
for (i=0;i<steps;i++)
{
for (j=start;j<=end;j++)
{
delta = palette[j].r-palette1[j].r;
palette2[j].r = palette1[j].r + delta * i / steps;
delta = palette[j].g-palette1[j].g;
palette2[j].g = palette1[j].g + delta * i / steps;
delta = palette[j].b-palette1[j].b;
palette2[j].b = palette1[j].b + delta * i / steps;
}
if(!usedoublebuffering || screenBits == 8) VL_WaitVBL(1);
VL_SetPalette(palette2, true);
}
if(!usedoublebuffering || screenBits == 8) VL_WaitVBL(1);
VL_SetPalette(palette2, true);
}
//
// final color
//
VL_SetPalette (palette, true);
screenfaded = false;
VL_SetPalette (palette, true);
screenfaded = false;
}
/*
=============================================================================
PIXEL OPS
PIXEL OPS
=============================================================================
*/
@ -433,7 +433,7 @@ void VL_Plot (int x, int y, int color)
&& "VL_Plot: Pixel out of bounds!");
VL_LockSurface(curSurface);
((byte *) curSurface->pixels)[y * curPitch + x] = color;
((byte *) curSurface->pixels)[y * curPitch + x] = color;
VL_UnlockSurface(curSurface);
}
@ -452,9 +452,9 @@ byte VL_GetPixel (int x, int y)
&& "VL_GetPixel: Pixel out of bounds!");
VL_LockSurface(curSurface);
byte col = ((byte *) curSurface->pixels)[y * curPitch + x];
byte col = ((byte *) curSurface->pixels)[y * curPitch + x];
VL_UnlockSurface(curSurface);
return col;
return col;
}
@ -489,19 +489,19 @@ void VL_Hlin (unsigned x, unsigned y, unsigned width, int color)
void VL_Vlin (int x, int y, int height, int color)
{
assert(x >= 0 && (unsigned) x < screenWidth
&& y >= 0 && (unsigned) y + height <= screenHeight
&& "VL_Vlin: Destination rectangle out of bounds!");
assert(x >= 0 && (unsigned) x < screenWidth
&& y >= 0 && (unsigned) y + height <= screenHeight
&& "VL_Vlin: Destination rectangle out of bounds!");
VL_LockSurface(curSurface);
Uint8 *dest = ((byte *) curSurface->pixels) + y * curPitch + x;
VL_LockSurface(curSurface);
Uint8 *dest = ((byte *) curSurface->pixels) + y * curPitch + x;
while (height--)
{
*dest = color;
dest += curPitch;
}
VL_UnlockSurface(curSurface);
while (height--)
{
*dest = color;
dest += curPitch;
}
VL_UnlockSurface(curSurface);
}
@ -515,25 +515,25 @@ void VL_Vlin (int x, int y, int height, int color)
void VL_BarScaledCoord (int scx, int scy, int scwidth, int scheight, int color)
{
assert(scx >= 0 && (unsigned) scx + scwidth <= screenWidth
&& scy >= 0 && (unsigned) scy + scheight <= screenHeight
&& "VL_BarScaledCoord: Destination rectangle out of bounds!");
assert(scx >= 0 && (unsigned) scx + scwidth <= screenWidth
&& scy >= 0 && (unsigned) scy + scheight <= screenHeight
&& "VL_BarScaledCoord: Destination rectangle out of bounds!");
VL_LockSurface(curSurface);
Uint8 *dest = ((byte *) curSurface->pixels) + scy * curPitch + scx;
VL_LockSurface(curSurface);
Uint8 *dest = ((byte *) curSurface->pixels) + scy * curPitch + scx;
while (scheight--)
{
memset(dest, color, scwidth);
dest += curPitch;
}
VL_UnlockSurface(curSurface);
while (scheight--)
{
memset(dest, color, scwidth);
dest += curPitch;
}
VL_UnlockSurface(curSurface);
}
/*
============================================================================
MEMORY OPS
MEMORY OPS
============================================================================
*/
@ -657,11 +657,11 @@ void VL_MemToScreenScaledCoord (byte *source, int origwidth, int origheight, int
void VL_LatchToScreenScaledCoord(SDL_Surface *source, int xsrc, int ysrc,
int width, int height, int scxdest, int scydest)
{
assert(scxdest >= 0 && scxdest + width * scaleFactor <= screenWidth
&& scydest >= 0 && scydest + height * scaleFactor <= screenHeight
&& "VL_LatchToScreenScaledCoord: Destination rectangle out of bounds!");
assert(scxdest >= 0 && scxdest + width * scaleFactor <= screenWidth
&& scydest >= 0 && scydest + height * scaleFactor <= screenHeight
&& "VL_LatchToScreenScaledCoord: Destination rectangle out of bounds!");
if(scaleFactor == 1)
if(scaleFactor == 1)
{
// HACK: If screenBits is not 8 and the screen is faded out, the
// result will be black when using SDL_BlitSurface. The reason

10
id_vl.h
View File

@ -14,8 +14,8 @@ void Quit (const char *error,...);
//===========================================================================
#define CHARWIDTH 2
#define TILEWIDTH 4
#define CHARWIDTH 2
#define TILEWIDTH 4
//===========================================================================
@ -25,8 +25,8 @@ extern boolean fullscreen, usedoublebuffering;
extern unsigned screenWidth, screenHeight, screenBits, screenPitch, bufferPitch, curPitch;
extern unsigned scaleFactor;
extern boolean screenfaded;
extern unsigned bordercolor;
extern boolean screenfaded;
extern unsigned bordercolor;
extern SDL_Color gamepal[256];
@ -107,4 +107,4 @@ void inline VL_LatchToScreen (SDL_Surface *source, int x, int y)
scaleFactor*x,scaleFactor*y);
}
#endif
#endif

16000
signon.cpp

File diff suppressed because it is too large Load Diff

View File

@ -27,8 +27,8 @@
#endif /* main */
/* The standard output files */
#define STDOUT_FILE TEXT("stdout.txt")
#define STDERR_FILE TEXT("stderr.txt")
#define STDOUT_FILE TEXT("stdout.txt")
#define STDERR_FILE TEXT("stderr.txt")
#ifndef NO_STDIO_REDIRECT
static char stdoutPath[MAX_PATH];
@ -38,51 +38,51 @@
/* Parse a command line buffer into arguments */
static int ParseCommandLine(char *cmdline, char **argv)
{
char *bufp;
int argc;
char *bufp;
int argc;
argc = 0;
for ( bufp = cmdline; *bufp; ) {
/* Skip leading whitespace */
while ( isspace(*bufp) ) {
++bufp;
}
/* Skip over argument */
if ( *bufp == '"' ) {
++bufp;
if ( *bufp ) {
if ( argv ) {
argv[argc] = bufp;
}
++argc;
}
/* Skip over word */
while ( *bufp && (*bufp != '"') ) {
++bufp;
}
} else {
if ( *bufp ) {
if ( argv ) {
argv[argc] = bufp;
}
++argc;
}
/* Skip over word */
while ( *bufp && ! isspace(*bufp) ) {
++bufp;
}
}
if ( *bufp ) {
if ( argv ) {
*bufp = '\0';
}
++bufp;
}
}
if ( argv ) {
argv[argc] = NULL;
}
return(argc);
argc = 0;
for ( bufp = cmdline; *bufp; ) {
/* Skip leading whitespace */
while ( isspace(*bufp) ) {
++bufp;
}
/* Skip over argument */
if ( *bufp == '"' ) {
++bufp;
if ( *bufp ) {
if ( argv ) {
argv[argc] = bufp;
}
++argc;
}
/* Skip over word */
while ( *bufp && (*bufp != '"') ) {
++bufp;
}
} else {
if ( *bufp ) {
if ( argv ) {
argv[argc] = bufp;
}
++argc;
}
/* Skip over word */
while ( *bufp && ! isspace(*bufp) ) {
++bufp;
}
}
if ( *bufp ) {
if ( argv ) {
*bufp = '\0';
}
++bufp;
}
}
if ( argv ) {
argv[argc] = NULL;
}
return(argc);
}
/* Show an error message */
@ -90,24 +90,24 @@ static void ShowError(const char *title, const char *message)
{
/* If USE_MESSAGEBOX is defined, you need to link with user32.lib */
#ifdef USE_MESSAGEBOX
MessageBox(NULL, message, title, MB_ICONEXCLAMATION|MB_OK);
MessageBox(NULL, message, title, MB_ICONEXCLAMATION|MB_OK);
#else
fprintf(stderr, "%s: %s\n", title, message);
fprintf(stderr, "%s: %s\n", title, message);
#endif
}
/* Pop up an out of memory message, returns to Windows */
static BOOL OutOfMemory(void)
{
ShowError("Fatal Error", "Out of memory - aborting");
return FALSE;
ShowError("Fatal Error", "Out of memory - aborting");
return FALSE;
}
/* SDL_Quit() shouldn't be used with atexit() directly because
calling conventions may differ... */
static void cleanup(void)
{
SDL_Quit();
SDL_Quit();
}
/* Remove the output files if there was no output written */
@ -115,20 +115,20 @@ static void cleanup_output(void)
{
#if 1
#ifndef NO_STDIO_REDIRECT
FILE *file;
FILE *file;
#endif
#endif
/* Flush the output in case anything is queued */
fclose(stdout);
fclose(stderr);
/* Flush the output in case anything is queued */
fclose(stdout);
fclose(stderr);
#if 1
#ifndef NO_STDIO_REDIRECT
/* See if the files have any output in them */
if ( stdoutPath[0] ) {
file = fopen(stdoutPath, TEXT("r"));
if ( file ) {
/* See if the files have any output in them */
if ( stdoutPath[0] ) {
file = fopen(stdoutPath, TEXT("r"));
if ( file ) {
char buf[16384];
size_t readbytes = fread(buf, 1, 16383, file);
fclose(file);
@ -140,11 +140,11 @@ static void cleanup_output(void)
}
else
remove(stdoutPath); // remove empty file
}
}
if ( stderrPath[0] ) {
file = fopen(stderrPath, TEXT("rb"));
if ( file ) {
}
}
if ( stderrPath[0] ) {
file = fopen(stderrPath, TEXT("rb"));
if ( file ) {
char buf[16384];
size_t readbytes = fread(buf, 1, 16383, file);
fclose(file);
@ -156,8 +156,8 @@ static void cleanup_output(void)
}
else
remove(stderrPath); // remove empty file
}
}
}
}
#endif
#endif
}
@ -165,145 +165,145 @@ static void cleanup_output(void)
/* This is where execution begins [console apps] */
int console_main(int argc, char *argv[])
{
size_t n;
char *bufp, *appname;
int status;
size_t n;
char *bufp, *appname;
int status;
/* Get the class name from argv[0] */
appname = argv[0];
if ( (bufp=SDL_strrchr(argv[0], '\\')) != NULL ) {
appname = bufp+1;
} else
if ( (bufp=SDL_strrchr(argv[0], '/')) != NULL ) {
appname = bufp+1;
}
/* Get the class name from argv[0] */
appname = argv[0];
if ( (bufp=SDL_strrchr(argv[0], '\\')) != NULL ) {
appname = bufp+1;
} else
if ( (bufp=SDL_strrchr(argv[0], '/')) != NULL ) {
appname = bufp+1;
}
if ( (bufp=SDL_strrchr(appname, '.')) == NULL )
n = SDL_strlen(appname);
else
n = (bufp-appname);
if ( (bufp=SDL_strrchr(appname, '.')) == NULL )
n = SDL_strlen(appname);
else
n = (bufp-appname);
bufp = SDL_stack_alloc(char, n+1);
if ( bufp == NULL ) {
return OutOfMemory();
}
SDL_strlcpy(bufp, appname, n+1);
appname = bufp;
bufp = SDL_stack_alloc(char, n+1);
if ( bufp == NULL ) {
return OutOfMemory();
}
SDL_strlcpy(bufp, appname, n+1);
appname = bufp;
/* Load SDL dynamic link library */
if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) {
ShowError("WinMain() error", SDL_GetError());
return(FALSE);
}
atexit(cleanup_output);
atexit(cleanup);
/* Load SDL dynamic link library */
if ( SDL_Init(SDL_INIT_NOPARACHUTE) < 0 ) {
ShowError("WinMain() error", SDL_GetError());
return(FALSE);
}
atexit(cleanup_output);
atexit(cleanup);
/* Sam:
We still need to pass in the application handle so that
DirectInput will initialize properly when SDL_RegisterApp()
is called later in the video initialization.
*/
SDL_SetModuleHandle(GetModuleHandle(NULL));
/* Sam:
We still need to pass in the application handle so that
DirectInput will initialize properly when SDL_RegisterApp()
is called later in the video initialization.
*/
SDL_SetModuleHandle(GetModuleHandle(NULL));
/* Run the application main() code */
status = SDL_main(argc, argv);
/* Run the application main() code */
status = SDL_main(argc, argv);
/* Exit cleanly, calling atexit() functions */
exit(status);
/* Exit cleanly, calling atexit() functions */
exit(status);
/* Hush little compiler, don't you cry... */
return 0;
/* Hush little compiler, don't you cry... */
return 0;
}
/* This is where execution begins [windowed apps] */
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{
HINSTANCE handle;
char **argv;
int argc;
char *cmdline;
char *bufp;
size_t nLen;
HINSTANCE handle;
char **argv;
int argc;
char *cmdline;
char *bufp;
size_t nLen;
#ifndef NO_STDIO_REDIRECT
DWORD pathlen;
char path[MAX_PATH];
FILE *newfp;
DWORD pathlen;
char path[MAX_PATH];
FILE *newfp;
#endif
/* Start up DDHELP.EXE before opening any files, so DDHELP doesn't
keep them open. This is a hack.. hopefully it will be fixed
someday. DDHELP.EXE starts up the first time DDRAW.DLL is loaded.
*/
handle = LoadLibrary(TEXT("DDRAW.DLL"));
if ( handle != NULL ) {
FreeLibrary(handle);
}
/* Start up DDHELP.EXE before opening any files, so DDHELP doesn't
keep them open. This is a hack.. hopefully it will be fixed
someday. DDHELP.EXE starts up the first time DDRAW.DLL is loaded.
*/
handle = LoadLibrary(TEXT("DDRAW.DLL"));
if ( handle != NULL ) {
FreeLibrary(handle);
}
#ifndef NO_STDIO_REDIRECT
pathlen = GetModuleFileName(NULL, path, SDL_arraysize(path));
while ( pathlen > 0 && path[pathlen] != '\\' ) {
--pathlen;
}
path[pathlen] = '\0';
pathlen = GetModuleFileName(NULL, path, SDL_arraysize(path));
while ( pathlen > 0 && path[pathlen] != '\\' ) {
--pathlen;
}
path[pathlen] = '\0';
SDL_strlcpy( stdoutPath, path, SDL_arraysize(stdoutPath) );
SDL_strlcat( stdoutPath, DIR_SEPERATOR STDOUT_FILE, SDL_arraysize(stdoutPath) );
SDL_strlcpy( stdoutPath, path, SDL_arraysize(stdoutPath) );
SDL_strlcat( stdoutPath, DIR_SEPERATOR STDOUT_FILE, SDL_arraysize(stdoutPath) );
/* Redirect standard input and standard output */
newfp = freopen(stdoutPath, TEXT("w"), stdout);
/* Redirect standard input and standard output */
newfp = freopen(stdoutPath, TEXT("w"), stdout);
if ( newfp == NULL ) { /* This happens on NT */
if ( newfp == NULL ) { /* This happens on NT */
#if !defined(stdout)
stdout = fopen(stdoutPath, TEXT("w"));
stdout = fopen(stdoutPath, TEXT("w"));
#else
newfp = fopen(stdoutPath, TEXT("w"));
if ( newfp ) {
*stdout = *newfp;
}
newfp = fopen(stdoutPath, TEXT("w"));
if ( newfp ) {
*stdout = *newfp;
}
#endif
}
}
SDL_strlcpy( stderrPath, path, SDL_arraysize(stderrPath) );
SDL_strlcat( stderrPath, DIR_SEPERATOR STDERR_FILE, SDL_arraysize(stderrPath) );
SDL_strlcpy( stderrPath, path, SDL_arraysize(stderrPath) );
SDL_strlcat( stderrPath, DIR_SEPERATOR STDERR_FILE, SDL_arraysize(stderrPath) );
newfp = freopen(stderrPath, TEXT("w"), stderr);
if ( newfp == NULL ) { /* This happens on NT */
newfp = freopen(stderrPath, TEXT("w"), stderr);
if ( newfp == NULL ) { /* This happens on NT */
#if !defined(stderr)
stderr = fopen(stderrPath, TEXT("w"));
stderr = fopen(stderrPath, TEXT("w"));
#else
newfp = fopen(stderrPath, TEXT("w"));
if ( newfp ) {
*stderr = *newfp;
}
newfp = fopen(stderrPath, TEXT("w"));
if ( newfp ) {
*stderr = *newfp;
}
#endif
}
}
setvbuf(stdout, NULL, _IOLBF, BUFSIZ); /* Line buffered */
setbuf(stderr, NULL); /* No buffering */
setvbuf(stdout, NULL, _IOLBF, BUFSIZ); /* Line buffered */
setbuf(stderr, NULL); /* No buffering */
#endif /* !NO_STDIO_REDIRECT */
/* Grab the command line */
bufp = GetCommandLine();
nLen = SDL_strlen(bufp)+1;
cmdline = SDL_stack_alloc(char, nLen);
if ( cmdline == NULL ) {
return OutOfMemory();
}
SDL_strlcpy(cmdline, bufp, nLen);
/* Grab the command line */
bufp = GetCommandLine();
nLen = SDL_strlen(bufp)+1;
cmdline = SDL_stack_alloc(char, nLen);
if ( cmdline == NULL ) {
return OutOfMemory();
}
SDL_strlcpy(cmdline, bufp, nLen);
/* Parse it into argv and argc */
argc = ParseCommandLine(cmdline, NULL);
argv = SDL_stack_alloc(char*, argc+1);
if ( argv == NULL ) {
return OutOfMemory();
}
ParseCommandLine(cmdline, argv);
/* Parse it into argv and argc */
argc = ParseCommandLine(cmdline, NULL);
argv = SDL_stack_alloc(char*, argc+1);
if ( argv == NULL ) {
return OutOfMemory();
}
ParseCommandLine(cmdline, argv);
/* Run the main program (after a little SDL initialization) */
console_main(argc, argv);
/* Run the main program (after a little SDL initialization) */
console_main(argc, argv);
/* Hush little compiler, don't you cry... */
return 0;
/* Hush little compiler, don't you cry... */
return 0;
}
#endif // _WIN32

View File

@ -1,9 +1,9 @@
// WL_DEBUG.C
#ifdef _WIN32
#include <io.h>
#include <io.h>
#else
#include <unistd.h>
#include <unistd.h>
#endif
#include "wl_def.h"

View File

@ -15,9 +15,9 @@
#include <wtypes.h>
#endif
#if !defined(_WIN32)
# include <stdint.h>
# include <string.h>
# include <stdarg.h>
# include <stdint.h>
# include <string.h>
# include <stdarg.h>
#endif
#include <SDL/SDL.h>
@ -27,7 +27,7 @@
#endif
#if !defined O_BINARY
# define O_BINARY 0
# define O_BINARY 0
#endif
#pragma pack(1)
@ -1328,7 +1328,7 @@ extern void EndText(void);
static inline fixed FixedMul(fixed a, fixed b)
{
return (fixed)(((int64_t)a * b + 0x8000) >> 16);
return (fixed)(((int64_t)a * b + 0x8000) >> 16);
}
#ifdef PLAYDEMOLIKEORIGINAL
@ -1355,14 +1355,14 @@ static inline fixed FixedMul(fixed a, fixed b)
#else
static inline char* itoa(int value, char* string, int radix)
{
sprintf(string, "%d", value);
return string;
sprintf(string, "%d", value);
return string;
}
static inline char* ltoa(long value, char* string, int radix)
{
sprintf(string, "%ld", value);
return string;
sprintf(string, "%ld", value);
return string;
}
#endif

View File

@ -1206,7 +1206,7 @@ vertentry:
{
if(pwalldir==di_west || pwalldir==di_east)
{
int32_t yintbuf;
int32_t yintbuf;
int pwallposnorm;
int pwallposinv;
if(pwalldir==di_west)

View File

@ -774,36 +774,36 @@ void DrawPlayBorderSides(void)
{
if(viewsize == 21) return;
const int sw = screenWidth;
const int sh = screenHeight;
const int vw = viewwidth;
const int vh = viewheight;
const int px = scaleFactor; // size of one "pixel"
const int sw = screenWidth;
const int sh = screenHeight;
const int vw = viewwidth;
const int vh = viewheight;
const int px = scaleFactor; // size of one "pixel"
const int h = sh - px * STATUSLINES;
const int xl = sw / 2 - vw / 2;
const int yl = (h - vh) / 2;
const int h = sh - px * STATUSLINES;
const int xl = sw / 2 - vw / 2;
const int yl = (h - vh) / 2;
if(xl != 0)
{
VWB_BarScaledCoord(0, 0, xl - px, h, bordercol); // left side
VWB_BarScaledCoord(xl + vw + px, 0, xl - px * 2, h, bordercol); // right side
VWB_BarScaledCoord(0, 0, xl - px, h, bordercol); // left side
VWB_BarScaledCoord(xl + vw + px, 0, xl - px * 2, h, bordercol); // right side
}
if(yl != 0)
{
VWB_BarScaledCoord(0, 0, sw, yl - px, bordercol); // upper side
VWB_BarScaledCoord(0, yl + vh + px, sw, yl - px, bordercol); // lower side
VWB_BarScaledCoord(0, 0, sw, yl - px, bordercol); // upper side
VWB_BarScaledCoord(0, yl + vh + px, sw, yl - px, bordercol); // lower side
}
if(xl != 0)
{
// Paint game view border lines
VWB_BarScaledCoord(xl - px, yl - px, vw + px, px, 0); // upper border
VWB_BarScaledCoord(xl, yl + vh, vw + px, px, bordercol - 2); // lower border
VWB_BarScaledCoord(xl - px, yl - px, px, vh + px, 0); // left border
VWB_BarScaledCoord(xl + vw, yl - px, px, vh + px * 2, bordercol - 2); // right border
VWB_BarScaledCoord(xl - px, yl + vh, px, px, bordercol - 3); // lower left highlight
VWB_BarScaledCoord(xl - px, yl - px, vw + px, px, 0); // upper border
VWB_BarScaledCoord(xl, yl + vh, vw + px, px, bordercol - 2); // lower border
VWB_BarScaledCoord(xl - px, yl - px, px, vh + px, 0); // left border
VWB_BarScaledCoord(xl + vw, yl - px, px, vh + px * 2, bordercol - 2); // right border
VWB_BarScaledCoord(xl - px, yl + vh, px, px, bordercol - 3); // lower left highlight
}
else
{
@ -855,7 +855,7 @@ void DrawStatusBorder (byte color)
void DrawPlayBorder (void)
{
const int px = scaleFactor; // size of one "pixel"
const int px = scaleFactor; // size of one "pixel"
if (bordercol != VIEWCOLOR)
DrawStatusBorder(bordercol);
@ -947,7 +947,7 @@ void ShowActStatus()
{
// Draw status bar without borders
byte *source = grsegs[STATUSBARPIC];
int picnum = STATUSBARPIC - STARTPICS;
int picnum = STATUSBARPIC - STARTPICS;
int width = pictable[picnum].width;
int height = pictable[picnum].height;
int destx = (screenWidth-scaleFactor*320)/2 + 9 * scaleFactor;