don't set floor if it's negative
This commit is contained in:
@@ -3936,9 +3936,9 @@ struct G_DestroyNPC_6x1C {
|
||||
|
||||
// 6x1F: Set player floor
|
||||
|
||||
struct G_SetPlayerArea_6x1F {
|
||||
struct G_SetPlayerFloor_6x1F {
|
||||
G_ClientIDHeader header;
|
||||
le_uint32_t floor = 0;
|
||||
le_int32_t floor = 0;
|
||||
} __packed__;
|
||||
|
||||
// 6x20: Set position
|
||||
@@ -3947,7 +3947,7 @@ struct G_SetPlayerArea_6x1F {
|
||||
|
||||
struct G_SetPosition_6x20 {
|
||||
G_ClientIDHeader header;
|
||||
le_uint32_t floor = 0;
|
||||
le_int32_t floor = 0;
|
||||
le_float x = 0.0f;
|
||||
le_float y = 0.0f;
|
||||
le_float z = 0.0f;
|
||||
@@ -3958,7 +3958,7 @@ struct G_SetPosition_6x20 {
|
||||
|
||||
struct G_InterLevelWarp_6x21 {
|
||||
G_ClientIDHeader header;
|
||||
le_uint32_t floor = 0;
|
||||
le_int32_t floor = 0;
|
||||
} __packed__;
|
||||
|
||||
// 6x22: Set player invisible
|
||||
@@ -4164,9 +4164,9 @@ struct G_Unknown_6x3B {
|
||||
struct G_StopAtPosition_6x3E {
|
||||
G_ClientIDHeader header;
|
||||
le_uint16_t unknown_a1 = 0;
|
||||
le_uint16_t unknown_a2 = 0;
|
||||
le_uint16_t floor = 0;
|
||||
le_uint16_t unknown_a3 = 0;
|
||||
le_uint16_t angle = 0;
|
||||
le_int16_t floor = 0;
|
||||
le_int16_t room = 0;
|
||||
le_float x = 0.0f;
|
||||
le_float y = 0.0f;
|
||||
le_float z = 0.0f;
|
||||
@@ -4178,8 +4178,8 @@ struct G_SetPosition_6x3F {
|
||||
G_ClientIDHeader header;
|
||||
le_uint16_t unknown_a1 = 0;
|
||||
le_uint16_t angle = 0;
|
||||
le_uint16_t floor = 0;
|
||||
le_uint16_t room = 0;
|
||||
le_int16_t floor = 0;
|
||||
le_int16_t room = 0;
|
||||
le_float x = 0.0f;
|
||||
le_float y = 0.0f;
|
||||
le_float z = 0.0f;
|
||||
|
||||
@@ -704,7 +704,9 @@ static void on_set_player_visible(shared_ptr<Client> c, uint8_t command, uint8_t
|
||||
template <typename CmdT, uint8_t DCNTESubcommand, uint8_t DC112000ProtoSubcommand>
|
||||
static void on_change_floor(shared_ptr<Client> c, uint8_t command, uint8_t flag, const void* data, size_t size) {
|
||||
const auto& cmd = check_size_t<CmdT>(data, size);
|
||||
c->floor = cmd.floor;
|
||||
if (cmd.floor >= 0) {
|
||||
c->floor = cmd.floor;
|
||||
}
|
||||
forward_subcommand(c, command, flag, data, size, DCNTESubcommand, DC112000ProtoSubcommand);
|
||||
}
|
||||
|
||||
@@ -838,7 +840,9 @@ void on_movement_with_floor(shared_ptr<Client> c, uint8_t command, uint8_t flag,
|
||||
|
||||
c->x = cmd.x;
|
||||
c->z = cmd.z;
|
||||
c->floor = cmd.floor;
|
||||
if (cmd.floor >= 0) {
|
||||
c->floor = cmd.floor;
|
||||
}
|
||||
|
||||
forward_subcommand(c, command, flag, data, size, DCNTESubcommand, DC112000ProtoSubcommand);
|
||||
}
|
||||
@@ -2862,7 +2866,7 @@ SubcommandDefinition subcommand_definitions[0x100] = {
|
||||
/* 6x1C */ {0x00, 0x00, 0x1C, on_forward_check_size_game},
|
||||
/* 6x1D */ {0x00, 0x00, 0x1D, nullptr},
|
||||
/* 6x1E */ {0x00, 0x00, 0x1E, nullptr},
|
||||
/* 6x1F */ {0x1B, 0x1D, 0x1F, on_change_floor<G_SetPlayerArea_6x1F, 0x1B, 0x1D>},
|
||||
/* 6x1F */ {0x1B, 0x1D, 0x1F, on_change_floor<G_SetPlayerFloor_6x1F, 0x1B, 0x1D>},
|
||||
/* 6x20 */ {0x1C, 0x1E, 0x20, on_movement_with_floor<G_SetPosition_6x20, 0x00, 0x00>},
|
||||
/* 6x21 */ {0x1D, 0x1F, 0x21, on_change_floor<G_InterLevelWarp_6x21, 0x1D, 0x1F>},
|
||||
/* 6x22 */ {0x1E, 0x20, 0x22, on_set_player_invisible},
|
||||
|
||||
Reference in New Issue
Block a user