mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-20 19:21:46 +00:00
M4: Added bunch of conv code
This commit is contained in:
parent
47dd0055e7
commit
64636c34c6
86
engines/m4/adv_r/chunk_ops.cpp
Normal file
86
engines/m4/adv_r/chunk_ops.cpp
Normal file
@ -0,0 +1,86 @@
|
||||
/* 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
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/textconsole.h"
|
||||
#include "m4/adv_r/chunk_ops.h"
|
||||
#include "m4/vars.h"
|
||||
|
||||
namespace M4 {
|
||||
|
||||
conv_chunk *get_conv(Conv *c, long cSize) {
|
||||
char *s = nullptr;
|
||||
conv_chunk *c_v = nullptr;
|
||||
|
||||
s = &(c->conv[c->myCNode]);
|
||||
c_v = (conv_chunk *)&s[cSize];
|
||||
|
||||
return c_v;
|
||||
}
|
||||
|
||||
char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c) {
|
||||
error("TODO: conv_ops_get_entry");
|
||||
}
|
||||
|
||||
decl_chunk *get_decl(Conv *c, long cSize) {
|
||||
char *s = nullptr;
|
||||
decl_chunk *d = nullptr;
|
||||
|
||||
s = c->conv;
|
||||
d = (decl_chunk *)&s[cSize];
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
char *get_string(Conv *c, long cSize) {
|
||||
char *s = nullptr;
|
||||
char *c_s = nullptr;
|
||||
|
||||
s = c->conv;
|
||||
c_s = (char *)&s[cSize];
|
||||
return c_s;
|
||||
}
|
||||
|
||||
text_chunk *get_text(Conv *c, long cSize) {
|
||||
char *s = NULL;
|
||||
text_chunk *t = NULL;
|
||||
|
||||
s = &(c->conv[c->myCNode]);
|
||||
t = (text_chunk *)&s[cSize];
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
long conv_ops_text_strlen(char *s) {
|
||||
long len = 0;
|
||||
len = strlen(s) + 1; //added +1 for null char.
|
||||
|
||||
if ((len % 4) == 0)
|
||||
return len;
|
||||
|
||||
len += 4 - (len % 4);
|
||||
return len;
|
||||
}
|
||||
|
||||
void conv_swap_words(Conv *c) {
|
||||
error("TODO: conv_swap_words");
|
||||
}
|
||||
|
||||
} // End of namespace M4
|
40
engines/m4/adv_r/chunk_ops.h
Normal file
40
engines/m4/adv_r/chunk_ops.h
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
/* 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
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef M4_ADV_R_CHUNK_OPS_H
|
||||
#define M4_ADV_R_CHUNK_OPS_H
|
||||
|
||||
#include "m4/m4_types.h"
|
||||
#include "m4/adv_r/conv.h"
|
||||
|
||||
namespace M4 {
|
||||
|
||||
extern conv_chunk *get_conv(Conv *c, long cSize);
|
||||
extern char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c);
|
||||
extern decl_chunk *get_decl(Conv *c, long cSize);
|
||||
extern char *get_string(Conv *c, long cSize);
|
||||
extern text_chunk *get_text(Conv *c, long cSize);
|
||||
extern long conv_ops_text_strlen(char *s);
|
||||
|
||||
} // End of namespace M4
|
||||
|
||||
#endif
|
108
engines/m4/adv_r/conv.cpp
Normal file
108
engines/m4/adv_r/conv.cpp
Normal file
@ -0,0 +1,108 @@
|
||||
/* 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
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "m4/adv_r/conv.h"
|
||||
#include "m4/core/errors.h"
|
||||
#include "m4/core/imath.h"
|
||||
#include "m4/gui/gui_univ.h"
|
||||
#include "m4/gui/gui_vmng.h"
|
||||
#include "m4/vars.h"
|
||||
|
||||
namespace M4 {
|
||||
|
||||
void set_dlg_rect() {
|
||||
int32 sizex = 0, sizey = 0;
|
||||
int32 screen_x_center = 0, screen_y_center = 0;
|
||||
int32 screen_x_size = 0, screen_y_size = 0;
|
||||
int32 status;
|
||||
|
||||
ScreenContext *game_buff_ptr = vmng_screen_find(_G(gameDrawBuff), &status);
|
||||
if (!game_buff_ptr)
|
||||
error_show(FL, 'BUF!');
|
||||
|
||||
screen_x_center = VIDEO_W / 2;
|
||||
screen_y_center = (game_buff_ptr->y2 - game_buff_ptr->y1) / 2;
|
||||
screen_x_size = VIDEO_W;
|
||||
screen_y_size = (game_buff_ptr->y2 - game_buff_ptr->y1);
|
||||
|
||||
_GC(height) = gr_font_get_height() + _GC(conv_font_spacing_v);
|
||||
_GC(width) += 2 * _GC(conv_font_spacing_h);
|
||||
|
||||
sizex = _GC(width);
|
||||
sizey = _G(cdd).num_txt_ents * (_GC(height))+_GC(conv_font_spacing_v);
|
||||
|
||||
switch (_GC(glob_x)) {
|
||||
case DLG_CENTER_H:
|
||||
_GC(r_x1) = screen_x_center - (sizex / 2);
|
||||
break;
|
||||
|
||||
case DLG_FLUSH_LEFT:
|
||||
_GC(r_x1) = 0;
|
||||
break;
|
||||
|
||||
case DLG_FLUSH_RIGHT:
|
||||
_GC(r_x1) = screen_x_size - sizex;
|
||||
break;
|
||||
|
||||
default:
|
||||
_GC(r_x1) = _GC(glob_x);
|
||||
_GC(r_x1) += game_buff_ptr->x1;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (_GC(glob_y)) {
|
||||
case DLG_CENTER_V:
|
||||
_GC(r_y1) = screen_y_center - (sizey / 2);
|
||||
break;
|
||||
|
||||
case DLG_FLUSH_TOP:
|
||||
_GC(r_y1) = 0;
|
||||
break;
|
||||
|
||||
case DLG_FLUSH_BOTTOM:
|
||||
_GC(r_y1) = screen_y_size - sizey + game_buff_ptr->y1 - 10;
|
||||
break;
|
||||
|
||||
default:
|
||||
_GC(r_y1) = _GC(glob_y);
|
||||
_GC(r_y1) += game_buff_ptr->y1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (_GC(r_x1) < 0)
|
||||
_GC(r_x1) = 0;
|
||||
|
||||
if (_GC(r_y1) < 0)
|
||||
_GC(r_y1) = 0;
|
||||
|
||||
//fprintf( conv_fp, "_GC(r_x1) %d sizex %d\n", _GC(r_x1), sizex );
|
||||
_GC(r_y2) = _GC(r_y1) + sizey - 1;
|
||||
_GC(r_x2) = _GC(r_x1) + sizex - 1;
|
||||
|
||||
_GC(r_x2) = imath_min(VIDEO_W, _GC(r_x2));
|
||||
_GC(r_y2) = imath_min(VIDEO_H, _GC(r_y2));
|
||||
}
|
||||
|
||||
void conv_go(Conv *c) {
|
||||
error("TODO: conv_go");
|
||||
}
|
||||
|
||||
} // End of namespace M4
|
@ -27,6 +27,8 @@
|
||||
|
||||
namespace M4 {
|
||||
|
||||
#define _GC(X) _G(conversations).##X
|
||||
|
||||
#define CONV_WAIT_FOR_INPUT 1
|
||||
#define CONV_HALT_FOREVER 2
|
||||
#define CONV_HALT 3
|
||||
@ -223,84 +225,8 @@ struct c_assign_chunk {
|
||||
long opnd1; // Integer value.
|
||||
};
|
||||
|
||||
extern Conv *conv_load(char *filename, int x1, int y1, int32 myTrigger, bool want_box = true);
|
||||
|
||||
extern void conv_unload(Conv *c);
|
||||
extern void conv_shutdown();
|
||||
|
||||
extern Conv *conv_get_handle();
|
||||
extern void conv_set_handle(Conv *c);
|
||||
|
||||
extern void conv_resume(Conv *c);
|
||||
|
||||
extern void set_conv_name(char *s);
|
||||
extern char *get_conv_name();
|
||||
extern char *conv_sound_to_play();
|
||||
extern int32 conv_whos_talking();
|
||||
|
||||
extern void conv_snap_on_hotspots();
|
||||
extern void conv_snap_off_hotspots();
|
||||
extern void conv_init_hotspots();
|
||||
|
||||
extern long conv_current_node();
|
||||
extern long conv_current_entry();
|
||||
|
||||
//from: chunkops.cpp
|
||||
extern long get_dechunk_type(char *s, long cSize);
|
||||
|
||||
extern conv_chunk *get_conv(Conv *c, long cSize);
|
||||
extern decl_chunk *get_decl(Conv *c, long cSize);
|
||||
extern node_chunk *get_node(Conv *c, long cSize);
|
||||
extern fall_chunk *get_fall(Conv *c, long cSize);
|
||||
extern lnode_chunk *get_lnode(Conv *c, long cSize);
|
||||
extern entry_chunk *get_entry(Conv *c, long cSize);
|
||||
extern entry_chunk *get_hash_entry(Conv *c, long cSize);
|
||||
|
||||
extern text_chunk *get_text(Conv *c, long cSize);
|
||||
extern mesg_chunk *get_mesg(Conv *c, long cSize);
|
||||
extern reply_chunk *get_reply(Conv *c, long cSize);
|
||||
extern c_reply_chunk *get_c_reply(Conv *c, long cSize);
|
||||
extern goto_chunk *get_goto(Conv *c, long cSize);
|
||||
extern c_goto_chunk *get_c_goto(Conv *c, long cSize);
|
||||
extern c_assign_chunk *get_c_asgn(Conv *c, long cSize);
|
||||
extern w_reply_chunk *get_w_reply(Conv *c, long cSize);
|
||||
extern w_entry_chunk *get_w_entry(Conv *c, long cSize);
|
||||
extern misc_chunk *get_misc(Conv *c, long cSize);
|
||||
extern c_misc_chunk *get_c_misc(Conv *c, long cSize);
|
||||
extern assign_chunk *get_asgn(Conv *c, long cSize);
|
||||
extern long get_long(Conv *c, long cSize);
|
||||
extern char *get_string(Conv *c, long cSize);
|
||||
|
||||
extern char *conv_ops_get_entry(long i, long *next, long *tag, Conv *c);
|
||||
|
||||
extern int conv_ops_cond_successful(long l_op, long op, long r_op);
|
||||
extern long conv_ops_process_asgn(long val, long oprtr, long opnd);
|
||||
extern void conv_ops_unknown_chunk(long tag, char *s);
|
||||
extern long conv_ops_text_strlen(char *s);
|
||||
|
||||
extern long conv_get_decl_val(decl_chunk *decl);
|
||||
extern void conv_set_decl_val(decl_chunk *decl, long val);
|
||||
extern void conv_export_value(Conv *c, long val, int index);
|
||||
extern void conv_export_pointer(Conv *c, long *val, int index);
|
||||
|
||||
extern void conv_set_font_spacing(int32 h, int32 v);
|
||||
extern void conv_set_text_colour(int32 norm_colour, int32 hi_colour);
|
||||
|
||||
extern void conv_set_text_colours(int32 norm_colour, int32 norm_colour_alt1, int32 norm_colour_alt2,
|
||||
int32 hi_colour, int32 hi_colour_alt1, int32 hi_colour_alt2);
|
||||
|
||||
extern void conv_set_shading(int32 shade);
|
||||
extern void conv_set_box_xy(int32 x, int32 y);
|
||||
extern void conv_get_dlg_coords(int32 *x1, int32 *y1, int32 *x2, int32 *y2);
|
||||
extern void conv_set_dlg_coords(int32 x1, int32 y1, int32 x2, int32 y2);
|
||||
extern void conv_set_default_text_colour(int32 norm_colour, int32 hi_colour);
|
||||
extern void conv_set_default_hv(int32 h, int32 v);
|
||||
|
||||
extern int conv_get_event();
|
||||
extern void conv_set_event(int e);
|
||||
extern int conv_is_event_ready();
|
||||
|
||||
extern void conv_swap_words(Conv *c);
|
||||
extern void set_dlg_rect();
|
||||
extern void conv_go(Conv *c);
|
||||
|
||||
} // End of namespace M4
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -40,25 +40,27 @@ struct Converstation_Globals {
|
||||
Conv *globConv = nullptr;
|
||||
bool playerCommAllowed = false;
|
||||
long myFinalTrigger = 0;
|
||||
bool interface_was_visible = false; // to remember to turn it back on or
|
||||
bool interface_was_visible = false; // to remember to turn it back on
|
||||
int restore_conv = 1;
|
||||
|
||||
int32 conv_font_spacing_h = 0;
|
||||
int32 conv_font_spacing_v = 5;
|
||||
int32 conv_default_h = conv_font_spacing_h;
|
||||
int32 conv_default_v = conv_font_spacing_v;
|
||||
int32 conv_shading = 65;
|
||||
|
||||
int32 conv_normal_colour = __BLACK;
|
||||
int32 conv_normal_colour_alt1 = __GREEN;
|
||||
int32 conv_normal_colour_alt2 = __GREEN;
|
||||
int32 conv_hilite_colour = __YELLOW;
|
||||
int32 conv_default_hilite_colour = __YELLOW;
|
||||
int32 conv_hilite_colour_alt1 = __YELLOW;
|
||||
int32 conv_hilite_colour_alt2 = __YELLOW;
|
||||
int32 conv_default_normal_colour = __BLACK;
|
||||
|
||||
int32 width = 0, height = 0;
|
||||
int32 glob_x = 0, glob_y = 0;
|
||||
|
||||
const int32 conv_font_spacing_h = 0;
|
||||
const int32 conv_font_spacing_v = 5;
|
||||
const int32 conv_default_h = conv_font_spacing_h;
|
||||
const int32 conv_default_v = conv_font_spacing_v;
|
||||
const int32 conv_shading = 65;
|
||||
|
||||
const int32 conv_normal_colour = __BLACK;
|
||||
const int32 conv_normal_colour_alt1 = __GREEN;
|
||||
const int32 conv_normal_colour_alt2 = __GREEN;
|
||||
const int32 conv_hilite_colour = __YELLOW;
|
||||
const int32 conv_default_hilite_colour = __YELLOW;
|
||||
const int32 conv_hilite_colour_alt1 = __YELLOW;
|
||||
const int32 conv_hilite_colour_alt2 = __YELLOW;
|
||||
const int32 conv_default_normal_colour = __BLACK;
|
||||
|
||||
int32 r_x1 = 0, r_y1 = 0, r_x2 = 0, r_y2 = 0;
|
||||
|
||||
void syncGame(Common::Serializer &s);
|
||||
|
||||
@ -69,6 +71,50 @@ struct Converstation_Globals {
|
||||
void conv_go(Conv *c);
|
||||
};
|
||||
|
||||
extern Conv *conv_load(char *filename, int x1, int y1, int32 myTrigger, bool want_box = true);
|
||||
|
||||
extern void conv_unload(Conv *c);
|
||||
extern void conv_shutdown();
|
||||
|
||||
extern Conv *conv_get_handle();
|
||||
extern void conv_set_handle(Conv *c);
|
||||
|
||||
extern void conv_resume(Conv *c);
|
||||
extern void conv_reset(char *filename);
|
||||
|
||||
extern void conv_reset_all();
|
||||
extern void conv_play(Conv *c);
|
||||
|
||||
extern void conv_resume(Conv *c);
|
||||
|
||||
extern void set_conv_name(char *s);
|
||||
extern char *get_conv_name();
|
||||
extern char *conv_sound_to_play();
|
||||
extern int32 conv_whos_talking();
|
||||
|
||||
extern long conv_get_decl_val(decl_chunk *decl);
|
||||
extern void conv_set_decl_val(decl_chunk *decl, long val);
|
||||
extern void conv_export_value(Conv *c, long val, int index);
|
||||
extern void conv_export_pointer(Conv *c, long *val, int index);
|
||||
|
||||
extern void conv_set_font_spacing(int32 h, int32 v);
|
||||
extern void conv_set_text_colour(int32 norm_colour, int32 hi_colour);
|
||||
|
||||
extern void conv_set_text_colours(int32 norm_colour, int32 norm_colour_alt1, int32 norm_colour_alt2,
|
||||
int32 hi_colour, int32 hi_colour_alt1, int32 hi_colour_alt2);
|
||||
|
||||
extern void conv_set_shading(int32 shade);
|
||||
extern void conv_set_box_xy(int32 x, int32 y);
|
||||
extern void conv_get_dlg_coords(int32 *x1, int32 *y1, int32 *x2, int32 *y2);
|
||||
extern void conv_set_dlg_coords(int32 x1, int32 y1, int32 x2, int32 y2);
|
||||
extern void conv_set_default_text_colour(int32 norm_colour, int32 hi_colour);
|
||||
extern void conv_set_default_hv(int32 h, int32 v);
|
||||
|
||||
extern int conv_get_event();
|
||||
extern void conv_set_event(int e);
|
||||
extern int conv_is_event_ready();
|
||||
|
||||
extern void conv_swap_words(Conv *c);
|
||||
|
||||
} // End of namespace M4
|
||||
|
||||
|
@ -365,7 +365,7 @@ void Sections::pal_game_task() {
|
||||
_G(midi).loop();
|
||||
|
||||
gui_system_event_handler();
|
||||
#ifdef TODO
|
||||
|
||||
if (conv_is_event_ready()) {
|
||||
_G(player).command_ready = true;
|
||||
term_message("conv parse row");
|
||||
@ -374,13 +374,15 @@ void Sections::pal_game_task() {
|
||||
|
||||
(void)conv_get_event();
|
||||
}
|
||||
#endif
|
||||
|
||||
f_stream_Process(2);
|
||||
|
||||
if (_G(kernel).call_daemon_every_loop)
|
||||
tick();
|
||||
|
||||
if (_G(editors_in_use) && (_G(editors_in_use) & 1))
|
||||
scale_editor_draw();
|
||||
|
||||
if (_G(showMousePos))
|
||||
update_mouse_pos_dialog();
|
||||
}
|
||||
|
@ -316,4 +316,15 @@ void mouse_show() {
|
||||
vmng_screen_show(_G(mouseScreenSource));
|
||||
}
|
||||
|
||||
void mouse_lock_sprite(int32 mouseNum) {
|
||||
_G(mouseIsLocked) = false;
|
||||
mouse_set_sprite(mouseNum);
|
||||
_G(mouseIsLocked) = true;
|
||||
}
|
||||
|
||||
void mouse_unlock_sprite() {
|
||||
_G(mouseIsLocked) = false;
|
||||
mouse_set_sprite(_G(newMouseNum));
|
||||
}
|
||||
|
||||
} // End of namespace M4
|
||||
|
@ -72,6 +72,8 @@ extern bool mouse_set_sprite(int32 spriteNum);
|
||||
extern void gui_mouse_refresh();
|
||||
extern void mouse_hide();
|
||||
extern void mouse_show();
|
||||
extern void mouse_lock_sprite(int32 mouseNum);
|
||||
extern void mouse_unlock_sprite();
|
||||
|
||||
} // End of namespace M4
|
||||
|
||||
|
@ -19,6 +19,8 @@ MODULE_OBJS = \
|
||||
adv_r/adv_scale.o \
|
||||
adv_r/adv_trigger.o \
|
||||
adv_r/adv_walk.o \
|
||||
adv_r/chunk_ops.o \
|
||||
adv_r/conv.o \
|
||||
adv_r/conv_io.o \
|
||||
adv_r/db_env.o \
|
||||
adv_r/kernel.o \
|
||||
|
@ -111,6 +111,7 @@ public:
|
||||
Sound::Midi _midi;
|
||||
KernelPal_Globals _krnPal;
|
||||
ADVScale_Globals _scale;
|
||||
ConvDisplayData _cdd;
|
||||
|
||||
bool _cheating_enabled = false;
|
||||
bool _cheat_keys_enabled = false;
|
||||
@ -186,6 +187,7 @@ public:
|
||||
#define _GI() (*g_vars->getInterface())
|
||||
#define _GW() (*g_vars->getWalker())
|
||||
#define _GWS(X) _G(ws)._##X
|
||||
#define INTERFACE_VISIBLE g_vars->getInterface()->_visible
|
||||
|
||||
} // namespace M4
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user