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
4007cb34
Commit
4007cb34
authored
May 19, 2000
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work so far (need to add keyboard and sprite/wall drawing)
parent
67a3124e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
251 additions
and
47 deletions
+251
-47
Burger.c
macsrc/Burger.c
+23
-11
Intro.c
macsrc/Intro.c
+1
-1
Level.c
macsrc/Level.c
+1
-1
RefBsp.c
macsrc/RefBsp.c
+1
-1
res.c
macsrc/res.c
+1
-0
stub.c
macsrc/stub.c
+81
-30
vi_svga.c
macsrc/vi_svga.c
+142
-0
wolfdef.h
macsrc/wolfdef.h
+1
-3
No files found.
macsrc/Burger.c
View file @
4007cb34
...
...
@@ -135,10 +135,12 @@ void DrawShape(Word x,Word y,void *ShapePtr)
Word
Width2
;
ShapePtr3
=
ShapePtr
;
Width
=
ShapePtr3
[
0
]
;
/* 16 bit width */
Height
=
ShapePtr3
[
1
]
;
/* 16 bit height */
Width
=
sMSB
(
ShapePtr3
[
0
])
;
/* 16 bit width */
Height
=
sMSB
(
ShapePtr3
[
1
])
;
/* 16 bit height */
ShapePtr2
=
(
unsigned
char
*
)
&
ShapePtr3
[
2
];
ScreenPtr
=
(
unsigned
char
*
)
&
VideoPointer
[
YTable
[
y
]
+
x
];
do
{
Width2
=
Width
;
Screenad
=
ScreenPtr
;
...
...
@@ -166,8 +168,9 @@ void DrawMShape(Word x,Word y,void *ShapePtr)
Word
Width2
;
ShapePtr2
=
ShapePtr
;
Width
=
ShapePtr2
[
1
];
Width
=
ShapePtr2
[
1
];
Height
=
ShapePtr2
[
3
];
ShapePtr2
+=
4
;
MaskPtr
=
&
ShapePtr2
[
Width
*
Height
];
ScreenPtr
=
(
unsigned
char
*
)
&
VideoPointer
[
YTable
[
y
]
+
x
];
...
...
@@ -192,8 +195,8 @@ void DrawXMShape(Word x,Word y,void *ShapePtr)
{
unsigned
short
*
ShapePtr2
;
ShapePtr2
=
ShapePtr
;
x
+=
ShapePtr2
[
0
]
;
y
+=
ShapePtr2
[
1
]
;
x
+=
sMSB
(
ShapePtr2
[
0
])
;
y
+=
sMSB
(
ShapePtr2
[
1
])
;
DrawMShape
(
x
,
y
,
&
ShapePtr2
[
2
]);
}
...
...
@@ -215,8 +218,8 @@ void EraseMBShape(Word x,Word y, void *ShapePtr, void *BackPtr)
Word
Width2
;
MaskPtr
=
ShapePtr
;
/* Get the pointer to the mask */
Width
=
MaskPtr
[
1
]
;
/* Get the width of the shape */
Height
=
MaskPtr
[
3
]
;
/* Get the height of the shape */
Width
=
sMSB
(
MaskPtr
[
1
])
;
/* Get the width of the shape */
Height
=
sMSB
(
MaskPtr
[
3
])
;
/* Get the height of the shape */
MaskPtr
=
&
MaskPtr
[(
Width
*
Height
)
+
4
];
/* Index to the mask */
/* Point to the screen */
ScreenPtr
=
(
unsigned
char
*
)
&
VideoPointer
[
YTable
[
y
]
+
x
];
...
...
@@ -255,8 +258,8 @@ Word TestMShape(Word x,Word y,void *ShapePtr)
Word
Width2
;
ShapePtr2
=
ShapePtr
;
Width
=
ShapePtr2
[
0
]
;
Height
=
ShapePtr2
[
1
]
;
Width
=
sMSB
(
ShapePtr2
[
0
])
;
Height
=
sMSB
(
ShapePtr2
[
1
])
;
ShapePtr2
+=
2
;
MaskPtr
=
&
ShapePtr2
[
Width
*
Height
];
ScreenPtr
=
(
unsigned
char
*
)
&
VideoPointer
[
YTable
[
y
]
+
x
];
...
...
@@ -295,8 +298,8 @@ Word TestMBShape(Word x,Word y,void *ShapePtr,void *BackPtr)
Word
Width2
;
MaskPtr
=
ShapePtr
;
/* Get the pointer to the mask */
Width
=
MaskPtr
[
0
]
;
/* Get the width of the shape */
Height
=
MaskPtr
[
1
]
;
/* Get the height of the shape */
Width
=
sMSB
(
MaskPtr
[
0
])
;
/* Get the width of the shape */
Height
=
sMSB
(
MaskPtr
[
1
])
;
/* Get the height of the shape */
MaskPtr
=
&
MaskPtr
[(
Width
*
Height
)
+
2
];
/* Index to the mask */
/* Point to the screen */
ScreenPtr
=
(
unsigned
char
*
)
&
VideoPointer
[
YTable
[
y
]
+
x
];
...
...
@@ -530,6 +533,8 @@ Byte CurrentPal[768];
void
SetAPalettePtr
(
unsigned
char
*
PalPtr
)
{
memcpy
(
&
CurrentPal
,
PalPtr
,
768
);
SetPalette
(
PalPtr
);
}
/**********************************
...
...
@@ -715,8 +720,15 @@ void DLZSS(Byte *Dest,Byte *Src,LongWord Length)
**********************************/
/* TODO */
#include <sys/types.h>
#include <signal.h>
void
*
AllocSomeMem
(
LongWord
Size
)
{
if
(
Size
>
5000000
)
kill
(
getpid
(),
SIGSEGV
);
return
(
void
*
)
malloc
(
Size
);
}
...
...
macsrc/Intro.c
View file @
4007cb34
...
...
@@ -14,7 +14,7 @@ void Intro(void)
LongWord
PackLength
;
Byte
*
ShapePtr
;
NewGameWindow
(
1
);
/* Set to 512 mode */
NewGameWindow
(
1
);
/* Set to 512 mode */
FadeToBlack
();
/* Fade out the video */
PackPtr
=
LoadAResource
(
rMacPlayPic
);
...
...
macsrc/Level.c
View file @
4007cb34
...
...
@@ -637,7 +637,7 @@ static Boolean LoadWallShape(Word Index,Byte *DarkPtr)
if
(
!
Buffer
)
{
return
FALSE
;
}
WallVal
=
WallListPtr
[
Index
+
1
]
;
/* Which resource is it? */
WallVal
=
sMSB
(
WallListPtr
[
Index
+
1
])
;
/* Which resource is it? */
WallPtr
=
LoadAResource
(
WallVal
&
0x3fff
);
/* Load the shape */
if
(
!
WallPtr
)
{
FreeSomeMem
(
Buffer
);
...
...
macsrc/RefBsp.c
View file @
4007cb34
...
...
@@ -55,7 +55,7 @@ void RenderWallLoop(Word x1,Word x2,Word distance)
texturecolumn
=
rw_maxtex
-
1
;
}
tile
=
rw_texture
[
texturecolumn
>>
8
];
/* Get the tile to use */
if
(
!
(
WallListPtr
[
tile
+
1
]
&
0x4000
))
{
if
(
!
(
sMSB
(
WallListPtr
[
tile
+
1
])
&
0x4000
))
{
texturecolumn
^=
0xff
;
/* Reverse the tile for N,W walls */
}
IO_ScaleWallColumn
(
x1
,
scaler
,
tile
,(
texturecolumn
>>
1
)
&
127
);
/* Draw the line */
...
...
macsrc/res.c
View file @
4007cb34
...
...
@@ -104,6 +104,7 @@ void *LoadAResource2(Word RezNum, LongWord Type)
}
fprintf
(
stderr
,
"ERROR: %d/%d was not found!
\n
"
,
Type
,
RezNum
);
AllocSomeMem
(
666666666
);
exit
(
EXIT_FAILURE
);
}
...
...
macsrc/stub.c
View file @
4007cb34
#include <sys/time.h>
#include <unistd.h>
#include "wolfdef.h"
LongWord
LastTick
;
unsigned
short
int
sMSB
(
unsigned
short
int
x
)
{
int
x1
=
(
x
&
0x00FF
)
<<
8
;
int
x2
=
(
x
&
0xFF00
)
>>
8
;
return
x1
|
x2
;
}
unsigned
long
lMSB
(
unsigned
long
x
)
{
int
x1
=
(
x
&
0x000000FF
)
<<
24
;
...
...
@@ -10,23 +23,6 @@ unsigned long lMSB(unsigned long x)
return
x1
|
x2
|
x3
|
x4
;
}
void
IO_ScaleWallColumn
(
Word
x
,
Word
scale
,
Word
tile
,
Word
column
)
{
}
void
IO_ScaleMaskedColumn
(
Word
x
,
Word
scale
,
unsigned
short
*
sprite
,
Word
column
)
{
}
Boolean
SetupScalers
(
void
)
{
return
1
;
}
void
ReleaseScalers
()
{
}
void
MakeSmallFont
(
void
)
{
}
...
...
@@ -41,14 +37,35 @@ void DrawSmall(Word x,Word y,Word tile)
void
ShowGetPsyched
(
void
)
{
LongWord
*
PackPtr
;
Byte
*
ShapePtr
;
LongWord
PackLength
;
Word
X
,
Y
;
ClearTheScreen
(
BLACK
);
BlastScreen
();
PackPtr
=
LoadAResource
(
rGetPsychPic
);
PackLength
=
lMSB
(
PackPtr
[
0
]);
ShapePtr
=
AllocSomeMem
(
PackLength
);
DLZSS
(
ShapePtr
,(
Byte
*
)
&
PackPtr
[
1
],
PackLength
);
X
=
100
;
/* TODO */
Y
=
100
;
DrawShape
(
X
,
Y
,
ShapePtr
);
FreeSomeMem
(
ShapePtr
);
ReleaseAResource
(
rGetPsychPic
);
BlastScreen
();
SetAPalette
(
rGamePal
);
}
void
DrawPsyched
(
Word
Index
)
{
/* TODO: blah */
}
void
EndGetPsyched
(
void
)
{
SetAPalette
(
rBlackPal
);
}
void
FlushKeys
(
void
)
...
...
@@ -70,24 +87,69 @@ void ShareWareEnd(void)
Word
WaitEvent
(
void
)
{
WaitTicks
(
240
);
return
0
;
}
static
struct
timeval
t0
;
LongWord
ReadTick
()
{
return
0
;
struct
timeval
t1
;
long
secs
,
usecs
;
if
(
t0
.
tv_sec
==
0
)
{
gettimeofday
(
&
t0
,
NULL
);
printf
(
"RESET?
\n
"
);
return
0
;
}
gettimeofday
(
&
t1
,
NULL
);
secs
=
t1
.
tv_sec
-
t0
.
tv_sec
;
usecs
=
t1
.
tv_usec
-
t0
.
tv_usec
;
if
(
usecs
<
0
)
{
usecs
+=
1000000
;
secs
--
;
}
return
secs
*
60
+
usecs
*
60
/
1000000
;
}
void
WaitTick
()
{
do
{
/* TODO: get events */
}
while
(
ReadTick
()
==
LastTick
);
LastTick
=
ReadTick
();
}
void
WaitTicks
(
Word
Count
)
{
LongWord
TickMark
;
do
{
/* TODO: get events */
TickMark
=
ReadTick
();
}
while
((
TickMark
-
LastTick
)
<=
Count
);
LastTick
=
TickMark
;
}
Word
WaitTicksEvent
(
Word
Time
)
{
LongWord
TickMark
;
LongWord
NewMark
;
TickMark
=
ReadTick
();
for
(;;)
{
/* TODO: get events */
NewMark
=
ReadTick
();
//if (Time) {
if
((
NewMark
-
TickMark
)
>=
Time
)
{
break
;
}
//}
}
return
0
;
}
...
...
@@ -119,18 +181,6 @@ void PurgeAllSounds(unsigned long minMemory)
{
}
void
BlastScreen2
(
Rect
*
BlastRect
)
{
}
void
BlastScreen
(
void
)
{
}
Word
NewGameWindow
(
Word
NewVidSize
)
{
}
void
BailOut
()
{
printf
(
"BailOut()
\n
"
);
...
...
@@ -139,6 +189,7 @@ void BailOut()
Word
ChooseGameDiff
(
void
)
{
SetAPalette
(
rGamePal
);
}
void
FinishLoadGame
(
void
)
...
...
macsrc/vi_svga.c
View file @
4007cb34
...
...
@@ -6,17 +6,159 @@
#include "wolfdef.h"
Byte
*
gfxbuf
;
void
FixMapList
(
maplist_t
*
m
)
{
int
i
;
m
->
MaxMap
=
sMSB
(
m
->
MaxMap
);
m
->
MapRezNum
=
sMSB
(
m
->
MapRezNum
);
for
(
i
=
0
;
i
<
m
->
MaxMap
;
i
++
)
{
m
->
InfoArray
[
i
].
NextLevel
=
sMSB
(
m
->
InfoArray
[
i
].
NextLevel
);
m
->
InfoArray
[
i
].
SecretLevel
=
sMSB
(
m
->
InfoArray
[
i
].
SecretLevel
);
m
->
InfoArray
[
i
].
ParTime
=
sMSB
(
m
->
InfoArray
[
i
].
ParTime
);
m
->
InfoArray
[
i
].
ScenarioNum
=
sMSB
(
m
->
InfoArray
[
i
].
ScenarioNum
);
m
->
InfoArray
[
i
].
FloorNum
=
sMSB
(
m
->
InfoArray
[
i
].
FloorNum
);
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
!=
2
)
{
fprintf
(
stderr
,
"usage: %s <mac wolf3d resource fork>
\n
"
,
argv
[
0
]);
exit
(
EXIT_FAILURE
);
}
vga_init
();
if
(
InitResources
(
argv
[
1
]))
{
fprintf
(
stderr
,
"could not load %s
\n
"
,
argv
[
1
]);
exit
(
EXIT_FAILURE
);
}
/*
InitSoundMusicSystem(8,8,5, 11025);
SoundListPtr = (Word *) LoadAResource(MySoundList);
RegisterSounds(SoundListPtr,FALSE);
ReleaseAResource(MySoundList);
*/
GetTableMemory
();
MapListPtr
=
(
maplist_t
*
)
LoadAResource
(
rMapList
);
FixMapList
(
MapListPtr
);
SongListPtr
=
(
unsigned
short
*
)
LoadAResource
(
rSongList
);
WallListPtr
=
(
unsigned
short
*
)
LoadAResource
(
MyWallList
);
NewGameWindow
(
0
);
/* 320x200 */
ClearTheScreen
(
BLACK
);
BlastScreen
();
return
WolfMain
(
argc
,
argv
);
}
void
SetPalette
(
Byte
*
pal
)
{
int
i
;
vga_waitretrace
();
for
(
i
=
0
;
i
<
256
;
i
++
)
vga_setpalette
(
i
,
pal
[
i
*
3
+
0
]
>>
2
,
pal
[
i
*
3
+
1
]
>>
2
,
pal
[
i
*
3
+
2
]
>>
2
);
}
void
BlastScreen2
(
Rect
*
BlastRect
)
{
BlastScreen
();
}
static
int
w
,
h
;
void
BlastScreen
()
{
Byte
*
ptrs
=
gfxbuf
,
*
ptrd
=
graph_mem
;
int
i
;
for
(
i
=
0
;
i
<
200
;
i
++
)
{
memcpy
(
ptrd
,
ptrs
,
320
);
ptrs
+=
w
;
ptrd
+=
320
;
}
}
Word
NewGameWindow
(
Word
NewVidSize
)
{
LongWord
*
LongPtr
;
Byte
*
DestPtr
;
int
i
;
switch
(
NewVidSize
)
{
case
0
:
w
=
320
;
h
=
200
;
break
;
case
1
:
w
=
512
;
h
=
384
;
break
;
case
2
:
w
=
640
;
h
=
400
;
break
;
case
3
:
w
=
640
;
h
=
480
;
break
;
default:
fprintf
(
stderr
,
"Vid size: %d
\n
"
,
NewVidSize
);
exit
(
EXIT_FAILURE
);
}
if
(
gfxbuf
)
free
(
gfxbuf
);
gfxbuf
=
(
Byte
*
)
malloc
(
w
*
h
);
vga_setmode
(
G320x200x256
);
VideoPointer
=
gfxbuf
;
VideoWidth
=
w
;
InitYTable
();
SetAPalette
(
rBlackPal
);
ClearTheScreen
(
BLACK
);
BlastScreen
();
LongPtr
=
(
LongWord
*
)
LoadAResource
(
rFaceShapes
);
GameShapes
=
(
Byte
**
)
AllocSomeMem
(
lMSB
(
LongPtr
[
0
]));
DLZSS
((
Byte
*
)
GameShapes
,(
Byte
*
)
&
LongPtr
[
1
],
lMSB
(
LongPtr
[
0
]));
ReleaseAResource
(
rFaceShapes
);
LongPtr
=
(
LongWord
*
)
GameShapes
;
DestPtr
=
(
Byte
*
)
GameShapes
;
for
(
i
=
0
;
i
<
((
NewVidSize
==
1
)
?
57
:
47
);
i
++
)
GameShapes
[
i
]
=
DestPtr
+
lMSB
(
LongPtr
[
i
]);
return
0
;
}
void
IO_ScaleWallColumn
(
Word
x
,
Word
scale
,
Word
tile
,
Word
column
)
{
}
void
IO_ScaleMaskedColumn
(
Word
x
,
Word
scale
,
unsigned
short
*
sprite
,
Word
column
)
{
}
Boolean
SetupScalers
(
void
)
{
return
1
;
}
void
ReleaseScalers
()
{
}
\ No newline at end of file
macsrc/wolfdef.h
View file @
4007cb34
...
...
@@ -533,8 +533,6 @@ extern Boolean rw_downside; /* True for dir_east and dir_south*/
extern
Byte
*
ArtData
[
64
];
extern
Byte
textures
[
MAPSIZE
*
2
+
5
][
MAPSIZE
];
/* 0-63 is horizontal, 64-127 is vertical*/
/* TODO - these were in Mac.c etc */
/* 128 - 132 are doors*/
/*
extern
void
InitTools
(
void
);
extern
void
BlastScreen
(
void
);
extern
void
BlastScreen2
(
Rect
*
BlastRect
);
...
...
@@ -549,7 +547,7 @@ extern void EndGetPsyched(void);
extern
Word
ChooseGameDiff
(
void
);
extern
void
ShareWareEnd
(
void
);
extern
void
FinishLoadGame
(
void
);
*/
/* In StateDef.c */
...
...
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