[Scummvm-git-logs] scummvm master -> 0892badade65a57dc76b97ae38f2884a0763de3c
joostp
noreply at scummvm.org
Wed Aug 3 13:08:09 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0892badade ICB: ELDORADO: add several El Dorado specific script functions
Commit: 0892badade65a57dc76b97ae38f2884a0763de3c
https://github.com/scummvm/scummvm/commit/0892badade65a57dc76b97ae38f2884a0763de3c
Author: Joost Peters (joostp at 7fc1.org)
Date: 2022-08-03T15:07:02+02:00
Commit Message:
ICB: ELDORADO: add several El Dorado specific script functions
Changed paths:
engines/icb/bone.cpp
engines/icb/logic.cpp
engines/icb/object_structs.h
engines/icb/player_interaction.cpp
engines/icb/session.h
diff --git a/engines/icb/bone.cpp b/engines/icb/bone.cpp
index adc6ffd844b..d7fa90f124f 100644
--- a/engines/icb/bone.cpp
+++ b/engines/icb/bone.cpp
@@ -426,6 +426,18 @@ mcodeFunctionReturnCodes fn_simple_look(int32 &result, int32 *params) { return (
mcodeFunctionReturnCodes speak_simple_look(int32 &result, int32 *params) { return (MS->speak_simple_look(result, params)); }
+mcodeFunctionReturnCodes fn_set_mega_height(int32 &result, int32 *params) { return (MS->fn_set_mega_height(result, params)); }
+
+mcodeFunctionReturnCodes _game_session::fn_set_mega_height(int32 &, int32 *params) {
+ if (!L->mega)
+ Fatal_error("fn_set_mega_height called for %s which is not a mega!", L->GetName());
+
+ L->mega->height = params[0];
+
+ return IR_CONT;
+}
+
+
// the array of standard look coords
#define LOOK_RIGHT (int16)(-384)
diff --git a/engines/icb/logic.cpp b/engines/icb/logic.cpp
index 85fdd2fd53a..3880312b470 100644
--- a/engines/icb/logic.cpp
+++ b/engines/icb/logic.cpp
@@ -73,6 +73,8 @@ mcodeFunctionReturnCodes fn_set_dynamic_light(int32 &result, int32 *params) { re
mcodeFunctionReturnCodes speak_set_dynamic_light(int32 &result, int32 *params) { return (MS->speak_set_dynamic_light(result, params)); }
+mcodeFunctionReturnCodes fn_is_player_standing_still(int32 &result, int32 *params) { return (MS->fn_is_player_standing_still(result, params)); }
+
mcodeFunctionReturnCodes fn_activate_sparkle(int32 &result, int32 *params) { return (MS->fn_activate_sparkle(result, params)); }
mcodeFunctionReturnCodes fn_deactivate_sparkle(int32 &result, int32 *params) { return (MS->fn_deactivate_sparkle(result, params)); }
@@ -125,6 +127,7 @@ void _logic::___init(const char *name) {
// defaults to a prop
image_type = PROP;
+ prop_interact_method = __ICB;
// defaults to no-type-set
object_type = __NO_TYPE_SET;
@@ -184,6 +187,8 @@ void _logic::___init(const char *name) {
// sparkle off by default
sparkleOn = FALSE8;
+
+ interact_dist = DEFAULT_interact_distance; //default interact distance - this is the ICB figure, but ED imps can change as required
}
void _mega::___init() {
@@ -256,6 +261,9 @@ void _mega::___init() {
dead = FALSE8; // still alive!
+ // height for looking at
+ height = DEFAULT_HEIGHT; //170cm default
+
// camera control
y_locked = FALSE8;
@@ -272,6 +280,17 @@ mcodeFunctionReturnCodes _game_session::fn_set_to_exlusive_coords(int32 &, int32
return IR_CONT;
}
+mcodeFunctionReturnCodes _game_session::fn_is_player_standing_still(int32 &result, int32 *) {
+ // stood or crouching?
+ if ((player.player_status == STOOD) || (player.player_status == CROUCHING) || (player.player_status == INVENTORY))
+ result = 1;
+ else
+ result = 0;
+
+ return IR_CONT;
+
+}
+
mcodeFunctionReturnCodes _game_session::fn_get_persons_weapon(int32 &result, int32 *params) {
// return the weapon type to the script
diff --git a/engines/icb/object_structs.h b/engines/icb/object_structs.h
index 11757b6b1d3..223e89b2c79 100644
--- a/engines/icb/object_structs.h
+++ b/engines/icb/object_structs.h
@@ -200,6 +200,8 @@ enum CameraStateEnum { OFF_CAMERA = 0x0, ON_CAMERA = 0x1 };
// on camera last cycle and on this cycle
#define ON_ON_CAMERA MAKE_VIEW_STATE(ON_CAMERA, ON_CAMERA)
+#define DEFAULT_HEIGHT 170
+
class _mega { // mega logic specific
public:
ParentBox *cur_parent; // our owner parent box
@@ -243,6 +245,8 @@ public:
Breath breath;
+ int32 height; // looking height (El Dorado only)
+
// the dynamic lamp (with one state only) and a switch as to whether it is on or off (if >0 then it is on for dynLightOn cycles, if
// 0 then off, if -1 on until explicitly turned off)
PSXLamp dynLight; // the lamp, filled in partly by logic and partly by stagedraw (rotating with character)
@@ -349,6 +353,8 @@ inline void _mega::SetThisViewState(enum CameraStateEnum status) { viewState = (
enum _object_image_type { PROP, VOXEL };
+enum _prop_interact_type { __THREE_SIXTY = 1, __ICB, __RADIAL };
+
enum _hold_mode {
prop_camera_hold = 1,
mega_player_floor_hold, // hold when not on player floor
@@ -402,6 +408,10 @@ public:
// prop xyz coord derived from nico
PXvector prop_xyz;
PXfloat prop_interact_pan;
+ PXreal interact_dist; //actual distance - can be changed by implementor
+ _prop_interact_type prop_interact_method; //user interaction method
+ int32 radial_interact_distance;
+
PXfloat pan; // engine pan
PXfloat pan_adjust; // pan neutraliser for frames that include a pan from the grab - i.e. turn on spot
// this is a distance to look up when looking at the object, only useful:
diff --git a/engines/icb/player_interaction.cpp b/engines/icb/player_interaction.cpp
index 603e2ab6de2..9b96b59dbd4 100644
--- a/engines/icb/player_interaction.cpp
+++ b/engines/icb/player_interaction.cpp
@@ -47,6 +47,7 @@
namespace ICB {
mcodeFunctionReturnCodes fn_start_player_interaction(int32 &result, int32 *params) { return (MS->fn_start_player_interaction(result, params)); }
+mcodeFunctionReturnCodes fn_set_interact_distance(int32 &result, int32 *params) { return (MS->fn_set_interact_distance(result, params)); }
#define INTERACT_DISTANCE (250 * REAL_ONE)
#define MIN_INTERACT_DISTANCE (5 * REAL_ONE)
@@ -346,6 +347,23 @@ __mode_return _player::Player_interact() {
return (__MORE_THIS_CYCLE);
}
+mcodeFunctionReturnCodes _game_session::fn_set_interact_distance(int32 &, int32 *params) {
+ // set the distance that the player needs to be from named object to interact with it
+ // params: 0 - name of object, 1 - distance in cm's
+
+ const char *object_name = (const char *)MemoryUtil::resolvePtr(params[0]);
+ uint32 id = LinkedDataObject::Fetch_item_number_by_name(objects, object_name);
+ if (id == 0xffffffff)
+ Fatal_error("[%s] calling fn_set_interact_distance finds [%s] is not a legal object", CGameObject::GetName(object), object_name);
+
+ if (params[1]) //positive value
+ logic_structs[id]->interact_dist = (PXreal)(params[1] * params[1]);
+ else
+ logic_structs[id]->interact_dist = DEFAULT_interact_distance; //default interact distance - this is the ICB figure, but ED imps can change as required
+
+ return IR_CONT;
+}
+
mcodeFunctionReturnCodes _game_session::fn_start_player_interaction(int32 &, int32 *params) {
// do check to see if script running
diff --git a/engines/icb/session.h b/engines/icb/session.h
index 4714b32073d..7606e07ed0a 100644
--- a/engines/icb/session.h
+++ b/engines/icb/session.h
@@ -79,6 +79,8 @@ enum __rtype {
__LASER // straight there - no barriers
};
+#define DEFAULT_interact_distance (500*500*REAL_ONE)
+
#define MAX_extra_floors 12
class _floor_cam_list {
@@ -665,10 +667,14 @@ public:
mcodeFunctionReturnCodes fn_hard_load_custom_anim(int32 &, int32 *);
mcodeFunctionReturnCodes fn_face_camera(int32 &, int32 *);
+ mcodeFunctionReturnCodes fn_set_interact_distance(int32 &, int32 *);
mcodeFunctionReturnCodes fn_activate_sparkle(int32 &, int32 *);
mcodeFunctionReturnCodes fn_deactivate_sparkle(int32 &, int32 *);
+ mcodeFunctionReturnCodes fn_is_player_standing_still(int32 &, int32 *);
+ mcodeFunctionReturnCodes fn_set_mega_height(int32 &, int32 *);
+
void Set_script(const char *script_name);
void Context_check(uint32 script_name);
void Shut_down_object();
More information about the Scummvm-git-logs
mailing list