mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
ICB: ELDORADO: handle fn_set_as_player differences
This commit is contained in:
parent
2e6cd47b68
commit
fc46171489
@ -216,6 +216,13 @@ void SetPlayerShotBone(int32 obj_id) {
|
||||
|
||||
#define STANDARD_MARKER_HEIGHT 170
|
||||
|
||||
void ResetPlayerLook() {
|
||||
_logic *log = MS->player.log;
|
||||
BoneDeformation *b = &(log->voxel_info->lookBone);
|
||||
|
||||
b->boneTarget.vx = b->boneTarget.vy = b->boneTarget.vz = 0;
|
||||
}
|
||||
|
||||
// update the neck bone
|
||||
// should only be called with player as logic
|
||||
void UpdatePlayerLook() {
|
||||
|
@ -37,6 +37,8 @@ void UpdateTalking(_logic *log, RapAPI *rap);
|
||||
|
||||
void SetPlayerShotBone(int32 obj_id);
|
||||
|
||||
void ResetPlayerLook();
|
||||
|
||||
void UpdatePlayerLook();
|
||||
|
||||
} // End of namespace ICB
|
||||
|
@ -338,8 +338,6 @@ mcodeFunctionReturnCodes fn_shadow(int32 &result, int32 *params) { return (MS->f
|
||||
|
||||
mcodeFunctionReturnCodes fn_is_actor_relative(int32 &result, int32 *params) { return (MS->fn_is_actor_relative(result, params)); }
|
||||
|
||||
mcodeFunctionReturnCodes _game_session::fn_set_as_player(int32 &, int32 *) { return (IR_CONT); }
|
||||
|
||||
mcodeFunctionReturnCodes _game_session::fn_rig_test(int32 &, int32 *) {
|
||||
// no params
|
||||
|
||||
@ -3580,5 +3578,36 @@ mcodeFunctionReturnCodes _game_session::fn_can_save(int32 &result, int32 *) {
|
||||
return IR_CONT;
|
||||
}
|
||||
|
||||
mcodeFunctionReturnCodes _game_session::fn_set_as_player(int32 &, int32 *params) {
|
||||
if (g_icb->getGameType() != GType_ELDORADO)
|
||||
return IR_CONT;
|
||||
|
||||
const char *object_name = (const char *)MemoryUtil::resolvePtr(params[0]);
|
||||
|
||||
uint32 id = LinkedDataObject::Fetch_item_number_by_name(objects, object_name);
|
||||
|
||||
if (id == PX_LINKED_DATA_FILE_ERROR)
|
||||
Fatal_error("fn_set_as_player object [%s] does not exist", object_name);
|
||||
|
||||
// first, if there is a current player then he needs to be told to re-run context as he ain't anymore
|
||||
if (player.Player_exists()) {
|
||||
logic_structs[player.Fetch_player_id()]->context_request = TRUE8;
|
||||
logic_structs[player.Fetch_player_id()]->mega->async_list_pos = 0; // reset list position
|
||||
logic_structs[player.Fetch_player_id()]->mega->asyncing = 0;
|
||||
ResetPlayerLook(); // old player straightens out - i.e. reset look at interact object
|
||||
}
|
||||
|
||||
player.Set_player_id(id);
|
||||
|
||||
player.Reset_player();
|
||||
|
||||
player.interact_lock = TRUE8;
|
||||
|
||||
logic_structs[id]->context_request = TRUE8;
|
||||
logic_structs[id]->mega->async_list_pos = 0; // reset list position
|
||||
logic_structs[id]->mega->asyncing = 0;
|
||||
|
||||
return IR_CONT;
|
||||
}
|
||||
|
||||
} // End of namespace ICB
|
||||
|
@ -2900,8 +2900,10 @@ void _player::Set_player_id(uint32 id) {
|
||||
// get player structures - we can be sure they wont get moved
|
||||
log = g_mission->session->Fetch_object_struct(player_id);
|
||||
|
||||
// get initial barriers for player
|
||||
MS->Prepare_megas_route_barriers(TRUE8);
|
||||
if (g_icb->getGameType() == GType_ICB) {
|
||||
// get initial barriers for player
|
||||
MS->Prepare_megas_route_barriers(TRUE8);
|
||||
}
|
||||
|
||||
// reset pointer to player parent barrier box
|
||||
MS->logic_structs[id]->mega->cur_parent = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user