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
81ab1d53
Commit
81ab1d53
authored
Dec 05, 2000
by
Steven Fuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wl_scale.c: Made DeCompileSprite simpler
parent
219c11c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
50 deletions
+37
-50
TODO
src/TODO
+1
-2
wl_scale.c
src/wl_scale.c
+36
-48
No files found.
src/TODO
View file @
81ab1d53
...
...
@@ -22,6 +22,7 @@ SD_StartMusic((MusicGroup *)audiosegs[STARTMUSIC + chunk]);
=>
SD_StartMusic(chunk);
* merge wl_scale with wl_draw?
* refresh rate under svgalib is horrible. the screen keeps getting updated
midframe. it's due to the way CalcTics works
* rewrite hw (sound, input) code, remove stuff like SD_SetSoundMode
...
...
@@ -94,8 +95,6 @@ also, it should be able to compile without extensions
* rename visable to visible
* create 'sound channels' with priority.. ie a door can only make one sound
at a time
* change wl_scale to use mac wolf3d's version of scaling
wall drawing is done, just needed to fix sprite code
* cat file.c | perl -e 'while($in = <STDIN>)
{$in =~ s/\/\/(.*)$/\/\* \1\ *\//gm;print $in;}'
or
...
...
src/wl_scale.c
View file @
81ab1d53
...
...
@@ -109,79 +109,67 @@ static void ScaleLineTrans(unsigned int height, byte *source, int x)
static
unsigned
char
*
spritegfx
[
SPR_TOTAL
];
/* TODO: merge FlipWall into function below */
static
byte
*
FlipWall
(
byte
*
dat
,
int
w
,
int
h
)
{
byte
*
buf
;
int
i
,
j
;
buf
=
(
byte
*
)
malloc
(
w
*
h
);
for
(
j
=
0
;
j
<
h
;
j
++
)
for
(
i
=
0
;
i
<
w
;
i
++
)
buf
[
j
*
w
+
i
]
=
dat
[
i
*
w
+
j
];
return
buf
;
}
static
void
DeCompileSprite
(
int
shapenum
)
{
t_compshape
*
ptr
;
unsigned
char
*
buf
;
int
srcx
=
32
;
int
slinex
=
31
;
int
stopx
;
int
srcx
;
unsigned
short
int
*
cmdptr
;
short
int
*
linecmds
;
unsigned
char
*
pixels
;
int
y
,
y0
,
y1
;
MM_GetPtr
((
void
*
)
&
buf
,
64
*
64
);
ptr
=
PM_GetSpritePage
(
shapenum
);
memset
(
buf
,
255
,
64
*
64
);
ptr
=
PM_GetSpritePage
(
shapenum
);
stopx
=
ptr
->
leftpix
;
cmdptr
=
&
ptr
->
dataofs
[
31
-
stopx
];
while
(
--
srcx
>=
stopx
)
{
short
*
linecmds
=
(
short
*
)((
unsigned
char
*
)
ptr
+
*
cmdptr
--
);
slinex
--
;
cmdptr
=
&
ptr
->
dataofs
[
31
-
ptr
->
leftpix
]
;
for
(
srcx
=
31
;
srcx
>=
ptr
->
leftpix
;
srcx
--
)
{
linecmds
=
(
short
*
)((
unsigned
char
*
)
ptr
+
*
cmdptr
--
);
while
(
linecmds
[
0
])
{
int
y
;
int
y0
=
linecmds
[
2
]
/
2
;
int
y1
=
linecmds
[
0
]
/
2
-
1
;
unsigned
char
*
pixels
=
(
unsigned
char
*
)
ptr
+
y0
+
linecmds
[
1
];
for
(
y
=
y0
;
y
<=
y1
;
y
++
)
{
unsigned
char
color
=
*
pixels
++
;
*
(
buf
+
slinex
+
(
y
*
64
))
=
color
;
y0
=
linecmds
[
2
]
/
2
;
y1
=
linecmds
[
0
]
/
2
;
pixels
=
(
unsigned
char
*
)
ptr
+
y0
+
linecmds
[
1
];
for
(
y
=
y0
;
y
<
y1
;
y
++
)
{
//*(buf + slinex + (y*64)) = *pixels;
*
(
buf
+
(
srcx
*
64
)
+
y
)
=
*
pixels
;
pixels
++
;
}
linecmds
+=
3
;
}
}
slinex
=
31
;
stopx
=
ptr
->
rightpix
;
if
(
ptr
->
leftpix
<
31
)
{
srcx
=
3
1
;
srcx
=
3
2
;
cmdptr
=
&
ptr
->
dataofs
[
32
-
ptr
->
leftpix
];
}
else
{
srcx
=
ptr
->
leftpix
-
1
;
srcx
=
ptr
->
leftpix
;
cmdptr
=
&
ptr
->
dataofs
[
0
];
}
while
(
++
srcx
<=
stopx
)
{
short
*
linecmds
=
(
short
*
)((
unsigned
char
*
)
ptr
+
*
cmdptr
++
);
for
(;
srcx
<=
ptr
->
rightpix
;
srcx
++
)
{
linecmds
=
(
short
*
)((
unsigned
char
*
)
ptr
+
*
cmdptr
++
);
while
(
linecmds
[
0
])
{
int
y
;
int
y0
=
linecmds
[
2
]
/
2
;
int
y1
=
linecmds
[
0
]
/
2
-
1
;
unsigned
char
*
pixels
=
(
unsigned
char
*
)
ptr
+
y0
+
linecmds
[
1
];
for
(
y
=
y0
;
y
<=
y1
;
y
++
)
{
unsigned
char
color
=
*
pixels
++
;
*
(
buf
+
slinex
+
(
y
*
64
))
=
color
;
y0
=
linecmds
[
2
]
/
2
;
y1
=
linecmds
[
0
]
/
2
;
pixels
=
(
unsigned
char
*
)
ptr
+
y0
+
linecmds
[
1
];
for
(
y
=
y0
;
y
<
y1
;
y
++
)
{
//*(buf + slinex + (y*64)) = *pixels;
*
(
buf
+
(
srcx
*
64
)
+
y
)
=
*
pixels
;
pixels
++
;
}
linecmds
+=
3
;
}
slinex
++
;
}
spritegfx
[
shapenum
]
=
FlipWall
(
buf
,
64
,
64
);
MM_FreePtr
((
void
*
)
&
buf
);
spritegfx
[
shapenum
]
=
buf
;
}
void
ScaleShape
(
int
xcenter
,
int
shapenum
,
unsigned
height
)
...
...
@@ -195,7 +183,7 @@ void ScaleShape(int xcenter, int shapenum, unsigned height)
for
(
p
=
xcenter
-
(
height
>>
3
),
x
=
0
;
x
<
(
64
<<
16
);
x
+=
scaler
,
p
++
)
{
if
((
p
<
0
)
||
(
p
>=
viewwidth
)
||
(
wallheight
[
p
]
>=
height
))
continue
;
ScaleLineTrans
(
(
height
>>
2
)
+
0
,
spritegfx
[
shapenum
]
+
((
x
>>
16
)
<<
6
),
p
);
ScaleLineTrans
(
height
>>
2
,
spritegfx
[
shapenum
]
+
((
x
>>
16
)
<<
6
),
p
);
}
}
...
...
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