EvilEngine/CNTR: Difference between revisions

Content added Content deleted
(Add GoodEngine Counter)
Tag: Reverted
m (Reverted edits by Seil (talk) to last revision by EnergyDrink)
Tag: Rollback
Line 1: Line 1:
<onlyinclude>
==EvilEngine==

<section begin="EvilEngineAsset" />
{{#vardefine:typeid|CNTR}}<nowiki/>
{{#vardefine:typeid|CNTR}}<nowiki/>
{{#vardefine:name|Counter}}<nowiki/>
{{#vardefine:name|Counter}}<nowiki/>
Line 9: Line 7:
{{#vardefine:sourcecode|[https://github.com/bfbbdecomp/bfbb/blob/master/src/Core/x/xCounter.h xCounter.h]}}<nowiki/>
{{#vardefine:sourcecode|[https://github.com/bfbbdecomp/bfbb/blob/master/src/Core/x/xCounter.h xCounter.h]}}<nowiki/>
{{#vardefine:image|}}<nowiki/>
{{#vardefine:image|}}<nowiki/>
</onlyinclude>
<section end="EvilEngineAsset" />
{{AutoAssetInfobox}}
{{AutoAssetInfobox}}


Line 25: Line 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).
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===
==Format==
Counters are [[Object Asset|object assets]], so they start with their 0x8 byte header, then are followed by:
Counters are [[Object Asset|object assets]], so they start with their 0x8 byte header, then are followed by:


Line 40: Line 38:
|}
|}


===Events===
==Events==
====Reset====
===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.
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====
===Increment===
Sending this event to a counter adds 1 to its current value, unless the counter is expired (see [[#Expired|Expired]]).
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.
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====
===Decrement===
Sending this event to a counter subtracts 1 from its current value, unless the counter is expired (see [[#Expired|Expired]]).
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.
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====
===Expired===
This event is sent from a counter to itself when [[#Increment|Increment]] or [[#Decrement|Decrement]] sets its value to 0.
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.
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====
===Count1 - Count20===
There are 20 events named Count1, Count2, Count3, etc. all the way through Count20.
There are 20 events named Count1, Count2, Count3, etc. all the way through Count20.


Line 68: Line 66:
{{Assets}}
{{Assets}}
{{AutoGameNavs}}
{{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]]
[[Category:Asset]]