[Scummvm-git-logs] scummvm master -> 28f1d6e7f15d5a4b89de51d9135efc27bb137b4b
dreammaster
noreply at scummvm.org
Mon May 18 01:04:08 UTC 2026
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
63e8876037 MADS: PHANTOM: Overall inter anim animview code
29fd17dc46 MADS: PHANTOM: animview run_animation fixes
28f1d6e7f1 MADS: PHANTOM: animview animate fixes
Commit: 63e8876037e99fc099919f533c078d65fbd05a78
https://github.com/scummvm/scummvm/commit/63e8876037e99fc099919f533c078d65fbd05a78
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-18T11:03:56+10:00
Commit Message:
MADS: PHANTOM: Overall inter anim animview code
Changed paths:
engines/mads/madsv2/animview/anim_timer.cpp
engines/mads/madsv2/animview/animview.cpp
engines/mads/madsv2/animview/functions.cpp
engines/mads/madsv2/animview/functions.h
diff --git a/engines/mads/madsv2/animview/anim_timer.cpp b/engines/mads/madsv2/animview/anim_timer.cpp
index 2d2925ee84b..94798fae8bf 100644
--- a/engines/mads/madsv2/animview/anim_timer.cpp
+++ b/engines/mads/madsv2/animview/anim_timer.cpp
@@ -68,9 +68,7 @@ void anim_timer() {
goto done;
if (currentFrame < 0 || currentFrame >= maxFrame)
goto done;
- // TODO: The min/max max values look like they're backwards. Plus, the code that sets
- // up the values in animview.
- if (foundSeries && currentFrame > seriesMaxFrame && currentFrame <= seriesMinFrame)
+ if (foundSeries && currentFrame > seriesMinFrame && currentFrame <= seriesMaxFrame)
goto done;
if (timerFlag1) {
diff --git a/engines/mads/madsv2/animview/animview.cpp b/engines/mads/madsv2/animview/animview.cpp
index 23709d6e4ef..3e5e1232cdc 100644
--- a/engines/mads/madsv2/animview/animview.cpp
+++ b/engines/mads/madsv2/animview/animview.cpp
@@ -23,6 +23,7 @@
#include "common/file.h"
#include "mads/madsv2/core/env.h"
#include "mads/madsv2/core/himem.h"
+#include "mads/madsv2/core/kernel.h"
#include "mads/madsv2/core/matte.h"
#include "mads/madsv2/core/mcga.h"
#include "mads/madsv2/core/mouse.h"
@@ -86,10 +87,11 @@ static int speech_lines_count;
static SeriesPtr animSeries;
static SpritePageInfoPtr pageInfo;
static SpritePageTablePtr pageTable;
-static int imageFlags, imageFlags2;
+static int imageFrame1, imageFrame2;
static int largeBufferSize;
static byte *largeBuffer, *largeBufferEnd;
-static byte *largeBuffer1, *largeBuffer2;
+static byte *largeBuffer1, *largeBuffer2, *largeBuffer3;
+static bool seriesFlag1, seriesFlag2;
static bool hasAnimInited;
static int runVal1, runVal2, runVal3;
static int runVal12;
@@ -122,11 +124,14 @@ static void init_globals() {
pageInfo = nullptr;
pageTable = nullptr;
foundSeries = false;
- imageFlags = imageFlags2 = seriesMaxFrame = 0;
+ imageFrame1 = imageFrame2 = seriesMaxFrame = 0;
seriesMinFrame = 0;
largeBufferSize = 0;
largeBuffer = largeBufferEnd = nullptr;
largeBuffer1 = largeBuffer2 = nullptr;
+ largeBuffer3 = nullptr;
+ seriesFlag1 = false;
+ seriesFlag2 = true;
hasAnimInited = false;
minFrame = maxFrame = -1;
timer1 = timer2 = 0;
@@ -148,20 +153,8 @@ static void init_globals() {
imageFrame = 0;
}
-/**
- * Handleas incremental fading by subtracting an amount from each palette
- * entries' RGB values down towards zero
- */
-static bool anim_fade(Palette *pal, int fadeAmount) {
- bool palChanged = false;
- byte *rgb = (byte *)pal;
- for (int count = 0; count < Graphics::PALETTE_SIZE; ++count, ++rgb) {
- if (*rgb)
- palChanged = true;
- *rgb = MAX((int)*rgb - fadeAmount, 0);
- }
-
- return palChanged;
+static void anim_inter_timer() {
+ error("TODO: Inter anim timer");
}
/**
@@ -218,10 +211,9 @@ static void run_animation(int animIndex) {
image_inter_marker = 1;
image_inter_list[0].flags = -2;
- image_inter_list[0].segment_id = 0xff;
+ image_inter_list[0].segment_id = KERNEL_SEGMENT_SYSTEM;
- //timer_activate_low_priority(anim_inter_timer);
- error("TODO: Inter version of animation files");
+ timer_activate_low_priority(anim_inter_timer);
} else {
timer1 += current_anim->frame[minFrame].ticks;
@@ -248,8 +240,53 @@ static void run_animation(int animIndex) {
speechStream = 0;
}
- if (foundSeries) {
- error("TODO: series block");
+ if (foundSeries && seriesMinFrame < seriesMaxFrame) {
+ // Get the memory needed for the page, rounded up
+ int frameIndex = seriesMinFrame - imageFrame1 + 2;
+ int pageMemNeeded = (pageTable[frameIndex - 1].memory_needed & ~15) + 16;
+ bool flag1 = false;
+
+ if (!seriesFlag1) {
+ if ((largeBufferEnd - largeBuffer2) <= pageMemNeeded) {
+ flag1 = true;
+ } else {
+ seriesFlag1 = true;
+ largeBuffer2 = largeBuffer;
+ }
+ }
+ if (seriesFlag1) {
+ if ((largeBuffer2 - largeBuffer1) <= pageMemNeeded)
+ flag1 = true;
+ }
+
+ if (seriesFlag2 && currentFrame <= seriesMinFrame && !picture_map.one_to_one)
+ flag1 = false;
+
+ if (flag1)
+ seriesFlag2 = false;
+
+ if (flag1) {
+ (void)sprite_data_load(animSeries, frameIndex, largeBuffer2);
+ largeBuffer2 += pageMemNeeded;
+ ++seriesMinFrame;
+ }
+
+ while (((speechIndex == -1 && currentFrame > imageFrame2) ||
+ (speechIndex != -1 && current_anim->speech[speechIndex].first_frame > imageFrame2)) &&
+ imageFrame2 < seriesMaxFrame) {
+ frameIndex = imageFrame2 - imageFrame1 + 1;
+ pageMemNeeded = (pageTable[frameIndex - 1].memory_needed & ~15) + 16;
+ largeBuffer1 += pageMemNeeded;
+ ++imageFrame2;
+
+ if (animSeries->index[frameIndex].data != largeBuffer1) {
+ largeBuffer1 = largeBuffer;
+ seriesFlag1 = false;
+
+ if (seriesMinFrame < imageFrame2)
+ largeBuffer2 = largeBuffer;
+ }
+ }
}
if (g_engine->shouldQuit())
@@ -490,6 +527,8 @@ static void animate() {
foundSeries = false;
imageIndex = -1;
+ seriesFlag1 = false;
+
for (ctr = 0; ctr < current_anim->num_images; ++ctr) {
int seriesId = current_anim->series_id[packIndex];
if (current_anim->image[ctr].series_id == seriesId) {
@@ -500,9 +539,9 @@ static void animate() {
if (foundSeries) {
Image &img = current_anim->image[imageIndex];
- imageFlags = imageFlags2 = img.flags;
- seriesMaxFrame = imageFlags - 1;
- seriesMinFrame = img.sprite_id;
+ imageFrame1 = imageFrame2 = img.flags;
+ seriesMinFrame = img.flags - 1;
+ seriesMaxFrame = img.flags + img.sprite_id - 1;
}
}
diff --git a/engines/mads/madsv2/animview/functions.cpp b/engines/mads/madsv2/animview/functions.cpp
index 6aa3b658d96..add2ccdd55d 100644
--- a/engines/mads/madsv2/animview/functions.cpp
+++ b/engines/mads/madsv2/animview/functions.cpp
@@ -20,6 +20,7 @@
*/
#include "common/textconsole.h"
+#include "graphics/palette.h"
#include "mads/madsv2/animview/functions.h"
#include "mads/madsv2/animview/animview.h"
#include "mads/madsv2/core/cycle.h"
@@ -192,6 +193,22 @@ void anim_setup_cycle(int fx) {
cycle_init(&anim_cycle_list, has_cycles && !fx);
}
+/**
+ * Handleas incremental fading by subtracting an amount from each palette
+ * entries' RGB values down towards zero
+ */
+bool anim_fade(Palette *pal, int fadeAmount) {
+ bool palChanged = false;
+ byte *rgb = (byte *)pal;
+ for (int count = 0; count < Graphics::PALETTE_SIZE; ++count, ++rgb) {
+ if (*rgb)
+ palChanged = true;
+ *rgb = MAX((int)*rgb - fadeAmount, 0);
+ }
+
+ return palChanged;
+}
+
} // namespace AnimView
} // namespace MADSV2
} // namespace MADS
diff --git a/engines/mads/madsv2/animview/functions.h b/engines/mads/madsv2/animview/functions.h
index 300ef176147..2be49480d4c 100644
--- a/engines/mads/madsv2/animview/functions.h
+++ b/engines/mads/madsv2/animview/functions.h
@@ -23,6 +23,7 @@
#define MADSV2_ANIMVIEW_FUNCTIONS_H
#include "common/stream.h"
+#include "mads/madsv2/core/pal.h"
namespace MADS {
namespace MADSV2 {
@@ -71,7 +72,8 @@ extern void read_resource(Common::SeekableReadStream *src);
extern void anim_peel();
-void anim_setup_cycle(int fx);
+extern void anim_setup_cycle(int fx);
+extern bool anim_fade(Palette *pal, int fadeAmount);
} // namespace AnimView
} // namespace MADSV2
Commit: 29fd17dc467433a5862bd0810da43a63c3c3d54c
https://github.com/scummvm/scummvm/commit/29fd17dc467433a5862bd0810da43a63c3c3d54c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-18T11:03:56+10:00
Commit Message:
MADS: PHANTOM: animview run_animation fixes
Changed paths:
engines/mads/madsv2/animview/animview.cpp
diff --git a/engines/mads/madsv2/animview/animview.cpp b/engines/mads/madsv2/animview/animview.cpp
index 3e5e1232cdc..c96560c97f2 100644
--- a/engines/mads/madsv2/animview/animview.cpp
+++ b/engines/mads/madsv2/animview/animview.cpp
@@ -163,7 +163,7 @@ static void anim_inter_timer() {
static void run_animation(int animIndex) {
int ctr;
- if (hasAnimInited) {
+ if (!hasAnimInited) {
hasAnimInited = true;
mouse_set_work_buffer(scr_work.data, scr_work.x);
mouse_set_view_port_loc(0, viewing_at_y, scr_work.x, scr_work.y + viewing_at_y - 1);
@@ -172,15 +172,16 @@ static void run_animation(int animIndex) {
auto &screen = *g_engine->getScreen();
if (viewing_at_y && anim_list[animIndex].show_bars) {
- screen.hLine(0, viewing_at_y, 319, 253);
- screen.hLine(0, viewing_at_y + scr_work.y, 319, 253);
+ screen.hLine(0, viewing_at_y - 2, 319, 253);
+ screen.hLine(0, viewing_at_y + scr_work.y + 1, 319, 253);
} else if (viewing_at_y) {
- screen.hLine(0, viewing_at_y, 319, 0);
- screen.hLine(0, viewing_at_y + scr_work.y, 319, 0);
+ screen.hLine(0, viewing_at_y - 2, 319, 0);
+ screen.hLine(0, viewing_at_y + scr_work.y + 1, 319, 0);
}
buffer_fill(scr_work, 0);
+ imageFrame = 0;
currentViewX = currentViewY = -1;
current_error_code = error_code;
@@ -190,7 +191,10 @@ static void run_animation(int animIndex) {
maxFrame = current_anim->num_frames;
minFrame = CLIP<int>(minFrame, 0, current_anim->num_frames);
- maxFrame = CLIP<int>(maxFrame, 0, maxFrame);
+ maxFrame = CLIP<int>(maxFrame, 0, current_anim->num_frames);
+ if (maxFrame < minFrame)
+ maxFrame = minFrame;
+
if (animIndex == 0)
timer1 = timer_read();
@@ -228,7 +232,7 @@ static void run_animation(int animIndex) {
// Main animation loop
while (currentFrame < maxFrame && !current_error_code) {
if (speechStream) {
- if (!(current_anim->load_flags & AA_LOAD_SPEECH)) {
+ if (current_anim->load_flags & AA_LOAD_SPEECH) {
//char speechName[80];
//MADS_FORMAT(speechName, current_anim->speech_file);
@@ -339,7 +343,7 @@ static void run_animation(int animIndex) {
}
}
- if ((animIndex <= (anim_count - 1)) &&
+ if ((animIndex == (anim_count - 1)) &&
(wait_for_music_at_end || !exit_immediately_at_end)) {
while (current_error_code == 0) {
// Check for any keypress or mouse clicks
@@ -366,8 +370,9 @@ static void run_animation(int animIndex) {
// Teardown for final animation
if (animIndex == (anim_count - 1) || current_error_code) {
timer_activate_low_priority(nullptr);
- g_engine->stopSpeech();
}
+
+ g_engine->stopSpeech();
}
/**
Commit: 28f1d6e7f15d5a4b89de51d9135efc27bb137b4b
https://github.com/scummvm/scummvm/commit/28f1d6e7f15d5a4b89de51d9135efc27bb137b4b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-18T11:03:56+10:00
Commit Message:
MADS: PHANTOM: animview animate fixes
Changed paths:
engines/mads/madsv2/animview/animview.cpp
diff --git a/engines/mads/madsv2/animview/animview.cpp b/engines/mads/madsv2/animview/animview.cpp
index c96560c97f2..2511af33097 100644
--- a/engines/mads/madsv2/animview/animview.cpp
+++ b/engines/mads/madsv2/animview/animview.cpp
@@ -398,6 +398,7 @@ static void animate() {
timer_install();
matte_init(-1);
+ cycle_list.num_cycles = 0;
// Preload resources used by the animations
for (count = 0; count < anim_count; ++count) {
@@ -407,7 +408,7 @@ static void animate() {
himem_preload_series(buf, 0);
if (anim_get_header_info(buf, &anim_in))
- return;
+ continue;
// Preload resources used by the animation
if (anim_in.load_flags & AA_LOAD_FONT) {
@@ -502,6 +503,7 @@ static void animate() {
int height = (scr_orig.y == 200) ? 200 : 156;
buffer_init(&scr_work, 320, height);
scr_inter = scr_work;
+ assert(scr_work.data);
viewing_at_y = (height == 200) ? 0 : (200 - height) / 2;
viewing_at_y2 = viewing_at_y;
@@ -525,12 +527,14 @@ static void animate() {
}
if (current_anim->misc_any_packed) {
- largeBufferSize = 0xffff;
+ largeBufferSize = 0xfffff; // Aribitrarily large value
largeBuffer = (byte *)mem_get(largeBufferSize);
+ assert(largeBuffer);
+
largeBufferEnd = largeBuffer + largeBufferSize - 1;
largeBuffer1 = largeBuffer2 = largeBuffer;
- foundSeries = false;
+ foundSeries = true;
imageIndex = -1;
seriesFlag1 = false;
@@ -538,10 +542,13 @@ static void animate() {
int seriesId = current_anim->series_id[packIndex];
if (current_anim->image[ctr].series_id == seriesId) {
imageIndex = ctr;
- foundSeries = true;
+ break;
}
}
+ if (imageIndex < 0)
+ foundSeries = false;
+
if (foundSeries) {
Image &img = current_anim->image[imageIndex];
imageFrame1 = imageFrame2 = img.flags;
More information about the Scummvm-git-logs
mailing list