[Scummvm-git-logs] scummvm master -> 5d37b084da2d3ce69f901cbe6e15f6ddec1716dd
dreammaster
noreply at scummvm.org
Wed May 20 11:14:27 UTC 2026
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
3a062771cd MADS: PHANTOM: Remove chdrive/chpath usage in savegame dialogs
3712145b4a MADS: PHANTOM: Remove unused functions from dialog.cpp
d3915e235d MADS: PHANTOM: Remove some disabled code blocks
b78dadfee3 MADS: DRAGONSPHERE: Added room 203
534fe83234 MADS: DRAGONSPHERE: Remainder of section 2 rooms
5d37b084da MADS: DRAGONSPHERE: Add section 3 rooms
Commit: 3a062771cd363411377661cebfab64ef9d0a66ee
https://github.com/scummvm/scummvm/commit/3a062771cd363411377661cebfab64ef9d0a66ee
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-20T21:13:23+10:00
Commit Message:
MADS: PHANTOM: Remove chdrive/chpath usage in savegame dialogs
Changed paths:
engines/mads/madsv2/core/dialog.cpp
engines/mads/madsv2/core/general.h
diff --git a/engines/mads/madsv2/core/dialog.cpp b/engines/mads/madsv2/core/dialog.cpp
index 5215877b472..029c4057682 100644
--- a/engines/mads/madsv2/core/dialog.cpp
+++ b/engines/mads/madsv2/core/dialog.cpp
@@ -651,12 +651,6 @@ ItemPtr dialog_add_filename(DialogPtr dialog, int x, int y, const char *prompt,
int list_num, dirs_num;
int base_item;
int message_line;
- int savedpath;
- int savedrive;
- char savepath[80];
- char mypath[80];
- char mypath2[80];
- int mydrive;
dialog->status |= DD_FILEMENU; // Note that we do in fact use files
@@ -672,10 +666,6 @@ ItemPtr dialog_add_filename(DialogPtr dialog, int x, int y, const char *prompt,
if ((listitem == NULL) || (dirsitem == NULL) || (dialog->lists_allocated > 0)) {
item = NULL;
} else {
-
- savedpath = (mads_getcwd(savepath, 80) != NULL);
- savedrive = mads_getdrive();
-
list_num = list_allocate(dialog);
dirs_num = list_allocate(dialog);
@@ -737,21 +727,7 @@ ItemPtr dialog_add_filename(DialogPtr dialog, int x, int y, const char *prompt,
dialog->fill_marker += (rows + 2);
- if (savedpath) {
- Common::strcpy_s(mypath, path);
- mads_strupr(mypath);
- mads_fullpath(mypath2, mypath, 80);
- mydrive = ((int)mypath2[0]) - '@';
- mads_chdir(mypath2);
- mads_chdrive(mydrive);
- }
-
dialog_load_directory(dialog, item);
-
- if (savedpath) {
- mads_chdir(savepath);
- mads_chdrive(savedrive);
- }
}
}
@@ -2954,17 +2930,11 @@ ItemPtr dialog_execute(DialogPtr dialog, ItemPtr active_item, ItemPtr default_bu
int mykey;
int count;
int buf;
- //int savedpath;
- int savedrive = 0;
int return_code;
- char savepath[80];
- char mypath[80];
- char mypath2[80];
long base_time;
long now_time;
long my_timeout;
long diff;
- int mydrive;
ItemPtr item;
struct KeyBuffer tempkey;
@@ -2975,19 +2945,6 @@ ItemPtr dialog_execute(DialogPtr dialog, ItemPtr active_item, ItemPtr default_bu
tempkey.len = 0;
}
- if (dialog->status & DD_FILEMENU) {
- //savedpath = (mads_getcwd(savepath, 80) != NULL);
- savedrive = mads_getdrive();
-
- if (dialog->path_item != NULL) {
- Common::strcpy_s(mypath, (dialog->path_item)->prompt);
- mads_fullpath(mypath2, mypath, 80);
- mydrive = ((int)mypath2[0]) - '@';
- mads_chdrive(mydrive);
- mads_chdir(mypath2);
- }
- }
-
return_code = false;
if (dialog->cancel_item == NULL) dialog->cancel_item = default_button;
@@ -3288,11 +3245,6 @@ ItemPtr dialog_execute(DialogPtr dialog, ItemPtr active_item, ItemPtr default_bu
mouse_end_cycle((!(dialog->status & DD_EXITFLAG)) && !mouse_stroke_going, true);
}
- if (dialog->status & DD_FILEMENU) {
- mads_chdir(savepath);
- mads_chdrive(savedrive);
- }
-
if (!return_code) {
item = &dialog->item[dialog->active_item];
} else {
diff --git a/engines/mads/madsv2/core/general.h b/engines/mads/madsv2/core/general.h
index 2a78c61d33b..35e9c60c5cd 100644
--- a/engines/mads/madsv2/core/general.h
+++ b/engines/mads/madsv2/core/general.h
@@ -156,9 +156,6 @@ inline char *mads_itoa(int value, char *buffer, int radix) {
return buffer;
}
-inline void mads_chdir(const char *path) {}
-inline void mads_chdrive(int drive) {}
-inline int mads_getdrive() { return 3; }
inline void mads_fullpath(char *buffer, const char *path, uint bufferCount) {
Common::strcpy_s(buffer, bufferCount, path);
}
Commit: 3712145b4a39a6345daaa25db7845ae9298a15c9
https://github.com/scummvm/scummvm/commit/3712145b4a39a6345daaa25db7845ae9298a15c9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-20T21:13:24+10:00
Commit Message:
MADS: PHANTOM: Remove unused functions from dialog.cpp
Changed paths:
engines/mads/madsv2/core/dialog.cpp
engines/mads/madsv2/core/dialog.h
diff --git a/engines/mads/madsv2/core/dialog.cpp b/engines/mads/madsv2/core/dialog.cpp
index 029c4057682..18131e3caa7 100644
--- a/engines/mads/madsv2/core/dialog.cpp
+++ b/engines/mads/madsv2/core/dialog.cpp
@@ -642,102 +642,6 @@ ItemPtr dialog_append_list(DialogPtr dialog, int x, int y, ItemPtr base_string,
return listitem;
}
-ItemPtr dialog_add_filename(DialogPtr dialog, int x, int y, const char *prompt,
- const char *default_val, const char *path, int rows,
- char *filebuf, int max_file_elements,
- char *dirsbuf, int max_dirs_elements) {
- ItemPtr item, listitem, dirsitem;
- ListPtr list, dirs;
- int list_num, dirs_num;
- int base_item;
- int message_line;
-
- dialog->status |= DD_FILEMENU; // Note that we do in fact use files
-
- base_item = dialog->num_items;
-
- item = dialog_add_string(dialog, x, y, prompt, default_val, DIALOG_FILE_BUFFER);
-
- if (item != NULL) {
-
- listitem = item_allocate(dialog, DD_I_FILELIST);
- dirsitem = item_allocate(dialog, DD_I_DIRSLIST);
-
- if ((listitem == NULL) || (dirsitem == NULL) || (dialog->lists_allocated > 0)) {
- item = NULL;
- } else {
- list_num = list_allocate(dialog);
- dirs_num = list_allocate(dialog);
-
- list = &dialog->lists[list_num];
- dirs = &dialog->lists[dirs_num];
-
- item->type = DD_I_FILENAME;
- listitem->type = DD_I_FILELIST;
- dirsitem->type = DD_I_DIRSLIST;
-
- listitem->keystroke = (int)'L';
- dirsitem->keystroke = (int)'D';
-
- dialog_add_blank(dialog);
- dialog->path_item = dialog_add_message(dialog, DD_IX_LEFT, DD_IY_AUTOFILL, path);
- dialog->string_marker += (80 - strlen(path));
- dialog_add_blank(dialog);
-
- message_line = dialog->fill_marker;
- dialog_add_message(dialog, DD_IX_LEFT, message_line, "File ~List:");
- dialog_add_message(dialog, 44, message_line, "~Drives / Dirs:");
-
- list->rows = rows;
- list->columns = 3;
- dirs->rows = rows;
- dirs->columns = 1;
-
- dialog->width = MAX<short>(dialog->width, DIALOG_FILE_WIDTH);
-
- list->entry_width = 12;
- list->element_offset = 13;
- list->max_elements = max_file_elements;
- list->base_entry = 0;
- list->picked_entry = -1;
- list->thumb = -1;
-
- dirs->entry_width = 12;
- dirs->element_offset = 13;
- dirs->max_elements = max_dirs_elements;
- dirs->base_entry = 0;
- dirs->picked_entry = -1;
- dirs->thumb = -1;
-
- list->window.ul_x = 0;
- dirs->window.ul_x = 43;
-
- list->window.ul_y = dialog->fill_marker;
- dirs->window.ul_y = dialog->fill_marker;
-
- item->status = listitem->id;
- listitem->status = item->id;
- dirsitem->status = item->id;
-
- listitem->buf_id = list_num;
- dirsitem->buf_id = dirs_num;
-
- list->list = filebuf;
- dirs->list = dirsbuf;
-
- dialog->fill_marker += (rows + 2);
-
- dialog_load_directory(dialog, item);
- }
- }
-
- if (item == NULL) {
- dialog->num_items = base_item;
- }
-
- return item;
-}
-
void dialog_set_colors(int normal, int select, int hilite, int greyed) {
dialog_default_normal = normal;
dialog_default_select = select;
@@ -874,26 +778,6 @@ void dialog_destroy_persist(DialogPtr dialog) {
}
}
-DialogPtr dialog_file_create(DialogPtr dialog, int ul_x, int ul_y,
- int normal_color, int select_color, int hilite_color,
- ItemPtr *ok_item, ItemPtr *first_item, const char *default_val,
- const char *path, int rows, char *filebuf, int maxfiles,
- char *dirsbuf, int maxdirs, const char *prompt) {
- dialog = dialog_create(dialog, ul_x, ul_y, DIALOG_FILE_WIDTH,
- normal_color, select_color, hilite_color);
-
- dialog_add_message(dialog, DD_IX_CENTER, DD_IY_AUTOFILL, prompt);
-
- *ok_item = dialog_add_button(dialog, DD_IX_LEFT, DD_IY_BUTTON, " OK ");
- dialog_add_button(dialog, DD_IX_RIGHT, DD_IY_BUTTON, CANCEL_BUTTON);
- *first_item = dialog_add_filename(dialog, DD_IX_LEFT, DD_IY_AUTOFILL, "~File Name: ",
- default_val, path, rows,
- filebuf, maxfiles,
- dirsbuf, maxdirs);
-
- return dialog;
-}
-
void dialog_set_list_callback(DialogPtr dialog, void (*(callback))()) {
dialog->callback = callback;
}
@@ -1023,29 +907,10 @@ char *dialog_read_list(DialogPtr dialog, ItemPtr item) {
return dialog->buffer[item->buf_id];
}
-char *dialog_read_pathname(DialogPtr dialog, ItemPtr item) {
- return (dialog->path_item)->prompt;
-}
-
char *dialog_read_filename(DialogPtr dialog, ItemPtr item) {
return dialog->buffer[item->buf_id];
}
-char *dialog_read_filepath(DialogPtr dialog, ItemPtr item) {
- int mylen;
-
- Common::strcpy_s(temp_buf, (dialog->path_item)->prompt);
- mylen = strlen(temp_buf);
-
- if (temp_buf[mylen - 1] != '\\') {
- Common::strcat_s(temp_buf, "\\");
- }
-
- Common::strcat_s(temp_buf, dialog->buffer[item->buf_id]);
-
- return (temp_buf);
-}
-
/**
* Updates the status of a dialog box based on its status flag
*
@@ -3254,97 +3119,6 @@ ItemPtr dialog_execute(DialogPtr dialog, ItemPtr active_item, ItemPtr default_bu
return item;
}
-char *dialog_select_file(const char *prompt, const char *path, const char *filespec, char *output) {
- DialogPtr dialog;
- ItemPtr ok, first_item, result;
- char *filebuf;
- char *dirbuf;
-
- filebuf = (char *)mem_get(3000);
- if (filebuf == NULL) return NULL;
-
- dirbuf = (char *)mem_get(1500);
- if (dirbuf == NULL) {
- mem_free(filebuf);
- return NULL;
- }
-
- dialog = dialog_file_create(NULL, DD_CENTER, DD_CENTER,
- DD_DEFAULT, DD_DEFAULT, DD_DEFAULT,
- &ok, &first_item,
- filespec, path, screen_max_y - 18,
- filebuf, 200, dirbuf, 100, prompt);
-
- result = dialog_execute(dialog, first_item, ok, NULL);
-
- if (result != dialog->cancel_item) {
- Common::strcpy_s(output, 65536, dialog_read_filepath(dialog, first_item));
- } else {
- output = NULL;
- }
-
- dialog_destroy(dialog);
-
- mem_free(filebuf);
- mem_free(dirbuf);
-
- return output;
-}
-
-char *dialog_enter_string(char *reply, const char *top_prompt, const char *left_prompt,
- char *my_default, int maxlen) {
- char work[100];
-
- DialogPtr dialog;
- ItemPtr string, ok, cancel, result;
-
- if (strlen(my_default) > (size_t)maxlen)
- my_default[maxlen - 1] = 0; // Trim default
-
- if (left_prompt == NULL)
- Common::strcpy_s(work, "~Reply: ");
- else
- Common::strcpy_s(work, left_prompt);
-
- dialog = dialog_create(NULL, DD_CENTER, DD_CENTER, DD_AUTO,
- DD_DEFAULT, DD_DEFAULT, DD_DEFAULT);
-
- dialog_add_blank(dialog);
- dialog_add_message(dialog, DD_IX_CENTER, DD_IY_AUTOFILL, top_prompt);
- dialog_add_blank(dialog);
- string = dialog_add_string(dialog, DD_IX_LEFT, DD_IY_AUTOFILL, work,
- my_default, maxlen);
- dialog_add_blank(dialog);
- ok = dialog_add_button(dialog, DD_IX_LEFT, DD_IY_BUTTON, " OK ");
- cancel = dialog_add_button(dialog, DD_IX_RIGHT, DD_IY_BUTTON, "Cancel");
-
- result = dialog_execute(dialog, string, ok, NULL);
-
- Common::strcpy_s(work, dialog_read_string(dialog, string));
-
- dialog_destroy(dialog);
-
- if (result == cancel)
- return(NULL);
-
- Common::strcpy_s(reply, 65536, work);
- return(reply);
-}
-
-int dialog_enter_int(char *top_prompt, int my_default) {
- char work[20], work1[20];
-
- if (my_default != 0)
- mads_itoa(my_default, work, 10);
- else
- Common::strcpy_s(work, "");
-
- if (dialog_enter_string(work1, top_prompt, "~Value:", work, 12) == NULL)
- return(0);
-
- return atoi(work1);
-}
-
DialogPtr dialog_create_default(void) {
return(dialog_create(NULL, DD_CENTER, DD_CENTER, DD_AUTO,
DD_DEFAULT, DD_DEFAULT, DD_DEFAULT));
diff --git a/engines/mads/madsv2/core/dialog.h b/engines/mads/madsv2/core/dialog.h
index 3e1bc0c46c0..8e32b44815a 100644
--- a/engines/mads/madsv2/core/dialog.h
+++ b/engines/mads/madsv2/core/dialog.h
@@ -264,13 +264,6 @@ extern ItemPtr dialog_add_listbased(DialogPtr dialog, int x, int y, const char *
const char *default_val, int width, const char *title, char *mylist,
int elements, int element_offset, int entry_width, int rows, int columns);
-/**
- * Adds a filename-base string item to the dialog box
- */
-extern ItemPtr dialog_add_filename(DialogPtr dialog, int x, int y, const char *prompt,
- const char *default_val, const char *path, int rows, char *filebuf, int max_file_elements,
- char *dirsbuf, int max_dirs_elements);
-
/**
* Appends a second list to a listbased string
*/
@@ -298,14 +291,6 @@ extern void dialog_destroy(DialogPtr dialog);
*/
extern void dialog_destroy_persist(DialogPtr dialog);
-/**
- * Creates a dialog box and adds a filename entry to it
- */
-extern DialogPtr dialog_file_create(DialogPtr dialog, int ul_x, int ul_y,
- int normal_color, int select_color, int hilite_color, ItemPtr *ok_item,
- ItemPtr *first_item, const char *default_val, const char *path, int rows,
- char *filebuf, int maxfiles, char *dirsbuf, int maxdirs, const char *prompt);
-
/**
* Assembly routine to read a file directory into the specified
* list structure. "Wild" is the wildcard spec to match (e.g. "*.*")
@@ -370,31 +355,16 @@ extern void dialog_set_checkbox_callback(DialogPtr dialog, void (*(callback))())
*/
extern int dialog_read_checkbox(DialogPtr dialog, ItemPtr item);
-/**
- * Returns a pointer to the specified string buffer
- */
-extern char *dialog_read_string(DialogPtr dialog, ItemPtr item);
-
/**
* Returns a pointer to the specified list-based string
*/
extern char *dialog_read_list(DialogPtr dialog, ItemPtr item);
-/**
- * Returns the dialog box's path
- */
-extern char *dialog_read_pathname(DialogPtr dialog, ItemPtr item);
-
/**
* Returns the filename selected by the user
*/
extern char *dialog_read_filename(DialogPtr dialog, ItemPtr item);
-/**
- * Returns the filename and full path selected by the user
- */
-extern char *dialog_read_filepath(DialogPtr dialog, ItemPtr item);
-
/**
* Routine to display the entire dialog box
*/
@@ -407,17 +377,6 @@ extern void dialog_show_all(DialogPtr dialog);
extern ItemPtr dialog_execute(DialogPtr dialog, ItemPtr active_item,
ItemPtr default_button, KeyPtr key_buffer);
-extern char *dialog_select_file(const char *prompt, const char *path,
- const char *filespec, char *output);
-extern char *dialog_enter_string(char *reply, const char *top_prompt,
- const char *left_prompt, char *my_default, int maxlen);
-
-/**
- * Prompts user to enter an integer value (displays default).
- * Returns 0 if user aborted, or entry was out of range.
- */
-extern int dialog_enter_int(const char *top_prompt, int my_default);
-
extern DialogPtr dialog_create_default();
/**
Commit: d3915e235d572a440532f8fb5b94f149a8a333ff
https://github.com/scummvm/scummvm/commit/d3915e235d572a440532f8fb5b94f149a8a333ff
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-20T21:13:24+10:00
Commit Message:
MADS: PHANTOM: Remove some disabled code blocks
Changed paths:
engines/mads/madsv2/core/config.cpp
engines/mads/madsv2/core/dialog.cpp
diff --git a/engines/mads/madsv2/core/config.cpp b/engines/mads/madsv2/core/config.cpp
index 920cb560fa3..b61afec841e 100644
--- a/engines/mads/madsv2/core/config.cpp
+++ b/engines/mads/madsv2/core/config.cpp
@@ -93,27 +93,7 @@ void global_load_config_parameters() {
kernel_panning_speed = config_file.panning_speed;
kernel_screen_fade = config_file.screen_fade;
-#if 0
- kernel.sound_card = sound_get_letter(config_file.sound_card_type);
- music_on = config_file.music_flag;
- sound_on = config_file.sound_flag;
- speech_on = config_file.speech_flag;
-
- int mem = config_file.high_memory_mode;
-
- if ((mem == MEMORY_NO_EMS) || (mem == MEMORY_CONVENTIONAL)) {
- himem_preload_ems_disabled = true;
- }
-
- if ((mem == MEMORY_NO_XMS) || (mem == MEMORY_CONVENTIONAL)) {
- himem_preload_xms_disabled = true;
- }
-
- if (config_file.speech_version_installed) {
- speech_system_requested = true;
- }
-#endif
if (config_file.cd_version_installed) {
env_search_cd = true;
env_cd_drive = (char)config_file.cd_drive;
@@ -125,14 +105,6 @@ void global_unload_config_parameters(void) {
config_file.panning_speed = kernel_panning_speed;
config_file.screen_fade = kernel_screen_fade;
-#if 0
- config_file.music_flag = music_on;
- config_file.sound_flag = sound_on;
- config_file.speech_flag = speech_on;
-
- config_file.sound_card_address = sound_board_address;
- config_file.sound_card_type = sound_board_type;
-#endif
}
} // namespace MADSV2
diff --git a/engines/mads/madsv2/core/dialog.cpp b/engines/mads/madsv2/core/dialog.cpp
index 18131e3caa7..19a53106ada 100644
--- a/engines/mads/madsv2/core/dialog.cpp
+++ b/engines/mads/madsv2/core/dialog.cpp
@@ -1193,34 +1193,6 @@ static void dialog_show_message(DialogPtr dialog, ItemPtr item) {
mouse_show();
}
-#if 0
-/**
- * Clears a message previously output with dialog_show_message ().
- * Currently, the only kind of message that could change (and thus
- * need to be cleared) is the pathname for file items, which is
- * handled internally.
- *
- * @param dialog Dialog
- * @param item Message item
- */
-static void dialog_clear_message(DialogPtr dialog, ItemPtr item) {
- int cx, cy;
- int count, bound;
-
- mouse_hide();
-
- cx = item->x + dialog->base_x;
- cy = item->y + dialog->base_y;
- bound = strlen(item->prompt);
-
- for (count = 0; count < bound; count++) {
- cx = screen_put(" ", dialog->normal_color, dialog->normal_color, cx, cy);
- }
-
- mouse_show();
-}
-#endif
-
/**
* Displays (and updates) a checkbox item
*
@@ -2028,70 +2000,6 @@ static void dialog_do_search(DialogPtr dialog, ItemPtr item) {
}
}
-/**
- * Routine to change the directory of the filename window
- *
- * @param dialog Dialog
- * @param item Item
- */
-static void dialog_set_new_directory(DialogPtr dialog, ItemPtr item) {
- int buf;
- //int newdrive;
- ItemPtr baseitem; //, fileitem, pathitem;
-
- baseitem = &dialog->item[item->status];
- //fileitem = &dialog->item[baseitem->status];
- buf = baseitem->buf_id;
-
- Common::strcpy_s(temp_buf, dialog->buffer[buf]);
- //pathitem = dialog->path_item;
-#ifdef TODO
- if (temp_buf[1] == ':') {
- // Change to a new drive, if requested
- newdrive = ((int)temp_buf[0]) - 64;
- mads_chdrive(newdrive);
-
- dialog_clear_message(dialog, pathitem);
- //mads_getcwd(temp_buf, DIALOG_MAX_PROMPT_CHARS);
- Common::strcpy_s(temp_buf, "");
- Common::strcpy_s(pathitem->prompt, 65536, temp_buf);
-
- } else {
- // otherwise, change to a new directory
- mads_chdir(temp_buf);
-
- dialog_clear_message(dialog, pathitem);
-
- if (mads_getcwd(temp_buf, DIALOG_MAX_PROMPT_CHARS) != NULL) {
- Common::strcpy_s(pathitem->prompt, temp_buf);
- } else {
- Common::strcpy_s(temp_buf, pathitem->prompt);
- mads_chdir(temp_buf);
- }
- }
-
- // Load a wildcard into the entry area
- if ((strchr(dialog->buffer[buf], '*') == NULL) &&
- (strchr(dialog->buffer[buf], '?') == NULL)) {
- Common::strcpy_s(dialog->buffer[buf], "*.*");
- dialog->buf_select[buf] = true;
- dialog->buf_cursor[buf] = 0;
- dialog->buf_selbase[buf] = 0;
- dialog->buf_seltarget[buf] = 3;
- }
-
- // Load up the new directory and display
- dialog_load_directory(dialog, baseitem);
- dialog_show_any(dialog, pathitem);
- dialog_update_any(dialog, baseitem, false);
- dialog_update_any(dialog, fileitem, false);
- dialog_update_any(dialog, item, false);
- dialog_update_active(dialog, 0, false, false);
-#else
- warning("TODO: dialog_set_new_directory");
-#endif
-}
-
/**
* Routine to handle scrolling around in a list window. Used to
* drive both mouse and cursor scroll routines.
@@ -2498,13 +2406,8 @@ static void dialog_exec_mouse_list(DialogPtr dialog, ItemPtr item) {
// Handle double-click if any
if (mouse_start_stroke && (old_pick == list->picked_entry)) {
if ((long)timer_read_dos() <= mouse_list_timing + MOUSE_DOUBLE_TIMING) {
- if (item->type == DD_I_DIRSLIST) {
- dialog_set_new_directory(dialog, item);
- abort = true;
- } else {
- dialog->active_item = (dialog->default_item)->id;
- dialog->status |= DD_EXITFLAG;
- }
+ dialog->active_item = (dialog->default_item)->id;
+ dialog->status |= DD_EXITFLAG;
}
}
if (mouse_start_stroke) mouse_list_timing = timer_read_dos();
@@ -2918,10 +2821,6 @@ ItemPtr dialog_execute(DialogPtr dialog, ItemPtr active_item, ItemPtr default_bu
case enter_key:
switch (item->type) {
- case DD_I_DIRSLIST:
- dialog_set_new_directory(dialog, item);
- break;
-
case DD_I_BUTTON:
dialog->status |= DD_EXITFLAG;
break;
Commit: b78dadfee3c6d1954d9a084b6978812ba11bee31
https://github.com/scummvm/scummvm/commit/b78dadfee3c6d1954d9a084b6978812ba11bee31
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-20T21:13:24+10:00
Commit Message:
MADS: DRAGONSPHERE: Added room 203
Changed paths:
engines/mads/madsv2/core/kernel.cpp
engines/mads/madsv2/dragonsphere/mads/conv.h
engines/mads/madsv2/dragonsphere/mads/inventory.h
engines/mads/madsv2/dragonsphere/mads/words.h
engines/mads/madsv2/dragonsphere/rooms/room203.cpp
diff --git a/engines/mads/madsv2/core/kernel.cpp b/engines/mads/madsv2/core/kernel.cpp
index d0122e2363c..71c16299c0a 100644
--- a/engines/mads/madsv2/core/kernel.cpp
+++ b/engines/mads/madsv2/core/kernel.cpp
@@ -871,6 +871,19 @@ int kernel_seq_forward(int series_id, int mirror, word ticks, word interval_tick
start_ticks, expire));
}
+
+int kernel_seq_forward_scroll(int series_id, int mirror,
+ word ticks, word interval_ticks, word start_ticks, int expire) {
+ int depth = 0;
+ SpritePtr sprite;
+
+ sprite = &series_list[series_id]->index[0];
+
+ return kernel_seq_add(series_id, mirror, 1, 0, 0, AA_LINEAR, 1,
+ depth, 100, true, 0, 0, ticks, interval_ticks,
+ start_ticks, expire);
+}
+
int kernel_seq_pingpong(int series_id, int mirror,
word ticks, word interval_ticks,
word start_ticks,
@@ -889,6 +902,18 @@ int kernel_seq_pingpong(int series_id, int mirror,
start_ticks, expire));
}
+int kernel_seq_pingpong_scroll(int series_id, int mirror,
+ word ticks, word interval_ticks, word start_ticks, int expire) {
+ int depth = 0;
+ SpritePtr sprite;
+
+ sprite = &series_list[series_id]->index[0];
+
+ return kernel_seq_add(series_id, mirror, 1, 0, 0, AA_PINGPONG, 1,
+ depth, 100, true, 0, 0, ticks, interval_ticks,
+ start_ticks, expire);
+}
+
int kernel_seq_backward(int series_id, int mirror, word ticks, word interval_ticks,
word start_ticks, int expire) {
int depth;
@@ -1038,6 +1063,17 @@ int kernel_seq_stamp(int series_id, int mirror, int sprite) {
return (id);
}
+int kernel_seq_stamp_scroll(int series_id, int mirror, int sprite) {
+ int id;
+
+ id = kernel_seq_forward_scroll(series_id, mirror, 32767, 0, 0, 0);
+ if (id >= 0) {
+ kernel_seq_range(id, sprite, sprite);
+ sequence_list[id].loop_direction = AA_STAMP;
+ }
+ return (id);
+}
+
int kernel_seq_trigger(int sequence_id,
int trigger_type,
int trigger_sprite,
diff --git a/engines/mads/madsv2/dragonsphere/mads/conv.h b/engines/mads/madsv2/dragonsphere/mads/conv.h
index 7615c30f086..edc3f5d9205 100644
--- a/engines/mads/madsv2/dragonsphere/mads/conv.h
+++ b/engines/mads/madsv2/dragonsphere/mads/conv.h
@@ -185,6 +185,12 @@ enum {
conv047_take_back_d_d = 48
};
+enum {
+ conv049_recheck = 1,
+ conv049_exit_b_b = 37,
+ conv049_polyquiz_b_b = 33
+};
+
enum {
conv054_restart = 1,
conv054_exit_b_b = 10,
diff --git a/engines/mads/madsv2/dragonsphere/mads/inventory.h b/engines/mads/madsv2/dragonsphere/mads/inventory.h
index 56fac545448..221fce4c1ea 100644
--- a/engines/mads/madsv2/dragonsphere/mads/inventory.h
+++ b/engines/mads/madsv2/dragonsphere/mads/inventory.h
@@ -36,6 +36,7 @@ enum {
bone = 6,
fruit = 7,
pid_doll = 8,
+ polystone = 9,
key_crown = 13,
statue = 15,
soul_egg = 17,
diff --git a/engines/mads/madsv2/dragonsphere/mads/words.h b/engines/mads/madsv2/dragonsphere/mads/words.h
index 40c21d32e4e..7dec94e2637 100644
--- a/engines/mads/madsv2/dragonsphere/mads/words.h
+++ b/engines/mads/madsv2/dragonsphere/mads/words.h
@@ -40,6 +40,7 @@ enum {
words_close = 11,
words_throw = 12,
words_walk_to = 13,
+ words_walk_into = 39,
words_floor = 16,
words_walk_across = 17,
words_rug = 18,
@@ -74,6 +75,7 @@ enum {
words_bottle_of_flies = 80,
N_WaterBubbles = 86,
words_thrust = 87,
+ words_mud = 88,
words_torch = 93,
words_pour_contents_of = 99,
words_rope = 101,
@@ -100,6 +102,8 @@ enum {
words_door = 166,
words_wall_switch = 167,
words_stairs = 168,
+ words_cave = 149,
+ words_rock = 172,
words_walk_down = 169,
words_edge_of_abyss = 170,
words_cave_ceiling = 173,
@@ -173,6 +177,7 @@ enum {
words_parchment = 290,
words_king = 291,
words_climb_up = 296,
+ words_boulders = 320,
words_path_to_west = 299,
words_path_to_east = 313,
words_sconce = 329,
@@ -187,6 +192,7 @@ enum {
words_grotto = 345,
words_climb_through = 346,
words_Queen_Mother = 347,
+ words_eye = 368,
words_sit_on = 363,
words_teleportal = 440,
words_Soptus_Ecliptus = 448,
@@ -199,9 +205,15 @@ enum {
words_nose_rock = 513,
words_path = 522,
words_guards = 523,
+ words_eye_rock = 533,
+ words_body_tree = 534,
+ words_clearing = 535,
words_tentacles = 536,
words_spell_shield = 537,
words_pool_monster = 538,
+ words_shifter = 544,
+ words_wise_shifter = 549,
+ words_boulder = 553,
words_Dragonsphere = 571
};
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room203.cpp b/engines/mads/madsv2/dragonsphere/rooms/room203.cpp
index f54546c6a5a..02a111ef5f1 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room203.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room203.cpp
@@ -1,4 +1,4 @@
-/* ScummVM - Graphic Adventure Engine
+/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
@@ -19,10 +19,15 @@
*
*/
+#include "mads/madsv2/core/camera.h"
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/matte.h"
+#include "mads/madsv2/core/object.h"
+#include "mads/madsv2/core/player.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
@@ -39,6 +44,32 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15];
+ int16 sequence[15];
+ int16 animation[4];
+
+ int16 wise_frame;
+ int16 wise_action;
+ int16 wise_talk_count;
+ int16 anim_0_running;
+
+ int16 beard_frame;
+ int16 beard_talk_count;
+ int16 anim_1_running;
+
+ int16 rock_l_base;
+ int16 dyn_rock_l;
+
+ int16 rock_r_base;
+ int16 dyn_rock_r;
+
+ int16 vine_base;
+ int16 dyn_vine;
+
+ int16 eye;
+ int16 face_left;
+ int16 face_right;
+ int16 prevent;
};
#define local (&scratch)
@@ -46,33 +77,832 @@ struct Scratch {
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
+static Scratch scratch;
+
+#define fx_rock_l 0
+#define fx_rock_r 1
+#define fx_vine 2
+#define fx_eye 3
+#define fx_face_left 4
+#define fx_face_right 5
+#define fx_take 6
+
+#define ROOM_203_EYE 60
+#define ROOM_203_FACE_LEFT 64
+#define ROOM_203_FACE_RIGHT 68
+#define ROOM_203_YOU_TALK 73
+#define ROOM_203_ME_TALK 75
+#define ROOM_203_NEW_ROOM 90
+
+#define camera_ratio_1 1
+#define camera_ratio_2 2
+
+#define PLAYER_X_FROM_201 -10
+#define PLAYER_Y_FROM_201 121
+#define WALK_TO_X_FROM_201 15
+#define WALK_TO_Y_FROM_201 121
+
+#define PLAYER_X_FROM_204 411
+#define PLAYER_Y_FROM_204 94
+#define WALK_TO_X_FROM_204 385
+#define WALK_TO_Y_FROM_204 104
+
+#define PLAYER_X_FROM_205 495
+#define PLAYER_Y_FROM_205 150
+#define WALK_TO_X_FROM_205 466
+#define WALK_TO_Y_FROM_205 147
+
+#define EYE_LEFT 0
+#define EYE_RIGHT 1
+#define EYE_MOVING 2
+
+#define FACE_NORMAL 0
+#define FACE_MOVING 1
+#define FACE_ABNORMAL 2
+#define FACE_NOT_THERE 3
+#define FACE_THERE 4
+
+#define FREEZE 0
+#define TALK 1
+#define POINT 2
+#define GIVE 3
+
+#define CONV_49_KING 49
+
+static void set_203_rock_r_position() {
+ int center;
+ int difference;
+ int direction;
+ int distance;
+ int displace;
+ int x;
+ int xs;
+
+ center = picture_view_x + (video_x >> 1);
+
+ if (seq[fx_rock_r] >= 0) {
+ kernel_seq_delete(seq[fx_rock_r]);
+ }
+
+ difference = center - local->rock_r_base;
+ direction = neg(sgn(difference));
+ distance = abs(difference);
+
+ displace = (int)(((long)distance * camera_ratio_1) / camera_ratio_2);
+ displace = sgn_in(displace, direction);
+
+ x = local->rock_r_base + displace - 1;
+ xs = series_list[ss[fx_rock_r]]->index[0].xs;
+
+ if (((x - ((xs >> 1) + 1)) >= (picture_view_x + video_x)) ||
+ ((x + ((xs >> 1) + 1)) < picture_view_x)) {
+ seq[fx_rock_r] = -1;
+ } else {
+ seq[fx_rock_r] = kernel_seq_stamp_scroll(ss[fx_rock_r], false, 1);
+ kernel_seq_loc(seq[fx_rock_r], x, 155);
+ kernel_seq_depth(seq[fx_rock_r], 1);
+ }
+}
+
+static void set_203_rock_l_position() {
+ int center;
+ int difference;
+ int direction;
+ int distance;
+ int displace;
+ int x;
+ int xs;
+
+ center = picture_view_x + (video_x >> 1);
+
+ if (seq[fx_rock_l] >= 0) {
+ kernel_seq_delete(seq[fx_rock_l]);
+ }
+
+ difference = center - local->rock_l_base;
+ direction = neg(sgn(difference));
+ distance = abs(difference);
+
+ displace = (int)(((long)distance * camera_ratio_1) / camera_ratio_2);
+ displace = sgn_in(displace, direction);
+
+ x = local->rock_l_base + displace - 1;
+ xs = series_list[ss[fx_rock_l]]->index[0].xs;
+
+ if (((x - ((xs >> 1) + 1)) >= (picture_view_x + video_x)) ||
+ ((x + ((xs >> 1) + 1)) < picture_view_x)) {
+ seq[fx_rock_l] = -1;
+ } else {
+ seq[fx_rock_l] = kernel_seq_stamp_scroll(ss[fx_rock_l], false, 1);
+ kernel_seq_loc(seq[fx_rock_l], x, 155);
+ kernel_seq_depth(seq[fx_rock_l], 1);
+ }
+}
+
+static void set_203_vine_position() {
+ int center;
+ int difference;
+ int direction;
+ int distance;
+ int displace;
+ int x;
+ int xs;
+
+ center = picture_view_x + (video_x >> 1);
+
+ if (seq[fx_vine] >= 0) {
+ kernel_seq_delete(seq[fx_vine]);
+ }
+
+ difference = center - local->vine_base;
+ direction = neg(sgn(difference));
+ distance = abs(difference);
+
+ displace = (int)(((long)distance * camera_ratio_1) / camera_ratio_2);
+ displace = sgn_in(displace, direction);
+
+ x = local->vine_base + displace - 1;
+ xs = series_list[ss[fx_vine]]->index[0].xs;
+
+ if (((x - ((xs >> 1) + 1)) >= (picture_view_x + video_x)) ||
+ ((x + ((xs >> 1) + 1)) < picture_view_x)) {
+ seq[fx_vine] = -1;
+ } else {
+ seq[fx_vine] = kernel_seq_stamp_scroll(ss[fx_vine], false, 1);
+ kernel_seq_loc(seq[fx_vine], x, 24);
+ kernel_seq_depth(seq[fx_vine], 1);
+ }
+}
+
+static void handle_anim_wise() {
+ int wise_reset_frame;
+ int it;
+
+ if (kernel_anim[aa[0]].frame != local->wise_frame) {
+ local->wise_frame = kernel_anim[aa[0]].frame;
+ wise_reset_frame = -1;
+
+ switch (local->wise_frame) {
+
+ case 57:
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_take] = kernel_seq_pingpong(ss[fx_take], true, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_SPRITE, 6, 1);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_EXPIRE, 0, 2);
+ kernel_seq_depth(seq[fx_take], 3);
+ kernel_seq_range(seq[fx_take], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_player(seq[fx_take], true);
+ break;
+
+ case 58:
+ if (local->wise_action == GIVE) {
+ wise_reset_frame = 57;
+ }
+ break;
+
+ case 1:
+ case 22:
+ case 40:
+ case 71:
+ case 63:
+ case 45:
+ switch (local->wise_action) {
+ case FREEZE:
+ wise_reset_frame = 0;
+ break;
+ case POINT:
+ wise_reset_frame = 40;
+ local->wise_action = FREEZE;
+ break;
+ case GIVE:
+ wise_reset_frame = 50;
+ break;
+ case TALK:
+ it = imath_random(1, 4);
+ switch (it) {
+ case 1: wise_reset_frame = 4; break;
+ case 2: wise_reset_frame = 22; break;
+ case 3: wise_reset_frame = 1; break;
+ case 4: wise_reset_frame = 63; break;
+ }
+ local->wise_action = FREEZE;
+ break;
+ }
+ break;
+
+ case 66:
+ case 67:
+ case 68:
+ case 69:
+ switch (local->wise_action) {
+ case TALK:
+ wise_reset_frame = imath_random(65, 68);
+ ++local->wise_talk_count;
+ if (local->wise_talk_count > 15) {
+ local->wise_action = FREEZE;
+ local->wise_talk_count = 0;
+ wise_reset_frame = 69;
+ }
+ break;
+ default:
+ wise_reset_frame = 69;
+ break;
+ }
+ break;
+
+ case 2:
+ case 3:
+ case 4:
+ switch (local->wise_action) {
+ case TALK:
+ wise_reset_frame = imath_random(1, 3);
+ ++local->wise_talk_count;
+ if (local->wise_talk_count > 15) {
+ local->wise_action = FREEZE;
+ local->wise_talk_count = 0;
+ wise_reset_frame = 0;
+ }
+ break;
+ default:
+ wise_reset_frame = 0;
+ break;
+ }
+ break;
+ }
+
+ if (wise_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], wise_reset_frame);
+ local->wise_frame = wise_reset_frame;
+ }
+ }
+}
+
+static void handle_anim_beard() {
+ int beard_reset_frame;
+
+ if (kernel_anim[aa[1]].frame != local->beard_frame) {
+ local->beard_frame = kernel_anim[aa[1]].frame;
+ beard_reset_frame = -1;
+
+ ++local->beard_talk_count;
+ if (local->beard_talk_count > imath_random(1, 3)) {
+ if (local->beard_frame == 1) {
+ beard_reset_frame = imath_random(0, 1);
+ } else if (local->beard_frame == 2) {
+ beard_reset_frame = imath_random(0, 2);
+ } else if (local->beard_frame == 3) {
+ beard_reset_frame = imath_random(1, 3);
+ } else if (local->beard_frame == 4) {
+ beard_reset_frame = imath_random(2, 4);
+ } else if (local->beard_frame == 5) {
+ beard_reset_frame = imath_random(3, 4);
+ }
+ local->beard_talk_count = 0;
+ } else {
+ beard_reset_frame = local->beard_frame - 1;
+ }
+
+ if (beard_reset_frame >= 0) {
+ kernel_reset_animation(aa[1], beard_reset_frame);
+ local->beard_frame = beard_reset_frame;
+ }
+ }
+}
+
+static void process_conv_wise() {
+ int you_trig_flag = false;
+ int me_trig_flag = false;
+
+ if (player_verb == conv049_polyquiz_b_b) {
+ conv_hold();
+ you_trig_flag = true;
+ me_trig_flag = true;
+ local->wise_action = GIVE;
+ }
+
+ if (player_verb == conv049_exit_b_b) {
+ *conv_my_next_start = conv049_recheck;
+ conv_abort();
+ you_trig_flag = true;
+ me_trig_flag = true;
+ player.commands_allowed = false;
+ player_walk(PLAYER_X_FROM_204, PLAYER_Y_FROM_204, FACING_EAST);
+ player_walk_trigger(ROOM_203_NEW_ROOM);
+ }
+
+ if (kernel.trigger == ROOM_203_YOU_TALK) {
+ local->wise_action = TALK;
+ }
+
+ if (!you_trig_flag) {
+ conv_you_trigger(ROOM_203_YOU_TALK);
+ }
+
+ local->wise_talk_count = 0;
+}
void room_203_init() {
+ local->eye = EYE_LEFT;
+ local->face_left = FACE_NORMAL;
+ local->face_right = FACE_NOT_THERE;
+ local->beard_talk_count = 0;
+ local->wise_talk_count = 0;
+ local->prevent = false;
+
+ kernel_flip_hotspot(words_wise_shifter, false);
+ kernel_flip_hotspot(words_shifter, false);
+
+ if (previous_room != KERNEL_RESTORING_GAME) {
+ local->anim_0_running = false;
+ local->anim_1_running = false;
+ }
+
+ conv_get(CONV_49_KING);
+
+ ss[fx_rock_l] = kernel_load_series(kernel_name('x', 3), false);
+ ss[fx_rock_r] = kernel_load_series(kernel_name('x', 4), false);
+ ss[fx_vine] = kernel_load_series(kernel_name('x', 0), false);
+ ss[fx_eye] = kernel_load_series(kernel_name('z', 0), false);
+ ss[fx_face_left] = kernel_load_series(kernel_name('z', 1), false);
+ ss[fx_face_right] = kernel_load_series(kernel_name('z', 2), false);
+ seq[fx_rock_l] = -1;
+ local->dyn_rock_l = -1;
+ local->rock_l_base = 64;
+
+ seq[fx_rock_r] = -1;
+ local->dyn_rock_r = -1;
+ local->rock_r_base = 413;
+
+ seq[fx_vine] = -1;
+ local->dyn_vine = -1;
+ local->vine_base = 70;
+
+ if (global[player_persona] == PLAYER_IS_KING) {
+ ss[fx_take] = kernel_load_series("*KGRH_9", false);
+ aa[0] = kernel_run_animation(kernel_name('w', 1), 0);
+ local->anim_0_running = true;
+ local->wise_action = FREEZE;
+
+ aa[1] = kernel_run_animation(kernel_name('b', 1), 0);
+ local->anim_1_running = true;
+
+ if (global[talked_to_wise]) {
+ kernel_flip_hotspot(words_wise_shifter, true);
+ } else {
+ kernel_flip_hotspot(words_shifter, true);
+ }
+ }
+
+ if (conv_restore_running == CONV_49_KING) {
+ conv_run(CONV_49_KING);
+ conv_export_value(global[talked_to_shifter]);
+ conv_export_value(global[talked_to_merchant]);
+ if (object[pid_doll].location == 2 ||
+ object[pid_doll].location == 201) {
+ conv_export_value(1);
+ } else {
+ conv_export_value(0);
+ }
+ conv_export_value(player_has(polystone));
+ }
+
+ if (previous_room == 204) {
+ player_first_walk(PLAYER_X_FROM_204, PLAYER_Y_FROM_204, FACING_SOUTHWEST,
+ WALK_TO_X_FROM_204, WALK_TO_Y_FROM_204, FACING_SOUTHWEST, true);
+ camera_jump_to(160, 0);
+ } else if (previous_room == 205) {
+ player_first_walk(PLAYER_X_FROM_205, PLAYER_Y_FROM_205, FACING_WEST,
+ WALK_TO_X_FROM_205, WALK_TO_Y_FROM_205, FACING_WEST, true);
+ camera_jump_to(160, 0);
+ } else if ((previous_room == 201) || (previous_room != KERNEL_RESTORING_GAME)) {
+ player_first_walk(PLAYER_X_FROM_201, PLAYER_Y_FROM_201, FACING_EAST,
+ WALK_TO_X_FROM_201, WALK_TO_Y_FROM_201, FACING_EAST, true);
+ }
+
+ set_203_rock_r_position();
+ set_203_rock_l_position();
+ set_203_vine_position();
+
+ section_2_music();
}
void room_203_daemon() {
+ int temp;
+
+ if (local->anim_0_running) {
+ handle_anim_wise();
+ }
+
+ if (local->anim_1_running) {
+ handle_anim_beard();
+ }
+
+ if (camera_x.pan_this_frame) {
+ set_203_rock_r_position();
+ set_203_rock_l_position();
+ set_203_vine_position();
+ }
+
+ if (local->eye != EYE_MOVING && imath_random(1, 320) == 1) {
+
+ if (local->eye == EYE_LEFT) {
+ if (imath_random(1, 2) == 1) {
+ seq[fx_eye] = kernel_seq_pingpong_scroll(ss[fx_eye], false, 5, 0, 0, 2);
+ kernel_seq_depth(seq[fx_eye], 1);
+ kernel_seq_range(seq[fx_eye], 1, 4);
+ kernel_seq_trigger(seq[fx_eye], KERNEL_TRIGGER_EXPIRE, 0, ROOM_203_EYE);
+ } else {
+ seq[fx_eye] = kernel_seq_forward_scroll(ss[fx_eye], false, 8, 0, 0, 1);
+ kernel_seq_depth(seq[fx_eye], 1);
+ kernel_seq_range(seq[fx_eye], 5, 7);
+ kernel_seq_trigger(seq[fx_eye], KERNEL_TRIGGER_EXPIRE, 0, ROOM_203_EYE + 1);
+ }
+ } else if (local->eye == EYE_RIGHT) {
+ kernel_seq_delete(seq[fx_eye]);
+ seq[fx_eye] = kernel_seq_backward_scroll(ss[fx_eye], false, 8, 0, 0, 1);
+ kernel_seq_depth(seq[fx_eye], 1);
+ kernel_seq_range(seq[fx_eye], 5, 7);
+ kernel_seq_trigger(seq[fx_eye], KERNEL_TRIGGER_EXPIRE, 0, ROOM_203_EYE + 2);
+ }
+
+ local->eye = EYE_MOVING;
+ }
+
+ if (kernel.trigger == ROOM_203_EYE ||
+ kernel.trigger == ROOM_203_EYE + 2) {
+ local->eye = EYE_LEFT;
+ }
+
+ if (kernel.trigger == ROOM_203_EYE + 1) {
+ temp = seq[fx_eye];
+ seq[fx_eye] = kernel_seq_stamp_scroll(ss[fx_eye], false, 7);
+ kernel_seq_depth(seq[fx_eye], 1);
+ kernel_synch(KERNEL_SERIES, seq[fx_eye], KERNEL_SERIES, temp);
+ local->eye = EYE_RIGHT;
+ }
+ if (local->face_left != FACE_MOVING && imath_random(1, 320) == 1) {
+
+ if (local->face_left == FACE_NORMAL) {
+ seq[fx_face_left] = kernel_seq_forward_scroll(ss[fx_face_left], false, 9, 0, 0, 1);
+ kernel_seq_depth(seq[fx_face_left], 1);
+ kernel_seq_range(seq[fx_face_left], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_face_left], KERNEL_TRIGGER_EXPIRE, 0, ROOM_203_FACE_LEFT);
+ } else {
+ kernel_seq_delete(seq[fx_face_left]);
+ seq[fx_face_left] = kernel_seq_backward_scroll(ss[fx_face_left], false, 9, 0, 0, 1);
+ kernel_seq_depth(seq[fx_face_left], 1);
+ kernel_seq_range(seq[fx_face_left], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_face_left], KERNEL_TRIGGER_EXPIRE, 0, ROOM_203_FACE_LEFT + 1);
+ }
+
+ local->face_left = FACE_MOVING;
+ }
+
+ if (kernel.trigger == ROOM_203_FACE_LEFT) {
+ temp = seq[fx_face_left];
+ seq[fx_face_left] = kernel_seq_stamp_scroll(ss[fx_face_left], false, 4);
+ kernel_seq_depth(seq[fx_face_left], 1);
+ kernel_synch(KERNEL_SERIES, seq[fx_face_left], KERNEL_SERIES, temp);
+ local->face_left = FACE_ABNORMAL;
+ }
+
+ if (kernel.trigger == ROOM_203_FACE_LEFT + 1) {
+ local->face_left = FACE_NORMAL;
+ }
+
+ if (local->face_right == FACE_NOT_THERE && imath_random(1, 500) == 1) {
+ seq[fx_face_right] = kernel_seq_forward_scroll(ss[fx_face_right], false, 8, 0, 0, 1);
+ kernel_seq_depth(seq[fx_face_right], 10);
+ kernel_seq_range(seq[fx_face_right], 1, 8);
+ kernel_seq_trigger(seq[fx_face_right], KERNEL_TRIGGER_EXPIRE, 0, ROOM_203_FACE_RIGHT);
+ local->face_right = FACE_MOVING;
+ }
+
+ if (local->face_right == FACE_THERE && imath_random(1, 500) == 1) {
+ kernel_seq_delete(seq[fx_face_right]);
+ seq[fx_face_right] = kernel_seq_backward_scroll(ss[fx_face_right], false, 8, 0, 0, 1);
+ kernel_seq_depth(seq[fx_face_right], 10);
+ kernel_seq_range(seq[fx_face_right], 1, 8);
+ kernel_seq_trigger(seq[fx_face_right], KERNEL_TRIGGER_EXPIRE, 0, ROOM_203_FACE_RIGHT + 1);
+ local->face_right = FACE_MOVING;
+ }
+
+ if (local->face_right == FACE_THERE && imath_random(1, 320) == 1) {
+ kernel_seq_delete(seq[fx_face_right]);
+ seq[fx_face_right] = kernel_seq_pingpong_scroll(ss[fx_face_right], false, 7, 0, 0, 2);
+ kernel_seq_depth(seq[fx_face_right], 10);
+ kernel_seq_range(seq[fx_face_right], 8, 9);
+ kernel_seq_trigger(seq[fx_face_right], KERNEL_TRIGGER_EXPIRE, 0, ROOM_203_FACE_RIGHT + 2);
+ local->face_right = FACE_MOVING;
+ }
+
+ if (kernel.trigger == ROOM_203_FACE_RIGHT) {
+ temp = seq[fx_face_right];
+ seq[fx_face_right] = kernel_seq_stamp_scroll(ss[fx_face_right], false, 8);
+ kernel_seq_depth(seq[fx_face_right], 10);
+ kernel_synch(KERNEL_SERIES, seq[fx_face_right], KERNEL_SERIES, temp);
+ local->face_right = FACE_THERE;
+ }
+
+ if (kernel.trigger == ROOM_203_FACE_RIGHT + 1) {
+ local->face_right = FACE_NOT_THERE;
+ }
+
+ if (kernel.trigger == ROOM_203_FACE_RIGHT + 2) {
+ temp = seq[fx_face_right];
+ seq[fx_face_right] = kernel_seq_stamp_scroll(ss[fx_face_right], false, 8);
+ kernel_seq_depth(seq[fx_face_right], 10);
+ kernel_synch(KERNEL_SERIES, seq[fx_face_right], KERNEL_SERIES, temp);
+ local->face_right = FACE_THERE;
+ }
+
+ switch (kernel.trigger) {
+ case 1:
+ if (local->prevent) {
+ ++global[player_score];
+ sound_play(N_TakeObjectSnd);
+ inter_give_to_player(polystone);
+ object_examine(polystone, 20329, 0);
+ local->wise_action = FREEZE;
+ }
+ local->prevent = true;
+ break;
+
+ case 2:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take]);
+ conv_release();
+ break;
+ }
}
void room_203_pre_parser() {
+ if (player_said_1(cave) && player.need_to_walk) {
+ if (!player_said_1(walk_into)) {
+ player.need_to_walk = false;
+ }
+ }
+ if (player_said_2(walk_down, path_to_east)) {
+ player.walk_off_edge_to_room = 205;
+ }
+
+ if (player_said_2(walk_down, path_to_west)) {
+ player.walk_off_edge_to_room = 201;
+ }
}
void room_203_parser() {
+ if (conv_control.running == CONV_49_KING) {
+ process_conv_wise();
+ goto handled;
+ }
+
+ if (player_said_2(walk_into, cave) ||
+ kernel.trigger == ROOM_203_NEW_ROOM) {
+ new_room = 204;
+ goto handled;
+ }
+
+ if (player_said_2(talk_to, shifter) || player_said_2(talk_to, wise_shifter)) {
+ conv_run(CONV_49_KING);
+ conv_export_value(global[talked_to_shifter]);
+ conv_export_value(global[talked_to_merchant]);
+ if (object[pid_doll].location == 2 ||
+ object[pid_doll].location == 201) {
+ conv_export_value(1);
+ } else {
+ conv_export_value(0);
+ }
+ conv_export_value(player_has(polystone));
+
+ global[talked_to_wise] = true;
+ kernel_flip_hotspot(words_wise_shifter, true);
+ kernel_flip_hotspot(words_shifter, false);
+ goto handled;
+ }
+
+ if (player_said_2(invoke, signet_ring)) {
+ if (global[object_given_201] != -1) {
+ text_show(20158);
+ goto handled;
+ }
+ }
+
+ if (player.look_around) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(20301);
+ } else {
+ text_show(20326);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+ if (player_said_1(path)) {
+ text_show(20302);
+ goto handled;
+ }
+
+ if (player_said_1(eye_rock) || player_said_1(eye)) {
+ text_show(20303);
+ goto handled;
+ }
+
+ if (player_said_1(body_tree)) {
+ text_show(20309);
+ goto handled;
+ }
+
+ if (player_said_1(clearing)) {
+ text_show(20315);
+ goto handled;
+ }
+
+ if (player_said_1(boulders)) {
+ text_show(20316);
+ goto handled;
+ }
+
+ if (player_said_1(path_to_west)) {
+ text_show(20318);
+ goto handled;
+ }
+
+ if (player_said_1(rock)) {
+ text_show(20331);
+ goto handled;
+ }
+
+ if (player_said_1(path_to_east)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(20319);
+ } else {
+ text_show(20327);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(cave)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(20320);
+ } else {
+ text_show(20328);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(Slathan_ni_Patan)) {
+ text_show(20323);
+ goto handled;
+ }
+
+ if (player_said_1(shifter)) {
+ text_show(20324);
+ goto handled;
+ }
+
+ if (player_said_1(wise_shifter)) {
+ text_show(20325);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(take, eye_rock) || player_said_2(take, eye)) {
+ text_show(20304);
+ goto handled;
+ }
+
+ if (player_said_1(eye) || player_said_1(eye_rock)) {
+ if (player_said_1(open) || player_said_1(close)) {
+ text_show(20305);
+ goto handled;
+ }
+
+ if (player_said_2(throw, mud) || player_said_2(put, mud) ||
+ player_said_1(pour_contents_of)) {
+ text_show(20308);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(give, eye_rock) || player_said_2(give, eye)) {
+ text_show(20307);
+ goto handled;
+ }
+
+ if (player_said_2(open, body_tree)) {
+ text_show(20310);
+ goto handled;
+ }
+
+ if (player_said_2(close, body_tree)) {
+ text_show(20311);
+ goto handled;
+ }
+
+ if (player_said_1(body_tree)) {
+ if (player_said_2(put, torch) ||
+ player_said_2(sword, attack) ||
+ player_said_2(sword, carve_up) ||
+ player_said_2(sword, thrust) ||
+ player_said_1(pour_contents_of)) {
+ text_show(20312);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(talk_to, body_tree)) {
+ text_show(20313);
+ goto handled;
+ }
+
+ if (player_said_2(talk_to, eye_rock) || player_said_2(talk_to, eye)) {
+ text_show(20306);
+ goto handled;
+ }
+
+ if (player_said_2(talk_to, rock)) {
+ text_show(20330);
+ goto handled;
+ }
+
+ if (player_said_2(give, body_tree)) {
+ text_show(20314);
+ goto handled;
+ }
+
+ if (player_said_2(talk_to, boulders) || player_said_2(talk_to, boulder)) {
+ text_show(20332);
+ goto handled;
+ }
+
+ if (player_said_1(boulders)) {
+ if (player_said_1(take) ||
+ player_said_1(push) ||
+ player_said_1(pull)) {
+ text_show(20317);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(cave)) {
+ if (player_said_1(open) || player_said_1(close)) {
+ text_show(20321);
+ goto handled;
+ }
+ }
+
+ if (player_said_3(throw, torch, cave) || player_said_3(put, torch, cave)) {
+ text_show(20322);
+ goto handled;
+ }
+
+ goto done;
+
+handled:
+ player.command_ready = false;
+
+done:
+ ;
+}
+void room_203_error() {
}
void room_203_synchronize(Common::Serializer &s) {
-
+ for (int16 &v : scratch.sprite) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.sequence) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.animation) s.syncAsSint16LE(v);
+ s.syncAsSint16LE(scratch.wise_frame);
+ s.syncAsSint16LE(scratch.wise_action);
+ s.syncAsSint16LE(scratch.wise_talk_count);
+ s.syncAsSint16LE(scratch.anim_0_running);
+ s.syncAsSint16LE(scratch.beard_frame);
+ s.syncAsSint16LE(scratch.beard_talk_count);
+ s.syncAsSint16LE(scratch.anim_1_running);
+ s.syncAsSint16LE(scratch.rock_l_base);
+ s.syncAsSint16LE(scratch.dyn_rock_l);
+ s.syncAsSint16LE(scratch.rock_r_base);
+ s.syncAsSint16LE(scratch.dyn_rock_r);
+ s.syncAsSint16LE(scratch.vine_base);
+ s.syncAsSint16LE(scratch.dyn_vine);
+ s.syncAsSint16LE(scratch.eye);
+ s.syncAsSint16LE(scratch.face_left);
+ s.syncAsSint16LE(scratch.face_right);
+ s.syncAsSint16LE(scratch.prevent);
}
void room_203_preload() {
- room_init_code_pointer = room_203_init;
+ room_init_code_pointer = room_203_init;
room_pre_parser_code_pointer = room_203_pre_parser;
- room_parser_code_pointer = room_203_parser;
- room_daemon_code_pointer = room_203_daemon;
+ room_parser_code_pointer = room_203_parser;
+ room_daemon_code_pointer = room_203_daemon;
section_2_walker();
section_2_interface();
Commit: 534fe8323480d1d28f3c1e1ce3eb42a918db90b2
https://github.com/scummvm/scummvm/commit/534fe8323480d1d28f3c1e1ce3eb42a918db90b2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-20T21:13:25+10:00
Commit Message:
MADS: DRAGONSPHERE: Remainder of section 2 rooms
Changed paths:
engines/mads/madsv2/dragonsphere/mads/conv.h
engines/mads/madsv2/dragonsphere/mads/sounds.h
engines/mads/madsv2/dragonsphere/mads/words.h
engines/mads/madsv2/dragonsphere/rooms/room201.cpp
engines/mads/madsv2/dragonsphere/rooms/room203.cpp
engines/mads/madsv2/dragonsphere/rooms/room204.cpp
engines/mads/madsv2/dragonsphere/rooms/room205.cpp
engines/mads/madsv2/dragonsphere/rooms/room206.cpp
diff --git a/engines/mads/madsv2/dragonsphere/mads/conv.h b/engines/mads/madsv2/dragonsphere/mads/conv.h
index edc3f5d9205..52a572b9988 100644
--- a/engines/mads/madsv2/dragonsphere/mads/conv.h
+++ b/engines/mads/madsv2/dragonsphere/mads/conv.h
@@ -191,6 +191,24 @@ enum {
conv049_polyquiz_b_b = 33
};
+enum {
+ conv051_nopass = 0,
+ conv051_exit_b_b = 3
+};
+
+enum {
+ conv052_nopass = 0,
+ conv052_exit_b_b = 5
+};
+
+enum {
+ conv053_story_b_b = 3,
+ conv053_focus_b_b = 9,
+ conv053_thanks_b_b = 12,
+ conv053_thanks_only = 13,
+ conv053_restart_only = 14
+};
+
enum {
conv054_restart = 1,
conv054_exit_b_b = 10,
diff --git a/engines/mads/madsv2/dragonsphere/mads/sounds.h b/engines/mads/madsv2/dragonsphere/mads/sounds.h
index 6c767010428..7abb4203538 100644
--- a/engines/mads/madsv2/dragonsphere/mads/sounds.h
+++ b/engines/mads/madsv2/dragonsphere/mads/sounds.h
@@ -58,6 +58,8 @@ enum {
N_BackgroundMus = 16,
N_GuardCollapses = 65,
N_TentaclesSplash = 66,
+ N_LavaPlops = 68,
+ N_002HealMeSnd = 70,
N_MouthRockTalks = 71,
N_PoolMonsterEatsPid = 72
};
diff --git a/engines/mads/madsv2/dragonsphere/mads/words.h b/engines/mads/madsv2/dragonsphere/mads/words.h
index 7dec94e2637..d554597ae01 100644
--- a/engines/mads/madsv2/dragonsphere/mads/words.h
+++ b/engines/mads/madsv2/dragonsphere/mads/words.h
@@ -99,6 +99,7 @@ enum {
words_passageway_to_east = 151,
words_cave_floor = 152,
words_castle = 156,
+ words_ground = 158,
words_door = 166,
words_wall_switch = 167,
words_stairs = 168,
@@ -176,11 +177,13 @@ enum {
words_soporific = 289,
words_parchment = 290,
words_king = 291,
+ words_path_to_south = 294,
words_climb_up = 296,
words_boulders = 320,
words_path_to_west = 299,
words_path_to_east = 313,
words_sconce = 329,
+ words_rock_tumble = 321,
words_stairway = 331,
words_mechanism = 332,
words_spearheads = 333,
@@ -211,9 +214,19 @@ enum {
words_tentacles = 536,
words_spell_shield = 537,
words_pool_monster = 538,
+ words_shifter_boulder = 539,
+ words_dead_tree = 540,
+ words_pit = 541,
+ words_shifter_village = 542,
words_shifter = 544,
+ words_wrecked_bridge = 546,
+ words_shack = 547,
+ words_wrecked_shack = 548,
words_wise_shifter = 549,
words_boulder = 553,
+ words_Slathan_sky = 555,
+ words_Greta = 556,
+ words_shifting_monster = 561,
words_Dragonsphere = 571
};
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room201.cpp b/engines/mads/madsv2/dragonsphere/rooms/room201.cpp
index d23d7a9ac8b..b832f0f4255 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room201.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room201.cpp
@@ -132,7 +132,7 @@ struct Scratch {
static Scratch scratch;
-/* ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ Sprite Series ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ */
+/* ========================= Sprite Series =================== */
#define fx_lg_rock 0 /* rm201x0 */
#define fx_md_rock 1 /* rm201x2 */
@@ -164,7 +164,7 @@ static Scratch scratch;
-/* ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ Triggers ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ */
+/* ======================== Triggers ========================= */
#define ROOM_201_HAND 60
#define ROOM_201_HALT 65
@@ -180,7 +180,7 @@ static Scratch scratch;
#define MUSIC 120
-/* ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ Other Macros ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ */
+/* ========================= Other Macros ==================== */
#define camera_ratio_1 1
#define camera_ratio_2 2
@@ -1458,7 +1458,7 @@ static void handle_anim_take() {
}
}
-void room_201_daemon() {
+static void room_201_daemon() {
long dif;
int temp;
@@ -2035,7 +2035,7 @@ static void process_conv_pid_guards() {
} /* if you_trig_flag == true, then a you trigger is called from above, not here. */
}
-void room_201_pre_parser() {
+static void room_201_pre_parser() {
if (local->activate_timer) {
player.need_to_walk = false;
}
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room203.cpp b/engines/mads/madsv2/dragonsphere/rooms/room203.cpp
index 02a111ef5f1..b4857f92be1 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room203.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room203.cpp
@@ -402,7 +402,7 @@ static void process_conv_wise() {
local->wise_talk_count = 0;
}
-void room_203_init() {
+static void room_203_init() {
local->eye = EYE_LEFT;
local->face_left = FACE_NORMAL;
local->face_right = FACE_NOT_THERE;
@@ -488,7 +488,7 @@ void room_203_init() {
section_2_music();
}
-void room_203_daemon() {
+static void room_203_daemon() {
int temp;
if (local->anim_0_running) {
@@ -641,7 +641,7 @@ void room_203_daemon() {
}
}
-void room_203_pre_parser() {
+static void room_203_pre_parser() {
if (player_said_1(cave) && player.need_to_walk) {
if (!player_said_1(walk_into)) {
player.need_to_walk = false;
@@ -657,7 +657,7 @@ void room_203_pre_parser() {
}
}
-void room_203_parser() {
+static void room_203_parser() {
if (conv_control.running == CONV_49_KING) {
process_conv_wise();
goto handled;
@@ -872,9 +872,6 @@ done:
;
}
-void room_203_error() {
-}
-
void room_203_synchronize(Common::Serializer &s) {
for (int16 &v : scratch.sprite) s.syncAsSint16LE(v);
for (int16 &v : scratch.sequence) s.syncAsSint16LE(v);
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room204.cpp b/engines/mads/madsv2/dragonsphere/rooms/room204.cpp
index 358895883eb..633ad366296 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room204.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room204.cpp
@@ -1,4 +1,4 @@
-/* ScummVM - Graphic Adventure Engine
+/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
@@ -22,7 +22,10 @@
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/matte.h"
+#include "mads/madsv2/core/player.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
@@ -39,40 +42,292 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15];
+ int16 sequence[15];
+ int16 animation[4];
+
+ int16 king_frame;
+ int16 anim_0_running;
+
+ int16 pop_0_running;
+ int16 pop_1_running;
+ int16 pop_2_running;
+ int16 pop_3_running;
+ int16 pop_4_running;
+ int16 pop_5_running;
+ int16 bubble_1_running;
+ int16 bubble_2_running;
+ int16 smoke_running;
};
+static Scratch scratch;
+
#define local (&scratch)
#define ss local->sprite
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
+#define fx_pop_0 0
+#define fx_pop_1 1
+#define fx_pop_2 2
+#define fx_pop_3 3
+#define fx_pop_4 4
+#define fx_pop_5 5
+#define fx_bubble_1 6
+#define fx_bubble_2 7
+#define fx_smoke 8
+#define fx_take 9
+
+#define TRIG 60
+#define ROOM_204_POP 70
+
+#define PLAYER_X_FROM_203_K -15
+#define PLAYER_Y_FROM_203_K 127
+#define WALK_TO_X_FROM_203_K 173
+#define WALK_TO_Y_FROM_203_K 118
+
+
+static void handle_anim_king_dream() {
+ int king_reset_frame;
+
+ if (kernel_anim[aa[0]].frame != local->king_frame) {
+ local->king_frame = kernel_anim[aa[0]].frame;
+ king_reset_frame = -1;
+
+ switch (local->king_frame) {
-void room_204_init() {
+ case 64: /* just before doll sequence */
+ if (global[doll_given]) {
+ king_reset_frame = 86;
+ player.walker_visible = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_ANIM, aa[0]);
+ }
+ break;
+ case 83: /* just touched pid doll */
+ ++ global[dragon_high_scene];
+ sound_play(N_TakeObjectSnd);
+ global[doll_given] = true;
+ inter_give_to_player(pid_doll);
+ break;
+
+ case 76: /* take doll */
+ player.walker_visible = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_ANIM, aa[0]);
+ break;
+ }
+
+ if (king_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], king_reset_frame);
+ local->king_frame = king_reset_frame;
+ }
+ }
}
-void room_204_daemon() {
+static void room_204_init() {
+ kernel_set_interface_mode(INTER_LIMITED_SENTENCES);
+ viewing_at_y = ((video_y - display_y) >> 1);
+ player.commands_allowed = false;
+
+ local->anim_0_running = false;
+ local->pop_0_running = false;
+ local->pop_1_running = false;
+ local->pop_2_running = false;
+ local->pop_3_running = false;
+ local->pop_4_running = false;
+ local->pop_5_running = false;
+ local->bubble_1_running = false;
+ local->bubble_2_running = false;
+ local->smoke_running = false;
+
+ ss[fx_pop_0] = kernel_load_series(kernel_name('y', 0), false);
+ ss[fx_pop_1] = kernel_load_series(kernel_name('y', 1), false);
+ ss[fx_pop_2] = kernel_load_series(kernel_name('y', 2), false);
+ ss[fx_pop_3] = kernel_load_series(kernel_name('y', 3), false);
+ ss[fx_pop_4] = kernel_load_series(kernel_name('y', 4), false);
+ ss[fx_pop_5] = kernel_load_series(kernel_name('y', 5), false);
+ ss[fx_bubble_1] = kernel_load_series(kernel_name('z', 0), false);
+ ss[fx_bubble_2] = kernel_load_series(kernel_name('z', 1), false);
+ ss[fx_smoke] = kernel_load_series(kernel_name('h', 0), false);
+ player_first_walk(PLAYER_X_FROM_203_K, PLAYER_Y_FROM_203_K, FACING_EAST,
+ WALK_TO_X_FROM_203_K, WALK_TO_Y_FROM_203_K, FACING_NORTHEAST, false);
+
+ if (global[player_persona] == PLAYER_IS_KING) {
+ ss[fx_take] = kernel_load_series("*KGDRD_7", false);
+ player_walk_trigger(1);
+ } else {
+ player_walk_trigger(5);
+ }
+
+ section_2_music();
}
-void room_204_pre_parser() {
+static void room_204_daemon() {
+ if (local->anim_0_running) {
+ handle_anim_king_dream();
+ }
+
+ if (!local->pop_0_running && imath_random(1, 150) == 1) {
+ seq[fx_pop_0] = kernel_seq_forward(ss[fx_pop_0], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_pop_0], 10);
+ kernel_seq_range(seq[fx_pop_0], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_pop_0], KERNEL_TRIGGER_SPRITE, 8, ROOM_204_POP);
+ kernel_seq_trigger(seq[fx_pop_0], KERNEL_TRIGGER_EXPIRE, 0, TRIG);
+ local->pop_0_running = true;
+ }
+
+ if (!local->pop_1_running && imath_random(1, 150) == 1) {
+ seq[fx_pop_1] = kernel_seq_forward(ss[fx_pop_1], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_pop_1], 10);
+ kernel_seq_range(seq[fx_pop_1], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_pop_1], KERNEL_TRIGGER_SPRITE, 8, ROOM_204_POP);
+ kernel_seq_trigger(seq[fx_pop_1], KERNEL_TRIGGER_EXPIRE, 0, TRIG + 1);
+ local->pop_1_running = true;
+ }
+ if (!local->pop_2_running && imath_random(1, 150) == 1) {
+ seq[fx_pop_2] = kernel_seq_forward(ss[fx_pop_2], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_pop_2], 10);
+ kernel_seq_range(seq[fx_pop_2], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_pop_2], KERNEL_TRIGGER_SPRITE, 7, ROOM_204_POP);
+ kernel_seq_trigger(seq[fx_pop_2], KERNEL_TRIGGER_EXPIRE, 0, TRIG + 2);
+ local->pop_2_running = true;
+ }
+
+ if (!local->pop_3_running && imath_random(1, 150) == 1) {
+ seq[fx_pop_3] = kernel_seq_forward(ss[fx_pop_3], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_pop_3], 10);
+ kernel_seq_range(seq[fx_pop_3], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_pop_3], KERNEL_TRIGGER_SPRITE, 7, ROOM_204_POP);
+ kernel_seq_trigger(seq[fx_pop_3], KERNEL_TRIGGER_EXPIRE, 0, TRIG + 3);
+ local->pop_3_running = true;
+ }
+
+ if (!local->pop_4_running && imath_random(1, 150) == 1) {
+ seq[fx_pop_4] = kernel_seq_forward(ss[fx_pop_4], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_pop_4], 10);
+ kernel_seq_range(seq[fx_pop_4], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_pop_4], KERNEL_TRIGGER_SPRITE, 6, ROOM_204_POP);
+ kernel_seq_trigger(seq[fx_pop_4], KERNEL_TRIGGER_EXPIRE, 0, TRIG + 4);
+ local->pop_4_running = true;
+ }
+
+ if (!local->pop_5_running && imath_random(1, 150) == 1) {
+ seq[fx_pop_5] = kernel_seq_forward(ss[fx_pop_5], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_pop_5], 10);
+ kernel_seq_range(seq[fx_pop_5], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_pop_5], KERNEL_TRIGGER_SPRITE, 7, ROOM_204_POP);
+ kernel_seq_trigger(seq[fx_pop_5], KERNEL_TRIGGER_EXPIRE, 0, TRIG + 5);
+ local->pop_5_running = true;
+ }
+
+ switch (kernel.trigger) {
+ case TRIG: local->pop_0_running = false; break;
+ case TRIG + 1: local->pop_1_running = false; break;
+ case TRIG + 2: local->pop_2_running = false; break;
+ case TRIG + 3: local->pop_3_running = false; break;
+ case TRIG + 4: local->pop_4_running = false; break;
+ case TRIG + 5: local->pop_5_running = false; break;
+ }
+
+ if (!local->bubble_1_running && imath_random(1, 150) == 1) {
+ seq[fx_bubble_1] = kernel_seq_forward(ss[fx_bubble_1], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_bubble_1], 10);
+ kernel_seq_range(seq[fx_bubble_1], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_bubble_1], KERNEL_TRIGGER_EXPIRE, 0, TRIG + 6);
+ local->bubble_1_running = true;
+ }
+
+ if (!local->bubble_2_running && imath_random(1, 150) == 1) {
+ seq[fx_bubble_2] = kernel_seq_forward(ss[fx_bubble_2], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_bubble_2], 10);
+ kernel_seq_range(seq[fx_bubble_2], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_bubble_2], KERNEL_TRIGGER_EXPIRE, 0, TRIG + 7);
+ local->bubble_2_running = true;
+ }
+
+ if (!local->smoke_running && imath_random(1, 150) == 1) {
+ seq[fx_smoke] = kernel_seq_forward(ss[fx_smoke], false, 6, 0, 0, 1);
+ kernel_seq_depth(seq[fx_smoke], 10);
+ kernel_seq_range(seq[fx_smoke], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_smoke], KERNEL_TRIGGER_EXPIRE, 0, TRIG + 8);
+ local->smoke_running = true;
+ }
+
+ switch (kernel.trigger) {
+ case TRIG + 6: local->bubble_1_running = false; break;
+ case TRIG + 7: local->bubble_2_running = false; break;
+ case TRIG + 8: local->smoke_running = false; break;
+ }
+
+ if (kernel.trigger == 1) {
+ aa[0] = kernel_run_animation(kernel_name('k', 1), 2);
+ }
+
+ if (kernel.trigger == 2) {
+ kernel_timing_trigger(10, 3);
+ }
+
+ if (kernel.trigger == 3) {
+ aa[0] = kernel_run_animation(kernel_name('k', 2), 4);
+ local->anim_0_running = true;
+ }
+
+ if (kernel.trigger == 4) {
+ player.walker_visible = true;
+ local->anim_0_running = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_ANIM, aa[0]);
+ player_walk(PLAYER_X_FROM_203_K, PLAYER_Y_FROM_203_K, FACING_WEST);
+ player.walk_off_edge_to_room = 203;
+ }
+
+ if (kernel.trigger == 5) {
+ aa[0] = kernel_run_animation(kernel_name('p', 1), 6);
+ }
+
+ if (kernel.trigger == 6) {
+ kernel_timing_trigger(10, 7);
+ }
+
+ if (kernel.trigger == 7) {
+ player_walk(PLAYER_X_FROM_203_K, PLAYER_Y_FROM_203_K, FACING_WEST);
+ player.walk_off_edge_to_room = 203;
+ }
+
+ if (kernel.trigger == ROOM_204_POP) {
+ sound_play(N_LavaPlops);
+ }
}
-void room_204_parser() {
+static void room_204_pre_parser() {
+}
+static void room_204_parser() {
}
void room_204_synchronize(Common::Serializer &s) {
-
+ for (int16 &v : scratch.sprite) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.sequence) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.animation) s.syncAsSint16LE(v);
+ s.syncAsSint16LE(scratch.king_frame);
+ s.syncAsSint16LE(scratch.anim_0_running);
+ s.syncAsSint16LE(scratch.pop_0_running);
+ s.syncAsSint16LE(scratch.pop_1_running);
+ s.syncAsSint16LE(scratch.pop_2_running);
+ s.syncAsSint16LE(scratch.pop_3_running);
+ s.syncAsSint16LE(scratch.pop_4_running);
+ s.syncAsSint16LE(scratch.pop_5_running);
+ s.syncAsSint16LE(scratch.bubble_1_running);
+ s.syncAsSint16LE(scratch.bubble_2_running);
+ s.syncAsSint16LE(scratch.smoke_running);
}
void room_204_preload() {
- room_init_code_pointer = room_204_init;
+ room_init_code_pointer = room_204_init;
room_pre_parser_code_pointer = room_204_pre_parser;
- room_parser_code_pointer = room_204_parser;
- room_daemon_code_pointer = room_204_daemon;
+ room_parser_code_pointer = room_204_parser;
+ room_daemon_code_pointer = room_204_daemon;
section_2_walker();
section_2_interface();
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room205.cpp b/engines/mads/madsv2/dragonsphere/rooms/room205.cpp
index 079aaf86438..f4c5f506a53 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room205.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room205.cpp
@@ -1,4 +1,4 @@
-/* ScummVM - Graphic Adventure Engine
+/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
@@ -22,7 +22,10 @@
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/object.h"
+#include "mads/madsv2/core/player.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
@@ -39,40 +42,863 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15];
+ int16 sequence[15];
+ int16 animation[4];
+
+ int16 top_slime_frame;
+ int16 top_slime_action;
+ int16 top_slime_talk_count;
+ int16 anim_0_running;
+
+ int16 face_frame;
+ int16 face_action;
+ int16 face_talk_count;
+ int16 anim_1_running;
+
+ int16 eye_frame;
+ int16 eye_action;
+ int16 eye_talk_count;
+ int16 anim_3_running;
+
+ int16 eye;
+ int16 rock_talk_count;
+ int16 prevent;
};
+static Scratch scratch;
+
#define local (&scratch)
#define ss local->sprite
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
+#define ROOM_205_EYE 60
+#define ROOM_205_MOUTH 67
+#define ROOM_205_YOU_TALK 72
+#define ROOM_205_ME_TALK 74
+#define ROOM_205_WALK 78
+
+#define fx_eye 0
+#define fx_mouth 1
+#define fx_take 2
+#define fx_cycle_slime 3
+#define fx_uncycle_slime 4
+#define fx_bridge 5
+#define fx_end_bridge_1 6
+#define fx_end_bridge_2 7
+
+#define PLAYER_X_FROM_203 112
+#define PLAYER_Y_FROM_203 147
+
+#define EYE_LEFT 0
+#define EYE_RIGHT 1
+#define EYE_MOVING 2
+
+#define CONV_51_KING 51
+#define CONV_52_PID 52
+
+#define WALK_1_X 166
+#define WALK_1_Y 122
+
+#define WALK_2_X 177
+#define WALK_2_Y 110
+
+#define WALK_3_X 195
+#define WALK_3_Y 110
+
+#define HEAL_X 176
+#define HEAL_Y 119
+
+#define MONST_X 152
+#define MONST_Y 126
+
+#define SHIFT 0
+#define END 1
+#define FREEZE 2
+#define INVIS 3
+#define TALK 4
+#define BLINK 5
+
+#define TUNNEL_X 169
+#define TUNNEL_Y 104
+
+
+static void handle_anim_top_slime() {
+ int top_slime_reset_frame;
+
+ if (kernel_anim[aa[0]].frame != local->top_slime_frame) {
+ local->top_slime_frame = kernel_anim[aa[0]].frame;
+ top_slime_reset_frame = -1;
+
+ switch (local->top_slime_frame) {
+
+ case 15:
+ case 26:
+
+ switch (local->top_slime_action) {
+
+ case SHIFT:
+ if (imath_random(1, 4) == 1) {
+ top_slime_reset_frame = 17;
+ } else {
+ top_slime_reset_frame = 0;
+ }
+ break;
+
+ case END:
+ top_slime_reset_frame = 15;
+ break;
+ }
+ break;
+
+ case 17: /* end of heal */
+ top_slime_reset_frame = 26;
+ break;
+
+ case 27: /* end of invislbe */
+ top_slime_reset_frame = 26;
+ break;
+ }
+
+ if (top_slime_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], top_slime_reset_frame);
+ local->top_slime_frame = top_slime_reset_frame;
+ }
+ }
+}
+
+static void handle_anim_face() {
+ int face_reset_frame;
+
+ if (kernel_anim[aa[1]].frame != local->face_frame) {
+ local->face_frame = kernel_anim[aa[1]].frame;
+ face_reset_frame = -1;
+
+ switch (local->face_frame) {
+
+ case 10: /* almost end of hide face */
+ player.commands_allowed = true;
+ break;
+
+ case 1: /* end of invis */
+ case 11: /* end of hide face */
+
+ switch (local->face_action) {
+
+ case INVIS:
+ face_reset_frame = 0;
+ break;
+
+ default:
+ face_reset_frame = 1;
+ break;
+ }
+ break;
+
+ case 4: /* end of show face */
+ case 5: /* end of freeze */
+ case 6: /* end of talk */
+ case 7: /* end of talk */
+ case 8: /* end of talk */
+
+ if (local->face_frame == 4) {
+ local->eye_action = BLINK;
+ }
+
+ switch (local->face_action) {
+
+ case FREEZE:
+ face_reset_frame = 4;
+ break;
+
+ case TALK:
+ face_reset_frame = imath_random(5, 7);
+ ++ local->face_talk_count;
+ if (local->face_talk_count > 22) {
+ local->face_action = FREEZE;
+ local->face_talk_count = 0;
+ face_reset_frame = 4;
+ }
+ break;
+
+ default:
+ local->eye_action = INVIS;
+ face_reset_frame = 8;
+ break;
+ }
+ break;
+ }
+
+ if (face_reset_frame >= 0) {
+ kernel_reset_animation(aa[1], face_reset_frame);
+ local->face_frame = face_reset_frame;
+ }
+ }
+}
+
+static void handle_anim_eye() {
+ int eye_reset_frame;
+
+ if (kernel_anim[aa[3]].frame != local->eye_frame) {
+ local->eye_frame = kernel_anim[aa[3]].frame;
+ eye_reset_frame = -1;
+
+ switch (local->eye_frame) {
+
+ case 1: /* end of invis */
+ case 3: /* end of blink */
+
+ switch (local->eye_action) {
+
+ case BLINK:
+ if (imath_random(1, 30) == 1) {
+ eye_reset_frame = 1;
+ } else {
+ eye_reset_frame = 0;
+ }
+ break;
+
+ default:
+ eye_reset_frame = 0;
+ break;
+ }
+ break;
+ }
+
+ if (eye_reset_frame >= 0) {
+ kernel_reset_animation(aa[3], eye_reset_frame);
+ local->eye_frame = eye_reset_frame;
+ }
+ }
+}
+
+static void room_205_init() {
+ local->eye = EYE_LEFT;
+ local->prevent = false;
+ local->rock_talk_count = 0;
+
+ if (previous_room != KERNEL_RESTORING_GAME) {
+ local->anim_0_running = false;
+ local->anim_1_running = false;
+ local->anim_3_running = false;
+ }
+
+ if (global[player_persona] == PLAYER_IS_KING) {
+ conv_get(CONV_51_KING);
+ } else {
+ conv_get(CONV_52_PID);
+ }
+
+ ss[fx_cycle_slime] = kernel_load_series(kernel_name('z', 0), false);
+ ss[fx_uncycle_slime] = kernel_load_series(kernel_name('z', 5), false);
+ ss[fx_bridge] = kernel_load_series(kernel_name('z', 4), false);
+ ss[fx_eye] = kernel_load_series(kernel_name('y', 0), false);
+ ss[fx_mouth] = kernel_load_series(kernel_name('y', 1), false);
+ ss[fx_end_bridge_1] = kernel_load_series(kernel_name('z', 6), false);
+ ss[fx_end_bridge_2] = kernel_load_series(kernel_name('z', 7), false);
+
+ if (global[slime_healed]) {
+ seq[fx_end_bridge_1] = kernel_seq_stamp(ss[fx_end_bridge_1], false, KERNEL_LAST);
+ kernel_seq_depth(seq[fx_end_bridge_1], 8);
+ seq[fx_end_bridge_2] = kernel_seq_stamp(ss[fx_end_bridge_2], false, KERNEL_LAST);
+ kernel_seq_depth(seq[fx_end_bridge_2], 13);
+
+ } else {
+ kernel_flip_hotspot_loc(words_ground, false, TUNNEL_X, TUNNEL_Y);
+ seq[fx_cycle_slime] = kernel_seq_stamp(ss[fx_cycle_slime], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_cycle_slime], 10);
+
+ aa[3] = kernel_run_animation(kernel_name('e', 1), 0);
+ local->anim_3_running = true;
+ local->eye_action = INVIS;
+
+ aa[1] = kernel_run_animation(kernel_name('s', 2), 0);
+ local->anim_1_running = true;
+ local->face_action = INVIS;
+
+ aa[0] = kernel_run_animation(kernel_name('s', 1), 0);
+ local->anim_0_running = true;
+ }
+
+ if (previous_room == 206) {
+ player.commands_allowed = false;
+ player.x = WALK_3_X;
+ player.y = WALK_3_Y;
+ player.facing = FACING_WEST;
+ player_walk(WALK_2_X, WALK_2_Y, 5);
+ player_walk_trigger(ROOM_205_WALK);
+
+ } else if (previous_room == 203 || previous_room != KERNEL_RESTORING_GAME) {
+ player.x = PLAYER_X_FROM_203;
+ player.y = PLAYER_Y_FROM_203;
+ player.facing = FACING_NORTHEAST;
+ }
+
+ section_2_music();
+}
+
+static void room_205_daemon() {
+ int temp;
+
+ if (local->anim_0_running) {
+ handle_anim_top_slime();
+ }
+
+ if (local->anim_1_running) {
+ handle_anim_face();
+ }
+
+ if (local->anim_3_running) {
+ handle_anim_eye();
+ }
+
+ if (local->eye != EYE_MOVING && imath_random(1, 400) == 1) {
+
+ if (local->eye == EYE_RIGHT) {
+ if (imath_random(1, 2) == 1) { /* blink */
+ kernel_seq_delete(seq[fx_eye]);
+ seq[fx_eye] = kernel_seq_pingpong(ss[fx_eye], false, 5, 0, 0, 2);
+ kernel_seq_depth(seq[fx_eye], 2);
+ kernel_seq_range(seq[fx_eye], 3, 4);
+ kernel_seq_trigger(seq[fx_eye], KERNEL_TRIGGER_EXPIRE, 0, ROOM_205_EYE + 1);
+
+ } else { /* look left */
+ kernel_seq_delete(seq[fx_eye]);
+ seq[fx_eye] = kernel_seq_backward(ss[fx_eye], false, 8, 0, 0, 1);
+ kernel_seq_depth(seq[fx_eye], 2);
+ kernel_seq_range(seq[fx_eye], 1, 2);
+ kernel_seq_trigger(seq[fx_eye], KERNEL_TRIGGER_EXPIRE, 0, ROOM_205_EYE);
+ }
+
+ } else if (local->eye == EYE_LEFT) { /* look right */
+ seq[fx_eye] = kernel_seq_forward(ss[fx_eye], false, 8, 0, 0, 1);
+ kernel_seq_depth(seq[fx_eye], 2);
+ kernel_seq_range(seq[fx_eye], 1, 2);
+ kernel_seq_trigger(seq[fx_eye], KERNEL_TRIGGER_EXPIRE, 0, ROOM_205_EYE + 1);
+ }
+
+ local->eye = EYE_MOVING;
+ }
-void room_205_init() {
+ if (kernel.trigger == ROOM_205_EYE) {
+ local->eye = EYE_LEFT;
+ }
+ if (kernel.trigger == ROOM_205_EYE + 1) {
+ temp = seq[fx_eye];
+ seq[fx_eye] = kernel_seq_stamp(ss[fx_eye], false, 2);
+ kernel_seq_depth(seq[fx_eye], 2);
+ kernel_synch(KERNEL_SERIES, seq[fx_eye], KERNEL_SERIES, temp);
+ local->eye = EYE_RIGHT;
+ }
+
+ if (local->rock_talk_count == 1) {
+ seq[fx_mouth] = kernel_seq_stamp(ss[fx_mouth], false, imath_random(1, 3));
+ kernel_seq_depth(seq[fx_mouth], 1);
+ kernel_timing_trigger(9, ROOM_205_MOUTH);
+ ++ local->rock_talk_count;
+ }
+
+ if (kernel.trigger == ROOM_205_MOUTH) {
+ ++ local->rock_talk_count;
+ kernel_seq_delete(seq[fx_mouth]);
+ if (local->rock_talk_count < 15) {
+ seq[fx_mouth] = kernel_seq_stamp(ss[fx_mouth], false, imath_random(1, 3));
+ kernel_seq_depth(seq[fx_mouth], 1);
+ kernel_timing_trigger(9, ROOM_205_MOUTH);
+
+ } else {
+ kernel_timing_trigger(9, ROOM_205_MOUTH + 1);
+ local->rock_talk_count = 0;
+ }
+ }
+
+ if (kernel.trigger == ROOM_205_MOUTH + 1) {
+ text_show(20527);
+ }
+
+ if (kernel.trigger == ROOM_205_WALK) {
+ player_walk(WALK_1_X, WALK_1_Y, 5);
+ player_walk_trigger(ROOM_205_WALK + 1);
+ }
+
+ if (kernel.trigger == ROOM_205_WALK) {
+ player.commands_allowed = true;
+ }
}
-void room_205_daemon() {
+static void process_conv_face_king() {
+ int you_trig_flag = false;
+ int me_trig_flag = false;
+
+ if (player_verb == conv051_exit_b_b) {
+ *conv_my_next_start = conv051_nopass;
+ conv_abort();
+ local->face_action = INVIS;
+ you_trig_flag = true;
+ me_trig_flag = true;
+ }
+
+ if (kernel.trigger == ROOM_205_YOU_TALK) {
+ local->face_action = TALK;
+ }
+
+ if (kernel.trigger == ROOM_205_ME_TALK) {
+ local->face_action = FREEZE;
+ }
+
+ if (!you_trig_flag) {
+ conv_you_trigger(ROOM_205_YOU_TALK);
+ }
+
+ if (!me_trig_flag) {
+ conv_me_trigger(ROOM_205_ME_TALK);
+ }
+
+ local->face_talk_count = 0;
+}
+
+static void process_conv_face_pid() {
+ int you_trig_flag = false;
+ int me_trig_flag = false;
+
+ if (player_verb == conv052_exit_b_b) {
+ *conv_my_next_start = conv052_nopass;
+ conv_abort();
+ local->face_action = INVIS;
+ you_trig_flag = true;
+ me_trig_flag = true;
+ }
+
+ if (kernel.trigger == ROOM_205_YOU_TALK) {
+ local->face_action = TALK;
+ }
+
+ if (kernel.trigger == ROOM_205_ME_TALK) {
+ local->face_action = FREEZE;
+ }
+
+ if (!you_trig_flag) {
+ conv_you_trigger(ROOM_205_YOU_TALK);
+ }
+
+ if (!me_trig_flag) {
+ conv_me_trigger(ROOM_205_ME_TALK);
+ }
+ local->face_talk_count = 0;
}
-void room_205_pre_parser() {
+static void room_205_pre_parser() {
+ if (player_said_2(heal, shifting_monster) && !global[slime_healed]) {
+ player_walk(HEAL_X, HEAL_Y, FACING_NORTH);
+ }
+ if (player_said_2(walk_to, shifter_village) ||
+ player_said_2(walk_across, ground) && inter_point_y < 117) {
+ if (global[slime_healed]) {
+ switch (kernel.trigger) {
+ case 0:
+ player_walk(WALK_1_X, WALK_1_Y, 5);
+ player_walk_trigger(1);
+ break;
+
+ case 1:
+ player.commands_allowed = false;
+ player_walk(WALK_2_X, WALK_2_Y, 5);
+ player_walk_trigger(2);
+ break;
+
+ case 2:
+ player_walk(WALK_3_X, WALK_3_Y, 5);
+ break;
+ }
+ } else {
+ player_walk(MONST_X, MONST_Y, FACING_NORTHEAST);
+ }
+ }
}
-void room_205_parser() {
+static void room_205_parser() {
+ int temp;
+
+ if (conv_control.running == CONV_51_KING) {
+ process_conv_face_king();
+ goto handled;
+ }
+
+ if (conv_control.running == CONV_52_PID) {
+ process_conv_face_pid();
+ goto handled;
+ }
+
+ if (player_said_2(walk_down, path_to_south)) {
+ new_room = 203;
+ goto handled;
+ }
+
+ if (player_said_2(heal, shifting_monster)) {
+ if (!global[slime_healed]) switch (kernel.trigger) {
+ case 0:
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ local->top_slime_action = END;
+ aa[2] = kernel_run_animation(kernel_name('h', 1), 1);
+ kernel_synch(KERNEL_ANIM, aa[2], KERNEL_PLAYER, 0);
+ break;
+
+ case 1:
+ kernel_abort_animation(aa[2]);
+ kernel_abort_animation(aa[0]);
+ kernel_seq_delete(seq[fx_cycle_slime]);
+ local->anim_0_running = false;
+ player.walker_visible = true;
+ seq[fx_bridge] = kernel_seq_forward(ss[fx_bridge], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_bridge], 8);
+ kernel_seq_range(seq[fx_bridge], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_bridge], KERNEL_TRIGGER_EXPIRE, 0, 2);
+ kernel_synch(KERNEL_SERIES, seq[fx_bridge], KERNEL_NOW, 0);
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+ break;
+
+ case 2:
+ temp = seq[fx_bridge];
+ player.commands_allowed = true;
+ global[slime_healed] = true;
+ global[player_score] += 2;
+ seq[fx_end_bridge_1] = kernel_seq_stamp(ss[fx_end_bridge_1], false, KERNEL_LAST);
+ kernel_seq_depth(seq[fx_end_bridge_1], 8);
+ seq[fx_end_bridge_2] = kernel_seq_stamp(ss[fx_end_bridge_2], false, KERNEL_LAST);
+ kernel_seq_depth(seq[fx_end_bridge_2], 13);
+
+ kernel_synch(KERNEL_SERIES, seq[fx_end_bridge_1], KERNEL_SERIES, temp);
+ kernel_synch(KERNEL_SERIES, seq[fx_end_bridge_2], KERNEL_SERIES, temp);
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+ kernel_flip_hotspot_loc(words_ground, true, TUNNEL_X, TUNNEL_Y);
+ break;
+
+ } else {
+ if (global[slime_healed] == 1) {
+ text_show(20533);
+
+ } else if (global[slime_healed] == 2) {
+ text_show(20534);
+
+ } else {
+ text_show(20528);
+ }
+ }
+ goto handled;
+ }
+
+ if (player_said_2(talk_to, shifting_monster)) {
+ if (global[slime_healed]) {
+ text_show(20529);
+
+ } else {
+ player.commands_allowed = false;
+ if (global[player_persona] == PLAYER_IS_KING) {
+ conv_run(CONV_51_KING);
+
+ } else {
+ conv_run(CONV_52_PID);
+ conv_export_value(true);
+ conv_export_value(true);
+ }
+ }
+ goto handled;
+ }
+
+ if (player_said_2(walk_to, shifter_village) ||
+ player_said_2(walk_across, ground) && inter_point_y < 117) {
+ if (global[slime_healed]) {
+ new_room = 206;
+
+ } else {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ conv_run(CONV_51_KING);
+
+ } else {
+ conv_run(CONV_52_PID);
+ conv_export_value(true);
+ conv_export_value(true);
+ }
+ }
+ goto handled;
+ }
+
+ if (player_said_2(invoke, signet_ring)) {
+ if (global[object_given_201] != -1) {
+ text_show(20158);
+ goto handled;
+ }
+ }
+
+ if (player.look_around) {
+ if (global[slime_healed]) {
+ text_show(20518);
+ } else {
+ text_show(20501);
+ }
+ goto handled;
+ }
+
+ if (player_said_3(sword, attack, shifting_monster) ||
+ player_said_3(sword, carve_up, shifting_monster) ||
+ player_said_3(sword, thrust, shifting_monster) ||
+ player_said_2(pour_contents_of, shifting_monster) ||
+ player_said_2(push, shifting_monster) ||
+ player_said_2(pull, shifting_monster) ||
+ player_said_2(look, shifting_monster) ||
+ player_said_2(open, shifting_monster) ||
+ player_said_2(close, shifting_monster)) {
+
+ if (global[slime_healed]) {
+ text_show(20523);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+ if (player_said_1(Slathan_ni_Patan)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(20502);
+ } else {
+ text_show(20519);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(shifter_boulder)) {
+ text_show(20503);
+ goto handled;
+ }
+
+ if (player_said_1(dead_tree)) {
+ text_show(20506);
+ goto handled;
+ }
+
+ if (player_said_1(rock_tumble)) {
+ text_show(20508);
+ goto handled;
+ }
+
+ if (player_said_1(shifter_village)) {
+ if (global[slime_healed]) {
+ text_show(20521);
+ } else {
+ text_show(20509);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(pit)) {
+ text_show(20511);
+ goto handled;
+ }
+
+ if (player_said_1(path_to_south)) {
+ text_show(20512);
+ goto handled;
+ }
+
+ if (player_said_1(Slathan_sky)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(20513);
+ } else {
+ text_show(20522);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(ground)) {
+ text_show(20514);
+ goto handled;
+ }
+
+ if (player_said_1(shifting_monster)) {
+ text_show(20515);
+ goto handled;
+ }
+
+ if (player_said_1(mouth_rock)) {
+ text_show(20526);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(talk_to, mouth_rock)) {
+ sound_play(N_MouthRockTalks);
+ local->rock_talk_count = 1;
+ goto handled;
+ }
+
+ if (player_said_2(talk_to, shifter_boulder)) {
+ text_show(20505);
+ goto handled;
+ }
+
+ if (player_said_1(take) || player_said_1(push) ||
+ player_said_1(pull)) {
+
+ if (player_said_1(boulder)) {
+ text_show(20504);
+ goto handled;
+ }
+
+ if (player_said_1(dead_tree)) {
+ text_show(20507);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(make_noise, birdcall)) {
+ text_show(20510);
+ goto handled;
+ }
+
+ if (player_said_3(sword, attack, shifting_monster) ||
+ player_said_3(sword, carve_up, shifting_monster) ||
+ player_said_3(sword, thrust, shifting_monster) ||
+ player_said_2(pour_contents_of, shifting_monster) ||
+ player_said_2(push, shifting_monster) ||
+ player_said_2(pull, shifting_monster) ||
+ player_said_2(open, shifting_monster) ||
+ player_said_2(close, shifting_monster)) {
+
+ text_show(20516);
+ goto handled;
+ }
+
+ if (player_said_2(take_magic_from, shifting_monster)) {
+ text_show(20517);
+ goto handled;
+ }
+
+ if (player_said_2(speak_words_on, parchment)) {
+ text_show(20524);
+ goto handled;
+ }
+
+ if (player_said_2(heal, dead_tree)) {
+ text_show(20520);
+ goto handled;
+ }
+
+ if (player_said_2(wear, key_crown) && !global[slime_healed]) {
+ text_show(20525);
+ goto handled;
+ }
+
+ if (player_said_2(gaze_into, crystal_ball)) {
+ if (!global[slime_healed]) {
+ text_show(20530);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(shifter_village)) {
+ if (!global[slime_healed]) {
+ text_show(20535);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(invoke_power_of, crystal_ball) ||
+ player_said_1(heal_self)) {
+ if (!global[slime_healed]) {
+ switch (kernel.trigger) {
+ case 0:
+ if (player_said_1(heal_self)) {
+ sound_play(N_002HealMeSnd);
+
+ } else {
+ sound_play(N_InvokeCrystalBall);
+ }
+ kernel_abort_animation(aa[0]);
+ kernel_seq_delete(seq[fx_cycle_slime]);
+ local->anim_0_running = false;
+ player.commands_allowed = false;
+ local->top_slime_action = END;
+ seq[fx_bridge] = kernel_seq_forward(ss[fx_bridge], false, 7, 0, 0, 1);
+ global[player_score] += 2;
+ kernel_seq_depth(seq[fx_bridge], 8);
+ kernel_seq_range(seq[fx_bridge], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_bridge], KERNEL_TRIGGER_EXPIRE, 0, 1);
+ kernel_synch(KERNEL_SERIES, seq[fx_bridge], KERNEL_NOW, 0);
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+ goto handled;
+ break;
+
+ case 1:
+ temp = seq[fx_bridge];
+ player.commands_allowed = true;
+ seq[fx_end_bridge_1] = kernel_seq_stamp(ss[fx_end_bridge_1], false, KERNEL_LAST);
+ seq[fx_end_bridge_2] = kernel_seq_stamp(ss[fx_end_bridge_2], false, KERNEL_LAST);
+ kernel_seq_depth(seq[fx_end_bridge_1], 8);
+ kernel_seq_depth(seq[fx_end_bridge_2], 13);
+
+ kernel_synch(KERNEL_SERIES, seq[fx_end_bridge_1], KERNEL_SERIES, temp);
+ kernel_synch(KERNEL_SERIES, seq[fx_end_bridge_2], KERNEL_SERIES, temp);
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+ kernel_flip_hotspot_loc(words_ground, true, TUNNEL_X, TUNNEL_Y);
+
+ if (player_said_1(crystal_ball)) {
+ text_show(20531);
+ global[crystal_ball_dead] = true;
+ inter_move_object(crystal_ball, NOWHERE);
+ global[slime_healed] = 2;
+ text_show(970);
+
+ } else {
+ text_show(20532);
+ global[slime_healed] = 1;
+ }
+ player.commands_allowed = true;
+ goto handled;
+ break;
+ }
+ }
+ }
+
+
+ goto done;
+
+handled:
+ player.command_ready = false;
+done:
+ ;
}
void room_205_synchronize(Common::Serializer &s) {
-
+ for (int16 &v : scratch.sprite) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.sequence) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.animation) s.syncAsSint16LE(v);
+ s.syncAsSint16LE(scratch.top_slime_frame);
+ s.syncAsSint16LE(scratch.top_slime_action);
+ s.syncAsSint16LE(scratch.top_slime_talk_count);
+ s.syncAsSint16LE(scratch.anim_0_running);
+ s.syncAsSint16LE(scratch.face_frame);
+ s.syncAsSint16LE(scratch.face_action);
+ s.syncAsSint16LE(scratch.face_talk_count);
+ s.syncAsSint16LE(scratch.anim_1_running);
+ s.syncAsSint16LE(scratch.eye_frame);
+ s.syncAsSint16LE(scratch.eye_action);
+ s.syncAsSint16LE(scratch.eye_talk_count);
+ s.syncAsSint16LE(scratch.anim_3_running);
+ s.syncAsSint16LE(scratch.eye);
+ s.syncAsSint16LE(scratch.rock_talk_count);
+ s.syncAsSint16LE(scratch.prevent);
}
void room_205_preload() {
- room_init_code_pointer = room_205_init;
+ room_init_code_pointer = room_205_init;
room_pre_parser_code_pointer = room_205_pre_parser;
- room_parser_code_pointer = room_205_parser;
- room_daemon_code_pointer = room_205_daemon;
+ room_parser_code_pointer = room_205_parser;
+ room_daemon_code_pointer = room_205_daemon;
section_2_walker();
section_2_interface();
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room206.cpp b/engines/mads/madsv2/dragonsphere/rooms/room206.cpp
index 68a975d82a7..ca1a1fdc5ab 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room206.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room206.cpp
@@ -1,4 +1,4 @@
-/* ScummVM - Graphic Adventure Engine
+/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
@@ -22,7 +22,11 @@
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/matte.h"
+#include "mads/madsv2/core/object.h"
+#include "mads/madsv2/core/player.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
@@ -39,40 +43,709 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15];
+ int16 sequence[15];
+ int16 animation[4];
+
+ int16 left_worker_frame;
+ int16 left_worker_talk_count;
+ int16 anim_0_running;
+
+ int16 right_worker_frame;
+ int16 right_worker_talk_count;
+ int16 anim_1_running;
+
+ int16 lady_frame;
+ int16 lady_action;
+ int16 lady_talk_count;
+ int16 anim_2_running;
+
+ int16 end_frame;
+ int16 anim_3_running;
+
+ int16 prevent;
};
+static Scratch scratch;
+
#define local (&scratch)
#define ss local->sprite
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
+#define fx_take 0
+
+#define ROOM_206_YOU_TALK 60
+#define ROOM_206_END_GAME 70
+
+#define PLAYER_X_FROM_205 167
+#define PLAYER_Y_FROM_205 146
+
+#define FREEZE 0
+#define TALK 1
+#define GET_UP 2
+#define SIT_DOWN 3
+#define GIVE 4
+
+#define CONV_53_PID 53
+
+#define SHIFTER_X 219
+#define SHIFTER_Y 111
+
+
+static void handle_anim_left_worker() {
+ int left_worker_reset_frame;
+ int it;
+
+ if (kernel_anim[aa[0]].frame != local->left_worker_frame) {
+ local->left_worker_frame = kernel_anim[aa[0]].frame;
+ left_worker_reset_frame = -1;
+
+ switch (local->left_worker_frame) {
+ case 1: /* end of freeze */
+ case 2: /* end of freeze */
+ case 3: /* end of freeze */
+ case 10: /* end of rake */
+ case 33: /* end of rake */
+ ++local->left_worker_talk_count;
-void room_206_init() {
+ if (local->left_worker_talk_count > imath_random(3, 4)) {
+ it = imath_random(1, 3);
+ local->left_worker_talk_count = 0;
+ switch (it) {
+ case 1:
+ left_worker_reset_frame = 3;
+ local->left_worker_talk_count = 30;
+ break;
+
+ case 2:
+ left_worker_reset_frame = 10;
+ break;
+
+ case 3:
+ left_worker_reset_frame = imath_random(0, 2);
+ break;
+ }
+
+ } else {
+ left_worker_reset_frame = imath_random(0, 2);
+ }
+ break;
+
+ case 20: /* end of rake */
+ case 21: /* end of freeze */
+ case 22: /* end of freeze */
+ ++ local->left_worker_talk_count;
+
+ if (local->left_worker_talk_count > imath_random(3, 4)) {
+ it = imath_random(1, 2);
+ local->left_worker_talk_count = 0;
+
+ switch (it) {
+ case 1:
+ left_worker_reset_frame = 22;
+ local->left_worker_talk_count = 30;
+ break;
+
+ case 3:
+ left_worker_reset_frame = imath_random(20, 21);
+ break;
+ }
+
+ } else {
+ left_worker_reset_frame = imath_random(20, 21);
+ }
+ break;
+ }
+
+ if (left_worker_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], left_worker_reset_frame);
+ local->left_worker_frame = left_worker_reset_frame;
+ }
+ }
}
-void room_206_daemon() {
+static void handle_anim_right_worker() {
+ int right_worker_reset_frame;
+ int it;
+
+ if (kernel_anim[aa[1]].frame != local->right_worker_frame) {
+ local->right_worker_frame = kernel_anim[aa[1]].frame;
+ right_worker_reset_frame = -1;
+
+ switch (local->right_worker_frame) {
+ case 1: /* end of freeze */
+ case 9: /* end of rake */
+ ++ local->right_worker_talk_count;
+ if (local->right_worker_talk_count > imath_random(3, 4)) {
+ it = imath_random(1, 3);
+ switch (it) {
+ case 1:
+ right_worker_reset_frame = 1; /* rake */
+ break;
+
+ default:
+ right_worker_reset_frame = 0; /* freeze */
+ break;
+ }
+ } else if (local->right_worker_frame == 1) {
+ right_worker_reset_frame = 0;
+
+ } else {
+ right_worker_reset_frame = 1;
+ }
+ break;
+ }
+
+ if (right_worker_reset_frame >= 0) {
+ kernel_reset_animation(aa[1], right_worker_reset_frame);
+ local->right_worker_frame = right_worker_reset_frame;
+ }
+ }
}
-void room_206_pre_parser() {
+static void handle_anim_lady() {
+ int lady_reset_frame;
+ int it;
+
+ if (kernel_anim[aa[2]].frame != local->lady_frame) {
+ local->lady_frame = kernel_anim[aa[2]].frame;
+ lady_reset_frame = -1;
+ switch (local->lady_frame) {
+ case 1: /* end of freeze */
+ case 2: /* end of freeze */
+ case 3: /* end of freeze */
+ case 12: /* end of talk */
+ case 56: /* end of sit */
+ switch (local->lady_action) {
+ case FREEZE:
+ if (local->lady_frame > 3) {
+ local->lady_frame = 1;
+ }
+
+ ++ local->lady_talk_count;
+ if (local->lady_talk_count > imath_random(3, 6)) {
+ if (local->lady_frame == 1) {
+ lady_reset_frame = imath_random(0, 1);
+ } else if (local->lady_frame == 2) {
+ lady_reset_frame = imath_random(0, 2);
+ } else if (local->lady_frame == 3) {
+ lady_reset_frame = imath_random(1, 2);
+ }
+ local->lady_talk_count = 0;
+
+ } else {
+ lady_reset_frame = local->lady_frame - 1;
+ }
+ break;
+
+ case GET_UP:
+ lady_reset_frame = 12;
+ local->lady_action = FREEZE;
+ break;
+
+ case TALK:
+ lady_reset_frame = 3;
+ break;
+ }
+ break;
+
+ case 7: /* end of come to talk */
+ case 8: /* end of talk */
+ case 9: /* end of talk */
+ case 10: /* end of talk */
+ switch (local->lady_action) {
+ case TALK:
+ lady_reset_frame = imath_random(7, 9);
+ ++ local->lady_talk_count;
+ if (local->lady_talk_count > 15) {
+ local->lady_action = FREEZE;
+ local->lady_talk_count = 0;
+ lady_reset_frame = 10; /* make lady shut up */
+ }
+ break;
+
+ default:
+ lady_reset_frame = 10; /* make lady shut up */
+ break;
+ }
+ break;
+
+ case 41: /* lady has hand almost all the way out */
+ player.walker_visible = false;
+ seq[fx_take] = kernel_seq_pingpong(ss[fx_take], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_SPRITE, 4, 1);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_EXPIRE, 0, 2);
+ kernel_seq_depth(seq[fx_take], 3);
+ kernel_seq_player(seq[fx_take], true);
+ kernel_seq_loc(seq[fx_take], player.x + 5, player.y + 4);
+ kernel_seq_range(seq[fx_take], KERNEL_FIRST, KERNEL_LAST);
+ break;
+
+ case 42:
+ if (local->lady_action == GIVE) {
+ lady_reset_frame = 41;
+ }
+ break;
+
+ case 55: /* almost end of sit down */
+ case 19: /* almost end of get up */
+ conv_release();
+ break;
+
+ case 20: /* end of get up */
+ case 44: /* end of give */
+ case 25: /* end of freeze and talk */
+ case 33: /* end of other talk */
+ switch (local->lady_action) {
+ case FREEZE:
+ lady_reset_frame = 24;
+ break;
+
+ case SIT_DOWN:
+ lady_reset_frame = 47;
+ local->lady_action = FREEZE;
+ break;
+
+ case GIVE:
+ lady_reset_frame = 33;
+ break;
+
+ case TALK:
+ it = imath_random(1, 3);
+ switch (it) {
+ case 1: lady_reset_frame = 20; break;
+ case 2: lady_reset_frame = 25; break;
+ case 3: lady_reset_frame = 44; break;
+ }
+ break;
+ }
+ break;
+
+ case 21: /* end of come to talk and talk */
+ case 22: /* end of talk */
+ case 23: /* end of talk */
+ case 24: /* end of talk */
+ switch (local->lady_action) {
+ case TALK:
+ lady_reset_frame = imath_random(20, 23);
+ ++ local->lady_talk_count;
+ if (local->lady_talk_count > 15) {
+ local->lady_action = FREEZE;
+ local->lady_talk_count = 0;
+ lady_reset_frame = 24; /* make lady shut up */
+ }
+ break;
+
+ default:
+ lady_reset_frame = 24; /* make lady shut up */
+ break;
+ }
+ break;
+
+ case 45: /* end of come to talk and talk */
+ case 46: /* end of talk */
+ case 47: /* end of talk */
+ switch (local->lady_action) {
+ case TALK:
+ lady_reset_frame = imath_random(44, 46);
+ ++ local->lady_talk_count;
+ if (local->lady_talk_count > 15) {
+ local->lady_action = FREEZE;
+ local->lady_talk_count = 0;
+ lady_reset_frame = 24; /* make lady shut up */
+ }
+ break;
+
+ default:
+ lady_reset_frame = 24; /* make lady shut up */
+ break;
+ }
+ break;
+
+ case 28: /* end of come to talk */
+ case 29: /* end of talk */
+ case 30: /* end of talk */
+ switch (local->lady_action) {
+ case TALK:
+ lady_reset_frame = imath_random(28, 29);
+ ++ local->lady_talk_count;
+ if (local->lady_talk_count > 15) {
+ local->lady_action = FREEZE;
+ local->lady_talk_count = 0;
+ lady_reset_frame = 30; /* make lady shut up */
+ }
+ break;
+
+ default:
+ lady_reset_frame = 30; /* make lady shut up */
+ break;
+ }
+ break;
+ }
+
+ if (lady_reset_frame >= 0) {
+ kernel_reset_animation(aa[2], lady_reset_frame);
+ local->lady_frame = lady_reset_frame;
+ }
+ }
}
-void room_206_parser() {
+static void handle_anim_end() {
+ int end_reset_frame;
+
+ if (kernel_anim[aa[3]].frame != local->end_frame) {
+ local->end_frame = kernel_anim[aa[3]].frame;
+ end_reset_frame = -1;
+
+ switch (local->end_frame) {
+ case 84:
+ kernel_timing_trigger(12, ROOM_206_END_GAME + 1);
+ break;
+
+ case 85:
+ end_reset_frame = 84;
+ break;
+ }
+ if (end_reset_frame >= 0) {
+ kernel_reset_animation(aa[3], end_reset_frame);
+ local->end_frame = end_reset_frame;
+ }
+ }
+}
+
+static void room_206_init() {
+ if (global[end_of_game]) {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+
+ viewing_at_y = ((video_y - display_y) >> 1);
+ kernel_init_dialog();
+ kernel_set_interface_mode(INTER_LIMITED_SENTENCES);
+
+ local->anim_2_running = false;
+
+ local->left_worker_talk_count = 0;
+ local->right_worker_talk_count = 0;
+ local->lady_talk_count = 0;
+ local->prevent = false;
+
+ aa[0] = kernel_run_animation(kernel_name('w', 1), 0);
+ local->anim_0_running = true;
+
+ aa[1] = kernel_run_animation(kernel_name('w', 2), 0);
+ local->anim_1_running = true;
+
+ aa[3] = kernel_run_animation(kernel_name('e', 1), 0);
+ local->anim_3_running = true;
+
+ } else {
+ kernel_flip_hotspot(words_Greta, false);
+ kernel_flip_hotspot_loc(words_shifter, false, SHIFTER_X, SHIFTER_Y);
+
+ if (global[talked_to_greta]) {
+ kernel_flip_hotspot(words_Greta, true);
+ } else {
+ kernel_flip_hotspot(words_shifter, true);
+ }
+
+ if (previous_room != KERNEL_RESTORING_GAME) {
+ local->anim_0_running = false;
+ local->anim_1_running = false;
+ local->anim_2_running = false;
+ local->anim_3_running = false;
+ }
+
+ conv_get(CONV_53_PID);
+
+ ss[fx_take] = kernel_load_series("*PDRD_9", false);
+
+ local->left_worker_talk_count = 0;
+ local->right_worker_talk_count = 0;
+ local->lady_talk_count = 0;
+ local->prevent = false;
+
+ aa[0] = kernel_run_animation(kernel_name('w', 1), 0);
+ local->anim_0_running = true;
+
+ aa[1] = kernel_run_animation(kernel_name('w', 2), 0);
+ local->anim_1_running = true;
+
+ aa[2] = kernel_run_animation(kernel_name('l', 1), 0);
+ local->lady_action = FREEZE;
+ local->anim_2_running = true;
+
+ if (previous_room == 205 || previous_room != KERNEL_RESTORING_GAME) {
+ player.x = PLAYER_X_FROM_205;
+ player.y = PLAYER_Y_FROM_205;
+ player.facing = FACING_NORTHEAST;
+ }
+ }
+
+ section_2_music();
+}
+
+static void room_206_daemon() {
+ int score;
+
+ if (local->anim_0_running) {
+ handle_anim_left_worker();
+ }
+
+ if (local->anim_1_running) {
+ handle_anim_right_worker();
+ }
+
+ if (local->anim_2_running) {
+ handle_anim_lady();
+ }
+
+ if (local->anim_3_running) {
+ handle_anim_end();
+ }
+
+ switch (kernel.trigger) {
+ case 1:
+ if (local->prevent) {
+ sound_play(N_TakeObjectSnd);
+ inter_give_to_player(shifter_ring);
+ object_examine(shifter_ring, 20613, 0);
+ local->lady_action = FREEZE;
+ ++ global[player_score];
+ }
+ local->prevent = true;
+ break;
+
+ case 2:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ local->prevent = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take]);
+ conv_release();
+ break;
+ }
+
+ if (kernel.trigger == ROOM_206_END_GAME + 1) {
+
+ score = global[player_score];
+ if (score > 250) score = 250;
+
+ text_index[0] = score;
+ text_index[1] = 250;
+
+ if (score <= 25) {
+ text_index[2] = 1;
+ } else if (score <= 50) {
+ text_index[2] = 2;
+ } else if (score <= 75) {
+ text_index[2] = 3;
+ } else if (score <= 100) {
+ text_index[2] = 4;
+ } else if (score <= 150) {
+ text_index[2] = 5;
+ } else if (score <= 200) {
+ text_index[2] = 6;
+ } else if (score <= 249) {
+ text_index[2] = 7;
+ } else if (score <= 250) {
+ text_index[2] = 8;
+ } else {
+ text_index[2] = 9;
+ }
+
+ text_show(99);
+ game.going = false;
+ win_status = 1;
+ }
+}
+
+static void room_206_pre_parser() {
+}
+
+static void process_conv_lady() {
+ int you_trig_flag = false;
+ int me_trig_flag = false;
+
+ if (player_verb == conv053_thanks_only || player_verb == conv053_restart_only) {
+ global[perform_displacements] = true;
+ }
+
+ if (player_verb == conv053_story_b_b) {
+ conv_hold();
+ you_trig_flag = true;
+ me_trig_flag = true;
+ local->lady_action = GET_UP;
+ }
+
+ if (player_verb == conv053_thanks_b_b) {
+ conv_hold();
+ you_trig_flag = true;
+ me_trig_flag = true;
+ local->lady_action = SIT_DOWN;
+ }
+
+ if (player_verb == conv053_focus_b_b) {
+ conv_hold();
+ you_trig_flag = true;
+ me_trig_flag = true;
+ local->lady_action = GIVE;
+ }
+
+ if (kernel.trigger == ROOM_206_YOU_TALK) {
+ local->lady_action = TALK;
+ }
+
+ if (!you_trig_flag) {
+ conv_you_trigger(ROOM_206_YOU_TALK);
+ }
+
+ local->lady_talk_count = 0;
+}
+
+static void room_206_parser() {
+ if (conv_control.running == CONV_53_PID) {
+ process_conv_lady();
+ goto handled;
+ }
+
+ if (player_said_2(talk_to, shifter) ||
+ player_said_2(talk_to, Greta)) {
+
+ if (inter_point_x < 140) {
+ text_show(20615);
+
+ } else {
+ global[perform_displacements] = false;
+ conv_run(CONV_53_PID);
+
+ global[talked_to_greta] = true;
+ kernel_flip_hotspot(words_Greta, true);
+ kernel_flip_hotspot_loc(words_shifter, false, SHIFTER_X, SHIFTER_Y);
+ }
+ goto handled;
+ }
+
+ if (player_said_2(walk_down, path_to_south)) {
+ new_room = 205;
+ goto handled;
+ }
+
+ if (player.look_around) {
+ text_show(20601);
+ goto handled;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+ if (player_said_1(wrecked_bridge)) {
+ text_show(20602);
+ goto handled;
+ }
+
+ if (player_said_1(wrecked_shack)) {
+ if (global[talked_to_greta]) {
+ text_show(20610);
+ } else {
+ text_show(20604);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(river)) {
+ text_show(20605);
+ goto handled;
+ }
+
+ if (player_said_1(shack)) {
+ text_show(20606);
+ goto handled;
+ }
+
+ if (player_said_1(path_to_south)) {
+ text_show(20607);
+ goto handled;
+ }
+
+ if (player_said_1(shifter_village)) {
+ text_show(20608);
+ goto handled;
+ }
+
+ if (player_said_1(shifter) || player_said_1(Greta)) {
+ if (inter_point_x < 140) {
+ text_show(20614);
+ } else if (global[talked_to_greta]) {
+ text_show(20611);
+ } else {
+ text_show(20609);
+ }
+ goto handled;
+ }
+ }
+
+ if (player_said_2(throw, shifter) && inter_point_x < 140) {
+ text_show(20616);
+ goto handled;
+ }
+
+ if (player_said_2(close, wrecked_bridge)) {
+ text_show(20603);
+ goto handled;
+ }
+
+ if (player_said_2(give, Greta)) {
+ text_show(20612);
+ goto handled;
+ }
+
+ if (player_said_1(shack)) {
+ if ((inter_point_x < 182) ||
+ (inter_point_x > 166 && inter_point_y < 54)) {
+ text_show(20618);
+ goto handled;
+ }
+ }
+
+ goto done;
+
+handled:
+ player.command_ready = false;
+
+done:
+ ;
}
void room_206_synchronize(Common::Serializer &s) {
-
+ for (int16 &v : scratch.sprite) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.sequence) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.animation) s.syncAsSint16LE(v);
+ s.syncAsSint16LE(scratch.left_worker_frame);
+ s.syncAsSint16LE(scratch.left_worker_talk_count);
+ s.syncAsSint16LE(scratch.anim_0_running);
+ s.syncAsSint16LE(scratch.right_worker_frame);
+ s.syncAsSint16LE(scratch.right_worker_talk_count);
+ s.syncAsSint16LE(scratch.anim_1_running);
+ s.syncAsSint16LE(scratch.lady_frame);
+ s.syncAsSint16LE(scratch.lady_action);
+ s.syncAsSint16LE(scratch.lady_talk_count);
+ s.syncAsSint16LE(scratch.anim_2_running);
+ s.syncAsSint16LE(scratch.end_frame);
+ s.syncAsSint16LE(scratch.anim_3_running);
+ s.syncAsSint16LE(scratch.prevent);
}
void room_206_preload() {
- room_init_code_pointer = room_206_init;
+ room_init_code_pointer = room_206_init;
room_pre_parser_code_pointer = room_206_pre_parser;
- room_parser_code_pointer = room_206_parser;
- room_daemon_code_pointer = room_206_daemon;
+ room_parser_code_pointer = room_206_parser;
+ room_daemon_code_pointer = room_206_daemon;
+
+ if (kernel.teleported_in) {
+ global[player_persona] = PLAYER_IS_PID;
+ }
section_2_walker();
section_2_interface();
Commit: 5d37b084da2d3ce69f901cbe6e15f6ddec1716dd
https://github.com/scummvm/scummvm/commit/5d37b084da2d3ce69f901cbe6e15f6ddec1716dd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-05-20T21:13:25+10:00
Commit Message:
MADS: DRAGONSPHERE: Add section 3 rooms
Changed paths:
engines/mads/madsv2/dragonsphere/mads/conv.h
engines/mads/madsv2/dragonsphere/mads/inventory.h
engines/mads/madsv2/dragonsphere/mads/sounds.h
engines/mads/madsv2/dragonsphere/mads/words.h
engines/mads/madsv2/dragonsphere/rooms/room301.cpp
engines/mads/madsv2/dragonsphere/rooms/room302.cpp
engines/mads/madsv2/dragonsphere/rooms/room303.cpp
diff --git a/engines/mads/madsv2/dragonsphere/mads/conv.h b/engines/mads/madsv2/dragonsphere/mads/conv.h
index 52a572b9988..3d28fb9da10 100644
--- a/engines/mads/madsv2/dragonsphere/mads/conv.h
+++ b/engines/mads/madsv2/dragonsphere/mads/conv.h
@@ -218,6 +218,28 @@ enum {
conv054_offer_b_b = 33
};
+enum {
+ conv055_greet_only = 0,
+ conv055_restart = 8,
+ conv055_exit_b_b = 13
+};
+
+enum {
+ conv056_ralphre2_permit = 2
+};
+
+enum {
+ conv057_startquiz_only = 0,
+ conv057_startquiz = 0,
+ conv057_newquiz = 25,
+ conv057_exit_b_b = 29,
+ conv057_respons_b_b = 33,
+ conv057_restart = 39,
+ conv057_exit_d_d = 51,
+ conv057_exit_f_f = 59,
+ conv057_exit_h_h = 61
+};
+
} // namespace Dragonsphere
} // namespace MADSV2
} // namespace MADS
diff --git a/engines/mads/madsv2/dragonsphere/mads/inventory.h b/engines/mads/madsv2/dragonsphere/mads/inventory.h
index 221fce4c1ea..5c10d42687c 100644
--- a/engines/mads/madsv2/dragonsphere/mads/inventory.h
+++ b/engines/mads/madsv2/dragonsphere/mads/inventory.h
@@ -37,8 +37,10 @@ enum {
fruit = 7,
pid_doll = 8,
polystone = 9,
+ red_powerstone = 10,
key_crown = 13,
statue = 15,
+ bottle_of_flies = 16,
soul_egg = 17,
magic_belt = 18,
amulet = 19,
diff --git a/engines/mads/madsv2/dragonsphere/mads/sounds.h b/engines/mads/madsv2/dragonsphere/mads/sounds.h
index 7abb4203538..cb355a2ebe3 100644
--- a/engines/mads/madsv2/dragonsphere/mads/sounds.h
+++ b/engines/mads/madsv2/dragonsphere/mads/sounds.h
@@ -61,7 +61,13 @@ enum {
N_LavaPlops = 68,
N_002HealMeSnd = 70,
N_MouthRockTalks = 71,
- N_PoolMonsterEatsPid = 72
+ N_PoolMonsterEatsPid = 72,
+
+ // Section 3
+ N_ToadEatsPlayer = 70,
+ N_RalphIsRed = 71,
+ N_EveryoneScatter = 72,
+ N_CrystalPing = 73
};
} // namespace Dragonsphere
diff --git a/engines/mads/madsv2/dragonsphere/mads/words.h b/engines/mads/madsv2/dragonsphere/mads/words.h
index d554597ae01..62404d3ae58 100644
--- a/engines/mads/madsv2/dragonsphere/mads/words.h
+++ b/engines/mads/madsv2/dragonsphere/mads/words.h
@@ -81,6 +81,7 @@ enum {
words_rope = 101,
words_tie = 102,
words_take_magic_from = 104,
+ words_dead_rat = 105,
words_crystal_ball = 109,
words_gaze_into = 110,
words_invoke_power_of = 111,
@@ -89,8 +90,10 @@ enum {
words_shift_into_seal = 117,
words_shift_into_snake = 118,
words_revert = 119,
+ words_ratsicle = 123,
words_tentacle_parts = 125,
words_rare_coin = 129,
+ words_crystal_flower = 131,
words_emerald = 136,
words_speak_words_on = 138,
words_touch = 146,
@@ -155,6 +158,7 @@ enum {
words_desk = 238,
words_door_to_meeting_room = 249,
words_door_to_ballroom = 250,
+ words_flowers = 251,
words_door_to_courtyard = 254,
words_platform = 255,
words_step = 256,
@@ -168,11 +172,13 @@ enum {
words_ward = 268,
words_darkness_beast = 269,
words_guard = 272,
+ words_crown = 273,
words_doorway = 277,
words_faerie = 278,
words_guard_captain = 280,
words_merchant = 281,
words_shapechanger = 282,
+ words_flies = 286,
words_flask_of_acid = 287,
words_soporific = 289,
words_parchment = 290,
@@ -200,6 +206,7 @@ enum {
words_teleportal = 440,
words_Soptus_Ecliptus = 448,
words_Slathan_ni_Patan = 453,
+ words_bush = 482,
words_pool = 497,
words_guardhouse = 509,
words_bone_tree = 510,
@@ -223,10 +230,24 @@ enum {
words_shack = 547,
words_wrecked_shack = 548,
words_wise_shifter = 549,
+ words_grass = 550,
+ words_entrance_to_maze = 551,
+ words_topiary_toad = 552,
words_boulder = 553,
+ words_mushroom = 554,
words_Slathan_sky = 555,
words_Greta = 556,
+ words_tree_stump = 557,
+ words_sanctuary_woods = 558,
+ words_toads = 559,
words_shifting_monster = 561,
+ words_sprite = 562,
+ words_maze = 563,
+ words_topiary_toadstool = 564,
+ words_topiary_gargoyle = 565,
+ words_topiary_dragon = 566,
+ words_guardian = 567,
+ words_Butterfly_King = 568,
words_Dragonsphere = 571
};
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room301.cpp b/engines/mads/madsv2/dragonsphere/rooms/room301.cpp
index 60fe2d788df..b6adff1e46a 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room301.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room301.cpp
@@ -1,4 +1,4 @@
-/* ScummVM - Graphic Adventure Engine
+/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
@@ -23,6 +23,7 @@
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/player.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
@@ -39,40 +40,532 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15];
+ int16 sequence[15];
+ int16 animation[4];
+
+ int16 girl_frame;
+ int16 girl_action;
+ int16 girl_talk_count;
+ int16 anim_0_running;
+ int16 cut_scene;
};
+static Scratch scratch;
+
#define local (&scratch)
#define ss local->sprite
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
+#define fx_guard 1
+
+#define ROOM_301_ME_TALK 60
+#define ROOM_301_YOU_TALK 62
+#define MUSIC 80
+
+#define PLAYER_X_FROM_120 335
+#define PLAYER_Y_FROM_120 117
+#define WALK_TO_X_FROM_120 298
+#define WALK_TO_Y_FROM_120 117
+
+#define PLAYER_X_FROM_302 55
+#define PLAYER_Y_FROM_302 113
+#define WALK_TO_X_FROM_302 95
+#define WALK_TO_Y_FROM_302 113
+
+#define CONV_55_KING 55
+
+#define FREEZE 0
+#define POINT 1
+#define TONGUE 2
+#define TEASE 3
+#define TALK 4
+#define LOOK_LEFT 5
+#define TALK_POINT 6
+
+#define BUB_X 92
+#define BUB_Y 114
+
+#define GUARD_X 68
+#define GUARD_Y 102
+
+
+static void handle_anim_girl() {
+ int girl_reset_frame;
+ int it;
+
+ if (kernel_anim[aa[0]].frame != local->girl_frame) {
+ local->girl_frame = kernel_anim[aa[0]].frame;
+ girl_reset_frame = -1;
+
+ switch (local->girl_frame) {
+ case 1: /* end of freeze & talk */
+ case 21: /* end of talk */
+ case 33: /* end of tongue */
+ case 86: /* end of tease */
+ case 63: /* end of point left */
+ case 52: /* end of look left */
+ switch (local->girl_action) {
+ case FREEZE:
+ girl_reset_frame = 0;
+ if (player.x < 160 && player.y > 100) {
+ local->girl_action = LOOK_LEFT;
+ girl_reset_frame = 33;
+
+ } else if (player.y > 90) {
+ it = imath_random(1, 110);
+ local->girl_talk_count = 0;
+
+ if (it == 1) {
+ girl_reset_frame = 20;
+ local->girl_action = TONGUE;
+
+ } else if (it == 2) {
+ girl_reset_frame = 63;
+ }
+ }
+ break;
+
+ case TALK_POINT:
+ girl_reset_frame = 4;
+ local->girl_action = POINT;
+ break;
+
+ case POINT:
+ girl_reset_frame = 52;
+ local->girl_action = FREEZE;
+ break;
+
+ case TONGUE:
+ girl_reset_frame = 21;
+ local->girl_action = FREEZE;
+ break;
+
+ case TEASE:
+ girl_reset_frame = 63;
+ local->girl_action = FREEZE;
+ break;
+
+ case LOOK_LEFT:
+ girl_reset_frame = 33;
+ break;
+
+ case TALK:
+ if (imath_random(1, 2) == 1) {
+ girl_reset_frame = 4;
+ local->girl_action = FREEZE;
+ } else {
+ girl_reset_frame = 1;
+ }
+ break;
+ }
+ break;
-void room_301_init() {
+ case 27: /* giving the tongue */
+ ++local->girl_talk_count;
+ if (local->girl_talk_count > imath_random(10, 15)) {
+ local->girl_action = FREEZE;
+ }
+ if (local->girl_action == TONGUE) {
+ girl_reset_frame = 26;
+ }
+ break;
+
+ case 57: /* make guardian go away */
+ kernel_seq_delete(seq[fx_guard]);
+ kernel_flip_hotspot(words_guardian, false);
+ aa[2] = kernel_run_animation(kernel_name('g', 1), 0);
+ player.commands_allowed = true;
+ break;
+
+ case 42: /* looking left */
+ if (local->girl_action == LOOK_LEFT) {
+ girl_reset_frame = 41;
+
+ if (player.x > 159) {
+ local->girl_action = FREEZE;
+ girl_reset_frame = 42;
+ }
+ }
+ break;
+
+ case 2: /* end of talk */
+ case 3:
+ case 4:
+ switch (local->girl_action) {
+ case TALK:
+ girl_reset_frame = imath_random(1, 3);
+ ++local->girl_talk_count;
+ if (local->girl_talk_count > 15) {
+ local->girl_action = FREEZE;
+ local->girl_talk_count = 0;
+ girl_reset_frame = 0; /* make girl shut up */
+ }
+ break;
+
+ default:
+ girl_reset_frame = 0; /* make girl shut up */
+ break;
+ }
+ break;
+ }
+
+ if (girl_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], girl_reset_frame);
+ local->girl_frame = girl_reset_frame;
+ }
+ }
}
-void room_301_daemon() {
+static void room_301_init() {
+ kernel.disable_fastwalk = true;
+ local->cut_scene = false;
+
+ if (previous_room != KERNEL_RESTORING_GAME) {
+ local->anim_0_running = false;
+ }
+
+ if (global[bubbles_up_in_301]) {
+
+ ss[fx_guard] = kernel_load_series(kernel_name('x', 8), false);
+
+ seq[fx_guard] = kernel_seq_forward(ss[fx_guard], false, 6, 0, 0, 0);
+ kernel_seq_depth(seq[fx_guard], 3);
+ kernel_seq_loc(seq[fx_guard], GUARD_X, GUARD_Y);
+ kernel_seq_range(seq[fx_guard], KERNEL_FIRST, KERNEL_LAST);
+
+ } else {
+ kernel_flip_hotspot(words_guardian, false);
+ }
+ if (global[player_persona] == PLAYER_IS_KING) {
+ conv_get(CONV_55_KING);
+
+ aa[0] = kernel_run_animation(kernel_name('f', 1), 0);
+ local->anim_0_running = true;
+ local->girl_action = FREEZE;
+
+ } else {
+ kernel_flip_hotspot(words_faerie, false);
+ local->anim_0_running = false;
+ }
+
+ if (previous_room == 302) {
+ player_first_walk(PLAYER_X_FROM_302, PLAYER_Y_FROM_302, FACING_EAST,
+ WALK_TO_X_FROM_302, WALK_TO_Y_FROM_302, FACING_EAST, true);
+
+ } else if ((previous_room == 120) || (previous_room != KERNEL_RESTORING_GAME)) {
+ player_first_walk(PLAYER_X_FROM_120, PLAYER_Y_FROM_120, FACING_WEST,
+ WALK_TO_X_FROM_120, WALK_TO_Y_FROM_120, FACING_WEST, true);
+ }
+
+ section_3_music();
}
-void room_301_pre_parser() {
+static void room_301_daemon() {
+ if (local->anim_0_running) {
+ handle_anim_girl();
+ }
+ if (kernel.trigger == MUSIC) {
+ sound_play(N_BackgroundMus);
+ }
+
+ if (local->cut_scene && !player.walking) {
+ local->cut_scene = false;
+ global[dragon_my_scene]--;
+ }
}
-void room_301_parser() {
+static void process_conv_girl() {
+ int you_trig_flag = false;
+ int me_trig_flag = false;
+
+ if (player_verb == conv055_exit_b_b) {
+ *conv_my_next_start = conv055_restart;
+ conv_abort();
+ local->girl_action = TALK_POINT;
+ global[bubbles_up_in_301] = false;
+ global[player_score] += 2;
+ you_trig_flag = true;
+ me_trig_flag = true;
+ player.commands_allowed = false;
+ }
+
+ if (kernel.trigger == ROOM_301_YOU_TALK) {
+ if (player_verb == conv055_greet_only) {
+ local->girl_action = TEASE;
+ } else if (local->girl_action != POINT && local->girl_action != TALK_POINT) {
+ local->girl_action = TALK;
+ }
+ }
+
+ if (kernel.trigger == ROOM_301_ME_TALK) {
+ local->girl_action = FREEZE;
+ }
+
+ if (!you_trig_flag) {
+ conv_you_trigger(ROOM_301_YOU_TALK);
+ }
+
+ if (!me_trig_flag) {
+ conv_me_trigger(ROOM_301_ME_TALK);
+ }
+
+ local->girl_talk_count = 0;
+}
+
+static void room_301_pre_parser() {
+ if (!player_said_2(walk_down, path_to_east) && local->cut_scene) {
+ local->cut_scene = false;
+ global[dragon_my_scene]--;
+ }
+
+ if (player_said_2(walk_down, path_to_east)) {
+ global[pre_room] = 301;
+ if (global[dragon_my_scene] < global[dragon_high_scene]) {
+ if (!local->cut_scene) {
+ global[dragon_my_scene]++;
+ }
+ player.walk_off_edge_to_room = 111;
+ local->cut_scene = true;
+
+ } else if (local->cut_scene) {
+ player.walk_off_edge_to_room = 111;
+
+ } else {
+ player.walk_off_edge_to_room = 120;
+ }
+ }
+
+ if (player_said_1(entrance_to_maze) && player.need_to_walk) {
+ if (global[bubbles_up_in_301]) {
+ player_walk(BUB_X, BUB_Y, FACING_WEST);
+
+ } else if (!player_said_1(walk_through)) {
+ player.need_to_walk = false;
+ }
+ }
+}
+
+static void room_301_parser() {
+ if (conv_control.running == CONV_55_KING) {
+ process_conv_girl();
+ goto handled;
+ }
+
+ if (player_said_2(talk_to, faerie)) {
+ conv_run(CONV_55_KING);
+ goto handled;
+ }
+
+ if (player_said_2(walk_through, entrance_to_maze)) {
+ if (global[bubbles_up_in_301]) {
+ text_show(30101);
+ } else {
+ new_room = 302;
+ }
+ goto handled;
+ }
+
+ if (player.look_around) {
+ text_show(30122);
+ if (global[bubbles_up_in_301]) {
+ text_show(30123);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+
+ if (player_said_1(mushroom)) {
+ text_show(30102);
+ goto handled;
+ }
+
+ if (player_said_1(ground)) {
+ text_show(30105);
+ goto handled;
+ }
+
+ if (player_said_1(hedge)) {
+ text_show(30106);
+ goto handled;
+ }
+
+ if (player_said_1(boulder)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(30110);
+ } else {
+ text_show(30111);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(path_to_east)) {
+ text_show(30112);
+ goto handled;
+ }
+
+ if (player_said_1(faerie)) {
+ text_show(30113);
+ goto handled;
+ }
+
+ if (player_said_1(rock)) {
+ text_show(30124);
+ goto handled;
+ }
+
+ if (player_said_1(guardian)) {
+ text_show(30125);
+ goto handled;
+ }
+
+ if (player_said_1(entrance_to_maze)) {
+ if (global[bubbles_up_in_301]) {
+ text_show(30118);
+ } else {
+ text_show(30119);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(grass)) {
+ text_show(30120);
+ goto handled;
+ }
+
+ if (player_said_1(topiary_toad)) {
+ text_show(30128);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(talk_to, topiary_toad) || player_said_2(give, topiary_toad)) {
+ text_show(30129);
+ goto handled;
+ }
+
+ if (player_said_3(sword, attack, mushroom) ||
+ player_said_3(sword, carve_up, mushroom) ||
+ player_said_3(sword, thrust, mushroom) ||
+ player_said_2(take, mushroom) ||
+ player_said_2(pull, mushroom)) {
+ text_show(30103);
+ goto handled;
+ }
+
+ if (player_said_3(sword, attack, hedge) ||
+ player_said_3(sword, carve_up, hedge) ||
+ player_said_3(sword, thrust, hedge) ||
+ player_said_2(take, hedge) ||
+ player_said_2(open, hedge) ||
+ player_said_2(push, hedge) ||
+ player_said_2(pour_contents_of, hedge) ||
+ player_said_2(pull, hedge)) {
+ text_show(30107);
+ goto handled;
+ }
+
+ if (player_said_3(sword, attack, faerie) ||
+ player_said_3(sword, carve_up, faerie) ||
+ player_said_3(sword, thrust, faerie) ||
+ player_said_2(push, faerie) ||
+ player_said_2(pour_contents_of, faerie) ||
+ player_said_2(throw, faerie) ||
+ player_said_2(pull, faerie)) {
+ text_show(30114);
+ goto handled;
+ }
+
+ if (player_said_3(sword, attack, grass) ||
+ player_said_3(sword, carve_up, grass) ||
+ player_said_3(sword, thrust, grass) ||
+ player_said_2(take, grass) ||
+ player_said_2(pour_contents_of, grass) ||
+ player_said_2(pull, grass)) {
+ text_show(30121);
+ goto handled;
+ }
+
+ if (player_said_2(open, flies)) {
+ text_show(30108);
+ goto handled;
+ }
+
+ if (player_said_2(put, mushroom)) {
+ text_show(30104);
+ goto handled;
+ }
+
+ if (player_said_2(take_magic_from, entrance_to_maze)) {
+ if (global[bubbles_up_in_301]) {
+ text_show(30109);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(give, faerie)) {
+ text_show(30115);
+ goto handled;
+ }
+
+ if (player_said_2(talk_to, guardian)) {
+ text_show(30126);
+ goto handled;
+ }
+
+ if (player_said_2(take, bush) || player_said_2(pull, bush)) {
+ text_show(30117);
+ goto handled;
+ }
+
+ if (player_said_1(push) ||
+ player_said_1(pull) ||
+ player_said_2(sword, attack) ||
+ player_said_2(sword, carve_up) ||
+ player_said_2(sword, thrust) ||
+ player_said_1(pour_contents_of)) {
+
+ if (player_said_1(guardian)) {
+ text_show(30127);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(take_magic_from, guardian)) {
+ text_show(30220);
+ goto handled;
+ }
+
+ goto done;
+
+handled:
+ player.command_ready = false;
+done:
+ ;
}
void room_301_synchronize(Common::Serializer &s) {
-
+ for (int16 &v : scratch.sprite) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.sequence) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.animation) s.syncAsSint16LE(v);
+ s.syncAsSint16LE(scratch.girl_frame);
+ s.syncAsSint16LE(scratch.girl_action);
+ s.syncAsSint16LE(scratch.girl_talk_count);
+ s.syncAsSint16LE(scratch.anim_0_running);
+ s.syncAsSint16LE(scratch.cut_scene);
}
void room_301_preload() {
- room_init_code_pointer = room_301_init;
+ room_init_code_pointer = room_301_init;
room_pre_parser_code_pointer = room_301_pre_parser;
- room_parser_code_pointer = room_301_parser;
- room_daemon_code_pointer = room_301_daemon;
+ room_parser_code_pointer = room_301_parser;
+ room_daemon_code_pointer = room_301_daemon;
section_3_walker();
section_3_interface();
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room302.cpp b/engines/mads/madsv2/dragonsphere/rooms/room302.cpp
index ee315299aac..4c8ac52b59a 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room302.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room302.cpp
@@ -1,4 +1,4 @@
-/* ScummVM - Graphic Adventure Engine
+/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
@@ -22,6 +22,7 @@
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
#include "mads/madsv2/core/sound.h"
#include "mads/madsv2/core/text.h"
@@ -39,43 +40,911 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15];
+ int16 sequence[15];
+ int16 animation[4];
+
+ int16 move_counter[8];
+ int16 direction[8];
+ int16 sprite_num[8];
+ int16 bubble_x[8];
+ int16 bubble_y[8];
+ int16 dyna[8];
+
+ int16 prevent;
+
+ int16 death_frame;
+ int16 anim_0_running;
+ int16 bubbles_here;
+
+ int16 leave;
+ int16 at_end;
+
+ int16 change_counter;
+
+ int16 guard_1_x;
+ int16 guard_1_y;
+ int16 guard_2_x;
+ int16 guard_2_y;
+ int16 guard_leave;
+ int16 guard_1_frame;
+ int16 guard_2_frame;
+
+ int16 xxx;
+ int16 run_conv;
};
+static Scratch scratch;
+
#define local (&scratch)
#define ss local->sprite
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
+#define fx_bubble 9
+#define fx_guard_1 10
+#define fx_guard_2 11
+
+#define ROOM_302_BUBBLES 60
+#define ROOM_302_GUARDS 70
+
+#define PLAYER_X_FROM_301 335
+#define PLAYER_Y_FROM_301 110
+#define WALK_TO_X_FROM_301 300
+#define WALK_TO_Y_FROM_301 110
+
+#define PLAYER_X_FROM_303 -20
+#define PLAYER_Y_FROM_303 110
+#define WALK_TO_X_FROM_303 20
+#define WALK_TO_Y_FROM_303 110
+
+#define RED 0
+#define YELLOW 1
+#define BLUE 2
+
+#define NORTHEAST 1
+#define NORTH 2
+#define NORTHWEST 3
+#define WEST 4
+#define SOUTHWEST 5
+#define SOUTH 6
+#define SOUTHEAST 7
+#define EAST 8
+
+#define MAX_LEFT_X 30
+#define MAX_RIGHT_X 200
+
+#define MAX_TOP_Y 20
+#define MAX_BOTTOM_Y 110
+
+#define MAX_MOVE_COUNTER 15
+
+#define CONV_56_BUBBLE 56
+
+#define DEATH_X 99
+#define DEATH_Y 108
+
+#define GUARD_1_X 36
+#define GUARD_1_Y 60
+#define GUARD_2_X 14
+#define GUARD_2_Y 100
+
+
+static int get_direction(int dir, int count) {
+ int it = 0;
-void room_302_init() {
+ if (local->bubble_x[count] >= MAX_RIGHT_X) {
+ if (dir > 8) {
+ dir = WEST;
+ }
+ }
+ if (local->bubble_y[count] >= MAX_BOTTOM_Y) {
+ if (dir > 8) {
+ dir = NORTH;
+ }
+ }
+
+ if (local->bubble_y[count] <= MAX_TOP_Y) {
+ if (dir > 8) {
+ dir = SOUTH;
+ }
+ }
+
+ if (local->bubble_x[count] <= MAX_LEFT_X) {
+ if (dir > 8) {
+ dir = EAST;
+ }
+ }
+
+ switch (dir) {
+ case NORTH:
+ if (imath_random(1, 2) == 1) {
+ it = SOUTHWEST;
+ --local->bubble_x[count];
+ ++local->bubble_y[count];
+
+ } else {
+ it = SOUTHEAST;
+ ++local->bubble_x[count];
+ ++local->bubble_y[count];
+ }
+ break;
+
+ case SOUTH:
+ if (imath_random(1, 2) == 1) {
+ it = NORTHWEST;
+ --local->bubble_x[count];
+ --local->bubble_y[count];
+
+ } else {
+ it = NORTHEAST;
+ ++local->bubble_x[count];
+ --local->bubble_y[count];
+ }
+ break;
+
+ case EAST:
+ if (imath_random(1, 2) == 1) {
+ it = NORTHWEST;
+ --local->bubble_x[count];
+ --local->bubble_y[count];
+
+ } else {
+ it = SOUTHWEST;
+ --local->bubble_x[count];
+ ++local->bubble_y[count];
+ }
+ break;
+
+ case WEST:
+ if (imath_random(1, 2) == 1) {
+ it = SOUTHEAST;
+ ++local->bubble_x[count];
+ ++local->bubble_y[count];
+
+ } else {
+ it = NORTHEAST;
+ ++local->bubble_x[count];
+ --local->bubble_y[count];
+ }
+ break;
+
+ case NORTHEAST:
+ if (local->bubble_x[count] >= MAX_RIGHT_X) {
+ it = NORTHWEST;
+ --local->bubble_x[count];
+ --local->bubble_y[count];
+
+ } else if (local->bubble_y[count] <= MAX_TOP_Y) {
+ it = SOUTHEAST;
+ ++local->bubble_x[count];
+ ++local->bubble_y[count];
+
+ } else {
+ }
+ break;
+
+ case SOUTHEAST:
+ if (local->bubble_x[count] >= MAX_RIGHT_X) {
+ it = SOUTHWEST;
+ --local->bubble_x[count];
+ ++local->bubble_y[count];
+
+ } else if (local->bubble_y[count] >= MAX_BOTTOM_Y) {
+ it = NORTHEAST;
+ ++local->bubble_x[count];
+ --local->bubble_y[count];
+ } else {
+ }
+ break;
+
+ case NORTHWEST:
+ if (local->bubble_y[count] <= MAX_TOP_Y) {
+ it = SOUTHWEST;
+ --local->bubble_x[count];
+ ++local->bubble_y[count];
+
+ } else if (local->bubble_x[count] <= MAX_LEFT_X) {
+ it = NORTHEAST;
+ ++local->bubble_x[count];
+ --local->bubble_y[count];
+ } else {
+ }
+ break;
+
+ case SOUTHWEST:
+ if (local->bubble_y[count] >= MAX_BOTTOM_Y) {
+ it = NORTHWEST;
+ --local->bubble_x[count];
+ --local->bubble_y[count];
+
+ } else if (local->bubble_x[count] <= MAX_LEFT_X) {
+ it = SOUTHEAST;
+ ++local->bubble_x[count];
+ ++local->bubble_y[count];
+ }
+ break;
+ }
+
+ return it;
}
-void room_302_daemon() {
+static void animate_bubbles() {
+ int count;
+ int it;
+
+ kernel_purge_dynamic();
+ ++local->change_counter;
+ if (local->change_counter == 2) {
+ local->change_counter = 0;
+ }
+
+ for (count = 0; count < 8; count++) {
+ ++local->move_counter[count];
+
+ ++local->sprite_num[count];
+ if (local->sprite_num[count] >= 30) {
+ local->sprite_num[count] = 1;
+ }
+
+ if (local->move_counter[count] > MAX_MOVE_COUNTER) {
+ local->move_counter[count] = 0;
+
+ switch (local->direction[count]) {
+ case NORTH:
+ local->direction[count] = (int16)imath_random(1, 3);
+ break;
+
+ case SOUTH:
+ local->direction[count] = (int16)imath_random(5, 7);
+ break;
+
+ case EAST:
+ it = imath_random(1, 3);
+ if (it == 1) local->direction[count] = NORTHEAST;
+ if (it == 2) local->direction[count] = EAST;
+ if (it == 3) local->direction[count] = SOUTHEAST;
+ break;
+
+ case WEST:
+ local->direction[count] = (int16)imath_random(3, 5);
+ break;
+
+ case NORTHEAST:
+ it = imath_random(1, 3);
+ if (it == 1) local->direction[count] = NORTH;
+ if (it == 2) local->direction[count] = NORTHEAST;
+ if (it == 3) local->direction[count] = EAST;
+ break;
+
+ case SOUTHEAST:
+ local->direction[count] = (int16)imath_random(6, 8);
+ break;
+
+ case NORTHWEST:
+ local->direction[count] = (int16)imath_random(2, 4);
+ break;
+
+ case SOUTHWEST:
+ local->direction[count] = (int16)imath_random(4, 6);
+ break;
+ }
+ }
+
+ if (local->bubble_x[count] >= MAX_RIGHT_X ||
+ local->bubble_y[count] >= MAX_BOTTOM_Y ||
+ local->bubble_y[count] <= MAX_TOP_Y ||
+ local->bubble_x[count] <= MAX_LEFT_X) {
+
+ local->direction[count] = (int16)get_direction(local->direction[count], count);
+ local->move_counter[count] = 0;
+ }
+
+ if (local->change_counter == 0 || game.difficulty == HARD_MODE) {
+ switch (local->direction[count]) {
+ case NORTH:
+ --local->bubble_y[count];
+ break;
+
+ case SOUTH:
+ ++local->bubble_y[count];
+ break;
+
+ case EAST:
+ ++local->bubble_x[count];
+ break;
+
+ case WEST:
+ --local->bubble_x[count];
+ break;
+
+ case NORTHEAST:
+ ++local->bubble_x[count];
+ --local->bubble_y[count];
+ break;
+
+ case SOUTHEAST:
+ ++local->bubble_x[count];
+ ++local->bubble_y[count];
+ break;
+
+ case NORTHWEST:
+ --local->bubble_x[count];
+ --local->bubble_y[count];
+ break;
+
+ case SOUTHWEST:
+ --local->bubble_x[count];
+ ++local->bubble_y[count];
+ break;
+ }
+ }
+
+ if (local->bubble_x[count] >= MAX_RIGHT_X ||
+ local->bubble_y[count] >= MAX_BOTTOM_Y ||
+ local->bubble_y[count] <= MAX_TOP_Y ||
+ local->bubble_x[count] <= MAX_LEFT_X) {
+
+ local->direction[count] = (int16)get_direction(local->direction[count], count);
+ local->move_counter[count] = 0;
+ }
+
+ if (count == 0 && local->sprite_num[count] == 1) {
+ sound_play(N_RalphIsRed);
+ }
+
+ kernel_seq_delete(seq[count]);
+ seq[count] = kernel_seq_stamp(ss[fx_bubble], false, local->sprite_num[count]);
+ kernel_seq_depth(seq[count], 2);
+ kernel_seq_loc(seq[count], local->bubble_x[count], local->bubble_y[count]);
+
+ local->dyna[count] = kernel_add_dynamic(words_sprite, words_look_at, SYNTAX_SINGULAR,
+ KERNEL_NONE, local->bubble_x[count] - 5, local->bubble_y[count] - 8,
+ 11, 11);
+ kernel_dynamic_hot[local->dyna[count]].prep = PREP_ON;
+ }
+
+ kernel_timing_trigger(5, ROOM_302_BUBBLES);
}
-void room_302_pre_parser() {
+static void leave_screen() {
+ int count;
+
+ kernel_purge_dynamic();
+ kernel_flip_hotspot(words_guardian, false);
+
+ local->bubble_x[0] += -3;
+ local->bubble_x[1] += -3;
+ local->bubble_y[2] += -3;
+ local->bubble_y[3] += -3;
+ local->bubble_y[4] += -3;
+ local->bubble_y[5] += 3;
+ local->bubble_y[6] += 3;
+ local->bubble_y[7] += 3;
+
+ for (count = 0; count < 8; count++) {
+
+ ++local->sprite_num[count];
+ if (local->sprite_num[count] >= 30) {
+ local->sprite_num[count] = 1;
+ }
+
+ kernel_seq_delete(seq[count]);
+ seq[count] = kernel_seq_stamp(ss[fx_bubble], false, local->sprite_num[count]);
+ kernel_seq_depth(seq[count], 2);
+ kernel_seq_loc(seq[count], local->bubble_x[count], local->bubble_y[count]);
+ }
+ if (local->bubble_x[0] < -5 &&
+ local->bubble_x[1] < -5 &&
+
+ local->bubble_y[2] < -7 &&
+ local->bubble_y[3] < -7 &&
+ local->bubble_y[4] < -7 &&
+
+ local->bubble_y[5] > 155 &&
+ local->bubble_y[6] > 155 &&
+ local->bubble_y[7] > 155) {
+
+ local->leave = false;
+ local->bubbles_here = false;
+ player.commands_allowed = true;
+ }
}
-void room_302_parser() {
+static void guard_leave_screen() {
+ kernel_seq_delete(seq[fx_guard_1]);
+ kernel_seq_delete(seq[fx_guard_2]);
+
+ local->guard_1_x += 3;
+ local->guard_1_y += 3;
+
+ local->guard_2_x += 3;
+ local->guard_2_y += -3;
+ ++local->guard_1_frame;
+ if (local->guard_1_frame == 9) {
+ local->guard_1_frame = 1;
+ }
+
+ ++local->guard_2_frame;
+ if (local->guard_2_frame == 6) {
+ local->guard_2_frame = 1;
+ }
+
+ seq[fx_guard_1] = kernel_seq_stamp(ss[fx_guard_1], false, local->guard_1_frame);
+ kernel_seq_depth(seq[fx_guard_1], 1);
+ kernel_seq_loc(seq[fx_guard_1], local->guard_1_x, local->guard_1_y);
+
+ seq[fx_guard_2] = kernel_seq_stamp(ss[fx_guard_2], false, local->guard_2_frame);
+ kernel_seq_depth(seq[fx_guard_2], 1);
+ kernel_seq_loc(seq[fx_guard_2], local->guard_2_x, local->guard_2_y);
+}
+
+static void handle_anim_death() {
+ int death_reset_frame;
+
+ if (kernel_anim[aa[0]].frame != local->death_frame) {
+ local->death_frame = kernel_anim[aa[0]].frame;
+ death_reset_frame = -1;
+
+ switch (local->death_frame) {
+ case 6:
+ player.walker_visible = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_ANIM, aa[0]);
+ break;
+
+ case 22:
+ seq[fx_guard_1] = kernel_seq_forward(ss[fx_guard_1], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_guard_1], 13);
+ kernel_seq_range(seq[fx_guard_1], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_loc(seq[fx_guard_1], GUARD_1_X, GUARD_1_Y);
+ kernel_seq_scale(seq[fx_guard_1], 100);
+ kernel_synch(KERNEL_SERIES, seq[fx_guard_1], KERNEL_ANIM, aa[0]);
+ break;
+
+ case 27:
+ if (game.difficulty == EASY_MODE) {
+ text_show(30226);
+ } else {
+ text_show(45);
+ }
+ kernel.force_restart = true;
+ break;
+ }
+
+ if (death_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], death_reset_frame);
+ local->death_frame = death_reset_frame;
+ }
+ }
+}
+
+static void room_302_init() {
+ int count;
+
+ kernel.disable_fastwalk = true;
+
+ if (!global[bubble_wont_attack]) {
+ conv_get(CONV_56_BUBBLE);
+ }
+
+ local->run_conv = -1;
+ local->xxx = 0;
+
+ local->change_counter = 0;
+
+ if ((game.difficulty == EASY_MODE && global[bubble_wont_attack]) ||
+ (game.difficulty == HARD_MODE && player_has_been_in_room(303))) {
+ local->bubbles_here = false;
+ kernel_flip_hotspot(words_guardian, false);
+
+ } else {
+ local->bubbles_here = true;
+ ss[fx_bubble] = kernel_load_series(kernel_name('x', 9), false);
+ ss[fx_guard_1] = kernel_load_series(kernel_name('x', 1), false);
+ ss[fx_guard_2] = kernel_load_series(kernel_name('x', 2), false);
+
+ seq[fx_guard_1] = kernel_seq_forward(ss[fx_guard_1], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_guard_1], 13);
+ kernel_seq_range(seq[fx_guard_1], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_loc(seq[fx_guard_1], GUARD_1_X, GUARD_1_Y);
+ kernel_seq_scale(seq[fx_guard_1], 100);
+
+ seq[fx_guard_2] = kernel_seq_forward(ss[fx_guard_2], false, 7, 0, 0, 0);
+ kernel_seq_depth(seq[fx_guard_2], 2);
+ kernel_seq_range(seq[fx_guard_2], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_loc(seq[fx_guard_2], GUARD_2_X, GUARD_2_Y);
+ kernel_seq_scale(seq[fx_guard_2], 100);
+
+ for (count = 0; count < 8; count++) {
+ if (previous_room != KERNEL_RESTORING_GAME) {
+ local->move_counter[count] = (int16)imath_random(1, MAX_MOVE_COUNTER);
+ local->direction[count] = (int16)imath_random(1, 8);
+ local->sprite_num[count] = (int16)imath_random(1, 30);
+ local->bubble_x[count] = (int16)imath_random(MAX_LEFT_X + 1, MAX_RIGHT_X - 1);
+ local->bubble_y[count] = (int16)imath_random(MAX_TOP_Y + 1, MAX_BOTTOM_Y - 1);
+ }
+
+ seq[count] = kernel_seq_stamp(ss[fx_bubble], false, local->sprite_num[count]);
+ kernel_seq_depth(seq[count], 2);
+ kernel_seq_loc(seq[count], local->bubble_x[count], local->bubble_y[count]);
+
+ local->dyna[count] = kernel_add_dynamic(words_sprite, words_look_at, SYNTAX_SINGULAR,
+ seq[count], 0, 0, 0, 0);
+ }
+ kernel_timing_trigger(3, ROOM_302_BUBBLES);
+ }
+
+ local->prevent = false;
+ local->anim_0_running = false;
+ local->leave = false;
+ local->at_end = false;
+ local->guard_1_x = GUARD_1_X;
+ local->guard_1_y = GUARD_1_Y;
+ local->guard_2_x = GUARD_2_X;
+ local->guard_2_y = GUARD_2_Y;
+ local->guard_leave = false;
+ local->guard_1_frame = 1;
+ local->guard_2_frame = 1;
+
+
+ if (conv_restore_running == CONV_56_BUBBLE) {
+ conv_run(CONV_56_BUBBLE);
+ conv_export_value(1);
+ }
+
+
+ if (previous_room == 303) {
+ player_first_walk(PLAYER_X_FROM_303, PLAYER_Y_FROM_303, FACING_EAST,
+ WALK_TO_X_FROM_303, WALK_TO_Y_FROM_303, FACING_EAST, true);
+
+ } else if ((previous_room == 301) || (previous_room != KERNEL_RESTORING_GAME)) {
+ player_first_walk(PLAYER_X_FROM_301, PLAYER_Y_FROM_301, FACING_WEST,
+ WALK_TO_X_FROM_301, WALK_TO_Y_FROM_301, FACING_WEST, true);
+ }
+
+ section_3_music();
+}
+
+static void room_302_daemon() {
+ if (local->anim_0_running) {
+ handle_anim_death();
+ }
+
+ if (kernel.trigger == ROOM_302_BUBBLES && local->bubbles_here && !local->leave) {
+ animate_bubbles();
+ }
+
+ if (local->leave) {
+ leave_screen();
+ }
+
+ if (local->guard_leave || kernel.trigger == ROOM_302_GUARDS) {
+ if (local->guard_1_y < 170 || local->guard_2_y > -14) {
+ guard_leave_screen();
+ }
+ }
+
+ if (player.x < 140 && !local->prevent && !player_has_been_in_room(303)) {
+ if (!global[bubble_wont_attack]) {
+ player_cancel_command();
+ player_walk(DEATH_X, DEATH_Y, FACING_WEST);
+ player_walk_trigger(1);
+ local->prevent = true;
+ player.commands_allowed = false;
+
+ } else if (local->bubbles_here) {
+ player_cancel_command();
+ player_walk(PLAYER_X_FROM_303, PLAYER_Y_FROM_303, FACING_WEST);
+ player.walk_off_edge_to_room = 303;
+ local->prevent = true;
+ player.commands_allowed = false;
+ }
+ }
+
+ if (kernel.trigger == 1) {
+ kernel_seq_delete(seq[fx_guard_1]);
+ aa[0] = kernel_run_animation(kernel_name('p', 1), 0);
+ local->anim_0_running = true;
+ }
+
+ if (local->at_end && conv_control.running != CONV_56_BUBBLE) {
+ local->leave = true;
+ local->guard_leave = true;
+ local->at_end = false;
+ global[bubble_wont_attack] = true;
+ player.commands_allowed = false;
+ sound_play(N_EveryoneScatter);
+ }
+}
+
+static void process_conv_bubb() {
+ if (player_verb == conv056_ralphre2_permit) {
+ if (game.difficulty == EASY_MODE) {
+ local->at_end = true;
+ } else {
+ global[bubble_wont_attack] = true;
+ }
+ }
+}
+
+static void room_302_pre_parser() {
+ int count;
+
+ if (player_said_1(talk_to)) {
+ player.need_to_walk = false;
+
+ local->run_conv = -1;
+
+ for (count = 0; count < 8; count++) {
+ if (inter_point_x >= local->bubble_x[count] - 6 &&
+ inter_point_x <= local->bubble_x[count] + 6 &&
+ inter_point_y >= local->bubble_y[count] - 9 &&
+ inter_point_y <= local->bubble_y[count] + 3) {
+ goto over;
+ }
+ }
+
+over:
+ if (count != 8) {
+ global[bubble_wont_attack] = false;
+ local->run_conv = count;
+ }
+ }
+
+ if (player_said_1(take_magic_from)) {
+ player.need_to_walk = false;
+ }
+
+ if (player_said_2(walk_down, path_to_east)) {
+ player.walk_off_edge_to_room = 301;
+ }
+
+ if (player_said_2(walk_down, path_to_west)) {
+ player.walk_off_edge_to_room = 303;
+ }
+}
+
+static void room_302_parser() {
+ if (conv_control.running == CONV_56_BUBBLE) {
+ process_conv_bubb();
+ goto handled;
+ }
+
+ if (local->run_conv >= 0) {
+ if (local->run_conv == 8) goto fucked_up;
+
+ conv_run(CONV_56_BUBBLE);
+
+ if (local->sprite_num[local->run_conv] <= 10) {
+ conv_export_value(3 * local->run_conv);
+
+ } else if (local->sprite_num[local->run_conv] <= 20) {
+ conv_export_value(2 + (3 * local->run_conv));
+
+ } else {
+ conv_export_value(1 + (3 * local->run_conv));
+ }
+ local->run_conv = -1;
+ goto handled;
+
+fucked_up:
+ ;
+ }
+
+ if (player.look_around) {
+ if (local->bubbles_here) {
+ if (game.difficulty == EASY_MODE) {
+ text_show(30222);
+ } else {
+ text_show(30201);
+ }
+ } else {
+ text_show(30202);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+ if (player_said_1(topiary_gargoyle)) {
+ text_show(30203);
+ goto handled;
+ }
+
+ if (player_said_1(topiary_dragon)) {
+ text_show(30204);
+ goto handled;
+ }
+
+ if (player_said_1(topiary_toadstool)) {
+ if (game.difficulty == EASY_MODE) {
+ text_show(30223);
+ } else {
+ text_show(30205);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(path_to_east)) {
+ text_show(30210);
+ goto handled;
+ }
+
+ if (player_said_1(path)) {
+ text_show(30211);
+ goto handled;
+ }
+
+ if (player_said_1(maze)) {
+ if (local->bubbles_here) {
+ text_show(30212);
+ } else {
+ text_show(30213);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(path_to_west)) {
+ if (local->bubbles_here) {
+ text_show(30208);
+ } else {
+ text_show(30209);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(sprite)) {
+ if (game.difficulty == EASY_MODE) {
+ text_show(30224);
+ } else {
+ text_show(30214);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(guardian)) {
+ text_show(30217);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(take) ||
+ player_said_1(push) ||
+ player_said_1(pull) ||
+ player_said_1(throw) ||
+ player_said_2(sword, attack) ||
+ player_said_2(sword, carve_up) ||
+ player_said_2(sword, thrust) ||
+ player_said_1(pour_contents_of)) {
+
+ if (player_said_1(topiary_gargoyle) ||
+ player_said_1(topiary_dragon) ||
+ player_said_1(topiary_toadstool)) {
+
+ text_show(30206);
+ goto handled;
+ }
+ }
+
+ if (player_said_1(talk_to)) {
+ if (player_said_1(topiary_gargoyle) ||
+ player_said_1(topiary_dragon) ||
+ player_said_1(topiary_toadstool)) {
+ if (game.difficulty == EASY_MODE) {
+ text_show(30223);
+ } else {
+ text_show(30207);
+ }
+ goto handled;
+ }
+ }
+
+ if (player_said_1(push) ||
+ player_said_1(pull) ||
+ player_said_2(sword, attack) ||
+ player_said_2(sword, carve_up) ||
+ player_said_2(sword, thrust) ||
+ player_said_1(pour_contents_of)) {
+
+ if (player_said_1(guardian)) {
+ text_show(30217);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(sword, attack) ||
+ player_said_2(sword, carve_up) ||
+ player_said_2(sword, thrust) ||
+ player_said_1(pour_contents_of)) {
+
+ if (player_said_1(sprite)) {
+ text_show(30225);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(open, maze)) {
+ text_show(30221);
+ goto handled;
+ }
+
+ if (player_said_2(talk_to, guardian)) {
+ text_show(30219);
+ goto handled;
+ }
+
+ if (player_said_2(take, sprite)) {
+ text_show(30215);
+ goto handled;
+ }
+
+ if (player_said_2(give, sprite)) {
+ text_show(30216);
+ goto handled;
+ }
+
+ if (player_said_2(take_magic_from, guardian) ||
+ player_said_2(take_magic_from, sprite)) {
+ text_show(30220);
+ goto handled;
+ }
+
+ goto done;
+
+handled:
+ player.command_ready = false;
+
+done:
+ ;
+}
+
+void room_302_error() {
}
void room_302_synchronize(Common::Serializer &s) {
-
+ for (int16 &v : scratch.sprite) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.sequence) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.animation) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.move_counter) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.direction) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.sprite_num) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.bubble_x) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.bubble_y) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.dyna) s.syncAsSint16LE(v);
+ s.syncAsSint16LE(scratch.prevent);
+ s.syncAsSint16LE(scratch.death_frame);
+ s.syncAsSint16LE(scratch.anim_0_running);
+ s.syncAsSint16LE(scratch.bubbles_here);
+ s.syncAsSint16LE(scratch.leave);
+ s.syncAsSint16LE(scratch.at_end);
+ s.syncAsSint16LE(scratch.change_counter);
+ s.syncAsSint16LE(scratch.guard_1_x);
+ s.syncAsSint16LE(scratch.guard_1_y);
+ s.syncAsSint16LE(scratch.guard_2_x);
+ s.syncAsSint16LE(scratch.guard_2_y);
+ s.syncAsSint16LE(scratch.guard_leave);
+ s.syncAsSint16LE(scratch.guard_1_frame);
+ s.syncAsSint16LE(scratch.guard_2_frame);
+ s.syncAsSint16LE(scratch.xxx);
+ s.syncAsSint16LE(scratch.run_conv);
}
void room_302_preload() {
- room_init_code_pointer = room_302_init;
+ room_init_code_pointer = room_302_init;
room_pre_parser_code_pointer = room_302_pre_parser;
- room_parser_code_pointer = room_302_parser;
- room_daemon_code_pointer = room_302_daemon;
+ room_parser_code_pointer = room_302_parser;
+ room_daemon_code_pointer = room_302_daemon;
section_3_walker();
section_3_interface();
+
+ vocab_make_active(words_sprite);
+ vocab_make_active(words_look_at);
+
+ player.walker_must_reload = true;
}
} // namespace Rooms
diff --git a/engines/mads/madsv2/dragonsphere/rooms/room303.cpp b/engines/mads/madsv2/dragonsphere/rooms/room303.cpp
index e8069aca7ec..223fa4ff699 100644
--- a/engines/mads/madsv2/dragonsphere/rooms/room303.cpp
+++ b/engines/mads/madsv2/dragonsphere/rooms/room303.cpp
@@ -1,4 +1,4 @@
-/* ScummVM - Graphic Adventure Engine
+/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
@@ -19,11 +19,17 @@
*
*/
+#include "mads/madsv2/core/camera.h"
#include "mads/madsv2/core/conv.h"
#include "mads/madsv2/core/game.h"
#include "mads/madsv2/core/imath.h"
+#include "mads/madsv2/core/inter.h"
#include "mads/madsv2/core/kernel.h"
+#include "mads/madsv2/core/matte.h"
+#include "mads/madsv2/core/object.h"
+#include "mads/madsv2/core/player.h"
#include "mads/madsv2/core/sound.h"
+#include "mads/madsv2/core/speech.h"
#include "mads/madsv2/core/text.h"
#include "mads/madsv2/dragonsphere/mads/conv.h"
#include "mads/madsv2/dragonsphere/mads/inventory.h"
@@ -39,43 +45,1635 @@ namespace Dragonsphere {
namespace Rooms {
struct Scratch {
+ int16 sprite[15];
+ int16 sequence[15];
+ int16 animation[10];
+
+ int16 scroll_left_base;
+ int16 dyn_scroll_left;
+
+ int16 scroll_right_base;
+ int16 dyn_scroll_right;
+
+ int16 scroll_mid_base;
+ int16 dyn_scroll_mid;
+
+ int16 butter_frame;
+ int16 butter_talk_count;
+ int16 anim_0_running;
+
+ int16 bk_frame;
+ int16 bk_action;
+ int16 bk_talk_count;
+ int16 anim_1_running;
+
+ int16 frog_1_frame;
+ int16 frog_1_action;
+ int16 frog_1_talk_count;
+ int16 anim_3_running;
+
+ int16 frog_2_frame;
+ int16 frog_2_action;
+ int16 frog_2_talk_count;
+ int16 anim_4_running;
+
+ int16 frog_3_frame;
+ int16 frog_3_action;
+ int16 frog_3_talk_count;
+ int16 anim_5_running;
+
+ int16 frog_4_frame;
+ int16 frog_4_action;
+ int16 frog_4_talk_count;
+ int16 anim_6_running;
+
+ int16 frog_5_frame;
+ int16 frog_5_action;
+ int16 frog_5_talk_count;
+ int16 anim_7_running;
+
+ int16 fli_frame;
+ int16 fli_action;
+ int16 fli_talk_count;
+ int16 anim_8_running;
+
+ int16 frog_6_frame;
+ int16 frog_6_action;
+ int16 frog_6_talk_count;
+ int16 anim_9_running;
+
+ int16 death_frame;
+ int16 anim_10_running;
+
+ int16 prevent;
+ int16 prevent_2;
+ int16 pid_take;
+
+ int16 wing_type;
+ int16 dont_die;
};
+static Scratch scratch;
+
#define local (&scratch)
#define ss local->sprite
#define seq local->sequence
#define aa local->animation
-//static Scratch scratch;
+#define fx_scroll 0
+#define fx_scroll_right 1
+#define fx_scroll_left 2
+#define fx_scroll_mid 3
+#define fx_crown 4
+#define fx_king_take_stone 5
+#define fx_wing 6
+#define fx_butt_king 7
+#define fx_flower 8
+#define fx_take 9
+#define fx_king_gone 10
+#define fx_king_gone_2 11
+
+#define ROOM_303_HAND 60
+#define ROOM_303_HALT 65
+#define ROOM_303_ME_TALK 70
+#define ROOM_303_YOU_TALK 72
+#define ROOM_303_DEATH 78
+#define ROOM_303_WING 83
+
+#define camera_ratio_1 1
+#define camera_ratio_2 2
+
+#define PLAYER_X_FROM_302 493
+#define PLAYER_Y_FROM_302 127
+#define WALK_TO_X_FROM_302 465
+#define WALK_TO_Y_FROM_302 127
+
+#define CONV_57_KING 57
+
+#define FREEZE 0
+#define TALK 1
+#define POINT 2
+#define GIVE 3
+#define WELCOME 4
+#define FREEZE_ABORT 5
+#define EAT 6
+#define KILL 7
+
+#define BK_X 449
+#define BK_Y 122
+
+#define DUL_X 61
+#define DUL_Y 110
+#define DLR_X 101
+#define DLR_Y 136
+
+#define DEATH_X 82
+#define DEATH_Y 134
+
+#define WING_BEFORE 0
+#define WING_AFTER 1
+#define WING_CHANGING 2
+
+#define AFTER_FLI_X 90
+#define AFTER_FLI_Y 139
+
+#define OPEN_X 83
+#define OPEN_Y 131
+
+#define PID_FLOWER_X 208
+#define PID_FLOWER_Y 140
+
+#define KING_FLOWER_X 199
+#define KING_FLOWER_Y 135
+
+#define MUSHROOM_X 388
+#define MUSHROOM_Y 66
+
+
+static void set_scroll_left_position() {
+ int center;
+ int difference;
+ int direction;
+ int distance;
+ int displace;
+ int x;
+ int xs;
+
+ center = picture_view_x + (video_x >> 1);
+
+ if (seq[fx_scroll_left] >= 0) {
+ kernel_seq_delete(seq[fx_scroll_left]);
+ }
+
+ difference = center - local->scroll_left_base;
+ direction = neg(sgn(difference));
+ distance = abs(difference);
+
+ displace = (int)(((long)distance * camera_ratio_1) / camera_ratio_2);
+ displace = sgn_in(displace, direction);
+
+ x = local->scroll_left_base + displace - 1;
+ xs = series_list[ss[fx_scroll_left]]->index[0].xs;
+
+ if (((x - ((xs >> 1) + 1)) >= (picture_view_x + video_x)) ||
+ ((x + ((xs >> 1) + 1)) < picture_view_x)) {
+ seq[fx_scroll_left] = -1;
+
+ } else {
+
+ seq[fx_scroll_left] = kernel_seq_stamp(ss[fx_scroll], false, 2);
+ kernel_seq_loc(seq[fx_scroll_left], x, 155);
+ kernel_seq_depth(seq[fx_scroll_left], 1);
+ }
+}
+
+static void set_scroll_right_position() {
+ int center;
+ int difference;
+ int direction;
+ int distance;
+ int displace;
+ int x;
+ int xs;
+
+ center = picture_view_x + (video_x >> 1);
+
+ if (seq[fx_scroll_right] >= 0) {
+ kernel_seq_delete(seq[fx_scroll_right]);
+ }
+
+ difference = center - local->scroll_right_base;
+ direction = neg(sgn(difference));
+ distance = abs(difference);
+
+ displace = (int)(((long)distance * camera_ratio_1) / camera_ratio_2);
+ displace = sgn_in(displace, direction);
+
+ x = local->scroll_right_base + displace - 1;
+ xs = series_list[ss[fx_scroll_right]]->index[0].xs;
+
+ if (((x - ((xs >> 1) + 1)) >= (picture_view_x + video_x)) ||
+ ((x + ((xs >> 1) + 1)) < picture_view_x)) {
+ seq[fx_scroll_right] = -1;
+
+ } else {
+
+ seq[fx_scroll_right] = kernel_seq_stamp(ss[fx_scroll], false, 1);
+ kernel_seq_loc(seq[fx_scroll_right], x, 155);
+ kernel_seq_depth(seq[fx_scroll_right], 1);
+ }
+}
+
+static void set_scroll_mid_position() {
+ int center;
+ int difference;
+ int direction;
+ int distance;
+ int displace;
+ int x;
+ int xs;
+
+ center = picture_view_x + (video_x >> 1);
+
+ if (seq[fx_scroll_mid] >= 0) {
+ kernel_seq_delete(seq[fx_scroll_mid]);
+ }
+
+ difference = center - local->scroll_mid_base;
+ direction = neg(sgn(difference));
+ distance = abs(difference);
+
+ displace = (int)(((long)distance * camera_ratio_1) / camera_ratio_2);
+ displace = sgn_in(displace, direction);
+
+ x = local->scroll_mid_base + displace - 1;
+ xs = series_list[ss[fx_scroll_mid]]->index[0].xs;
+
+ if (((x - ((xs >> 1) + 1)) >= (picture_view_x + video_x)) ||
+ ((x + ((xs >> 1) + 1)) < picture_view_x)) {
+ seq[fx_scroll_mid] = -1;
+
+ } else {
+
+ seq[fx_scroll_mid] = kernel_seq_stamp(ss[fx_scroll], false, 3);
+ kernel_seq_loc(seq[fx_scroll_mid], x, 155);
+ kernel_seq_depth(seq[fx_scroll_mid], 1);
+ }
+}
+
+static void room_303_init() {
+ if (!player.been_here_before) {
+ ++global[dragon_high_scene];
+ global[player_score] += 8;
+ }
+
+ local->butter_talk_count = 0;
+ local->pid_take = false;
+ local->prevent_2 = false;
+ local->prevent = false;
+ local->wing_type = WING_BEFORE;
+ local->dont_die = false;
+ local->anim_10_running = false;
+
+ local->frog_1_talk_count = 0;
+ local->frog_2_talk_count = 0;
+ local->frog_3_talk_count = 0;
+ local->frog_4_talk_count = 0;
+ local->frog_5_talk_count = 0;
+ local->frog_6_talk_count = 0;
+
+ if (previous_room != KERNEL_RESTORING_GAME) {
+ local->anim_0_running = false;
+ local->anim_1_running = false;
+ local->anim_3_running = false;
+ local->anim_4_running = false;
+ local->anim_5_running = false;
+ local->anim_6_running = false;
+ local->anim_7_running = false;
+ local->anim_8_running = false;
+ local->anim_9_running = false;
+ }
+
+ if (global[player_persona] == PLAYER_IS_PID) {
+ ss[fx_king_gone_2] = kernel_load_series(kernel_name('w', 9), false);
+ seq[fx_king_gone_2] = kernel_seq_stamp(ss[fx_king_gone_2], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_king_gone_2], 1);
+
+ kernel_flip_hotspot(words_Butterfly_King, false);
+ }
+
+ if (global[player_persona] == PLAYER_IS_KING) {
+ kernel_flip_hotspot_loc(words_mushroom, false, MUSHROOM_X, MUSHROOM_Y);
+ conv_get(CONV_57_KING);
+ ss[fx_king_take_stone] = kernel_load_series("*KGRH_9", false);
+ }
-void room_303_init() {
+ if (object_is_here(crystal_flower)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ ss[fx_take] = kernel_load_series("*KGRM_3", false);
+ } else {
+ ss[fx_take] = kernel_load_series("*PDRL_9", false);
+ }
+ ss[fx_flower] = kernel_load_series(kernel_name('p', 1), false);
+ seq[fx_flower] = kernel_seq_stamp(ss[fx_flower], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_flower], 3);
+ } else {
+ kernel_flip_hotspot(words_crystal_flower, false);
+ }
+
+ ss[fx_scroll] = kernel_load_series("*RM303FX", false);
+
+ if (global[player_persona] == PLAYER_IS_KING) {
+ ss[fx_wing] = kernel_load_series(kernel_name('w', 0), false);
+ ss[fx_butt_king] = kernel_load_series(kernel_name('e', 3), false);
+ seq[fx_wing] = kernel_seq_stamp(ss[fx_wing], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_wing], 10);
+ }
+
+ seq[fx_scroll_left] = -1;
+ local->dyn_scroll_left = -1;
+ local->scroll_left_base = 69;
+
+ seq[fx_scroll_right] = -1;
+ local->dyn_scroll_right = -1;
+ local->scroll_right_base = 418;
+
+ seq[fx_scroll_mid] = -1;
+ local->dyn_scroll_mid = -1;
+ local->scroll_mid_base = 255;
+
+ if (object_is_here(key_crown)) {
+ ss[fx_crown] = kernel_load_series(kernel_name('p', 0), false);
+ seq[fx_crown] = kernel_seq_stamp(ss[fx_crown], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_crown], 14);
+ } else {
+ kernel_flip_hotspot(words_crown, false);
+ }
+
+ aa[0] = kernel_run_animation(kernel_name('b', 1), 0);
+ local->anim_0_running = true;
+
+ aa[4] = kernel_run_animation(kernel_name('f', 4), 0);
+ local->anim_4_running = true;
+ local->frog_2_action = FREEZE;
+
+ if (conv_restore_running == CONV_57_KING) {
+ aa[1] = kernel_run_animation(kernel_name('u', 1), 0);
+ local->anim_1_running = true;
+ local->bk_action = FREEZE;
+ player.commands_allowed = false;
+ conv_run(CONV_57_KING);
+
+ } else {
+ aa[9] = kernel_run_animation(kernel_name('f', 6), 0);
+ local->anim_9_running = true;
+ local->frog_6_action = FREEZE;
+
+ aa[5] = kernel_run_animation(kernel_name('f', 5), 0);
+ local->anim_5_running = true;
+ local->frog_3_action = FREEZE;
+
+ aa[6] = kernel_run_animation(kernel_name('f', 3), 0);
+ local->anim_6_running = true;
+ local->frog_4_action = FREEZE;
+
+ aa[7] = kernel_run_animation(kernel_name('f', 2), 0);
+ local->anim_7_running = true;
+ local->frog_5_action = FREEZE;
+
+ aa[3] = kernel_run_animation(kernel_name('f', 1), 0);
+ local->anim_3_running = true;
+ local->frog_1_action = FREEZE;
+
+ if (global[player_persona] == PLAYER_IS_KING) {
+ seq[fx_butt_king] = kernel_seq_stamp(ss[fx_butt_king], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_butt_king], 1);
+ }
+ }
+
+
+ if ((previous_room == 302) || (previous_room != KERNEL_RESTORING_GAME)) {
+ camera_jump_to(160, 0);
+ player_first_walk(PLAYER_X_FROM_302, PLAYER_Y_FROM_302, FACING_WEST,
+ WALK_TO_X_FROM_302, WALK_TO_Y_FROM_302, FACING_WEST, true);
+ }
+
+ set_scroll_left_position();
+ set_scroll_right_position();
+ set_scroll_mid_position();
+
+ section_3_music();
}
-void room_303_daemon() {
+static void handle_anim_butter() {
+ int butter_reset_frame;
+
+ if (kernel_anim[aa[0]].frame != local->butter_frame) {
+ local->butter_frame = kernel_anim[aa[0]].frame;
+ butter_reset_frame = -1;
+
+ switch (local->butter_frame) {
+ case 1:
+ case 2:
+ case 38:
+ if (local->butter_frame > 2) {
+ local->butter_frame = 1;
+ }
+
+ ++local->butter_talk_count;
+
+ if (local->butter_talk_count > imath_random(5, 10)) {
+ if (imath_random(1, 11) == 1) {
+ butter_reset_frame = 2;
+
+ } else if (imath_random(1, 2) == 1) {
+ butter_reset_frame = 0;
+
+ } else {
+ butter_reset_frame = 1;
+ }
+
+ local->butter_talk_count = 0;
+ } else {
+ butter_reset_frame = local->butter_frame - 1;
+ }
+ break;
+
+ case 19:
+ case 20:
+ case 21:
+ case 18:
+ if (local->butter_frame < 19) {
+ local->butter_frame = 20;
+ }
+
+ ++local->butter_talk_count;
+
+ if (local->butter_talk_count > imath_random(5, 10)) {
+ if (imath_random(1, 11) == 1) {
+ butter_reset_frame = 21;
+
+ } else if (local->butter_frame == 19) {
+ butter_reset_frame = imath_random(18, 19);
+ } else if (local->butter_frame == 20) {
+ butter_reset_frame = imath_random(18, 20);
+ } else if (local->butter_frame == 21) {
+ butter_reset_frame = imath_random(19, 20);
+ }
+ local->butter_talk_count = 0;
+
+ } else {
+ butter_reset_frame = local->butter_frame - 1;
+ }
+ break;
+ }
+
+ if (butter_reset_frame >= 0) {
+ kernel_reset_animation(aa[0], butter_reset_frame);
+ local->butter_frame = butter_reset_frame;
+ }
+ }
}
-void room_303_pre_parser() {
+static void handle_anim_bk() {
+ int bk_reset_frame;
+ int it;
+
+ if (kernel_anim[aa[1]].frame != local->bk_frame) {
+ local->bk_frame = kernel_anim[aa[1]].frame;
+ bk_reset_frame = -1;
+
+ switch (local->bk_frame) {
+ case 1:
+ case 16:
+ case 76:
+ case 113:
+ case 33:
+ case 51:
+ case 95:
+ if (local->bk_frame == 76) {
+ kernel_timing_trigger(1, 2);
+ }
+ switch (local->bk_action) {
+ case TALK:
+ it = imath_random(1, 4);
+ switch (it) {
+ case 1:
+ bk_reset_frame = 1;
+ break;
+
+ case 2:
+ if (local->bk_action != GIVE) {
+ local->bk_action = FREEZE;
+ }
+ bk_reset_frame = 16;
+ break;
+
+ case 3:
+ if (local->bk_action != GIVE) {
+ local->bk_action = FREEZE;
+ }
+ bk_reset_frame = 33;
+ break;
+
+ case 4:
+ if (local->bk_action != GIVE) {
+ local->bk_action = FREEZE;
+ }
+ bk_reset_frame = 76;
+ break;
+ }
+ break;
+
+ case POINT:
+ bk_reset_frame = 95;
+ local->bk_action = FREEZE;
+ break;
+
+ case FREEZE:
+ bk_reset_frame = 0;
+ break;
+
+ case FREEZE_ABORT:
+ kernel_abort_animation(aa[1]);
+ local->anim_1_running = false;
+ seq[fx_butt_king] = kernel_seq_stamp(ss[fx_butt_king], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_butt_king], 1);
+ kernel_synch(KERNEL_SERIES, seq[fx_butt_king], KERNEL_NOW, 0);
+ player.commands_allowed = true;
+
+ aa[9] = kernel_run_animation(kernel_name('f', 6), 0);
+ local->anim_9_running = true;
+ local->frog_6_action = FREEZE;
+
+ aa[5] = kernel_run_animation(kernel_name('f', 5), 0);
+ local->anim_5_running = true;
+ local->frog_3_action = FREEZE;
+
+ aa[6] = kernel_run_animation(kernel_name('f', 3), 0);
+ local->anim_6_running = true;
+ local->frog_4_action = FREEZE;
+
+ aa[7] = kernel_run_animation(kernel_name('f', 2), 0);
+ local->anim_7_running = true;
+ local->frog_5_action = FREEZE;
+
+ aa[3] = kernel_run_animation(kernel_name('f', 1), 0);
+ local->anim_3_running = true;
+ local->frog_1_action = FREEZE;
+ break;
+
+ case WELCOME:
+ bk_reset_frame = 4;
+ local->bk_action = FREEZE;
+ break;
+
+ case GIVE:
+ bk_reset_frame = 51;
+ local->bk_action = FREEZE;
+ break;
+ }
+ break;
+
+ case 2:
+ case 3:
+ case 4:
+ switch (local->bk_action) {
+ case TALK:
+ bk_reset_frame = imath_random(1, 3);
+ ++local->bk_talk_count;
+ if (local->bk_talk_count > 15) {
+ local->bk_action = FREEZE;
+ local->bk_talk_count = 0;
+ bk_reset_frame = 1;
+ }
+ break;
+
+ default:
+ bk_reset_frame = 0;
+ break;
+ }
+ break;
+ }
+
+ if (bk_reset_frame >= 0) {
+ kernel_reset_animation(aa[1], bk_reset_frame);
+ local->bk_frame = bk_reset_frame;
+ }
+ }
}
-void room_303_parser() {
+static void handle_anim_frog_1() {
+ int frog_1_reset_frame;
+ int it;
+
+ if (kernel_anim[aa[3]].frame != local->frog_1_frame) {
+ local->frog_1_frame = kernel_anim[aa[3]].frame;
+ frog_1_reset_frame = -1;
+ switch (local->frog_1_frame) {
+ case 2:
+ switch (local->frog_1_action) {
+ case FREEZE:
+ frog_1_reset_frame = 1;
+ ++local->frog_1_talk_count;
+ if (local->frog_1_talk_count > imath_random(30, 40)) {
+ local->frog_1_talk_count = 0;
+ frog_1_reset_frame = 0;
+ }
+ break;
+
+ default:
+ frog_1_reset_frame = 0;
+ break;
+ }
+ break;
+
+ case 8:
+ switch (local->frog_1_action) {
+ case FREEZE:
+ frog_1_reset_frame = 7;
+ ++local->frog_1_talk_count;
+ if (local->frog_1_talk_count > imath_random(5, 10)) {
+ local->frog_1_talk_count = 0;
+ frog_1_reset_frame = 15;
+ }
+ break;
+
+ default:
+ frog_1_reset_frame = 15;
+ break;
+ }
+ break;
+
+ case 1:
+ case 15:
+ case 21:
+ case 30:
+ case 37:
+ switch (local->frog_1_action) {
+ case EAT:
+ frog_1_reset_frame = 8;
+ break;
+
+ case KILL:
+ kernel_abort_animation(aa[3]);
+ local->anim_3_running = false;
+ player.walker_visible = false;
+ if (global[player_persona] == PLAYER_IS_KING) {
+ aa[3] = kernel_run_animation(kernel_name('d', 1), ROOM_303_DEATH + 1);
+ } else {
+ aa[3] = kernel_run_animation(kernel_name('d', 2), ROOM_303_DEATH + 1);
+ }
+ kernel_synch(KERNEL_ANIM, aa[3], KERNEL_PLAYER, 0);
+ local->anim_10_running = true;
+ break;
+
+ case FREEZE:
+ it = imath_random(1, 9);
+ switch (it) {
+ case 1: case 2: frog_1_reset_frame = 1; break;
+ case 3: case 4: frog_1_reset_frame = 2; break;
+ case 5: case 6: frog_1_reset_frame = 21; break;
+ case 7: case 8: frog_1_reset_frame = 30; break;
+ case 9: frog_1_reset_frame = 8; break;
+ }
+ break;
+ }
+ break;
+ }
+
+ if (frog_1_reset_frame >= 0) {
+ kernel_reset_animation(aa[3], frog_1_reset_frame);
+ local->frog_1_frame = frog_1_reset_frame;
+ }
+ }
+}
+
+static void handle_anim_frog_2() {
+ int frog_2_reset_frame;
+ int it;
+
+ if (kernel_anim[aa[4]].frame != local->frog_2_frame) {
+ local->frog_2_frame = kernel_anim[aa[4]].frame;
+ frog_2_reset_frame = -1;
+
+ switch (local->frog_2_frame) {
+ case 2:
+ switch (local->frog_2_action) {
+ case FREEZE:
+ frog_2_reset_frame = 1;
+ ++local->frog_2_talk_count;
+ if (local->frog_2_talk_count > imath_random(30, 40)) {
+ local->frog_2_talk_count = 0;
+ frog_2_reset_frame = 0;
+ }
+ break;
+
+ default:
+ frog_2_reset_frame = 0;
+ break;
+ }
+ break;
+
+ case 6:
+ switch (local->frog_2_action) {
+ case FREEZE:
+ frog_2_reset_frame = 5;
+ ++local->frog_2_talk_count;
+ if (local->frog_2_talk_count > imath_random(5, 10)) {
+ local->frog_2_talk_count = 0;
+ frog_2_reset_frame = 6;
+ }
+ break;
+
+ default:
+ frog_2_reset_frame = 6;
+ break;
+ }
+ break;
+
+ case 1:
+ case 8:
+ case 9:
+
+ switch (local->frog_2_action) {
+
+ case FREEZE:
+ it = imath_random(1, 3);
+ switch (it) {
+ case 1: frog_2_reset_frame = 8; break;
+ case 2: frog_2_reset_frame = 1; break;
+ case 3: frog_2_reset_frame = 2; break;
+ }
+ break;
+ }
+ break;
+ }
+
+ if (frog_2_reset_frame >= 0) {
+ kernel_reset_animation(aa[4], frog_2_reset_frame);
+ local->frog_2_frame = frog_2_reset_frame;
+ }
+ }
+}
+
+static void handle_anim_frog_3() {
+ int frog_3_reset_frame;
+ int it;
+
+ if (kernel_anim[aa[5]].frame != local->frog_3_frame) {
+ local->frog_3_frame = kernel_anim[aa[5]].frame;
+ frog_3_reset_frame = -1;
+
+ switch (local->frog_3_frame) {
+ case 2:
+ switch (local->frog_3_action) {
+ case FREEZE:
+ frog_3_reset_frame = 1;
+ ++local->frog_3_talk_count;
+ if (local->frog_3_talk_count > imath_random(30, 40)) {
+ local->frog_3_talk_count = 0;
+ frog_3_reset_frame = 0;
+ }
+ break;
+
+ default:
+ frog_3_reset_frame = 0;
+ break;
+ }
+ break;
+
+ case 1:
+ case 6:
+ switch (local->frog_3_action) {
+ case FREEZE:
+ it = imath_random(1, 5);
+ switch (it) {
+ case 1: frog_3_reset_frame = 2; break;
+ default: frog_3_reset_frame = 1; break;
+ }
+ break;
+
+ case EAT:
+ frog_3_reset_frame = 2;
+ break;
+ }
+ break;
+ }
+
+ if (frog_3_reset_frame >= 0) {
+ kernel_reset_animation(aa[5], frog_3_reset_frame);
+ local->frog_3_frame = frog_3_reset_frame;
+ }
+ }
+}
+
+static void handle_anim_frog_4() {
+ int frog_4_reset_frame;
+ int it;
+
+ if (kernel_anim[aa[6]].frame != local->frog_4_frame) {
+ local->frog_4_frame = kernel_anim[aa[6]].frame;
+ frog_4_reset_frame = -1;
+
+ switch (local->frog_4_frame) {
+ case 2:
+ switch (local->frog_4_action) {
+ case FREEZE:
+ frog_4_reset_frame = 1;
+ ++local->frog_4_talk_count;
+ if (local->frog_4_talk_count > imath_random(30, 40)) {
+ local->frog_4_talk_count = 0;
+ frog_4_reset_frame = 0;
+ }
+ break;
+
+ default:
+ frog_4_reset_frame = 0;
+ break;
+ }
+ break;
+
+ case 5:
+ switch (local->frog_4_action) {
+ case FREEZE:
+ frog_4_reset_frame = 4;
+ ++local->frog_4_talk_count;
+ if (local->frog_4_talk_count > imath_random(30, 40)) {
+ local->frog_4_talk_count = 0;
+ frog_4_reset_frame = 5;
+ }
+ break;
+
+ default:
+ frog_4_reset_frame = 5;
+ break;
+ }
+ break;
+
+ case 1:
+ case 6:
+ case 7:
+ case 11:
+ switch (local->frog_4_action) {
+ case EAT:
+ frog_4_reset_frame = 7;
+ break;
+
+ case FREEZE:
+ it = imath_random(1, 4);
+ switch (it) {
+ case 1: frog_4_reset_frame = 2; break;
+ case 2: frog_4_reset_frame = 6; break;
+ default: frog_4_reset_frame = 1; break;
+ }
+ break;
+ }
+ break;
+ }
+
+ if (frog_4_reset_frame >= 0) {
+ kernel_reset_animation(aa[6], frog_4_reset_frame);
+ local->frog_4_frame = frog_4_reset_frame;
+ }
+ }
+}
+
+static void handle_anim_frog_5() {
+ int frog_5_reset_frame;
+ int it;
+
+ if (kernel_anim[aa[7]].frame != local->frog_5_frame) {
+ local->frog_5_frame = kernel_anim[aa[7]].frame;
+ frog_5_reset_frame = -1;
+
+ switch (local->frog_5_frame) {
+ case 2:
+ switch (local->frog_5_action) {
+ case FREEZE:
+ frog_5_reset_frame = 1;
+ ++local->frog_5_talk_count;
+ if (local->frog_5_talk_count > imath_random(30, 40)) {
+ local->frog_5_talk_count = 0;
+ frog_5_reset_frame = 0;
+ }
+ break;
+
+ default:
+ frog_5_reset_frame = 0;
+ break;
+ }
+ break;
+
+ case 5:
+ switch (local->frog_5_action) {
+ case FREEZE:
+ frog_5_reset_frame = 4;
+ ++local->frog_5_talk_count;
+ if (local->frog_5_talk_count > imath_random(30, 40)) {
+ local->frog_5_talk_count = 0;
+ frog_5_reset_frame = 5;
+ }
+ break;
+
+ default:
+ frog_5_reset_frame = 5;
+ break;
+ }
+ break;
+
+ case 1:
+ case 7:
+ case 8:
+ case 9:
+ case 15:
+ switch (local->frog_5_action) {
+ case FREEZE:
+ it = imath_random(1, 7);
+ switch (it) {
+ case 1: frog_5_reset_frame = 2; break;
+ case 2: frog_5_reset_frame = 7; break;
+ case 3: frog_5_reset_frame = 8; break;
+ case 4: frog_5_reset_frame = 9; break;
+ default: frog_5_reset_frame = 1; break;
+ }
+ break;
+
+ case EAT:
+ frog_5_reset_frame = 9;
+ break;
+ }
+ break;
+ }
+
+ if (frog_5_reset_frame >= 0) {
+ kernel_reset_animation(aa[7], frog_5_reset_frame);
+ local->frog_5_frame = frog_5_reset_frame;
+ }
+ }
+}
+
+static void handle_anim_frog_6() {
+ int frog_6_reset_frame;
+ int it;
+
+ if (kernel_anim[aa[9]].frame != local->frog_6_frame) {
+ local->frog_6_frame = kernel_anim[aa[9]].frame;
+ frog_6_reset_frame = -1;
+
+ switch (local->frog_6_frame) {
+ case 2:
+ switch (local->frog_6_action) {
+ case FREEZE:
+ frog_6_reset_frame = 1;
+ ++local->frog_6_talk_count;
+ if (local->frog_6_talk_count > imath_random(30, 40)) {
+ local->frog_6_talk_count = 0;
+ frog_6_reset_frame = 0;
+ }
+ break;
+
+ default:
+ frog_6_reset_frame = 0;
+ break;
+ }
+ break;
+
+ case 1:
+ case 10:
+ switch (local->frog_6_action) {
+ case FREEZE:
+ it = imath_random(1, 5);
+ switch (it) {
+ case 1: frog_6_reset_frame = 2; break;
+ default: frog_6_reset_frame = 1; break;
+ }
+ break;
+
+ case EAT:
+ frog_6_reset_frame = 2;
+ break;
+ }
+ break;
+ }
+
+ if (frog_6_reset_frame >= 0) {
+ kernel_reset_animation(aa[9], frog_6_reset_frame);
+ local->frog_6_frame = frog_6_reset_frame;
+ }
+ }
+}
+
+static void handle_anim_fli() {
+ int fli_reset_frame;
+
+ if (kernel_anim[aa[8]].frame != local->fli_frame) {
+ local->fli_frame = kernel_anim[aa[8]].frame;
+ fli_reset_frame = -1;
+
+ switch (local->fli_frame) {
+ case 15:
+ inter_move_object(bottle_of_flies, NOWHERE);
+ break;
+
+ case 19:
+ local->frog_1_action = EAT;
+ local->frog_3_action = EAT;
+ local->frog_4_action = EAT;
+ local->frog_5_action = EAT;
+ local->frog_6_action = EAT;
+ break;
+
+ case 61:
+ local->frog_1_action = FREEZE;
+ local->frog_3_action = FREEZE;
+ local->frog_4_action = FREEZE;
+ local->frog_5_action = FREEZE;
+ local->frog_6_action = FREEZE;
+ break;
+
+ case 77:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ kernel_abort_animation(aa[8]);
+ local->anim_8_running = false;
+ local->dont_die = false;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_NOW, 0);
+ object_examine(key_crown, 30315, 0);
+ break;
+
+ case 39:
+ kernel_flip_hotspot(words_crown, false);
+ kernel_seq_delete(seq[fx_crown]);
+ sound_play(N_TakeObjectSnd);
+ inter_give_to_player(key_crown);
+ ++global[player_score];
+ break;
+ }
+
+ if (fli_reset_frame >= 0) {
+ kernel_reset_animation(aa[8], fli_reset_frame);
+ local->fli_frame = fli_reset_frame;
+ }
+ }
+}
+
+static void handle_anim_death() {
+ int death_reset_frame;
+
+ if (kernel_anim[aa[3]].frame != local->death_frame) {
+ local->death_frame = kernel_anim[aa[3]].frame;
+ death_reset_frame = -1;
+
+ switch (local->death_frame) {
+ case 11:
+ if (speech_system_active && speech_on) {
+ global_speech_go(2);
+ } else {
+ sound_play(N_ToadEatsPlayer);
+ }
+ break;
+
+ case 25:
+ if (speech_system_active && speech_on) {
+ global_speech_go(3);
+ } else {
+ sound_play(N_ToadEatsPlayer);
+ }
+ break;
+ }
+
+ if (death_reset_frame >= 0) {
+ kernel_reset_animation(aa[3], death_reset_frame);
+ local->death_frame = death_reset_frame;
+ }
+ }
+}
+
+static void room_303_daemon() {
+ int temp;
+
+ if (local->anim_0_running) {
+ handle_anim_butter();
+ }
+
+ if (local->anim_1_running) {
+ handle_anim_bk();
+ }
+
+ if (local->anim_3_running) {
+ handle_anim_frog_1();
+ }
+
+ if (local->anim_4_running) {
+ handle_anim_frog_2();
+ }
+
+ if (local->anim_5_running) {
+ handle_anim_frog_3();
+ }
+
+ if (local->anim_6_running) {
+ handle_anim_frog_4();
+ }
+
+ if (local->anim_7_running) {
+ handle_anim_frog_5();
+ }
+
+ if (local->anim_8_running) {
+ handle_anim_fli();
+ }
+
+ if (local->anim_9_running) {
+ handle_anim_frog_6();
+ }
+
+ if (local->anim_10_running) {
+ handle_anim_death();
+ }
+
+ if (camera_x.pan_this_frame) {
+ set_scroll_left_position();
+ set_scroll_right_position();
+ set_scroll_mid_position();
+ }
+
+ if (local->pid_take) {
+ local->pid_take = false;
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ seq[fx_king_take_stone] = kernel_seq_forward(ss[fx_king_take_stone], true, 7, 0, 0, 1);
+ kernel_seq_trigger(seq[fx_king_take_stone], KERNEL_TRIGGER_EXPIRE, 0, 1);
+ kernel_seq_player(seq[fx_king_take_stone], true);
+ kernel_seq_range(seq[fx_king_take_stone], KERNEL_FIRST, KERNEL_LAST);
+ }
+
+ switch (kernel.trigger) {
+ case 1:
+ local->bk_action = GIVE;
+ temp = seq[fx_king_take_stone];
+ seq[fx_king_take_stone] = kernel_seq_stamp(ss[fx_king_take_stone], true, KERNEL_LAST);
+ kernel_seq_player(seq[fx_king_take_stone], false);
+ kernel_synch(KERNEL_SERIES, seq[fx_king_take_stone], KERNEL_SERIES, temp);
+ break;
+
+ case 2:
+ sound_play(N_TakeObjectSnd);
+ ++global[player_score];
+
+ if (object_is_here(red_powerstone)) {
+ inter_give_to_player(red_powerstone);
+ object_examine(red_powerstone, 30301, 0);
+
+ } else if (object_is_here(bird_figurine)) {
+ inter_give_to_player(bird_figurine);
+ object_examine(bird_figurine, 30302, 0);
+ ++global[dragon_high_scene];
+ }
+
+ kernel_seq_delete(seq[fx_king_take_stone]);
+ seq[fx_king_take_stone] = kernel_seq_backward(ss[fx_king_take_stone], true, 7, 0, 0, 1);
+ kernel_seq_trigger(seq[fx_king_take_stone], KERNEL_TRIGGER_EXPIRE, 0, 3);
+ kernel_seq_player(seq[fx_king_take_stone], false);
+ kernel_seq_range(seq[fx_king_take_stone], KERNEL_FIRST, KERNEL_LAST);
+ break;
+
+ case 3:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_king_take_stone]);
+ conv_release();
+ break;
+ }
+
+ if ((player.x >= DUL_X) && (player.y >= DUL_Y) && (player.x <= DLR_X) && (player.y <= DLR_Y) &&
+ !local->prevent_2 && !local->dont_die) {
+ local->prevent_2 = true;
+ if (global[player_persona] == PLAYER_IS_KING) {
+ player_walk(DEATH_X, DEATH_Y - 2, FACING_NORTH);
+ } else {
+ player_walk(DEATH_X, DEATH_Y, FACING_NORTH);
+ }
+ player.commands_allowed = false;
+ player_walk_trigger(ROOM_303_DEATH);
+ }
+
+ if (kernel.trigger == ROOM_303_DEATH) {
+ local->frog_1_action = KILL;
+ }
+
+ if (kernel.trigger == ROOM_303_DEATH + 1) {
+ if (game.difficulty == EASY_MODE) {
+ text_show(30331);
+ } else {
+ text_show(45);
+ }
+ kernel.force_restart = true;
+ }
+
+ if (local->wing_type != WING_CHANGING && imath_random(1, 1200) == 1 &&
+ global[player_persona] == PLAYER_IS_KING) {
+
+ kernel_seq_delete(seq[fx_wing]);
+
+ if (local->wing_type == WING_BEFORE) {
+ seq[fx_wing] = kernel_seq_forward(ss[fx_wing], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_wing], 10);
+ kernel_seq_range(seq[fx_wing], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_wing], KERNEL_TRIGGER_EXPIRE, 0, ROOM_303_WING);
+ local->wing_type = WING_CHANGING;
+
+ } else {
+ seq[fx_wing] = kernel_seq_backward(ss[fx_wing], false, 7, 0, 0, 1);
+ kernel_seq_depth(seq[fx_wing], 10);
+ kernel_seq_range(seq[fx_wing], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_trigger(seq[fx_wing], KERNEL_TRIGGER_EXPIRE, 0, ROOM_303_WING + 1);
+ local->wing_type = WING_CHANGING;
+ }
+ }
+
+ if (kernel.trigger == ROOM_303_WING) {
+ seq[fx_wing] = kernel_seq_stamp(ss[fx_wing], false, KERNEL_LAST);
+ kernel_seq_depth(seq[fx_wing], 10);
+ local->wing_type = WING_AFTER;
+ }
+
+ if (kernel.trigger == ROOM_303_WING + 1) {
+ seq[fx_wing] = kernel_seq_stamp(ss[fx_wing], false, KERNEL_FIRST);
+ kernel_seq_depth(seq[fx_wing], 10);
+ local->wing_type = WING_BEFORE;
+ }
+}
+
+static void room_303_pre_parser() {
+ if (player_said_2(walk_down, path_to_east)) {
+ player.walk_off_edge_to_room = 302;
+ }
+
+ if (player_said_2(open, flies) || player_said_3(give, flies, toads)) {
+ player_walk(OPEN_X, OPEN_Y, FACING_NORTH);
+ local->dont_die = true;
+ }
+
+ if (player_said_2(take, crystal_flower) && object_is_here(crystal_flower)) {
+ if (global[player_persona] == PLAYER_IS_PID) {
+ player_walk(PID_FLOWER_X, PID_FLOWER_Y, FACING_NORTHEAST);
+ } else {
+ player_walk(KING_FLOWER_X, KING_FLOWER_Y, FACING_SOUTHEAST);
+ }
+ }
+}
+
+static void process_conv_king() {
+ int you_trig_flag = false;
+
+ if (player_verb == conv057_exit_b_b) {
+ *conv_my_next_start = conv057_startquiz;
+ local->bk_action = FREEZE_ABORT;
+ you_trig_flag = true;
+ conv_abort();
+ }
+
+ if (player_verb == conv057_exit_d_d) {
+ *conv_my_next_start = conv057_newquiz;
+ local->bk_action = FREEZE_ABORT;
+ you_trig_flag = true;
+ conv_abort();
+ }
+
+ if (player_verb == conv057_exit_f_f) {
+ conv_hold();
+ you_trig_flag = true;
+ local->pid_take = true;
+ }
+
+ if (player_verb == conv057_exit_h_h) {
+ *conv_my_next_start = conv057_restart;
+ local->bk_action = FREEZE_ABORT;
+ you_trig_flag = true;
+ conv_abort();
+ }
+
+ if (player_verb == conv057_respons_b_b) {
+ conv_hold();
+ you_trig_flag = true;
+ local->pid_take = true;
+ }
+
+ if (kernel.trigger == ROOM_303_YOU_TALK) {
+ if (player_verb == conv057_startquiz_only) {
+ local->bk_action = WELCOME;
+ } else if (local->bk_action != GIVE) {
+ local->bk_action = TALK;
+ }
+ }
+
+ if (!you_trig_flag) {
+ conv_you_trigger(ROOM_303_YOU_TALK);
+ }
+
+ local->bk_talk_count = 0;
+}
+
+static void room_303_parser() {
+ if (local->prevent_2) {
+ goto handled;
+ }
+
+ if (conv_control.running == CONV_57_KING) {
+ process_conv_king();
+ goto handled;
+ }
+
+ if (player_said_2(open, flies) || player_said_3(give, flies, toads)) {
+ aa[8] = kernel_run_animation(kernel_name('t', 1), 0);
+ local->anim_8_running = true;
+ kernel_synch(KERNEL_ANIM, aa[8], KERNEL_PLAYER, 0);
+ player.walker_visible = false;
+ player.commands_allowed = false;
+ global[player_score] += 3;
+ player_demand_location(AFTER_FLI_X, AFTER_FLI_Y);
+ player_demand_facing(FACING_SOUTH);
+ goto handled;
+ }
+
+ if (player_said_2(take, crystal_flower) || player_said_2(pull, crystal_flower)) {
+ switch (kernel.trigger) {
+ case 0:
+ if (!player_has(crystal_flower)) {
+ player.commands_allowed = false;
+ player.walker_visible = false;
+ if (global[player_persona] == PLAYER_IS_KING) {
+ seq[fx_take] = kernel_seq_pingpong(ss[fx_take], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_SPRITE, 5, 2);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_EXPIRE, 0, 3);
+
+ } else {
+ seq[fx_take] = kernel_seq_pingpong(ss[fx_take], false, 7, 0, 0, 2);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_SPRITE, 4, 2);
+ kernel_seq_trigger(seq[fx_take], KERNEL_TRIGGER_EXPIRE, 0, 3);
+ }
+ kernel_seq_depth(seq[fx_take], 1);
+ kernel_seq_range(seq[fx_take], KERNEL_FIRST, KERNEL_LAST);
+ kernel_seq_player(seq[fx_take], true);
+ goto handled;
+ }
+ break;
+
+ case 2:
+ if (local->prevent) {
+ kernel_seq_delete(seq[fx_flower]);
+ kernel_flip_hotspot(words_crystal_flower, false);
+ global[player_score] += 5;
+ sound_play(N_CrystalPing);
+ inter_give_to_player(crystal_flower);
+ object_examine(crystal_flower, 30329, 0);
+ }
+ local->prevent = true;
+ goto handled;
+ break;
+
+ case 3:
+ player.walker_visible = true;
+ player.commands_allowed = true;
+ kernel_synch(KERNEL_PLAYER, 0, KERNEL_SERIES, seq[fx_take]);
+ goto handled;
+ break;
+ }
+ }
+
+ if (player_said_2(talk_to, Butterfly_King)) {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ kernel_abort_animation(aa[3]);
+ kernel_abort_animation(aa[7]);
+ kernel_abort_animation(aa[6]);
+ kernel_abort_animation(aa[5]);
+ kernel_abort_animation(aa[9]);
+ local->anim_3_running = false;
+ local->anim_7_running = false;
+ local->anim_6_running = false;
+ local->anim_5_running = false;
+ local->anim_9_running = false;
+
+ player.commands_allowed = false;
+ kernel_seq_delete(seq[fx_butt_king]);
+ aa[1] = kernel_run_animation(kernel_name('u', 1), 0);
+ local->anim_1_running = true;
+ local->bk_action = FREEZE;
+
+ conv_run(CONV_57_KING);
+ }
+ goto handled;
+ }
+
+ if (player.look_around) {
+ text_show(30330);
+ goto handled;
+ }
+
+ if (player_said_1(look) || player_said_1(look_at)) {
+
+ if (player_said_1(mushroom)) {
+ if (inter_point_x < 333 ||
+ (inter_point_x > 436 && inter_point_y > 86)) {
+ text_show(30307);
+
+ } else {
+ if (global[player_persona] == PLAYER_IS_KING) {
+ text_show(30304);
+ } else {
+ text_show(30303);
+ }
+ }
+ goto handled;
+ }
+
+ if (player_said_1(ground)) {
+ text_show(30308);
+ goto handled;
+ }
+
+ if (player_said_1(flowers)) {
+ text_show(30309);
+ if (object_is_here(crystal_flower)) {
+ text_show(30310);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(crown)) {
+ text_show(30313);
+ if (game.difficulty == EASY_MODE && global[can_view_crown_hole]) {
+ text_show(30314);
+ }
+ goto handled;
+ }
+
+ if (player_said_1(tree_stump)) {
+ text_show(30316);
+ goto handled;
+ }
+
+ if (player_said_1(toads)) {
+ text_show(30320);
+ goto handled;
+ }
+
+ if (player_said_1(Butterfly_King)) {
+ text_show(30325);
+ goto handled;
+ }
+
+ if (player_said_1(sanctuary_woods)) {
+ text_show(30327);
+ goto handled;
+ }
+
+ if (player_said_1(path_to_east)) {
+ text_show(30332);
+ goto handled;
+ }
+
+ if (player_said_1(crystal_flower) && object_is_here(crystal_flower)) {
+ text_show(30328);
+ goto handled;
+ }
+ }
+
+ if (player_said_2(take, mushroom)) {
+ text_show(30305);
+ goto handled;
+ }
+
+ if (player_said_3(sword, attack, mushroom) ||
+ player_said_3(sword, carve_up, mushroom) ||
+ player_said_3(sword, thrust, mushroom) ||
+ player_said_2(push, mushroom) ||
+ player_said_2(pull, mushroom)) {
+ text_show(30306);
+ goto handled;
+ }
+
+ if (player_said_2(take, flowers) || player_said_2(pull, flowers)) {
+ text_show(30311);
+ goto handled;
+ }
+
+ if (player_said_2(open, flowers) || player_said_2(close, flowers)) {
+ text_show(30312);
+ goto handled;
+ }
+
+ if (player_said_2(take, tree_stump)) {
+ text_show(30317);
+ goto handled;
+ }
+
+ if (player_said_2(open, tree_stump)) {
+ text_show(30318);
+ goto handled;
+ }
+
+ if (player_said_2(put, tree_stump)) {
+ text_show(30319);
+ goto handled;
+ }
+
+ if (player_said_2(take, toads)) {
+ text_show(30320);
+ goto handled;
+ }
+
+ if (player_said_2(close, toads)) {
+ text_show(30322);
+ goto handled;
+ }
+
+ if (player_said_2(talk_to, toads)) {
+ text_show(30323);
+ goto handled;
+ }
+
+ if (player_said_2(throw, toads) || player_said_2(give, toads)) {
+ if (player_said_1(fruit) ||
+ player_said_1(bone) ||
+ player_said_1(dates) ||
+ player_said_1(ratsicle) ||
+ player_said_1(dead_rat) ||
+ player_said_1(tentacle_parts)) {
+ text_show(30324);
+ goto handled;
+ }
+ }
+
+ if (player_said_3(sword, attack, Butterfly_King) ||
+ player_said_3(sword, carve_up, Butterfly_King) ||
+ player_said_3(sword, thrust, Butterfly_King) ||
+ player_said_2(throw, Butterfly_King) ||
+ player_said_2(push, Butterfly_King) ||
+ player_said_2(pull, Butterfly_King)) {
+ text_show(30326);
+ goto handled;
+ }
+
+ goto done;
+
+handled:
+ player.command_ready = false;
+
+done:
+ ;
}
void room_303_synchronize(Common::Serializer &s) {
-
+ for (int16 &v : scratch.sprite) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.sequence) s.syncAsSint16LE(v);
+ for (int16 &v : scratch.animation) s.syncAsSint16LE(v);
+ s.syncAsSint16LE(scratch.scroll_left_base);
+ s.syncAsSint16LE(scratch.dyn_scroll_left);
+ s.syncAsSint16LE(scratch.scroll_right_base);
+ s.syncAsSint16LE(scratch.dyn_scroll_right);
+ s.syncAsSint16LE(scratch.scroll_mid_base);
+ s.syncAsSint16LE(scratch.dyn_scroll_mid);
+ s.syncAsSint16LE(scratch.butter_frame);
+ s.syncAsSint16LE(scratch.butter_talk_count);
+ s.syncAsSint16LE(scratch.anim_0_running);
+ s.syncAsSint16LE(scratch.bk_frame);
+ s.syncAsSint16LE(scratch.bk_action);
+ s.syncAsSint16LE(scratch.bk_talk_count);
+ s.syncAsSint16LE(scratch.anim_1_running);
+ s.syncAsSint16LE(scratch.frog_1_frame);
+ s.syncAsSint16LE(scratch.frog_1_action);
+ s.syncAsSint16LE(scratch.frog_1_talk_count);
+ s.syncAsSint16LE(scratch.anim_3_running);
+ s.syncAsSint16LE(scratch.frog_2_frame);
+ s.syncAsSint16LE(scratch.frog_2_action);
+ s.syncAsSint16LE(scratch.frog_2_talk_count);
+ s.syncAsSint16LE(scratch.anim_4_running);
+ s.syncAsSint16LE(scratch.frog_3_frame);
+ s.syncAsSint16LE(scratch.frog_3_action);
+ s.syncAsSint16LE(scratch.frog_3_talk_count);
+ s.syncAsSint16LE(scratch.anim_5_running);
+ s.syncAsSint16LE(scratch.frog_4_frame);
+ s.syncAsSint16LE(scratch.frog_4_action);
+ s.syncAsSint16LE(scratch.frog_4_talk_count);
+ s.syncAsSint16LE(scratch.anim_6_running);
+ s.syncAsSint16LE(scratch.frog_5_frame);
+ s.syncAsSint16LE(scratch.frog_5_action);
+ s.syncAsSint16LE(scratch.frog_5_talk_count);
+ s.syncAsSint16LE(scratch.anim_7_running);
+ s.syncAsSint16LE(scratch.fli_frame);
+ s.syncAsSint16LE(scratch.fli_action);
+ s.syncAsSint16LE(scratch.fli_talk_count);
+ s.syncAsSint16LE(scratch.anim_8_running);
+ s.syncAsSint16LE(scratch.frog_6_frame);
+ s.syncAsSint16LE(scratch.frog_6_action);
+ s.syncAsSint16LE(scratch.frog_6_talk_count);
+ s.syncAsSint16LE(scratch.anim_9_running);
+ s.syncAsSint16LE(scratch.death_frame);
+ s.syncAsSint16LE(scratch.anim_10_running);
+ s.syncAsSint16LE(scratch.prevent);
+ s.syncAsSint16LE(scratch.prevent_2);
+ s.syncAsSint16LE(scratch.pid_take);
+ s.syncAsSint16LE(scratch.wing_type);
+ s.syncAsSint16LE(scratch.dont_die);
}
void room_303_preload() {
- room_init_code_pointer = room_303_init;
+ room_init_code_pointer = room_303_init;
room_pre_parser_code_pointer = room_303_pre_parser;
- room_parser_code_pointer = room_303_parser;
- room_daemon_code_pointer = room_303_daemon;
+ room_parser_code_pointer = room_303_parser;
+ room_daemon_code_pointer = room_303_daemon;
section_3_walker();
section_3_interface();
+
+ player.walker_must_reload = true;
}
} // namespace Rooms
More information about the Scummvm-git-logs
mailing list