Cog Files


Cog Symbol Example


We`ll show the actual interconnections between all these files so far and the "Symbols" section of a cog . This might help if you have the complete files to look at.

For the cog example the file "09_pipedoor_a.cog" will be used.

Along with the matching jkl file "09_fuelstation.jkl"

First thing to find in the Jkl is the Section :Cogs then look for 09_pipedoor_a.cog. We have shown two more here.

13:	09_pipedoor_a.cog	9542 9536 3915 3412 33 14 15 368 12.000000 3.920000 
14:	09_pipedoor_b.cog	9548 9554 3937 3952 34 13 15 370 12.000000 3.920000 
15:	09_pipedoor_c.cog	9560 9566 4108 35 13 14 374 12.000000 3.920000 

Line 13: is the one to look at for now, the numbers that follow 09_pipedoor_a.cog are the "values or references" that will be passed to the symbols section in 09_pipedoor.cog.

If you notice the line above is marked in RED , the same is done in the symbols , so you can see what it recieving these values or references. The "Sections:" refered to below can all be found in the JKL file. Following this table , each symbol assignment will be explained in more deatil.

09_pipedoor_a.cog

symbols

message	startup
message	activate    ( Messages sent by the system )
message	arrived
message	timer
message	user0	    ( User defined messages )
message	user1					
message	user2

surface	socket0                 linkid=0 surface # 9542 from Section: GeoResources/World Surfaces list
surface	socket1                 linkid=1 surface # 9536
surface	socketind1              linkid=3 surface # 3915
surface	doorswitch              nolink surface # 3412
            
thing	door                    linkid=10 Thing #33 from World Things list

cog     pipedoorb                nolink cog # 14 from Section : Cogs
cog     pipedoorc                nolink cog # 15 from Section : Cogs

sound	klaxon=00alarmloop01.wav local

sector	doorsector               nolink sector # 368 from  SECTION: SECTORS

int     doorpos=0                local		
int     closed=1                 local		
int     i=-1                     local		
int     alarm=-1                 local		
int     alarming=0               local		

flex    movespeed=12 ( The value 12.000000 )
flex    animtime=3.92 ( The value 3.920000 )

end


SymbolUse

There is four symbol uses. And one used for descriptions.

Masks see Thing Masks


Symbols Explained

The following is a more detailed account of the symbol assignments.

Surfaces

In this assignment, the section :cog passed the reference # 9542 as the first parameter, In the code section when you see "socket0" or "linkid # 0" then this would be the actual surface ,that is being used. Because JediKnight is pure 3d in nature, a surface can be at almost any angle ,the closest thing you could call them would be ,floor,ceiling or wall.In JK they are simply called a surface.

surface	socket0                 linkid=0 surface # 9542 from Section: GeoResources/World Surfaces list

9542:	333	0x6		0x4		4	3	1	-1	0.50		4	8241,40	8242,37	8243,38	8244,23256	0.229572	0.405138	0.000000	0.012493	
(surface number 9542  in the JKl World Surfaces)


Thing

The thing symbol assignment is passed a reference number to a thing in the World things list. To get to the real bottom of what this Thing is we need to also retrive the "Template" sewerdoor.(first two lines in world thing list is name and template).

Now we can see this Thing is in fact a door 3do,but this is not the end of the trail. Sewerdoor is based on the template "_walkstruct", which is in turn based upon "_structure",which also has a base template "_decor" which finaly gets to the very start of it all and is based on the template "none".

None specifies the base template ,and every template after that may modify previously specified values,if a value is not modified it is passed on as it was. The one thing that must be watched for is flags, they do not get set to the new value ,but rather added to. In Jedi Knight doors and elevators are also 3do`s. The thing list basicly tells the engine where to move the 3do. The cog is probably just checking the position of the door before something else can happen.The template in this case sets up all the parameters that the thing will need.

As you can see this can get very messy in a big hurry. Care should be taken when modifying templates.

thing	door                    linkid=10 Thing #33 from World Things list

33: sewerdoor       sewerdoor      	15.217214	19.028973	-7.384992	0.000000	0.000000	0.000000	368	thingflags=0x400448 numframes=2 frame=(15.217213/19.028973/-7.384992:0.000000/0.000000/0.000000) frame=(15.212876/19.028971/-7.399019:0.000000/0.000000/-179.947662) 
(from World Thing list)

sewerdoor        _walkstruct      model3d=dr13half.3do size=1.471634 movesize=1.471634 soundclass=lg_door.snd 
(from World templates list)

_walkstruct      _structure       thingflags=0x400048 
(from World templates list)

_structure       _decor           collide=3 thingflags=0x8 
(from World templates list)

_decor           none             orient=(0.000000/0.000000/0.000000) type=cog collide=1 move=path 
(from World templates list)


COG

In this case the assignment was another cog file, the symbol use is nolink so the only reference in the code section you will see is pipedoorb.

cog     pipedoorb                nolink cog # 14 from Section : Cogs

14:	09_pipedoor_b.cog	9548 9554 3937 3952 34 13 15 370 12.000000 3.920000 
(from section : Cogs)


SECTOR

Here again there is nolink so the symbol will only be refered to as doorsector. The cog was passed the actual sector number, and the sector it`s self has a flag indicating it is linked to a cog.In the code when you see doorsector being used for something this is the sector being queried or affected.

sector	doorsector               nolink sector # 368 from  SECTION: SECTORS


SECTOR	368           (sector number)
FLAGS	0x1004        (this flag indicates the sector is linked to a cog)
AMBIENT LIGHT	0.21
EXTRA LIGHT	0.70
COLORMAP	0
TINT	0.00	0.00	0.00
BOUNDBOX	13.749980 18.925011 -8.850015 16.649992 19.133007 -5.950003
COLLIDEBOX	14.174679 18.955471 -8.425318 16.225285 19.102547 -6.374711
SOUND	00rumbleamb04.wav 0.400000
CENTER	15.199986 19.029009 -7.400009
RADIUS	2.053253
VERTICES	64
...........~
(from Section: Sectors)


Flex

In this example , the section :Cog passed the two values to movespeed and animtime, these happen to be the same as what is already specified in the cog , these could have been marked as local and left off the last two values in the section: cog line. In this case the Section: Cog would overide the cog file value.

flex    movespeed=12 ( The value 12.000000 )
flex    animtime=3.92 ( The value 3.920000 )

13:	09_pipedoor_a.cog	9542 9536 3915 3412 33 14 15 368 12.000000 3.920000