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
Dino Bollinger
EDuke32 - DB Patches
Commits
36486171
Commit
36486171
authored
May 17, 2022
by
Richard Gobeille
Browse files
Duke3d: revise
44409aa4
parent
16ddd511
Changes
1
Hide whitespace changes
Inline
Side-by-side
source/duke3d/src/premap.cpp
View file @
36486171
...
...
@@ -418,50 +418,35 @@ static void G_DoLoadScreen(const char *statustext, int percent)
}
}
static
void
cacheExtraTextureMaps
(
int
tileNum
)
static
void
cacheExtraTextureMaps
(
int
tileNum
,
int
type
)
{
// PRECACHE
for
(
int
type
=
0
;
type
<
2
&&
!
KB_KeyPressed
(
sc_Space
);
type
++
)
{
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
++
)
{
// this is the CROSSHAIR_PAL, see screens.cpp
if
(
k
==
MAXPALOOKUPS
-
RESERVEDPALS
-
1
)
break
;
for
(
int
i
=
0
;
i
<
MAXPALOOKUPS
-
RESERVEDPALS
-
1
;
i
++
)
{
#ifdef POLYMER
if
(
videoGetRenderMode
()
!=
REND_POLYMER
||
!
polymer_havehighpalookup
(
0
,
k
))
if
(
videoGetRenderMode
()
!=
REND_POLYMER
||
!
polymer_havehighpalookup
(
0
,
i
))
#endif
polymost_precache
(
tileNum
,
k
,
type
);
}
polymost_precache
(
tileNum
,
i
,
type
);
}
#endif
#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
}
void
G_CacheMapData
(
void
)
...
...
@@ -469,6 +454,10 @@ void G_CacheMapData(void)
if
(
ud
.
recstat
==
2
||
!
ud
.
config
.
useprecache
)
return
;
g_precacheCount
=
0
;
Bmemset
(
gotpic
,
0
,
sizeof
(
gotpic
));
Bmemset
(
precachehightile
,
0
,
sizeof
(
precachehightile
));
S_TryPlaySpecialMusic
(
MUS_LOADING
);
#if defined EDUKE32_TOUCH_DEVICES && defined USE_OPENGL
...
...
@@ -500,42 +489,43 @@ void G_CacheMapData(void)
}
int
cnt
=
0
;
int
percentDisplayed
=
-
1
;
int
cntDisplayed
=
-
1
;
int
pctDisplayed
=
-
1
;
int
i
=
0
;
while
(
percentDisplayed
<
100
&&
!
KB_KeyPressed
(
sc_Space
)
)
while
(
cnt
<
g_precacheCount
)
{
if
(
cnt
<
g_precacheCount
)
if
(
bitmap_test
(
gotpic
,
i
)
)
{
if
(
!
(
i
&
7
)
&&
!
gotpic
[
i
>>
3
])
{
i
+=
8
;
continue
;
}
else
if
(
bitmap_test
(
gotpic
,
i
)
)
cnt
++
;
if
(
waloff
[
i
]
==
0
)
tileLoad
((
int16_t
)
i
)
;
for
(
int
j
=
0
;
j
<
2
;
j
++
)
{
if
(
waloff
[
i
]
==
0
)
tileLoad
((
int16_t
)
i
);
if
(
bitmap_test
(
precachehightile
[
j
],
i
))
{
tileLoadScaled
(
i
);
cacheExtraTextureMaps
(
i
);
gameHandleEvents
();
MUSIC_Update
();
cnt
++
;
if
(
videoGetRenderMode
()
!=
REND_CLASSIC
)
cacheExtraTextureMaps
(
i
,
j
);
}
}
i
++
;
gameHandleEvents
();
if
(
KB_KeyPressed
(
sc_Space
))
break
;
}
i
++
;
int
const
percentComplete
=
min
(
100
,
tabledivide32_noinline
(
100
*
cnt
,
g_precacheCount
));
// this just prevents the loading screen percentage bar from making large jumps
if
(
percentDisplayed
<
percentComplete
)
if
(
cntDisplayed
+
(
i
&
7
)
<
cnt
-
(
i
&
7
)
&&
engineFPSLimit
(
true
))
{
if
(
engineFPSLimit
(
false
))
{
Bsprintf
(
tempbuf
,
"Loaded %d%% (%d/%d textures)
\n
"
,
percentDisplayed
,
cnt
,
g_precacheCount
);
G_DoLoadScreen
(
tempbuf
,
percentDisplayed
);
percentDisplayed
=
logapproach
(
percentDisplayed
,
percentComplete
);
}
int
const
percentComplete
=
min
(
100
,
tabledivide32
(
100
*
cntDisplayed
,
g_precacheCount
));
cntDisplayed
=
logapproach
(
cntDisplayed
,
cnt
);
pctDisplayed
=
logapproach
(
pctDisplayed
,
percentComplete
);
Bsprintf
(
tempbuf
,
"Loaded %d%% (%d/%d textures)
\n
"
,
pctDisplayed
,
cntDisplayed
,
g_precacheCount
);
G_DoLoadScreen
(
tempbuf
,
pctDisplayed
);
}
}
...
...
@@ -1992,10 +1982,6 @@ int G_EnterLevel(int gameMode)
p0
.
q16ang
=
fix16_from_int
(
playerAngle
);
g_precacheCount
=
0
;
Bmemset
(
gotpic
,
0
,
sizeof
(
gotpic
));
Bmemset
(
precachehightile
,
0
,
sizeof
(
precachehightile
));
NET_75_CHECK
++
;
// resetpspritevars attempts to insert player 0's sprite, which isn't going to work because we don't have
// the STAT_NETALLOC sprites allocated yet.
...
...
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