anim_ticks -> ter_anim_ticks & turn back on in combat

Fix #736
This commit is contained in:
2025-05-17 07:18:16 -05:00
parent b6ac9e8e69
commit 7ccd50201b
4 changed files with 7 additions and 12 deletions

View File

@@ -85,8 +85,6 @@ rectangle menuBarRect;
Region originalGrayRgn, newGrayRgn, underBarRgn;
sf::View mainView;
long anim_ticks = 0;
extern enum_map(eGuiArea, rectangle) win_to_rects;
// 0 - title 1 - button 2 - credits 3 - base button
@@ -934,8 +932,6 @@ void draw_terrain(short mode) {
if(fog_lifted) can_draw = true;
if((can_draw != 0) && (overall_mode != MODE_RESTING)) { // if can see, not a pit, and not resting
if(is_combat()) anim_ticks = 0;
eTrimType trim = univ.scenario.ter_types[spec_terrain].trim_type;
// Finally, draw this terrain spot

View File

@@ -39,8 +39,6 @@ extern bool monsters_going;
extern short num_targets_left;
extern location spell_targets[8];
extern long anim_ticks;
extern char spot_seen[9][9];
extern short monster_index[21];
@@ -52,6 +50,8 @@ extern cCustomGraphics spec_scen_g;
rectangle boat_rects[4] = {{0,0,36,28}, {0,28,36,56},{0,56,36,84},{0,84,36,112}};
bool gave_no_g_error = false;
long ter_anim_ticks = 0;
//short dest; // 0 - terrain gworld 1 - screen
// if terrain_to_draw is -1, do black
// if terrain_to_draw >= 10000, force to draw graphic which is terrain_to_draw - 10000
@@ -80,7 +80,7 @@ void draw_one_terrain_spot (short i,short j,short terrain_to_draw) {
source_rect = calc_rect(terrain_to_draw % 10, terrain_to_draw / 10);
}
else if(univ.scenario.ter_types[terrain_to_draw].picture >= 2000) { // custom
graf_pos_ref(source_gworld, source_rect) = spec_scen_g.find_graphic(univ.scenario.ter_types[terrain_to_draw].picture - 2000 + (anim_ticks % 4));
graf_pos_ref(source_gworld, source_rect) = spec_scen_g.find_graphic(univ.scenario.ter_types[terrain_to_draw].picture - 2000 + (ter_anim_ticks % 4));
}
else if(univ.scenario.ter_types[terrain_to_draw].picture >= 1000) { // custom
graf_pos_ref(source_gworld, source_rect) = spec_scen_g.find_graphic(univ.scenario.ter_types[terrain_to_draw].picture - 1000);
@@ -88,7 +88,7 @@ void draw_one_terrain_spot (short i,short j,short terrain_to_draw) {
else if(univ.scenario.ter_types[terrain_to_draw].picture >= 960) { // animated
source_gworld = &ResMgr::graphics.get("teranim");
terrain_to_draw = univ.scenario.ter_types[terrain_to_draw].picture;
source_rect = calc_rect(4 * ((terrain_to_draw - 960) / 5) + (anim_ticks % 4),(terrain_to_draw - 960) % 5);
source_rect = calc_rect(4 * ((terrain_to_draw - 960) / 5) + (ter_anim_ticks % 4),(terrain_to_draw - 960) % 5);
}
else {
terrain_to_draw = univ.scenario.ter_types[terrain_to_draw].picture;
@@ -410,7 +410,7 @@ void draw_fields(location where){
if(univ.town.is_web(where.x,where.y))
Draw_Some_Item(fields_gworld,calc_rect(5,0),terrain_screen_gworld(),where_draw,1,0);
if(univ.town.is_fire_barr(where.x,where.y) || univ.town.is_force_barr(where.x,where.y))
Draw_Some_Item(*ResMgr::graphics.get("teranim"),calc_rect(8+(anim_ticks%4),4),terrain_screen_gworld(),where_draw,1,0);
Draw_Some_Item(*ResMgr::graphics.get("teranim"),calc_rect(8+(ter_anim_ticks%4),4),terrain_screen_gworld(),where_draw,1,0);
if(univ.town.is_quickfire(where.x,where.y))
Draw_Some_Item(fields_gworld,calc_rect(7,1),terrain_screen_gworld(),where_draw,1,0);
if(univ.town.is_force_cage(where.x,where.y)) {

View File

@@ -208,7 +208,7 @@ std::unordered_map <std::string, std::shared_ptr <iEventListener>> event_listene
cDrawableManager drawable_mgr;
sf::Clock animTimer;
extern long anim_ticks;
extern long ter_anim_ticks;
static void init_boe(int, char*[]);
static void handle_scenario_args();
@@ -1464,7 +1464,7 @@ void update_terrain_animation() {
if(overall_mode == MODE_STARTUP) return;
if(animTimer.getElapsedTime().asMilliseconds() < fortyTicks) return;
anim_ticks++;
ter_anim_ticks++;
animTimer.restart();
}

View File

@@ -56,7 +56,6 @@ short monsters_faces[190] = {
23,0,0,0,0,0,0,0,23,23,
0,0,0,55,23,36,31,0,0,0};
extern rectangle windRect;
extern long anim_ticks;
extern tessel_ref_t bg[];
extern short which_combat_type;
extern eGameMode overall_mode;