Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
03d4082f
Commit
03d4082f
authored
5 years ago
by
Lactozilla
Browse files
Options
Downloads
Patches
Plain Diff
Rename functions
parent
c7794d4c
No related branches found
No related tags found
2 merge requests
!734
Rebase Keycodes only branch.
,
!619
More OpenGL fixes plus masked PNG conversion
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/r_patch.c
+17
-12
17 additions, 12 deletions
src/r_patch.c
src/r_patch.h
+2
-2
2 additions, 2 deletions
src/r_patch.h
with
19 additions
and
14 deletions
src/r_patch.c
+
17
−
12
View file @
03d4082f
...
@@ -201,11 +201,15 @@ void R_PatchToFlat(patch_t *patch, UINT8 *flat)
...
@@ -201,11 +201,15 @@ void R_PatchToFlat(patch_t *patch, UINT8 *flat)
}
}
//
//
// R_PatchTo
Flat_16bpp
// R_PatchTo
MaskedFlat
//
//
// Convert a patch to a 16-bit flat.
// Convert a patch to a masked flat.
// Now, what is a "masked" flat anyway?
// It means the flat uses two bytes to store image data.
// The upper byte is used to store the transparent pixel,
// and the lower byte stores a palette index.
//
//
void
R_PatchTo
Flat_16bpp
(
patch_t
*
patch
,
UINT16
*
raw
,
boolean
flip
)
void
R_PatchTo
MaskedFlat
(
patch_t
*
patch
,
UINT16
*
raw
,
boolean
flip
)
{
{
fixed_t
col
,
ofs
;
fixed_t
col
,
ofs
;
column_t
*
column
;
column_t
*
column
;
...
@@ -352,11 +356,12 @@ patch_t *R_FlatToPatch(UINT8 *raw, UINT16 width, UINT16 height, UINT16 leftoffse
...
@@ -352,11 +356,12 @@ patch_t *R_FlatToPatch(UINT8 *raw, UINT16 width, UINT16 height, UINT16 leftoffse
}
}
//
//
// R_FlatToPatch
_16bpp
// R_
Masked
FlatToPatch
//
//
// Convert a 16-bit flat to a patch.
// Convert a masked flat to a patch.
// Explanation of "masked" flats in R_PatchToMaskedFlat.
//
//
patch_t
*
R_FlatToPatch
_16bpp
(
UINT16
*
raw
,
UINT16
width
,
UINT16
height
,
UINT16
leftoffset
,
UINT16
topoffset
,
size_t
*
destsize
)
patch_t
*
R_
Masked
FlatToPatch
(
UINT16
*
raw
,
UINT16
width
,
UINT16
height
,
UINT16
leftoffset
,
UINT16
topoffset
,
size_t
*
destsize
)
{
{
UINT32
x
,
y
;
UINT32
x
,
y
;
UINT8
*
img
;
UINT8
*
img
;
...
@@ -684,7 +689,7 @@ static UINT8 *PNG_RawConvert(const UINT8 *png, UINT16 *w, UINT16 *h, INT16 *topo
...
@@ -684,7 +689,7 @@ static UINT8 *PNG_RawConvert(const UINT8 *png, UINT16 *w, UINT16 *h, INT16 *topo
}
}
// Convert a PNG with transparency to a raw image.
// Convert a PNG with transparency to a raw image.
static
UINT16
*
PNG_RawConvert
_16bpp
(
const
UINT8
*
png
,
UINT16
*
w
,
UINT16
*
h
,
INT16
*
topoffset
,
INT16
*
leftoffset
,
size_t
size
)
static
UINT16
*
PNG_
Masked
RawConvert
(
const
UINT8
*
png
,
UINT16
*
w
,
UINT16
*
h
,
INT16
*
topoffset
,
INT16
*
leftoffset
,
size_t
size
)
{
{
UINT16
*
flat
;
UINT16
*
flat
;
png_uint_32
x
,
y
;
png_uint_32
x
,
y
;
...
@@ -693,7 +698,7 @@ static UINT16 *PNG_RawConvert_16bpp(const UINT8 *png, UINT16 *w, UINT16 *h, INT1
...
@@ -693,7 +698,7 @@ static UINT16 *PNG_RawConvert_16bpp(const UINT8 *png, UINT16 *w, UINT16 *h, INT1
size_t
flatsize
,
i
;
size_t
flatsize
,
i
;
if
(
!
row_pointers
)
if
(
!
row_pointers
)
I_Error
(
"PNG_RawConvert
_16bpp
: conversion failed"
);
I_Error
(
"PNG_
Masked
RawConvert: conversion failed"
);
// Convert the image to 16bpp
// Convert the image to 16bpp
flatsize
=
(
width
*
height
);
flatsize
=
(
width
*
height
);
...
@@ -737,12 +742,12 @@ patch_t *R_PNGToPatch(const UINT8 *png, size_t size, size_t *destsize)
...
@@ -737,12 +742,12 @@ patch_t *R_PNGToPatch(const UINT8 *png, size_t size, size_t *destsize)
{
{
UINT16
width
,
height
;
UINT16
width
,
height
;
INT16
topoffset
=
0
,
leftoffset
=
0
;
INT16
topoffset
=
0
,
leftoffset
=
0
;
UINT16
*
raw
=
PNG_RawConvert
_16bpp
(
png
,
&
width
,
&
height
,
&
topoffset
,
&
leftoffset
,
size
);
UINT16
*
raw
=
PNG_
Masked
RawConvert
(
png
,
&
width
,
&
height
,
&
topoffset
,
&
leftoffset
,
size
);
if
(
!
raw
)
if
(
!
raw
)
I_Error
(
"R_PNGToPatch: conversion failed"
);
I_Error
(
"R_PNGToPatch: conversion failed"
);
return
R_FlatToPatch
_16bpp
(
raw
,
width
,
height
,
leftoffset
,
topoffset
,
destsize
);
return
R_
Masked
FlatToPatch
(
raw
,
width
,
height
,
leftoffset
,
topoffset
,
destsize
);
}
}
//
//
...
@@ -1209,7 +1214,7 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
...
@@ -1209,7 +1214,7 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
for
(
i
=
0
;
i
<
size
;
i
++
)
for
(
i
=
0
;
i
<
size
;
i
++
)
rawsrc
[
i
]
=
0xFF00
;
rawsrc
[
i
]
=
0xFF00
;
R_PatchTo
Flat_16bpp
(
patch
,
rawsrc
,
bflip
);
R_PatchTo
MaskedFlat
(
patch
,
rawsrc
,
bflip
);
// Don't cache angle = 0
// Don't cache angle = 0
for
(
angle
=
1
;
angle
<
ROTANGLES
;
angle
++
)
for
(
angle
=
1
;
angle
<
ROTANGLES
;
angle
++
)
...
@@ -1305,7 +1310,7 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
...
@@ -1305,7 +1310,7 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
}
}
// make patch
// make patch
newpatch
=
R_FlatToPatch
_16bpp
(
rawdst
,
newwidth
,
newheight
,
0
,
0
,
&
size
);
newpatch
=
R_
Masked
FlatToPatch
(
rawdst
,
newwidth
,
newheight
,
0
,
0
,
&
size
);
{
{
newpatch
->
leftoffset
=
(
newpatch
->
width
/
2
)
+
(
leftoffset
-
px
);
newpatch
->
leftoffset
=
(
newpatch
->
width
/
2
)
+
(
leftoffset
-
px
);
newpatch
->
topoffset
=
(
newpatch
->
height
/
2
)
+
(
patch
->
topoffset
-
py
);
newpatch
->
topoffset
=
(
newpatch
->
height
/
2
)
+
(
patch
->
topoffset
-
py
);
...
...
This diff is collapsed.
Click to expand it.
src/r_patch.h
+
2
−
2
View file @
03d4082f
...
@@ -45,9 +45,9 @@ typedef struct
...
@@ -45,9 +45,9 @@ typedef struct
boolean
R_CheckIfPatch
(
lumpnum_t
lump
);
boolean
R_CheckIfPatch
(
lumpnum_t
lump
);
void
R_TextureToFlat
(
size_t
tex
,
UINT8
*
flat
);
void
R_TextureToFlat
(
size_t
tex
,
UINT8
*
flat
);
void
R_PatchToFlat
(
patch_t
*
patch
,
UINT8
*
flat
);
void
R_PatchToFlat
(
patch_t
*
patch
,
UINT8
*
flat
);
void
R_PatchTo
Flat_16bpp
(
patch_t
*
patch
,
UINT16
*
raw
,
boolean
flip
);
void
R_PatchTo
MaskedFlat
(
patch_t
*
patch
,
UINT16
*
raw
,
boolean
flip
);
patch_t
*
R_FlatToPatch
(
UINT8
*
raw
,
UINT16
width
,
UINT16
height
,
UINT16
leftoffset
,
UINT16
topoffset
,
size_t
*
destsize
,
boolean
transparency
);
patch_t
*
R_FlatToPatch
(
UINT8
*
raw
,
UINT16
width
,
UINT16
height
,
UINT16
leftoffset
,
UINT16
topoffset
,
size_t
*
destsize
,
boolean
transparency
);
patch_t
*
R_FlatToPatch
_16bpp
(
UINT16
*
raw
,
UINT16
width
,
UINT16
height
,
UINT16
leftoffset
,
UINT16
topoffset
,
size_t
*
destsize
);
patch_t
*
R_
Masked
FlatToPatch
(
UINT16
*
raw
,
UINT16
width
,
UINT16
height
,
UINT16
leftoffset
,
UINT16
topoffset
,
size_t
*
destsize
);
// Portable Network Graphics
// Portable Network Graphics
boolean
R_IsLumpPNG
(
const
UINT8
*
d
,
size_t
s
);
boolean
R_IsLumpPNG
(
const
UINT8
*
d
,
size_t
s
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment