Beco: Difference between revisions

imported>Leoetlino
(→‎Operations: collapse original code by default)
imported>Leoetlino
Line 45: Line 45:
The algorithm that returns the custom data that is associated with a coordinate is very simple. It consists of determining the correct row index in the table, then iterating over segments in that row and returning the segment data when the X coordinate is within its bounds.
The algorithm that returns the custom data that is associated with a coordinate is very simple. It consists of determining the correct row index in the table, then iterating over segments in that row and returning the segment data when the X coordinate is within its bounds.


<div class="mw-collapsible mw-collapsed">
For the reference, here is the official, mostly unreversed function<ref>0x7100E41C40 in Switch 1.5.0</ref> that implements the aforementioned algorithm:
For the reference, here is the official, mostly unreversed function<ref>0x7100E41C40 in Switch 1.5.0</ref> that implements the aforementioned algorithm:
 
<div class="mw-collapsible-content">
<div class="mw-collapsible mw-collapsed">
<syntaxhighlight lang="c++">
<syntaxhighlight lang="c++">
unsigned int __fastcall eco::getCurrentAreaNum(float posX, float posZ, Ecosystem *ecosystem, EcoMapInfo *info)
unsigned int __fastcall eco::getCurrentAreaNum(float posX, float posZ, Ecosystem *ecosystem, EcoMapInfo *info)
Line 130: Line 130:
}
}
</syntaxhighlight>
</syntaxhighlight>
</div>
</div>
</div>


Anonymous user