The m4nfo User manual and Technical Report

Technical Report

Object properties, functions and callbacks


Content

Object property functions

m4nfo object properties are based on plain nfo's action0 properties. Most of them are mapped in a straightforward way, but some of m4nfo's object property functions are based on custom calculations, or based on using more than one nfo property.

m4nfo function nfo property custom
anim_info0x11 
anim_speed0x12
anim_triggers0x13
buildingheight0x16
callbacks0x15yes
classlabel0x08 
classname0x09
climate0x0B
flags0x10
numviews0x17
objectname0x0A
price0x0D
removalcost0x14
size0x0C
timeframe0x0E + 0x0Fyes

Flag label Bit Value
INEDITOR00x01
NOTREMOVABLE10x02
REMOVABLE20x04
BUILDONWATER30x08
REMOVALINCOME40x10
NOFOUNDATION50x20
HASANIMATION60x40
INGAME70x80
TWOCC80x100
NOBUILDONLAND90x200
DRAWWATER100x400
ALLOWBRIDGE110x800
RANDOMBITS120x1000

callbacks(<List::Callbacks>)

Enabling callbacks in plain nfo means to set bits in property (0x15). Unfortunately, these bits have no numerical relation to the corresponding callback values returned by nfo's variable (0x0C). In m4nfo, both property function callbacks() and performance function callback() are using the same callback labels.

timeframe(<Date>)

This function links the two nfo properties for 'introduction date' (0x0E) and 'end of life' (0x0F), both in days since the year 0, into one function. The time frame is given either in 'day.month.year', or 'month.year', or 'year', e.g.: timeframe(1.1.1930 .. 1.1.2050).

Object performance functions

m4nfo object performance functions are based on plain nfo's Variational Action2 variables. Again, most of them are mapped in a straightforward way, but some of m4nfo's object performance functions are based on custom calculations, or based on use of more than one nfo variable.

Please note that functions return either Byte, Word or Dword values, depending on the context they're used in.

m4nfo function nfo var Byte Word/Dword
anim_frame0x43/0x6381 (43 | (63 $1)) 00 FF 
callback0x0C81 0C 00 FF85 0C 00 FF FF
colour0x4781 47 00 FF 
constructiondate0x42 89 42 00 FF FF FF FF
constructionyear(custom)
elsen/a  
getviews0x4881 48 00 FF
objinfo_e2distance0x4681 46 $1 00 FF FF
objinfo_founder0x4481 44 00 FF
objinfo_height0x6281 62 $1 10 FF
objinfo_lclass81 62 $1 18 0F
objinfo_mdistance0x4581 45 $1 00 FF FF
objinfo_randombits0x10/0x6181 (10 | (61 $1)) 00 FF
objinfo_slope0x41/0x6281 41 08 0F
objinfo_terrain0x4181 41 00 07
objinfo_townzone0x4581 45 $1 10 FF
objinfo_type0x6081 60 $1 00 FF85 60 $1 00 FF FF
objinfo_type40x60(custom) 
objinfo_typeview0x60 89 60 $1 00 FF 00 03 00
objinfo_view0x60 85 60 $1 10 0F 00
objinfo_water0x6281 62 $1 09 01 
objinfo_waterclass81 62 $1 0D 03
position0x4081 40 10 FF
testposition0x1881 18 00 FF
testslope0x1081 10 00 0F
yearbuilt0x42(custom)

yearbuilt(<block>)

Object callbacks

m4nfo object callbacks are based on plain nfo's callbacks. They're all mapped in a straightforward way. Callbacks from the first section of the table below have to be enabled by property function callbacks(), but those from the second section do not need to be: they're always active and will be used automatically if needed.

m4nfo callback nfo callback
CB_AFRAME0x158
CB_ASPEED0x15A
CB_AUTOSLOPE0x15D
CB_COLOUR0x15B
CB_SLOPE0x157
CB_TEXT0x15C
CB_ACONTROL0x159

Callback helper functions

Callback helper functions are based on m4nfo's function cbr() which returns a parameter as a callback return value.

m4nfo function definition
grftextcbr($1)
reftxtcb(custom)

Random functions

In nfo, randomized Action2s are used to randomize the object (0x80).

m4nfo function nfo random Action2 type
randomrel0x80