Turok
 
Loading...
Searching...
No Matches
t1_scriptAPI.cpp
Go to the documentation of this file.
7
23
35
37{
38 AF_SOLID = 1, ///< Can be collided
39 AF_DORMANT = 2, ///< if on then is asleep (won't be updated onTick) else is awake
40 AF_SNAPTOFLOOR = 4, ///< adjust z-axis to floor on spawn
41 AF_CLIMBWALLS = 8, ///< allows entering of wall sectors
42 AF_WOUNDEDMORTALLY = 16, ///< if on this actor will drop a mortal wound because it was hit by a super arrow shot
43 AF_CASTSHADOW = 32, ///< can cast a simple shadow
44 AF_TRIGGERSTUFF = 64, ///< NOT USED
45 AF_HIDDEN = 128, ///< don't draw but continue updating. can't be collided
46 AF_ACTIVATED = 256, ///< was triggered
47 AF_DISABLED = 512, ///< don't update animations
48 AF_ENTEREDAREAEVENT = 1024, ///< just entered a trigger sector
49 AF_REMOVEONCOMPLETION = 2048, ///< remove after finishing a special animation
50 AF_NOBLOOD = 4096, ///< don't spawn particles flagged as blood
51 AF_AVOIDWATER = 8192, ///< clip against edges linking to water sectors
52 AF_FLOATINWATERONDEATH = 16384, ///< rise to the surface while dead
53 AF_DEAD = 32768, ///< actor is dead. handle special cases for collision
54 AF_STATIONARY = 65536, ///< Sniper. don't update the animation's root motion
55 AF_ALIGNTOFLOOR = 131072, ///< rotate along slopes
56 AF_NODRAW = 262144, ///< don't render
57 AF_NONSHOOTABLE = 524288, ///< NOT USED. suppose to be: can't be shot at (ignores hitscans)
58 AF_FULLVOLUME = 1048576, ///< all sounds coming from this actor will be heard at full volume
59 AF_CANBETOUCHED = 2097152, ///< allow invoking the OnTouch callback
60 AF_IGNORESOUNDEVENTS = 4194304, ///< don't call kexAnimState::Action_PlaySound
61 AF_TRIGGERANIMATION = 8388608, ///< play special animation on trigger/spawn
62 AF_HOLDTRIGGERANIM = 16777216, ///< pause special animation until triggered (is also invincible)
63 AF_TRIGGERNAIMDELAY = 33554432, ///< delay a bit before starting special animation
64 AF_STAYINWATER = 67108864, ///< can't exit water sectors
65 AF_ALWAYSACTIVE = 134217728, ///< never sleep or go dormant
66 AF_COLLIDEDWITHWALL = 268435456, ///< collided with an edge. cleared at every OnTick call
67 AF_INVINCIBLE = 536870912, ///< will not recieve damage. OnDamage and OnDeath are never called
68 AF_ALLOWTINYENEMYCHEAT = 1073741824, ///< affected by tiny enemy game cheat
69 AF_NOMOVEMENT = -2147483648 ///< will not do collision movement
70};
71
73{
75 ASF1_PROJECTILEATTACK1 = 2, ///< High Priest Flame Attack (anim_aiRangeAttack1)
76 ASF1_LEADER = 4, ///< Flocker ai run toward Leaders to get attention.
78 ASF1_EXPLOSIONDEATH = 16, ///< NOT USED
80 ASF1_PROJECTILEATTACK2 = 64, ///< Pistol Fire (anim_aiRangeAttack2)
81 ASF1_NOREPEATEXPLOSION = 128, ///< NOT USED
82 ASF1_DIEONEXPLOSION = 256, ///< NOT USED
83 ASF1_FLOCKER = 512, ///< flocks to a leader kAI
84 ASF1_SLOW = 1024, ///< NOT USED
85 ASF1_RANDOMRESURRECTION = 2048, ///< NOT USED
86 ASF1_RANDOMFEIGNDEATH = 4096, ///< NOT USED
87 ASF1_KAMIKAZE = 8192, ///< if has no target then targets player and sets agitation to 300
88 ASF1_AVOIDPLAYERS = 16384, ///< NOT USED
89 ASF1_FLOATINWATERONDEATH = 32768, ///< kAI will float up to the top of the water when they are dead
90 ASF1_TELEPORT = 65536, ///< allows kAI to teleport on SetupAISpawnFlags
91 ASF1_CASTSHADOW = 131072, ///< sets AF_CASTSHADOW on SetSpawnParams
92 ASF1_TELEPORTWAIT = 262144, ///< allows enemy to move around for 1.5 - 4.5 seconds before teleporting back in.
93 ASF1_USESTRONGATTACKS = 524288, ///< anim_aiMelee1
94 ASF1_USEWEAKATTACKS = 1048576, ///< anim_aiAltMelee1
95 ASF1_SNIPER = 2097152,
96 ASF1_MELTONDEATH = 4194304, ///< allows melt effect and regeneration
97 ASF1_AVOIDWATER = 8388608, ///< sets AF_AVOIDWATER on SetSpawnParams
98 ASF1_FLYING = 16777216, ///< NOT USED
101 ASF1_TRIGGERSTUFF = 134217728, ///< Sets AF_TRIGGERSTUFF on SetupSpawnParams
102 ASF1_CANNOTCAUSEAFIGHT = 268435456, ///< if another actor was damaged by this actor with this flag set then other actor will not target this actor.
103 ASF1_NOWALLCOLLISION = 536870912, ///< NOT USED
104 ASF1_SCREENSHAKE = 1073741824, ///< Used in floor mover scripts to shake screen.
105 ASF1_RESPAWNANIMATION = -2147483648 ///< Enables respawning animation effect
106};
107
109{
110 ASF2_DROPITEM_MASK1 = 1, ///< Explosive shells
111 ASF2_DROPITEM_MASK2 = 2, ///< Grenade
112 ASF2_DROPITEM_MASK3 = 4, ///< Medium Health
113 ASF2_DROPITEM_MASK4 = 8, ///< Full Health
114 ASF2_DROPITEM_MASK5 = 16, ///< Ultra Health
115 ASF2_DROPITEM_MASK6 = 32, ///< Small Health
116 ASF2_DROPITEM_MASK7 = 64, ///< Large Health
117 ASF2_DROPITEM_MASK8 = 128, ///< Minigun ammo
118 ASF2_DROPITEM_MASK9 = 256, ///< Mortal Wound
119 ASF2_DROPITEM_MASK10 = 512, ///< 4 Rockets
120 ASF2_DROPITEM_MASK11 = 1024, ///< Shotgun Shells
121 ASF2_DROPITEM_MASK12 = 2048, ///< Energy Cell
122 ASF2_DROPITEM_MASK13 = 4096, ///< Large Energy Cell
123 ASF2_DROPITEM_MASK14 = 8192, ///< Clip
124 ASF2_REMOVEONCOMPLETION = 16384, ///< Sets AF_REMOVEONCOMPLETION
127 ASF2_PROJECTILEATTACK3 = 131072, ///< crouch rifle Fire (anim_aiRangeAttack7)
128 ASF2_PROJECTILEATTACK4 = 262144, ///< (anim_aiRangeAttack8)
129 ASF2_DROPITEMONDAMAGE = 524288, ///< NOT USED
130 ASF2_NOAUTOMAPDRAW = 1048576, ///< if map all or show enemies cheats are on then will not draw this actor on the automap.
131 ASF2_ALTERNATEMOVES = 2097152, ///< is for holding two handed weapons
132 ASF2_UNUSED1 = 4194304, ///< NOT USED
133 ASF2_UNUSED2 = 8388608, ///< NOT USED
134 ASF2_PROJECTILEATTACK5 = 16777216, ///< Stand Rifle Fire (anim_aiRangeAttack5)
135 ASF2_PROJECTILEATTACK6 = 33554432, ///< Pipe Blow (anim_aiRangeAttack6)
136 ASF2_MORTALWOUNDIMPACT = 67108864, ///< 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 = 134217728, ///< sets AF_STAYINWATER on SetSpawnParams
138 ASF2_WARPDEATH = 268435456, ///< NOT USED
139 ASF2_STOREWARPRETURN = 536870912, ///< Used in portal scripts
140 ASF2_PROJECTILEATTACK7 = 1073741824, ///< Grenade Throw (anim_aiRangeAttack3)
141 ASF2_PROJECTILEATTACK8 = -2147483648 ///< High Priest Homing Blue Flame (anim_aiRangeAttack4)
142};
143
145{
146 ASF3_RETURNWARP = 1, ///< Used in portal scripts
147 ASF3_PLAYTRIGGERANIMONCE = 2, ///< MarkPersistentBit(false) when activated
148 ASF3_REGENERATEFROMSTART = 4, ///< Regen from starting position
149 ASF3_WALKINSTRAIGHTLINE = 8, ///< Set animation to Blend(ANIM_WALKING, (m_animSpeed * m_animScalar), 10, ANF_LOOP|ANF_ROOTMOTION); and do nothing else.
150 ASF3_KILLOUTSIDEOFVIEW = 16, ///< NOT USED
151 ASF3_NOTHINKER = 32, ///< AI will not function. Actores will not update movement. Actors OnBeginLevel will set their animation to ANIM_SPECIAL_EVENT.
152 ASF3_AVOIDPLAYERS2 = 64, ///< NOT USED
153 ASF3_NOVIOLENTDEATH = 128, ///< ANIM_AIDEATHSTAND and ANIM_DEATHSTANDALT will not play when kAI is killed.
154 ASF3_PROJECTILEATTACK9 = 256, ///< Demon chest Hadoken (anim_aiRangeAttack9)
155 ASF3_PROJECTILEATTACK10 = 512, ///< High Priest Lightning Red Flames (anim_aiRangeAttack10)
156 ASF3_MAKESPAWNANIMVISIBLE = 1024, ///< clears actor flags: ~(AF_HIDDEN|AF_DISABLED)
157 ASF3_NODRAWONCAMERA = 2048 ///< Will not draw this actor when viewing from camera unless camera flags has CMF_SHOW_HIDDEN_OBJECTS.
158};
159
161{
165 PF_GOD = 8, ///< Is reset when level beings
166 PF_JUMPING = 16, ///< is jumping (moving up). flag is off when reached max jump height or let go of jump button.
168 PF_INWARPAREA = 64, ///< in sector area with AAF_TELEPORT flag.
172 PF_PREVENTDEATHCAM = 1024, ///< will stop the death cinematic or the deadAnimView from triggering when the player dies.
173 PF_FIREDPROJECTILE = 2048, ///< set when FireProjectile is called. Cleared OnTick if weapon is not in WS_FIRE state and player is not locked.
174 PF_FALLINGDEATHPIT = 4096, ///< currently falling in a death pit. Cleared after level begins.
175 PF_WEAPONSTEAL = 8192, ///< on when campaigner steals weapon
176 PF_NOSECTORMUSIC = 16384, ///< disables music changes when changing sectors
177 PF_NOTOUCH = 32768 ///< disables invoking onTouch callbacks
178};
179
190
191enum EnumAIFlags
192{
193 AIF_ATTACKING = 1, ///< playing an attacking animation
197 AIF_BLOWNAWAY = 16, ///< being blown away by explosion
203 AIF_NOCHASE = 1024, ///< disable chase logic
205 AIF_NOTHINK = 4096, ///< don't run ai logic
206 AIF_RUNNING = 8192, ///< Is playing running animation
211 AIF_TELEPORTAWAY = 262144, ///< playing teleport out animation
212 AIF_TELEPORTMOVESLOW = 524288, ///< chasing while underground
213 AIF_TELEPORTING = 1048576, ///< in teleport state. ignore all chase logic
214 AIF_TELEPORTIN = 2097152, ///< playing teleport in animation
215 AIF_WAITFORCYCLE = 4194304, ///< prevent other animations from interrupting until the current one finishes
216 AIF_DAMAGEPANIC = 8388608 ///< become aggressive when target is outside it's active threshold (good for forcing AI to attack their target)
218
232
240
242{
244 CRF_FLOOR = 1, ///< made contact with a floor
245 CRF_CEILING = 2, ///< made contact with a ceiling
246 CRF_WALL = 4, ///< made contact with an edge (sector edge that isn't linked to another sector)
247 CRF_OBJECT = 8, ///< made contact with an actor
248 CRF_MESH = 16, ///< made contact with a static object
249 CRF_ADJUST = 32, ///< z-axis was adjusted (ceiling or floor)
250 CRF_WALLRADIUS = 64 ///< made contact with an edge during the wall radius collision test
251};
252
254{
258 WS_FIRE = 3, //< Is currently firing
259 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.
260 WS_WALK = 5, ///< NOT USED
261 WS_RUN = 6, ///< NOT USED
262 WS_DISCHARGE = 7, ///< set after OnEndFire is called. If was in WS_FIRE state and not pressing the Attack button.
263 WS_FIREUNDERWATER = 8 ///< NOT USED
264};
265
281
297
327
341
342enum EnumDifficulty
343{
349
351{
352 CF_CLIPEDGES = 1, ///< clip movement against edges that don't link to sectors
353 CF_IGNOREBLOCKERS = 2, ///< don't clip edges belonging to blocking sectors
354 CF_DROPOFF = 4, ///< allows passing through platforms or ledges
355 CF_NOENTERWATER = 8, ///< block all edges that links to a water sector
356 CF_NOEXITWATER = 16, ///< block all edges that links to a non-water sector
357 CF_NOCLIPSTATICS = 32, ///< don't collide with static models
358 CF_NOCLIPACTORS = 64, ///< don't collide with dynamic objects/actors
359 CF_WALKWALLS = 128, ///< don't restrict movement to steep slopes
360 CF_COLLIDEFLOORS = 256, ///< project and clip movement against non-flat floors
361 CF_HITSCAN = 512, ///< performs a single-pass trace. useful for hitscans
362 CF_ALLOWCLIMB = 1024, ///< collide with sectors flagged as climbable
363 CF_ALLOWCRAWL = 2048, ///< collide with sectors flagged as crawlable
364 CF_NOSTEPDOWN = 4096, ///< don't clamp z-axis when walking down slopes
365 CF_NOSLOPESTEP = 8192, ///< don't project z-axis movement along slopes
366 CF_COLLIDEHEIGHT = 16384, ///< clip against ceilings
367 CF_COLLIDECORPSES = 32768, ///< clip against actors flagged as dead
368 CF_NOEXITWALLS = 65536, ///< clip all edges, regardless if they link to another sector or not
369 CF_NOCOLLIDEFUNC = 131072, ///< don't invoke the OnCollide callback on the moving object
370 CF_NOFLOORADJUST = 262144, ///< don't keep z-axis above floor plane
371 CF_NOCEILINGADJUST = 524288, ///< don't keep z-axis below ceiling plane
372 CF_COLLIDEWATER = 1048576, ///< clip movement against the water surface
373 CF_USEWALLRADIUS = 2097152, ///< clip and project movement away from walls based on wall radius
374 CF_NOCLIPTARGETACTORS = 4194304, ///< don't clip actors that are targeted by moving object
375 CF_COLLIDETRIGGERS = 8388608, ///< block edges belonging to a trigger
376 CF_STANDONOBJECTS = 16777216, ///< allow vertical clipping of objects
377 CF_GREASESLIDEOBJECTS = 33554432, ///< always keep movement projected away from collided objects
378 CF_ALLOWRESTRICTEDAREAS = 67108864, ///< don't collide with edges belonging to a restricted sector
379 CF_COLLIDECLIFFS = 134217728, ///< collide with non-walkable floors
380 CF_CHECKLINKEDBRIDGES = 268435456, ///< do extensive checks against overlapping bridge sectors
381 CF_POLYCOLLISION = 536870912 ///< clip movement against all model polygons of an object
382};
383
385{
386 WLT_INVALID = 0, ///< Not in water sectors
387 WLT_OVER = 1, ///< In water sector but over the water height
388 WLT_BETWEEN = 2, ///< In water sector and floating above the water
389 WLT_UNDER = 3 ///< In water sector and under the water height
390};
391
392/**
393 * @brief Lerp type when doing AutoPlayPositionTrack, AutoPlayRotationTrack, or AutoPlayBlendTrack.
394 * When a view has one of those active the view's time variable is then increased by GAME_DELTA_TIME.
395 */
397{
398 CMLT_NONE = 0, ///< time is set to time / speed.
399 CMLT_LINEAR = 1, ///< time is set to time / speed.
400 CMLT_LINEARLOOP = 2, ///< time is set to time / speed. If time is > 1.0 then time -= 1.0
401 CMLT_COSINE = 3, ///< time will never be higher than speed. time = CosTween(time * (1.0f / speed));
402 CMLT_COSINE_POW = 4 ///< time will never be higher than speed. time = CosTween(Pow(time * (1.0f / speed), 3));
403};
404
417
428
430{
433 AAF_TOGGLE = 4, ///< if on and AAF_BLOCK is on then sectors won't be marked on automap until it's unblocked. Used for door areas.
434 AAF_CLIFF = 8, ///< is a wall
435 AAF_CLIMB = 16, ///< climb up sectors faster than AAF_LADDER
436 AAF_ONESIDED = 32, ///< Bridge
439 AAF_ENTERCRAWL = 256, ///< Exactly the same as AAF_CRAWL
441 AAF_ENTERED = 1024, ///< 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.
443 AAF_RESTRICTED = 4096, ///< kAI can't enter the area
444 AAF_SLOPETEST = 8192, ///< 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).
446 AAF_MAPPED = 32768,
447 AAF_EVENT = 65536,
448 AAF_REPEATABLE = 131072, ///< Unused
449 AAF_TELEPORT = 262144,
450 AAF_DAMAGE = 524288,
451 AAF_DRAWSKY = 1048576,
453 AAF_LAVA = 4194304,
454 AAF_EVENTSOUND = 8388608,
455 AAF_ANTIGRAVITY = 16777216,
456 AAF_LADDER = 33554432, ///< climb up sectors slower than AAF_CLIMB
457 AAF_CHECKPOINT = 67108864,
458 AAF_SAVEGAME = 134217728,
459 AAF_WARPRETURN = 268435456, ///< Unused
460 AAF_SHALLOWWATER = 536870912,
461 AAF_DRAWSUN = 1073741824,
462 AAF_STOREWARPRETURN = -2147483648 ///< Unused
463};
464
482
483/**
484 * @class array<T>
485It is possible to declare array variables with the array identifier followed by the type of the elements within angle brackets.
486
487Example:
488
489 @code{.cpp}
490 array<int> a, b, c;
491 array<Foo@> d;
492 @endcode
493
494a, b, and c are now arrays of integers, and d is an array of handles to objects of the Foo type.
495
496When 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:
497
498 @code{.cpp}
499 array<int> a; // A zero-length array of integers
500 array<int> b(3); // An array of integers with 3 elements
501 array<int> c(3, 1); // An array of integers with 3 elements, all set to 1 by default
502 array<int> d = {5,6,7}; // An array of integers with 3 elements with specific values
503 @endcode
504
505Multidimensional arrays are supported as arrays of arrays, for example:
506
507 @code{.cpp}
508 array<array<int>> a; // An empty array of arrays of integers
509 array<array<int>> b = {{1,2},{3,4}} // A 2 by 2 array with initialized values
510 array<array<int>> c(10, array<int>(10)); // A 10 by 10 array of integers with uninitialized values
511 @endcode
512
513Each 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.
514
515 @code{.cpp}
516 a[0] = some_value;
517 @endcode
518
519When the array stores handles the elements are assigned using the handle assignment.
520
521 @code{.cpp}
522 // Declare an array with initial length 1
523 array<Foo@> arr(1);
524 @endcode
525
526 @code{.cpp}
527 // Set the first element to point to a new instance of Foo
528 @arr[0] = Foo();
529 @endcode
530
531Arrays can also be created and initialized within expressions as anonymous objects.
532
533 @code{.cpp}
534 // Call a function that expects an array of integers as input
535 foo(array<int> = {1,2,3,4});
536 @endcode
537
538 */
539template <class T>
540class array<T>
541{
542public:
543 void insertAt(uint index, const T&in value); ///< Inserts a new element into the array at the specified index.
544 void insertAt(uint index, const T[]&inout arr); ///< Inserts another array of elements into the array at the specified index.
545 void insertLast(const T&in value); ///< Appends an element at the end of the array.
546 void removeAt(uint index); ///< Removes the element at the specified index.
547 void removeLast(); ///< Removes the last element of the array.
548 void removeRange(uint start, uint count); ///< Removes count elements starting from start.
549 uint length() const; ///< Returns the length of the array.
550 void reserve(uint length);
551 void resize(uint length); ///< Sets the new length of the array.
552 void sortAsc(); ///< Sorts the elements in the array in ascending order. For object types, this will use the type's opCmp method.
553 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.
554 void sortDesc(); ///< Sorts the elements in the array in descending order. For object types, this will use the type's opCmp method.
555 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.
556 void reverse(); ///< Reverses the order of the elements in the array.
557
558 /**
559 * @brief Returns the index of the first element that has the same value as the wanted value.
560 * 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.
561 * If no match is found will return a negative value.
562 */
563 int find(const T&in value) const;
564
565 /**
566 * @brief Returns the index of the first element that has the same value as the wanted value.
567 * 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.
568 * If no match is found will return a negative value.
569 */
570 int find(uint startAt, const T&in value) const;
571
572 /**
573 * @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.
574 * If no match is found will return a negative value.
575 */
576 int findByRef(const T&in value) const;
577
578 /**
579 * @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.
580 * If no match is found will return a negative value.
581 */
582 int findByRef(uint startAt, const T&in value) const;
583 bool isEmpty() const;
584 T& opIndex(uint index);
585 const T& opIndex(uint index) const;
586 T[]& opAssign(const T[]&in);
587 bool opEquals(const T[]&in) const;
588 funcdef bool less(const ?&in a, const ?&in b); ///< sorting function for sort
589 void sort(less&in, uint startAt = 0, uint count = uint ( - 1 )); ///< sorts array using the passed in less function
590};
591
592/**
593 * @class kStr
594 * @brief String class functions
595 */
596class kStr
597{
598public:
600 kStr(const kStr&in s);
601 uint Hash() const; ///< Returns HashID from this instance
602 kStr& ToUpper(); ///< Converts string to upper case characters
603 kStr& ToLower(); ///< Converts string to lower case characters
604 int Atoi() const; ///< Converts string to int
605 float Atof() const; ///< Converts string to float
606 bool Contains(const kStr&in) const; ///< contains the string
607 bool ContainsNoCase(const kStr&in) const; ///< contains the string ignoring case
608 bool IsEmpty() const; ///< length of string is 0
609 uint64 IndexOf(const kStr&in) 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.
610 uint64 Length() const; ///< Returns the length of the string
611 int8 opIndex(const int64 i); ///< Returns The ASCII code of the character at the strings index
612 bool opEquals(const kStr&in s) const;
613 kStr& opAssign(const kStr&in s);
614 kStr opAdd(const kStr&in s) const;
615 kStr opAdd(bool b) const;
616 kStr opAdd(int i) const;
617 kStr opAdd(uint i) const;
618 kStr opAdd(int64 i) const;
619 kStr opAdd(uint64 i) const;
620 kStr opAdd(int16 i) const;
621 kStr opAdd(uint16 i) const;
622 kStr opAdd(float f) const;
623 kStr& opAddAssign(const kStr&in s);
625};
626
627/**
628 * @class kAngle
629 * @brief Angle functions
630 */
632{
633public:
635 kAngle(float rads);
636 kAngle(const kAngle&in other);
637 float Diff(const float rads) const;
638 float Diff(const kAngle&in other) const;
639 float Interpolate(const float a, const float b) const;
640 kAngle opAdd(const float f) const;
641 kAngle& opAddAssign(const float f);
642 kAngle opSub(const float f) const;
643 kAngle& opSubAssign(const float f);
644 kAngle opAdd(const kAngle&in a) const;
646 kAngle opSub(const kAngle&in a) const;
648 kAngle& opAssign(const float f);
649 kAngle& opAssign(const kAngle&in a);
650 kAngle opNeg() const;
651 float opImplConv();
652};
653
654/**
655 * @class kVec3
656 * @brief Representation of 3D vectors and points.
657 */
658class kVec3
659{
660public:
662 kVec3(float x, float y, float z);
663 kVec3(const kVec3&in v);
664 kVec3& Normalize(); ///< Makes this vector have a magnitude of 1
665 kVec3 Cross(const kVec3&in v) const; ///< Cross Product of two vectors
666 float Dot(const kVec3&in v) const; ///< Dot Product of two vectors
667 float Length() const; ///< Returns the length of this vector. Exactly the same as Unit()
668 float LengthSq() const; ///< Returns the squared length of this vector. Exactly the same as UnitSq()
669 float DistanceSq(const kVec3&in other) const; ///< Returns the squared distance between this instance and other
670 float ToYaw(); ///< Returns the Yaw direction in Rads
671 float ToPitch(); ///< Returns the Pitch direction in Rads
672 void Clear(); ///< Sets x, y and z components to 0
673 void Set(const float x, const float y, const float z); ///< Set x, y and z components of this kVec3
674 kVec3 Lerp(const kVec3&in other, const float t) const; ///< Linearly interpolates between two vectors
675 kVec3& Lerp(const kVec3&in other, const float t); ///< Linearly interpolates between two vectors
676 kVec3& Project(const kVec3&in normal, const float value); ///< Projects a vector onto another vector
677 kVec3& Reflect(const kVec3&in normal, const float energyFactor); ///< Reflects a vector off the plane defined by a normal
678 kVec3& Randomize(const float value); ///< Randomizes x, y, z, components by value
679 kVec3& CubicCurve(const kVec3&in pt1, const float value, const kVec3&in pt2);
680 kVec3& QuadraticCurve(const kVec3&in pt1, const float value, const kVec3&in pt2, const kVec3&in pt3);
681 kVec3 opAdd(const kVec3&in v) const;
682 kVec3 opAdd(const float f) const;
683 kVec3& opAddAssign(const kVec3&in v);
684 kVec3& opAddAssign(const float f);
686 kVec3 opSub(const kVec3&in v) const;
687 kVec3 opSub(const float f) const;
688 kVec3& opSubAssign(const kVec3&in v);
689 kVec3& opSubAssign(const float f);
690 kVec3 opMul(const kVec3&in v);
691 kVec3 opMul(const float val);
692 kVec3& opMulAssign(const kVec3&in v);
693 kVec3& opMulAssign(const float f);
694 kVec3 opDiv(const kVec3&in v);
695 kVec3 opDiv(const float val);
696 kVec3& opDivAssign(const kVec3&in v);
697 kVec3& opDivAssign(const float f);
698 kVec3& opAssign(const kVec3&in v);
699 float opIndex(int i) const;
700 float& opIndex(int i);
701 float Distance(const kVec3&in other) const; ///< Returns the distance between this instance and other vector
703 kVec3 opMul(const kQuat&in rot) const;
704 kVec3& opMulAssign(const kQuat&in rot);
706 kQuat ToQuat() const;
707 float Unit() const; ///< Returns the length of this vector. Exactly the same as Length()
708 float UnitSq() const; ///< Returns the squared length of this vector. Exactly the same as LengthSq()
709 float x;
710 float y;
711 float z;
712};
713
714/**
715 * @class kQuat
716 * @brief Quaternions used to represent rotations
717 */
718class kQuat
719{
720public:
722 kQuat(float x, float y, float z, float w);
723 kQuat(float w, kVec3&in point);
724 kQuat(float x, float y, float z);
725 kQuat(const kQuat&in other);
728 kQuat Slerp(const kQuat&in rot, float t) const;
729 kQuat Inverse() const;
730 void GetAngles(float&out yaw, float&out pitch, float&out roll);
731 kQuat Diff(const kQuat&in rot) const;
732 void Set(const float x, const float y, const float z, const float w);
733 void Clear(); ///< x,y,z = 0.0 w = 1.0
734 kQuat opAdd(const kQuat&in rot);
735 kQuat opSub(const kQuat&in rot);
736 kQuat opMul(const kQuat&in rot);
737 kQuat& opAssign(const kQuat&in rot);
738 kQuat& opMulAssign(const kQuat&in rot);
739 kStr ToString() const;
740 float x;
741 float y;
742 float z;
743 float w;
744};
745
746/**
747 * @class kPlane
748 * @brief Plane functions
749 */
751{
752public:
754 kPlane(const float a, const float b, const float c, const float d);
755 kPlane(const kVec3&in a, const kVec3&in b, const kVec3&in c);
756 kPlane(const kVec3&in a, const kVec3&in b);
757 kPlane(const kAngle&in a);
758 const kVec3& Normal() const;
760 float Dot(const kVec3&in point) const;
761 float Dot(const kPlane&in plane) const;
762 float Distance(const kVec3&in point) const; ///< 0 = PSIDE_ON. > 0 is PSIDE_FRONT. < 0 PSIDE_BACK.
763 float ToYaw() const; ///< Yaw of this plane.
764
765 /**
766 * @brief Returns true if yaw is facing toward the plane. Usually used for climbing sectors.
767 * @code{.cpp}
768 * bool Climbable(const float yaw) const
769 * {
770 * return (floorPlane.c <= 0.5f && flags & AAF_CLIMB && floorPlane.IsFacing(yaw));
771 * }
772 * @endcode
773 */
774 bool IsFacing(const float yaw) const;
775 const int PointOnSide(const kVec3&in point) const; ///< Returns EnumPlaneSide. If point is in front, behind or on the plane.
776};
777
778class kColor ///< Not used (included automatically from kexengine)
779{
780public:
782 kColor(const kColor&in c);
783 kColor(uint8 r, uint8 g, uint8 b, uint8 a);
784 kColor(const kColor&in rgb, uint8 a);
785 kColor(uint8 rgb, uint8 a);
786 kColor(uint rgba);
787 kColor(float r, float g, float b);
788 uint DwColor() const;
789 kVec3 ToVec3() const;
790 void FromVec3(const kVec3&in v);
792 void FromVec3Linear(const kVec3&in v);
794 void SetSaturation(float);
795 void SetLuminance(float);
796 float GetSaturation() const;
797 float GetLuminance() const;
798 kColor& opAssign(const kColor&in c);
799 void LerpRGB(const kColor&in c, float t);
802 void RGBToHSV(float&out hue, float&out sat, float&out result) const;
803 void HSVToRGB(float hue, float sat, float val);
804 void RGBToHSL(float&out hue, float&out sat, float&out lit) const;
805 void HSLToRGB(float hue, float sat, float lit);
806 bool opEquals(const kColor&in c) const;
807 kColor opAdd(const kColor&in c) const;
808 kColor opSub(const kColor&in c) const;
809 kColor opMul(const kColor&in c) const;
810 kColor opMul(float f) const;
815 uint8 r;
816 uint8 g;
817 uint8 b;
818 uint8 a;
819};
820
821class kBitDelta ///< Not used (garbage included automatically from kexengine)
822{
823public:
824 bool WriteByte(const uint8 i);
825 uint8 ReadByte();
826};
827
828class kexTranslation ///< Not used (garbage included automatically from kexengine)
829{
830public:
831 uint GetGroupIndex(const kStr&in groupName);
832 kStr GetString(const kStr&in key, kexLocPlatform_e plat) const;
833 kStr GetString(int key, kexLocPlatform_e plat) const;
834 kStr GetGroupString(const kStr&in key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
835 kStr GetGroupString(int key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
836 kStr TranslateString(const kStr&in key, kexLocPlatform_e plat) const;
837 kStr TranslateString(const kStr&in key) const; ///< Same as Game.GetLocalizedText
838 kStr TranslateGroupString(const kStr&in key, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
839 kStr TranslateStringWithArgs(const kStr&in key, const kDict&in pairs, uint plat) const; ///< plat: kexLocPlatform_e
840 kStr TranslateGroupStringWithArgs(const kStr&in key, const kDict&in pairs, uint groupIndex, uint plat) const; ///< plat: kexLocPlatform_e
841};
842
843class ref
844{
845public:
848 ref(const ref&in);
849 ref(const ?&in);
850 void opCast(?&out);
851 ref& opHndlAssign(const ref&in);
852 ref& opHndlAssign(const ?&in);
853 bool opEquals(const ref&in) const;
854 bool opEquals(const ?&in) const;
855};
856
858{
859public:
861};
862
864{
865public:
866 void OnTick();
867 void OnSpawn();
868};
869
871{
872public:
874 void OnFire();
875 void OnEndFire();
876 void OnLower();
877 void OnRaise();
879};
880
881/**
882 * @class kDict
883 * @brief Editable Dictionary object that holds keys and values
884 */
885class kDict
886{
887public:
888 void Add(const kStr&in key, const kStr&in value); ///< Adds a new key/value
889 void Empty(); ///< Removes all keys/values
890 void SetValue(const kStr&in key, const kStr&in value); ///< Sets the value for the specified key
891 const bool HasKey(const kStr&in key); ///< Returns true if key exists
892 bool GetFloat(const kStr&in key, float&out floatResult, const float defaultValue = 0); ///< Returns true if found the key as a float type
893 bool GetInt(const kStr&in key, int&out intResult, const int defaultValue = 0); ///< Returns true if found the key as a int type
894 bool GetBool(const kStr&in key, bool&out boolResult, const bool defaultValue = false); ///< Returns true if found the key as a bool type
895 bool GetString(const kStr&in key, kStr&out stringResult); ///< Returns true if found the key as a kStr type
896 bool GetVector(const kStr&in key, kVec3&out vectorResult); ///< Returns true if found the key as a kVec3 type
897};
898
899/**
900 * @class kDictMem
901 * @brief Read only Dictionary object that holds keys and values
902 */
904{
905public:
906 bool GetFloat(const kStr&in key, float&out floatResult, const float defaultValue = 0); ///< Returns true if found the key as a float type
907 bool GetInt(const kStr&in key, int&out intResult, const int defaultValue = 0); ///< Returns true if found the key as a int type
908 bool GetBool(const kStr&in key, bool&out boolResult, const bool defaultValue = false); ///< Returns true if found the key as a bool type
909 bool GetString(const kStr&in key, kStr&out stringResult); ///< Returns true if found the key as a kStr type
910 bool GetVector(const kStr&in key, kVec3&out vectorResult); ///< Returns true if found the key as a kVec3 type
911};
912
913/**
914 * @class kSelectionListInt
915 * @brief For selecting a int value based on weights
916 */
918{
919public:
921 void AddItem(int item, const int weight);
922 int& Select(); ///< Returns a value based on item weights
923 void Reset(); ///< clears all items in the list
924 const uint GetNumEntries() const; ///< returns number of items in the list
926};
927
928/**
929 * @class kSelectionListFloat
930 * @brief For selecting a float value based on weights
931 */
933{
934public:
936 void AddItem(float item, const int weight);
937 float& Select(); ///< Returns a value based on item weights
938 void Reset(); ///< clears all items in the list
939 const uint GetNumEntries() const; ///< returns number of items in the list
941};
942
944{
945public:
946 void SetModel(const kStr&in modelPath, const kStr&in modelAnimPath);
947 void SetRotationOffset(const int nodeIndex, const float rads, const float x, const float y, const float z);
948 void SetRotationOffset(const int nodeIndex, const kQuat&in rotation);
949 void SetTexture(const int section, const int textureID);
950 void SetVisibility(const int nodeIndex, const bool visible);
951 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.
952 void AddTrailEffect(const kStr&in trailName, const int nodeIndex);
953 void RemoveTrailEffect(); ///< Removes all trail effects
956 const int GetNumNodes() const;
957 kVec3 GetNodeOrigin(const int node, const kVec3&in offset);
958 kQuat GetNodeRotation(const int node);
959 kVec3 GetNodeScale(const int node);
962 const bool IsMorph() const;
963
964 /**
965 * @brief Set Morph Updating.
966 * @param bUpdate: Set to false to handle updating it yourself per ModelFile (not per Actor).
967 *
968 Default Tick code:
969 @code{.cpp}
970 if(time >= 1.0f)
971 {
972 time = 0;
973 frame++;
974
975 if(frame >= maxFrames)
976 {
977 frame = 2;
978 }
979 nextFrame = frame + 1;
980 }
981 time += GAME_DELTA_TIME * 7.5f;
982 @endcode
983 */
984 void SetMorphUpdating(const bool bUpdate);
985
986 /**
987 * @brief Get Morph frame info
988 * @param frame: 1=Init Frame, 2=Start Loop Frame. >= maxFrames then 1.
989 * @param nextFrame: 2=Init Frame, 3=Start Loop Frame. >= maxFrames then 2.
990 * @param maxFrames
991 * @param time: 0..1 (lerp time between frame and nextFrame meshes)
992 */
993 void GetMorphFrame(int&out frame, int&out nextFrame, int&out maxFrames, float&out time) const;
994 void SetMorphFrame(const int frame, const int nextFrame, const float time);
995};
996
998{
999public:
1000 void Blend(const int animID, float speed, float blend, int flags); ///< EnumAnimStateFlags
1001 void Set(const int animID, float speed, int flags); ///< EnumAnimStateFlags
1002 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.
1003 const int NumFrames(); ///< number of frames in this animation
1004 const float PlayTime(); ///< increases by GAME_DELTA_TIME if not stopped or paused.
1005 const float TrackTime(); ///< time from 0(on first frame) to 1(on last frame).
1006 bool IsPlaying(const int animID); ///< Returns true if current animations ID is animID and the animation is not stopped.
1007 bool CheckAnimID(const int animID); ///< checks if animID exists
1008 const int PlayingID() const; ///< the current animations ID
1009 void Stop(); ///< flags |= ANF_STOPPED; flags &= ~ANF_LOOP;
1010 void Pause(); ///< flags |= ANF_PAUSED;
1011 void Resume(); ///< flags &= ~ANF_PAUSED;
1012 const bool Stopped() const; ///< (flags & ANF_STOPPED) != 0
1013 const bool Blending() const; ///< (flags & ANF_BLEND) != 0
1014 const bool Looping() const; ///< (flags & ANF_LOOP) != 0
1015 const bool CycleCompleted() const; ///< (flags & ANF_CYCLECOMPLETED) != 0
1016 void ChangeSpeed(const float speed); ///< Scales speed of the current animation where 1.0 = 15fps and 4.0 = 60fps
1017 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).
1018 void SetPlayTime(const float time); ///< The total time in seconds this animation has been playing
1019 void SetTrackTime(const float time); ///< 0.0(first frame) to 1.0(last frame)
1020 const int TrackFrame(void) const; // current frame playing for the current animation.
1021 const int TrackNextFrame(void) const; // next frame to play for the current animation.
1022 int flags; ///< EnumAnimStateFlags
1023};
1024
1025/**
1026 * @class kActor
1027 * @brief Base type used by all actors.
1028 */
1030{
1031public:
1032 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.
1036 kVec3& Origin(); ///< Position in world space
1039 void SetTarget(kActor@ actor);
1041 void SetSector(const uint sectorIndex);
1042 void Remove(); ///< Removes the actor and sets stale to true. Actor will only internally be removed when there are no references to this actor.
1046 int16& Health();
1047 int& Type(); ///< The actors Type ID
1048 int& ImpactType(); ///< EnumImpactType
1049 bool &IgnoreSectorHeightChange(void); ///< if true will not change position(or velocity and movement) when sector height changes.
1052 uint& Flags(); ///< EnumActorFlags
1053 const uint SpawnFlags1() const; ///< EnumActorSpawnFlags1
1054 const uint SpawnFlags2() const; ///< EnumActorSpawnFlags2
1055 const uint SpawnFlags3() const; ///< EnumActorSpawnFlags3
1056 const int TID() const;
1057 float& Radius();
1058 float& Height();
1059 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.
1060 float& WallRadius();
1061 float& Gravity();
1062 float& Friction();
1063 float& AnimSpeed();
1064 float& BounceDamp();
1065 float& FloorHeight();
1067 const int SectorIndex();
1068 const int AreaID() const;
1069 bool InstanceOf(const kStr&in className) const; ///< example: InstanceOf("kexPuppet")
1070 void PlaySound(const kStr&in soundPath);
1071 void PlaySoundWithLookupID(const int soundID);
1074 const int GameTicks() const;
1077 const bool InWater() const;
1078 bool CheckPosition(const kVec3&in origin); ///< checks if the actor can move to this location
1079 bool CheckPosition(const float angle, const float distance); ///< calls CheckPosition(kVec3 origin) with location being: Actor.Origin() + (angle*distance*actor.Radius())
1080 float GetTurnYaw(const kVec3&in lookAtLocation) const;
1081 float GetAvoidanceAngle(const kVec3&in lookAtLocation, const float distance);
1082 const float GetWaterHeight() const;
1083 const bool CanSee(kActor@ actor, const uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1084 uint& ClipFlags(); ///< EnumClipFlags
1085 kDictMem@ Definition(); ///< get actors def data
1086 bool OnGround() const;
1087 int GetWaterLevel() const; ///< EnumWaterLevel
1088 kActor@ CastToActor(); ///< Casts to a kActor. Only used for kPuppet Actor().
1089 kAI@ CastToAI(); ///< Casts to kAI. returns null if isn't a kAI.
1090 void SpawnProjectile(const kStr&in fxPath, const kVec3&in pos, const kVec3&in targetLocation, const float maxAngle);
1091 void MeleeObject(const kStr&in damageType, const kVec3&in offset, const float radius);
1092 void SpawnFx(const kStr&in fxPath, const kVec3&in pos);
1093 void SpawnFx(const kStr&in fxPath, const kVec3&in pos, const kQuat&in rot);
1095 float DistanceToPoint(const kVec3&in point) const; ///< calls DistanceToPoint(x,y,z)
1096 float DistanceToPoint(const float x, const float y, const float z) const; ///< actors point is in the center
1097 void InflictGenericDamage(kActor@ inflictor, const int damage);
1098 void InflictDamage(kActor@ inflictor, const kStr&in damageDef);
1099 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);
1101 void MoveToPosition(const float x, const float y); ///< Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision for quick collision tests.
1102 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.
1103 void SetPosition(const kVec3&in pos); ///< best way to set an actors position, will also set the sector and clearinterpolation
1104
1105 /**
1106 * @brief Get a map actors param value
1107 * @param paramID
1108 * (0) Target ID -32768..32767
1109 * (1) Trigger Anim 0..255
1110 * (2) Health -32768..32767
1111 * (3) Max Regenerations -32768..32767
1112 * (4) Attach Chance 0..255
1113 * (5) Texture -128..127
1114 * (6) Params 2 -128..127
1115 * (7) Params 1 -128..127
1116 */
1117 const int16 SpawnParams(const int paramID) const;
1118 const float GetCeilingHeight() const; ///< calculates the ceiling height from the actors sector and origin. Returns 0 if not in a sector.
1119 const float GetFloorHeight() const; ///< calculates the floor height from the actors sector and origin. Returns 0 if not in a sector.
1120 void RunFxEvent(const kStr&in fxEventName); ///< Runs an ActorFX event. Example: RunFxEvent("Enemy_Freeze");
1121 const int GetSectorIndexAtLocation(const kVec3&in pos, uint excludeClipFlags = 0); ///< excludeClipFlags to ignore/disable (EnumClipFlags)
1122 void MarkPersistentBit(const bool clear);
1126 void AutomapToggle(const bool show); ///< Use with Game.AutomapCustom(true);
1127 void SetAutomapColor(const int r, const int g, const int b);
1128
1129 /**
1130 * @brief Sets the actors param value. all params are int16.
1131 * @param param
1132 * (0) Target ID -32768..32767
1133 * (1) Trigger Anim 0..255
1134 * (2) Health -32768..32767
1135 * (3) Max Regenerations -32768..32767
1136 * (4) Attach Chance 0..255
1137 * (5) Texture -128..127
1138 * (6) Params 2 -128..127
1139 * (7) Params 1 -128..127
1140 * @param value
1141 */
1142 void SetSpawnParams(const int param, const int16 value);
1143 void SetSpawnFlags1(const uint flags); ///< EnumActorSpawnFlags1
1144 void SetSpawnFlags2(const uint flags); ///< EnumActorSpawnFlags2
1145 void SetSpawnFlags3(const uint flags); ///< EnumActorSpawnFlags3
1146 void SetupSpawnParams(); ///< call after setting your actors spawnflags for them to take effect on the kActor
1147 void SetCustomDeadHeight(const bool bUse, const float height); ///< Height of actor when they are dead. Only for non map actors. (actors spawned with ActorFactory)
1148 const float GetCustomDeadHeight();
1150 const bool OverridingKeyTouchTID(); ///< used only for key pickups
1151 const int16 GetOverrideKeyTouchTID(); ///< used only for key pickups
1152 void OverrideKeyTouchTID(const bool bOverride, const int16 tid); ///< used only for key pickups to tell what key it is in the hub
1153 bool& SkipKeyTouchCinema(); ///< used only for key pickups
1154 void SetModel(kStr&in modelFile, kStr&in animFile); ///< a way to set the model/anim for actors that had no model set previously
1155 bool& TriggerInvincibility(); ///< Can't damage if true. Gets set to true if enemy has trigger anim and false when activated.
1156 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)
1157 const int MapActorIndex() const; ///< Returns -1 if not a map actor
1158 int& DifficultyMode(); ///< The difficulty this actor is currently set to
1159 void OverrideOnDamageValue(const int damage, const bool bOverride = true); ///< call in OnPreDamage
1160 bool& NoKnockBack(); ///< Will not receive knock back movement from things like the alien weapon for example.
1161 const float BaseHeight() const; ///< height of actor when spawned or when kAI regenerated
1162 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
1163 float& AirFriction(); ///< default = 1.0f
1164 float& WaterFriction(); ///< default = 0.5f (same as Friction)
1165 float& Mass(); ///< default = GAME_SCALE * 1.0f
1166 const float GetSkyHeight() const;
1167 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.
1168 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.
1169 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.
1170 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.
1171};
1172
1173/**
1174 * @class kActorIterator
1175 * @brief The way to iterate through all actors in the map. Example code:
1176 * @code{.cpp}
1177 * kActorIterator it;
1178 * kActor @actor;
1179 * while((@actor = it.Get()) !is null)
1180 * {
1181 * // Do something with actor
1182 * }
1183 * @endcode
1184 */
1186{
1187public:
1189 kActor@ Get(); ///< Returns the next actor in the iterator
1190 void Reset(); ///< Resets the iterator back to the first actor
1191};
1192
1193class kWeapon : public kActor
1194{
1195public:
1196 kVec3 TransformToOwnerPosition(); ///< returns the OffsetPosition() * the players matrix.
1197 kVec3 TransformToOwnerPosition(const kVec3&in vector); ///< returns the (OffsetPosition() + vector) * the players matrix.
1198
1199 /**
1200 * @brief SpawnsFx at the players at the position passed in * players rotation, then adds the
1201 * viewHeight + landingViewOffset to the z position. Sets PF_FIREDPROJECTILE PlayerFlags.
1202 * adjustToPerspective will change the position you pass in like this:
1203 * @code{.cpp}
1204 * float d = kexMath::Pow(47.5f / fov, fov / 60.0f);
1205 * vOrigin.y *= d;
1206 * vOrigin.z += (1.0f - d) * 2.0f;
1207 * @endcode
1208 */
1209 void FireProjectile(const kStr&in fxPath, const float x, const float y, const float z, const bool adjustToPerspective = false);
1210 bool& PreventFire(); ///< Use in OnBeginFire to internally prevent from entering its Fire state.
1211 kVec3& OffsetPosition(); ///< Offset position of weapon
1212 int& State(); ///< EnumWeaponStates
1214};
1215
1216class kAI : public kActor
1217{
1218public:
1219 uint& AIFlags(); ///< EnumAIFlags
1220 void SetupAISpawnFlags(); ///< call after setting your actors spawnflags for them to take effect on the kAI
1221 int& AttackChance(); ///< 0-100
1222 float& AttackRange(); ///< squared
1223 float& MeleeRange(); ///< squared
1224 float& LeashRadius(); ///< squared
1225 float& SightRange(); ///< squared
1226 float& LoudRange(); ///< squared
1227 float& QuietRange(); ///< squared
1228 float& FlyHeight(); ///< squared
1229 float& SightFOV(); ///< in rads
1230 int& Agitation(); ///< 0-300. 0-99=IDLE, 100-199=AGITATED, 200-300=CHASE
1231 float& AnimScalar(); ///< default = 1.0f
1232 float& BlendScalar(); ///< default = 10.0f
1233};
1234
1235class kPuppet : public kActor
1236{
1237public:
1238 float& ViewHeight(); ///< set from the players def "player.viewHeight". Origin.z + ViewHeight() + LandingViewOffset() = Cameras position.
1239 float& RecoilPitch(); ///< used for weapon recoil that modifies the players pitch.
1240 const float LandingViewOffset() const; ///< LandingViewOffset changes when jumping and falling. Origin.z + ViewHeight() + LandingViewOffset() = Cameras position.
1241 uint& PlayerFlags(); ///< EnumPlayerFlags
1244 void SetGroundForwardSpeed(const float speed); ///< default = 10.24f
1245 void SetGroundBackwardSpeed(const float speed); ///< default = -10.24f
1246 void SetGroundStrafeSpeed(const float speed); ///< default = 10.24f
1247 void SetGroundForwardAccel(const float accel); ///< default = 0.05f
1248 void SetGroundBackwardAccel(const float accel); ///< default = 0.05f
1249 void SetGroundStrafeAccel(const float accel); ///< default = 0.05f
1250 void SetGroundDeaccel(const float accel); ///< default = 0.5f
1251 void SetSwimForwardSpeed(const float speed); ///< default = 10.24f
1252 void SetSwimBackwardSpeed(const float speed); ///< default = -10.24f
1253 void SetSwimStrafeSpeed(const float speed); ///< default = 10.24f
1254 void SetSwimForwardAccel(const float accel); ///< default = 0.05f
1255 void SetSwimBackwardAccel(const float accel); ///< default = 0.05f
1256 void SetSwimStrafeAccel(const float accel); ///< default = 0.05f
1257 void SetSwimDeaccel(const float accel); ///< default = 0.5f
1258 void SetJumpMinSpeed(const float speed); ///< default = GAME_SCALE * 0.855f
1259 void SetJumpMaxSpeed(const float speed); ///< default = GAME_SCALE * 1.667f
1260 void SetJumpClimbSpeed(const float speed); ///< default = GAME_SCALE * 0.2875f
1261 void SetOverrideShadow(const int value); ///< 0=none(default), 1=Force Disable shadow, 2=Force Enable shadow
1262 void SetOverrideWalkRun(const int value); ///< 0=none(default), 1=Force Disable Walk
1263 float& Oxygen(); ///< Time in seconds. 0: full oxygen. >= 55: shows air bar. >= 70: OxygenOut is set to true.
1264 bool& OxygenOut(); ///< if true will damage player if underwater
1265 float& OverrideFOV(); ///< set to 1-179. anything else will stop overriding the fov and will use the r_fov cvar.
1266 void SetCrawl(const bool crawl); ///< use this to manually set if the player is crawling instead of setting PF_CRAWLING directly.
1267 const float GroundForwardSpeed() const; ///< default = 10.24f
1268 const float GroundBackwardSpeed() const; ///< default = -10.24f
1269 const float GroundStrafeSpeed() const; ///< default = 10.24f
1270 const float GroundForwardAccel() const; ///< default = 0.05f
1271 const float GroundBackwardAccel() const; ///< default = 0.05f
1272 const float GroundStrafeAccel() const; ///< default = 0.05f
1273 const float GroundDeaccel() const; ///< default = 0.5f
1274 const float SwimForwardSpeed() const; ///< default = 10.24f
1275 const float SwimBackwardSpeed() const; ///< default = -10.24f
1276 const float SwimStrafeSpeed() const; ///< default = 10.24f
1277 const float SwimForwardAccel() const; ///< default = 0.05f
1278 const float SwimBackwardAccel() const; ///< default = 0.05f
1279 const float SwimStrafeAccel() const; ///< default = 0.05f
1280 const float SwimDeaccel() const; ///< default = 0.5f
1281 const float JumpMinSpeed() const; ///< default = GAME_SCALE * 0.855f
1282 const float JumpMaxSpeed() const; ///< default = GAME_SCALE * 1.667f
1283 const float ClimbJumpAmount() const; ///< default = GAME_SCALE * 0.2875f
1284 const int OverrideShadow() const; ///< default = 0
1285 const int OverrideWalkRun() const; ///< default = 0
1286 const int GetState(void) const; ///< EnumPlayerStates
1287};
1288
1289/**
1290 * @class kActorFactory
1291 * @brief For Spawning Actors
1292 */
1294{
1295public:
1296 kActor@ Spawn(const int actorID, const float x, const float y, const float z, const float yaw, const int sector = - 1);
1297 kActor@ Spawn(const kStr&in actorName, const float x, const float y, const float z, const float yaw, const int sector = - 1);
1298};
1299
1301{
1302public:
1303 void StartCinematic(const uint flags = 12); ///< EnumCameraFlags
1304 void StopCinematic(const bool noFade = false); ///< if noFade is true will stop the cinematic immediately without fading out.
1305 const int CinematicState() const; ///< EnumCameraStates
1308 void SetRotateEyeVector(const kVec3&in vector); ///< The focus position that is used when AutoPlayRotationTrack is called if there is no LookAtActor set.
1309 void SetFinalView(const int view); ///< the view to use for the camera origin and direction. view must be in range 0-2
1310 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.
1311 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.
1312 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.
1313 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).
1314 void AutoPlayPositionTrack(const int view, const float speed, const int lerpType); ///< EnumCameraLerpType. Calls TweenPositionTrack on the view using speed and lerpType
1315 void AutoPlayRotationTrack(const int view, const float speed, const int lerpType); ///< EnumCameraLerpType. Calls TweenRotationTrack on the view using speed and lerpType
1316 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.
1317 void SetEyeView(const kVec3&in position); ///< position of camera (finalview). finalview must be set or will do nothing.
1318 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.
1319 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.
1320 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.
1321 kVec3 GetEyeView(); ///< position of camera (finalview). finalview must be set or will return vecZero.
1322 kVec3 GetFocusView(); ///< position of where the camera (finalview) is looking at. finalview must be set or will return vecZero.
1323 void ClearFinalView(); ///< finalview is set to null
1324 void ClearViewTracks(); ///< views 0-2 all variables are set to 0
1325 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
1326 const bool Active() const;
1327 const bool Enabled() const; ///< CinematicState() >= CAMS_FADEOUT (Not Idle)
1328 const bool ViewingFromCamera() const; ///< CinematicState() >= CAMS_FADEIN && CinematicState() <= CAMS_ACTIVE_TO_FADEOUT
1329 kVec3& Tremor(); ///< x = adds to yaw, y = adds to pitch, z = adds to roll. lerps to vecZero using lerpTime of GAME_FRAME_TIME.
1330 void SetSector(const uint sectorIndex);
1331 const int SectorIndex();
1332 const int AreaID() const;
1334 const uint Flags() const; ///< EnumCameraFlags
1335 kVec3 origin; ///< current position of camera. if a finalview is set then the origin will be set to the finalview's eye position.
1336 kAngle yaw; ///< if a finalview is set then the yaw will be set to the finalview's look direction.
1337 kAngle pitch; ///< if a finalview is set then the pitch will be set to the finalview's look direction.
1338 kAngle roll; ///< if a finalview is set then the roll will be set to 0.
1339 float fov; ///< Camera FOV (default is 74.0)
1340 float lookZOffset; ///< Used only if LookAtActor has been set.
1341};
1342
1343/**
1344 * @class kCModel
1345 * @brief The kCModel(CModel) global stores collision results when certain actor methods are called. Those methods are as follows:
1346 * GetSectorIndexAtLocation
1347 * const bool CanSee(kActor@, const uint = 0)
1348 * MoveToPosition
1349 * SpawnProjectile
1350 * bool CheckPosition(const kVec3 &in)
1351 */
1353{
1354public:
1355 kVec3& InterceptVector(); ///< Returns the vector that intersected the collided geometry
1356 kVec3& ContactNormal(); ///< Returns the normalized vector of the collided surface
1357 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.)
1358 const uint ClipResult(); ///< specifies the type of intersection (flags)
1359 kActor@ ContactActor(); ///< handle pointer to actor that was collided (null if none was collided)
1360 kVec3& MoveDirection(); ///< Movement vector of the object
1361};
1362
1364{
1365public:
1366 const int Ticks() const; ///< effected by gamespeed
1367 const int UnscaledTicks() const; ///< Not effected by GameSpeed
1370 void CheckKeys(); ///< Prints HUD messages to tell the player how many keys they've found on the current HUBID
1371 void ChangeMap(const kStr&in mapName);
1372 void StartWarp(kActor@ actor, const int tagID, const int mapID);
1373 void StartFreeWarp(kActor@ actor, const kVec3&in origin, const float yaw, const int sectorIndex, const int mapID);
1374 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.
1375 const bool CheckWarping(); ///< Checks if Warping or FreeWarping is in progress.
1376 const bool CanOpenPauseMenu(); ///< Checks if it's okay to be able to open a menu
1377 const bool CanOpenSaveMenu(); ///< Checks if it's okay to be able to open the save menu
1378 const int NewMapWarpTID(); ///< Returns the warp TID the player warped to from another map. Returns -1 of didn't warp from another map. Check before OnPostBeginLevel.
1379 void ClearWarpInterpolation(void); ///< Clearing the interpolation for kPuppet will also clear the warp interpolation.
1380};
1381
1382class kSys
1383{
1384public:
1385 void Print(const kStr&in message);
1386 void Warning(const kStr&in message);
1389 int Mouse_X();
1390 int Mouse_Y();
1391 const bool GetCvarValue(const kStr&in cvarName, kStr&out result);
1392 void MouseToHUD(float&out x, float&out y); ///< Returns the HUD position of the mouse
1393};
1394
1396{
1397public:
1398 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
1399 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.
1400 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.
1401 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)
1402 void FloodFillAreaFlags(const kVec3&in origin, const uint flags, const bool active); ///< (EnumAreaFlags) Calls FloodMatchingAreaFlags with FindNextClosestSector(origin) sector.
1403 void FloodMatchingAreaFlags(const int sectorIndex, const uint flags, const bool active); ///< (EnumAreaFlags) Sets flags on all adjacent sectors with matching areaID.
1404 const uint GetAreaFlags(const int areaID) const; ///< EnumAreaFlags
1405 const int GetAreaFloorImpact(const int areaID) const; ///< EnumImpactType
1406 const int GetAreaWallImpact(const int areaID) const; ///< EnumImpactType
1407 void ChangeAreaFloorImpact(const int areaID, const int value); ///< value: EnumImpactType
1408 void ChangeAreaWallImpact(const int areaID, const int value); ///< value: EnumImpactType
1409 void ChangeAreaWaterHeight(const int areaID, const float height); ///< WaterHeight is stored per area, not per sector or per vertex.
1410
1411 /**
1412 * @brief Returns an area arg value
1413 * @param areaID
1414 * @param arg
1415 @code{.cpp}
1416
1417 though args can be used for anything, they are typically used in this fashion:
1418 0: warp ID
1419 1: warp level ID or trigger sound ID
1420 2: checkpoint ID
1421 3: tag ID
1422 4: floor damage hit points
1423 5: floor damage rate
1424
1425 Hardcoded:
1426 0: AAF_TELEPORT: WarpID
1427 1: AAF_TELEPORT: WarpLevelID, AAF_EVENT and AAF_EVENTSOUND: soundID to play when player enters sector
1428 2: AAF_CHECKPOINT or AAF_SAVEGAME: CheckpointID
1429 3: AAF_EVENT: tag ID
1430 4: Not used
1431 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 damaga sectors))
1432
1433 Default Scripts:
1434 0: Not used
1435 1: Not used
1436 2: Not used
1437 3: Not used
1438 4: AAF_DAMAGE: amount of damage to do to the player when they're on the ground
1439 5: Always used as floor damage delay no matter the AAF flags. Should be used with AAF_DAMAGE only. 1 second = 1024
1440 @endcode
1441 */
1442 const int16 GetAreaArg(const int areaID, const int arg) const;
1443
1444 /**
1445 * @brief
1446 * @param areaID
1447 * @param arg
1448 @code{.cpp}
1449
1450 though args can be used for anything, they are typically used in this fashion:
1451 0: warp ID
1452 1: warp level ID or trigger sound ID
1453 2: checkpoint ID
1454 3: tag ID
1455 4: floor damage hit points
1456 5: floor damage rate
1457
1458 Hardcoded:
1459 0: AAF_TELEPORT: WarpID
1460 1: AAF_TELEPORT: WarpLevelID, AAF_EVENT and AAF_EVENTSOUND: soundID to play when player enters sector
1461 2: AAF_CHECKPOINT or AAF_SAVEGAME: CheckpointID
1462 3: AAF_EVENT: tag ID
1463 4: Not used
1464 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 damaga sectors))
1465
1466 Default Scripts:
1467 0: Not used
1468 1: Not used
1469 2: Not used
1470 3: Not used
1471 4: AAF_DAMAGE: amount of damage to do to the player when they're on the ground
1472 5: Always used as floor damage delay no matter the AAF flags. Should be used with AAF_DAMAGE only. 1 second = 1024
1473 @endcode
1474 * @param value
1475 */
1476 void ChangeAreaArg(const int areaID, const int arg, const int16 value);
1477 void ChangeSectorHeight(const int sectorIndex, const float height); ///< Changes all sectors floor vertices with the same areaID to the height
1478 void ChangeSectorCeilingHeight(const int sectorIndex, const float height); ///< Changes all sectors ceilng vertices with the same areaID to the height
1479 void ChangeSectorCeilingHeightVertices(const int sectorIndex, const float height, const int ptMask = 7); ///< Changes only the sector ceiling vertices(specfied using the ptMask) to the height.
1480 void ChangeSectorHeightVertices(const int sectorIndex, const float height, const int ptMask = 7); ///< Changes only the sector floor vertices(specfied using the ptMask) to the height.
1481 const int FindNextClosestSector(const kVec3&in origin);
1482 /**
1483 * @brief Get the Sectors vertex position and height
1484 * Link 1 is pt1 to pt3
1485 * Link 2 is pt2 to pt1
1486 * Link 3 is pt3 to pt2
1487 * @param sectorIndex
1488 * @param pt1
1489 * @param pt2
1490 * @param pt3
1491 * @param heights: x is the height of pt1, y is the height of pt2, z is the height of pt3.
1492 */
1493 void GetSectorCorners(const int sectorIndex, kVec3&out pt1, kVec3&out pt2, kVec3&out pt3, kVec3&out heights) const;
1494
1495 /**
1496 * @brief Get the 3 sectors links. -1 means there was no sector linked to that edge.
1497 * Link 1 is pt1 to pt3
1498 * Link 2 is pt2 to pt1
1499 * Link 3 is pt3 to pt2
1500 * @param sectorIndex
1501 * @param sectorIndex1
1502 * @param sectorIndex2
1503 * @param sectorIndex3
1504 */
1505 void GetSectorLinks(const int sectorIndex, int&out sectorIndex1, int&out sectorIndex2, int&out sectorIndex3) const; ///< a sectorIndex with -1 is no sector.
1506 const uint GetSectorNumBridges(const int sectorIndex) const; ///< number of bridge sectors this sector has
1507 const int GetSectorBridge(const int sectorIndex, const uint bridge) const; ///< Get the sector of the bridge. Use GetSectorNumBridges to loop through them all.
1508 const int GetSectorAreaID(const int sectorIndex) const;
1509 const int GetNumSectors() const;
1510 const int GetNumAreas() const;
1511 const int GetNumActors() const; ///< number of actors that are in the current maps data
1512 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.
1513 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.
1514};
1515
1517{
1518public:
1519 void CallDelayedMapScript(const kStr&in funcName, kActor@ instigator, const float delay); ///< even with delay 0 it will be called when map scripts update
1520 void CallDelayedMapScript(const int scriptID, kActor@ instigator, const float delay); ///< even with delay 0 it will be called when map scripts update
1521 void CallMapScript(const int scriptID, kActor@ instigator); ///< Use to call map script right away
1522 void HaltMapScript(const int scriptID);
1523 void PlaySound(const kStr&in path);
1524 void PlaySoundID(const int soundID);
1525 void PlayMusic(const kStr&in path, const bool loop);
1531 void MusicPitch(const float pitch);
1532
1533 /**
1534 * @brief Start controller vibration from tactile sound file. Returns a handle.
1535 * @param path the path to the .bnvib file
1536 * @param channel kexVibrationPlayer::channel_e
1537 * @param pos kexVibrationPlayer::position_e
1538 */
1539 int PlayTactile(const kStr&in path, int channel, int pos);
1540 bool IsTactilePlaying(int vibHandle);
1541 bool IsTactilePlaying(int vibHandle, const kStr&in path);
1543 void StopTactile(int vibHandle);
1545 void Restart();
1546
1547 /**
1548 * @brief Print a message to the HUD
1549 * @param text
1550 * @param lineNumber must be in range 0..7
1551 * @param ticks number of ticks message will be visible. 60 ticks = 1 second.
1552 */
1553 void PrintLine(const kStr&in text, const int lineNumber, const int ticks = 120);
1554 /**
1555 * @brief Print a message to the HUD on the next line.
1556 * @param text
1557 * @param ticks number of ticks message will be visible. 60 ticks = 1 second.
1558 */
1559 void Print(const kStr &in text, const int ticks = 120);
1560 void PrintHelp(const kStr&in text, const bool endGame = false);
1564 void ChangeMap(const kStr&in path);
1565 void ShowMainMenu(const bool mouseCenter = true);
1566 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".
1567 const int GetMapIDFromName(const kStr &in mapName); ///< This returns the mapID from the mapName
1568 const int GetCurrentMapID();
1569 const int GetDifficulty(); ///< EnumDifficulty. Internally calls GameVariables.GetInt("g_difficulty")
1570 void SetDifficulty(const int value); ///< EnumDifficulty
1572
1573 /**
1574 * @brief Sets the current GameSpeed. kPuppet and kPlayerWeapon are not effected by GameSpeed.
1575 * @param speed 0..1
1576 * @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)
1577 */
1578 void SetGameSpeed(const float speed, const float blendSpeed);
1579 bool GetHubKeyInfo(const uint hubID, int&out nKeys, int&out remainingKeys, int&out keyBits);
1580 bool SetHubKey(const uint hubID, int key);
1581 void SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in velocity, const kVec3&in origin, const kQuat&in rotation);
1582 void SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in velocity, const kVec3&in origin, const kQuat&in rotation);
1583 void SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in origin, const kQuat&in rotation);
1584 void SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in origin, const kQuat&in rotation);
1585 void SpawnFx(const kStr&in fxPath, kActor@ source, const kVec3&in origin, const float yaw, const float pitch);
1586 void SpawnFx(const kStr&in fxPath, kPuppet@ source, const kVec3&in origin, const float yaw, const float pitch);
1587 void SpawnFx(const kStr&in fxPath, const kVec3&in origin, const int sectorIndex);
1589 const bool AutomapEnabled(); ///< is the automap displaying on screen
1590 const bool AutomapDeactived();
1591 void AutomapToggle(const bool toggle); ///< show/hide the automap.
1592 void AutomapDeactive(const bool toggle); ///< permanently deactivates the automap.
1593 void AutomapCustom(const bool toggle); ///< allow actors with custom automap colors to be drawn to the automap. (for mods)
1594 void LifeForcePulse(); ///< Shows the LifeForces on the HUD
1595 void LivesPulse(); ///< Shows the Lives on the HUD
1596 void RunWalkPulse(); ///< Shows the RunWalk graphic on the HUD
1597 void WeaponWheelPulse(); ///< Shows the WeaponWheel on the HUD
1598 bool SetWeaponWheelPic(const int weapon, const kStr&in imagePath);
1599 bool ClearWeaponWheelPic(const int weapon);
1600 void SetLivesPic(const kStr&in imagePath);
1602 void SetLifeForcePic(const kStr&in imagePath);
1604 void MessageBox(const kStr&in msg1, const kStr&in msg2);
1605
1606 /**
1607 * @brief
1608 * @param msg1 top line
1609 * @param msg2 bottom line
1610 @code{.cpp}
1611 // Usage:
1612 Game.ConfirmMenu("Confirm This", "Is that correct?");
1613
1614 // Then check for result on Tick:
1615
1616 int result;
1617 GameVariables.GetInt("ConfirmMenuResult", result);
1618 switch(result)
1619 {
1620 case 1:
1621 Sys.Print("Selected No");
1622 GameVariables.SetValue("ConfirmMenuResult", "0");
1623 break;
1624 case 2:
1625 Sys.Print("Selected Yes");
1626 GameVariables.SetValue("ConfirmMenuResult", "0");
1627 break;
1628 default: // There's no ConfirmMenuResult waiting
1629 break;
1630 }
1631 @endcode
1632 */
1633 void ConfirmMenu(const kStr&in msg1, const kStr&in msg2);
1634 void SaveMenu(); ///< Opens the save game menu. Should always check if(PlayLoop.CanOpenSaveMenu())
1635 void LoadMenu(); ///< Opens the load game menu. Should always check if(PlayLoop.CanOpenPauseMenu())
1636 void SetDamageFlash(); ///< Shows the damage screen flash
1637 void SetPickupFlash(); ///< Shows the pickup screen flash
1638 void SetArmorFlash(); ///< Shows the armor damage screen flash
1639 const uint ConButtons(); ///< EnumPlayerConButtons
1640 uint MenuButtons(void) ///< EnumGameButtonEvents
1641 const int64 GetTimestamp();
1642 void GetDateAndTime(int&out seconds, int&out minutes, int&out hours, int&out day, int&out month, int&out year, kStr&out text);
1645
1646 /**
1647 * @brief add custom text to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLevel or later.
1648 * if the id already exists then simply sets all it's variables.
1649 * @param font EnumGameFontType
1650 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
1651 */
1652 void AddText(const int id, const int font, const kStr &in text, const float x, const float y,
1653 const int edge = 0, const float scale = 1.0f, const bool center = false, const bool shadow = false,
1654 const int r = 255, const int g = 255, const int b = 255, const int a = 255,
1655 const int r2 = 255, const int g2 = 255, const int b2 = 255, const int a2 = 255);
1656 bool SetTextMsg(const int id, const kStr &in text);
1657 bool SetTextOrigin(const int id, const float x, const float y);
1658 bool SetTextColor(const int id, const int r = 255, const int g = 255, const int b = 255, const int a = 255);
1659 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);
1660
1661 /**
1662 * @brief Set the text scale, font, edge, center, shadow
1663 * @param font EnumGameFontType
1664 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
1665 */
1666 bool SetTextProps(const int id, const float scale, const int font = 0, const int edge = 0, const bool center = false, const bool shadow = false);
1667 bool RemoveText(const int id);
1669 void GetTextSize(const kStr &in text, const int font, const float scale, float &out width, float &out height); ///< EnumGameFontType
1670 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".
1671
1672 /**
1673 * @brief add custom image to the HUD. HUD size is 640x480 (pillar box). AddPic must be done in OnPostBeginLevel or later.
1674 * if the id already exists then simply sets all it's variables.
1675 * @param edge 1=left side 2=right side (for convenience. You can set to 0 and offset x position with GetHUDOffset() as well)
1676 */
1677 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,
1678 const float s1 = 0.0f, const float t1 = 0.0f, const float s2 = 1.0f, const float t2 = 1.0f,
1679 const int r = 255, const int g = 255, const int b = 255, const int a = 255);
1680 bool SetPicTex(const int id, const kStr &in path);
1681 bool SetPicOrigin(const int id, const float x, const float y);
1682 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)
1683 bool SetPicAngle(const int id, const float angle); ///< in rads
1684 bool SetPicWH(const int id, const float w, const float h);
1685 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);
1686 bool SetPicColor(const int id, const int r = 255, const int g = 255, const int b = 255, const int a = 255);
1687 bool RemovePic(const int id);
1688 void ClearPics(const bool clearImageCache = false);
1689 bool& HideHealth(); ///< Hide health display on the HUD
1690 bool& HideAmmo(); ///< Hide ammo display on the HUD
1691 bool& HideLifeForces(); ///< Hide LifeForces display on the HUD
1692 bool& HideRunWalk(); ///< Hide RunWalk display on the HUD
1693 bool& HideLives(); ///< Hide Lives display on the HUD
1694 bool& HideBossBar(); ///< Hide BossBar display on the HUD
1695 bool& HideAirBar(); ///< Hide AirBar display on the HUD
1696 bool& HideWeaponWheel(); ///< Hide WeaponWheel display on the HUD
1697 bool& HideCrosshair(); ///< Hide Crosshair display on the HUD
1698 bool& HideHelpMessages(); ///< Hide HelpMessages display on the HUD
1699 bool& HideMessages(); ///< Hide Messages display on the HUD
1700 bool& HideTimers(); ///< Hide Timers display on the HUD
1701 const float GetExtraZFar();
1702 void SetExtraZFar(const float zfar); ///< affects actors, ai, particles, fog and underwater. (works normally unlike the cvar r_zfarextent)
1703 const float ShakeIntensity();
1704 kVec3 WorldToHUDPoint(const kVec3&in origin);
1705 bool SphereInView(const kVec3&in origin, const float radius);
1706 bool BoxInView(const kVec3&in min, const kVec3&in max);
1707 const float ViewZFar();
1708 void SaveModFile(const kStr&in filename); ///< make sure to call GameModFileData.Empty() before adding key/values to save
1709 bool LoadModFile(const kStr&in filename); ///< make sure to call GameModFileData.Empty() after you're done loading
1710 bool LoadModDataFile(const kStr&in filename); ///< Returns false if couldn't load file. Clears and Sets GameModFileData with the contents of the loaded file.
1711 void SetNoModSelect(const bool bToggle = true); ///< Disable the mod select menu when selecting new game for workshop mods only. (seta g_nomodselect "1")
1712 void PlayMovie(const kStr&in filename, const bool skippable = true); ///< Only .ogv files (replaces/adds .ogv extension to filename). Can not read from kpfs.
1713
1714 /**
1715 * @brief Returns the key bind name of action. Returns empty string if nothing is bound.
1716 * @param action EnumInputActions
1717 * @param first if is false returns a string of all the bound keys separated by the ; character.
1718 * @param sortsorts binds by keyboard, mouse, and controller binds. depending on if controller or keyboard is active.
1719 */
1720 kStr GetActionBind(const int action, const bool first = true, const bool sort = true);
1721
1722 /**
1723 * @brief Returns the key bind name of the console command. Returns empty string if nothing is bound.
1724 * @param command the name of the console command.
1725 @code{.cpp}
1726 "weapon 0" to "weapon 13"
1727 "automap"
1728 "changeammotype"
1729 "runwalktoggle"
1730 "menu_up"
1731 "menu_down"
1732 "menu_left"
1733 "menu_right"
1734 "*menu_select"
1735 "menu_back"
1736 "menu_cancel"
1737 "menu_activate"
1738 @endcode
1739 * @param first if is false returns a string of all the bound keys separated by the ; character.
1740 * @param sort sorts binds by keyboard, mouse, and controller binds. depending on if controller or keyboard is active.
1741 */
1742 kStr GetCommandBind(const kStr&in command, const bool first = true, const bool sort = true);
1743 bool IsJoystickActive(); ///< if true the players last input was from a controller.
1744 kStr GetInputImagePath(const kStr&in bindName);
1745 bool InputImageExists(const kStr&in path);
1746 void SetCursorHotPos(int x, int y); ///< change the mouses cursors click point (default is 0, 0)
1747 void SetModBindings(const bool show = true); ///< Shows custom mod bindings in menu Bindings > Actions
1748 kStr PlayerName(); ///< Returns "Player" if could not get name
1749 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.
1750 const bool IsActorPersistentMarked(const int actorIndex, const int hubID = -1, const int mapNum = 0); ///< an invalid hub or map uses current maps persistent data.
1752 void SetPreventOpenPauseMenu(const bool value);
1753 void ShowPauseMenu(); ///< Should always check if(PlayLoop.CanOpenPauseMenu())
1754 void OverrideSkyHeight(const float height); ///< Set to 0 to stop overriding
1755 const int BossDamageScaler(const int difficulty, const int damage);
1756 int PurgeUnusedModels(); ///< Returns number of models freed
1761 void SetWorldSunLightColor(const float r, const float g, const float b);
1762 void SetWorldSunAmbientColor(const float r, const float g, const float b);
1763 void SetWorldSunDirection(const float x, const float y, const float z);
1764 bool IsWorkshop(); ///< Returns true if game was run through the steam workshop (ran with command arg -workshop)
1765 void OverridePerPolyCollision(const int value); ///< 0=none, 1=force disable, 2=force enable
1766 void DisableLegalText(); ///< Removes the text at the bottom of the title screen
1767 void OverrideFogType(const int value); ///< 0=none, 1=force Radial, 2=force Plane
1768 void ClearInterpolationOnGameObjects(); ///< Clears Interpolation on all gameobjects and the camera if it's active
1769 void ShowDummyMenu(void); ///< Actors OnMenuTick fucntion will now be processed. Call ClearDummyMenu to close the dummy menu.
1770 void ClearDummyMenu(bool bClearAll = false);
1771 void ToggleCursor(bool b = false);
1772};
1773
1775{
1776public:
1777 const uint16 Buttons() const; ///< returns EnumPlayerButtons
1778 uint ButtonHeldTime(const int btn); ///< btn type is EnumInputActions
1780 void ConsumeAmmo(const int ammo, const bool preferredAmmo = true);
1781 void ConsumeAltAmmo(const int ammo);
1782 const int GetAmmo(const int weaponID) const;
1783 const int GetAltAmmo(const int weaponID) const;
1784 const bool HasAmmo(const int weaponID, const bool checkAlt = true) const; ///< if checkAlt is false only checks primary ammo
1785 const bool HasAltAmmo(const int weaponID) const;
1786 const bool HasAltAmmo() const;
1787 const bool HasWeapon(const int weaponID) const;
1788 bool& UseAltAmmo();
1789 const int CurrentWeapon() const;
1790 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.
1791 bool RemoveWeapon(const int weapon);
1792 void Lock();
1793 void Unlock();
1794 int16& Armor();
1795 void Victory(const int warpActorID = - 1, const int mapID = - 1);
1796 const bool Locked() const;
1797 const int Lives() const;
1798 void SetLives(const int amount);
1799 const int LifeForces();
1800 void SetLifeForces(const int amount);
1801 bool& Backpack();
1803 bool& NoLandClearVel(); ///< if true, when doing a hard landing you will not lose your velocity
1804 bool GiveAmmo(const int weapon, const int amount, const bool altAmmo); ///< set amount to negative values to take ammo
1805 const int CurrentCheckPoint(); ///< returns warpTID
1807 void SetCheckPoint(const int warpTID, const int map);
1808 const kVec3 GetButtonAngles() const;
1810 const bool WeaponUsingAltAmmo(const int weapon) const;
1811 const bool SetWeaponUseAltAmmo(const int weapon, const bool bToggle);
1812 const bool WeaponAllowUnderwater(const int weapon) const;
1813 void ChangeWeapon(const int weapon);
1814 const int PendingWeapon() const;
1815 void CycleNextWeapon(const bool bCheckAmmo = false);
1816 void CyclePrevWeapon(const bool bCheckAmmo = false);
1817 kWeapon@ GetWeaponActor(const int weapon);
1818 int16& MaxHealth(); ///< should be >= MaxExtraHealth and ExtraHealth
1819 int16& MaxExtraHealth(); ///< should be <= MaxHealth
1820 int16& ExtraHealth(); ///< should be <= MaxExtraHealth
1821 bool GiveHealth(const int amount, const bool bMortalWound); ///< Takes into account extra health, and max health values. 0 is full health, negative amounts gives extra health. if bMortalWound is true which is for 2 and ultra health then health goes up to maxExtraHealth.
1822 void CancelSpiritualTime(float blendTime = 1.0f); ///< if in spirit mode then will set gamespeed back to 1.0f using the passed in blendTime
1823 void SetSpiritualTime(const float time, const float blend); ///< time = time until cancels the effect. Should SetGameSpeed after calling this.
1824 const float GetSpiritualTime() const;
1825 const int GetWeaponGroup(const int weapon);
1826
1827 /**
1828 * @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.
1829 * 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.
1830 */
1831 void SetWeaponGroup(const int weapon, const int group);
1832 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.
1833};
1834
1835namespace Math
1836{
1837 float Sin(float f); ///< Returns the sine of angle f in radians
1838 float Cos(float f); ///< Returns the cosine of angle f in radians
1839 float Tan(float f); ///< Returns the tangent of angle f in radians.
1840 float ATan2(float y, float x); ///< Returns the angle in radians whose Tan is y/x
1841 float Fabs(float f); ///< Returns the absolute value of f
1842 float ACos(float f); ///< Returns the arc-cosine of f - the angle in radians whose cosine is f
1843 float Sqrt(float f); ///< Returns square root of f
1844 int Abs(int i); ///< Returns the absolute value of i.
1845 float Ceil(float f); ///< Returns the smallest integer greater to or equal to f
1846 float Floor(float f); ///< Returns the largest integer smaller to or equal to f
1847 float Log(float f); ///< Returns the natural (base e) logarithm of a specified number
1848 float Pow(float x, float y); ///< Returns f raised to power p
1849 float Deg2Rad(float degs); ///< Degrees-to-radians conversion
1850 float Rad2Deg(float rads); ///< Radians-to-Degrees conversion
1851 float InvSqrt(float f); ///< Returns inverse square root of f
1852 float IncMax(const float val, const float inc, const float dest); ///< returns val +(or minus) inc and never goes above or below dest value
1853 int SysRand(); ///< Range 0..32767
1854 int Rand(); ///< Range 0..32767
1855 uint8 RandByte(); ///< Range 0..255
1856 int RandMax(const int max); ///< Range 0..max-1
1857 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]
1858 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.
1859 float RandFloat(); ///< Range 0..1
1860 float RandCFloat(); ///< Range -1..1
1861 float RandRange(const float min, const float max); ///< Returns a random float number between and min [inclusive] and max [inclusive]
1862 int Clamp(const int i, const int min, const int max); ///< Returns clamped value between min and max
1863 float Clampf(const float f, const float min, const float max); ///< Returns clamped value between min and max
1864 float Lerp(float start, const float end, const float time); ///< Linearly interpolates between start and end by time.
1865 float CosTween(const float t); ///< return (0.5f - (Cos(t * pi) * 0.5f));
1866 float CosArc(const float t); ///< return (-((Cos(Deg2Rad(360.0f * t)) - 1.0f) * 0.5f));
1867 float SmoothStep(const float from, const float to, const float t); ///< Interpolates between min and max with smoothing at the limits.
1868 float HermiteBlend(const float a, const float b, const float t);
1869 float Min(const float a, const float b); ///< Returns the smallest of the two values
1870 float Max(const float a, const float b); ///< Returns the largest of the two values
1871 const int f2i(const float f); ///< IEEE 754 float to int
1872 const float i2f(const int i); ///< int to IEEE 754 float
1873 const float pi = 3.1415927f;
1874 const float tau = 6.2831855f; ///< pi * 2
1875 const kVec3 vecZero(0.0f, 0.0f, 0.0f);
1876}
1877
1878namespace kexColors ///< Not used (garbage included automatically from kexengine)
1879{
1880 const kColor white; ///< 255, 255, 255, 255
1881 const kColor gray; ///< 127, 127, 127, 255
1882 const kColor black; ///< 0, 0, 0, 255
1883 const kColor red; ///< 255, 0, 0, 255
1884 const kColor green; ///< 0, 255, 0, 255
1885 const kColor blue; ///< 0, 0, 255, 255
1886 const kColor yellow; ///< 255, 255, 0, 255
1887 const kColor orange; ///< 255, 127, 0, 255
1888 const kColor cyan; ///< 0, 255, 255, 255
1889 const kColor magenta; ///< 255, 0, 255, 255
1890 const kColor transparent; ///< 0, 0, 0, 0
1911}
1912
1913kColor kexColor_FromHSL(float hue, float sat, float lit); ///< Not used. (garbage from kexengine)
1914kColor kexColor_Random(); ///< Not used. (garbage from kexengine)
1915kColor kexColor_Tab20(uint i); ///< Not used. (garbage from kexengine)
1916kColor kexColor_Tab20Dark(uint i); ///< Not used. (garbage from kexengine)
1917kColor kexColor_Tab20Light(uint i); ///< Not used. (garbage from kexengine)
1918kColor kexColor_ViridisScale(float v); ///< Not used. (garbage from kexengine)
1919kColor kexColor_LerpRGB(const kColor&in from, const kColor&in to, float time); ///< Not used. (garbage from kexengine)
1920void delay(const float time); ///< used in map scripts to delay execution of script
1921const float GAME_FRAME_TIME = 0.25f;
1922const float GAME_DELTA_TIME = 0.016666668f;
1923const float GAME_FRAME_UNIT = 4.0f;
1924const float GAME_SECONDS = 0.06666667f;
1925const float GAME_SCALE = 10.24f;
1928kDict GameModFileData; ///< Use with Game.SaveModFile and Game.LoadModFile
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
kSys Sys
EnumGameFontType
@ GFT_BIG
@ GFT_SMALL
@ GFT_NUMBERS
@ GFT_TTF
enum EnumPlayerFlags AIF_TELEPORTIN
playing teleport in animation
enum EnumPlayerFlags AIF_FIRSTATTACK
enum EnumPlayerFlags AIF_FEIGNDEATH
kGame Game
kColor kexColor_ViridisScale(float v)
Not used. (garbage from kexengine)
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.
const float GAME_DELTA_TIME
enum EnumPlayerFlags AIF_GOBACKTOLEASH
kColor kexColor_Tab20(uint i)
Not used. (garbage from kexengine)
enum EnumGameButtonEvents DIFFICULTY_EASY
EnumActorSpawnFlags3
@ ASF3_MAKESPAWNANIMVISIBLE
clears actor flags: ~(AF_HIDDEN|AF_DISABLED)
@ ASF3_PROJECTILEATTACK9
Demon chest Hadoken (anim_aiRangeAttack9)
@ ASF3_NOTHINKER
AI will not function. Actores will not update movement. Actors OnBeginLevel will set their animation ...
@ 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.
enum EnumPlayerFlags AIF_HEARDLOUDNOISE
kColor kexColor_Tab20Light(uint i)
Not used. (garbage from kexengine)
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
enum EnumPlayerFlags AIF_TELEPORTMOVESLOW
chasing while underground
kDict GameModFileData
Use with Game.SaveModFile and Game.LoadModFile.
EnumClipFlags
@ CF_HITSCAN
performs a single-pass trace. useful for hitscans
@ 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
@ 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
enum EnumGameButtonEvents DIFFICULTY_HARD
const float GAME_FRAME_UNIT
enum EnumPlayerFlags AIF_TELEPORTING
in teleport state. ignore all chase logic
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
enum EnumPlayerFlags AIF_ATTACKING
playing an attacking animation
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)
enum EnumPlayerFlags AIF_TELEPORTAWAY
playing teleport out animation
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.
@ IT_METAL
enum EnumPlayerFlags AIF_NOCHASE
disable chase logic
enum EnumPlayerFlags AIF_REGENERATE
kCModel CModel
enum EnumPlayerFlags AIF_RUNNING
Is playing running animation.
enum EnumPlayerFlags AIF_REGENANIMDELAY
const float GAME_SECONDS
enum EnumPlayerFlags AIF_HEARDQUIETNOISE
enum EnumPlayerFlags AIF_DAMAGEPANIC
become aggressive when target is outside it's active threshold (good for forcing AI to attack their t...
enum EnumPlayerFlags AIF_SEETARGET
kColor kexColor_LerpRGB(const kColor &in from, const kColor &in to, float time)
Not used. (garbage from kexengine)
EnumWeaponStates
@ WS_LOWER
@ WS_FIRE
@ 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
@ PS_SWIMMING
@ PS_JUMPING
@ PF_CRAWLING
@ PS_FALLDEATH
@ 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
@ PS_CLIMBING
@ PS_UNDERWATER
@ PF_DEAD
@ PF_INWARPAREA
in sector area with AAF_TELEPORT flag.
@ PS_WALKING
@ PF_FLY
@ PF_PREVENTDEATHCAM
will stop the death cinematic or the deadAnimView from triggering when the player dies.
@ PF_CLIMBTHRUST
@ PS_ANTIGRAVITY
@ PF_NOAIRFRICTION
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
enum EnumPlayerFlags AIF_WAITFORCYCLE
prevent other animations from interrupting until the current one finishes
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 recieve damage. OnDamage and OnDeath are never called
@ AF_AVOIDWATER
clip against edges linking to water sectors
@ AF_NONSHOOTABLE
NOT USED. suppose to be: can't be shot at (ignores hitscans)
@ 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.
@ AAF_DAMAGE
@ AAF_SHALLOWWATER
@ AAF_CRAWL
@ AAF_BLOCK
@ AAF_REPEATABLE
Unused.
@ 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
Unused.
@ 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)
enum EnumPlayerFlags AIF_REGENERATEANIM
enum EnumGameButtonEvents DIFFICULTY_NORMAL
enum EnumGameButtonEvents DIFFICULTY_HARDCORE
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.
EnumCameraStates
@ CAMS_FADEIN
@ CAMS_RESTORE_TO_CLIENT
@ CAMS_ACTIVE_TO_FADEOUT
@ CAMS_IDLE
@ CAMS_FADEBACK_TO_CLIENT
@ CAMS_ACTIVE
@ CAMS_FADEOUT
kWorld World
enum EnumPlayerFlags AIF_NOTHINK
don't run ai logic
enum EnumPlayerFlags AIF_AWAYFROMLEASH
enum EnumPlayerFlags AIF_GETATTENTION
enum EnumPlayerFlags AIF_RESSURECT
enum EnumPlayerFlags AIF_WASSOLID
enum EnumPlayerFlags AIF_BLOWNAWAY
being blown away by explosion
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_INITIAL_FADEIN
@ CMF_LOCK_PLAYER
@ CMF_SHOW_CREDITS
@ CMF_NO_INITIAL_FADEIN
void delay(const float time)
used in map scripts to delay execution of script
kActorFactory ActorFactory
float Lerp(float start, const float end, const float time)
Linearly interpolates between start and end by time.
float ATan2(float y, float x)
Returns the angle in radians whose Tan is y/x.
float Clampf(const float f, const float min, const float max)
Returns clamped value between min and max.
int Abs(int i)
Returns the absolute value of i.
int Rand()
Range 0..32767.
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,...
const float tau
pi * 2
const kVec3 vecZero(0.0f, 0.0f, 0.0f)
float Floor(float f)
Returns the largest integer smaller to or equal to f.
float Pow(float x, float y)
Returns f raised to power p.
float Deg2Rad(float degs)
Degrees-to-radians conversion.
float Max(const float a, const float b)
Returns the largest of the two values.
uint8 RandByte()
Range 0..255.
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.
float Sqrt(float f)
Returns square root of f.
float CosTween(const float t)
return (0.5f - (Cos(t * pi) * 0.5f));
float Tan(float f)
Returns the tangent of angle f in radians.
float Log(float f)
Returns the natural (base e) logarithm of a specified number.
float Fabs(float f)
Returns the absolute value of f.
float HermiteBlend(const float a, const float b, const float t)
float RandRange(const float min, const float max)
Returns a random float number between and min [inclusive] and max [inclusive].
float InvSqrt(float f)
Returns inverse square root of f.
float ACos(float f)
Returns the arc-cosine of f - the angle in radians whose cosine is f.
float Rad2Deg(float rads)
Radians-to-Degrees conversion.
float IncMax(const float val, const float inc, const float dest)
returns val +(or minus) inc and never goes above or below dest value
float Cos(float f)
Returns the cosine of angle f in radians.
const float i2f(const int i)
int to IEEE 754 float
int RandMax(const int max)
Range 0..max-1.
float Min(const float a, const float b)
Returns the smallest of the two values.
float Ceil(float f)
Returns the smallest integer greater to or equal to f.
const int f2i(const float f)
IEEE 754 float to int.
float CosArc(const float t)
return (-((Cos(Deg2Rad(360.0f * t)) - 1.0f) * 0.5f));
float SmoothStep(const float from, const float to, const float t)
Interpolates between min and max with smoothing at the limits.
int Clamp(const int i, const int min, const int max)
Returns clamped value between min and max.
const float pi
int SysRand()
Range 0..32767.
float Sin(float f)
Returns the sine of angle f in radians.
float RandCFloat()
Range -1..1.
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 & 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
int8 opIndex(const int64 i)
Returns The ASCII code of the character at the strings index.
kStr & opAddAssign(bool b)
kStr opAdd(int64 i) const
kStr(const kStr &in s)
kStr opAdd(bool b) const
int Atoi() const
Converts string to int.
uint64 IndexOf(const kStr &in) const
Reports the zero-based index of the first occurrence of a specified string within this instance....
uint Hash() const
Returns HashID from this instance.
kStr & opAddAssign(const kStr &in s)
kStr & opAssign(const kStr &in 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 Diff(const kQuat &in rot) const
kQuat(float w, kVec3 &in point)
void Clear()
x,y,z = 0.0 w = 1.0
kStr ToString() const
kQuat opSub(const kQuat &in rot)
kQuat & opAssign(const kQuat &in rot)
kQuat(const kQuat &in other)
kQuat & opMulAssign(const kQuat &in rot)
kQuat(float x, float y, float z)
kQuat & Normalize()
kQuat opAdd(const kQuat &in rot)
kQuat opMul(const kQuat &in rot)
kQuat Slerp(const kQuat &in rot, float t) const
kQuat(float x, float y, float z, float w)
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)
void OnSpawn()
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)
void SetRotationOffset(const int nodeIndex, const kQuat &in rotation)
const int GetNumNodes() const
kVec3 GetNodeOrigin(const int node, const kVec3 &in offset)
void SetRotationOffset(const int nodeIndex, const float rads, const float x, const float y, const float z)
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 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 AddTrailEffect(const kStr &in trailName, const int nodeIndex)
const bool IsMorph() const
const int GetNumAttachedTrails()
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 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
void Blend(const int animID, float speed, float blend, int flags)
EnumAnimStateFlags.
void Set(const int animID, float speed, int flags)
EnumAnimStateFlags.
void Stop()
flags |= ANF_STOPPED; flags &= ~ANF_LOOP;
const int NumFrames()
number of frames in this animation
const int CurrentFrame()
current frame playing for the current animation. Must have an animation action keyframe for this to w...
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
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
const bool Blending() const
(flags & ANF_BLEND) != 0
int flags
EnumAnimStateFlags.
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 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 PlayingID() const
the current animations ID
const int TrackFrame(void) const
Base type used by all actors.
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.
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
const int16 GetOverrideKeyTouchTID()
used only for key pickups
bool & NoKnockBack()
Will not receive knock back movement from things like the alien weapon for example.
float & Mass()
default = GAME_SCALE * 1.0f
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)
void SpawnFx(const kStr &in fxPath, const kVec3 &in pos, const kQuat &in rot)
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...
kVec3 & Velocity()
float DistanceToPoint(const float x, const float y, const float z) const
actors point is in the center
const float GetCustomDeadHeight()
kDictMem Definition()
get actors def data
bool CheckPosition(const float angle, const float distance)
calls CheckPosition(kVec3 origin) with location 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()
kAngle & Roll()
const bool InWater() const
float & Height()
float & Gravity()
float & FloorHeight()
void SetSector(const uint sectorIndex)
kActor GetTarget()
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
void SetPosition(const kVec3 &in pos)
best way to set an actors position, will also set the sector and clearinterpolation
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)
const int TID() const
const bool CanSee(kPuppet@ puppet, const uint excludeClipFlags=0)
excludeClipFlags to ignore/disable (EnumClipFlags). Note: This function that takes in the kPuppet arg...
void MoveToPosition(const float x, const float y)
Moves the world object to a desired position at xy coordinates. Movement will use hitscan collision f...
kScriptObject ScriptObject()
float & WallRadius()
uint & ClipFlags()
EnumClipFlags.
kRenderModel RenderModel()
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)
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()
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)
void StopSound()
const uint SpawnFlags2() const
EnumActorSpawnFlags2.
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 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)
void SpawnFx(const kStr &in fxPath, const kVec3 &in pos)
kVec3 & Origin()
Position in world space.
const float GetSkyHeight() const
int & Type()
The actors Type ID.
kAnimState & AnimState()
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
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...
const uint SpawnFlags1() const
EnumActorSpawnFlags1.
float GetTurnYaw(const kVec3 &in lookAtLocation) const
void SpawnProjectile(const kStr &in fxPath, const kVec3 &in pos, const kVec3 &in targetLocation, const float maxAngle)
kQuat & Rotation()
float & CeilingHeight()
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.
void 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...
kVec3 TransformToOwnerPosition()
returns the OffsetPosition() * the players matrix.
kVec3 TransformToOwnerPosition(const kVec3 &in vector)
returns the (OffsetPosition() + vector) * the players matrix.
kPlayer & Owner()
int & State()
EnumWeaponStates.
bool & PreventFire()
Use in OnBeginFire to internally prevent from entering its Fire state.
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
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
void SetGroundBackwardAccel(const float accel)
default = 0.05f
const float LandingViewOffset() const
LandingViewOffset changes when jumping and falling. Origin.z + ViewHeight() + LandingViewOffset() = C...
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
void SetGroundBackwardSpeed(const float speed)
default = -10.24f
void SetOverrideWalkRun(const int value)
0=none(default), 1=Force Disable Walk
void SetSwimForwardAccel(const float accel)
default = 0.05f
const float GroundDeaccel() const
default = 0.5f
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
uint & PlayerFlags()
EnumPlayerFlags.
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.
const float SwimBackwardAccel() const
default = 0.05f
const float SwimForwardSpeed() const
default = 10.24f
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 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
void LoudNoiseAlert()
void SetGroundForwardAccel(const float accel)
default = 0.05f
const float SwimBackwardSpeed() const
default = -10.24f
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
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
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)
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=12)
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
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.
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.
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.
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)
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 effected 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.
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 of 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
effected by gamespeed
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.
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 GetAreaFloorImpact(const int areaID) const
EnumImpactType.
const int GetNumSectors() 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 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 ChangeAreaArg(const int areaID, const int arg, const int16 value)
void ChangeSectorCeilingHeight(const int sectorIndex, const float height)
Changes all sectors ceilng vertices with the same areaID to the height.
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(specfied using the ptMask) to the height.
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)
const int GetAreaWallImpact(const int areaID) const
EnumImpactType.
void ChangeSectorCeilingHeightVertices(const int sectorIndex, const float height, const int ptMask=7)
Changes only the sector ceiling vertices(specfied using the ptMask) to the height.
void ChangeSectorHeight(const int sectorIndex, const float height)
Changes all sectors floor vertices with the same areaID to the height.
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 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...
const int GetCurrentMapID()
void StopTactile(int vibHandle)
void CenterMouse()
void SpawnFx(const kStr &in fxPath, kPuppet@ source, const kVec3 &in origin, const kQuat &in rotation)
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)
void LifeForcePulse()
Shows the LifeForces on the HUD.
void KillAllFx()
void SetWorldSunDirection(const float x, const float y, const float z)
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.
void SetPreventOpenPauseMenu(const bool value)
bool SetPicColor(const int id, const int r=255, const int g=255, const int b=255, const int a=255)
void SpawnFx(const kStr &in fxPath, kPuppet@ source, const kVec3 &in origin, const float yaw, const float pitch)
void HaltMapScript(const int scriptID)
bool IsTactilePlaying(int vibHandle, const kStr &in path)
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 PlayMovie(const kStr &in filename, const bool skippable=true)
Only .ogv files (replaces/adds .ogv extension to filename). 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 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)
void SpawnFx(const kStr &in fxPath, kActor@ source, const kVec3 &in velocity, const kVec3 &in origin, const kQuat &in rotation)
const bool IsActorPersistentMarked(const int actorIndex, const int hubID=-1, const int mapNum=0)
an invalid hub or map uses current maps persistent data.
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.
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 LoadModFile(const kStr &in filename)
make sure to call GameModFileData.Empty() after you're done loading
void StopAllTactile()
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
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".
bool InputImageExists(const kStr &in path)
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.
const int GetMapIDFromName(const kStr &in mapName)
This returns the mapID from the mapName.
bool & HideBossBar()
Hide BossBar display on the HUD.
void SaveModFile(const kStr &in filename)
make sure to call GameModFileData.Empty() before adding key/values to save
void SetDifficulty(const int value)
EnumDifficulty.
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.
const bool AutomapDeactived()
void SetWorldSunLightColor(const float r, const float g, const float b)
void PlaySound(const kStr &in path)
bool MusicIsPlaying()
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)
const float ShakeIntensity()
const float GetExtraZFar()
void SetExtraZFar(const float zfar)
affects actors, ai, particles, fog and underwater. (works normally unlike the cvar r_zfarextent)
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
bool SetTextOrigin(const int id, const float x, const float y)
bool & HideWeaponWheel()
Hide WeaponWheel display on the HUD.
void SpawnFx(const kStr &in fxPath, kActor@ source, const kVec3 &in origin, const float yaw, const float pitch)
void SetDamageFlash()
Shows the damage screen flash.
void SetWorldSunAmbientColor(const float r, const float g, const float b)
const uint ConButtons()
EnumPlayerConButtons.
kVec3 GetWorldSunAmbientColor()
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...
const bool AutomapEnabled()
is the automap displaying on screen
void PlayMusic(const kStr &in path, const bool loop)
void SpawnFx(const kStr &in fxPath, kActor@ source, const kVec3 &in origin, const kQuat &in rotation)
void Restart()
void ClearText()
bool & HideLives()
Hide Lives display on the HUD.
bool SetTextColor(const int id, const int r=255, const int g=255, const int b=255, const int a=255)
void SpawnFx(const kStr &in fxPath, kPuppet@ source, const kVec3 &in velocity, const kVec3 &in origin, const kQuat &in rotation)
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)
void LoadMenu()
Opens the load game menu. Should always check if(PlayLoop.CanOpenPauseMenu())
bool & HideTimers()
Hide Timers display on the HUD.
void ResumeMusic()
void ClearLifeForcePic()
const bool GetPreventOpenPauseMenu()
void ChangeMap(const kStr &in path)
bool RemovePic(const int id)
kVec3 GetWorldSunDirection()
void CallMapScript(const int scriptID, kActor@ instigator)
Use to call map script right away.
bool & HideAirBar()
Hide AirBar display on the HUD.
void WeaponWheelPulse()
Shows the WeaponWheel on the HUD.
void SetGameSpeed(const float speed, const float blendSpeed)
Sets the current GameSpeed. kPuppet and kPlayerWeapon are not effected by GameSpeed.
void MessageBox(const kStr &in msg1, const kStr &in msg2)
void ToggleCursor(bool b=false)
void RemoveTimer()
bool & HideLifeForces()
Hide LifeForces display on the HUD.
void SetArmorFlash()
Shows the armor damage screen flash.
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)
Returns false if couldn't load file. Clears and Sets GameModFileData with the contents of the loaded ...
bool & HideHelpMessages()
Hide HelpMessages display on the HUD.
kVec3 WorldToHUDPoint(const kVec3 &in origin)
void OverrideSkyHeight(const float height)
Set to 0 to stop overriding.
bool & HideRunWalk()
Hide RunWalk display on the HUD.
void SpawnFx(const kStr &in fxPath, const kVec3 &in origin, const int sectorIndex)
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.
const float ViewZFar()
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 fucntion will now be processed. Call ClearDummyMenu to close the dummy menu.
void CyclePrevWeapon(const bool bCheckAmmo=false)
const bool HasAltAmmo(const int weaponID) const
const bool HasAltAmmo() const
const int LifeForces()
kPuppet Actor()
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()
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 gives extr...
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
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
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....
const bool WeaponAllowUnderwater(const int weapon) const
const int GetAmmo(const int weaponID) const
void ConsumeAltAmmo(const int ammo)