Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Richard Gobeille
EDuke32
Commits
44409aa4
Commit
44409aa4
authored
May 01, 2022
by
Richard Gobeille
Browse files
Duke3d: precache indexed hightile textures, minor rework of loading screen progress bar
parent
cf3770e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
source/duke3d/src/premap.cpp
View file @
44409aa4
...
...
@@ -418,53 +418,55 @@ static void G_DoLoadScreen(const char *statustext, int percent)
}
}
#ifdef USE_OPENGL
static
void
cacheExtraTextureMaps
(
int
tileNum
)
{
// PRECACHE
if
(
ud
.
config
.
useprecache
&&
bpp
>
8
)
for
(
int
type
=
0
;
type
<
2
&&
!
KB_KeyPressed
(
sc_Space
);
type
++
)
{
for
(
int
type
=
0
;
type
<
2
&&
!
KB_KeyPressed
(
sc_Space
);
type
++
)
if
(
bitmap_test
(
precachehightile
[
type
],
tileNum
)
)
{
if
(
bitmap_test
(
precachehightile
[
type
],
tileNum
))
tileLoadScaled
(
tileNum
);
if
(
videoGetRenderMode
()
==
REND_CLASSIC
)
continue
;
#ifdef USE_OPENGL
for
(
int
k
=
0
;
k
<
MAXPALOOKUPS
-
RESERVEDPALS
&&
!
KB_KeyPressed
(
sc_Space
);
k
++
)
{
for
(
int
k
=
0
;
k
<
MAXPALOOKUPS
-
RESERVEDPALS
&&
!
KB_KeyPressed
(
sc_Space
);
k
++
)
{
// this is the CROSSHAIR_PAL, see screens.cpp
if
(
k
==
MAXPALOOKUPS
-
RESERVEDPALS
-
1
)
break
;
// this is the CROSSHAIR_PAL, see screens.cpp
if
(
k
==
MAXPALOOKUPS
-
RESERVEDPALS
-
1
)
break
;
#ifdef POLYMER
if
(
videoGetRenderMode
()
!=
REND_POLYMER
||
!
polymer_havehighpalookup
(
0
,
k
))
if
(
videoGetRenderMode
()
!=
REND_POLYMER
||
!
polymer_havehighpalookup
(
0
,
k
))
#endif
polymost_precache
(
tileNum
,
k
,
type
);
}
#endif
polymost_precache
(
tileNum
,
k
,
type
);
}
#ifdef USE_GLEXT
if
(
r_detailmapping
)
polymost_precache
(
tileNum
,
DETAILPAL
,
type
);
if
(
r_detailmapping
)
polymost_precache
(
tileNum
,
DETAILPAL
,
type
);
if
(
r_glowmapping
)
polymost_precache
(
tileNum
,
GLOWPAL
,
type
);
if
(
r_glowmapping
)
polymost_precache
(
tileNum
,
GLOWPAL
,
type
);
#endif
#ifdef POLYMER
if
(
videoGetRenderMode
()
==
REND_POLYMER
)
{
if
(
pr_specularmapping
)
polymost_precache
(
tileNum
,
SPECULARPAL
,
type
);
if
(
videoGetRenderMode
()
==
REND_POLYMER
)
{
if
(
pr_specularmapping
)
polymost_precache
(
tileNum
,
SPECULARPAL
,
type
);
if
(
pr_normalmapping
)
polymost_precache
(
tileNum
,
NORMALPAL
,
type
);
}
#endif
if
(
pr_normalmapping
)
polymost_precache
(
tileNum
,
NORMALPAL
,
type
);
}
#endif
}
}
}
#endif
void
G_CacheMapData
(
void
)
{
if
(
ud
.
recstat
==
2
)
if
(
ud
.
recstat
==
2
||
!
ud
.
config
.
useprecache
)
return
;
S_TryPlaySpecialMusic
(
MUS_LOADING
);
...
...
@@ -497,51 +499,43 @@ void G_CacheMapData(void)
}
}
int
clock
=
(
int
)
totalclock
;
int
cnt
=
0
;
int
percentDisplayed
=
-
1
;
int
i
=
0
;
for
(
int
i
=
0
;
i
<
MAXTILES
&&
!
KB_KeyPressed
(
sc_Space
)
;
i
++
)
while
(
percentDisplayed
<
100
&&
!
KB_KeyPressed
(
sc_Space
))
{
if
(
!
(
i
&
7
)
&&
!
gotpic
[
i
>>
3
]
)
if
(
cnt
<
g_precacheCount
)
{
i
+=
7
;
continue
;
}
if
(
!
(
i
&
7
)
&&
!
gotpic
[
i
>>
3
])
{
i
+=
8
;
continue
;
}
else
if
(
bitmap_test
(
gotpic
,
i
))
continue
;
if
(
waloff
[
i
]
==
0
)
tileLoad
((
int16_t
)
i
);
#ifdef USE_OPENGL
cacheExtraTextureMaps
(
i
);
#endif
MUSIC_Update
();
{
if
(
waloff
[
i
]
==
0
)
tileLoad
((
int16_t
)
i
);
if
((
++
cnt
&
7
)
==
0
)
gameHandleEvents
();
cacheExtraTextureMaps
(
i
);
gameHandleEvents
();
MUSIC_Update
();
cnt
++
;
}
i
++
;
}
int
const
percentComplete
=
min
(
100
,
tabledivide32_noinline
(
100
*
cnt
,
g_precacheCount
));
if
(
videoGetRenderMode
()
!=
REND_CLASSIC
&&
totalclock
-
clock
>
(
TICRATE
>>
2
))
// this just prevents the loading screen percentage bar from making large jumps
if
(
percentDisplayed
<
percentComplete
)
{
int
const
percentComplete
=
min
(
100
,
tabledivide32_noinline
(
100
*
cnt
,
g_precacheCount
));
// this just prevents the loading screen percentage bar from making large jumps
while
(
percentDisplayed
<
percentComplete
)
if
(
engineFPSLimit
(
false
))
{
gameHandleEvents
();
Bsprintf
(
tempbuf
,
"Loaded %d%% (%d/%d textures)
\n
"
,
percentDisplayed
,
cnt
,
g_precacheCount
);
G_DoLoadScreen
(
tempbuf
,
percentDisplayed
);
if
(
totalclock
-
clock
>=
1
)
{
clock
=
(
int
)
totalclock
;
percentDisplayed
++
;
}
percentDisplayed
=
logapproach
(
percentDisplayed
,
percentComplete
);
}
clock
=
(
int
)
totalclock
;
}
}
...
...
Richard Gobeille
@terminx
mentioned in commit
36486171
·
Jun 11, 2022
mentioned in commit
36486171
mentioned in commit 364861718c0f3d1a8f083939ff2a7791677d6546
Toggle commit list
Write
Preview
Supports
Markdown
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