Skip to content

Commit

Permalink
Extension fields for EasyRPG, behavior changes (#43)
Browse files Browse the repository at this point in the history
* Fix picture batch-erase (#42)

* Fix nametag sprites being erroneously reused

* Extension fields for multiplayer ShowPicture

---------

Co-authored-by: notdistorted <73075016+notdistorted@users.noreply.github.com>
  • Loading branch information
Desdaemon and notdistorted authored Sep 8, 2024
1 parent 48affe0 commit 708e792
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/game_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3088,7 +3088,7 @@ bool Game_Interpreter::CommandErasePicture(lcf::rpg::EventCommand const& com) {

Main_Data::game_pictures->Erase(i);

GMI().PictureErased(pic_id);
GMI().PictureErased(i);
}
} else {
PicPointerPatch::AdjustId(pic_id);
Expand Down
1 change: 1 addition & 0 deletions src/multiplayer/chatname.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void ChatName::Draw(Bitmap& dst) {
// FIXME: Text::GetSize is broken and always returns a height of 0, use 12 for now
auto rect = Text::GetSize(*Font::NameText(), nick_trim);
nick_img = Bitmap::Create(rect.width, 12);
nick_img->SetId(fmt::format("nametag:{}", nickname));

Text::Draw(*nick_img, 0, 0, *Font::NameText(), *(sys_graphic ? sys_graphic : Cache::SystemOrBlack()), 0, nick_trim);

Expand Down
18 changes: 17 additions & 1 deletion src/multiplayer/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,20 @@ namespace S2C {
p.name = v.at(17);
p.use_transparent_color = Decode<bool>(v.at(18));
p.fixed_to_map = Decode<bool>(v.at(19));
if (v.size() >= 32) {
p.spritesheet_cols = Decode<int>(v.at(20));
p.spritesheet_rows = Decode<int>(v.at(21));
p.spritesheet_frame = Decode<int>(v.at(22));
p.spritesheet_speed = Decode<int>(v.at(23));
p.spritesheet_play_once = Decode<bool>(v.at(24));
p.map_layer = Decode<int>(v.at(25));
p.battle_layer = Decode<int>(v.at(26));
p.flags = Decode<int>(v.at(27));
p.blend_mode = Decode<int>(v.at(28));
p.flip_x = Decode<bool>(v.at(29));
p.flip_y = Decode<bool>(v.at(30));
p.origin = Decode<int>(v.at(31));
}
return p;
}
ShowPicturePacket(const PL& v)
Expand Down Expand Up @@ -503,7 +517,9 @@ namespace C2S {
std::string ToBytes() const override {
std::string r {GetName()};
PicturePacket::Append(r);
AppendPartial(r, p_show.name, p_show.use_transparent_color, p_show.fixed_to_map);
AppendPartial(r, p_show.name, p_show.use_transparent_color, p_show.fixed_to_map,
p_show.spritesheet_cols, p_show.spritesheet_rows, p_show.spritesheet_frame, p_show.spritesheet_speed, p_show.spritesheet_play_once,
p_show.map_layer, p_show.battle_layer, p_show.flags, p_show.blend_mode, p_show.flip_x, p_show.flip_y, p_show.origin);
return r;
}
protected:
Expand Down

0 comments on commit 708e792

Please sign in to comment.