EvilEngine/CNTR: Difference between revisions

m
Seil moved page Counter to EvilEngine/CNTR without leaving a redirect
(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>
==EvilEngine==
 
<section begin="EvilEngineAsset" />
{{#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>
<section end="EvilEngineAsset" />
{{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).
 
===Format===
Counters are [[Object Asset|object assets]], so they start with their 0x8 byte header, then are followed by:
 
Line 40 ⟶ 38:
|}
 
===Events===
====Reset====
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.
 
====Increment====
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.
 
====Decrement====
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.
 
====Expired====
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.
 
====Count1 - Count20====
There are 20 events named Count1, Count2, Count3, etc. all the way through Count20.
 
Line 68 ⟶ 66:
{{Assets}}
{{AutoGameNavs}}
 
==GoodEngine==
 
<section begin="GoodEngineAsset" />
{{#vardefine:name|Counter}}<nowiki/>
{{#vardefine:type|[[Asset (GoodEngine)#Base_Assets|Base]]}}<nowiki/>
{{#vardefine:typeid|0xC72962FC}}<nowiki/>
{{#vardefine:games|RATS WALLE UP TOS UFC FGUY HOLLYWOOD}}<nowiki/>
{{#vardefine:sourcecode|}}<nowiki/>
{{#vardefine:image|}}<nowiki/>
<section end="GoodEngineAsset" />
{{AutoAssetInfoboxGE}}
 
===Format===
Counters are base assets, so they start with their 0x10 byte header, then are followed by:
 
[[Category:Asset]]