update comment on get_random quest opcode

This commit is contained in:
Martin Michelsen
2025-02-27 23:13:26 -08:00
parent 4d7a3395ba
commit 21a0efa8ac
2 changed files with 10 additions and 6 deletions
+2 -2
View File
@@ -990,7 +990,7 @@ const char* MapFile::name_for_enemy_type(uint16_t type) {
string MapFile::ObjectSetEntry::str() const {
string name_str = MapFile::name_for_object_type(this->base_type);
return phosg::string_printf("[ObjectEntry type=%04hX \"%s\" set_flags=%04hX index=%04hX a2=%04hX entity_id=%04hX group=%04hX room=%04hX a3=%04hX x=%g y=%g z=%g x_angle=%08" PRIX32 " y_angle=%08" PRIX32 " z_angle=%08" PRIX32 " params=[%g %g %g %08" PRIX32 " %08" PRIX32 " %08" PRIX32 "] unused=%08" PRIX32 "]",
return phosg::string_printf("[ObjectSetEntry type=%04hX \"%s\" set_flags=%04hX index=%04hX a2=%04hX entity_id=%04hX group=%04hX room=%04hX a3=%04hX x=%g y=%g z=%g x_angle=%08" PRIX32 " y_angle=%08" PRIX32 " z_angle=%08" PRIX32 " params=[%g %g %g %08" PRIX32 " %08" PRIX32 " %08" PRIX32 "] unused=%08" PRIX32 "]",
this->base_type.load(),
name_str.c_str(),
this->set_flags.load(),
@@ -1032,7 +1032,7 @@ uint64_t MapFile::ObjectSetEntry::semantic_hash(uint8_t floor) const {
}
string MapFile::EnemySetEntry::str() const {
return phosg::string_printf("[EnemyEntry type=%04hX \"%s\" set_flags=%04hX index=%04hX num_children=%04hX floor=%04hX entity_id=%04hX room=%04hX wave_number=%04hX wave_number2=%04hX a1=%04hX x=%g y=%g z=%g x_angle=%08" PRIX32 " y_angle=%08" PRIX32 " z_angle=%08" PRIX32 " params=[%g %g %g %g %g %04hX %04hX] unused=%08" PRIX32 "]",
return phosg::string_printf("[EnemySetEntry type=%04hX \"%s\" set_flags=%04hX index=%04hX num_children=%04hX floor=%04hX entity_id=%04hX room=%04hX wave_number=%04hX wave_number2=%04hX a1=%04hX x=%g y=%g z=%g x_angle=%08" PRIX32 " y_angle=%08" PRIX32 " z_angle=%08" PRIX32 " params=[%g %g %g %g %g %04hX %04hX] unused=%08" PRIX32 "]",
this->base_type.load(),
MapFile::name_for_enemy_type(this->base_type),
this->set_flags.load(),
+8 -4
View File
@@ -1913,10 +1913,14 @@ static const QuestScriptOpcodeDefinition opcode_defs[] = {
// Generates a random number by calling rand(). Note that the returned
// value is not uniform! The algorithm generates a uniform random number,
// scales it to the range [0, max], then clamps it to [min, max]. So, if
// the minimum value is not 0, the minimum value is more likely than all
// other possible results. To get an unbiased result with a minimum not
// equal to zero, use this with a minimum of zero, then use add or addi.
// scales it to the range 0 through (max-1) inclusive, then clamps it to
// the range min through (max-1). So, if the minimum value is not 0, the
// minimum value is more likely than all other possible results. To get
// an unbiased result with a minimum not equal to zero, use this with a
// minimum of zero, then use add or addi.
// Note also that this is implemented by calling rand(), which returns a
// 15-bit random integer. If your range of values is larger than 15 bits,
// call this multiple times and combine the results appropriately.
// regsA[0] = minimum value
// regsA[1] = maximum value
// regB = generated random value