1,535
edits
(Add GoodEngine Counter) Tag: Reverted |
m (Seil moved page Counter to EvilEngine/CNTR without leaving a redirect) |
||
(One intermediate revision by the same user not shown) | |||
Line 1:
<onlyinclude>
{{#vardefine:typeid|CNTR}}<nowiki/>
{{#vardefine:name|Counter}}<nowiki/>
Line 9 ⟶ 7:
{{#vardefine:sourcecode|[https://github.com/bfbbdecomp/bfbb/blob/master/src/Core/x/xCounter.h xCounter.h]}}<nowiki/>
{{#vardefine:image|}}<nowiki/>
</onlyinclude>
{{AutoAssetInfobox}}
Line 25 ⟶ 23:
Note that setting a counter's ''initial'' value to 0 does not make it expired. It only becomes expired when its ''new'' value after receiving [[#Increment|Increment]] or [[#Decrement|Decrement]] is 0 (i.e. incrementing a counter whose value is -1 or decrementing a counter whose value is 1).
Counters are [[Object Asset|object assets]], so they start with their 0x8 byte header, then are followed by:
Line 40 ⟶ 38:
|}
Sending this event to a counter resets its value back to its initial value. It also turns off its "expired" state (see [[#Expired|Expired]]), so that its value is able to be changed.
Sending this event to a counter adds 1 to its current value, unless the counter is expired (see [[#Expired|Expired]]).
If its new value is 0, it sends [[#Expired|Expired]] to itself. If its new value is between 1 and 20, it sends a matching [[#Count1 - Count20|Count1 - Count20]] event to itself.
Sending this event to a counter subtracts 1 from its current value, unless the counter is expired (see [[#Expired|Expired]]).
If its new value is 0, it sends [[#Expired|Expired]] to itself. If its new value is between 1 and 20, it sends a matching [[#Count1 - Count20|Count1 - Count20]] event to itself.
This event is sent from a counter to itself when [[#Increment|Increment]] or [[#Decrement|Decrement]] sets its value to 0.
Sending this event to a counter sets its value to 0. It also turns on its "expired" state, which prevents its value from being changed by the [[#Increment|Increment]], [[#Decrement|Decrement]], and [[#Count1 - Count20|Count1 - Count20]] events, until it is reset with the [[#Reset|Reset]] event.
There are 20 events named Count1, Count2, Count3, etc. all the way through Count20.
Line 68 ⟶ 66:
{{Assets}}
{{AutoGameNavs}}
[[Category:Asset]]
|