Skip to content

Commit

Permalink
Merge pull request #2185 from ericoporto/fix-precache-only-walk-of-pl…
Browse files Browse the repository at this point in the history
…ayer

Engine: precache only player walk view
  • Loading branch information
ivan-mogilko authored Oct 18, 2023
2 parents 93c3f7f + 20c7e57 commit bf088d5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Engine/ac/viewframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@ int ViewFrame_GetFrame(ScriptViewFrame *svf) {

//=============================================================================

void precache_view(int view)
void precache_view(int view, int max_loops)
{
if (view < 0)
return;

for (int i = 0; i < views[view].numLoops; i++) {
max_loops = std::min(views[view].numLoops, max_loops);
for (int i = 0; i < max_loops; i++) {
for (int j = 0; j < views[view].loops[i].numFrames; j++)
spriteset.Precache(views[view].loops[i].frames[j].pic);
}
Expand Down
2 changes: 1 addition & 1 deletion Engine/ac/viewframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int ViewFrame_GetView(ScriptViewFrame *svf);
int ViewFrame_GetLoop(ScriptViewFrame *svf);
int ViewFrame_GetFrame(ScriptViewFrame *svf);

void precache_view(int view);
void precache_view(int view, int max_loops = INT_MAX);
// Calculate the frame sound volume from different factors;
// pass scale as 100 if volume scaling is disabled
// NOTE: historically scales only in 0-100 range :/
Expand Down
2 changes: 1 addition & 1 deletion Engine/main/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ void engine_init_game_settings()
}
// may as well preload the character gfx
if (playerchar->view >= 0)
precache_view (playerchar->view);
precache_view (playerchar->view, Character_GetDiagonalWalking(playerchar) ? 8 : 4);

our_eip=-6;

Expand Down

0 comments on commit bf088d5

Please sign in to comment.