Docs, is-named bool functions and MSVC utf-8

This commit is contained in:
shweet committed 2026-11-12 21:48:04 -05:00
1 parent 1a0db1abbd
commit 1cf4d1ea85
18 files changed
+443 -586

No files matched your search

+6 -8
View File
@@ -51,24 +51,23 @@ bool Play::is_spawn_possible()
return false;
}
bool Play::spawn_queue_add(int id)
void Play::spawn_queue_add(int id)
{
if (id < 0 || id >= (int)character->items.size())
return false;
return;
Item& item = character->items[id];
audio->play(character->sounds[SOUND_SUMMON]);
if (item.rarity >= 0)
audio->play(character->rarities[item.rarity].sound);
spawnQueue.push_back(id);
spawnDelay = spawn_delay_get();
return true;
}
// Queues an item picked at random by rarity, once the spawn delay is up.
bool Play::spawn_queue_add()
void Play::spawn_queue_add()
{
if (spawnDelay > 0 || !is_spawn_possible())
return false;
return;
float total = 0;
for (int i = 0; i < (int)character->items.size(); i++)
total += spawn_weight_get(*this, i);
@@ -76,7 +75,6 @@ bool Play::spawn_queue_add()
for (int i = 0; i < (int)character->items.size(); i++)
if (float weight = spawn_weight_get(*this, i); weight > 0 && (roll -= weight) < 0)
return spawn_queue_add(i);
return false;
}
// Where an eat area takes food: its null now, or at the start of its animation when it isn't showing.
@@ -426,7 +424,7 @@ void Play::interact_update(Pointer pointer)
}
// Moves the cursor toward a target, braking to land on it. Returns whether it's there.
static bool move_toward(Vec2& position, Vec2& velocity, Vec2 target, float speed, float acceleration)
static bool is_target_reached(Vec2& position, Vec2& velocity, Vec2 target, float speed, float acceleration)
{
Vec2 delta = target - position;
float distance = vec2_length(delta);
@@ -520,7 +518,7 @@ void Play::autofeed_update(Pointer& itemPointer, Pointer& interactPointer)
auto move = [&](Vec2 target, float speed, float acceleration) {
isAutofeedActive = autoCursor.isVisible = true;
itemPointer = interactPointer = {.position = autoCursor.position, .isAutomated = true};
bool isThere = move_toward(autoCursor.position, autoVelocity, target, speed * speedScale,
bool isThere = is_target_reached(autoCursor.position, autoVelocity, target, speed * speedScale,
acceleration * speedScale);
itemPointer.position = interactPointer.position = autoCursor.position;
return isThere;