Some major changes happend to wasm2c, before I do something stupid...
This commit is contained in:
parent
af66bfc82f
commit
049f599d9a
|
|
@ -8644,6 +8644,39 @@ static u32 w2c_f167(u32 w2c_p0) {
|
|||
}
|
||||
|
||||
void w2c_f168(u32 w2c_p0, u32 w2c_p1) {
|
||||
typedef struct str_long_ {
|
||||
u32 text;
|
||||
int length;
|
||||
void* capacity;
|
||||
} str_long;
|
||||
|
||||
typedef struct str_short_ {
|
||||
char text[1];
|
||||
char __pad[10];
|
||||
char length;
|
||||
} str_short;
|
||||
|
||||
typedef struct str_ {
|
||||
union {
|
||||
str_long repr_long;
|
||||
str_short repr_short;
|
||||
};
|
||||
} str;
|
||||
|
||||
_Static_assert(sizeof(str_long) == 12, L"str_long needs to be 12 bytes.");
|
||||
_Static_assert(sizeof(str_short) == 12, L"str_long needs to be 12 bytes.");
|
||||
_Static_assert(sizeof(str) == 12, L"str_long needs to be 12 bytes.");
|
||||
|
||||
printf("get_text(): ");
|
||||
|
||||
str* str_input = (str*)&(&w2c_memory)->data[w2c_p1];
|
||||
// if is_short
|
||||
if(-1 < str_input->repr_short.length) {
|
||||
printf("\"%s\" ", str_input->repr_short.text);
|
||||
} else {
|
||||
printf("\"%s\" ", (char*)&(&w2c_memory)->data[str_input->repr_long.text]);
|
||||
}
|
||||
|
||||
u32 w2c_l2 = 0, w2c_l3 = 0, w2c_l4 = 0, w2c_l5 = 0, w2c_l6 = 0, w2c_l7 = 0;
|
||||
FUNC_PROLOGUE;
|
||||
u32 w2c_i0, w2c_i1, w2c_i2, w2c_i3;
|
||||
|
|
@ -8759,6 +8792,17 @@ void w2c_f168(u32 w2c_p0, u32 w2c_p1) {
|
|||
w2c_i0 += w2c_i1;
|
||||
w2c_g0 = w2c_i0;
|
||||
FUNC_EPILOGUE;
|
||||
|
||||
printf("got translated into ");
|
||||
|
||||
str* str_output = (str*)&(&w2c_memory)->data[w2c_p0];
|
||||
// if is_short
|
||||
if(-1 < str_output->repr_short.length) {
|
||||
printf("\"%s\" ", str_output->repr_short.text);
|
||||
} else {
|
||||
printf("\"%s\" ", (char*)&(&w2c_memory)->data[str_output->repr_long.text]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static u32 w2c_f169(u32 w2c_p0, u32 w2c_p1, u32 w2c_p2) {
|
||||
|
|
|
|||
|
|
@ -221,22 +221,14 @@ check_rebuff(const flyff::Pointer<flyff::Mover> &buffer, const flyff::Pointer<fl
|
|||
static_cast<const flyff::ObjectProperty *>(buff->property)
|
||||
);
|
||||
|
||||
std::cout << "Current skill level: " << current_skill_level << ", Player skill level: "
|
||||
<< player_skill_level << std::endl;
|
||||
if (player_skill_level > current_skill_level) {
|
||||
std::cout << neuz.get_text(buff_property->name)
|
||||
<< " has to be applied because it is lower level than what " << buffer->name << " has."
|
||||
<< std::endl;
|
||||
// Always apply a higher buff.
|
||||
result.push_back(skill_index);
|
||||
} else if (buff->get_time_remaining() < 30 * 1000 && player_skill_level >= current_skill_level) {
|
||||
std::cout << neuz.get_text(buff_property->name) << " has to be applied because the buff is running out."
|
||||
<< std::endl;
|
||||
// Refresh the buff.
|
||||
result.push_back(skill_index);
|
||||
}
|
||||
} else {
|
||||
// std::cout << buff_property->name << " has to be applied because it is lower level than what " << buffer->name << " has." << std::endl;
|
||||
// Apply the buff.
|
||||
result.push_back(skill_index);
|
||||
}
|
||||
|
|
@ -474,9 +466,9 @@ void on_keyup_hook(int event_type, const EmscriptenKeyboardEvent *event, void *u
|
|||
}
|
||||
|
||||
std::cout << "Player has the following " << client.player->skills->size() << " skills" << std::endl;
|
||||
for(const auto& skill : client.player->skills) {
|
||||
const auto& property = fugg::Client::get_skill_property(skill.id);
|
||||
if(property) {
|
||||
for (const auto &skill: client.player->skills) {
|
||||
const auto &property = fugg::Client::get_skill_property(skill.id);
|
||||
if (property) {
|
||||
std::cout << client.get_text(property->name) << " ";
|
||||
}
|
||||
std::cout << "(" << skill.id << ") at level " << skill.level << std::endl;
|
||||
|
|
@ -665,7 +657,7 @@ void attacker_script() {
|
|||
std::string str = "Eating ";
|
||||
str.append(neuz.get_text(food_item->property->name));
|
||||
|
||||
neuz.show_message(str);
|
||||
neuz.show_message(str, {0x7F, 0, 0});
|
||||
|
||||
client.send_use_item_in_inventory(food_item->index);
|
||||
} else {
|
||||
|
|
@ -735,9 +727,6 @@ void attacker_script() {
|
|||
}
|
||||
}
|
||||
|
||||
std::cout << "Player has " << neuz.player->get_mp() << " / " << neuz.player->get_max_mp() << " MP" << std::endl;
|
||||
std::cout << "Player has " << neuz.player->get_fp() << " / " << neuz.player->get_max_fp() << " FP" << std::endl;
|
||||
|
||||
if (neuz.player->get_fp_percent() != 100) {
|
||||
auto fatigue_item = flyff::Pointer<flyff::InventoryItem>(nullptr);
|
||||
auto items = player->inventory.begin();
|
||||
|
|
@ -784,6 +773,7 @@ void attacker_script() {
|
|||
|
||||
current_target = 0;
|
||||
neuz.player->selected_target = 0;
|
||||
neuz.player->attack_target = 0;
|
||||
client.send_clear_target();
|
||||
return;
|
||||
}
|
||||
|
|
@ -791,10 +781,8 @@ void attacker_script() {
|
|||
}
|
||||
|
||||
|
||||
if ((neuz.player->get_move_state() == flyff::Object::MoveState::Stand ||
|
||||
neuz.player->get_move_state() == flyff::Object::MoveState::PickUp) &&
|
||||
if (neuz.player->get_move_state() == flyff::Object::MoveState::Stand &&
|
||||
!neuz.player->is_attacking()) {
|
||||
std::cout << "Player MoveState: " << client.player->get_move_state() << std::endl;
|
||||
|
||||
// Check buffs.
|
||||
static constexpr flyff::SkillID buffs_to_check[] = {
|
||||
|
|
@ -863,7 +851,7 @@ void attacker_script() {
|
|||
client.send_use_skill(flyff::SkillID::Asmodeus);
|
||||
return;
|
||||
}
|
||||
} else if(neuz.player->get_job() == flyff::JobID::Knight) {
|
||||
} else if (neuz.player->get_job() == flyff::JobID::Knight) {
|
||||
const auto &off_hand = player->get_equipped_item(flyff::Part::Shield);
|
||||
|
||||
if (off_hand && off_hand->item_kind3 == flyff::ItemKind3::Shield) {
|
||||
|
|
|
|||
Reference in New Issue