Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wolf3d
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
wolf3d
Commits
16a98a20
Commit
16a98a20
authored
May 22, 2000
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added cheat codes, fixed things for different resolutions
parent
d8c795c6
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
192 additions
and
27 deletions
+192
-27
Main.c
macsrc/Main.c
+10
-4
Makefile
macsrc/Makefile
+2
-1
TODO
macsrc/TODO
+6
-4
WolfMain.c
macsrc/WolfMain.c
+5
-5
res.c
macsrc/res.c
+3
-4
stub.c
macsrc/stub.c
+2
-0
vi_svga.c
macsrc/vi_svga.c
+155
-7
wolfdef.h
macsrc/wolfdef.h
+9
-2
No files found.
macsrc/Main.c
View file @
16a98a20
...
...
@@ -50,15 +50,16 @@ void RunAutoMap(void)
}
else
{
vy
=
0
;
}
oldjoy
=
joystick1
;
do
{
ClearTheScreen
(
BLACK
);
DrawAutomap
(
vx
,
vy
);
do
{
oldjoy
=
joystick1
;
ReadSystemJoystick
();
}
while
(
joystick1
==
oldjoy
);
oldjoy
&=
joystick1
;
newjoy
=
joystick1
^
oldjoy
;
if
(
newjoy
&
(
JOYPAD_START
|
JOYPAD_SELECT
|
JOYPAD_A
|
JOYPAD_B
|
JOYPAD_X
|
JOYPAD_Y
))
{
playstate
=
EX_STILLPLAYING
;
}
...
...
@@ -77,9 +78,10 @@ void RunAutoMap(void)
}
while
(
playstate
==
EX_AUTOMAP
);
playstate
=
EX_STILLPLAYING
;
/* let the player scroll around until the start button is pressed again */
KillSmallFont
();
/* Release the tiny font */
RedrawStatusBar
();
ReadSystemJoystick
();
mousex
=
0
;
mousey
=
0
;
...
...
@@ -108,7 +110,7 @@ void StartGame(void)
**********************************/
Boolean
TitleScreen
(
void
)
Boolean
TitleScreen
(
)
{
Word
RetVal
;
/* Value to return */
LongWord
PackLen
;
...
...
@@ -129,9 +131,12 @@ Boolean TitleScreen (void)
StartSong
(
SongListPtr
[
0
]);
FadeTo
(
rTitlePal
);
/* Fade in the picture */
BlastScreen
();
RetVal
=
WaitTicksEvent
(
0
);
/* Wait for event */
playstate
=
EX_COMPLETED
;
return
TRUE
;
/* Return True if canceled */
return
TRUE
;
}
/**********************************
...
...
@@ -169,6 +174,7 @@ DoGame:
StartGame
();
/* Play the game */
}
}
/* TODO: demos or whatever here */
}
return
0
;
...
...
macsrc/Makefile
View file @
16a98a20
CC
=
gcc
#CFLAGS = -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
#CFLAGS = -g -Wall -O6 -fomit-frame-pointer -ffast-math -funroll-loops -mpentiumpro -mcpu=pentiumpro -march=pentiumpro
#CFLAGS = -g -Wall
#CFLAGS = -g -DNOVGA
CFLAGS
=
-g
#CFLAGS = -Os
#CFLAGS = -Os
-g
#CFLAGS = -g -Wall -I/home/relnev/cvs/oal/include
OBJS
=
Data.o Doors.o EnMove.o EnThink.o Intro.o Level.o
\
...
...
macsrc/TODO
View file @
16a98a20
* remove NOVGA when other ports are added. NOVGA is a hack for using
ElectricFence (since svgalib doesn't work too well with it)
* fi
nish defining all the keys
* fi
x return value of DoEvents
* when you die, where do all the sprites go?
* drawing seems like its imprecise, stationary sprites move back and forth,
and walls 'swim' when you move around
and walls 'swim' when you move around, or sprites pop into different sizes
when are far enough and get closer/farther away
* Word is 16bit damnit, wonder why in the MAC version its 32bits?!
* Automap movement is too fast
* How about adding red/white shifts (from PC wolf3d)?
\ No newline at end of file
* How about adding red/white shifts (from PC wolf3d)?
* it crashes somewhere, no reason why...
* Pause key
macsrc/WolfMain.c
View file @
16a98a20
...
...
@@ -439,12 +439,12 @@ skipbrief:
}
else
if
(
playstate
!=
EX_WARPED
)
{
nextmap
=
MapListPtr
->
InfoArray
[
gamestate
.
mapon
].
NextLevel
;
/* Normal warp? */
}
/* If warped, then nextmap is preset */
if
(
nextmap
==
0xffff
)
{
/* Last level? */
VictoryScale
();
/* You win!! */
ReleaseMap
();
/* Unload the map */
Intermission
();
/* Display the wrapup... */
if
(
nextmap
==
0xffff
)
{
/* Last level? */
VictoryScale
();
/* You win!! */
ReleaseMap
();
/* Unload the map */
Intermission
();
/* Display the wrapup... */
ShareWareEnd
();
/* End the game for the shareware version */
/* VictoryIntermission();
/* Wrapup for victory! */
/* VictoryIntermission(); */
/* Wrapup for victory! */
return
;
}
ReleaseMap
();
/* Unload the game map */
...
...
macsrc/res.c
View file @
16a98a20
...
...
@@ -43,8 +43,7 @@ int InitResources(char *name)
for
(
i
=
0
;
i
<
typecount
;
i
++
)
{
int
type
;
int
off
,
bak
,
bak2
,
data
,
count
,
x
,
c
,
z
;
int
d1
,
d2
,
d3
,
d4
;
int
off
,
bak
,
bak2
,
data
,
count
,
x
;
type
=
(
fgetc
(
fp
)
<<
24
)
|
(
fgetc
(
fp
)
<<
16
)
|
(
fgetc
(
fp
)
<<
8
)
|
(
fgetc
(
fp
)
<<
0
);
...
...
@@ -103,8 +102,8 @@ void *LoadAResource2(Word RezNum, LongWord Type)
c
=
c
->
next
;
}
fprintf
(
stderr
,
"ERROR: %d/%d was not found!
\n
"
,
Type
,
RezNum
);
AllocSomeMem
(
666666666
);
fprintf
(
stderr
,
"ERROR: %
l
d/%d was not found!
\n
"
,
Type
,
RezNum
);
AllocSomeMem
(
666666666
);
/* TODO: hack! */
exit
(
EXIT_FAILURE
);
}
...
...
macsrc/stub.c
View file @
16a98a20
...
...
@@ -253,6 +253,8 @@ Word ChooseGameDiff(void)
/* 0 = easy, 1 = normal, 2 = hard, 3 = death incarnate */
difficulty
=
1
;
SetAPalette
(
rGamePal
);
return
1
;
}
void
FinishLoadGame
(
void
)
...
...
macsrc/vi_svga.c
View file @
16a98a20
...
...
@@ -95,7 +95,10 @@ void BlastScreen2(Rect *BlastRect)
BlastScreen
();
}
static
int
w
,
h
,
v
;
int
VidWidth
,
VidHeight
,
ViewHeight
;
#define w VidWidth
#define h VidHeight
#define v ViewHeight
void
BlastScreen
()
{
...
...
@@ -117,14 +120,46 @@ Word VidVs[] = {160,320,320,400};
Word
VidPics
[]
=
{
rFaceShapes
,
rFace512
,
rFace640
,
rFace640
};
Word
VidSize
=
-
1
;
Word
ScaleX
(
Word
x
)
{
switch
(
VidSize
)
{
case
1
:
return
x
*
8
/
5
;
case
2
:
case
3
:
return
x
*
2
;
}
return
x
;
}
Word
ScaleY
(
Word
y
)
{
switch
(
VidSize
)
{
case
1
:
y
=
(
y
*
8
/
5
)
+
64
;
if
(
y
==
217
)
y
++
;
return
y
;
case
2
:
return
y
*
2
;
case
3
:
return
y
*
2
+
80
;
}
return
y
;
}
Word
NewGameWindow
(
Word
NewVidSize
)
{
LongWord
*
LongPtr
;
Byte
*
DestPtr
;
int
i
;
printf
(
"Called: %d
\n
"
,
NewVidSize
);
if
(
NewVidSize
==
VidSize
)
return
VidSize
;
printf
(
"Setting Size: %d (from %d)
\n
"
,
NewVidSize
,
VidSize
);
if
(
NewVidSize
<
4
)
{
w
=
VidXs
[
NewVidSize
];
...
...
@@ -153,6 +188,9 @@ Word NewGameWindow(Word NewVidSize)
LongPtr
=
(
LongWord
*
)
LoadAResource
(
VidPics
[
NewVidSize
]);
if
(
GameShapes
)
FreeSomeMem
(
GameShapes
);
GameShapes
=
(
Byte
**
)
AllocSomeMem
(
lMSB
(
LongPtr
[
0
]));
DLZSS
((
Byte
*
)
GameShapes
,(
Byte
*
)
&
LongPtr
[
1
],
lMSB
(
LongPtr
[
0
]));
ReleaseAResource
(
rFaceShapes
);
...
...
@@ -290,22 +328,97 @@ void ReleaseScalers()
{
}
void
FlushKeys
(
void
)
/* Keyboard Hack */
static
int
RSJ
;
static
int
keys
[
128
];
void
FlushKeys
()
{
/* TODO: read all keys in keyboard buffer */
while
(
keyboard_update
())
;
memset
(
keys
,
0
,
sizeof
(
keys
));
}
static
int
RSJ
;
#define SC(x) SCANCODE_##x
static
int
keys
[
128
];
struct
{
int
code
[
13
];
int
flag
;
}
CheatCodes
[]
=
{
{
{
SC
(
X
),
SC
(
U
),
SC
(
S
),
SC
(
C
),
SC
(
N
),
SC
(
I
),
SC
(
E
),
SC
(
L
),
SC
(
P
),
SC
(
P
),
SC
(
A
)
},
0
},
/* "XUSCNIELPPA" */
{
{
SC
(
I
),
SC
(
D
),
SC
(
D
),
SC
(
Q
),
SC
(
D
)
},
0
},
/* "IDDQD" */
{
{
SC
(
B
),
SC
(
U
),
SC
(
R
),
SC
(
G
),
SC
(
E
),
SC
(
R
)
},
0
},
/* "BURGER" */
{
{
SC
(
W
),
SC
(
O
),
SC
(
W
),
SC
(
Z
),
SC
(
E
),
SC
(
R
),
SC
(
S
)
},
0
},
/* "WOWZERS" */
{
{
SC
(
L
),
SC
(
E
),
SC
(
D
),
SC
(
O
),
SC
(
U
),
SC
(
X
)
},
0
},
/* "LEDOUX" */
{
{
SC
(
S
),
SC
(
E
),
SC
(
G
),
SC
(
E
),
SC
(
R
)
},
0
},
/* "SEGER" */
{
{
SC
(
M
),
SC
(
C
),
SC
(
C
),
SC
(
A
),
SC
(
L
),
SC
(
L
)
},
0
},
/* "MCCALL" */
{
{
SC
(
A
),
SC
(
P
),
SC
(
P
),
SC
(
L
),
SC
(
E
),
SC
(
I
),
SC
(
I
),
SC
(
G
),
SC
(
S
)
}
},
0
/* "APPLEIIGS" */
};
const
int
CheatCount
=
sizeof
(
CheatCodes
)
/
sizeof
(
CheatCodes
[
0
]);
int
CheatIndex
;
void
keyboard_handler
(
int
key
,
int
press
)
{
if
(
key
==
SCANCODE_Q
)
Quit
(
"blah"
);
int
i
;
if
(
key
==
SCANCODE_ESCAPE
)
Quit
(
0
);
if
(
RSJ
)
{
keys
[
key
]
=
press
;
if
(
press
==
0
)
{
for
(
i
=
0
;
i
<
CheatCount
;
i
++
)
{
if
(
CheatCodes
[
i
].
code
[
CheatIndex
]
==
key
)
{
CheatIndex
++
;
if
(
CheatCodes
[
i
].
code
[
CheatIndex
]
==
0
)
{
PlaySound
(
SND_BONUS
);
switch
(
i
)
{
case
0
:
case
4
:
GiveKey
(
0
);
GiveKey
(
1
);
gamestate
.
godmode
=
TRUE
;
break
;
case
1
:
gamestate
.
godmode
^=
TRUE
;
break
;
case
2
:
gamestate
.
machinegun
=
TRUE
;
gamestate
.
chaingun
=
TRUE
;
gamestate
.
flamethrower
=
TRUE
;
gamestate
.
missile
=
TRUE
;
GiveAmmo
(
gamestate
.
maxammo
);
GiveGas
(
99
);
GiveMissile
(
99
);
break
;
case
3
:
gamestate
.
maxammo
=
999
;
GiveAmmo
(
999
);
break
;
case
5
:
GiveKey
(
0
);
GiveKey
(
1
);
break
;
case
6
:
playstate
=
EX_WARPED
;
nextmap
=
gamestate
.
mapon
+
1
;
if
(
MapListPtr
->
MaxMap
<=
nextmap
)
nextmap
=
0
;
break
;
case
7
:
ShowPush
^=
TRUE
;
break
;
}
CheatIndex
=
0
;
}
break
;
}
}
if
(
i
==
CheatCount
)
CheatIndex
=
0
;
}
joystick1
=
0
;
if
(
press
==
0
)
{
...
...
@@ -345,6 +458,23 @@ void keyboard_handler(int key, int press)
}
}
if
(
keys
[
SCANCODE_CURSORUPLEFT
])
joystick1
|=
(
JOYPAD_UP
|
JOYPAD_LFT
);
if
(
keys
[
SCANCODE_CURSORUP
])
joystick1
|=
JOYPAD_UP
;
if
(
keys
[
SCANCODE_CURSORUPRIGHT
])
joystick1
|=
(
JOYPAD_UP
|
JOYPAD_RGT
);
if
(
keys
[
SCANCODE_CURSORRIGHT
])
joystick1
|=
JOYPAD_RGT
;
if
(
keys
[
SCANCODE_CURSORDOWNRIGHT
])
joystick1
|=
(
JOYPAD_DN
|
JOYPAD_RGT
);
if
(
keys
[
SCANCODE_CURSORDOWN
])
joystick1
|=
JOYPAD_DN
;
if
(
keys
[
SCANCODE_CURSORDOWNLEFT
])
joystick1
|=
(
JOYPAD_DN
|
JOYPAD_LFT
);
if
(
keys
[
SCANCODE_CURSORLEFT
])
joystick1
|=
JOYPAD_LFT
;
if
(
keys
[
SCANCODE_CURSORBLOCKLEFT
])
joystick1
|=
JOYPAD_LFT
;
if
(
keys
[
SCANCODE_CURSORBLOCKRIGHT
])
...
...
@@ -353,10 +483,28 @@ void keyboard_handler(int key, int press)
joystick1
|=
JOYPAD_UP
;
if
(
keys
[
SCANCODE_CURSORBLOCKDOWN
])
joystick1
|=
JOYPAD_DN
;
if
(
keys
[
SCANCODE_KEYPADENTER
])
joystick1
|=
JOYPAD_A
;
if
(
keys
[
SCANCODE_ENTER
])
joystick1
|=
JOYPAD_A
;
if
(
keys
[
SCANCODE_SPACE
])
joystick1
|=
JOYPAD_A
;
if
(
keys
[
SCANCODE_LEFTALT
])
joystick1
|=
JOYPAD_TL
;
if
(
keys
[
SCANCODE_RIGHTALT
])
joystick1
|=
JOYPAD_TR
;
if
(
keys
[
SCANCODE_LEFTCONTROL
])
joystick1
|=
JOYPAD_B
;
if
(
keys
[
SCANCODE_RIGHTCONTROL
])
joystick1
|=
JOYPAD_B
;
if
(
keys
[
SCANCODE_LEFTSHIFT
])
joystick1
|=
(
JOYPAD_X
|
JOYPAD_Y
);
if
(
keys
[
SCANCODE_RIGHTSHIFT
])
joystick1
|=
(
JOYPAD_X
|
JOYPAD_Y
);
}
}
...
...
macsrc/wolfdef.h
View file @
16a98a20
...
...
@@ -73,11 +73,18 @@ typedef unsigned short ufixed_t; /* 8.8 unsigned fixed point number */
#define ANGLE90 0x4000
/* Use a 0x10000 angle range */
#define ANGLE180 0x8000
/* Use a 0x10000 angle range */
#if 0
#define SCREENWIDTH 320 /* Size of the offscreen buffer */
#define SCREENHEIGHT 200 /* Height of the offscreen buffer */
#define VIEWHEIGHT 160 /* Height of the viewing area */
#define ScaleX(x) x
/* Scale factor for 320 mode points projected to SCREEN */
#define ScaleY(y) y
#endif
#define SCREENWIDTH VidWidth
#define SCREENHEIGHT VidHeight
#define VIEWHEIGHT ViewHeight
extern
int
VidWidth
,
VidHeight
,
ViewHeight
;
Word
ScaleX
(
Word
x
);
/* Scale factor for 320 mode points projected to SCREEN */
Word
ScaleY
(
Word
y
);
#define CENTERY (VIEWHEIGHT/2)
/* Center of the viewing area */
#define CENTERX (SCREENWIDTH/2)
/* Center of the viewing area */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment