Turok
 
Loading...
Searching...
No Matches
t1_scriptAPI.cpp
Go to the documentation of this file.
8enum kexLocPlatform_e ///< Not used (garbage included automatically from kexengine)
9{
22};
23
25{
26 ANF_BLEND = 1 << 0,
27 ANF_LOOP = 1 << 1,
28 ANF_STOPPED = 1 << 2,
31 ANF_PAUSED = 1 << 5,
34};
35
37{
38 AF_SOLID = 1 << 0, ///< Can be collided
39 AF_DORMANT = 1 << 1, ///< if on then is asleep (won't be updated onTick) else is awake
40 AF_SNAPTOFLOOR = 1 << 2, ///< adjust z-axis to floor on spawn
41 AF_CLIMBWALLS = 1 << 3, ///< allows entering of wall sectors
42 AF_WOUNDEDMORTALLY = 1 << 4, ///< if on this actor will drop a mortal wound because it was hit by a super arrow shot
43 AF_CASTSHADOW = 1 << 5, ///< can cast a simple shadow
44 AF_TRIGGERSTUFF = 1 << 6, ///< NOT USED
45 AF_HIDDEN = 1 << 7, ///< don't draw but continue updating. can't be collided
46 AF_ACTIVATED = 1 << 8, ///< was triggered
47 AF_DISABLED = 1 << 9, ///< don't update animations
48 AF_ENTEREDAREAEVENT = 1 << 10, ///< just entered a trigger sector
49 AF_REMOVEONCOMPLETION = 1 << 11, ///< remove after finishing a special animation
50 AF_NOBLOOD = 1 << 12, ///< don't spawn particles flagged as blood
51 AF_AVOIDWATER = 1 << 13, ///< clip against edges linking to water sectors
52 AF_FLOATINWATERONDEATH = 1 << 14, ///< rise to the surface while dead
53 AF_DEAD = 1 << 15, ///< actor is dead. handle special cases for collision
54 AF_STATIONARY = 1 << 16, ///< Sniper. don't update the animation's root motion
55 AF_ALIGNTOFLOOR = 1 << 17, ///< rotate along slopes
56 AF_NODRAW = 1 << 18, ///< don't render
57 AF_NONSHOOTABLE = 1 << 19, ///< Fx won't hit actors if this flag is set.
58 AF_FULLVOLUME = 1 << 20, ///< all sounds coming from this actor will be heard at full volume
59 AF_CANBETOUCHED = 1 << 21, ///< allow invoking the OnTouch callback
60 AF_IGNORESOUNDEVENTS = 1 << 22, ///< don't call kexAnimState::Action_PlaySound
61 AF_TRIGGERANIMATION = 1 << 23, ///< play special animation on trigger/spawn
62 AF_HOLDTRIGGERANIM = 1 << 24, ///< pause special animation until triggered (is also invincible)
63 AF_TRIGGERNAIMDELAY = 1 << 25, ///< delay a bit before starting special animation
64 AF_STAYINWATER = 1 << 26, ///< can't exit water sectors
65 AF_ALWAYSACTIVE = 1 << 27, ///< never sleep or go dormant
66 AF_COLLIDEDWITHWALL = 1 << 28, ///< collided with an edge. cleared at every OnTick call
67 AF_INVINCIBLE = 1 << 29, ///< will not receive damage. OnDamage and OnDeath are never called
68 AF_ALLOWTINYENEMYCHEAT = 1 << 30, ///< affected by tiny enemy game cheat
69 AF_NOMOVEMENT = 1 << 31 ///< will not do collision movement
70};
71
73{
74 ASF1_SOLID = 1 << 0,
75 ASF1_PROJECTILEATTACK1 = 1 << 1, ///< High Priest Flame Attack (anim_aiRangeAttack1)
76 ASF1_LEADER = 1 << 2, ///< Flocker ai run toward Leaders to get attention.
78 ASF1_EXPLOSIONDEATH = 1 << 4, ///< NOT USED
80 ASF1_PROJECTILEATTACK2 = 1 << 6, ///< Pistol Fire (anim_aiRangeAttack2)
81 ASF1_NOREPEATEXPLOSION = 1 << 7, ///< NOT USED
82 ASF1_DIEONEXPLOSION = 1 << 8, ///< NOT USED
83 ASF1_FLOCKER = 1 << 9, ///< flocks to a leader kAI
84 ASF1_SLOW = 1 << 10, ///< NOT USED
85 ASF1_RANDOMRESURRECTION = 1 << 11, ///< NOT USED
86 ASF1_RANDOMFEIGNDEATH = 1 << 12, ///< NOT USED
87 ASF1_KAMIKAZE = 1 << 13, ///< if has no target then targets player and sets agitation to 300
88 ASF1_AVOIDPLAYERS = 1 << 14, ///< NOT USED
89 ASF1_FLOATINWATERONDEATH = 1 << 15, ///< kAI will float up to the top of the water when they are dead
90 ASF1_TELEPORT = 1 << 16, ///< allows kAI to teleport on SetupAISpawnFlags
91 ASF1_CASTSHADOW = 1 << 17, ///< sets AF_CASTSHADOW on SetSpawnParams
92 ASF1_TELEPORTWAIT = 1 << 18, ///< allows enemy to move around for 1.5 - 4.5 seconds before teleporting back in.
93 ASF1_USESTRONGATTACKS = 1 << 19, ///< anim_aiMelee1
94 ASF1_USEWEAKATTACKS = 1 << 20, ///< anim_aiAltMelee1
95 ASF1_SNIPER = 1 << 21,
96 ASF1_MELTONDEATH = 1 << 22, ///< allows melt effect and regeneration
97 ASF1_AVOIDWATER = 1 << 23, ///< sets AF_AVOIDWATER on SetSpawnParams
98 ASF1_FLYING = 1 << 24, ///< NOT USED
101 ASF1_TRIGGERSTUFF = 1 << 27, ///< Sets AF_TRIGGERSTUFF on SetupSpawnParams
102 ASF1_CANNOTCAUSEAFIGHT = 1 << 28, ///< if another actor was damaged by this actor with this flag set then other actor will not target this actor.
103 ASF1_NOWALLCOLLISION = 1 << 29, ///< NOT USED
104 ASF1_SCREENSHAKE = 1 << 30, ///< Used in floor mover scripts to shake screen.
105 ASF1_RESPAWNANIMATION = 1 << 31 ///< Enables respawning animation effect
106};
107
109{
110 ASF2_DROPITEM_MASK1 = 1 << 0, ///< Explosive shells
111 ASF2_DROPITEM_MASK2 = 1 << 1, ///< Grenade
112 ASF2_DROPITEM_MASK3 = 1 << 2, ///< Medium Health
113 ASF2_DROPITEM_MASK4 = 1 << 3, ///< Full Health
114 ASF2_DROPITEM_MASK5 = 1 << 4, ///< Ultra Health
115 ASF2_DROPITEM_MASK6 = 1 << 5, ///< Small Health
116 ASF2_DROPITEM_MASK7 = 1 << 6, ///< Large Health
117 ASF2_DROPITEM_MASK8 = 1 << 7, ///< Minigun ammo
118 ASF2_DROPITEM_MASK9 = 1 << 8, ///< Mortal Wound
119 ASF2_DROPITEM_MASK10 = 1 << 9, ///< 4 Rockets
120 ASF2_DROPITEM_MASK11 = 1 << 10, ///< Shotgun Shells
121 ASF2_DROPITEM_MASK12 = 1 << 11, ///< Energy Cell
122 ASF2_DROPITEM_MASK13 = 1 << 12, ///< Large Energy Cell
123 ASF2_DROPITEM_MASK14 = 1 << 13, ///< Clip
124 ASF2_REMOVEONCOMPLETION = 1 << 14, ///< Sets AF_REMOVEONCOMPLETION
125 ASF2_NOBLOOD = 1 << 15,
127 ASF2_PROJECTILEATTACK3 = 1 << 17, ///< crouch rifle Fire (anim_aiRangeAttack7)
128 ASF2_PROJECTILEATTACK4 = 1 << 18, ///< (anim_aiRangeAttack8)
129 ASF2_DROPITEMONDAMAGE = 1 << 19, ///< NOT USED
130 ASF2_NOAUTOMAPDRAW = 1 << 20, ///< if map all or show enemies cheats are on then will not draw this actor on the automap.
131 ASF2_ALTERNATEMOVES = 1 << 21, ///< is for holding two handed weapons
132 ASF2_UNUSED1 = 1 << 22, ///< NOT USED
133 ASF2_UNUSED2 = 1 << 23, ///< NOT USED
134 ASF2_PROJECTILEATTACK5 = 1 << 24, ///< Stand Rifle Fire (anim_aiRangeAttack5)
135 ASF2_PROJECTILEATTACK6 = 1 << 25, ///< Pipe Blow (anim_aiRangeAttack6)
136 ASF2_MORTALWOUNDIMPACT = 1 << 26, ///< Can be hit by a super arrow shot and if ASF2_DROPITEM_MASK9 is on has a chance to drop a mortal wound
137 ASF2_STAYINWATER = 1 << 27, ///< sets AF_STAYINWATER on SetSpawnParams
138 ASF2_WARPDEATH = 1 << 28, ///< NOT USED
139 ASF2_STOREWARPRETURN = 1 << 29, ///< Used in portal scripts
140 ASF2_PROJECTILEATTACK7 = 1 << 30, ///< Grenade Throw (anim_aiRangeAttack3)
141 ASF2_PROJECTILEATTACK8 = 1 << 31 ///< High Priest Homing Blue Flame (anim_aiRangeAttack4)
142};
143
145{
146 ASF3_RETURNWARP = 1 << 0, ///< Used in portal scripts
147 ASF3_PLAYTRIGGERANIMONCE = 1 << 1, ///< MarkPersistentBit(false) when activated
148 ASF3_REGENERATEFROMSTART = 1 << 2, ///< Regen from starting position
149 ASF3_WALKINSTRAIGHTLINE = 1 << 3, ///< Set animation to Blend(ANIM_WALKING, (m_animSpeed * m_animScalar), 10, ANF_LOOP|ANF_ROOTMOTION); and do nothing else.
150 ASF3_KILLOUTSIDEOFVIEW = 1 << 4, ///< NOT USED
151 ASF3_NOTHINKER = 1 << 5, ///< AI will not function. Actors will not update movement. Actors OnBeginLevel will set their animation to ANIM_SPECIAL_EVENT.
152 ASF3_AVOIDPLAYERS2 = 1 << 6, ///< NOT USED
153 ASF3_NOVIOLENTDEATH = 1 << 7, ///< ANIM_AIDEATHSTAND and ANIM_DEATHSTANDALT will not play when kAI is killed.
154 ASF3_PROJECTILEATTACK9 = 1 << 8, ///< Demon chest Hadoken (anim_aiRangeAttack9)
155 ASF3_PROJECTILEATTACK10 = 1 << 9, ///< High Priest Lightning Red Flames (anim_aiRangeAttack10)
156 ASF3_MAKESPAWNANIMVISIBLE = 1 << 10, ///< clears actor flags: ~(AF_HIDDEN|AF_DISABLED)
157 ASF3_NODRAWONCAMERA = 1 << 11 ///< Will not draw this actor when viewing from camera unless camera flags has CMF_SHOW_HIDDEN_OBJECTS.
158};
159
161{
162 PF_NOCLIP = 1 << 0,
163 PF_FLY = 1 << 1,
164 PF_DEAD = 1 << 2,
165 PF_GOD = 1 << 3, ///< Is reset when level beings
166 PF_JUMPING = 1 << 4, ///< is jumping (moving up). flag is off when reached max jump height or let go of jump button.
167 PF_HASJUMPED = 1 << 5,
168 PF_INWARPAREA = 1 << 6, ///< in sector area with AAF_TELEPORT flag.
171 PF_CRAWLING = 1 << 9,
172 PF_PREVENTDEATHCAM = 1 << 10, ///< will stop the death cinematic or the deadAnimView from triggering when the player dies.
173 PF_FIREDPROJECTILE = 1 << 11, ///< set when FireProjectile is called. Cleared OnTick if weapon is not in WS_FIRE state and player is not locked.
174 PF_FALLINGDEATHPIT = 1 << 12, ///< currently falling in a death pit. Cleared after level begins.
175 PF_WEAPONSTEAL = 1 << 13, ///< on when campaigner steals weapon
176 PF_NOSECTORMUSIC = 1 << 14, ///< disables music changes when changing sectors
177 PF_NOTOUCH = 1 << 15, ///< disables invoking onTouch callbacks
178 PF_NOCEILINGGLIDE = 1 << 16 ///< disables the ceiling glide glitch
179};
180
191
193{
194 GC_BIG_HEADS = 1 << 0,
200 GC_FLIGHT = 1 << 6,
201 GC_DISCO = 1 << 7,
203 GC_ALL_MAP = 1 << 9,
205 GC_NOCLIP = 1 << 11,
206};
207
209{
210 AIF_ATTACKING = 1 << 0, ///< playing an attacking animation
211 AIF_WASSOLID = 1 << 1,
214 AIF_BLOWNAWAY = 1 << 4, ///< being blown away by explosion
220 AIF_NOCHASE = 1 << 10, ///< disable chase logic
222 AIF_NOTHINK = 1 << 12, ///< don't run ai logic
223 AIF_RUNNING = 1 << 13, ///< Is playing running animation
228 AIF_TELEPORTAWAY = 1 << 18, ///< playing teleport out animation
229 AIF_TELEPORTMOVESLOW = 1 << 19, ///< chasing while underground
230 AIF_TELEPORTING = 1 << 20, ///< in teleport state. ignore all chase logic
231 AIF_TELEPORTIN = 1 << 21, ///< playing teleport in animation
232 AIF_WAITFORCYCLE = 1 << 22, ///< prevent other animations from interrupting until the current one finishes
233 AIF_DAMAGEPANIC = 1 << 23 ///< become aggressive when target is outside its active threshold (good for forcing AI to attack their target)
234};
235
237{
244 IT_FLESH_UNDEAD = 6, ///< AKA IT_FLESH_WATER. Not used in the remaster for anything by default. In the original game if an Fx was underwater and hit an actor that had an impact type of IT_FLESH_HUMAN or IT_FLESH_CREATURE it would do a IT_FLESH_UNDEAD impact instead.
248};
249
257
259{
261 CRF_FLOOR = 1 << 0, ///< made contact with a floor
262 CRF_CEILING = 1 << 1, ///< made contact with a ceiling
263 CRF_WALL = 1 << 2, ///< made contact with an edge (sector edge that isn't linked to another sector)
264 CRF_OBJECT = 1 << 3, ///< made contact with an actor
265 CRF_MESH = 1 << 4, ///< made contact with a static object
266 CRF_ADJUST = 1 << 5, ///< z-axis was adjusted (ceiling or floor)
267 CRF_WALLRADIUS = 1 << 6 ///< made contact with an edge during the wall radius collision test
268};
269
271{
275 WS_FIRE = 3, ///< Is currently firing
276 WS_HOLDSTER = 4, ///< Set when dead (with no death cinematic) or when climbing. Should set weapon anim to ANIM_WEAPONSWAPOUT if you set this state manually.
277 WS_WALK = 5, ///< NOT USED
278 WS_RUN = 6, ///< NOT USED
279 WS_DISCHARGE = 7, ///< set after OnEndFire is called. If was in WS_FIRE state and not pressing the Attack button.
280 WS_FIREUNDERWATER = 8 ///< NOT USED
281};
282
298
300{
301 BC_ATTACK = 1 << 0,
302 BC_JUMP = 1 << 1,
303 BC_FORWARD = 1 << 2,
304 BC_BACKWARD = 1 << 3,
309 BC_MAPZOOMIN = 1 << 8,
311 BC_CUSTOM1 = 1 << 10,
312 BC_CUSTOM2 = 1 << 11
313};
314
316{
317 CBC_WEAPON1 = 1 << 0,
318 CBC_WEAPON2 = 1 << 1,
319 CBC_WEAPON3 = 1 << 2,
320 CBC_WEAPON4 = 1 << 3,
321 CBC_WEAPON5 = 1 << 4,
322 CBC_WEAPON6 = 1 << 5,
323 CBC_WEAPON7 = 1 << 6,
324 CBC_WEAPON8 = 1 << 7,
325 CBC_WEAPON9 = 1 << 8,
326 CBC_WEAPON10 = 1 << 9,
327 CBC_WEAPON11 = 1 << 10,
328 CBC_WEAPON12 = 1 << 11,
329 CBC_WEAPON13 = 1 << 12,
330 CBC_WEAPON14 = 1 << 13,
331 CBC_AUTOMAP = 1 << 14,
332 CBC_CHANGEAMMO = 1 << 15,
333 CBC_RUNWALK = 1 << 16,
334 CBC_MENUUP = 1 << 17,
335 CBC_MENUDOWN = 1 << 18,
336 CBC_MENULEFT = 1 << 19,
337 CBC_MENURIGHT = 1 << 20,
338 CBC_MENUSELECT = 1 << 21,
340 CBC_MENUBACK = 1 << 23,
341 CBC_MENUCANCEL = 1 << 24,
343};
344
358
366
368{
369 CF_CLIPEDGES = 1 << 0, ///< clip movement against edges that don't link to sectors
370 CF_IGNOREBLOCKERS = 1 << 1, ///< don't clip edges belonging to blocking sectors
371 CF_DROPOFF = 1 << 2, ///< allows passing through platforms or ledges
372 CF_NOENTERWATER = 1 << 3, ///< block all edges that links to a water sector
373 CF_NOEXITWATER = 1 << 4, ///< block all edges that links to a non-water sector
374 CF_NOCLIPSTATICS = 1 << 5, ///< don't collide with static models
375 CF_NOCLIPACTORS = 1 << 6, ///< don't collide with dynamic objects/actors
376 CF_WALKWALLS = 1 << 7, ///< don't restrict movement to steep slopes
377 CF_COLLIDEFLOORS = 1 << 8, ///< project and clip movement against non-flat floors
378 CF_HITSCAN = 1 << 9, ///< performs a single-pass trace. useful for hitscans
379 CF_ALLOWCLIMB = 1 << 10, ///< collide with sectors flagged as climbable
380 CF_ALLOWCRAWL = 1 << 11, ///< collide with sectors flagged as crawlable
381 CF_NOSTEPDOWN = 1 << 12, ///< don't clamp z-axis when walking down slopes
382 CF_NOSLOPESTEP = 1 << 13, ///< don't project z-axis movement along slopes
383 CF_COLLIDEHEIGHT = 1 << 14, ///< clip against ceilings
384 CF_COLLIDECORPSES = 1 << 15, ///< clip against actors flagged as dead
385 CF_NOEXITWALLS = 1 << 16, ///< clip all edges, regardless if they link to another sector or not
386 CF_NOCOLLIDEFUNC = 1 << 17, ///< don't invoke the OnCollide callback on the moving object
387 CF_NOFLOORADJUST = 1 << 18, ///< don't keep z-axis above floor plane
388 CF_NOCEILINGADJUST = 1 << 19, ///< don't keep z-axis below ceiling plane
389 CF_COLLIDEWATER = 1 << 20, ///< clip movement against the water surface
390 CF_USEWALLRADIUS = 1 << 21, ///< clip and project movement away from walls based on wall radius
391 CF_NOCLIPTARGETACTORS = 1 << 22, ///< don't clip actors that are targeted by moving object
392 CF_COLLIDETRIGGERS = 1 << 23, ///< block edges belonging to a trigger. Can't cross into sectors if sector has AAF_EVENT.
393 CF_STANDONOBJECTS = 1 << 24, ///< allow vertical clipping of objects
394 CF_GREASESLIDEOBJECTS = 1 << 25, ///< always keep movement projected away from collided objects
395 CF_ALLOWRESTRICTEDAREAS = 1 << 26, ///< don't collide with edges belonging to a restricted sector
396 CF_COLLIDECLIFFS = 1 << 27, ///< collide with non-walkable floors
397 CF_CHECKLINKEDBRIDGES = 1 << 28, ///< do extensive checks against overlapping bridge sectors
398 CF_POLYCOLLISION = 1 << 29, ///< clip movement against all model polygons of an object
399 CF_COLLIDEPLAYERBLOCKER = 1 << 30 ///< collide with edges linked to player blocking regions (AAF_WARPRETURN)
400};
401
403{
404 WLT_INVALID = 0, ///< Not in water sectors
405 WLT_OVER = 1, ///< In water sector but over the water height
406 WLT_BETWEEN = 2, ///< In water sector and floating above the water
407 WLT_UNDER = 3 ///< In water sector and under the water height
408};
409
410/**
411 * @brief Lerp type when doing AutoPlayPositionTrack, AutoPlayRotationTrack, or AutoPlayBlendTrack.
412 * When a view has one of those active the view's time variable is then increased by GAME_DELTA_TIME.
413 */
415{
416 CMLT_NONE = 0, ///< time is set to time / speed.
417 CMLT_LINEAR = 1, ///< time is set to time / speed.
418 CMLT_LINEARLOOP = 2, ///< time is set to time / speed. If time is > 1.0 then time -= 1.0
419 CMLT_COSINE = 3, ///< time will never be higher than speed. time = CosTween(time * (1.0f / speed));
420 CMLT_COSINE_POW = 4 ///< time will never be higher than speed. time = CosTween(Pow(time * (1.0f / speed), 3));
421};
422
424{
434 CMF_NO_SUNLENSFLARE = 1 << 9 ///< Doesn't force the sun lens flare always on. Sun lens flare will work normally, using the "Always Show Lens Flares" option and checking if the sun is being blocked.
435};
436
447
449{
450 AAF_WATER = 1 << 0,
451 AAF_BLOCK = 1 << 1,
452 AAF_TOGGLE = 1 << 2, ///< if on and AAF_BLOCK is on then sectors won't be marked on automap until it's unblocked. Used for door areas.
453 AAF_CLIFF = 1 << 3, ///< is a wall
454 AAF_CLIMB = 1 << 4, ///< climb up sectors faster than AAF_LADDER
455 AAF_ONESIDED = 1 << 5, ///< Bridge
456 AAF_CEILING = 1 << 6,
457 AAF_CRAWL = 1 << 7,
458 AAF_ENTERCRAWL = 1 << 8, ///< Exactly the same as AAF_CRAWL except actors won't collide with this sector when CF_ALLOWCRAWL is not set.
459 AAF_HIDDEN = 1 << 9,
460 AAF_ENTERED = 1 << 10, ///< Not shown in Editor. Used in kex editor only for fill sector commands. When map is saved in kex editor all sectors will have this flag off.
461 AAF_SECRET = 1 << 11,
462 AAF_RESTRICTED = 1 << 12, ///< kAI can't enter the area
463 AAF_SLOPETEST = 1 << 13, ///< overrides AAF_CLIFF flag. If the sectors floor plane up direction is <= 0.5 then is a wall (a wall is the same as the AAF_CLIFF flag).
464 AAF_DEATHPIT = 1 << 14,
465 AAF_MAPPED = 1 << 15,
466 AAF_EVENT = 1 << 16,
467 AAF_REPEATABLE = 1 << 17, ///< Unused. In the original game this is used in combination with AAF_EVENT and will only trigger the event if the actor has also collided with a wall.
468 AAF_TELEPORT = 1 << 18,
469 AAF_DAMAGE = 1 << 19,
470 AAF_DRAWSKY = 1 << 20,
472 AAF_LAVA = 1 << 22,
473 AAF_EVENTSOUND = 1 << 23,
475 AAF_LADDER = 1 << 25, ///< climb up sectors slower than AAF_CLIMB
476 AAF_CHECKPOINT = 1 << 26,
477 AAF_SAVEGAME = 1 << 27,
478 AAF_WARPRETURN = 1 << 28, ///< In Remaster it's used as a PlayerBlocking sector. used with clipflag CF_COLLIDEPLAYERBLOCKER.
480 AAF_DRAWSUN = 1 << 30,
481 AAF_STOREWARPRETURN = 1 << 31 ///< Unused
482};
483
485{
486 SPF_FLOORVERTS = 1 << 0, ///< Changes sectors verts origin
487 SPF_CEILINGVERTS = 1 << 1, ///< Changes sectors verts heights
488 SPF_SAMEAREA = 1 << 2, ///< Effects sectors only with the same area as the starting sector
489 SPF_MOVEPLAYERINAIR = 1 << 3, ///< Player moves with the sectors even in the air
490 SPF_USEMOVETOFORPLAYER = 1 << 4, ///< Uses the MoveToPosition function to set the Players origin. else sets origin.
491 SPF_USEMOVETOFORAI = 1 << 5, ///< Uses the MoveToPosition function to set the AI origin. else sets origin.
492 SPF_USEMOVETOFOROTHER = 1 << 6, ///< Uses the MoveToPosition function to set other actors origin. else sets origin.
493 SPF_MOVEPLAYER = 1 << 7, ///< Moves player
494 SPF_MOVEAI = 1 << 8, ///< Moves AI
495 SPF_MOVEOTHERACTORS = 1 << 9, ///< Moves other actors on the sectors that are not the player or AI.
496
498};
499
501{
502 CHF_HIDECINEMA = 1 << 0, ///< Hide when cinema is active
503 CHF_HIDEMENU = 1 << 1, ///< Hide when menu is active
504 CHF_HIDEDUMMYMENU = 1 << 2, ///< Hide when dummy menu is active
505 CHF_HIDENOHUD = 1 << 3, ///< Hide when Show HUD menu option is off
506 CHF_ALPHASCALE = 1 << 4 ///< Scales color alpha values by the HUD opacity menu option
507};
508
526
527/**
528 * @class array<T>
529It is possible to declare array variables with the array identifier followed by the type of the elements within angle brackets.
530
531Example:
532
533@code{.cpp}
534 array<int> a, b, c;
535 array<Foo@> d;
536@endcode
537
538a, b, and c are now arrays of integers, and d is an array of handles to objects of the Foo type.
539
540When declaring arrays it is possible to define the initial size of the array by passing the length as a parameter to the constructor. The elements can also be individually initialized by specifying an initialization list. Example:
541
542@code{.cpp}
543 array<int> a; // A zero-length array of integers
544 array<int> b(3); // An array of integers with 3 elements
545 array<int> c(3, 1); // An array of integers with 3 elements, all set to 1 by default
546 array<int> d = {5,6,7}; // An array of integers with 3 elements with specific values
547@endcode
548
549Multidimensional arrays are supported as arrays of arrays, for example:
550
551@code{.cpp}
552 array<array<int>> a; // An empty array of arrays of integers
553 array<array<int>> b = {{1,2},{3,4}} // A 2 by 2 array with initialized values
554 array<array<int>> c(10, array<int>(10)); // A 10 by 10 array of integers with uninitialized values
555@endcode
556
557Each element in the array is accessed with the indexing operator. The indices are zero based, i.e. the range of valid indices are from 0 to length - 1.
558
559@code{.cpp}
560 a[0] = some_value;
561@endcode
562
563When the array stores handles the elements are assigned using the handle assignment.
564
565@code{.cpp}
566 // Declare an array with initial length 1
567 array<Foo@> arr(1);
568@endcode
569
570@code{.cpp}
571 // Set the first element to point to a new instance of Foo
572 @arr[0] = Foo();
573@endcode
574
575Arrays can also be created and initialized within expressions as anonymous objects.
576
577@code{.cpp}
578 // Call a function that expects an array of integers as input
579 foo(array<int> = {1,2,3,4});
580@endcode
581
582 */
583template <class T>
584class array // class array<T>
585{
586public:
587 void insertAt(uint index, const T&in value); ///< Inserts a new element into the array at the specified index.
588 void insertAt(uint index, const T[]&inout arr); ///< Inserts another array of elements into the array at the specified index.
589 void insertLast(const T&in value); ///< Appends an element at the end of the array.
590 void removeAt(uint index); ///< Removes the element at the specified index.
591 void removeLast(); ///< Removes the last element of the array.
592 void removeRange(uint start, uint count); ///< Removes count elements starting from start.
593 uint length() const; ///< Returns the length of the array.
594 void reserve(uint length);
595 void resize(uint length); ///< Sets the new length of the array.
596 void sortAsc(); ///< Sorts the elements in the array in ascending order. For object types, this will use the type's opCmp method.
597 void sortAsc(uint startAt, uint count); ///< Sorts only the elements starting at index startAt and the following count elements in the array in ascending order. For object types, this will use the type's opCmp method.
598 void sortDesc(); ///< Sorts the elements in the array in descending order. For object types, this will use the type's opCmp method.
599 void sortDesc(uint startAt, uint count); ///< Sorts only the elements starting at index startAt and the following count elements in the array in descending order. For object types, this will use the type's opCmp method.
600 void reverse(); ///< Reverses the order of the elements in the array.
601
602 /**
603 * @brief Returns the index of the first element that has the same value as the wanted value.
604 * For object types, this will use the type's opEquals or opCmp method to compare the value. For arrays of handles any null handle will be skipped.
605 * If no match is found will return a negative value.
606 */
607 int find(const T&in value) const;
608
609 /**
610 * @brief Returns the index of the first element that has the same value as the wanted value.
611 * For object types, this will use the type's opEquals or opCmp method to compare the value. For arrays of handles any null handle will be skipped.
612 * If no match is found will return a negative value.
613 */
614 int find(uint startAt, const T&in value) const;
615
616 /**
617 * @brief Searches for a matching address. These are especially useful for arrays of handles where specific instances of objects are desired, and not just objects that happen to have equal value.
618 * If no match is found will return a negative value.
619 */
620 int findByRef(const T&in value) const;
621
622 /**
623 * @brief Searches for a matching address. These are especially useful for arrays of handles where specific instances of objects are desired, and not just objects that happen to have equal value.
624 * If no match is found will return a negative value.
625 */
626 int findByRef(uint startAt, const T&in value) const;
627 bool isEmpty() const;
628 T& opIndex(uint index);
629 const T& opIndex(uint index) const;
630 T[]& opAssign(const T[]&in);
631 bool opEquals(const T[]&in) const;
632 funcdef bool less(const ?&in a, const ?&in b); ///< sorting function for sort
633 void sort(less&in, uint startAt = 0, uint count = uint ( - 1 )); ///< sorts array using the passed in less function
634};
635
636/**
637 * @class kStr
638 * @brief String class functions
639 */
640class kStr
641{
642public:
644 kStr(const kStr&in s);
645 uint Hash() const; ///< Returns HashID from this instance
646 kStr& ToUpper(); ///< Converts string to upper case characters
647 kStr& ToLower(); ///< Converts string to lower case characters
648 int Atoi() const; ///< Converts string to int
649 float Atof() const; ///< Converts string to float
650 bool Contains(const kStr&in) const; ///< contains the string
651 bool ContainsNoCase(const kStr&in) const; ///< contains the string ignoring case
652 bool IsEmpty() const; ///< length of string is 0
653 uint64 IndexOf(const kStr&in s) const; ///< Reports the zero-based index of the first occurrence of a specified string within this instance. The method returns uint64(-1) if the string is not found in this instance.
654 uint64 Length() const; ///< Returns the length of the string
655 kStr Substr(uint64 start, uint64 length) const; ///< Return a substring from the current string. Will return the current string if start or length indexes are out of range.
656 kStr ReplaceSubstr(const kStr &in from, const kStr &in to) const; ///< Returns a new kStr that replaced all occurrences of from with to.
657 bool StartsWith(const kStr &in s) const; ///< Returns true if this string starts with s
658 bool EndsWith(const kStr &in s) const; ///< Returns true if this string ends with s
659 const int8 opIndex(const uint64 i) const; ///< Returns the ASCII code of the character at the strings index
660 int8 &opIndex(const uint64 i); ///< Get/Set the ASCII code of the character at the strings index
661 bool opEquals(const kStr&in s) const;
662 kStr& opAssign(const kStr&in s);
663 kStr opAdd(const kStr&in s) const;
664 kStr opAdd(bool b) const;
665 kStr opAdd(int i) const;
666 kStr opAdd(uint i) const;
667 kStr opAdd(int64 i) const;
668 kStr opAdd(uint64 i) const;
669 kStr opAdd(int16 i) const;
670 kStr opAdd(uint16 i) const;
671 kStr opAdd(float f) const;
672 kStr& opAddAssign(const kStr&in s);
674};
675
676/**
677 * @class kAngle
678 * @brief Angle functions
679 */
681{
682public:
684 kAngle(float rads);
685 kAngle(const kAngle&in other);
686 float Diff(const float rads) const;
687 float Diff(const kAngle&in other) const;
688 float Interpolate(const float a, const float b) const;
689 kAngle opAdd(const float f) const;
690 kAngle& opAddAssign(const float f);
691 kAngle opSub(const float f) const;
692 kAngle& opSubAssign(const float f);
693 kAngle opAdd(const kAngle&in a) const;
695 kAngle opSub(const kAngle&in a) const;
697 kAngle& opAssign(const float f);
698 kAngle& opAssign(const kAngle&in a);
699 kAngle opNeg() const;
700 float opImplConv();
701};
702
703/**
704 * @class kVec3
705 * @brief Representation of 3D vectors and points.
706 */
707class kVec3
708{
709public:
711 kVec3(float x, float y, float z);
712 kVec3(const kVec3&in v);
713 kVec3& Normalize(); ///< Makes this vector have a magnitude of 1
714 kVec3 Cross(const kVec3&in v) const; ///< Cross Product of two vectors
715 float Dot(const kVec3&in v) const; ///< Dot Product of two vectors
716 float Length() const; ///< Returns the length of this vector. Exactly the same as Unit()
717 float LengthSq() const; ///< Returns the squared length of this vector. Exactly the same as UnitSq()
718 float DistanceSq(const kVec3&in other) const; ///< Returns the squared distance between this instance and other
719 float ToYaw(); ///< Returns the Yaw direction in Rads
720 float ToPitch(); ///< Returns the Pitch direction in Rads
721 void Clear(); ///< Sets x, y and z components to 0
722 void Set(const float x, const float y, const float z); ///< Set x, y and z components of this kVec3
723 kVec3 Lerp(const kVec3&in other, const float t) const; ///< Linearly interpolates between two vectors
724 kVec3& Lerp(const kVec3&in other, const float t); ///< Linearly interpolates between two vectors
725 kVec3& Project(const kVec3&in normal, const float value); ///< Projects a vector onto another vector
726 kVec3& Reflect(const kVec3&in normal, const float energyFactor); ///< Reflects a vector off the plane defined by a normal
727 kVec3& Randomize(const float value); ///< Randomizes x, y, z, components by value
728 kVec3& CubicCurve(const kVec3&in pt1, const float value, const kVec3&in pt2);
729 kVec3& QuadraticCurve(const kVec3&in pt1, const float value, const kVec3&in pt2, const kVec3&in pt3);
730 kVec3 opAdd(const kVec3&in v) const;
731 kVec3 opAdd(const float f) const;
732 kVec3& opAddAssign(const kVec3&in v);
733 kVec3& opAddAssign(const float f);
735 kVec3 opSub(const kVec3&in v) const;
736 kVec3 opSub(const float f) const;
737 kVec3& opSubAssign(const kVec3&in v);
738 kVec3& opSubAssign(const float f);
739 kVec3 opMul(const kVec3&in v);
740 kVec3 opMul(const float val);
741 kVec3& opMulAssign(const kVec3&in v);
742 kVec3& opMulAssign(const float f);
743 kVec3 opDiv(const kVec3&in v);
744 kVec3 opDiv(const float val);
745 kVec3& opDivAssign(const kVec3&in v);
746 kVec3& opDivAssign(const float f);
747 kVec3& opAssign(const kVec3&in v);
748 float opIndex(int i) const;
749 float& opIndex(int i);
750 float Distance(const kVec3&in other) const; ///< Returns the distance between this instance and other vector
752 kVec3 opMul(const kQuat&in rot) const;
753 kVec3& opMulAssign(const kQuat&in rot);
755 kQuat ToQuat() const;
756 float Unit() const; ///< Returns the length of this vector. Exactly the same as Length()
757 float UnitSq() const; ///< Returns the squared length of this vector. Exactly the same as LengthSq()
758 float x;
759 float y;
760 float z;
761};
762
763/**
764 * @class kQuat
765 * @brief Quaternions used to represent rotations
766 */
767class kQuat
768{
769public:
771 kQuat(float angle, float x, float y, float z);
772 kQuat(float angle, kVec3&in vector);
773 kQuat(float rotX, float rotY, float rotZ);
774 kQuat(const kQuat&in other);
777 kQuat Slerp(const kQuat&in rot, float t) const;
778 kQuat Inverse() const;
779 void GetAngles(float&out yaw, float&out pitch, float&out roll);
780 kQuat Diff(const kQuat&in rot) const;
781 void Set(const float x, const float y, const float z, const float w);
782 void Clear(); ///< x,y,z = 0.0 w = 1.0
783 kQuat opAdd(const kQuat&in rot);
784 kQuat opSub(const kQuat&in rot);
785 kQuat opMul(const kQuat&in rot);
786 kQuat& opAssign(const kQuat&in rot);
787 kQuat& opMulAssign(const kQuat&in rot);
788 kStr ToString() const;
789 float x;
790 float y;
791 float z;
792 float w;
793};
794
795/**
796 * @class kPlane
797 * @brief Plane functions
798 */
800{
801public:
803 kPlane(const float a, const float b, const float c, const float d);
804 kPlane(const kVec3&in a, const kVec3&in b, const kVec3&in c);
805 kPlane(const kVec3&in a, const kVec3&in b);
806 kPlane(const kAngle&in a);
807 const kVec3& Normal() const;
809 float Dot(const kVec3&in point) const;
810 float Dot(const kPlane&in plane) const;
811 float Distance(const kVec3&in point) const; ///< 0 = PSIDE_ON. > 0 is PSIDE_FRONT. < 0 PSIDE_BACK.
812 float ToYaw() const; ///< Yaw of this plane.
813
814 /**
815 * @brief Returns true if yaw is facing toward the plane. Usually used for climbing sectors.
816 * @code{.cpp}
817 * bool Climbable(const float yaw) const
818 * {
819 * return (floorPlane.c <= 0.5f && flags & AAF_CLIMB && floorPlane.IsFacing(yaw));
820 * }
821 * @endcode
822 */
823 bool IsFacing(const float yaw) const;
824 const int PointOnSide(const kVec3&in point) const; ///< Returns EnumPlaneSide. If point is in front, behind or on the plane.
825};
826
827class kColor ///< Not used (included automatically from kexengine)
828{
829public:
831 kColor(const kColor&in c);
832 kColor(uint8 r, uint8 g, uint8 b, uint8 a);
833 kColor(const kColor&in rgb, uint8 a);
834 kColor(uint8 rgb, uint8 a);
835 kColor(uint rgba);
836 kColor(float r, float g, float b);
837 uint DwColor() const;
838 kVec3 ToVec3() const;
839 void FromVec3(const kVec3&in v);
841 void FromVec3Linear(const kVec3&in v);
843 void SetSaturation(float);
844 void SetLuminance(float);
845 float GetSaturation() const;
846 float GetLuminance() const;
847 kColor& opAssign(const kColor&in c);
848 void LerpRGB(const kColor&in c, float t);
851 void RGBToHSV(float&out hue, float&out sat, float&out result) const;
852 void HSVToRGB(float hue, float sat, float val);
853 void RGBToHSL(float&out hue, float&out sat, float&out lit) const;
854 void HSLToRGB(float hue, float sat, float lit);
855 bool opEquals(const kColor&in c) const;
856 kColor opAdd(const kColor&in c) const;
857 kColor opSub(const kColor&in c) const;
858 kColor opMul(const kColor&in c) const;
859 kColor opMul(float f) const;
864 uint8 r;
865 uint8 g;
866 uint8 b;
867 uint8 a;
868};
869
870class kBitDelta ///< Not used (garbage included automatically from kexengine)
871{
872public:
873 bool WriteByte(const uint8 i);
874 uint8 ReadByte();
875};
876
877class kexTranslation ///< Not used (garbage included automatically from kexengine)
878{
879public:
880 uint GetGroupIndex(const kStr&in groupName);
881 kStr GetString(const kStr&in key, kexLocPlatform_e plat) const;
882 kStr GetString(int key, kexLocPlatform_e plat) const;
883 kStr GetGroupString(const kStr&in key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
884 kStr GetGroupString(int key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
885 kStr TranslateString(const kStr&in key, kexLocPlatform_e plat) const;
886 kStr TranslateString(const kStr&in key) const; ///< Same as Game.GetLocalizedText
887 kStr TranslateGroupString(const kStr&in key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
888 kStr TranslateStringWithArgs(const kStr&in key, const kDict&in pairs, uint plat) const; ///< plat: kexLocPlatform_e
889 kStr TranslateGroupStringWithArgs(const kStr&in key, const kDict&in pairs, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
890};
891
892class ref
893{
894public:
897 ref(const ref&in);
898 ref(const ?&in);
899 void opCast(?&out);
900 ref& opHndlAssign(const ref&in);
901 ref& opHndlAssign(const ?&in);
902 bool opEquals(const ref&in) const;
903 bool opEquals(const ?&in) const;
904};
905
907{
908public:
909 /**
910 * @brief Access to ScriptObject class script obj ref. Should never be null.
911 @code{.cpp}
912 TurokEnemy @enemyObj = cast<TurokEnemy@>(actor.ScriptObject().obj);
913 @endcode
914 */
916};
917
919{
920public:
921 /**
922 * @brief Access to ScriptObjectFx class script obj ref. Should never be null.
923 @code{.cpp}
924 MyCoolFx @coolFx = cast<MyCoolFx@>(fx.ScriptObject().obj);
925 @endcode
926 */
928};
929
930/**
931 * @class ScriptObject
932 * @brief Actor script classes must inherit from this class
933 * @code{.cpp}
934 * class TurokActor : ScriptObject
935 * {
936 * kActor @self;
937 * TurokActor(kActor @actor)
938 * {
939 * @self = actor;
940 * }
941 * }
942 * @endcode
943 */
945{
946public:
947 void OnSpawn(); ///< Required
948 void OnTick(); ///< Required
950 void OnRestore();
952 void OnSleep();
953 void OnWake();
954 void OnTouch(kActor @theActorThatTouchedMe); ///< called even if alseep
955 void OnCollide(kCModel@); ///< called even if alseep
956 void OnCollisionStart(); ///< Collision Movement Check is starting
957 void OnCollisionFinish(); ///< Collision Movement Check has ended
958 void OnMenuTick(); ///< called only when dummymenu active
959 void OnRemoved(); ///< called when actor is removed (Internally or through scripting). IsStale will return true immediately after this, RenderModel will be null, and the scriptobject will be destroyed.
961 void OnDeactivate(); ///< Never used
962 void OnPreDamage(kActor @instigator, kDictMem @damageDef, const int damage); ///< always called when damaged even after death. Call OverrideOnDamageValue on the actor if you need to override the damage value to prevent death.
963 void OnDeath(kActor @killer, kDictMem @damageDef); ///< called only when actor dies
964 void OnDamage(kActor @instigator, kDictMem @damageDef, const int damage); ///< always called even after death
966};
967
968/**
969 * @class ScriptObjectWeapon
970 * @brief Weapon script classes must inherit from this class
971 * @code{.cpp}
972 * class TurokWeapon : ScriptObjectWeapon
973 * {
974 * kWeapon @self;
975 * TurokWeapon(kWeapon @actor)
976 * {
977 * @self = actor;
978 * }
979 * }
980 * @endcode
981 */
983{
984public:
985 void OnBeginFire(); ///< Required
986 void OnFire(); ///< Required
987 void OnEndFire(); ///< Required
988 void OnLower(); ///< Required
989 void OnRaise(); ///< Required
990 void OnHoldster(); ///< Required
991 void OnPreRaise() ///< Optional. Called right when the weapon state is set to raise.
992 void OnActorTick() ///< Optional. Called after the weapon calls OnTick for the kActor class (Should not use. Only here if needed)
993};
994
995/**
996 * @class ScriptObjectPlayer
997 * @brief Player script class must inherit from this class
998 * @code{.cpp}
999 * class TurokPlayer : ScriptObjectPlayer
1000 * {
1001 * kPuppet @self;
1002 * TurokPlayer(kPuppet @actor)
1003 * {
1004 * @self = actor;
1005 * }
1006 * }
1007 * @endcode
1008 */
1010{
1011public:
1012 void OnPickup(kActor @pickup);
1013 void OnArmorDamage(kActor @instigator, kDictMem @damageDef, const int damage);
1015};
1016
1017/**
1018 * @class ScriptObjectFx
1019 * @brief Fx script class must inherit from this class
1020 * @code{.cpp}
1021 * class TurokFx : ScriptObjectFx
1022 * {
1023 * kFx @self;
1024 * TurokFx(kFx @fx)
1025 * {
1026 * @self = fx;
1027 * }
1028 * }
1029 * @endcode
1030 */
1032{
1033public:
1034 void OnTick(); ///< Required
1035 void OnRemoved(); ///< called when actor is removed (Internally or through scripting). IsStale will return true immediately after this.
1036 void OnCollisionStart(); ///< Collision Movement Check is starting
1037 void OnCollisionFinish(); ///< Collision Movement Check has ended
1038 void OnCollide(kCModel @pCModel); ///< Called just before any of the OnImpact functions (except water).
1039 void OnCollidePost(); ///< Called right after OnCollide and the OnImpact functions (except water).
1040 bool OnImpactWall(int impactType, const kVec3 &in normal);
1041 bool OnImpactFloor(int impactType, const kVec3 &in normal);
1042 bool OnImpactCeiling(int impactType, const kVec3 &in normal);
1043 bool OnImpactObject(int impactType, int impactDmgType, kActor@ actor, const kVec3 &in normal);
1044 void OnImpactWater(); ///< Called OnTick after Fx Movement update
1045 void OnExpire(); ///< Called OnTick
1046};
1047
1048/**
1049 * @class kDict
1050 * @brief Editable Dictionary object that holds keys and values
1051 */
1053{
1054public:
1055 void Add(const kStr&in key, const kStr&in value); ///< Adds a new key/value
1056 void Empty(); ///< Removes all keys/values
1057 void SetValue(const kStr&in key, const kStr&in value); ///< Sets the value for the specified key
1058 const bool HasKey(const kStr&in key); ///< Returns true if key exists
1059 bool GetFloat(const kStr&in key, float&out floatResult, const float defaultValue = 0); ///< Returns true if found the key as a float type
1060 bool GetInt(const kStr&in key, int&out intResult, const int defaultValue = 0); ///< Returns true if found the key as a int type
1061 bool GetBool(const kStr&in key, bool&out boolResult, const bool defaultValue = false); ///< Returns true if found the key as a bool type
1062 bool GetString(const kStr&in key, kStr&out stringResult); ///< Returns true if found the key as a kStr type
1063 bool GetVector(const kStr&in key, kVec3&out vectorResult); ///< Returns true if found the key as a kVec3 type
1064};
1065
1066/**
1067 * @class kDictMem
1068 * @brief Read only Dictionary object that holds keys and values
1069 */
1071{
1072public:
1073 bool GetFloat(const kStr&in key, float&out floatResult, const float defaultValue = 0); ///< Returns true if found the key as a float type
1074 bool GetInt(const kStr&in key, int&out intResult, const int defaultValue = 0); ///< Returns true if found the key as a int type
1075 bool GetBool(const kStr&in key, bool&out boolResult, const bool defaultValue = false); ///< Returns true if found the key as a bool type
1076 bool GetString(const kStr&in key, kStr&out stringResult); ///< Returns true if found the key as a kStr type
1077 bool GetVector(const kStr&in key, kVec3&out vectorResult); ///< Returns true if found the key as a kVec3 type
1078};
1079
1080/**
1081 * @class kSelectionListInt
1082 * @brief For selecting a int value based on weights
1083 */
1085{
1086public:
1088 void AddItem(int item, const int weight);
1089 int& Select(); ///< Returns a value based on item weights
1090 void Reset(); ///< clears all items in the list
1091 const uint GetNumEntries() const; ///< returns number of items in the list
1093};
1094
1095/**
1096 * @class kSelectionListFloat
1097 * @brief For selecting a float value based on weights
1098 */
1100{
1101public:
1103 void AddItem(float item, const int weight);
1104 float& Select(); ///< Returns a value based on item weights
1105 void Reset(); ///< clears all items in the list
1106 const uint GetNumEntries() const; ///< returns number of items in the list
1108};
1109
1111{
1112public:
1113 void SetModel(const kStr&in modelPath, const kStr&in modelAnimPath);
1114 void SetRotationOffset(const int nodeIndex, const float rads, const float x, const float y, const float z, const bool clearInterpolation = false);
1115 void SetRotationOffset(const int nodeIndex, const kQuat&in rotation, const bool clearInterpolation = false);
1116 void SetTexture(const int section, const int textureID);
1117 void SetVisibility(const int nodeIndex, const bool visible);
1118 void HideSection(const int nodeIndex, const int section, const bool hide); ///< section is the surface index. must be 0-31 and must not be >= number of surfaces or will do nothing.
1119 void AddTrailEffect(const kStr&in trailName, const int nodeIndex);
1120 void RemoveTrailEffect(); ///< Removes all trail effects
1124 const int GetNumNodes() const;
1125 kVec3 GetNodeOrigin(const int node, const kVec3&in offset); ///< Is calculated on draw. Can call ForceUpdateJoints if you need the current value for interpolation.
1126 kQuat GetNodeRotation(const int node); ///< Is calculated on draw. Can call ForceUpdateJoints if you need the current value for interpolation.
1127 kVec3 GetNodeScale(const int node);
1128 void ForceUpdateJoints(const float interpolatedFraction = 1.0f); ///< Force update node matrices and then call GetNodeOrigin/GetNodeRotation to get current value. interpolatedFraction should be in the range 0.0 (prev) to 1.0 (current). This is an expensive operation so use sparingly.
1131 const bool IsMorph() const;
1132
1133 /**
1134 * @brief Set Morph Updating.
1135 * @param bUpdate: Set to false to handle updating it yourself per ModelFile (not per Actor).
1136 *
1137 Default Tick code:
1138 @code{.cpp}
1139 if(time >= 1.0f)
1140 {
1141 time = 0;
1142 frame++;
1143
1144 if(frame >= maxFrames)
1145 {
1146 frame = 2;
1147 }
1148 nextFrame = frame + 1;
1149 }
1150 time += GAME_DELTA_TIME * 7.5f;
1151 @endcode
1152 */
1153 void SetMorphUpdating(const bool bUpdate);
1154
1155 /**
1156 * @brief Get Morph frame info
1157 * @param frame: 1=Init Frame, 2=Start Loop Frame. >= maxFrames then 1.
1158 * @param nextFrame: 2=Init Frame, 3=Start Loop Frame. >= maxFrames then 2.
1159 * @param maxFrames
1160 * @param time: 0..1 (lerp time between frame and nextFrame meshes)
1161 */
1162 void GetMorphFrame(int&out frame, int&out nextFrame, int&out maxFrames, float&out time) const;
1163 void SetMorphFrame(const int frame, const int nextFrame, const float time);
1164 void ColorOverride(const int node, const float r = 1.0f, const float g = 1.0f, const float b = 1.0f, const float a = 1.0f); ///< color values range from -1.0f to 1.0f. Call ColorOverrideSections to enable the override for sections on the node.
1165 void ColorOverrideSections(const int node, const int sectionMask = -1); ///< enable the color override for specific sections(materials) on the node by setting each bit. -1 = All, 0 = Stop override
1166 void ScaleOverride(const int node, const kVec3 &in scale);
1167};
1168
1170{
1171public:
1172 void Blend(const int animID, float speed, float blend, int flags); ///< EnumAnimStateFlags
1173 void Blend(const int animID, float speed, float blend, int flags, const int frame, const bool runActions = true, const bool noSoundActions = false); ///< EnumAnimStateFlags. Blends the animation to the frame while optionally running all previous actions
1174 void Set(const int animID, float speed, int flags); ///< EnumAnimStateFlags
1175 void Set(const int animID, float speed, int flags, const int frame, const bool runActions = true, const bool noSoundActions = false); ///< EnumAnimStateFlags. Sets the animation to the frame while optionally running all previous actions
1176 const int CurrentFrame(); ///< current frame playing for the current animation. Must have an animation action keyframe for this to work, otherwise use TrackFrame() instead. This should be named more like last frame an action was checked to execute.
1177 const int NumFrames(); ///< number of frames in this animation. Returns -1 if no animation set.
1178 const int NumNodes(); ///< number of nodes in this animation. Returns -1 if no animation set.
1179 const float PlayTime(); ///< increases by GAME_DELTA_TIME if not stopped or paused.
1180 const float TrackTime(); ///< time from 0(on first frame) to 1(on last frame).
1181 bool IsPlaying(const int animID); ///< Returns true if current animations ID is animID and the animation is not stopped.
1182 bool CheckAnimID(const int animID); ///< checks if animID exists
1183 const int PlayingID() const; ///< the current animations ID
1184 void Stop(); ///< flags |= ANF_STOPPED; flags &= ~ANF_LOOP;
1185 void Pause(); ///< flags |= ANF_PAUSED;
1186 void Resume(); ///< flags &= ~ANF_PAUSED;
1187 const bool Stopped() const; ///< (flags & ANF_STOPPED) != 0
1188 const bool Blending() const; ///< (flags & ANF_BLEND) != 0
1189 const bool Looping() const; ///< (flags & ANF_LOOP) != 0
1190 const bool CycleCompleted() const; ///< (flags & ANF_CYCLECOMPLETED) != 0
1191 void ChangeSpeed(const float speed); ///< Scales speed of the current animation where 1.0 = 15fps and 4.0 = 60fps
1192 void SetLastFrame(const bool execActions = false); ///< if execActions is true, runs all key frame actions in the animation except Footstep(55) and PlaySound(248). applies the stop flag (flags |= ANF_STOPPED).
1193 void SetPlayTime(const float time); ///< The total time in seconds this animation has been playing
1194 void SetTrackTime(const float time); ///< 0.0(first frame) to 1.0(last frame)
1195 const int TrackFrame(void) const; ///< current frame playing for the current animation.
1196 const int TrackNextFrame(void) const; ///< next frame to play for the current animation.
1197 kQuat GetRotation(const int animID, int nodeNum, int frame);
1198 kVec3 GetOrigin(const int animID, int nodeNum, int frame);
1199 const int GetAnimNumFrames(const int animID);
1200 const int LoopFrame(); ///< The frame the animation loops back to when it reaches the last frame. Returns -1 if no animation set.
1201 int flags; ///< EnumAnimStateFlags
1202
1203 /**
1204 * @brief is somewhat the Z position of the root node. It's calculated as follows whenever the
1205 * root motion is updated (ANF_ROOTMOTION must be set).
1206 * @code{.cpp}
1207 * // vBlendPos: is the blended position of the root node (node 0) from the prev frame to the current frame.
1208 * // m_pOwner->BaseHeight(): is the Height of the actor when it spawned (or when SetSpawnParams is called on non map actors).
1209 * baseOffset = vBlendPos.z * m_pOwner->Scale().z;
1210 * baseOffset -= m_pOwner->BaseHeight() * 0.6f;
1211 * if(baseOffset < 0) baseOffset = 0;
1212 * @endcode
1213 */
1215 kVec3 rootMotion; ///< the move direction of the root node from the prev frame to the current frame.
1216};
1217
1218/**
1219 * @class kActor
1220 * @brief Base type used by all actors.
1221 */
1223{
1224public:
1225 const bool IsStale() const; ///< Actor is marked as removed and is waiting to be freed from memory when it next checks if there are no more references to this actor.
1229 kVec3& Origin(); ///< Position in world space
1232 void SetTarget(kActor@ actor);
1234 void SetSector(const uint sectorIndex);
1235 void Remove(); ///< Removes the actor and sets stale to true. Actor will only internally be removed when there are no references to this actor.
1239 int16& Health();
1240 int& Type(); ///< The actors Type ID
1241 int& ImpactType(); ///< EnumImpactType
1242 int& ImpactTypeDmg(); ///< EnumImpactType. Overrides the damage def used. if is -1 (default) then does not override ImpactType()
1243 bool &IgnoreSectorHeightChange(void); ///< if true will not change position(or velocity and movement) when sector height changes.
1244 bool &IgnoreSectorPlatformChange(void); ///< if true this actor will not change position(or velocity and movement) when sector platform moves.
1247 uint& Flags(); ///< EnumActorFlags
1248 const uint SpawnFlags1() const; ///< EnumActorSpawnFlags1
1249 const uint SpawnFlags2() const; ///< EnumActorSpawnFlags2
1250 const uint SpawnFlags3() const; ///< EnumActorSpawnFlags3
1251 const int TID() const;
1252 float& Radius();
1253 float& Height();
1254 float& StepHeight(); ///< AKA Dead Height. Used for moving up steps, figuring out if in waterheight, and the height of the actor when they are dead so you can still shoot them.
1255 float& WallRadius();
1256 float& Gravity();
1257 float& Friction();
1258 float& AnimSpeed();
1259 float& BounceDamp();
1260 float& FloorHeight();
1262 const int SectorIndex();
1263 const int AreaID() const;
1264 bool InstanceOf(const kStr&in className) const; ///< example: InstanceOf("kexPuppet")
1265 void PlaySound(const kStr&in soundPath);
1266 void PlaySoundWithLookupID(const int soundID);
1269 const int GameTicks() const;
1272 const bool InWater() const;
1273 bool CheckPosition(const kVec3&in origin); ///< checks if the actor can move to this location
1274 bool CheckPosition(const float angle, const float distance); ///< calls CheckPosition(kVec3 origin) with origin being: Actor.Origin() + (angle*distance*Actor.Radius())
1275 float GetTurnYaw(const kVec3&in lookAtLocation) const;
1276 float GetAvoidanceAngle(const kVec3&in lookAtLocation, const float distance);
1277 const float GetWaterHeight() const;
1278 const bool CanSee(kActor@ actor, const uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1279 uint& ClipFlags(); ///< EnumClipFlags
1280 kDictMem@ Definition(); ///< get actors def data
1281 bool OnGround() const;
1282 int GetWaterLevel() const; ///< EnumWaterLevel
1283 kActor@ CastToActor(); ///< Casts to a kActor. Only used for kPuppet Actor().
1284 kAI@ CastToAI(); ///< Casts to kAI. returns null if isn't a kAI.
1285 kFx @SpawnProjectile(const kStr&in fxPath, const kVec3&in pos, const kVec3&in targetLocation, const float maxAngle); ///< Returns the first Fx spawned. targetLocation.z gets added by GAME_SCALE * 3.0f
1286 void MeleeObject(const kStr&in damageType, const kVec3&in offset, const float radius);
1287 kFx @SpawnFx(const kStr&in fxPath, const kVec3&in pos);
1288 kFx @SpawnFx(const kStr&in fxPath, const kVec3&in pos, const kQuat&in rot);
1290 float DistanceToPoint(const kVec3&in point) const; ///< calls DistanceToPoint(x,y,z)
1291 float DistanceToPoint(const float x, const float y, const float z) const; ///< actors point is in the center
1292 void InflictGenericDamage(kActor@ inflictor, const int damage);
1293 void InflictGenericDamage(kActor@ inflictor, const kStr &damageDef, const int damage); ///< Can pass in a damage def. The damageDef keys used are mainly for custom scripting purposes only. Only the following keys are used internally when calling this function: bImpact, impactDamp, impactFalloff, bKnockback, knockBackForce
1294 void InflictDamage(kActor@ inflictor, const kStr&in damageDef);
1295 /**
1296 * @brief Calls a script function on all actors that are in the AreaNodes (KD-Tree search) contained inside a bounds. The bounds is calculated as: pos + this actors bounds(model bounds) + this actors radius. This will call for actors not necessarily in the bounds of the actor so checking distance is required in your script function.
1297 * @param pos The world position of where to check for actors
1298 * @param callbackFunc a function on this actors script class that will be called (if it exists) for each actor in range. function header must be: void callbackFunc(kActor@ actor, const float arg1, const float arg2, const float arg3, const float arg4)
1299 */
1300 void InteractActorsAtPosition(const kVec3&in pos, const kStr&in callbackFunc, const float arg1 = 0, const float arg2 = 0, const float arg3 = 0, const float arg4 = 0);
1301 kScriptObject@ ScriptObject(); ///< Returns the ScriptObject that holds the obj ref to the custom script. Will return null if actor doesn't have a custom script or the actor was removed.
1302 const bool MoveToPosition(const float x, const float y); ///< Returns True if new position is in the same sector as the actor else returns false and it set a new sector. Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision for quick collision tests.
1303 const bool MoveToPosition(const float x, const float y, uint clipFlags); ///< EnumClipFlags to use. Returns True if new position is in the same sector as the actor else returns false and it set a new sector. Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision for quick collision tests.
1304 bool RandomDecision(const int randomBit) const; ///< randomBit should be >= 2. if a random value has the bit set and actors GameTicks also has the bit set then returns true.
1305 void SetPosition(const kVec3&in pos, const bool clearInterpolation = true); ///< best way to set an actors position (if you don't know the sector), will also set the sector and optionally clear interpolation
1306
1307 /**
1308 * @brief Get a map actors param value
1309 * @param paramID
1310 * (0) Target ID -32768..32767
1311 * (1) Trigger Anim 0..255
1312 * (2) Health -32768..32767
1313 * (3) Max Regenerations -32768..32767
1314 * (4) Attach Chance 0..255
1315 * (5) Texture -128..127
1316 * (6) Params 2 -128..127
1317 * (7) Params 1 -128..127
1318 */
1319 const int16 SpawnParams(const int paramID) const;
1320 const float GetCeilingHeight() const; ///< calculates the ceiling height from the actors sector and origin. Returns 0 if not in a sector.
1321 const float GetFloorHeight() const; ///< calculates the floor height from the actors sector and origin. Returns 0 if not in a sector.
1322 void RunFxEvent(const kStr&in fxEventName); ///< Runs an ActorFX event. Example: RunFxEvent("Enemy_Freeze");
1323 void ClearFxEvent(); ///< Clears all data for the actors ActorFx on this actor
1324 bool FxEventActive(); ///< Returns true if ActorFx is running
1325 const int GetSectorIndexAtLocation(const kVec3&in pos, uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1326 void MarkPersistentBit(const bool clear);
1330 void AutomapToggle(const bool show); ///< Use with Game.AutomapCustom(true);
1331 void SetAutomapColor(const int r, const int g, const int b);
1332
1333 /**
1334 * @brief Sets the actors param value. all params are int16.
1335 * @param param
1336 * (0) Target ID -32768..32767
1337 * (1) Trigger Anim 0..255
1338 * (2) Health -32768..32767
1339 * (3) Max Regenerations -32768..32767
1340 * (4) Attach Chance 0..255
1341 * (5) Texture -128..127
1342 * (6) Params 2 -128..127
1343 * (7) Params 1 -128..127
1344 * @param value
1345 */
1346 void SetSpawnParams(const int param, const int16 value);
1347 void SetSpawnFlags1(const uint flags); ///< EnumActorSpawnFlags1
1348 void SetSpawnFlags2(const uint flags); ///< EnumActorSpawnFlags2
1349 void SetSpawnFlags3(const uint flags); ///< EnumActorSpawnFlags3
1350 void SetupSpawnParams(); ///< call after setting your actors spawnflags for them to take effect on the kActor
1351 void SetCustomDeadHeight(const bool bUse, const float height); ///< Height of actor when they are dead. Only for non map actors. (actors spawned with ActorFactory)
1352 const float GetCustomDeadHeight();
1354 const bool OverridingKeyTouchTID(); ///< used only for key pickups
1355 const int16 GetOverrideKeyTouchTID(); ///< used only for key pickups
1356 void OverrideKeyTouchTID(const bool bOverride, const int16 tid); ///< used only for key pickups to tell what key it is in the hub
1357 bool& SkipKeyTouchCinema(); ///< used only for key pickups
1358 void SetModel(kStr&in modelFile, kStr&in animFile); ///< a way to set the model/anim for actors that had no model set previously
1359 bool& TriggerInvincibility(); ///< Can't damage if true. Gets set to true if enemy has trigger anim and false when activated.
1360 bool &DrawDelay(); ///< Don't draw until has ticked once.
1361 void GetBoundsMinMax(kVec3&out min, kVec3&out max) const; ///< actor must not be sleeping and have a model set and not be a pickup. otherwise will return default min/max values of (-128, -128, -128) (128, 128, 128). Sets the min and max kVec3 values (the actors origin is added to the values)
1362 const int MapActorIndex() const; ///< Returns -1 if not a map actor
1363 int& DifficultyMode(); ///< The difficulty this actor is currently set to
1364 void OverrideOnDamageValue(const int damage, const bool bOverride = true); ///< call in OnPreDamage
1365 bool& NoKnockBack(); ///< Will not receive knock back movement from things like the alien weapon for example.
1366 const float BaseHeight() const; ///< height of actor when spawned or when kAI regenerated
1367 void RunAction(const int funcID, const float w = 0.0f, const float x = 0.0f, const float y = 0.0f, const float z = 0.0f); ///< run a function on the actor defined in defs/animActions.txt
1368 float& AirFriction(); ///< default = 1.0f
1369 float& WaterFriction(); ///< default = 0.5f (same as Friction)
1370 float& Mass(); ///< default = GAME_SCALE * 1.0f
1371 const float GetSkyHeight() const;
1372 bool &ChildOfTarget(void); ///< if this actors Target is an actor that belongs to the owner of the Fx, explosion or melee attack then won't collide/get damaged.
1373 kVec3 DamageOrigin(void) const; ///< The Origin point of the attacker (Fx, Actor, or null (returns this actors origin in that case)) who damaged this actor last. Gets set before OnPreDamage.
1374 kVec3 DamageVelocity(void) const; ///< The Velocity of the attacker (Fx, Actor, or null (returns this actors velocity in that case)) who damaged this actor last. Gets set before OnPreDamage.
1375 const bool CanSee(kPuppet@ puppet, const uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags). Note: This function that takes in the kPuppet arg is only available for kActor, not for kPuppet or kAI or kWeapon.
1382 const int RefCount() const; ///< Returns the number of references there are to this actor. If actor is stale and RefCount is 0 then it will be removed after the actor ticks.
1383 bool HasCustomRef(void) const;
1384 void AddCustomRef(void); ///< Keeps the actor from getting freed from memory.
1385 void ClearCustomRef(void); ///< Allows the actor to get freed from memory if it has no references. This will be called automatically when level is unloaded.
1386 void SetupHeadTrack(const kStr &in headTrackDef); ///< Sets a headtrack
1387 float &SoundPitchModify(); ///< Override the final pitch of sounds owned by this actor. A value of 1000 raises the pitch by the amount tiny cheat does. A value of -1000 lowers the pitch by the amount the big head cheat does. Set to 0 to stop overriding. if less than 1 will override with no pitch change so tiny and big head mode don't affect it.
1388 void RotateAroundOrigin(const kAngle &in angle, const kVec3 &in platformOrigin, const bool setPos = true); ///< The angle amount to rotate this actors position. if setPos is true will use SetPosition to position the actor else will use MoveToPosition.
1389 void LinkArea(); ///< Links the actor to an area node so that internally the actor can be found in quick searches (similar to a kd-tree) for explosive damage radius checks, when InteractActorsAtPosition is called, kAI GetAttention checks, and collision checks against actors. Should only call whenever you set the actors Origin() directly. Calling MoveToPosition or SetPosition or when the actors movement is updated by velocity changes or by gravity then LinkArea will be called internally.
1390 void CheckLinkArea(); ///< If origin or radius changed since the last LinkArea then calls LinkArea else does nothing. Links the Actor to an area node so that internally the Actor can be found in quick searches (similar to a kd-tree).
1391 float SoundPlayTime(const kStr &in file, const uint index = 0); ///< returns -1.0f if sound is not playing. Returns the amount of time in seconds the sound has been playing for. file is the path to the .ksnd file. use index to specify which sound to check for in the ksnd starting at 0.
1392 bool &RemoveTrailsOnAnimChange(); ///< Will remove all model trails on this actor when animation is set/blend
1393 const float GetCurrentGameSpeed(void) const; ///< Gamespeed of this Actor (default 1.0f)
1394 void SetCurrentGameSpeed(const float speed); ///< Set Gamespeed of this Actor (default 1.0f)
1395 bool &IgnoreGameSpeed(); ///< GameSpeed used for this actor will be CurrentGameSpeed. (Default is true for kPuppet and kPlayerWeapon. Default is False for every other actor)
1396 bool &IgnoreFxGameSpeed(); ///< GameSpeed used for Fx whose source is this actor will always be CurrentGameSpeed. (Default is false)
1397 const float GetGameSpeed() const; ///< Returns CurrentGameSpeed if IgnoreGameSpeed is true else returns CurrentGameSpeed * GlobalGameSpeed.
1398 kFx @DamageFx() const; ///< The kFx that hit this actor. Will be null if no Fx hit this actor. Only use in OnPreDamage/OnDamage/OnDeath. Do not use anywhere else or it could be pointing to a random place in memory then the game will crash!
1399 const float DecayTime(void); ///< Value used to melt kAI when they regen. Values range from 0.0 (normal) to 60.0 (fully melted).
1400 void SetDecayTime(const float value); ///< Used to melt kAI when they regen. Value range should be 0 (normal) to 60 (fully melted).
1401 float RadiusDamageFactor(const kVec3 &in origin, const float radius) const;
1402 bool &UseNewExplosiveRadiusCheck(void); ///< (default False) Set to true to enable explosive damage checks from radius to actor cylinder(more accurate) instead of radius to actors center point.
1403};
1404
1405/**
1406 * @class kActorIterator
1407 * @brief The way to iterate through all actors in the map. Example code:
1408 * @code{.cpp}
1409 * kActorIterator it;
1410 * kActor @actor;
1411 * while((@actor = it.Get()) !is null)
1412 * {
1413 * // Do something with actor
1414 * }
1415 * @endcode
1416 */
1418{
1419public:
1421 kActor@ Get(); ///< Returns the next actor in the iterator
1422 void Reset(); ///< Resets the iterator back to the first actor
1423};
1424
1425class kWeapon : public kActor
1426{
1427public:
1428 kVec3 TransformToOwnerPosition(); ///< returns the OffsetPosition() * the players matrix.
1429 kVec3 TransformToOwnerPosition(const kVec3&in vector); ///< returns the (OffsetPosition() + vector) * the players matrix.
1430
1431 /**
1432 * @brief SpawnsFx at the players at the position passed in * players rotation, then adds the
1433 * viewHeight + landingViewOffset to the z position. Sets PF_FIREDPROJECTILE PlayerFlags.
1434 * adjustToPerspective will change the position you pass in like this:
1435 * @code{.cpp}
1436 * float d = kexMath::Pow(47.5f / fov, fov / 60.0f);
1437 * vOrigin.y *= d;
1438 * vOrigin.z += (1.0f - d) * 2.0f;
1439 * @endcode
1440 */
1441 kFx @FireProjectile(const kStr&in fxPath, const float x, const float y, const float z, const bool adjustToPerspective = false);
1442 bool& PreventFire(); ///< Use in OnBeginFire to internally prevent from entering its Fire state.
1443 bool &NoGenericBobbing(); ///< Disables the generic weapon bobbing menu option from affecting this weapon
1444 kVec3& OffsetPosition(); ///< Offset position of weapon
1445 int& State(); ///< EnumWeaponStates
1446 bool &AllowUnderwater(); ///< Set to true to allow the weapon underwater. Gets reset back to the weapons def value after OnBeginLevel.
1448 bool &ClearInterpolationOffsetPosition(); ///< Set to true to clear the OffsetPosition interpolation after the weapon ticks, then it gets set back to false.
1449 float &PlaySpeed(); ///< Get/Set speed of weapon animations (default = 4.0f)
1450 float &PlaySpeedSwapIn(); ///< Get/Set speed of weapon lower animation (default = 4.0f)
1451 float &PlaySpeedSwapOut(); ///< Get/Set speed of weapon raise animation (default = 3.0f)
1452 float &FOV(); ///< Get/Set weapon FOV (default = 47.5f)
1453 bool &NoWalkAnim(); ///< Get/Set the usage of the walk anim. Run animation will be used instead.
1455
1456};
1457
1458class kAI : public kActor
1459{
1460public:
1461 uint& AIFlags(); ///< EnumAIFlags
1462 void SetupAISpawnFlags(); ///< call after setting your actors spawnflags for them to take effect on the kAI
1463 int& AttackChance(); ///< 0-100
1464 float& AttackRange(); ///< squared
1465 float& MeleeRange(); ///< squared
1466 float& LeashRadius(); ///< squared
1467 float& SightRange(); ///< squared
1468 float& LoudRange(); ///< squared
1469 float& QuietRange(); ///< squared
1470 float& FlyHeight(); ///< squared
1471 float& SightFOV(); ///< in rads
1472 int& Agitation(); ///< 0-300. 0-99=IDLE, 100-199=AGITATED, 200-300=CHASE
1473 float& AnimScalar(); ///< default = 1.0f
1474 float& BlendScalar(); ///< default = 10.0f
1475 int &Regenerate(); ///< get/set current number of times the enemy will regenerate value. Regenerate is set right after OnBeginLevel is called and is set to a random value from 0 to the mapActors maxRegenerations value or the actors def ai.maxRegenerations value(for non map actors).
1476};
1477
1478class kPuppet : public kActor
1479{
1480public:
1481 float& ViewHeight(); ///< set from the players def "player.viewHeight". Origin.z + ViewHeight() + LandingViewOffset() = Cameras position.
1482 float& RecoilPitch(); ///< used for weapon recoil that modifies the players pitch.
1483 const float LandingViewOffset() const; ///< LandingViewOffset changes when jumping and falling. Origin.z + ViewHeight() + LandingViewOffset() = Cameras position.
1484 uint& PlayerFlags(); ///< EnumPlayerFlags
1487 void SetGroundForwardSpeed(const float speed); ///< default = 10.24f
1488 void SetGroundBackwardSpeed(const float speed); ///< default = -10.24f
1489 void SetGroundStrafeSpeed(const float speed); ///< default = 10.24f
1490 void SetGroundForwardAccel(const float accel); ///< default = 0.05f
1491 void SetGroundBackwardAccel(const float accel); ///< default = 0.05f
1492 void SetGroundStrafeAccel(const float accel); ///< default = 0.05f
1493 void SetGroundDeaccel(const float accel); ///< default = 0.5f
1494 void SetSwimForwardSpeed(const float speed); ///< default = 10.24f
1495 void SetSwimBackwardSpeed(const float speed); ///< default = -10.24f
1496 void SetSwimStrafeSpeed(const float speed); ///< default = 10.24f
1497 void SetSwimForwardAccel(const float accel); ///< default = 0.05f
1498 void SetSwimBackwardAccel(const float accel); ///< default = 0.05f
1499 void SetSwimStrafeAccel(const float accel); ///< default = 0.05f
1500 void SetSwimDeaccel(const float accel); ///< default = 0.5f
1501 void SetJumpMinSpeed(const float speed); ///< default = GAME_SCALE * 0.855f
1502 void SetJumpMaxSpeed(const float speed); ///< default = GAME_SCALE * 1.667f
1503 void SetWalkMaxSpeed(const float speed); ///< default = 4.0f
1504 void SetJumpClimbSpeed(const float speed); ///< default = GAME_SCALE * 0.2875f
1505 void SetOverrideShadow(const int value); ///< 0=none(default), 1=Force Disable shadow, 2=Force Enable shadow
1506 void SetOverrideWalkRun(const int value); ///< 0=none(default), 1=Force Disable Walk
1507 float& Oxygen(); ///< Time in seconds. 0: full oxygen. >= 55: shows air bar. >= 70: OxygenOut is set to true.
1508 bool& OxygenOut(); ///< if true will damage player if underwater
1509 float& OverrideFOV(); ///< set to 1-179. anything else will stop overriding the fov and will use the r_fov cvar.
1510 void SetCrawl(const bool crawl); ///< use this to manually set if the player is crawling instead of setting PF_CRAWLING directly.
1511 const float GroundForwardSpeed() const; ///< default = 10.24f
1512 const float GroundBackwardSpeed() const; ///< default = -10.24f
1513 const float GroundStrafeSpeed() const; ///< default = 10.24f
1514 const float GroundForwardAccel() const; ///< default = 0.05f
1515 const float GroundBackwardAccel() const; ///< default = 0.05f
1516 const float GroundStrafeAccel() const; ///< default = 0.05f
1517 const float GroundDeaccel() const; ///< default = 0.5f
1518 const float SwimForwardSpeed() const; ///< default = 10.24f
1519 const float SwimBackwardSpeed() const; ///< default = -10.24f
1520 const float SwimStrafeSpeed() const; ///< default = 10.24f
1521 const float SwimForwardAccel() const; ///< default = 0.05f
1522 const float SwimBackwardAccel() const; ///< default = 0.05f
1523 const float SwimStrafeAccel() const; ///< default = 0.05f
1524 const float SwimDeaccel() const; ///< default = 0.5f
1525 const float JumpMinSpeed() const; ///< default = GAME_SCALE * 0.855f
1526 const float JumpMaxSpeed() const; ///< default = GAME_SCALE * 1.667f
1527 const float WalkMaxSpeed() const; ///< default = 4.0f
1528 const float ClimbJumpAmount() const; ///< default = GAME_SCALE * 0.2875f
1529 const int OverrideShadow() const; ///< default = 0
1530 const int OverrideWalkRun() const; ///< default = 0
1531 const int GetState(void) const; ///< EnumPlayerStates
1532 float &MaxFallVelocity(void); ///< default = -200.0f
1533 bool &NoWallJump(void); ///< default = false
1534 bool &CustomViewEnable(); ///< Set to true to enable the custom view
1535 bool &CustomViewUnderwater(); ///< whether the custom view is underwater or not
1540 void SetHeadBobScale(const float scale);
1541 void SetTurnBobScale(const float scale);
1542 void SetStrafeBobScale(const float scale);
1543 void SetUnderwaterBobScale(const float scale);
1544 void SetJumpBobScale(const float scale);
1545 void SetOverrideWeaponOnTopFix(const int value); ///< 0=none(default), 1=Force disable fix, 2=Force enable fix (can use console command "g_weaponontopfix" 1 to turn it on as well)
1546 void SetMaxLives(const int value); ///< Max lives allowed from gaining Lifeforces
1547 void SetMaxLifeforces(const int value); ///< Amount of Lifeforces needed to get an extra life
1548 const float HeadBobScale() const;
1549 const float TurnBobScale() const;
1550 const float StrafeBobScale() const;
1551 const float UnderwaterBobScale() const;
1552 const float JumpBobScale() const;
1553 const int OverrideWeaponOnTopFix() const;
1554 const int GetMaxLives() const;
1555 const int GetMaxLifeforces() const;
1556};
1557
1558/**
1559 * @class kActorFactory
1560 * @brief For Spawning Actors
1561 */
1563{
1564public:
1565 kActor@ Spawn(const int actorID, const float x, const float y, const float z, const float yaw, const int sector = - 1);
1566 kActor@ Spawn(const kStr&in actorName, const float x, const float y, const float z, const float yaw, const int sector = - 1);
1567};
1568
1569/**
1570 * @class kFx
1571 */
1572class kFx
1573{
1574public:
1575 const bool IsStale() const; ///< Fx is marked as removed and is waiting to be freed from memory when it next checks if there are no more references to this fx (after OnTick is called).
1576 kAngle& Yaw(); ///< Not used by the Fx
1577 kAngle& Pitch(); ///< Not used by the Fx
1578 kAngle& Roll(); ///< Not used by the Fx
1582 void SetTarget(kActor@ actor);
1584 void SetSector(const uint sectorIndex);
1588 int &ImpactType(); ///< EnumImpactType
1589 int &ImpactTypeDmg(); ///< EnumImpactType. Overrides the damage def used. if is -1 (default) then does not override ImpactType()
1591 float &Radius(); ///< (Default 8.0) Not really used. Only for searches for the fx to define it's bounding box.
1592 float &Height(); ///< (Default 8.0) Not really used. Only for searches for the fx to define it's bounding box.
1593 float &WallRadius();
1594 float &Gravity();
1595 float &Friction();
1596 float &BounceDamp();
1597 float &FloorHeight();
1599 const int SectorIndex();
1600 const int AreaID() const;
1601 bool InstanceOf(const kStr &in className) const; ///< example: InstanceOf("kexFx")
1602 void PlaySound(const kStr &in soundPath);
1603 void PlaySoundWithLookupID(const int soundID);
1606 const float GetWaterHeight() const;
1607 const bool CanSee(kActor@ actor, const uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1608 bool OnGround() const;
1609 int GetWaterLevel() const; ///< EnumWaterLevel
1610 float DistanceToPoint(const kVec3 &in point) const; ///< calls DistanceToPoint(x,y,z)
1611 float DistanceToPoint(const float x, const float y, const float z) const; ///< Fx point is in the center
1612 const bool MoveToPosition(const float x, const float y); ///< Returns True if new position is in the same sector as the actor else returns false and it set a new sector. Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision for quick collision tests.
1613 const bool MoveToPosition(const float x, const float y, uint clipFlags); ///< EnumClipFlags to use. Returns True if new position is in the same sector as the actor else returns false and it set a new sector. Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision for quick collision tests.
1614 void SetPosition(const kVec3 &in pos, const bool clearInterpolation = true); ///< best way to set an Fx position without knowing the sector, will also find/set the sector and optionally clear interpolation
1615 const float GetCeilingHeight() const; ///< calculates the ceiling height from the Fx sector and origin. Returns 0 if not in a sector.
1616 const float GetFloorHeight() const; ///< calculates the floor height from the Fx sector and origin. Returns 0 if not in a sector.
1617 const int GetSectorIndexAtLocation(const kVec3 &in pos, uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1618 float &AirFriction();
1620 float &Mass();
1621 const float GetSkyHeight() const;
1622 bool &ChildOfTarget(); ///< Unused. Only used for kActors.
1623 void LinkArea(); ///< Links the Fx to an area node so that internally the fx can be found in quick searches (similar to a kd-tree). Use with Game.GetFxInBounds. Should only call whenever you set the actors Origin() directly and then want to call Game.GetFxInBounds right after. LinkArea will be called automatically in OnTick internally so outside of that case you never need to worry about calling this.
1624 void CheckLinkArea(); ///< If origin or radius changed since the last LinkArea then calls LinkArea else does nothing. Links the Fx to an area node so that internally the Fx can be found in quick searches (similar to a kd-tree). Use with Game.GetFxInBounds. Should only call whenever you set the actors Origin() directly and then want to call Game.GetFxInBounds right after. CheckLinkArea will be called automatically in OnTick internally so outside of that case you never need to worry about calling this.
1625 void Remove(); ///< Removes the Fx and sets stale to true. Fx will only internally be removed when there are no references to this Fx.
1626 const int GameTicks() const;
1627 float RadiusDamageFactor(const kVec3 &in origin, const float radius) const;
1628 bool InWater();
1629 kScriptObjectFx @ScriptObject(); ///< Returns the ScriptObject that holds the obj ref to the custom script. Will return null if kFx doesn't have a custom script.
1631 const bool DrawDelay() const;
1632 const float GetCurrentGameSpeed(void) const; ///< Gamespeed of this Fx (default 1.0f)
1633 void SetCurrentGameSpeed(const float speed); ///< Set the Gamespeed of this Fx (default 1.0f)
1634 const float GetGameSpeed() const; ///< Returns CurrentGameSpeed if IgnoreGameSpeed is true else returns the CurrentGameSpeed * GlobalGameSpeed.
1635 const int RefCount() const; ///< Returns the number of references there are to this Fx. If this Fx is stale and RefCount is 0 then it will be removed after the Fx ticks.
1636 bool HasCustomRef() const;
1637 void AddCustomRef(); ///< Keeps the Fx from getting freed from memory.
1638 void ClearCustomRef(); ///< Allows the Fx to get freed from memory if it has no references. This will be called automatically when level is unloaded.
1639 const int BounceCount() const;
1642 bool &IgnoreGameSpeed(); ///< GameSpeed used for this Fx will always be CurrentGameSpeed. (Default = false)
1643 kActor @GetOwnerAsActor(); ///< Returns null if is not an Actor
1644 kFx @GetOwnerAsFx(); ///< Returns null if is not an Fx
1648 void SetParentFx(kFx@ fx);
1651 const float Distance() const; ///< Distance to the center of the View (Player or Camera) at the time the Fx spawned.
1652 const float Restart() const; ///< Current delay time before the Fx will start ticking
1653 int &Frame(); ///< The sprite frame. Make sure this value is < MaxFrames().
1654 const uint MaxFrames() const; ///< MaxFrames the sprite has. Frame should be < this value.
1655 float &DrawScale(); ///< Current scale of the sprite
1656 float &DrawScaleDest(); ///< When the Fx is updating its scale OnTick, the current draw scale will increase to this value in different ways depending if bScaleLerp is true in the fx file.
1657 float &MaxDrawScale(); ///< The highest value the DrawScale() can become when the Fx is updating its scale OnTick.
1658 float &RotationOffset(); ///< Current Rotation Offset around the Y Axis. kQuat(RotationOffset(), 0.0f, 1.0f, 0.0f);
1659 float &RotationSpeed(); ///< Adds this value * (0.25 * GameSpeed) to RotationOffset() when updating rotation OnTick. This value is set on spawn.
1660 kVec3 &VelocityOffset(); ///< When Fx spawns this is set to the starting velocity of the Fx. And adds to velocity if bAddOffset is true. Has no other use.
1661 void SetColor1(float r, float g, float b, float a); ///< Values range from 0.0 to 1.0. Color and alpha of sprite.
1662 void SetColor2(float r, float g, float b, float a); ///< Values range from 0.0 to 1.0. Environment color of the sprite (used in shaders to blend color1 and color2 together). Alpha is always set to the same as Color1.
1663 void GetColor1(float &out r, float &out g, float &out b, float &out a); ///< Get the color values
1664 void GetColor2(float &out r, float &out g, float &out b, float &out a); ///< Get the color values
1665 const bool SwapBloodColor() const; ///< Is true if fx has bBlood set to true and games blood menu option is set to Green(1). When RandomizeColors() is called which is done automatically when the Fx spawns.
1666 float &Speed(); ///< Initial forward moving speed, set on spawn from forwardSpeed and forwardSpeedRandom in the fx file.
1667 float &MovingForce(); ///< initial velocity.Length() value. if bBullet is true then while updating movement OnTick, if the velocity.length() of the fx is below MovingForce() * 0.65f then removes the Fx.
1669 const int Instances() const; ///< Same as the instances value in the fx file.
1670 float &FrameTime(); ///< The current time left before the Fx sprite tries going to the next frame in the sprite.
1672 uint &ClipFlagsInclude(); ///< ClipFlags to always include on Fx movement collision
1673 uint &ClipFlagsExclude(); ///< ClipFlags to always exclude on Fx movement collision
1674 const int FxIndex() const; ///< The index in the fx file array
1675 const int InstanceIndex() const;
1676 bool &DoUpdateTickEvents(); ///< If set to false the Fx will not call Tick or WaterTick events.
1677 bool &DoUpdateSpriteAnimation(); ///< If set to false the Fx will not update sprite frame
1678 bool &DoUpdateRotation(); ///< If set to false the Fx will not update rotation offset
1679 bool &DoUpdateScaling(); ///< If set to false the Fx will not update draw scale
1680 bool &DoUpdateFading(); ///< If set to false the Fx will not update color1 and color2 alpha value
1681 bool &DoUpdateMovement(); ///< If set to false the Fx will not move
1682 bool &DoUpdateExpireCheck(); ///< If set to false the Fx will not expire and get removed when lifetime is over
1683 bool &OnCollideForceSetOriginToLast(); ///< If set to true the Fx will set it's origin and sector to what it was before OnCollide was called.
1684 bool &OnCollideForceNoSetOriginToLast(); ///< If set to true the Fx will never set it's origin and sector to what it was before OnCollide was called.
1685 void SpawnImpactFx(const int impactType, const kVec3 &in normal, const bool bUseEvent = true, const bool bBlood = true);
1688 const int FxID() const;
1689 bool InfoFadeout(void) const;
1694 bool InfoLensFlares() const;
1695 bool InfoBlood() const;
1696 bool InfoAddOffset() const;
1697 bool InfoDepthBuffer() const;
1698 bool InfoScaleLerp() const;
1699 bool InfoActorInstance() const;
1700 bool InfoNoDirection() const;
1701 bool InfoFlash() const;
1702 bool InfoProjectile() const;
1705 bool InfoStickOnTarget() const;
1706 bool InfoBullet() const;
1707 bool InfoWeaponView() const;
1708 bool InfoFullScreen() const;
1709 bool InfoDecalOffset() const;
1710 bool InfoNoSpawnNear() const;
1711 bool InfoNoSpawnFar() const;
1714 bool InfoAttachSource() const;
1716 bool InfoDrawOnBottom() const;
1717 bool InfoSparkle() const;
1718 bool InfoCrossFade() const;
1719 bool InfoImpactEffect() const;
1720 bool InfoRestrictAim() const;
1721 bool InfoNoWallSpawn() const;
1722 bool InfoNoGroundSpawn() const;
1723 bool InfoNoHitSource() const;
1724 bool InfoSourceAlive() const;
1725 bool InfoSourceDead() const;
1727 bool InfoMuzzleEffect() const;
1728 bool InfoDrawDelay() const;
1729 bool InfoBounceImpact() const;
1732 float InfoMass() const;
1735 float InfoGravity() const;
1736 float InfoFriction() const;
1737 float InfoAirFriction() const;
1738 float InfoWaterFriction() const;
1739 float InfoAnimFriction() const;
1741 float InfoScale() const;
1742 float InfoScaleDest() const;
1743 float InfoMaxscale() const;
1744 float InfoForward() const;
1746 float InfoRotationOffset() const;
1747 float InfoRotationSpeed() const;
1748 float InfoRotationPivotX() const;
1749 float InfoRotationPivotY() const;
1750 int InfoLifetime() const;
1752 float InfoRestart() const;
1753 int InfoAnimspeed() const;
1757 int InfoDrawType() const;
1758 int InfoAnimType() const;
1762 float InfoHueRandom() const;
1765 int InfoFadeinTime() const;
1766 int InfoFadeoutTime() const;
1768 int InfoMaxInstances() const;
1769 float InfoSpawnDistOffset() const;
1772 kStr InfoModelName() const; ///< Custom use
1773 kStr InfoAnimName() const; ///< Custom use
1774 kStr InfoUserString() const; ///< Custom use
1775 int InfoUserID() const; ///< Custom use
1776};
1777
1779{
1780public:
1781 void StartCinematic(const uint flags = (CMF_LOCK_PLAYER|CMF_UNLOCK_PLAYER_ON_FINISH)); ///< EnumCameraFlags
1782 void StopCinematic(const bool noFade = false); ///< if noFade is true will stop the cinematic immediately without fading out.
1783 const int CinematicState() const; ///< EnumCameraStates
1786 void SetRotateEyeVector(const kVec3&in vector); ///< The focus position that is used when AutoPlayRotationTrack is called if there is no LookAtActor set.
1787 void SetFinalView(const int view); ///< the view to use for the camera origin and direction. view must be in range 0-2
1788 void SetRotationTrack(const int view, const float startAngle, const float destAngle, const float startDist, const float destDist, const float startEyeZOffset = 0, const float destEyeZOffset = 0, const float startFocusZOffset = 0, const float destFocusZOffset = 0); ///< Use with TweenRotationTrack and AutoPlayRotationTrack.
1789 void SetPositionTrack(const int view, const kVec3&in startEye, const kVec3&in destEye, const kVec3&in startFocus, const kVec3&in endFocus); ///< Sets eye and focus start and dest positions for use with TweenPositionTrack and AutoPlayPositionTrack.
1790 void TweenPositionTrack(const int view, const float time); ///< Lerps eye and focus positions to the start and dest positions using the time param (clamped 0..1). Call SetPositionTrack to set the start and dest positions.
1791 void TweenRotationTrack(const int view, const kVec3&in pos, const float time); ///< Lerps all variables set when SetRotationTrack was called using the time param (clamped 0..1).
1792 void AutoPlayPositionTrack(const int view, const float speed, const int lerpType); ///< EnumCameraLerpType. Calls TweenPositionTrack on the view using speed and lerpType
1793 void AutoPlayRotationTrack(const int view, const float speed, const int lerpType); ///< EnumCameraLerpType. Calls TweenRotationTrack on the view using speed and lerpType
1794 void AutoPlayBlendTrack(const int viewA, const int viewB, const int viewC, const float speed, const int lerpType); ///< EnumCameraLerpType. Blends between viewB and viewC eye and focus. and sets the results to viewA.
1795 void SetEyeView(const kVec3&in position); ///< position of camera (finalview). finalview must be set or will do nothing.
1796 void SetFocusView(const kVec3&in position); ///< position of where the camera (finalview) is looking at. (Sets look direction from eye and focus positions). finalview must be set or will do nothing.
1797 void ZoomEyeViewToPosition(const kVec3&in position, const float speed); ///< linear lerp finalview eye position to position using speed. finalview must be set or will do nothing.
1798 void ZoomFocusViewToPosition(const kVec3&in position, const float speed); ///< linear lerp finalview focus position to position using speed. finalview must be set or will do nothing.
1799 kVec3 GetEyeView(); ///< position of camera (finalview). finalview must be set or will return vecZero.
1800 kVec3 GetFocusView(); ///< position of where the camera (finalview) is looking at. finalview must be set or will return vecZero.
1801 void ClearFinalView(); ///< finalview is set to null
1802 void ClearViewTracks(); ///< views 0-2 all variables are set to 0
1803 const bool UserInterrupted() const; ///< User pressed left click or escape key or any controller button. While CinematicState() == CAMS_ACTIVE and used EnumCameraFlags CMF_LOCK_PLAYER
1804 void SetUserInterrupted(const bool toggle); ///< set to false to set the user interrupted to false.
1805 const bool Active() const;
1806 const bool Enabled() const; ///< CinematicState() >= CAMS_FADEOUT (Not Idle)
1807 const bool ViewingFromCamera() const; ///< CinematicState() >= CAMS_FADEIN && CinematicState() <= CAMS_ACTIVE_TO_FADEOUT
1808 kVec3& Tremor(); ///< x = adds to yaw, y = adds to pitch, z = adds to roll. lerps to vecZero using lerpTime of GAME_FRAME_TIME.
1809 void SetSector(const uint sectorIndex);
1810 const int SectorIndex();
1811 const int AreaID() const;
1813 const uint Flags() const; ///< EnumCameraFlags
1814 void SetFlags(const uint flags); ///< EnumCameraFlags
1815 kVec3 origin; ///< current position of camera. if a finalview is set then the origin will be set to the finalview's eye position.
1816 kAngle yaw; ///< if a finalview is set then the yaw will be set to the finalview's look direction.
1817 kAngle pitch; ///< if a finalview is set then the pitch will be set to the finalview's look direction.
1818 kAngle roll; ///< if a finalview is set then the roll will be set to 0.
1819 float fov; ///< Camera FOV (default is 74.0)
1820 float lookZOffset; ///< Used only if LookAtActor has been set.
1821 bool &ClearInterpolationOnTick(void); ///< set to false to handle interpolation yourself
1822 bool &AllowMenusWhenActive(void); ///< set to true to allow the pause menu to be opened during a cinematic
1823};
1824
1825/**
1826 * @class kCModel
1827 * @brief The kCModel(CModel) global stores collision results when certain actor methods are called. Those methods are as follows:
1828 * GetSectorIndexAtLocation
1829 * const bool CanSee(kActor@, const uint = 0)
1830 * MoveToPosition
1831 * SpawnProjectile
1832 * bool CheckPosition(const kVec3 &in)
1833 */
1835{
1836public:
1837 kVec3& InterceptVector(); ///< Returns the vector that intersected the collided geometry
1838 kVec3& ContactNormal(); ///< Returns the normalized vector of the collided surface
1839 const float& Fraction(); ///< returns the 0.0 - 1.0 range of the point of intersection from start to end trace. (If fraction is == 1.0 then no intersection occured.)
1840 const uint ClipResult(); ///< specifies the type of intersection (flags. EnumClipResultFlags)
1841 kActor@ ContactActor(); ///< handle pointer to actor that was collided (null if none was collided)
1842 kVec3& MoveDirection(); ///< Movement vector of the object
1843};
1844
1846{
1847public:
1848 const int Ticks() const; ///< affected by gamespeed (Ticksf truncated)
1849 const float Ticksf(void) const; ///< affected by gamespeed
1850 const int UnscaledTicks() const; ///< Not affected by GameSpeed
1853 void CheckKeys(); ///< Prints HUD messages to tell the player how many keys they've found on the current HUBID
1854 void ChangeMap(const kStr&in mapName);
1855 void StartWarp(kActor@ actor, const int tagID, const int mapID);
1856 void StartFreeWarp(kActor@ actor, const kVec3&in origin, const float yaw, const int sectorIndex, const int mapID);
1857 void HandlePlayerDeath(const bool loseLife = true); ///< if loseLife is true and infinite lives cheat is off then player loses a life. if player lives is < 0 then GameOver is called. If has >= 0 lives left then will ChangeMap to the current set check point, or use the current map if no check point is set.
1858 const bool CheckWarping(); ///< Checks if Warping or FreeWarping is in progress.
1859 const bool CanOpenPauseMenu(); ///< Checks if it's okay to be able to open a menu
1860 const bool CanOpenSaveMenu(); ///< Checks if it's okay to be able to open the save menu
1861 const int NewMapWarpTID(); ///< Returns the warp TID the player warped to from another map. Returns -1 if didn't warp from another map. Check before OnPostBeginLevel.
1862 void ClearWarpInterpolation(void); ///< Clearing the interpolation for kPuppet will also clear the warp interpolation.
1863};
1864
1865class kSys
1866{
1867public:
1868 void Print(const kStr&in message);
1869 void Warning(const kStr&in message);
1872 int Mouse_X();
1873 int Mouse_Y();
1874 const bool GetCvarValue(const kStr&in cvarName, kStr&out result);
1875 void MouseToHUD(float&out x, float&out y); ///< Returns the HUD position of the mouse
1876 void MouseToHUDNoStretch(float&out x, float&out y); ///< Returns the HUD position of the mouse
1877};
1878
1880{
1881public:
1882 kActor@ GetActorByTID(const int tagID, const int typeFilter = - 1) const; ///< if typeFilter is -1 checks any type otherwise only returns the actor of that type
1883 kActor@ GetActorByType(const int typeFilter) const; ///< Returns the first map actor of the same type
1884 bool TriggerActorsByTID(kActor@ instigator, const int tagID); ///< Triggers an actor (that is not the instigator) that has the same tagID. Returns true if triggered an actor.
1885 void ChangeAreaFlag(const int areaID, const uint flags, const bool active); ///< (EnumAreaFlags) Only sets the areaID flags and not the sector flags. Should most likely prefer using FloodMatchingAreaFlags so the sectors get set as well.
1886 void FloodFillAreaFlags(const int sectorIndex, const uint flags, const bool active); ///< (EnumAreaFlags) Sets flags on all adjacent sectors until it finds a sector that has the flags already set (or cleared if active is false)
1887 void FloodFillAreaFlags(const kVec3&in origin, const uint flags, const bool active); ///< (EnumAreaFlags) Calls FloodMatchingAreaFlags with FindNextClosestSector(origin) sector.
1888 void FloodMatchingAreaFlags(const int sectorIndex, const uint flags, const bool active); ///< (EnumAreaFlags) Sets flags on all adjacent sectors with matching areaID.
1889 const uint GetAreaFlags(const int areaID) const; ///< EnumAreaFlags
1890 const int GetAreaFloorImpact(const int areaID) const; ///< EnumImpactType
1891 const int GetAreaWallImpact(const int areaID) const; ///< EnumImpactType
1892 void ChangeAreaFloorImpact(const int areaID, const int value); ///< value: EnumImpactType
1893 void ChangeAreaWallImpact(const int areaID, const int value); ///< value: EnumImpactType
1894 void ChangeAreaWaterHeight(const int areaID, const float height); ///< WaterHeight is stored per area, not per sector or per vertex.
1895
1896 /**
1897 * @brief Returns an area arg value
1898 * @param areaID
1899 * @param arg
1900 @code{.cpp}
1901
1902 though args can be used for anything, they are typically used in this fashion:
1903 0: warp ID
1904 1: warp level ID or trigger sound ID
1905 2: checkpoint ID
1906 3: tag ID
1907 4: floor damage hit points
1908 5: floor damage rate
1909
1910 Hardcoded:
1911 0: AAF_TELEPORT: WarpID
1912 1: AAF_TELEPORT: WarpLevelID, AAF_EVENT and AAF_EVENTSOUND: soundID to play when player enters sector
1913 2: AAF_CHECKPOINT or AAF_SAVEGAME: CheckpointID
1914 3: AAF_EVENT: tag ID
1915 4: Not used
1916 5: AAF_SECRET: the secret index value (set automatically when level loads starting at 0. Conflicts with AAF_DAMAGE (so I guess no secrets should be placed on damage sectors))
1917
1918 Default Scripts:
1919 0: Not used
1920 1: Not used
1921 2: Not used
1922 3: Not used
1923 4: AAF_DAMAGE: amount of damage to do to the player when they're on the ground
1924 5: Always used as floor damage delay no matter the AAF flags. Should be used with AAF_DAMAGE only. 1 second = 1024
1925 @endcode
1926 */
1927 const int16 GetAreaArg(const int areaID, const int arg) const;
1928
1929 /**
1930 * @brief
1931 * @param areaID
1932 * @param arg
1933 @code{.cpp}
1934
1935 though args can be used for anything, they are typically used in this fashion:
1936 0: warp ID
1937 1: warp level ID or trigger sound ID
1938 2: checkpoint ID
1939 3: tag ID
1940 4: floor damage hit points
1941 5: floor damage rate
1942
1943 Hardcoded:
1944 0: AAF_TELEPORT: WarpID
1945 1: AAF_TELEPORT: WarpLevelID, AAF_EVENT and AAF_EVENTSOUND: soundID to play when player enters sector
1946 2: AAF_CHECKPOINT or AAF_SAVEGAME: CheckpointID
1947 3: AAF_EVENT: tag ID
1948 4: Not used
1949 5: AAF_SECRET: the secret index value (set automatically when level loads starting at 0. Conflicts with AAF_DAMAGE (so I guess no secrets should be placed on damage sectors))
1950
1951 Default Scripts:
1952 0: Not used
1953 1: Not used
1954 2: Not used
1955 3: Not used
1956 4: AAF_DAMAGE: amount of damage to do to the player when they're on the ground
1957 5: Always used as floor damage delay no matter the AAF flags. Should be used with AAF_DAMAGE only. 1 second = 1024
1958 @endcode
1959 * @param value
1960 */
1961 void ChangeAreaArg(const int areaID, const int arg, const int16 value);
1962 void ChangeSectorHeight(const int sectorIndex, const float height); ///< Changes all sectors floor vertices with the same areaID to the height
1963 void ChangeSectorCeilingHeight(const int sectorIndex, const float height); ///< Changes all sectors ceiling vertices with the same areaID to the height
1964 void ChangeSectorCeilingHeightVertices(const int sectorIndex, const float height, const int ptMask = 7); ///< Changes only the sector ceiling vertices(specified using the ptMask) to the height.
1965 void ChangeSectorHeightVertices(const int sectorIndex, const float height, const int ptMask = 7); ///< Changes only the sector floor vertices(specified using the ptMask) to the height.
1966 const int FindNextClosestSector(const kVec3&in origin); ///< Returns the sector that this point is best in. Returns -1 if not inside and above/on a sector.
1967 const int FindClosestSectorByDistance(const kVec3&in origin); ///< Returns the closest sector. Will return -1 only if the map contains no sectors.
1968
1969 /**
1970 * @brief Get the Sectors vertex position and height
1971 * Link 1 is pt1 to pt3
1972 * Link 2 is pt2 to pt1
1973 * Link 3 is pt3 to pt2
1974 * @param sectorIndex
1975 * @param pt1
1976 * @param pt2
1977 * @param pt3
1978 * @param heights: x is the height of pt1, y is the height of pt2, z is the height of pt3.
1979 */
1980 void GetSectorCorners(const int sectorIndex, kVec3&out pt1, kVec3&out pt2, kVec3&out pt3, kVec3&out heights) const;
1981
1982 /**
1983 * @brief Get the Sectors vertex indices. If invalid sectorIndex is passed in will return all -1.
1984 * @param sectorIndex
1985 * @param v1
1986 * @param v2
1987 * @param v3
1988 */
1989 void GetSectorVertIndices(const int sectorIndex, int &v1, int &v2, int &v3) const;
1990
1991 /**
1992 * @brief Get the 3 sectors links. -1 means there was no sector linked to that edge.
1993 * Link 1 is pt1 to pt3
1994 * Link 2 is pt2 to pt1
1995 * Link 3 is pt3 to pt2
1996 * @param sectorIndex
1997 * @param sectorIndex1
1998 * @param sectorIndex2
1999 * @param sectorIndex3
2000 */
2001 void GetSectorLinks(const int sectorIndex, int&out sectorIndex1, int&out sectorIndex2, int&out sectorIndex3) const; ///< a sectorIndex with -1 is no sector.
2002 const uint GetSectorNumBridges(const int sectorIndex) const; ///< number of bridge sectors this sector has
2003 const int GetSectorBridge(const int sectorIndex, const uint bridge) const; ///< Get the sector of the bridge. Use GetSectorNumBridges to loop through them all.
2004 const int GetSectorAreaID(const int sectorIndex) const;
2005 const int GetNumSectors() const;
2006 const int GetNumAreas() const;
2007 const int GetNumActors() const; ///< number of actors that are in the current maps data
2008 const int GetSectorFlags(const int sectorIndex) const; ///< Returns a 16 bit unsigned integer. Only the first 16 area flags (up to AAF_MAPPED) are used for sectors.
2009 void SetSectorFlags(const int sectorIndex, const int flags); ///< Keep in mind sector flags are a 16 bit unsigned integer and only the first 16 area flags (up to AAF_MAPPED) are used for sector flags.
2010 const kStr GetSkyMaterial() const;
2011 void OverrideSkyMaterial(const kStr &in path); ///< Example path: "skies/skyMaterials/sky_brown" You can clear the sky with an empty string: "" Do not pass in invalid paths!
2012 void OverrideFogColor(const int r, const int g, const int b); ///< rgb values are 0-255
2013 void ClearOverrideFogColor(); ///< Stops overriding and uses the sector color
2014 void OverrideWaterFogColor(const int r, const int g, const int b); ///< rgb values are 0-255
2015 void ClearOverrideWaterFogColor(); ///< Stops overriding and uses the sector color
2016 const int FindClosestSectorByDistance(const kVec3&in origin);
2017 const float GetAreaWaterHeight(const int area) const;
2018 const float GetAreaFogZFar(const int area) const;
2019 void SetAreaFogZFar(const int area, const float zfar);
2020 const float GetAreaWaterZFar(const int area) const;
2021 void SetAreaWaterZFar(const int area, const float zfar);
2022 const kVec3 GetAreaFogColor(const int area) const; ///< color values are in range 0-255
2023 void SetAreaFogColor(const int area, const kVec3 &in color); ///< color values are in range 0-255
2024 const kVec3 GetAreaWaterColor(const int area) const; ///< color values are in range 0-255
2025 void SetAreaWaterColor(const int area, const kVec3 &in color); ///< color values are in range 0-255
2026 const float GetAreaSkyHeight(const int area) const;
2027 void SetAreaSkyHeight(const int area, const float height);
2028 const float GetAreaSkySpeed(const int area) const; ///< speed scale is this value / 100. 100 is normal speed.
2029 void SetAreaSkySpeed(const int area, const float speed); ///< speed scale is this value / 100. 100 is normal speed.
2030 const float GetAreaBlendLength(const int area) const; ///< the speed to interpolate the fog color/start/zfar values when they change
2031 void SetAreaBlendLength(const int area, const float blendLength); ///< a blendLength value of 1.0 interpolates the fog color/start/zfar values at 0.066666 (1/15) per tick.
2032 const int GetAreaAmbience(const int area) const;
2033 void SetAreaAmbience(const int area, const int ambience);
2034 const int GetAreaMapColor(const int area) const;
2035 void SetAreaMapColor(const int area, const int color);
2036 const int GetAreaMusic(const int area) const;
2037 void SetAreaMusic(const int area, const int music);
2038 const int GetAreaCullBits(const int area) const; ///< if any staticmeshes cullBits have any of the area cullBits set then it will draw. (default callbits is 255)
2039 void SetAreaCullBits(const int area, const int bits); ///< if any staticmeshes cullBits have any of the area cullBits set then it will draw. (default callbits is 255)
2040 const int GetSectorDrawOrder(const int sectorIndex) const; ///< lowest draw order (0) draws the sectors on the automap last
2041 void SetSectorDrawOrder(const int sectorIndex, const int drawOrder); ///< lowest draw order (0) draws the sectors on the automap last
2042 void MoveSectorPlatform(const int sectorIndex, const kVec3 &in moveDelta, const uint flags = SPF_DEFAULT); ///< EnumSectorPlatformFlags. Moves bridge sectors vertices not connected to non bridge sectors by moveDelta amount affecting actors
2043 const bool PointInsideSector(const int sectorIndex, const kVec3 &in point) const; ///< Returns true if point is inside the sector (XY only)
2044};
2045
2047{
2048public:
2049 void CallDelayedMapScript(const kStr&in funcName, kActor@ instigator, const float delay); ///< even with delay 0 it will be called when map scripts update
2050 void CallDelayedMapScript(const int scriptID, kActor@ instigator, const float delay); ///< even with delay 0 it will be called when map scripts update
2051 void CallMapScript(const int scriptID, kActor@ instigator); ///< Use to call map script right away
2052 void HaltMapScript(const int scriptID);
2053 void PlaySound(const kStr&in path);
2054 void PlaySoundID(const int soundID);
2055 void PlayMusic(const kStr&in path, const bool loop); ///< Use PlayMusicID instead.
2060 float MusicPlayTime(); ///< Returns the amount of time the music has been playing for in seconds. Doesn't reset back to 0 when looping. if no music is playing returns -1.0
2062 void MusicPitch(const float pitch);
2063
2064 /**
2065 * @brief Start controller vibration from tactile sound file. Returns a handle.
2066 * @param path the path to the .bnvib file
2067 * @param channel kexVibrationPlayer::channel_e
2068 * @param pos kexVibrationPlayer::position_e
2069 */
2070 int PlayTactile(const kStr&in path, int channel, int pos);
2071 bool IsTactilePlaying(int vibHandle);
2072 bool IsTactilePlaying(int vibHandle, const kStr&in path);
2074 void StopTactile(int vibHandle);
2076 void Restart();
2077
2078 /**
2079 * @brief Print a message to the HUD
2080 * @param text
2081 * @param lineNumber must be in range 0..7
2082 * @param ticks number of ticks message will be visible. 60 ticks = 1 second.
2083 */
2084 void PrintLine(const kStr&in text, const int lineNumber, const int ticks = 120);
2085 /**
2086 * @brief Print a message to the HUD on the next line.
2087 * @param text
2088 * @param ticks number of ticks message will be visible. 60 ticks = 1 second.
2089 */
2090 void Print(const kStr &in text, const int ticks = 120);
2091 void PrintHelp(const kStr&in text, const bool endGame = false);
2095 void ChangeMap(const kStr&in path);
2096 void ShowMainMenu(const bool mouseCenter = true);
2097 const int GetMapNumberFromName(const kStr&in mapName); ///< This returns the HUB number NOT the map number. mapName is the HUB name such as "Map_Jungle". Returns -1 if not found.
2098 const int GetMapIDFromName(const kStr &in mapName); ///< This returns the mapID from the mapName. Returns -1 if not found.
2099 const int GetCurrentMapID();
2100 const int GetDifficulty(); ///< EnumDifficulty. Internally calls GameVariables.GetInt("g_difficulty")
2101 void SetDifficulty(const int value); ///< EnumDifficulty
2103
2104 /**
2105 * @brief Sets the current GameSpeed. kPuppet and kPlayerWeapon are not affected by GameSpeed.
2106 * @param speed 0..1
2107 * @param blendSpeed must be >= 1.0. This is the time it takes to lerp from current speed to the new speed. (lerp time = 1.0 / blendSpeed)
2108 */
2109 void SetGameSpeed(const float speed, const float blendSpeed);
2110 bool GetHubKeyInfo(const uint hubID, int&out nKeys, int&out remainingKeys, int&out keyBits);
2111 bool SetHubKey(const uint hubID, int key);
2112 bool SetHubKey(const uint hubID, int keyBits, int remainingKeys); ///< Set the keybits and remainingKeys directly
2113 kFx @SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in velocity, const kVec3&in origin, const kQuat&in rotation);
2114 kFx @SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in velocity, const kVec3&in origin, const kQuat&in rotation);
2115 kFx @SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in origin, const kQuat&in rotation);
2116 kFx @SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in origin, const kQuat&in rotation);
2117 kFx @SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in origin, const float yaw, const float pitch);
2118 kFx @SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in origin, const float yaw, const float pitch);
2119 kFx @SpawnFx(const kStr&in fxPath, const kVec3&in origin, const int sectorIndex);
2121 const bool AutomapEnabled(); ///< is the automap displaying on screen
2122 const bool AutomapDeactived();
2123 void AutomapToggle(const bool toggle); ///< show/hide the automap.
2124 void AutomapDeactive(const bool toggle); ///< permanently deactivates the automap.
2125 void AutomapCustom(const bool toggle); ///< allow actors with custom automap colors to be drawn to the automap. (for mods)
2126 void LifeForcePulse(); ///< Shows the LifeForces on the HUD
2127 void LivesPulse(); ///< Shows the Lives on the HUD
2128 void RunWalkPulse(); ///< Shows the RunWalk graphic on the HUD
2129 void WeaponWheelPulse(); ///< Shows the WeaponWheel on the HUD
2130 bool SetWeaponWheelPic(const int weapon, const kStr&in imagePath);
2131 bool ClearWeaponWheelPic(const int weapon);
2132 void SetLivesPic(const kStr&in imagePath);
2134 void SetLifeForcePic(const kStr&in imagePath);
2136 void MessageBox(const kStr&in msg1, const kStr&in msg2);
2137
2138 /**
2139 * @brief
2140 * @param msg1 top line
2141 * @param msg2 bottom line
2142 @code{.cpp}
2143 // Usage:
2144 Game.ConfirmMenu("Confirm This", "Is that correct?");
2145
2146 // Then check for result on Tick:
2147
2148 int result;
2149 GameVariables.GetInt("ConfirmMenuResult", result);
2150 switch(result)
2151 {
2152 case 1:
2153 Sys.Print("Selected No");
2154 GameVariables.SetValue("ConfirmMenuResult", "0");
2155 break;
2156 case 2:
2157 Sys.Print("Selected Yes");
2158 GameVariables.SetValue("ConfirmMenuResult", "0");
2159 break;
2160 default: // There's no ConfirmMenuResult waiting
2161 break;
2162 }
2163 @endcode
2164 */
2165 void ConfirmMenu(const kStr&in msg1, const kStr&in msg2);
2166 void SaveMenu(); ///< Opens the save game menu. Should always check if(PlayLoop.CanOpenSaveMenu())
2167 void LoadMenu(); ///< Opens the load game menu. Should always check if(PlayLoop.CanOpenPauseMenu())
2168 void SetDamageFlash(); ///< Shows the damage screen flash
2169 void SetPickupFlash(); ///< Shows the pickup screen flash
2170 void SetArmorFlash(); ///< Shows the armor damage screen flash
2171 const uint ConButtons(); ///< EnumPlayerConButtons
2172 uint MenuButtons(void) ///< EnumGameButtonEvents
2173 const int64 GetTimestamp();
2174 void GetDateAndTime(int&out seconds, int&out minutes, int&out hours, int&out day, int&out month, int&out year, kStr&out text);
2177
2178 /**
2179 * @brief add custom text to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLevel or later.
2180 * if the id already exists then simply sets all its variables.
2181 * @param font EnumGameFontType
2182 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
2183 */
2184 void AddText(const int id, const int font, const kStr &in text, const float x, const float y,
2185 const int edge = 0, const float scale = 1.0f, const bool center = false, const bool shadow = false,
2186 const int r = 255, const int g = 255, const int b = 255, const int a = 255,
2187 const int r2 = 255, const int g2 = 255, const int b2 = 255, const int a2 = 255);
2188 bool SetTextMsg(const int id, const kStr &in text);
2189 bool SetTextOrigin(const int id, const float x, const float y);
2190 bool SetTextColor(const int id, const int r = 255, const int g = 255, const int b = 255, const int a = 255);
2191 bool SetTextColors(const int id, const int r = 255, const int g = 255, const int b = 255, const int a = 255, const int r2 = 255, const int g2 = 255, const int b2 = 255, const int a2 = 255);
2192
2193 /**
2194 * @brief Set the text scale, font, edge, center, shadow
2195 * @param font EnumGameFontType
2196 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
2197 */
2198 bool SetTextProps(const int id, const float scale, const int font = 0, const int edge = 0, const bool center = false, const bool shadow = false);
2199 bool SetTextFlags(const int id, const int flags); ///< EnumCustomHUDFlags
2200 void SetTextOrder(const int id, const int order);
2201 void ClearTextInterpolation(const int id);
2202 bool RemoveText(const int id);
2204 void GetTextSize(const kStr &in text, const int font, const float scale, float &out width, float &out height); ///< EnumGameFontType
2205 float GetHUDOffset(const bool user = false); ///< if user is false will return the width to the edge of the screen (negative value). if true will return the width from the menu option "HUD Position".
2206 float GetHUDOffsetNoStretch(const bool user = false); ///< if user is false will return the width to the edge of the screen (negative value). if true will return the width from the menu option "HUD Position".
2207
2208 /**
2209 * @brief add custom image to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLevel or later.
2210 * if the id already exists then simply sets all its variables.
2211 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
2212 */
2213 bool AddPic(const int id, const kStr &in path, const float x, const float y, const float w, const float h, const int edge = 0,
2214 const float s1 = 0.0f, const float t1 = 0.0f, const float s2 = 1.0f, const float t2 = 1.0f,
2215 const int r = 255, const int g = 255, const int b = 255, const int a = 255);
2216 bool SetPicTex(const int id, const kStr &in path);
2217 bool SetPicOrigin(const int id, const float x, const float y);
2218 bool SetPicEdge(const int id, const int edge); ///< edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
2219 bool SetPicAngle(const int id, const float angle); ///< in rads
2220 bool SetPicFlags(const int id, const int flags); ///< EnumCustomHUDFlags
2221 bool SetPicWH(const int id, const float w, const float h);
2222 bool SetPicUV(const int id, const float s1 = 0.0f, const float t1 = 0.0f, const float s2 = 1.0f, const float t2 = 1.0f);
2223 bool SetPicColor(const int id, const int r = 255, const int g = 255, const int b = 255, const int a = 255);
2224 void SetPicOrder(const int id, const int order);
2225 void ClearPicInterpolation(const int id);
2226 bool RemovePic(const int id);
2227 void ClearPics(const bool clearImageCache = false);
2228 bool& HideHealth(); ///< Hide health display on the HUD
2229 bool& HideAmmo(); ///< Hide ammo display on the HUD
2230 bool& HideLifeForces(); ///< Hide LifeForces display on the HUD
2231 bool& HideRunWalk(); ///< Hide RunWalk display on the HUD
2232 bool& HideLives(); ///< Hide Lives display on the HUD
2233 bool& HideBossBar(); ///< Hide BossBar display on the HUD
2234 bool& HideAirBar(); ///< Hide AirBar display on the HUD
2235 bool& HideWeaponWheel(); ///< Hide WeaponWheel display on the HUD
2236 bool& HideCrosshair(); ///< Hide Crosshair display on the HUD
2237 bool& HideHelpMessages(); ///< Hide HelpMessages display on the HUD
2238 bool& HideMessages(); ///< Hide Messages display on the HUD
2239 bool& HideTimers(); ///< Hide Timers display on the HUD
2240 const float GetMaxZDrawDistance(); ///< Returns GetExtraZFar + the max z-draw distance from the active map def.
2241 const float GetExtraZFar(); ///< a custom amount for modders to add to the zfar value
2242 void SetExtraZFar(const float zfar); ///< affects actors, ai, particles, fog and underwater. (works normally unlike the cvar r_zfarextent)
2243 const float ShakeIntensity();
2245 bool SphereInView(const kVec3&in origin, const float radius);
2246 bool BoxInView(const kVec3&in min, const kVec3&in max);
2247 const float ViewZFar();
2248 void SaveModFile(const kStr&in filename); ///< Saves a custom save file. make sure to call GameModFileData.Empty() before adding key/values to save
2249 bool LoadModFile(const kStr&in filename); ///< Loads a custom save file. make sure to call GameModFileData.Empty() after you're done loading
2250 bool LoadModDataFile(const kStr&in filename); ///< Load any file in your mod that is a kDict binary. Use the python T1_json2modbin.py on the main scripting manual page to convert a json file to a kDict binary. Returns false if couldn't load file. Clears and Sets GameModFileData with the contents of the loaded file.
2251 void SetNoModSelect(const bool bToggle = true); ///< Disable the mod select menu when selecting new game for workshop mods only. (seta g_nomodselect "1")
2252 void PlayMovie(const kStr&in filename, const bool skippable = true); ///< Only .ogv or .webm files (replaces/adds extension to filename automatically). Can not read from kpfs.
2253
2254 /**
2255 * @brief Returns the key bind name of action. Returns empty string if nothing is bound.
2256 * @param action EnumInputActions
2257 * @param first if is false returns a string of all the bound keys separated by the ; character.
2258 * @param sort sorts binds by keyboard, mouse, and controller binds. depending on if controller or keyboard is active.
2259 */
2260 kStr GetActionBind(const int action, const bool first = true, const bool sort = true);
2261
2262 /**
2263 * @brief Returns the key bind name of the console command. Returns empty string if nothing is bound.
2264 * @param command the name of the console command.
2265 @code{.cpp}
2266 "weapon 0" to "weapon 13"
2267 "automap"
2268 "changeammotype"
2269 "runwalktoggle"
2270 "menu_up"
2271 "menu_down"
2272 "menu_left"
2273 "menu_right"
2274 "*menu_select"
2275 "menu_back"
2276 "menu_cancel"
2277 "menu_activate"
2278 @endcode
2279 * @param first if is false returns a string of all the bound keys separated by the ; character.
2280 * @param sort sorts binds by keyboard, mouse, and controller binds. depending on if controller or keyboard is active.
2281 */
2282 kStr GetCommandBind(const kStr&in command, const bool first = true, const bool sort = true);
2283 bool IsJoystickActive(); ///< if true the players last input was from a controller.
2284 kStr GetInputImagePath(const kStr&in bindName);
2285 bool InputImageExists(const kStr&in path);
2286 void SetCursorHotPos(int x, int y); ///< change the mouses cursors click point (default is 0, 0)
2287 void SetModBindings(const bool show = true); ///< Shows custom mod bindings in menu Bindings > Actions
2288 kStr PlayerName(); ///< Returns "Player" if could not get name
2289 void MarkActorPersistentBit(const int actorIndex, const bool clear = false, const int hubID = -1, const int mapNum = 0); ///< an invalid hub or map uses current maps persistent data.
2290 const bool IsActorPersistentMarked(const int actorIndex, const int hubID = -1, const int mapNum = 0); ///< an invalid hub or map uses current maps persistent data.
2291 void ClearAllMapsPersistData(void); ///< Clears all sector and actor persistent data for all maps in the game
2292 bool ClearMapPersistData(int mapID); ///< Clears all sector and actor persistent data for the map and returns true. Returns false if map was not found.
2294 void SetPreventOpenPauseMenu(const bool value);
2295 void ShowPauseMenu(); ///< Should always check if(PlayLoop.CanOpenPauseMenu())
2296 void OverrideSkyHeight(const float height); ///< Set to 0 to stop overriding
2297 const int BossDamageScaler(const int difficulty, const int damage);
2298 int PurgeUnusedModels(); ///< Returns number of models freed
2303 void SetWorldSunLightColor(const float r, const float g, const float b);
2304 void SetWorldSunAmbientColor(const float r, const float g, const float b);
2305 void SetWorldSunDirection(const float x, const float y, const float z);
2306 bool IsWorkshop(); ///< Returns true if game was run through the steam workshop (ran with command arg -workshop)
2307 void OverridePerPolyCollision(const int value); ///< 0=none, 1=force disable, 2=force enable
2308 void OverrideBloom(const int value); ///< 0=none, 1=force disable, 2=force enable
2309 void DisableLegalText(); ///< Removes the text at the bottom of the title screen
2310 void OverrideFogType(const int value); ///< 0=none, 1=force Radial, 2=force Plane
2311 void ClearInterpolationOnGameObjects(); ///< Clears Interpolation on all gameobjects and the camera if it's active
2312 void ShowDummyMenu(void); ///< Actors OnMenuTick function will now be processed. Call ClearDummyMenu to close the dummy menu.
2313 void ClearDummyMenu(bool bClearAll = false);
2314 void ToggleCursor(bool b = false);
2316 void OpenOptionsMenu(); ///< saves config file when exiting this menu
2327 bool EnemiesAlwaysDropItems(); ///< Returns the gameplay menu option value
2328 void OverrideRespawningEnemies(const int value); ///< Set: Game.OverrideRespawningEnemies(); Get: GameVariables.GetInt("OverrideRespawningEnemies", result); 0=none, 1=force disable, 2=force enable
2329 void PlayMusicID(const int musicID, const int fadeTimeMS = 500, const bool loop = true); ///< MusicID -2 plays previous track, -1 stops the music.
2331 bool IsRunningMapScript(const int scriptID);
2332 kStr GetMapNameFromID(const int mapID); ///< Finds the name of the map with the mapID. Returns an empty string couldn't find the map.
2333 const float GetMaxZDrawDistance(); ///< Returns GetExtraZFar + the max z-draw distance from the active map def.
2334 bool IsCheatActive(const int cheatBits); ///< EnumCheatFlags. Returns true if cheats are active
2335 void SetWaterReflectionAlpha(const float alpha); ///< Default is 1.0f
2336 void EnableWaterReflectionViewPoint(const bool enable);
2337 void SetWaterReflectionViewPoint(const kVec3 &in point);
2338 void NextSoundVolumeScale(const float volume); ///< The next play sound will scale the volume by this much
2339 void NextSoundPitchScale(const float pitch); ///< The next play sound will scale the pitch by this much
2340 kDictMem @GetActorDef(const kStr &in name); ///< Returns the Actors Def by name
2341 kDictMem @GetActorDef(const int type); ///< Returns the Actors Def by it's type
2342 void GetActorInBounds(const kVec3 &in min, const kVec3 &in max); ///< The array of actors is stored in Game.GetActorResult. (KD-Tree search). Each actors bounds is calculated as MAX(radius, height) + position.
2343 void GetFxInBounds(const kVec3 &in min, const kVec3 &in max); ///< The array of Fx is stored in Game.GetFxResult. (KD-Tree search). Each Fx bounds is calculated as MAX(radius, height) + position.
2344 void GetSectorInBounds(const kVec3 &in min, const kVec3 &in max); ///< The array of sectors is stored in Game.GetSectorResult. (KD-Tree search)
2345 uint GetActorResultsLength(); ///< Use after calling Game.GetActorInBounds
2346 uint GetFxResultsLength(); ///< Use after calling Game.GetFxInBounds
2347 uint GetSectorResultsLength(); ///< Use after calling Game.GetSectorInBounds
2348 kActor @GetActorResult(const uint index); ///< Use after calling Game.GetActorInBounds. Do not use at any other point!
2349 kFx @GetFxResult(const uint index); ///< Use after calling Game.GetFxInBounds. Do not use at any other point!
2350 int @GetSectorResult(const uint index); ///< Use after calling Game.GetSectorInBounds. Do not use at any other point!
2351 void NextSpawnFxSetResults(); ///< On the next call to SpawnFx or any other function that calls SpawnFx (such as SpawnProjectile and FireProjectile), all the Fx that were spawned will be stored in Game.GetFxResult. Do not make nested calls to this!
2352 kStr GetFxFile(const int fxID); ///< Returns the file path to the Fx by ID value as defined in defs/fileLookup.txt
2353 bool &UseCustomNoStretch(); ///< Set to true to use the non stretch Hud fix for Custom Text and Pics
2354 bool CanUseCustomNoStretch(); ///< Returns true if aspect ratio is 4:3 or bigger width
2355 void ScreenPointToHUD(float sx, float sy, float&out x, float&out y); ///< Returns the HUD position of the screen point
2356 void ScreenPointToHUDNoStretch(float sx, float sy, float&out x, float&out y); ///< Returns the HUD position of the screen point
2357 bool &NoDamageFlash(void);
2358 bool &NoPickupFlash(void);
2359 bool &NoArmorFlash(void);
2360 void SetAllSoundsPitchScale(const float pitchScale); ///< Sets all playing sounds pitch scale
2361 void SetGlobalSoundPitch(const float pitch); ///< When sounds begin to play their pitch is scaled by this value
2362 int GetMapSecretBits(int mapID); ///< returns the secretBits found in this map. Returns 0 if map not found.
2363 int GetMapSecretsFound(int mapID); ///< Returns the number of secrets found in this map. Returns 0 if map not found.
2364 bool SetMapSecretsFound(int mapID, int secretBits); ///< Returns false if map could not be found. secretBits only uses the first 16 bits, that means each map can only hold 16 secrets.
2365 int GetHubSecretsFound(const uint hubID); ///< Returns the number of secrets found in all the maps in this HUB. Returns 0 if HUB not found.
2366 int GetHubIDFromMapID(int mapID); ///< Return the HUB ID value. Returns -1 if not found.
2367 kStr GetHubTitle(int hubID); ///< Returns the HUB's Title def property. Returns empty string if not found.
2368 kStr GetHubDefName(int hubID); ///< Returns the HUB's def name. Returns empty string if not found.
2369 const bool IsFrozenObjects(); ///< Returns true if the freezeobjects console command is enabled
2370};
2371
2372/**
2373 * @class kFxIterator
2374 * @brief The way to iterate through all Fx in the map. Example code:
2375 * @code{.cpp}
2376 * kFxIterator it;
2377 * kFx @fx;
2378 * while((@fx = it.Get()) !is null)
2379 * {
2380 * // Do something with fx
2381 * }
2382 * @endcode
2383 */
2385{
2386public:
2388 kFx@ Get(); ///< Returns the next Fx in the iterator
2389 void Reset(); ///< Resets the iterator back to the first Fx
2390};
2391
2393{
2394public:
2395 const uint16 Buttons() const; ///< returns EnumPlayerButtons
2396 uint ButtonHeldTime(const int btn); ///< btn type is EnumInputActions
2398 void ConsumeAmmo(const int ammo, const bool preferredAmmo = true);
2399 void ConsumeAltAmmo(const int ammo);
2400 const int GetAmmo(const int weaponID) const;
2401 const int GetAltAmmo(const int weaponID) const;
2402 const bool HasAmmo(const int weaponID, const bool checkAlt = true) const; ///< if checkAlt is false only checks primary ammo
2403 const bool HasAltAmmo(const int weaponID) const;
2404 const bool HasAltAmmo() const;
2405 const bool HasWeapon(const int weaponID) const;
2406 bool& UseAltAmmo();
2407 const int CurrentWeapon() const;
2408 bool GiveWeapon(const int weaponID, const int ammo, const bool switchNewWeapon = true); ///< returns true if gave ammo else returns false because already has full primary ammo. if switchNewWeapon is false it will not auto switch to the weapon.
2409 bool RemoveWeapon(const int weapon);
2410 void Lock();
2411 void Unlock();
2412 int16& Armor();
2413 void Victory(const int warpActorID = - 1, const int mapID = - 1);
2414 const bool Locked() const;
2415 const int Lives() const;
2416 void SetLives(const int amount);
2417 const int LifeForces();
2418 void SetLifeForces(const int amount);
2419 bool& Backpack();
2420 bool& RunWalkToggle(); ///< if true walking is enabled. (saves)
2421 bool& NoLandClearVel(); ///< if true, when doing a hard landing you will not lose your velocity (saves)
2422 bool &NoWeaponSwitchOnWaterLand(); ///< will not auto switch weapon when entering/exiting water. (saves)
2423 bool GiveAmmo(const int weapon, const int amount, const bool altAmmo); ///< set amount to negative values to take ammo
2424 const int CurrentCheckPoint(); ///< returns warpTID
2426 void SetCheckPoint(const int warpTID, const int map);
2427 const kVec3 GetButtonAngles() const;
2429 const bool WeaponUsingAltAmmo(const int weapon) const;
2430 const bool SetWeaponUseAltAmmo(const int weapon, const bool bToggle);
2431 const bool WeaponAllowUnderwater(const int weapon) const;
2432 void ChangeWeapon(const int weapon);
2433 const int PendingWeapon() const;
2434 void CycleNextWeapon(const bool bCheckAmmo = false);
2435 void CyclePrevWeapon(const bool bCheckAmmo = false);
2436 kWeapon@ GetWeaponActor(const int weapon);
2437 int16& MaxHealth(); ///< should be >= MaxExtraHealth and ExtraHealth
2438 int16& MaxExtraHealth(); ///< should be <= MaxHealth
2439 int16& ExtraHealth(); ///< should be <= MaxExtraHealth
2440 bool GiveHealth(const int amount, const bool bMortalWound); ///< Takes into account extra health, and max health values. 0 is full health, negative amounts give extra health. if bMortalWound is true which is for 2 and ultra health then health goes up to maxExtraHealth.
2441 void CancelSpiritualTime(float blendTime = 1.0f); ///< if in spirit mode then will set gamespeed back to 1.0f using the passed in blendTime
2442 void SetSpiritualTime(const float time, const float blend); ///< time = time until cancels the effect. Should SetGameSpeed after calling this.
2443 const float GetSpiritualTime() const;
2444 const int GetWeaponGroup(const int weapon);
2445
2446 /**
2447 * @brief Binds this weapon to another weapons index. Example: you made a new pistol weapon at index 14 and want to group it with default pistol that has the index 2.
2448 * then set your new pistols(14) group to 2 and whenever the user presses the key assigned to the original pistol 2 it will cycle between them. instead of the user having to cycle to the new weapon with next/prev weapon inputs. The group can also be set in weaponInfo.txt def file with the key "group"
2449 */
2450 void SetWeaponGroup(const int weapon, const int group);
2451 bool &SilentCheckPoints(void); ///< if true won't show checkpoint message or play sound when on a checkpoint area. Gets set back to false when level starts.
2452 float &LookSensScale(); ///< Scales mouse/controller/gyro sensitivity (default = 1.0f)
2453 const int16 SecretCount(void) const; ///< Total number of secrets currently found over the entire game
2454 void SetSecretCount(const int amount); ///< Set the total number of secrets currently found over the entire game
2455};
2456
2457/**
2458 * @class kScriptTMap
2459 * @brief A map/dictionary that stores key/values as kStr. Example code to iterate each key/value:
2460 * @code{.cpp}
2461 * kScriptTMap tmap;
2462 * kStr key, value;
2463 * tmap.ItBegin();
2464 * while(tmap.ItNext(key, value))
2465 * {
2466 * Sys.Print("Key: " + key + ", Value: " + value);
2467 * }
2468 * @endcode
2469 */
2471{
2472 void ItBegin(); ///< Resets the iterator back to the first key/value
2473 bool ItNext(kStr &out key, kStr &out value); ///< key and value is set to the next key/value in the iterator. Returns false if reached the end.
2474 bool Add(const kStr &in key, const kStr &in value); ///< if the key doesn't exist then adds the key/value and returns false. If the key already exists then sets the value and returns true.
2475 bool Find(const kStr &in key, kStr &out value); ///< if the key exists then sets value and returns true. If key was not found then returns false.
2476 bool HasKey(const kStr &in key); ///< Returns true if the key exists
2477 bool Remove(const kStr &in key); ///< Removes the key if it exists and returns true.
2478 void Clear();
2479 bool IsEmpty();
2480 uint Count();
2481}
2482
2483namespace Math
2484{
2485 float Sin(float f); ///< Returns the sine of angle f in radians
2486 float Cos(float f); ///< Returns the cosine of angle f in radians
2487 float Tan(float f); ///< Returns the tangent of angle f in radians.
2488 float ATan2(float y, float x); ///< Returns the angle in radians whose Tan is y/x
2489 float Fabs(float f); ///< Returns the absolute value of f
2490 float ACos(float f); ///< Returns the arc-cosine of f - the angle in radians whose cosine is f
2491 float Sqrt(float f); ///< Returns square root of f
2492 int Abs(int i); ///< Returns the absolute value of i.
2493 float Ceil(float f); ///< Returns the smallest integer greater to or equal to f
2494 float Floor(float f); ///< Returns the largest integer smaller to or equal to f
2495 float Log(float f); ///< Returns the natural (base e) logarithm of a specified number
2496 float Pow(float x, float y); ///< Returns f raised to power p
2497 float Deg2Rad(float degs); ///< Degrees-to-radians conversion
2498 float Rad2Deg(float rads); ///< Radians-to-Degrees conversion
2499 float InvSqrt(float f); ///< Returns inverse square root of f
2500 float IncMax(const float val, const float inc, const float dest); ///< returns val +(or minus) inc and never goes above or below dest value
2501 int SysRand(); ///< Range 0..32767
2502 int Rand(); ///< Range 0..32767
2503 uint8 RandByte(); ///< Range 0..255
2504 int RandMax(const int max); ///< Range 0..max-1
2505 float NLerp(const float a, const float b, const float t); ///< Calculates the linear parameter t that produces the interpolant value within the range [a, b]
2506 float Accelerate(const float val, const float accel, const float max); ///< return val that increases by accel in a weird way to the max value.
2507 float RandFloat(); ///< Range 0..1
2508 float RandCFloat(); ///< Range -1..1
2509 float RandRange(const float min, const float max); ///< Returns a random float number between and min [inclusive] and max [inclusive]
2510 int Clamp(const int i, const int min, const int max); ///< Returns clamped value between min and max
2511 float Clampf(const float f, const float min, const float max); ///< Returns clamped value between min and max
2512 float Lerp(float start, const float end, const float time); ///< Linearly interpolates between start and end by time.
2513 float CosTween(const float t); ///< return (0.5f - (Cos(t * pi) * 0.5f));
2514 float CosArc(const float t); ///< return (-((Cos(Deg2Rad(360.0f * t)) - 1.0f) * 0.5f));
2515 float SmoothStep(const float from, const float to, const float t); ///< Interpolates between min and max with smoothing at the limits.
2516 float HermiteBlend(const float a, const float b, const float t);
2517 float Min(const float a, const float b); ///< Returns the smallest of the two values
2518 float Max(const float a, const float b); ///< Returns the largest of the two values
2519 const int f2i(const float f); ///< IEEE 754 float to int
2520 const float i2f(const int i); ///< int to IEEE 754 float
2521 const float pi = 3.1415927f;
2522 const float tau = 6.2831855f; ///< pi * 2
2523 const kVec3 vecZero(0.0f, 0.0f, 0.0f);
2524}
2525
2526namespace kexColors ///< Not used (garbage included automatically from kexengine)
2527{
2528 const kColor white; ///< 255, 255, 255, 255
2529 const kColor gray; ///< 127, 127, 127, 255
2530 const kColor black; ///< 0, 0, 0, 255
2531 const kColor red; ///< 255, 0, 0, 255
2532 const kColor green; ///< 0, 255, 0, 255
2533 const kColor blue; ///< 0, 0, 255, 255
2534 const kColor yellow; ///< 255, 255, 0, 255
2535 const kColor orange; ///< 255, 127, 0, 255
2536 const kColor cyan; ///< 0, 255, 255, 255
2537 const kColor magenta; ///< 255, 0, 255, 255
2538 const kColor transparent; ///< 0, 0, 0, 0
2559}
2560
2561/**
2562 * @brief
2563 * @param s the string you want to split
2564 * @param sep the separators you want to use to split the string
2565 @code{.cpp}
2566 kStr myString = "Hello,World!";
2567 kStrSplit(myString, ",");
2568 for(uint i = 0; i < kStrSplitLength(); i++)
2569 {
2570 kStr stringPart = kStrSplitGet(i);
2571 Sys.Print("SplitStrings[" + i + "] len=" + stringPart.Length() + ": " + stringPart);
2572 }
2573 kStrSplitClear();
2574 @endcode
2575 */
2576void kStrSplit(const kStr &in s, const kStr &in sep);
2577kStr kStrSplitGet(const int index); ///< returns the string at index
2578uint kStrSplitLength(); ///< returns the amount of strings that were split
2579void kStrSplitClear(); ///< clear the list of split strings after your done. Not required to call because it gets cleared when you call kStrSplit but if you don't want those strings still hanging around you can clear them now.
2580void GameVarsSetAdd(const kStr &in key, const kStr &in value); ///< Adds the key and value to GameVariables if it doesn't exist otherwise sets the existing keys value.
2581void GameModFileDataSetAdd(const kStr &in key, const kStr &in value); ///< Adds the key and value to GameModFileData if it doesn't exist otherwise sets the existing keys value.
2582kColor kexColor_FromHSL(float hue, float sat, float lit); ///< Not used. (garbage from kexengine)
2583kColor kexColor_Random(); ///< Not used. (garbage from kexengine)
2584kColor kexColor_Tab20(uint i); ///< Not used. (garbage from kexengine)
2585kColor kexColor_Tab20Dark(uint i); ///< Not used. (garbage from kexengine)
2586kColor kexColor_Tab20Light(uint i); ///< Not used. (garbage from kexengine)
2587kColor kexColor_ViridisScale(float v); ///< Not used. (garbage from kexengine)
2588kColor kexColor_LerpRGB(const kColor&in from, const kColor&in to, float time); ///< Not used. (garbage from kexengine)
2589int kexRandInt(); ///< Range -2147483648..2147483647
2590uint kexRandUInt(); ///< Range 0..4294967295
2591void delay(const float time); ///< used in map scripts to delay execution of script
2592const float GAME_FRAME_TIME = 0.25f;
2593const float GAME_DELTA_TIME = 0.016666668f;
2594const float GAME_FRAME_UNIT = 4.0f;
2595const float GAME_SECONDS = 0.06666667f;
2596const float GAME_SCALE = 10.24f;
2599kDict GameModFileData; ///< Use with Game.SaveModFile, Game.LoadModFile, and Game.LoadModDataFile
void kStrSplit(const kStr &in s, const kStr &in sep)
EnumPlayerConButtons
@ CBC_AUTOMAP
@ CBC_WEAPON14
@ CBC_MENUACTIVATE
@ CBC_WEAPON9
@ CBC_WEAPON5
@ CBC_WEAPON11
@ CBC_RUNWALK
@ CBC_WEAPON6
@ CBC_MENUCANCEL
@ CBC_WEAPON1
@ CBC_WEAPON10
@ CBC_MENULEFT
@ CBC_WEAPON3
@ CBC_WEAPON13
@ CBC_MENURIGHT
@ CBC_WEAPON4
@ CBC_WEAPON12
@ CBC_MENUDESELECT
@ CBC_MENUUP
@ CBC_MENUDOWN
@ CBC_WEAPON7
@ CBC_WEAPON8
@ CBC_CHANGEAMMO
@ CBC_MENUSELECT
@ CBC_MENUBACK
@ CBC_WEAPON2
float RandRange(const float min, const float max)
Returns a random float number between and min [inclusive] and max [inclusive].
EnumCheatFlags
@ GC_INVINCIBILITY
@ GC_FLIGHT
@ GC_PURDY_COLORS
@ GC_TINY_ENEMY
@ GC_ALL_MAP
@ GC_INFINITE_AMMO
@ GC_SPIRIT_MODE
@ GC_BIG_HEADS
@ GC_DISCO
@ GC_NOCLIP
@ GC_INFINITE_LIVES
@ GC_SHOW_ENEMIES
float Sqrt(float f)
Returns square root of f.
const float tau
pi * 2
kSys Sys
EnumGameFontType
@ GFT_BIG
@ GFT_SMALL
@ GFT_NUMBERS
@ GFT_TTF
float Ceil(float f)
Returns the smallest integer greater to or equal to f.
float SmoothStep(const float from, const float to, const float t)
Interpolates between min and max with smoothing at the limits.
float Min(const float a, const float b)
Returns the smallest of the two values.
float RandCFloat()
Range -1..1.
kGame Game
kColor kexColor_ViridisScale(float v)
Not used. (garbage from kexengine)
uint kexRandUInt()
Range 0..4294967295.
int RandMax(const int max)
Range 0..max-1.
EnumCameraLerpType
Lerp type when doing AutoPlayPositionTrack, AutoPlayRotationTrack, or AutoPlayBlendTrack....
@ CMLT_COSINE
time will never be higher than speed. time = CosTween(time * (1.0f / speed));
@ CMLT_LINEARLOOP
time is set to time / speed. If time is > 1.0 then time -= 1.0
@ CMLT_COSINE_POW
time will never be higher than speed. time = CosTween(Pow(time * (1.0f / speed), 3));
@ CMLT_LINEAR
time is set to time / speed.
@ CMLT_NONE
time is set to time / speed.
float Rad2Deg(float rads)
Radians-to-Degrees conversion.
const float GAME_DELTA_TIME
kColor kexColor_Tab20(uint i)
Not used. (garbage from kexengine)
void GameModFileDataSetAdd(const kStr &in key, const kStr &in value)
Adds the key and value to GameModFileData if it doesn't exist otherwise sets the existing keys value.
float ACos(float f)
Returns the arc-cosine of f - the angle in radians whose cosine is f.
float CosTween(const float t)
return (0.5f - (Cos(t * pi) * 0.5f));
EnumActorSpawnFlags3
@ ASF3_MAKESPAWNANIMVISIBLE
clears actor flags: ~(AF_HIDDEN|AF_DISABLED)
@ ASF3_PROJECTILEATTACK9
Demon chest Hadoken (anim_aiRangeAttack9)
@ ASF3_NOTHINKER
AI will not function. Actors will not update movement. Actors OnBeginLevel will set their animation t...
@ ASF3_PLAYTRIGGERANIMONCE
MarkPersistentBit(false) when activated.
@ ASF3_KILLOUTSIDEOFVIEW
NOT USED.
@ ASF3_PROJECTILEATTACK10
High Priest Lightning Red Flames (anim_aiRangeAttack10)
@ ASF3_RETURNWARP
Used in portal scripts.
@ ASF3_WALKINSTRAIGHTLINE
Set animation to Blend(ANIM_WALKING, (m_animSpeed * m_animScalar), 10, ANF_LOOP|ANF_ROOTMOTION); and ...
@ ASF3_AVOIDPLAYERS2
NOT USED.
@ ASF3_REGENERATEFROMSTART
Regen from starting position.
@ ASF3_NOVIOLENTDEATH
ANIM_AIDEATHSTAND and ANIM_DEATHSTANDALT will not play when kAI is killed.
@ ASF3_NODRAWONCAMERA
Will not draw this actor when viewing from camera unless camera flags has CMF_SHOW_HIDDEN_OBJECTS.
float Accelerate(const float val, const float accel, const float max)
return val that increases by accel in a weird way to the max value.
kColor kexColor_Tab20Light(uint i)
Not used. (garbage from kexengine)
float Floor(float f)
Returns the largest integer smaller to or equal to f.
EnumClipResultFlags
@ CRF_NOCOLLISION
@ CRF_MESH
made contact with a static object
@ CRF_ADJUST
z-axis was adjusted (ceiling or floor)
@ CRF_FLOOR
made contact with a floor
@ CRF_WALL
made contact with an edge (sector edge that isn't linked to another sector)
@ CRF_CEILING
made contact with a ceiling
@ CRF_WALLRADIUS
made contact with an edge during the wall radius collision test
@ CRF_OBJECT
made contact with an actor
kDict GameModFileData
Use with Game.SaveModFile, Game.LoadModFile, and Game.LoadModDataFile.
float Lerp(float start, const float end, const float time)
Linearly interpolates between start and end by time.
EnumClipFlags
@ CF_HITSCAN
performs a single-pass trace. useful for hitscans
@ CF_COLLIDEPLAYERBLOCKER
collide with edges linked to player blocking regions (AAF_WARPRETURN)
@ CF_CHECKLINKEDBRIDGES
do extensive checks against overlapping bridge sectors
@ CF_NOCLIPTARGETACTORS
don't clip actors that are targeted by moving object
@ CF_ALLOWCRAWL
collide with sectors flagged as crawlable
@ CF_STANDONOBJECTS
allow vertical clipping of objects
@ CF_ALLOWRESTRICTEDAREAS
don't collide with edges belonging to a restricted sector
@ CF_COLLIDEFLOORS
project and clip movement against non-flat floors
@ CF_USEWALLRADIUS
clip and project movement away from walls based on wall radius
@ CF_DROPOFF
allows passing through platforms or ledges
@ CF_NOCLIPSTATICS
don't collide with static models
@ CF_ALLOWCLIMB
collide with sectors flagged as climbable
@ CF_NOEXITWATER
block all edges that links to a non-water sector
@ CF_WALKWALLS
don't restrict movement to steep slopes
@ CF_NOCOLLIDEFUNC
don't invoke the OnCollide callback on the moving object
@ CF_COLLIDETRIGGERS
block edges belonging to a trigger. Can't cross into sectors if sector has AAF_EVENT.
@ CF_NOEXITWALLS
clip all edges, regardless if they link to another sector or not
@ CF_COLLIDECORPSES
clip against actors flagged as dead
@ CF_POLYCOLLISION
clip movement against all model polygons of an object
@ CF_NOSTEPDOWN
don't clamp z-axis when walking down slopes
@ CF_NOENTERWATER
block all edges that links to a water sector
@ CF_NOCLIPACTORS
don't collide with dynamic objects/actors
@ CF_COLLIDEHEIGHT
clip against ceilings
@ CF_COLLIDECLIFFS
collide with non-walkable floors
@ CF_NOFLOORADJUST
don't keep z-axis above floor plane
@ CF_NOCEILINGADJUST
don't keep z-axis below ceiling plane
@ CF_NOSLOPESTEP
don't project z-axis movement along slopes
@ CF_IGNOREBLOCKERS
don't clip edges belonging to blocking sectors
@ CF_CLIPEDGES
clip movement against edges that don't link to sectors
@ CF_COLLIDEWATER
clip movement against the water surface
@ CF_GREASESLIDEOBJECTS
always keep movement projected away from collided objects
kCamera Camera
EnumAnimStateFlags
@ ANF_ROOTMOTION
@ ANF_LOOP
@ ANF_NOINTERRUPT
@ ANF_PAUSED
@ ANF_BLEND
@ ANF_STOPPED
@ ANF_LINEARBLEND
@ ANF_CYCLECOMPLETED
const float GAME_FRAME_UNIT
EnumCustomHUDFlags
@ CHF_ALPHASCALE
Scales color alpha values by the HUD opacity menu option.
@ CHF_HIDEMENU
Hide when menu is active.
@ CHF_HIDENOHUD
Hide when Show HUD menu option is off.
@ CHF_HIDECINEMA
Hide when cinema is active.
@ CHF_HIDEDUMMYMENU
Hide when dummy menu is active.
EnumPlaneSide
@ PSIDE_BACK
@ PSIDE_ON
@ PSIDE_FRONT
EnumInputActions
@ IA_JUMP
@ IA_CUSTOM2
@ IA_FORWARD
@ IA_ATTACK
@ IA_STRAFELEFT
@ IA_WEAPNEXT
@ IA_MAPZOOMIN
@ IA_WEAPPREV
@ IA_CUSTOM1
@ IA_STRAFERIGHT
@ IA_BACKWARD
@ IA_MAPZOOMOUT
kPlayer Player
float IncMax(const float val, const float inc, const float dest)
returns val +(or minus) inc and never goes above or below dest value
EnumSectorPlatformFlags
@ SPF_FLOORVERTS
Changes sectors verts origin.
@ SPF_MOVEPLAYER
Moves player.
@ SPF_USEMOVETOFORPLAYER
Uses the MoveToPosition function to set the Players origin. else sets origin.
@ SPF_MOVEOTHERACTORS
Moves other actors on the sectors that are not the player or AI.
@ SPF_MOVEAI
Moves AI.
@ SPF_SAMEAREA
Effects sectors only with the same area as the starting sector.
@ SPF_DEFAULT
@ SPF_USEMOVETOFORAI
Uses the MoveToPosition function to set the AI origin. else sets origin.
@ SPF_MOVEPLAYERINAIR
Player moves with the sectors even in the air.
@ SPF_USEMOVETOFOROTHER
Uses the MoveToPosition function to set other actors origin. else sets origin.
@ SPF_CEILINGVERTS
Changes sectors verts heights.
kexLocPlatform_e
< Not used (garbage included automatically from kexengine)
@ LocPlatform_XboxSeries
@ LocPlatform_Current
@ LocPlatform_PlayStation5
@ LocPlatform_XboxOne
@ LocPlatform_Mac
@ LocPlatform_Switch
@ LocPlatform_WindowsStore
@ LocPlatform_Linux
@ LocPlatform_Windows
@ LocPlatform_PlayStation4
@ LocPlatform_UserPlatformCount
@ LocPlatform_FirstUserPlatform
EnumWaterLevel
@ WLT_BETWEEN
In water sector and floating above the water.
@ WLT_INVALID
Not in water sectors.
@ WLT_OVER
In water sector but over the water height.
@ WLT_UNDER
In water sector and under the water height.
kColor kexColor_Random()
Not used. (garbage from kexengine)
uint kStrSplitLength()
returns the amount of strings that were split
EnumImpactType
@ IT_STONE
@ IT_DEFAULT
@ IT_FORCEFIELD
@ IT_SLIME
@ IT_FLESH_CREATURE
@ IT_LAVA
@ IT_FLESH_HUMAN
@ IT_WATER
@ IT_FLESH_UNDEAD
AKA IT_FLESH_WATER. Not used in the remaster for anything by default. In the original game if an Fx w...
@ IT_METAL
const int f2i(const float f)
IEEE 754 float to int.
int Abs(int i)
Returns the absolute value of i.
kCModel CModel
float Log(float f)
Returns the natural (base e) logarithm of a specified number.
const float GAME_SECONDS
float InvSqrt(float f)
Returns inverse square root of f.
kColor kexColor_LerpRGB(const kColor &in from, const kColor &in to, float time)
Not used. (garbage from kexengine)
EnumWeaponStates
@ WS_LOWER
@ WS_FIRE
Is currently firing.
@ WS_FIREUNDERWATER
NOT USED.
@ WS_RAISE
@ WS_RUN
NOT USED.
@ WS_WALK
NOT USED.
@ WS_IDLE
@ WS_HOLDSTER
Set when dead (with no death cinematic) or when climbing. Should set weapon anim to ANIM_WEAPONSWAPOU...
@ WS_DISCHARGE
set after OnEndFire is called. If was in WS_FIRE state and not pressing the Attack button.
kColor kexColor_FromHSL(float hue, float sat, float lit)
Not used. (garbage from kexengine)
EnumPlayerFlags
@ PF_NOTOUCH
disables invoking onTouch callbacks
@ PF_GOD
Is reset when level beings.
@ PF_FALLINGDEATHPIT
currently falling in a death pit. Cleared after level begins.
@ PF_WEAPONSTEAL
on when campaigner steals weapon
@ PF_CRAWLING
@ PF_JUMPING
is jumping (moving up). flag is off when reached max jump height or let go of jump button.
@ PF_NOCLIP
@ PF_HASJUMPED
@ PF_FIREDPROJECTILE
set when FireProjectile is called. Cleared OnTick if weapon is not in WS_FIRE state and player is not...
@ PF_NOSECTORMUSIC
disables music changes when changing sectors
@ PF_NOCEILINGGLIDE
disables the ceiling glide glitch
@ PF_DEAD
@ PF_INWARPAREA
in sector area with AAF_TELEPORT flag.
@ PF_FLY
@ PF_PREVENTDEATHCAM
will stop the death cinematic or the deadAnimView from triggering when the player dies.
@ PF_CLIMBTHRUST
@ PF_NOAIRFRICTION
float Tan(float f)
Returns the tangent of angle f in radians.
const float GAME_FRAME_TIME
EnumGameButtonEvents
@ GBE_MENU_SELECT
@ GBE_MENU_DESELECT
@ GBE_MENU_DOWN
@ GBE_MENU_UP
@ GBE_MENU_ACTIVATE
@ GBE_MENU_LEFT
@ GBE_MENU_CANCEL
@ GBE_MENU_MOUSESELECT
@ GBE_MENU_RIGHT
@ GBE_MENU_BACK
EnumActorFlags
@ AF_NOMOVEMENT
will not do collision movement
@ AF_CLIMBWALLS
allows entering of wall sectors
@ AF_REMOVEONCOMPLETION
remove after finishing a special animation
@ AF_SNAPTOFLOOR
adjust z-axis to floor on spawn
@ AF_ALWAYSACTIVE
never sleep or go dormant
@ AF_HIDDEN
don't draw but continue updating. can't be collided
@ AF_TRIGGERSTUFF
NOT USED.
@ AF_COLLIDEDWITHWALL
collided with an edge. cleared at every OnTick call
@ AF_WOUNDEDMORTALLY
if on this actor will drop a mortal wound because it was hit by a super arrow shot
@ AF_CANBETOUCHED
allow invoking the OnTouch callback
@ AF_IGNORESOUNDEVENTS
don't call kexAnimState::Action_PlaySound
@ AF_NODRAW
don't render
@ AF_DISABLED
don't update animations
@ AF_DEAD
actor is dead. handle special cases for collision
@ AF_CASTSHADOW
can cast a simple shadow
@ AF_ALLOWTINYENEMYCHEAT
affected by tiny enemy game cheat
@ AF_SOLID
Can be collided.
@ AF_STAYINWATER
can't exit water sectors
@ AF_ALIGNTOFLOOR
rotate along slopes
@ AF_INVINCIBLE
will not receive damage. OnDamage and OnDeath are never called
@ AF_AVOIDWATER
clip against edges linking to water sectors
@ AF_NONSHOOTABLE
Fx won't hit actors if this flag is set.
@ AF_FLOATINWATERONDEATH
rise to the surface while dead
@ AF_ACTIVATED
was triggered
@ AF_NOBLOOD
don't spawn particles flagged as blood
@ AF_ENTEREDAREAEVENT
just entered a trigger sector
@ AF_DORMANT
if on then is asleep (won't be updated onTick) else is awake
@ AF_TRIGGERANIMATION
play special animation on trigger/spawn
@ AF_TRIGGERNAIMDELAY
delay a bit before starting special animation
@ AF_HOLDTRIGGERANIM
pause special animation until triggered (is also invincible)
@ AF_STATIONARY
Sniper. don't update the animation's root motion.
@ AF_FULLVOLUME
all sounds coming from this actor will be heard at full volume
EnumActorSpawnFlags1
@ ASF1_CLIMBWALLS
@ ASF1_SNAPTOFLOOR
@ ASF1_CASTSHADOW
sets AF_CASTSHADOW on SetSpawnParams
@ ASF1_FLOATINWATERONDEATH
kAI will float up to the top of the water when they are dead
@ ASF1_RANDOMFEIGNDEATH
NOT USED.
@ ASF1_SCREENSHAKE
Used in floor mover scripts to shake screen.
@ ASF1_PROJECTILEATTACK2
Pistol Fire (anim_aiRangeAttack2)
@ ASF1_KAMIKAZE
if has no target then targets player and sets agitation to 300
@ ASF1_AVOIDPLAYERS
NOT USED.
@ ASF1_TELEPORTAVOIDCLIFFS
@ ASF1_NOWALLCOLLISION
NOT USED.
@ ASF1_FLOCKER
flocks to a leader kAI
@ ASF1_CANNOTCAUSEAFIGHT
if another actor was damaged by this actor with this flag set then other actor will not target this a...
@ ASF1_FLYING
NOT USED.
@ ASF1_USEWEAKATTACKS
anim_aiAltMelee1
@ ASF1_LEADER
Flocker ai run toward Leaders to get attention.
@ ASF1_SOLID
@ ASF1_RANDOMRESURRECTION
NOT USED.
@ ASF1_DIEONEXPLOSION
NOT USED.
@ ASF1_PROJECTILEATTACK1
High Priest Flame Attack (anim_aiRangeAttack1)
@ ASF1_SNIPER
@ ASF1_NOREPEATEXPLOSION
NOT USED.
@ ASF1_EXPLOSIONDEATH
NOT USED.
@ ASF1_AVOIDWATER
sets AF_AVOIDWATER on SetSpawnParams
@ ASF1_MELTONDEATH
allows melt effect and regeneration
@ ASF1_RESPAWNANIMATION
Enables respawning animation effect.
@ ASF1_TELEPORTAVOIDWATER
@ ASF1_TELEPORTWAIT
allows enemy to move around for 1.5 - 4.5 seconds before teleporting back in.
@ ASF1_TRIGGERSTUFF
Sets AF_TRIGGERSTUFF on SetupSpawnParams.
@ ASF1_USESTRONGATTACKS
anim_aiMelee1
@ ASF1_TELEPORT
allows kAI to teleport on SetupAISpawnFlags
@ ASF1_SLOW
NOT USED.
EnumAreaFlags
@ AAF_CHECKPOINT
@ AAF_EVENT
@ AAF_CLIFF
is a wall
@ AAF_LAVA
@ AAF_ENTERCRAWL
Exactly the same as AAF_CRAWL except actors won't collide with this sector when CF_ALLOWCRAWL is not ...
@ AAF_DAMAGE
@ AAF_SHALLOWWATER
@ AAF_CRAWL
@ AAF_BLOCK
@ AAF_REPEATABLE
Unused. In the original game this is used in combination with AAF_EVENT and will only trigger the eve...
@ AAF_CLIMB
climb up sectors faster than AAF_LADDER
@ AAF_ANTIGRAVITY
@ AAF_MAPPED
@ AAF_DEATHPIT
@ AAF_ONESIDED
Bridge.
@ AAF_ENTERED
Not shown in Editor. Used in kex editor only for fill sector commands. When map is saved in kex edito...
@ AAF_SAVEGAME
@ AAF_DRAWSKY
@ AAF_TELEPORTAIR
@ AAF_WARPRETURN
In Remaster it's used as a PlayerBlocking sector. used with clipflag CF_COLLIDEPLAYERBLOCKER.
@ AAF_LADDER
climb up sectors slower than AAF_CLIMB
@ AAF_EVENTSOUND
@ AAF_RESTRICTED
kAI can't enter the area
@ AAF_CEILING
@ AAF_TELEPORT
@ AAF_SECRET
@ AAF_STOREWARPRETURN
Unused.
@ AAF_DRAWSUN
@ AAF_SLOPETEST
overrides AAF_CLIFF flag. If the sectors floor plane up direction is <= 0.5 then is a wall (a wall is...
@ AAF_TOGGLE
if on and AAF_BLOCK is on then sectors won't be marked on automap until it's unblocked....
@ AAF_WATER
@ AAF_HIDDEN
kColor kexColor_Tab20Dark(uint i)
Not used. (garbage from kexengine)
float Pow(float x, float y)
Returns f raised to power p.
float NLerp(const float a, const float b, const float t)
Calculates the linear parameter t that produces the interpolant value within the range [a,...
int Clamp(const int i, const int min, const int max)
Returns clamped value between min and max.
EnumPlayerStates
@ PS_SWIMMING
@ PS_JUMPING
@ PS_FALLDEATH
@ PS_CLIMBING
@ PS_UNDERWATER
@ PS_WALKING
@ PS_ANTIGRAVITY
int SysRand()
Range 0..32767.
const float i2f(const int i)
int to IEEE 754 float
const kVec3 vecZero(0.0f, 0.0f, 0.0f)
float ATan2(float y, float x)
Returns the angle in radians whose Tan is y/x.
int kexRandInt()
Range -2147483648..2147483647.
kPlayLoop PlayLoop
EnumPlayerButtons
@ BC_WEAPONRIGHT
@ BC_CUSTOM2
@ BC_ATTACK
@ BC_MAPZOOMOUT
@ BC_JUMP
@ BC_STRAFERIGHT
@ BC_BACKWARD
@ BC_STRAFELEFT
@ BC_CUSTOM1
@ BC_FORWARD
@ BC_MAPZOOMIN
@ BC_WEAPONLEFT
const float GAME_SCALE
EnumActorSpawnFlags2
@ ASF2_NOBLOOD
@ ASF2_DROPITEM_MASK6
Small Health.
@ ASF2_DROPITEM_MASK3
Medium Health.
@ ASF2_PROJECTILEATTACK8
High Priest Homing Blue Flame (anim_aiRangeAttack4)
@ ASF2_DROPITEM_MASK11
Shotgun Shells.
@ ASF2_UNUSED1
NOT USED.
@ ASF2_DROPITEM_MASK14
Clip.
@ ASF2_UNUSED2
NOT USED.
@ ASF2_DROPITEM_MASK12
Energy Cell.
@ ASF2_WARPDEATH
NOT USED.
@ ASF2_NOAUTOMAPDRAW
if map all or show enemies cheats are on then will not draw this actor on the automap.
@ ASF2_DROPITEM_MASK1
Explosive shells.
@ ASF2_DROPITEM_MASK5
Ultra Health.
@ ASF2_PROJECTILEATTACK3
crouch rifle Fire (anim_aiRangeAttack7)
@ ASF2_PROJECTILEATTACK4
(anim_aiRangeAttack8)
@ ASF2_STAYINWATER
sets AF_STAYINWATER on SetSpawnParams
@ ASF2_DROPITEM_MASK10
4 Rockets
@ ASF2_HOLDTRIGGERANIMATION
@ ASF2_DROPITEM_MASK13
Large Energy Cell.
@ ASF2_DROPITEM_MASK2
Grenade.
@ ASF2_STOREWARPRETURN
Used in portal scripts.
@ ASF2_ALTERNATEMOVES
is for holding two handed weapons
@ ASF2_MORTALWOUNDIMPACT
Can be hit by a super arrow shot and if ASF2_DROPITEM_MASK9 is on has a chance to drop a mortal wound...
@ ASF2_DROPITEMONDAMAGE
NOT USED.
@ ASF2_DROPITEM_MASK4
Full Health.
@ ASF2_PROJECTILEATTACK7
Grenade Throw (anim_aiRangeAttack3)
@ ASF2_PROJECTILEATTACK5
Stand Rifle Fire (anim_aiRangeAttack5)
@ ASF2_PROJECTILEATTACK6
Pipe Blow (anim_aiRangeAttack6)
@ ASF2_DROPITEM_MASK8
Minigun ammo.
@ ASF2_DROPITEM_MASK9
Mortal Wound.
@ ASF2_DROPITEM_MASK7
Large Health.
@ ASF2_REMOVEONCOMPLETION
Sets AF_REMOVEONCOMPLETION.
void kStrSplitClear()
clear the list of split strings after your done. Not required to call because it gets cleared when yo...
EnumCameraStates
@ CAMS_FADEIN
@ CAMS_RESTORE_TO_CLIENT
@ CAMS_ACTIVE_TO_FADEOUT
@ CAMS_IDLE
@ CAMS_FADEBACK_TO_CLIENT
@ CAMS_ACTIVE
@ CAMS_FADEOUT
float CosArc(const float t)
return (-((Cos(Deg2Rad(360.0f * t)) - 1.0f) * 0.5f));
kWorld World
const float pi
int Rand()
Range 0..32767.
void GameVarsSetAdd(const kStr &in key, const kStr &in value)
Adds the key and value to GameVariables if it doesn't exist otherwise sets the existing keys value.
uint8 RandByte()
Range 0..255.
float Cos(float f)
Returns the cosine of angle f in radians.
EnumDifficulty
@ DIFFICULTY_HARD
@ DIFFICULTY_HARDCORE
@ DIFFICULTY_NORMAL
@ DIFFICULTY_EASY
float Max(const float a, const float b)
Returns the largest of the two values.
class kScriptTMap Sin(float f)
Returns the sine of angle f in radians.
float Deg2Rad(float degs)
Degrees-to-radians conversion.
kDict GameVariables
EnumCameraFlags
@ CMF_CHANGE_MAP_AFTER_FADE
@ CMF_NO_LETTERBOX
@ CMF_NO_INITIAL_FADEOUT
@ CMF_SHOW_HIDDEN_OBJECTS
@ CMF_UNLOCK_PLAYER_ON_FINISH
@ CMF_NO_SUNLENSFLARE
Doesn't force the sun lens flare always on. Sun lens flare will work normally, using the "Always Show...
@ CMF_INITIAL_FADEIN
@ CMF_LOCK_PLAYER
@ CMF_SHOW_CREDITS
@ CMF_NO_INITIAL_FADEIN
float Clampf(const float f, const float min, const float max)
Returns clamped value between min and max.
kStr kStrSplitGet(const int index)
returns the string at index
EnumAIFlags
@ AIF_HEARDLOUDNOISE
@ AIF_NOTHINK
don't run ai logic
@ AIF_REGENERATEANIM
@ AIF_SEETARGET
@ AIF_REGENANIMDELAY
@ AIF_FIRSTATTACK
@ AIF_HEARDQUIETNOISE
@ AIF_ATTACKING
playing an attacking animation
@ AIF_AWAYFROMLEASH
@ AIF_GOBACKTOLEASH
@ AIF_WAITFORCYCLE
prevent other animations from interrupting until the current one finishes
@ AIF_RESSURECT
@ AIF_REGENERATE
@ AIF_NOCHASE
disable chase logic
@ AIF_TELEPORTING
in teleport state. ignore all chase logic
@ AIF_BLOWNAWAY
being blown away by explosion
@ AIF_GETATTENTION
@ AIF_WASSOLID
@ AIF_RUNNING
Is playing running animation.
@ AIF_TELEPORTIN
playing teleport in animation
@ AIF_TELEPORTAWAY
playing teleport out animation
@ AIF_TELEPORTMOVESLOW
chasing while underground
@ AIF_DAMAGEPANIC
become aggressive when target is outside its active threshold (good for forcing AI to attack their ta...
@ AIF_FEIGNDEATH
void delay(const float time)
used in map scripts to delay execution of script
float Fabs(float f)
Returns the absolute value of f.
float HermiteBlend(const float a, const float b, const float t)
kActorFactory ActorFactory
float RandFloat()
Range 0..1.
< Not used (garbage included automatically from kexengine)
const kColor magenta
255, 0, 255, 255
const kColor blue
0, 0, 255, 255
const kColor gray
127, 127, 127, 255
const kColor tab20blue2
const kColor tab20purple2
const kColor tab20cyan
const kColor tab20pink
const kColor green
0, 255, 0, 255
const kColor tab20brown2
const kColor white
255, 255, 255, 255
const kColor tab20blue
const kColor red
255, 0, 0, 255
const kColor cyan
0, 255, 255, 255
const kColor tab20green2
const kColor yellow
255, 255, 0, 255
const kColor tab20orange
const kColor tab20pink2
const kColor tab20orange2
const kColor tab20cyan2
const kColor tab20olive
const kColor tab20purple
const kColor tab20grey
const kColor tab20grey2
const kColor tab20green
const kColor orange
255, 127, 0, 255
const kColor transparent
0, 0, 0, 0
const kColor tab20red
const kColor black
0, 0, 0, 255
const kColor tab20brown
const kColor tab20red2
const kColor tab20olive2
funcdef bool less(const ?&in a, const ?&in b)
sorting function for sort
void resize(uint length)
Sets the new length of the array.
void insertAt(uint index, const T &in value)
Inserts a new element into the array at the specified index.
void sortAsc()
Sorts the elements in the array in ascending order. For object types, this will use the type's opCmp ...
void removeLast()
Removes the last element of the array.
int find(uint startAt, const T &in value) const
Returns the index of the first element that has the same value as the wanted value....
int findByRef(const T &in value) const
Searches for a matching address. These are especially useful for arrays of handles where specific ins...
void reverse()
Reverses the order of the elements in the array.
void removeRange(uint start, uint count)
Removes count elements starting from start.
uint length() const
Returns the length of the array.
void removeAt(uint index)
Removes the element at the specified index.
int find(const T &in value) const
Returns the index of the first element that has the same value as the wanted value....
void insertAt(uint index, const T[]&inout arr)
Inserts another array of elements into the array at the specified index.
void insertLast(const T &in value)
Appends an element at the end of the array.
void reserve(uint length)
const T & opIndex(uint index) const
T & opIndex(uint index)
void sortDesc()
Sorts the elements in the array in descending order. For object types, this will use the type's opCmp...
bool isEmpty() const
bool opEquals(const T[]&in) const
void sortDesc(uint startAt, uint count)
Sorts only the elements starting at index startAt and the following count elements in the array in de...
int findByRef(uint startAt, const T &in value) const
Searches for a matching address. These are especially useful for arrays of handles where specific ins...
void sort(less &in, uint startAt=0, uint count=uint(- 1))
sorts array using the passed in less function
T &[] opAssign(const T[]&in)
void sortAsc(uint startAt, uint count)
Sorts only the elements starting at index startAt and the following count elements in the array in as...
String class functions.
kStr & ToUpper()
Converts string to upper case characters.
bool IsEmpty() const
length of string is 0
kStr opAdd(uint16 i) const
kStr opAdd(uint i) const
bool ContainsNoCase(const kStr &in) const
contains the string ignoring case
kStr ReplaceSubstr(const kStr &in from, const kStr &in to) const
Returns a new kStr that replaced all occurrences of from with to.
int8 & opIndex(const uint64 i)
Get/Set the ASCII code of the character at the strings index.
kStr & ToLower()
Converts string to lower case characters.
kStr opAdd(uint64 i) const
bool opEquals(const kStr &in s) const
bool Contains(const kStr &in) const
contains the string
float Atof() const
Converts string to float.
uint64 Length() const
Returns the length of the string.
kStr opAdd(float f) const
kStr opAdd(int i) const
kStr opAdd(int16 i) const
kStr opAdd(const kStr &in s) const
kStr Substr(uint64 start, uint64 length) const
Return a substring from the current string. Will return the current string if start or length indexes...
kStr & opAddAssign(bool b)
kStr opAdd(int64 i) const
kStr(const kStr &in s)
kStr opAdd(bool b) const
const int8 opIndex(const uint64 i) const
Returns the ASCII code of the character at the strings index.
bool StartsWith(const kStr &in s) const
Returns true if this string starts with s.
int Atoi() const
Converts string to int.
uint Hash() const
Returns HashID from this instance.
kStr & opAddAssign(const kStr &in s)
kStr & opAssign(const kStr &in s)
uint64 IndexOf(const kStr &in s) const
Reports the zero-based index of the first occurrence of a specified string within this instance....
bool EndsWith(const kStr &in s) const
Returns true if this string ends with s.
Angle functions.
kAngle & opAssign(const float f)
kAngle opSub(const float f) const
kAngle(const kAngle &in other)
kAngle & opAssign(const kAngle &in a)
float Diff(const float rads) const
kAngle opNeg() const
float opImplConv()
kAngle & opSubAssign(const float f)
float Interpolate(const float a, const float b) const
float Diff(const kAngle &in other) const
kAngle & opAddAssign(const kAngle &in a)
kAngle & opAddAssign(const float f)
kAngle opAdd(const kAngle &in a) const
kAngle(float rads)
kAngle opSub(const kAngle &in a) const
kAngle & opSubAssign(kAngle &in a)
kAngle opAdd(const float f) const
Representation of 3D vectors and points.
kVec3 opAdd(const kVec3 &in v) const
kVec3 & opAssign(const kVec3 &in v)
kVec3 Cross(const kVec3 &in v) const
Cross Product of two vectors.
kVec3 opMul(const float val)
kVec3 & QuadraticCurve(const kVec3 &in pt1, const float value, const kVec3 &in pt2, const kVec3 &in pt3)
kVec3(float x, float y, float z)
float Length() const
Returns the length of this vector. Exactly the same as Unit()
float ToYaw()
Returns the Yaw direction in Rads.
void Set(const float x, const float y, const float z)
Set x, y and z components of this kVec3.
kVec3 opSub(const kVec3 &in v) const
kVec3 & CubicCurve(const kVec3 &in pt1, const float value, const kVec3 &in pt2)
kVec3 & opSubAssign(const kVec3 &in v)
kVec3 opDiv(const kVec3 &in v)
kVec3 & Normalize()
Makes this vector have a magnitude of 1.
kVec3 & Randomize(const float value)
Randomizes x, y, z, components by value.
kVec3 opDiv(const float val)
kVec3 & opAddAssign(const kVec3 &in v)
kVec3 & opDivAssign(const float f)
kStr ToString()
float Distance(const kVec3 &in other) const
Returns the distance between this instance and other vector.
kVec3 & opMulAssign(const kVec3 &in v)
kVec3 opMul(const kQuat &in rot) const
float LengthSq() const
Returns the squared length of this vector. Exactly the same as UnitSq()
kVec3(const kVec3 &in v)
kVec3 & opMulAssign(const float f)
kVec3 Lerp(const kVec3 &in other, const float t) const
Linearly interpolates between two vectors.
float UnitSq() const
Returns the squared length of this vector. Exactly the same as LengthSq()
kVec3 & Lerp(const kVec3 &in other, const float t)
Linearly interpolates between two vectors.
float ToPitch()
Returns the Pitch direction in Rads.
float opIndex(int i) const
kQuat ToQuat() const
kVec3 opAdd(const float f) const
kVec3 opSub(const float f) const
kVec3 & Project(const kVec3 &in normal, const float value)
Projects a vector onto another vector.
kVec3 & opMulAssign(const kQuat &in rot)
kVec3 & opAddAssign(const float f)
kVec3 & opDivAssign(const kVec3 &in v)
float & opIndex(int i)
kVec3 opMul(const kVec3 &in v)
kVec3 opNeg()
kVec3 & Reflect(const kVec3 &in normal, const float energyFactor)
Reflects a vector off the plane defined by a normal.
float DistanceSq(const kVec3 &in other) const
Returns the squared distance between this instance and other.
float Unit() const
Returns the length of this vector. Exactly the same as Length()
kQuat ToQuaternion() const
kVec3 & opSubAssign(const float f)
void Clear()
Sets x, y and z components to 0.
float Dot(const kVec3 &in v) const
Dot Product of two vectors.
Quaternions used to represent rotations.
kQuat Inverse() const
void GetAngles(float &out yaw, float &out pitch, float &out roll)
kQuat & NormalizeNoInvSqrt()
void Set(const float x, const float y, const float z, const float w)
kQuat(float angle, float x, float y, float z)
kQuat Diff(const kQuat &in rot) const
void Clear()
x,y,z = 0.0 w = 1.0
kStr ToString() const
kQuat opSub(const kQuat &in rot)
kQuat(float rotX, float rotY, float rotZ)
kQuat & opAssign(const kQuat &in rot)
kQuat(const kQuat &in other)
kQuat & opMulAssign(const kQuat &in rot)
kQuat(float angle, kVec3 &in vector)
kQuat & Normalize()
kQuat opAdd(const kQuat &in rot)
kQuat opMul(const kQuat &in rot)
kQuat Slerp(const kQuat &in rot, float t) const
float ToYaw() const
Yaw of this plane.
const kVec3 & Normal() const
float Distance(const kVec3 &in point) const
0 = PSIDE_ON. > 0 is PSIDE_FRONT. < 0 PSIDE_BACK.
kPlane(const float a, const float b, const float c, const float d)
float Dot(const kVec3 &in point) const
bool IsFacing(const float yaw) const
Returns true if yaw is facing toward the plane. Usually used for climbing sectors.
kPlane(const kVec3 &in a, const kVec3 &in b, const kVec3 &in c)
float Dot(const kPlane &in plane) const
kVec3 & Normal()
kPlane(const kAngle &in a)
const int PointOnSide(const kVec3 &in point) const
Returns EnumPlaneSide. If point is in front, behind or on the plane.
kPlane(const kVec3 &in a, const kVec3 &in b)
< Not used (included automatically from kexengine)
kColor(float r, float g, float b)
kColor opSub(const kColor &in c) const
kColor(const kColor &in rgb, uint8 a)
kColor & opAssign(const kColor &in c)
void FromVec3(const kVec3 &in v)
void HSLToRGB(float hue, float sat, float lit)
uint DwColor() const
void RGBToHSV(float &out hue, float &out sat, float &out result) const
kColor & opMulAssign(const kColor &in c)
kColor opMul(float f) const
kColor opAdd(const kColor &in c) const
kColor opMul(const kColor &in c) const
kColor(uint rgba)
void RGBToHSL(float &out hue, float &out sat, float &out lit) const
kColor(uint8 r, uint8 g, uint8 b, uint8 a)
kColor & opSubAssign(const kColor &in c)
kColor & opAddAssign(const kColor &in c)
float GetSaturation() const
kColor(const kColor &in c)
kColor(uint8 rgb, uint8 a)
bool opEquals(const kColor &in c) const
kVec3 ToVec3() const
void HSVToRGB(float hue, float sat, float val)
kVec3 ToVec3Linear() const
float GetLuminance() const
kColor ToPreMultiplied() const
void SetLuminance(float)
void PreMultiply()
void FromVec3Linear(const kVec3 &in v)
kColor & opMulAssign(float f)
void SetGrayScale()
void SetSaturation(float)
void LerpRGB(const kColor &in c, float t)
< Not used (garbage included automatically from kexengine)
bool WriteByte(const uint8 i)
uint8 ReadByte()
< Not used (garbage included automatically from kexengine)
kStr GetGroupString(int key, uint groupIndex, uint plat) const
plat: kexLocPlatform_e
kStr TranslateGroupString(const kStr &in key, uint groupIndex, uint plat) const
plat: kexLocPlatform_e
kStr GetString(const kStr &in key, kexLocPlatform_e plat) const
kStr TranslateStringWithArgs(const kStr &in key, const kDict &in pairs, uint plat) const
plat: kexLocPlatform_e
uint GetGroupIndex(const kStr &in groupName)
kStr GetGroupString(const kStr &in key, uint groupIndex, uint plat) const
plat: kexLocPlatform_e
kStr TranslateGroupStringWithArgs(const kStr &in key, const kDict &in pairs, uint groupIndex, uint plat) const
plat: kexLocPlatform_e
kStr TranslateString(const kStr &in key, kexLocPlatform_e plat) const
kStr GetString(int key, kexLocPlatform_e plat) const
kStr TranslateString(const kStr &in key) const
Same as Game.GetLocalizedText.
bool opEquals(const ref &in) const
ref(const ?&in)
~ref()
ref(const ref &in)
ref & opHndlAssign(const ?&in)
bool opEquals(const ?&in) const
ref & opHndlAssign(const ref &in)
void opCast(?&out)
ref obj
Access to ScriptObject class script obj ref. Should never be null.
ref obj
Access to ScriptObjectFx class script obj ref. Should never be null.
Actor script classes must inherit from this class.
void OnCollisionStart()
Collision Movement Check is starting.
void OnSleep()
void OnMenuTick()
called only when dummymenu active
void OnCollide(kCModel@)
called even if alseep
void OnRemoved()
called when actor is removed (Internally or through scripting). IsStale will return true immediately ...
void OnPreDamage(kActor @instigator, kDictMem @damageDef, const int damage)
always called when damaged even after death. Call OverrideOnDamageValue on the actor if you need to o...
void OnActivate()
void OnSpawn()
Required.
void OnEndLevel()
void OnTouch(kActor @theActorThatTouchedMe)
called even if alseep
void OnDeactivate()
Never used.
void OnPostBeginLevel()
void OnDamage(kActor @instigator, kDictMem @damageDef, const int damage)
always called even after death
void OnBeginLevel()
void OnCollisionFinish()
Collision Movement Check has ended.
void OnRestore()
void OnDeath(kActor @killer, kDictMem @damageDef)
called only when actor dies
void OnTick()
Required.
Weapon script classes must inherit from this class.
void OnBeginFire()
Required.
void OnLower()
Required.
void OnRaise()
Required.
void OnFire()
Required.
void OnEndFire()
Required.
void OnHoldster()
Required.
Player script class must inherit from this class.
void OnPickup(kActor @pickup)
void OnArmorDamage(kActor @instigator, kDictMem @damageDef, const int damage)
Fx script class must inherit from this class.
void OnExpire()
Called OnTick.
bool OnImpactFloor(int impactType, const kVec3 &in normal)
bool OnImpactWall(int impactType, const kVec3 &in normal)
void OnCollide(kCModel @pCModel)
Called just before any of the OnImpact functions (except water).
void OnImpactWater()
Called OnTick after Fx Movement update.
void OnCollidePost()
Called right after OnCollide and the OnImpact functions (except water).
void OnRemoved()
called when actor is removed (Internally or through scripting). IsStale will return true immediately ...
void OnCollisionFinish()
Collision Movement Check has ended.
bool OnImpactObject(int impactType, int impactDmgType, kActor@ actor, const kVec3 &in normal)
void OnCollisionStart()
Collision Movement Check is starting.
bool OnImpactCeiling(int impactType, const kVec3 &in normal)
void OnTick()
Required.
Editable Dictionary object that holds keys and values.
void SetValue(const kStr &in key, const kStr &in value)
Sets the value for the specified key.
void Empty()
Removes all keys/values.
bool GetBool(const kStr &in key, bool &out boolResult, const bool defaultValue=false)
Returns true if found the key as a bool type.
void Add(const kStr &in key, const kStr &in value)
Adds a new key/value.
bool GetInt(const kStr &in key, int &out intResult, const int defaultValue=0)
Returns true if found the key as a int type.
bool GetString(const kStr &in key, kStr &out stringResult)
Returns true if found the key as a kStr type.
bool GetVector(const kStr &in key, kVec3 &out vectorResult)
Returns true if found the key as a kVec3 type.
bool GetFloat(const kStr &in key, float &out floatResult, const float defaultValue=0)
Returns true if found the key as a float type.
const bool HasKey(const kStr &in key)
Returns true if key exists.
Read only Dictionary object that holds keys and values.
bool GetVector(const kStr &in key, kVec3 &out vectorResult)
Returns true if found the key as a kVec3 type.
bool GetBool(const kStr &in key, bool &out boolResult, const bool defaultValue=false)
Returns true if found the key as a bool type.
bool GetFloat(const kStr &in key, float &out floatResult, const float defaultValue=0)
Returns true if found the key as a float type.
bool GetString(const kStr &in key, kStr &out stringResult)
Returns true if found the key as a kStr type.
bool GetInt(const kStr &in key, int &out intResult, const int defaultValue=0)
Returns true if found the key as a int type.
const uint GetNumEntries() const
returns number of items in the list
kSelectionListInt & opAssign(const kSelectionListInt &in other)
void AddItem(int item, const int weight)
void Reset()
clears all items in the list
int & Select()
Returns a value based on item weights.
kSelectionListFloat & opAssign(const kSelectionListFloat &in other)
const uint GetNumEntries() const
returns number of items in the list
void AddItem(float item, const int weight)
void Reset()
clears all items in the list
float & Select()
Returns a value based on item weights.
void SetVisibility(const int nodeIndex, const bool visible)
kVec3 GetNodeScale(const int node)
kStr GetAnimFile() const
kQuat GetNodeRotation(const int node)
Is calculated on draw. Can call ForceUpdateJoints if you need the current value for interpolation.
kVec3 & PrevOffset()
const int GetNumNodes() const
kVec3 GetNodeOrigin(const int node, const kVec3 &in offset)
Is calculated on draw. Can call ForceUpdateJoints if you need the current value for interpolation.
void HideSection(const int nodeIndex, const int section, const bool hide)
section is the surface index. must be 0-31 and must not be >= number of surfaces or will do nothing.
void ColorOverrideSections(const int node, const int sectionMask=-1)
enable the color override for specific sections(materials) on the node by setting each bit....
void SetMorphUpdating(const bool bUpdate)
Set Morph Updating.
void SetMorphFrame(const int frame, const int nextFrame, const float time)
void SetTexture(const int section, const int textureID)
void SetRotationOffset(const int nodeIndex, const float rads, const float x, const float y, const float z, const bool clearInterpolation=false)
void AddTrailEffect(const kStr &in trailName, const int nodeIndex)
const bool IsMorph() const
void ColorOverride(const int node, const float r=1.0f, const float g=1.0f, const float b=1.0f, const float a=1.0f)
color values range from -1.0f to 1.0f. Call ColorOverrideSections to enable the override for sections...
void SetRotationOffset(const int nodeIndex, const kQuat &in rotation, const bool clearInterpolation=false)
const int GetNumAttachedTrails()
void ForceUpdateJoints(const float interpolatedFraction=1.0f)
Force update node matrices and then call GetNodeOrigin/GetNodeRotation to get current value....
void GetMorphFrame(int &out frame, int &out nextFrame, int &out maxFrames, float &out time) const
Get Morph frame info.
kVec3 & Offset()
void SetModel(const kStr &in modelPath, const kStr &in modelAnimPath)
kStr GetModelFile() const
void ScaleOverride(const int node, const kVec3 &in scale)
void RemoveTrailEffect()
Removes all trail effects.
const float TrackTime()
time from 0(on first frame) to 1(on last frame).
const bool CycleCompleted() const
(flags & ANF_CYCLECOMPLETED) != 0
const int LoopFrame()
The frame the animation loops back to when it reaches the last frame. Returns -1 if no animation set.
void Blend(const int animID, float speed, float blend, int flags)
EnumAnimStateFlags.
kVec3 rootMotion
the move direction of the root node from the prev frame to the current frame.
const int GetAnimNumFrames(const int animID)
void Set(const int animID, float speed, int flags)
EnumAnimStateFlags.
kVec3 GetOrigin(const int animID, int nodeNum, int frame)
void Stop()
flags |= ANF_STOPPED; flags &= ~ANF_LOOP;
const int NumFrames()
number of frames in this animation. Returns -1 if no animation set.
const int CurrentFrame()
current frame playing for the current animation. Must have an animation action keyframe for this to w...
void Set(const int animID, float speed, int flags, const int frame, const bool runActions=true, const bool noSoundActions=false)
EnumAnimStateFlags. Sets the animation to the frame while optionally running all previous actions.
void Resume()
flags &= ~ANF_PAUSED;
const float PlayTime()
increases by GAME_DELTA_TIME if not stopped or paused.
void Pause()
flags |= ANF_PAUSED;
const int TrackNextFrame(void) const
next frame to play for the current animation.
void SetPlayTime(const float time)
The total time in seconds this animation has been playing.
void SetLastFrame(const bool execActions=false)
if execActions is true, runs all key frame actions in the animation except Footstep(55) and PlaySound...
const bool Looping() const
(flags & ANF_LOOP) != 0
kQuat GetRotation(const int animID, int nodeNum, int frame)
const bool Blending() const
(flags & ANF_BLEND) != 0
int flags
EnumAnimStateFlags.
float baseOffset
is somewhat the Z position of the root node. It's calculated as follows whenever the root motion is u...
const bool Stopped() const
(flags & ANF_STOPPED) != 0
bool IsPlaying(const int animID)
Returns true if current animations ID is animID and the animation is not stopped.
void Blend(const int animID, float speed, float blend, int flags, const int frame, const bool runActions=true, const bool noSoundActions=false)
EnumAnimStateFlags. Blends the animation to the frame while optionally running all previous actions.
void SetTrackTime(const float time)
0.0(first frame) to 1.0(last frame)
bool CheckAnimID(const int animID)
checks if animID exists
void ChangeSpeed(const float speed)
Scales speed of the current animation where 1.0 = 15fps and 4.0 = 60fps.
const int NumNodes()
number of nodes in this animation. Returns -1 if no animation set.
const int PlayingID() const
the current animations ID
const int TrackFrame(void) const
current frame playing for the current animation.
Base type used by all actors.
bool & DrawDelay()
Don't draw until has ticked once.
kVec3 GetTransformedVector(const kVec3 &in vector)
kVec3 DamageOrigin(void) const
The Origin point of the attacker (Fx, Actor, or null (returns this actors origin in that case)) who d...
bool OnGround() const
float & Friction()
int & DifficultyMode()
The difficulty this actor is currently set to.
void StopLoopingSounds()
void SetSpawnFlags3(const uint flags)
EnumActorSpawnFlags3.
kFx DamageFx() const
The kFx that hit this actor. Will be null if no Fx hit this actor. Only use in OnPreDamage/OnDamage/O...
const int16 SpawnParams(const int paramID) const
Get a map actors param value.
const bool GetUsingCustomDeadHeight()
const int AreaID() const
const int MapActorIndex() const
Returns -1 if not a map actor.
float & BounceDamp()
void SetModel(kStr &in modelFile, kStr &in animFile)
a way to set the model/anim for actors that had no model set previously
void SetDecayTime(const float value)
Used to melt kAI when they regen. Value range should be 0 (normal) to 60 (fully melted).
const int16 GetOverrideKeyTouchTID()
used only for key pickups
bool & NoKnockBack()
Will not receive knock back movement from things like the alien weapon for example.
bool & UseNewExplosiveRadiusCheck(void)
(default False) Set to true to enable explosive damage checks from radius to actor cylinder(more accu...
float & Mass()
default = GAME_SCALE * 1.0f
kAngle & PrevLerpYaw(void)
kAI CastToAI()
Casts to kAI. returns null if isn't a kAI.
int & ImpactType()
EnumImpactType.
void SetCustomDeadHeight(const bool bUse, const float height)
Height of actor when they are dead. Only for non map actors. (actors spawned with ActorFactory)
float SoundPlayTime(const kStr &in file, const uint index=0)
returns -1.0f if sound is not playing. Returns the amount of time in seconds the sound has been playi...
const float GetWaterHeight() const
kVec3 DamageVelocity(void) const
The Velocity of the attacker (Fx, Actor, or null (returns this actors velocity in that case)) who dam...
bool FxEventActive()
Returns true if ActorFx is running.
kVec3 & Velocity()
float DistanceToPoint(const float x, const float y, const float z) const
actors point is in the center
bool & IgnoreSectorPlatformChange(void)
if true this actor will not change position(or velocity and movement) when sector platform moves.
const float GetCustomDeadHeight()
void ClearCustomRef(void)
Allows the actor to get freed from memory if it has no references. This will be called automatically ...
kDictMem Definition()
get actors def data
bool CheckPosition(const float angle, const float distance)
calls CheckPosition(kVec3 origin) with origin being: Actor.Origin() + (angle*distance*Actor....
float & WaterFriction()
default = 0.5f (same as Friction)
void Remove()
Removes the actor and sets stale to true. Actor will only internally be removed when there are no ref...
void GetBoundsMinMax(kVec3 &out min, kVec3 &out max) const
actor must not be sleeping and have a model set and not be a pickup. otherwise will return default mi...
kAngle & Pitch()
void LinkArea()
Links the actor to an area node so that internally the actor can be found in quick searches (similar ...
void SetPosition(const kVec3 &in pos, const bool clearInterpolation=true)
best way to set an actors position (if you don't know the sector), will also set the sector and optio...
kAngle & Roll()
const bool InWater() const
float & Height()
float & Gravity()
float & FloorHeight()
void SetSector(const uint sectorIndex)
void SetCurrentGameSpeed(const float speed)
Set Gamespeed of this Actor (default 1.0f)
kActor GetTarget()
kAngle & PrevLerpPitch(void)
void InflictGenericDamage(kActor@ inflictor, const kStr &damageDef, const int damage)
Can pass in a damage def. The damageDef keys used are mainly for custom scripting purposes only....
bool & IgnoreSectorHeightChange(void)
if true will not change position(or velocity and movement) when sector height changes.
kVec3 & PrevOrigin()
const bool OverridingKeyTouchTID()
used only for key pickups
void OverrideOnDamageValue(const int damage, const bool bOverride=true)
call in OnPreDamage
kFx SpawnProjectile(const kStr &in fxPath, const kVec3 &in pos, const kVec3 &in targetLocation, const float maxAngle)
Returns the first Fx spawned. targetLocation.z gets added by GAME_SCALE * 3.0f.
float RadiusDamageFactor(const kVec3 &in origin, const float radius) const
int & ImpactTypeDmg()
EnumImpactType. Overrides the damage def used. if is -1 (default) then does not override ImpactType()
void SetSpawnParams(const int param, const int16 value)
Sets the actors param value. all params are int16.
kAngle & Yaw()
void SetAutomapColor(const int r, const int g, const int b)
kFx SpawnFx(const kStr &in fxPath, const kVec3 &in pos)
const int TID() const
const float GetGameSpeed() const
Returns CurrentGameSpeed if IgnoreGameSpeed is true else returns CurrentGameSpeed * GlobalGameSpeed.
const bool CanSee(kPuppet@ puppet, const uint excludeClipFlags=0)
excludeClipFlags to ignore/disable (EnumClipFlags). Note: This function that takes in the kPuppet arg...
kScriptObject ScriptObject()
Returns the ScriptObject that holds the obj ref to the custom script. Will return null if actor doesn...
void ClearFxEvent()
Clears all data for the actors ActorFx on this actor.
kFx SpawnFx(const kStr &in fxPath, const kVec3 &in pos, const kQuat &in rot)
float & WallRadius()
uint & ClipFlags()
EnumClipFlags.
kRenderModel RenderModel()
kAngle & PrevLerpRoll(void)
kActor CastToActor()
Casts to a kActor. Only used for kPuppet Actor().
void InflictGenericDamage(kActor@ inflictor, const int damage)
void SetHeadTrackTarget(kActor@ actor)
void SetupSpawnParams()
call after setting your actors spawnflags for them to take effect on the kActor
bool InstanceOf(const kStr &in className) const
example: InstanceOf("kexPuppet")
void InteractActorsAtPosition(const kVec3 &in pos, const kStr &in callbackFunc, const float arg1=0, const float arg2=0, const float arg3=0, const float arg4=0)
Calls a script function on all actors that are in the AreaNodes (KD-Tree search) contained inside a b...
void SetTarget(kActor@ actor)
const float BaseHeight() const
height of actor when spawned or when kAI regenerated
const bool CanSee(kActor@ actor, const uint excludeClipFlags=0)
excludeClipFlags to ignore/disable (EnumClipFlags)
bool CheckPosition(const kVec3 &in origin)
checks if the actor can move to this location
void SetSpawnFlags2(const uint flags)
EnumActorSpawnFlags2.
void AutomapToggle(const bool show)
Use with Game.AutomapCustom(true);.
const bool IsPersistentMarked()
float & PrevLerpFloorHeight(void)
void InflictDamage(kActor@ inflictor, const kStr &in damageDef)
int & ModelVariation()
const int GetSectorIndexAtLocation(const kVec3 &in pos, uint excludeClipFlags=0)
excludeClipFlags to ignore/disable (EnumClipFlags)
const bool MoveToPosition(const float x, const float y, uint clipFlags)
EnumClipFlags to use. Returns True if new position is in the same sector as the actor else returns fa...
kVec3 & PrevLerpOrigin(void)
void StopSound()
const float GetCurrentGameSpeed(void) const
Gamespeed of this Actor (default 1.0f)
const uint SpawnFlags2() const
EnumActorSpawnFlags2.
const float DecayTime(void)
Value used to melt kAI when they regen. Values range from 0.0 (normal) to 60.0 (fully melted).
bool & IgnoreGameSpeed()
GameSpeed used for this actor will be CurrentGameSpeed. (Default is true for kPuppet and kPlayerWeapo...
void SetupHeadTrack(const kStr &in headTrackDef)
Sets a headtrack.
void RotateAroundOrigin(const kAngle &in angle, const kVec3 &in platformOrigin, const bool setPos=true)
The angle amount to rotate this actors position. if setPos is true will use SetPosition to position t...
const float GetFloorHeight() const
calculates the floor height from the actors sector and origin. Returns 0 if not in a sector.
const bool IsStale() const
Actor is marked as removed and is waiting to be freed from memory when it next checks if there are no...
int GetWaterLevel() const
EnumWaterLevel.
bool & ChildOfTarget(void)
if this actors Target is an actor that belongs to the owner of the Fx, explosion or melee attack then...
void RunFxEvent(const kStr &in fxEventName)
Runs an ActorFX event. Example: RunFxEvent("Enemy_Freeze");.
void MeleeObject(const kStr &in damageType, const kVec3 &in offset, const float radius)
kVec3 & Movement()
uint & Flags()
EnumActorFlags.
const bool MoveToPosition(const float x, const float y)
Returns True if new position is in the same sector as the actor else returns false and it set a new s...
const uint SpawnFlags3() const
EnumActorSpawnFlags3.
kVec3 & Scale()
void PlaySound(const kStr &in soundPath)
int & SpeciesMask()
const int SectorIndex()
float & StepHeight()
AKA Dead Height. Used for moving up steps, figuring out if in waterheight, and the height of the acto...
float DistanceToPoint(const kVec3 &in point) const
calls DistanceToPoint(x,y,z)
kVec3 & Origin()
Position in world space.
const float GetSkyHeight() const
int & Type()
The actors Type ID.
kAnimState & AnimState()
void CheckLinkArea()
If origin or radius changed since the last LinkArea then calls LinkArea else does nothing....
const float GetCeilingHeight() const
calculates the ceiling height from the actors sector and origin. Returns 0 if not in a sector.
void RunAction(const int funcID, const float w=0.0f, const float x=0.0f, const float y=0.0f, const float z=0.0f)
run a function on the actor defined in defs/animActions.txt
kQuat & PrevLerpRotation(void)
float & Radius()
int16 & Health()
void ClearInterpolation()
bool & SkipKeyTouchCinema()
used only for key pickups
float & AnimSpeed()
void PlaySoundWithLookupID(const int soundID)
bool & TriggerInvincibility()
Can't damage if true. Gets set to true if enemy has trigger anim and false when activated.
bool RandomDecision(const int randomBit) const
randomBit should be >= 2. if a random value has the bit set and actors GameTicks also has the bit set...
bool & IgnoreFxGameSpeed()
GameSpeed used for Fx whose source is this actor will always be CurrentGameSpeed. (Default is false)
bool & RemoveTrailsOnAnimChange()
Will remove all model trails on this actor when animation is set/blend.
const uint SpawnFlags1() const
EnumActorSpawnFlags1.
float GetTurnYaw(const kVec3 &in lookAtLocation) const
void AddCustomRef(void)
Keeps the actor from getting freed from memory.
bool HasCustomRef(void) const
kQuat & Rotation()
float & CeilingHeight()
const int RefCount() const
Returns the number of references there are to this actor. If actor is stale and RefCount is 0 then it...
float & SoundPitchModify()
Override the final pitch of sounds owned by this actor. A value of 1000 raises the pitch by the amoun...
void SetSpawnFlags1(const uint flags)
EnumActorSpawnFlags1.
const int GameTicks() const
void MarkPersistentBit(const bool clear)
float GetAvoidanceAngle(const kVec3 &in lookAtLocation, const float distance)
float & AirFriction()
default = 1.0f
void OverrideKeyTouchTID(const bool bOverride, const int16 tid)
used only for key pickups to tell what key it is in the hub
kActor Get()
Returns the next actor in the iterator.
void Reset()
Resets the iterator back to the first actor.
float & PlaySpeed()
Get/Set speed of weapon animations (default = 4.0f)
float & FOV()
Get/Set weapon FOV (default = 47.5f)
kFx FireProjectile(const kStr &in fxPath, const float x, const float y, const float z, const bool adjustToPerspective=false)
SpawnsFx at the players at the position passed in * players rotation, then adds the viewHeight + land...
bool & NoGenericBobbing()
Disables the generic weapon bobbing menu option from affecting this weapon.
kVec3 TransformToOwnerPosition()
returns the OffsetPosition() * the players matrix.
kVec3 TransformToOwnerPosition(const kVec3 &in vector)
returns the (OffsetPosition() + vector) * the players matrix.
bool & ClearInterpolationOffsetPosition()
Set to true to clear the OffsetPosition interpolation after the weapon ticks, then it gets set back t...
bool & NoWalkAnim()
Get/Set the usage of the walk anim. Run animation will be used instead.
kPlayer & Owner()
float & PlaySpeedSwapIn()
Get/Set speed of weapon lower animation (default = 4.0f)
int & State()
EnumWeaponStates.
float & PlaySpeedSwapOut()
Get/Set speed of weapon raise animation (default = 3.0f)
bool & ForceGenericBobbing()
bool & PreventFire()
Use in OnBeginFire to internally prevent from entering its Fire state.
bool & AllowUnderwater()
Set to true to allow the weapon underwater. Gets reset back to the weapons def value after OnBeginLev...
kVec3 & OffsetPosition()
Offset position of weapon.
float & AttackRange()
squared
float & SightRange()
squared
int & Agitation()
0-300. 0-99=IDLE, 100-199=AGITATED, 200-300=CHASE
float & SightFOV()
in rads
float & AnimScalar()
default = 1.0f
float & QuietRange()
squared
float & BlendScalar()
default = 10.0f
int & AttackChance()
0-100
void SetupAISpawnFlags()
call after setting your actors spawnflags for them to take effect on the kAI
float & LeashRadius()
squared
int & Regenerate()
get/set current number of times the enemy will regenerate value. Regenerate is set right after OnBegi...
uint & AIFlags()
EnumAIFlags.
float & MeleeRange()
squared
float & FlyHeight()
squared
float & LoudRange()
squared
const float GroundStrafeSpeed() const
default = 10.24f
void SetJumpClimbSpeed(const float speed)
default = GAME_SCALE * 0.2875f
const float JumpMinSpeed() const
default = GAME_SCALE * 0.855f
const float StrafeBobScale() const
void SetGroundBackwardAccel(const float accel)
default = 0.05f
const float LandingViewOffset() const
LandingViewOffset changes when jumping and falling. Origin.z + ViewHeight() + LandingViewOffset() = C...
kVec3 & CustomViewOrigin()
const float GroundBackwardAccel() const
default = 0.05f
float & Oxygen()
Time in seconds. 0: full oxygen. >= 55: shows air bar. >= 70: OxygenOut is set to true.
void SetSwimBackwardSpeed(const float speed)
default = -10.24f
const int GetMaxLifeforces() const
void SetUnderwaterBobScale(const float scale)
kAngle & CustomViewPitch()
void SetGroundBackwardSpeed(const float speed)
default = -10.24f
void SetOverrideWalkRun(const int value)
0=none(default), 1=Force Disable Walk
const float TurnBobScale() const
const float WalkMaxSpeed() const
default = 4.0f
void SetSwimForwardAccel(const float accel)
default = 0.05f
const float GroundDeaccel() const
default = 0.5f
void SetHeadBobScale(const float scale)
const int OverrideShadow() const
default = 0
void SetGroundStrafeAccel(const float accel)
default = 0.05f
const float GroundForwardSpeed() const
default = 10.24f
void QuietNoiseAlert()
const float GroundForwardAccel() const
default = 0.05f
void SetJumpMaxSpeed(const float speed)
default = GAME_SCALE * 1.667f
const int GetMaxLives() const
void SetStrafeBobScale(const float scale)
uint & PlayerFlags()
EnumPlayerFlags.
void SetWalkMaxSpeed(const float speed)
default = 4.0f
void SetGroundForwardSpeed(const float speed)
default = 10.24f
const float GroundStrafeAccel() const
default = 0.05f
void SetGroundStrafeSpeed(const float speed)
default = 10.24f
float & RecoilPitch()
used for weapon recoil that modifies the players pitch.
kAngle & CustomViewRoll()
const float SwimBackwardAccel() const
default = 0.05f
void SetOverrideWeaponOnTopFix(const int value)
0=none(default), 1=Force disable fix, 2=Force enable fix (can use console command "g_weaponontopfix" ...
const float SwimForwardSpeed() const
default = 10.24f
kAngle & CustomViewYaw()
void SetSwimBackwardAccel(const float accel)
default = 0.05f
void SetCrawl(const bool crawl)
use this to manually set if the player is crawling instead of setting PF_CRAWLING directly.
void SetGroundDeaccel(const float accel)
default = 0.5f
void SetSwimForwardSpeed(const float speed)
default = 10.24f
float & OverrideFOV()
set to 1-179. anything else will stop overriding the fov and will use the r_fov cvar.
void SetMaxLifeforces(const int value)
Amount of Lifeforces needed to get an extra life.
void SetJumpMinSpeed(const float speed)
default = GAME_SCALE * 0.855f
const float SwimStrafeAccel() const
default = 0.05f
const float JumpMaxSpeed() const
default = GAME_SCALE * 1.667f
const int OverrideWalkRun() const
default = 0
void SetSwimStrafeAccel(const float accel)
default = 0.05f
const float SwimStrafeSpeed() const
default = 10.24f
void SetSwimDeaccel(const float accel)
default = 0.5f
void SetSwimStrafeSpeed(const float speed)
default = 10.24f
const float ClimbJumpAmount() const
default = GAME_SCALE * 0.2875f
bool & CustomViewUnderwater()
whether the custom view is underwater or not
const int OverrideWeaponOnTopFix() const
void SetMaxLives(const int value)
Max lives allowed from gaining Lifeforces.
void SetJumpBobScale(const float scale)
const float JumpBobScale() const
bool & NoWallJump(void)
default = false
void SetTurnBobScale(const float scale)
void LoudNoiseAlert()
void SetGroundForwardAccel(const float accel)
default = 0.05f
const float SwimBackwardSpeed() const
default = -10.24f
float & MaxFallVelocity(void)
default = -200.0f
const float GroundBackwardSpeed() const
default = -10.24f
const float SwimDeaccel() const
default = 0.5f
const int GetState(void) const
EnumPlayerStates.
void SetOverrideShadow(const int value)
0=none(default), 1=Force Disable shadow, 2=Force Enable shadow
bool & CustomViewEnable()
Set to true to enable the custom view.
const float UnderwaterBobScale() const
const float SwimForwardAccel() const
default = 0.05f
float & ViewHeight()
set from the players def "player.viewHeight". Origin.z + ViewHeight() + LandingViewOffset() = Cameras...
bool & OxygenOut()
if true will damage player if underwater
const float HeadBobScale() const
For Spawning Actors.
kActor Spawn(const kStr &in actorName, const float x, const float y, const float z, const float yaw, const int sector=- 1)
kActor Spawn(const int actorID, const float x, const float y, const float z, const float yaw, const int sector=- 1)
bool InfoSourceDead() const
const int FxIndex() const
The index in the fx file array.
kVec3 InfoMuzzleOffset() const
float InfoSaturationRandom() const
bool InfoOverrideMaxDrawScale() const
void GetColor1(float &out r, float &out g, float &out b, float &out a)
Get the color values.
kStr InfoUserString() const
Custom use.
bool InfoAddOffset() const
void LinkArea()
Links the Fx to an area node so that internally the fx can be found in quick searches (similar to a k...
bool InfoAttachSourceAnimOffset() const
bool InfoProjectile() const
kActor GetOwnerAsActor()
Returns null if is not an Actor.
int InfoFadeinTime() const
int InfoClipFlagsExclude() const
void SpawnWaterImpactFx()
float InfoRotationSpeed() const
bool InfoNoSpawnFar() const
bool InfoStopAnimOnImpact() const
int InfoDrawType() const
bool InfoNoDirection() const
float InfoRestart() const
const int InstanceIndex() const
float InfoHueRandom() const
float InfoRotationPivotY() const
bool InfoBullet() const
const float GetWaterHeight() const
bool InfoNoSpawnNear() const
int & ImpactType()
EnumImpactType.
bool InfoDepthBuffer() const
int InfoLifetime() const
kVec3 InfoTranslation() const
kVec3 & VelocityOffset()
When Fx spawns this is set to the starting velocity of the Fx. And adds to velocity if bAddOffset is ...
void Remove()
Removes the Fx and sets stale to true. Fx will only internally be removed when there are no reference...
bool InfoFlash() const
const int BounceCount() const
const float GetSkyHeight() const
float RadiusDamageFactor(const kVec3 &in origin, const float radius) const
void GetColor2(float &out r, float &out g, float &out b, float &out a)
Get the color values.
float & Height()
(Default 8.0) Not really used. Only for searches for the fx to define it's bounding box.
void StopLoopingSounds()
void SpawnImpactFx(const int impactType, const kVec3 &in normal, const bool bUseEvent=true, const bool bBlood=true)
bool & DoUpdateMovement()
If set to false the Fx will not move.
bool InfoMuzzleEffect() const
const bool CanSee(kActor@ actor, const uint excludeClipFlags=0)
excludeClipFlags to ignore/disable (EnumClipFlags)
const int SectorIndex()
int InfoClipFlagsInclude() const
float InfoAirFriction() const
bool InfoNoWallSpawn() const
int InfoUserID() const
Custom use.
bool InfoActorInstance() const
float DistanceToPoint(const kVec3 &in point) const
calls DistanceToPoint(x,y,z)
bool InfoAttachSource() const
bool InfoIgnoreGameSpeed() const
bool & DoUpdateExpireCheck()
If set to false the Fx will not expire and get removed when lifetime is over.
int & Frame()
The sprite frame. Make sure this value is < MaxFrames().
void SetTarget(kActor@ actor)
kVec3 & PrevOrigin()
float & Radius()
(Default 8.0) Not really used. Only for searches for the fx to define it's bounding box.
float InfoSpawnDistOffset() const
const bool DrawDelay() const
kVec3 & Movement()
kStr FxFilePath()
kScriptObjectFx ScriptObject()
Returns the ScriptObject that holds the obj ref to the custom script. Will return null if kFx doesn't...
bool InfoDecalOffset() const
const bool SwapBloodColor() const
Is true if fx has bBlood set to true and games blood menu option is set to Green(1)....
bool InfoBounceImpact() const
bool InWater()
void ClearCustomRef()
Allows the Fx to get freed from memory if it has no references. This will be called automatically whe...
bool & OnCollideForceNoSetOriginToLast()
If set to true the Fx will never set it's origin and sector to what it was before OnCollide was calle...
uint & ClipFlagsExclude()
ClipFlags to always exclude on Fx movement collision.
float InfoMaxscale() const
float & Friction()
int & ImpactTypeDmg()
EnumImpactType. Overrides the damage def used. if is -1 (default) then does not override ImpactType()
bool & DoUpdateScaling()
If set to false the Fx will not update draw scale.
float & RotationOffset()
Current Rotation Offset around the Y Axis. kQuat(RotationOffset(), 0.0f, 1.0f, 0.0f);.
bool InfoSourceAlive() const
float InfoMass() const
int InfoOnCollideWall() const
bool & ChildOfTarget()
Unused. Only used for kActors.
void SetColor2(float r, float g, float b, float a)
Values range from 0.0 to 1.0. Environment color of the sprite (used in shaders to blend color1 and co...
void SetColor1(float r, float g, float b, float a)
Values range from 0.0 to 1.0. Color and alpha of sprite.
float & FloorHeight()
const float GetFloorHeight() const
calculates the floor height from the Fx sector and origin. Returns 0 if not in a sector.
float InfoWaterFriction() const
kFx GetParentFx()
bool InfoFullScreen() const
const int RefCount() const
Returns the number of references there are to this Fx. If this Fx is stale and RefCount is 0 then it ...
void SetParentFx(kFx@ fx)
float & FrameTime()
The current time left before the Fx sprite tries going to the next frame in the sprite.
void SetOwnerAsFx(kFx@ fx)
int InfoFadeoutTime() const
bool & DoUpdateFading()
If set to false the Fx will not update color1 and color2 alpha value.
float & DrawScaleDest()
When the Fx is updating its scale OnTick, the current draw scale will increase to this value in diffe...
bool InfoStickOnTarget() const
bool InfoLensFlares() const
bool InfoDrawOnBottom() const
float & MaxDrawScale()
The highest value the DrawScale() can become when the Fx is updating its scale OnTick.
kFx GetOwnerAsFx()
Returns null if is not an Fx.
float & Speed()
Initial forward moving speed, set on spawn from forwardSpeed and forwardSpeedRandom in the fx file.
float DistanceToPoint(const float x, const float y, const float z) const
Fx point is in the center.
float & WallRadius()
const float Distance() const
Distance to the center of the View (Player or Camera) at the time the Fx spawned.
int InfoOnCollideActor() const
const float Restart() const
Current delay time before the Fx will start ticking.
bool InfoPerPolyCollision() const
kVec3 & Velocity()
bool & OnCollideForceSetOriginToLast()
If set to true the Fx will set it's origin and sector to what it was before OnCollide was called.
float InfoRotationPivotX() const
float InfoBounceImpactThreshold() const
int InfoAnimspeed() const
bool InfoNoGroundSpawn() const
const float GetCurrentGameSpeed(void) const
Gamespeed of this Fx (default 1.0f)
const int FxID() const
int GetWaterLevel() const
EnumWaterLevel.
const int GameTicks() const
float & Gravity()
float & MovingForce()
initial velocity.Length() value. if bBullet is true then while updating movement OnTick,...
kVec3 InfoBlackColor() const
int InfoMaxInstances() const
bool & DoUpdateRotation()
If set to false the Fx will not update rotation offset.
kAngle & Pitch()
Not used by the Fx.
bool InfoRestrictAim() const
const int AreaID() const
float InfoBrightnessRandom() const
void PlaySoundWithLookupID(const int soundID)
bool InfoOffsetFromFloor() const
float & BounceDamp()
bool InfoNoHitSource() const
float & DrawScale()
Current scale of the sprite.
float InfoScaleDest() const
const bool MoveToPosition(const float x, const float y)
Returns True if new position is in the same sector as the actor else returns false and it set a new s...
const int Instances() const
Same as the instances value in the fx file.
void SetSector(const uint sectorIndex)
float InfoRotationOffset() const
kVec3 & Origin()
bool InfoImpactEffect() const
float & WaterFriction()
kVec3 & MuzzleOffset()
kVec3 InfoWhiteColor() const
kAngle & Roll()
Not used by the Fx.
kStr InfoAnimName() const
Custom use.
const bool MoveToPosition(const float x, const float y, uint clipFlags)
EnumClipFlags to use. Returns True if new position is in the same sector as the actor else returns fa...
float InfoForward() const
const float GetGameSpeed() const
Returns CurrentGameSpeed if IgnoreGameSpeed is true else returns the CurrentGameSpeed * GlobalGameSpe...
bool HasCustomRef() const
float InfoFriction() const
float InfoAnimFriction() const
float InfoScale() const
float & AirFriction()
bool & DidWaterImpact()
float & RecurseLifeTime()
void SetPosition(const kVec3 &in pos, const bool clearInterpolation=true)
best way to set an Fx position without knowing the sector, will also find/set the sector and optional...
bool InfoFadeout(void) const
void RandomizeColors()
void PlaySound(const kStr &in soundPath)
void AddCustomRef()
Keeps the Fx from getting freed from memory.
bool InfoDrawDelay() const
float & RotationSpeed()
Adds this value * (0.25 * GameSpeed) to RotationOffset() when updating rotation OnTick....
int InfoOnCollideFloor() const
int InfoAnimType() const
bool InfoTextureWrapMirrorWidth() const
float InfoNoSpawnNearFarDist() const
bool & IgnoreSectorHeightChange()
const bool IsStale() const
Fx is marked as removed and is waiting to be freed from memory when it next checks if there are no mo...
kStr InfoModelName() const
Custom use.
int & BulletBounces()
bool InstanceOf(const kStr &in className) const
example: InstanceOf("kexFx")
bool InfoSparkle() const
bool OnGround() const
float & MuzzleLifeTime()
float & Mass()
float InfoGravity() const
int InfoMaxBulletBounces() const
bool InfoTextureWrapMirrorHeight() const
uint & ClipFlagsInclude()
ClipFlags to always include on Fx movement collision.
void SetCurrentGameSpeed(const float speed)
Set the Gamespeed of this Fx (default 1.0f)
int InfoRecurseLifetime() const
kVec3 & Scale()
const int GetSectorIndexAtLocation(const kVec3 &in pos, uint excludeClipFlags=0)
excludeClipFlags to ignore/disable (EnumClipFlags)
int InfoVisibilityType() const
kAngle & Yaw()
Not used by the Fx.
void CheckLinkArea()
If origin or radius changed since the last LinkArea then calls LinkArea else does nothing....
const float GetCeilingHeight() const
calculates the ceiling height from the Fx sector and origin. Returns 0 if not in a sector.
void ClearInterpolation()
bool InfoDestroyOnNoWater() const
kVec3 InfoOffset() const
void StopSound()
bool InfoScaleLerp() const
void SetOwnerAsActor(kActor@ actor)
kActor GetTarget()
float InfoTranslationGlobalRandomScale() const
bool InfoDestroyOnWaterSurface() const
bool InfoWeaponView() const
bool & DoUpdateSpriteAnimation()
If set to false the Fx will not update sprite frame.
bool InfoCrossFade() const
float & CeilingHeight()
bool & DoUpdateTickEvents()
If set to false the Fx will not call Tick or WaterTick events.
const uint MaxFrames() const
MaxFrames the sprite has. Frame should be < this value.
bool & IgnoreGameSpeed()
GameSpeed used for this Fx will always be CurrentGameSpeed. (Default = false)
kQuat & Rotation()
bool InfoBlood() const
const int CinematicState() const
EnumCameraStates.
void SetLookAtActor(kActor@ actor)
void TweenRotationTrack(const int view, const kVec3 &in pos, const float time)
Lerps all variables set when SetRotationTrack was called using the time param (clamped 0....
const bool Enabled() const
CinematicState() >= CAMS_FADEOUT (Not Idle)
void ZoomEyeViewToPosition(const kVec3 &in position, const float speed)
linear lerp finalview eye position to position using speed. finalview must be set or will do nothing.
void StartCinematic(const uint flags=(CMF_LOCK_PLAYER|CMF_UNLOCK_PLAYER_ON_FINISH))
EnumCameraFlags.
void SetEyeView(const kVec3 &in position)
position of camera (finalview). finalview must be set or will do nothing.
void ZoomFocusViewToPosition(const kVec3 &in position, const float speed)
linear lerp finalview focus position to position using speed. finalview must be set or will do nothin...
kVec3 origin
current position of camera. if a finalview is set then the origin will be set to the finalview's eye ...
kAngle pitch
if a finalview is set then the pitch will be set to the finalview's look direction.
void SetFinalView(const int view)
the view to use for the camera origin and direction. view must be in range 0-2
void ClearViewTracks()
views 0-2 all variables are set to 0
const bool Active() const
bool & ClearInterpolationOnTick(void)
set to false to handle interpolation yourself
void SetFocusView(const kVec3 &in position)
position of where the camera (finalview) is looking at. (Sets look direction from eye and focus posit...
float lookZOffset
Used only if LookAtActor has been set.
void SetFlags(const uint flags)
EnumCameraFlags.
const int AreaID() const
void SetPositionTrack(const int view, const kVec3 &in startEye, const kVec3 &in destEye, const kVec3 &in startFocus, const kVec3 &in endFocus)
Sets eye and focus start and dest positions for use with TweenPositionTrack and AutoPlayPositionTrack...
const bool ViewingFromCamera() const
CinematicState() >= CAMS_FADEIN && CinematicState() <= CAMS_ACTIVE_TO_FADEOUT.
void SetRotationTrack(const int view, const float startAngle, const float destAngle, const float startDist, const float destDist, const float startEyeZOffset=0, const float destEyeZOffset=0, const float startFocusZOffset=0, const float destFocusZOffset=0)
Use with TweenRotationTrack and AutoPlayRotationTrack.
void StopCinematic(const bool noFade=false)
if noFade is true will stop the cinematic immediately without fading out.
void TweenPositionTrack(const int view, const float time)
Lerps eye and focus positions to the start and dest positions using the time param (clamped 0....
kVec3 & Tremor()
x = adds to yaw, y = adds to pitch, z = adds to roll. lerps to vecZero using lerpTime of GAME_FRAME_T...
void SetSector(const uint sectorIndex)
const int SectorIndex()
kAngle roll
if a finalview is set then the roll will be set to 0.
void ClearLookAtActor()
float fov
Camera FOV (default is 74.0)
kAngle yaw
if a finalview is set then the yaw will be set to the finalview's look direction.
kVec3 GetEyeView()
position of camera (finalview). finalview must be set or will return vecZero.
void SetUserInterrupted(const bool toggle)
set to false to set the user interrupted to false.
const uint Flags() const
EnumCameraFlags.
void AutoPlayPositionTrack(const int view, const float speed, const int lerpType)
EnumCameraLerpType. Calls TweenPositionTrack on the view using speed and lerpType.
kVec3 GetFocusView()
position of where the camera (finalview) is looking at. finalview must be set or will return vecZero.
const bool UserInterrupted() const
User pressed left click or escape key or any controller button. While CinematicState() == CAMS_ACTIVE...
void AutoPlayBlendTrack(const int viewA, const int viewB, const int viewC, const float speed, const int lerpType)
EnumCameraLerpType. Blends between viewB and viewC eye and focus. and sets the results to viewA.
bool & AllowMenusWhenActive(void)
set to true to allow the pause menu to be opened during a cinematic
void ClearInterpolation()
void SetRotateEyeVector(const kVec3 &in vector)
The focus position that is used when AutoPlayRotationTrack is called if there is no LookAtActor set.
void ClearFinalView()
finalview is set to null
void AutoPlayRotationTrack(const int view, const float speed, const int lerpType)
EnumCameraLerpType. Calls TweenRotationTrack on the view using speed and lerpType.
The kCModel(CModel) global stores collision results when certain actor methods are called....
kVec3 & ContactNormal()
Returns the normalized vector of the collided surface.
kActor ContactActor()
handle pointer to actor that was collided (null if none was collided)
const uint ClipResult()
specifies the type of intersection (flags. EnumClipResultFlags)
kVec3 & InterceptVector()
Returns the vector that intersected the collided geometry.
kVec3 & MoveDirection()
Movement vector of the object.
const float & Fraction()
returns the 0.0 - 1.0 range of the point of intersection from start to end trace. (If fraction is == ...
void StartWarp(kActor@ actor, const int tagID, const int mapID)
void TagActorForBossBar(kActor@ actor)
void ClearWarpInterpolation(void)
Clearing the interpolation for kPuppet will also clear the warp interpolation.
const bool CheckWarping()
Checks if Warping or FreeWarping is in progress.
const int UnscaledTicks() const
Not affected by GameSpeed.
void HandlePlayerDeath(const bool loseLife=true)
if loseLife is true and infinite lives cheat is off then player loses a life. if player lives is < 0 ...
const bool CanOpenSaveMenu()
Checks if it's okay to be able to open the save menu.
const float Ticksf(void) const
affected by gamespeed
void CheckKeys()
Prints HUD messages to tell the player how many keys they've found on the current HUBID.
void ChangeMap(const kStr &in mapName)
const int NewMapWarpTID()
Returns the warp TID the player warped to from another map. Returns -1 if didn't warp from another ma...
void RemoveBossActor()
void StartFreeWarp(kActor@ actor, const kVec3 &in origin, const float yaw, const int sectorIndex, const int mapID)
const int Ticks() const
affected by gamespeed (Ticksf truncated)
const bool CanOpenPauseMenu()
Checks if it's okay to be able to open a menu.
const bool GetCvarValue(const kStr &in cvarName, kStr &out result)
void MouseToHUD(float &out x, float &out y)
Returns the HUD position of the mouse.
void MouseToHUDNoStretch(float &out x, float &out y)
Returns the HUD position of the mouse.
int VideoHeight()
void Warning(const kStr &in message)
int Mouse_X()
void Print(const kStr &in message)
int VideoWidth()
int Mouse_Y()
void FloodMatchingAreaFlags(const int sectorIndex, const uint flags, const bool active)
(EnumAreaFlags) Sets flags on all adjacent sectors with matching areaID.
void ChangeAreaWallImpact(const int areaID, const int value)
value: EnumImpactType
const int GetAreaAmbience(const int area) const
const int GetAreaFloorImpact(const int areaID) const
EnumImpactType.
const float GetAreaWaterZFar(const int area) const
const int GetNumSectors() const
const float GetAreaWaterHeight(const int area) const
const int GetNumAreas() const
void ChangeAreaFloorImpact(const int areaID, const int value)
value: EnumImpactType
void FloodFillAreaFlags(const kVec3 &in origin, const uint flags, const bool active)
(EnumAreaFlags) Calls FloodMatchingAreaFlags with FindNextClosestSector(origin) sector.
const float GetAreaBlendLength(const int area) const
the speed to interpolate the fog color/start/zfar values when they change
const int GetSectorDrawOrder(const int sectorIndex) const
lowest draw order (0) draws the sectors on the automap last
const int GetSectorBridge(const int sectorIndex, const uint bridge) const
Get the sector of the bridge. Use GetSectorNumBridges to loop through them all.
void SetSectorFlags(const int sectorIndex, const int flags)
Keep in mind sector flags are a 16 bit unsigned integer and only the first 16 area flags (up to AAF_M...
kActor GetActorByTID(const int tagID, const int typeFilter=- 1) const
if typeFilter is -1 checks any type otherwise only returns the actor of that type
const int GetNumActors() const
number of actors that are in the current maps data
void OverrideWaterFogColor(const int r, const int g, const int b)
rgb values are 0-255
void GetSectorVertIndices(const int sectorIndex, int &v1, int &v2, int &v3) const
Get the Sectors vertex indices. If invalid sectorIndex is passed in will return all -1.
void ChangeAreaArg(const int areaID, const int arg, const int16 value)
const float GetAreaFogZFar(const int area) const
void ChangeSectorCeilingHeight(const int sectorIndex, const float height)
Changes all sectors ceiling vertices with the same areaID to the height.
const int GetAreaCullBits(const int area) const
if any staticmeshes cullBits have any of the area cullBits set then it will draw. (default callbits i...
void OverrideFogColor(const int r, const int g, const int b)
rgb values are 0-255
kActor GetActorByType(const int typeFilter) const
Returns the first map actor of the same type.
void SetAreaFogColor(const int area, const kVec3 &in color)
color values are in range 0-255
void SetAreaWaterColor(const int area, const kVec3 &in color)
color values are in range 0-255
void SetAreaMapColor(const int area, const int color)
const int GetSectorAreaID(const int sectorIndex) const
const uint GetAreaFlags(const int areaID) const
EnumAreaFlags.
const int GetSectorFlags(const int sectorIndex) const
Returns a 16 bit unsigned integer. Only the first 16 area flags (up to AAF_MAPPED) are used for secto...
void ChangeSectorHeightVertices(const int sectorIndex, const float height, const int ptMask=7)
Changes only the sector floor vertices(specified using the ptMask) to the height.
const kStr GetSkyMaterial() const
void GetSectorLinks(const int sectorIndex, int &out sectorIndex1, int &out sectorIndex2, int &out sectorIndex3) const
Get the 3 sectors links. -1 means there was no sector linked to that edge. Link 1 is pt1 to pt3 Link ...
void FloodFillAreaFlags(const int sectorIndex, const uint flags, const bool active)
(EnumAreaFlags) Sets flags on all adjacent sectors until it finds a sector that has the flags already...
void ChangeAreaFlag(const int areaID, const uint flags, const bool active)
(EnumAreaFlags) Only sets the areaID flags and not the sector flags. Should most likely prefer using ...
const int FindNextClosestSector(const kVec3 &in origin)
Returns the sector that this point is best in. Returns -1 if not inside and above/on a sector.
void SetAreaAmbience(const int area, const int ambience)
const int FindClosestSectorByDistance(const kVec3 &in origin)
Returns the closest sector. Will return -1 only if the map contains no sectors.
const float GetAreaSkySpeed(const int area) const
speed scale is this value / 100. 100 is normal speed.
const kVec3 GetAreaWaterColor(const int area) const
color values are in range 0-255
const int GetAreaWallImpact(const int areaID) const
EnumImpactType.
const int GetAreaMusic(const int area) const
void SetSectorDrawOrder(const int sectorIndex, const int drawOrder)
lowest draw order (0) draws the sectors on the automap last
void ChangeSectorCeilingHeightVertices(const int sectorIndex, const float height, const int ptMask=7)
Changes only the sector ceiling vertices(specified using the ptMask) to the height.
const int GetAreaMapColor(const int area) const
void SetAreaWaterZFar(const int area, const float zfar)
void ChangeSectorHeight(const int sectorIndex, const float height)
Changes all sectors floor vertices with the same areaID to the height.
void OverrideSkyMaterial(const kStr &in path)
Example path: "skies/skyMaterials/sky_brown" You can clear the sky with an empty string: "" Do not pa...
const bool PointInsideSector(const int sectorIndex, const kVec3 &in point) const
Returns true if point is inside the sector (XY only)
void SetAreaFogZFar(const int area, const float zfar)
void SetAreaSkyHeight(const int area, const float height)
void SetAreaCullBits(const int area, const int bits)
if any staticmeshes cullBits have any of the area cullBits set then it will draw. (default callbits i...
void SetAreaMusic(const int area, const int music)
const uint GetSectorNumBridges(const int sectorIndex) const
number of bridge sectors this sector has
const int16 GetAreaArg(const int areaID, const int arg) const
Returns an area arg value.
void ChangeAreaWaterHeight(const int areaID, const float height)
WaterHeight is stored per area, not per sector or per vertex.
bool TriggerActorsByTID(kActor@ instigator, const int tagID)
Triggers an actor (that is not the instigator) that has the same tagID. Returns true if triggered an ...
void SetAreaSkySpeed(const int area, const float speed)
speed scale is this value / 100. 100 is normal speed.
const kVec3 GetAreaFogColor(const int area) const
color values are in range 0-255
void ClearOverrideWaterFogColor()
Stops overriding and uses the sector color.
void GetSectorCorners(const int sectorIndex, kVec3 &out pt1, kVec3 &out pt2, kVec3 &out pt3, kVec3 &out heights) const
Get the Sectors vertex position and height Link 1 is pt1 to pt3 Link 2 is pt2 to pt1 Link 3 is pt3 to...
void ClearOverrideFogColor()
Stops overriding and uses the sector color.
const float GetAreaSkyHeight(const int area) const
void MoveSectorPlatform(const int sectorIndex, const kVec3 &in moveDelta, const uint flags=SPF_DEFAULT)
EnumSectorPlatformFlags. Moves bridge sectors vertices not connected to non bridge sectors by moveDel...
void SetAreaBlendLength(const int area, const float blendLength)
a blendLength value of 1.0 interpolates the fog color/start/zfar values at 0.066666 (1/15) per tick.
const int GetCurrentMapID()
void StopTactile(int vibHandle)
void CenterMouse()
void Print(const kStr &in text, const int ticks=120)
Print a message to the HUD on the next line.
kStr GetLocalizedText(const kStr &in key)
bool SphereInView(const kVec3 &in origin, const float radius)
bool SetTextFlags(const int id, const int flags)
EnumCustomHUDFlags.
void OverrideRespawningEnemies(const int value)
Set: Game.OverrideRespawningEnemies(); Get: GameVariables.GetInt("OverrideRespawningEnemies",...
void LifeForcePulse()
Shows the LifeForces on the HUD.
kStr GetHubTitle(int hubID)
Returns the HUB's Title def property. Returns empty string if not found.
void KillAllFx()
bool EnemiesAlwaysDropItems()
Returns the gameplay menu option value.
void SetWorldSunDirection(const float x, const float y, const float z)
const bool IsFrozenObjects()
Returns true if the freezeobjects console command is enabled.
kStr GetCommandBind(const kStr &in command, const bool first=true, const bool sort=true)
Returns the key bind name of the console command. Returns empty string if nothing is bound.
bool MusicIsPaused()
void SaveMenu()
Opens the save game menu. Should always check if(PlayLoop.CanOpenSaveMenu())
bool SetWeaponWheelPic(const int weapon, const kStr &in imagePath)
void SetPickupFlash()
Shows the pickup screen flash.
void SetModBindings(const bool show=true)
Shows custom mod bindings in menu Bindings > Actions.
bool & NoArmorFlash(void)
kStr GetFxFile(const int fxID)
Returns the file path to the Fx by ID value as defined in defs/fileLookup.txt.
void OpenAudioMenu()
void SetPreventOpenPauseMenu(const bool value)
void OpenHeadBobbingMenu()
bool SetPicColor(const int id, const int r=255, const int g=255, const int b=255, const int a=255)
const float GetMaxZDrawDistance()
Returns GetExtraZFar + the max z-draw distance from the active map def.
void HaltMapScript(const int scriptID)
bool IsTactilePlaying(int vibHandle, const kStr &in path)
void ScreenPointToHUD(float sx, float sy, float &out x, float &out y)
Returns the HUD position of the screen point.
void ClearTextInterpolation(const int id)
void OverrideFogType(const int value)
0=none, 1=force Radial, 2=force Plane
void OverridePerPolyCollision(const int value)
0=none, 1=force disable, 2=force enable
void OpenWeaponBindingsMenu()
void PlayMovie(const kStr &in filename, const bool skippable=true)
Only .ogv or .webm files (replaces/adds extension to filename automatically). Can not read from kpfs.
int PlayTactile(const kStr &in path, int channel, int pos)
Start controller vibration from tactile sound file. Returns a handle.
bool SetPicUV(const int id, const float s1=0.0f, const float t1=0.0f, const float s2=1.0f, const float t2=1.0f)
bool & HideAmmo()
Hide ammo display on the HUD.
float GetHUDOffset(const bool user=false)
if user is false will return the width to the edge of the screen (negative value)....
void ShowPauseMenu()
Should always check if(PlayLoop.CanOpenPauseMenu())
void AutomapDeactive(const bool toggle)
permanently deactivates the automap.
bool GetHubKeyInfo(const uint hubID, int &out nKeys, int &out remainingKeys, int &out keyBits)
bool IsTactilePlaying(int vibHandle)
void SetCursorHotPos(int x, int y)
change the mouses cursors click point (default is 0, 0)
bool & HideCrosshair()
Hide Crosshair display on the HUD.
void ScreenPointToHUDNoStretch(float sx, float sy, float &out x, float &out y)
Returns the HUD position of the screen point.
bool IsCheatActive(const int cheatBits)
EnumCheatFlags. Returns true if cheats are active.
void AddText(const int id, const int font, const kStr &in text, const float x, const float y, const int edge=0, const float scale=1.0f, const bool center=false, const bool shadow=false, const int r=255, const int g=255, const int b=255, const int a=255, const int r2=255, const int g2=255, const int b2=255, const int a2=255)
add custom text to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLevel...
bool BoxInView(const kVec3 &in min, const kVec3 &in max)
bool IsJoystickActive()
if true the players last input was from a controller.
const int BossDamageScaler(const int difficulty, const int damage)
bool SetPicEdge(const int id, const int edge)
edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOff...
void StopTimer()
bool SetPicWH(const int id, const float w, const float h)
bool SetTextColors(const int id, const int r=255, const int g=255, const int b=255, const int a=255, const int r2=255, const int g2=255, const int b2=255, const int a2=255)
const bool IsActorPersistentMarked(const int actorIndex, const int hubID=-1, const int mapNum=0)
an invalid hub or map uses current maps persistent data.
void OverrideBloom(const int value)
0=none, 1=force disable, 2=force enable
kStr GetInputImagePath(const kStr &in bindName)
void PrintLine(const kStr &in text, const int lineNumber, const int ticks=120)
Print a message to the HUD.
kFx SpawnFx(const kStr &in fxPath, kActor@ source, const kVec3 &in velocity, const kVec3 &in origin, const kQuat &in rotation)
void LivesPulse()
Shows the Lives on the HUD.
void PrintHelp(const kStr &in text, const bool endGame=false)
void SetNoModSelect(const bool bToggle=true)
Disable the mod select menu when selecting new game for workshop mods only. (seta g_nomodselect "1")
bool SetHubKey(const uint hubID, int keyBits, int remainingKeys)
Set the keybits and remainingKeys directly.
bool LoadModFile(const kStr &in filename)
Loads a custom save file. make sure to call GameModFileData.Empty() after you're done loading.
void StopAllTactile()
void GetSectorInBounds(const kVec3 &in min, const kVec3 &in max)
The array of sectors is stored in Game.GetSectorResult. (KD-Tree search)
void OpenMenuBindingsMenu()
bool SetPicAngle(const int id, const float angle)
in rads
void CallDelayedMapScript(const kStr &in funcName, kActor@ instigator, const float delay)
even with delay 0 it will be called when map scripts update
bool SetPicFlags(const int id, const int flags)
EnumCustomHUDFlags.
void OpenLevelKeysMenu()
void SetGlobalSoundPitch(const float pitch)
When sounds begin to play their pitch is scaled by this value.
kFx SpawnFx(const kStr &in fxPath, kPuppet@ source, const kVec3 &in velocity, const kVec3 &in origin, const kQuat &in rotation)
const int GetMapNumberFromName(const kStr &in mapName)
This returns the HUB number NOT the map number. mapName is the HUB name such as "Map_Jungle"....
void NextSoundPitchScale(const float pitch)
The next play sound will scale the pitch by this much.
bool InputImageExists(const kStr &in path)
void NextSpawnFxSetResults()
On the next call to SpawnFx or any other function that calls SpawnFx (such as SpawnProjectile and Fir...
bool SetTextProps(const int id, const float scale, const int font=0, const int edge=0, const bool center=false, const bool shadow=false)
Set the text scale, font, edge, center, shadow.
void StopMusic()
void MarkActorPersistentBit(const int actorIndex, const bool clear=false, const int hubID=-1, const int mapNum=0)
an invalid hub or map uses current maps persistent data.
void ClearAllMapsPersistData(void)
Clears all sector and actor persistent data for all maps in the game.
const int GetMapIDFromName(const kStr &in mapName)
This returns the mapID from the mapName. Returns -1 if not found.
void ClearPicInterpolation(const int id)
float MusicPlayTime()
Returns the amount of time the music has been playing for in seconds. Doesn't reset back to 0 when lo...
void OpenOptionsMenu()
saves config file when exiting this menu
void SetAllSoundsPitchScale(const float pitchScale)
Sets all playing sounds pitch scale.
kStr GetHubDefName(int hubID)
Returns the HUB's def name. Returns empty string if not found.
bool & HideBossBar()
Hide BossBar display on the HUD.
void SaveModFile(const kStr &in filename)
Saves a custom save file. make sure to call GameModFileData.Empty() before adding key/values to save.
void SetDifficulty(const int value)
EnumDifficulty.
bool & NoPickupFlash(void)
void DisableLegalText()
Removes the text at the bottom of the title screen.
void AutomapToggle(const bool toggle)
show/hide the automap.
bool SetPicOrigin(const int id, const float x, const float y)
bool RemoveText(const int id)
int PurgeUnusedModels()
Returns number of models freed.
kFx SpawnFx(const kStr &in fxPath, kPuppet@ source, const kVec3 &in origin, const kQuat &in rotation)
void GetActorInBounds(const kVec3 &in min, const kVec3 &in max)
The array of actors is stored in Game.GetActorResult. (KD-Tree search). Each actors bounds is calcula...
const bool AutomapDeactived()
kFx GetFxResult(const uint index)
Use after calling Game.GetFxInBounds. Do not use at any other point!
void SetWorldSunLightColor(const float r, const float g, const float b)
void PlaySound(const kStr &in path)
bool MusicIsPlaying()
uint GetActorResultsLength()
Use after calling Game.GetActorInBounds.
void AutomapCustom(const bool toggle)
allow actors with custom automap colors to be drawn to the automap. (for mods)
void ShowMainMenu(const bool mouseCenter=true)
int GetMapSecretsFound(int mapID)
Returns the number of secrets found in this map. Returns 0 if map not found.
const float ShakeIntensity()
const float GetExtraZFar()
a custom amount for modders to add to the zfar value
void SetExtraZFar(const float zfar)
affects actors, ai, particles, fog and underwater. (works normally unlike the cvar r_zfarextent)
bool CanUseCustomNoStretch()
Returns true if aspect ratio is 4:3 or bigger width.
bool & HideHealth()
Hide health display on the HUD.
void ClearLivesPic()
void StartTimer()
bool ClearWeaponWheelPic(const int weapon)
bool IsWorkshop()
Returns true if game was run through the steam workshop (ran with command arg -workshop)
bool SetTextMsg(const int id, const kStr &in text)
void CallDelayedMapScript(const int scriptID, kActor@ instigator, const float delay)
even with delay 0 it will be called when map scripts update
int GetMapSecretBits(int mapID)
returns the secretBits found in this map. Returns 0 if map not found.
void SetPicOrder(const int id, const int order)
bool SetTextOrigin(const int id, const float x, const float y)
bool & NoDamageFlash(void)
bool & HideWeaponWheel()
Hide WeaponWheel display on the HUD.
void PlayMusicID(const int musicID, const int fadeTimeMS=500, const bool loop=true)
MusicID -2 plays previous track, -1 stops the music.
void OpenHUDOptionsMenu()
void SetDamageFlash()
Shows the damage screen flash.
void SetWorldSunAmbientColor(const float r, const float g, const float b)
uint GetSectorResultsLength()
Use after calling Game.GetSectorInBounds.
const uint ConButtons()
EnumPlayerConButtons.
void OpenActionBindingsMenu()
void OpenGameplayMenu()
bool IsRunningMapScript(const int scriptID)
uint GetFxResultsLength()
Use after calling Game.GetFxInBounds.
kVec3 GetWorldSunAmbientColor()
void OpenBindingsMenu()
void NextSoundVolumeScale(const float volume)
The next play sound will scale the volume by this much.
const int GetDifficulty()
EnumDifficulty. Internally calls GameVariables.GetInt("g_difficulty")
kVec3 GetWorldSunLightColor()
bool AddPic(const int id, const kStr &in path, const float x, const float y, const float w, const float h, const int edge=0, const float s1=0.0f, const float t1=0.0f, const float s2=1.0f, const float t2=1.0f, const int r=255, const int g=255, const int b=255, const int a=255)
add custom image to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLeve...
bool ClearMapPersistData(int mapID)
Clears all sector and actor persistent data for the map and returns true. Returns false if map was no...
const bool AutomapEnabled()
is the automap displaying on screen
void PlayMusic(const kStr &in path, const bool loop)
Use PlayMusicID instead.
kStr GetMapNameFromID(const int mapID)
Finds the name of the map with the mapID. Returns an empty string couldn't find the map.
void Restart()
void ClearText()
bool & HideLives()
Hide Lives display on the HUD.
int GetHubIDFromMapID(int mapID)
Return the HUB ID value. Returns -1 if not found.
bool SetTextColor(const int id, const int r=255, const int g=255, const int b=255, const int a=255)
void SetTextOrder(const int id, const int order)
kStr MusicSong()
void ClearDummyMenu(bool bClearAll=false)
void MusicPitch(const float pitch)
void GetTextSize(const kStr &in text, const int font, const float scale, float &out width, float &out height)
EnumGameFontType.
float GetGameSpeed()
bool SetHubKey(const uint hubID, int key)
uint MenuButtons(void) const int64 GetTimestamp()
bool SetPicTex(const int id, const kStr &in path)
kFx SpawnFx(const kStr &in fxPath, kActor@ source, const kVec3 &in origin, const kQuat &in rotation)
void LoadMenu()
Opens the load game menu. Should always check if(PlayLoop.CanOpenPauseMenu())
kVec3 WorldToScreenPoint(const kVec3 &in origin)
bool & HideTimers()
Hide Timers display on the HUD.
bool MusicIsFading()
void ResumeMusic()
void ClearLifeForcePic()
const bool GetPreventOpenPauseMenu()
void ChangeMap(const kStr &in path)
void SetWaterReflectionViewPoint(const kVec3 &in point)
bool RemovePic(const int id)
kVec3 GetWorldSunDirection()
kFx SpawnFx(const kStr &in fxPath, kActor@ source, const kVec3 &in origin, const float yaw, const float pitch)
void CallMapScript(const int scriptID, kActor@ instigator)
Use to call map script right away.
bool & HideAirBar()
Hide AirBar display on the HUD.
float GetHUDOffsetNoStretch(const bool user=false)
if user is false will return the width to the edge of the screen (negative value)....
kDictMem GetActorDef(const kStr &in name)
Returns the Actors Def by name.
void WeaponWheelPulse()
Shows the WeaponWheel on the HUD.
void SetWaterReflectionAlpha(const float alpha)
Default is 1.0f.
kDictMem GetActorDef(const int type)
Returns the Actors Def by it's type.
void SetGameSpeed(const float speed, const float blendSpeed)
Sets the current GameSpeed. kPuppet and kPlayerWeapon are not affected by GameSpeed.
void MessageBox(const kStr &in msg1, const kStr &in msg2)
void ToggleCursor(bool b=false)
kFx SpawnFx(const kStr &in fxPath, const kVec3 &in origin, const int sectorIndex)
void RemoveTimer()
bool & HideLifeForces()
Hide LifeForces display on the HUD.
void SetArmorFlash()
Shows the armor damage screen flash.
void OpenGraphicsMenu()
kStr GetActionBind(const int action, const bool first=true, const bool sort=true)
Returns the key bind name of action. Returns empty string if nothing is bound.
void GetDateAndTime(int &out seconds, int &out minutes, int &out hours, int &out day, int &out month, int &out year, kStr &out text)
kStr PlayerName()
Returns "Player" if could not get name.
bool LoadModDataFile(const kStr &in filename)
Load any file in your mod that is a kDict binary. Use the python T1_json2modbin.py on the main script...
bool & HideHelpMessages()
Hide HelpMessages display on the HUD.
bool SetMapSecretsFound(int mapID, int secretBits)
Returns false if map could not be found. secretBits only uses the first 16 bits, that means each map ...
int GetHubSecretsFound(const uint hubID)
Returns the number of secrets found in all the maps in this HUB. Returns 0 if HUB not found.
int GetSectorResult(const uint index)
Use after calling Game.GetSectorInBounds. Do not use at any other point!
kFx SpawnFx(const kStr &in fxPath, kPuppet@ source, const kVec3 &in origin, const float yaw, const float pitch)
void OverrideSkyHeight(const float height)
Set to 0 to stop overriding.
bool & UseCustomNoStretch()
Set to true to use the non stretch Hud fix for Custom Text and Pics.
void EnableWaterReflectionViewPoint(const bool enable)
void GetFxInBounds(const kVec3 &in min, const kVec3 &in max)
The array of Fx is stored in Game.GetFxResult. (KD-Tree search). Each Fx bounds is calculated as MAX(...
bool & HideRunWalk()
Hide RunWalk display on the HUD.
void ClearPics(const bool clearImageCache=false)
void PauseMusic()
void PlaySoundID(const int soundID)
void StopSounds()
bool & HideMessages()
Hide Messages display on the HUD.
void SetLivesPic(const kStr &in imagePath)
void ClearInterpolationOnGameObjects()
Clears Interpolation on all gameobjects and the camera if it's active.
kActor GetActorResult(const uint index)
Use after calling Game.GetActorInBounds. Do not use at any other point!
const float ViewZFar()
void OpenAutomapBindingsMenu()
void ConfirmMenu(const kStr &in msg1, const kStr &in msg2)
void RunWalkPulse()
Shows the RunWalk graphic on the HUD.
void SetLifeForcePic(const kStr &in imagePath)
void ShowDummyMenu(void)
Actors OnMenuTick function will now be processed. Call ClearDummyMenu to close the dummy menu.
void Reset()
Resets the iterator back to the first Fx.
kFx Get()
Returns the next Fx in the iterator.
void CyclePrevWeapon(const bool bCheckAmmo=false)
const bool HasAltAmmo(const int weaponID) const
const bool HasAltAmmo() const
const int LifeForces()
kPuppet Actor()
const int16 SecretCount(void) const
Total number of secrets currently found over the entire game.
const int GetAltAmmo(const int weaponID) const
void SetCheckPoint(const int warpTID, const int map)
kWeapon GetWeaponActor(const int weapon)
int16 & ExtraHealth()
should be <= MaxExtraHealth
bool GiveAmmo(const int weapon, const int amount, const bool altAmmo)
set amount to negative values to take ammo
void Victory(const int warpActorID=- 1, const int mapID=- 1)
int16 & Armor()
bool & RunWalkToggle()
if true walking is enabled. (saves)
const int CurrentCheckPoint()
returns warpTID
const int GetWeaponGroup(const int weapon)
const uint16 Buttons() const
returns EnumPlayerButtons
void SetLives(const int amount)
const float GetSpiritualTime() const
void CancelSpiritualTime(float blendTime=1.0f)
if in spirit mode then will set gamespeed back to 1.0f using the passed in blendTime
bool GiveHealth(const int amount, const bool bMortalWound)
Takes into account extra health, and max health values. 0 is full health, negative amounts give extra...
bool & Backpack()
const int CurrentCheckPointMap()
void CycleNextWeapon(const bool bCheckAmmo=false)
const int PendingWeapon() const
void SetLifeForces(const int amount)
const bool SetWeaponUseAltAmmo(const int weapon, const bool bToggle)
void SetSpiritualTime(const float time, const float blend)
time = time until cancels the effect. Should SetGameSpeed after calling this.
const bool WeaponUsingAltAmmo(const int weapon) const
void ConsumeAmmo(const int ammo, const bool preferredAmmo=true)
int16 & MaxExtraHealth()
should be <= MaxHealth
const int CurrentWeapon() const
void SetSecretCount(const int amount)
Set the total number of secrets currently found over the entire game.
const bool Locked() const
uint ButtonHeldTime(const int btn)
btn type is EnumInputActions
bool & UseAltAmmo()
bool & SilentCheckPoints(void)
if true won't show checkpoint message or play sound when on a checkpoint area. Gets set back to false...
void Lock()
const kVec3 GetButtonMovement() const
bool & NoLandClearVel()
if true, when doing a hard landing you will not lose your velocity (saves)
bool RemoveWeapon(const int weapon)
void Unlock()
const kVec3 GetButtonAngles() const
int16 & MaxHealth()
should be >= MaxExtraHealth and ExtraHealth
void SetWeaponGroup(const int weapon, const int group)
Binds this weapon to another weapons index. Example: you made a new pistol weapon at index 14 and wan...
void ChangeWeapon(const int weapon)
const bool HasAmmo(const int weaponID, const bool checkAlt=true) const
if checkAlt is false only checks primary ammo
const bool HasWeapon(const int weaponID) const
const int Lives() const
bool GiveWeapon(const int weaponID, const int ammo, const bool switchNewWeapon=true)
returns true if gave ammo else returns false because already has full primary ammo....
float & LookSensScale()
Scales mouse/controller/gyro sensitivity (default = 1.0f)
const bool WeaponAllowUnderwater(const int weapon) const
bool & NoWeaponSwitchOnWaterLand()
will not auto switch weapon when entering/exiting water. (saves)
const int GetAmmo(const int weaponID) const
void ConsumeAltAmmo(const int ammo)
A map/dictionary that stores key/values as kStr. Example code to iterate each key/value:
bool IsEmpty()
bool HasKey(const kStr &in key)
Returns true if the key exists.
bool ItNext(kStr &out key, kStr &out value)
key and value is set to the next key/value in the iterator. Returns false if reached the end.
void ItBegin()
Resets the iterator back to the first key/value.
bool Find(const kStr &in key, kStr &out value)
if the key exists then sets value and returns true. If key was not found then returns false.
uint Count()
bool Remove(const kStr &in key)
Removes the key if it exists and returns true.
void Clear()
bool Add(const kStr &in key, const kStr &in value)
if the key doesn't exist then adds the key/value and returns false. If the key already exists then se...