-
Notifications
You must be signed in to change notification settings - Fork 0
/
std.txt
1082 lines (759 loc) · 33.8 KB
/
std.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
std.txt for ZC Versions 2.55.0 Alpha 32 and higher.
23rd September, 2019
=================
--- Constants ---
=================
const float STD_VERSION;
* The current header version.
const float PI, PI2, E
* The mathematical constants pi, 2*pi and e.
const float RADIAN, DEGREE, SQRT_MAX
const int SQRT_ERROR
* Some additional constants for maths.
const int NULL
* Refers to an invalid array pointer, returned by ALLOCATEMEM when memory cannot be allocated
const float MAX_CONSTANT, float MIN_CONSTANT, float MAX_VARIABLE, float MIN_VARIABLE, int MAX_INT, MIN_INT,
const float MAX_FLOAT, float MIN_FLOAT, int MIN_INT, float MIN_FLOAT, float MIN_
const int MAX_COUNTER, int MIN_COUNTER
const int MIN_LWEAPON, int MIN_EWEAPON, int MIN_NPC, int MIN_IEM, int MAX_LWEAPON, int MAX_EWEAPON, int MAX_NPC,
const int MAX_ITEM, MAX_OBJECT_POINTERS< MAX_WEAPON_POINTERS, MAX_TOTAL_OBJECT_POINTERS
const int MAX_SPRITES
const int MAX_DRAWING
const int MINBITMAP_X, int MAX_BITMAP_X, int MIN_BITMAP_Y, int MAX_BITMAP_Y
const int MAX_GLOBAL_VARIABLES, int MAX_VARIABLES, int MAX_BITSPERVARIABLE
const int MAX_ARRAY_POINTERS, int MAX_TILES, int MAX_COMBOS, int MAX_STRINGS
const int HP_PER_BLOCK, int MP_PER_BLOCK
const int MAX_SCRIPTDRAWINGCOMMANDS
const int MAX_MESSAGES, int MAX_MESSAGELENGTH
const int MAX_MAPS, MAX_DMAPS
const int MAX_DMAPNAMELENGTH, MAX_DMAPTITLELENGTH, MAX_DMAPINTROLENGTH
const int MAX_FFC_*
* Information about some system constraints
const int SCREEN_W, int SCREEN_H, int SUBSCREEN_BOTTOM, int SUBSCREEN_TOP
const int SCREEN_RIGHT, int SCREEN_LEFT, int SCREEN_TOP, int SCREEN_BOTTOM
* Screen dimensions.
const float GRAVITY
const float TERMINAL_VELOCITY
const float JUMPING_LAYER_THRESHOLD
* Some defaults from Init. Data
const int CSET*
* Offsets for the initial swatch of each CSet
const int SFX_*
* Sound effects, can be used with Game->PlaySound.
const int SP_*
* Default Sprite IDs
const int IC_*
* Itemclass IDs, can be compared against itemdata->Family
const int I_*
* Item IDs, can be used with Link->Item, Link->Equipment, item->ID, Link->HeldItem, GetEquipmentA,
* GetEquipmentB, Screen->CreateItem, CreateItemAt, NumItemsOf
const int LA_*
* Link's actions, can be used to set or compare against Link->Action
const int NPCT_*
* NPC Types, can be used to compare against npc->Type
const int NPC_*
* NPC IDs, can be used with npc->ID, Screen->CreateNPC, NumNPCsOf
const int HP_SILENT
* NPC HP value, can be used to set npc->HP
const int LW_*
* LWeapon IDs, can be used with lweapon->ID, Screen->CreateLWeapon, CreateLWeaponAt, NumLWeaponsOf
const int EW_*
* EWeapon IDs, can be used with eweapon->ID, Screen->CreateEWeapon, CreateEWeaponAt, NumEWeaponsOf
const int WDS_*
* Weapon DeadState Values, can be used to set or compare against *weapon->DeadState
const int FFCF_*
* FFC Flags, can be used to set or compare against ffc->Flags[]
const int DIR_*
* Directions, can be used with Link->Dir, npc->Dir, *weapon->Dir
const int DEG_DIR_*
* Constants for the equivalent to a given direction, in degrees.
const int RAD_DIR_*
* Constants for the equivalent to a given direction, in radians.
const int FLIP_*, int ROT_*
* Flip and rotation used by sprites and tiles.
const int EXT_*
* Extend types.
const int CF_*
* Combo Flags, can be used with Screen->ComboF[], Screen->ComboI[], Game->GetComboFlag, Game->SetComboFlag,
* Game->GetComboInherentFlag, Game->SetComboInherentFlag
const int CT_*
* Combo Types, can be used with Screen->ComboT[], Game->GetComboType, Game->SetComboFlag
const int CB_*
* Controller buttons.
const int IP_*
* Item Pickup Flags, can be used with item->Pickup, GetItemPickup, SetItemPickup
const int SF_*
* Screen Flag Categories, can be used with Screen->Flags, GetScreenFlags
const int SFR_*
* Room types.
const int SFV_*
* Screen View Flags
const int SFS_*
* Screen Secret Flags
const int SFW_*
* Screen Warp Flags
const int SFI_*
* Screen Item Flags
const int SFC_*
* Sreen Combo Flags
const int SFSV_*
* Screen save flags
const int SFF_*
* Screen FFC Flags
const int SFW_*
* Screen Whistle Flags
const int SFM_*
* Screen Misc. Flags
const int SEF_*
* Screen Enemy Flag Categories, can be used with Screen->EFlags, GetScreenEFlags
const int DMF_*
* DMap Flags, can be used with Game->DMapFlags[], GetDMapFlag, SetDMapFlag
const int NPCA*_*
* NPC Attributes, can be used to compare against npc->Attributes[]
const int NPCD_*
* NPC Defenses, can be used to compare against npc->Defense[]
const int NPCDT_*
* NPC Defense types, can be used to compare against npc->Defense[]
cons int NPCA_*
* NPC Attribute Indices, and Values for each type of Attribute, segregated by NPC type.
const int DS_*
* Draw Styles, can be used with item->DrawStyle
const int WT_*
* Warp Types, can be used with Screen->SetSideWarp, Screen->SetTileWarp
const int TILEWARP_*, int SIDEWARP_*
* IDs of tile warps and side warps.
const int FONT_*
* Font Types, can be used with Screen->DrawCharacter, Screen->DrawString, Screen->DrawInteger
const int TF_*
* Text Formats, can be used with Screen->DrawString
const int PT_*
* Texture Mapping Rendering Modes, can be used with Screen->*3D
const int OP_*
* Opacity options, can be used with all shape and tile drawing commands.
const int RT_*
* Render targets, can be used with Screen->SetRenderTarget and Screen->DrawBitmap.
const int EXT_*
* Sprite Extend Types, can be used with Link->Extend, npc->Extend, *weapon->Extend, item->Extend
const int CR_*
* Counter types, can be used with itemclass->Counter, Game->Counter[], Game->MCounter[], Game->DCounter[]
const int GEN_*
* Generic Data Types, can be used to set or compare against Game->Generic[]
const int LI_*
* Level Item Flags, can be used with Game->LItems[], GetLevelItems, SetLevelItems
cosnt int ST_*
* Screen States, can be used with Screen->State[], Game->GetScreenState, Game->SetScreenState
const int D_*
* Door types, can be used with Screen->Door[]
const int WPN_*
* Enemy Weapon Types, can be used with npc->Weapon
const int AT_*
* Weapon aim types, to be used with AimEWeapon
const int IS_*
* Item Drop Sets, can be used to set or compare against npc->ItemSet
const int BPAL_*
* Boss Palletes, can be used to set or compare against npc->BossPal
const int SL_*
* Sprite Lists, can be used with Screen->ClearSprites
const int MB_*
* Mouse Buttons, can be used with Link->InputMouseB
const int CB_*
* Controller input buttons
const int NPCSF_*
* NPC Spawn Flags
const int NPCM_*
* NPC Misc. Flags
const int SFM__*
* Misc. Screen Flags
const int CSET_*
* Values for the first colour in each CSet
const int SPRITE_*
* Values for all default sprites
const int AT_*
* Aim types for use with AimEWeapon()
const int TEX_BITMAP
* Drawing texture Mode (2.50.3 experimental, and later)
const int FFCBF_*
* Bitwise flags for FFC Flags.
const int GOS_*
* Game Over Screen Indices for Game->GameOverScreen[]
* Game Over Strings indives for Game->GameOverStrings[]
const int BITDX_*
* BitmapEx drawing modes for DrawBitmapEx() and Blit()
const int ITM_*
* Slot flags for Link->SetItemSlot
const int MOUSE_*
* Indices of Input->Mouse[]
const int SECCMB_*
* Indices of GetSecretCombo()
const int VOL_*
* Indices of Audio->Volume
const float DIR16_DEG_*
* Regree values for 16 built-in directions.
const float DIR16_RADS_*
* Radian values for 16 built-in directions.
const int DMAP_*
* DMap Types for dmapdata->Type
const int TINT_*
* Built-in tint presets for Monochrome() and Tint() functions.
const int RTC_
* Values for the category param of GetSystemTime(int category)
const int WT_*
* Warp Types for use with WarpEx() and Set/Get*Warp()
const int WARPEFFECT_*
* Visual warp effects for WarpEx()
const int WARP_FLAG_*
* Flagset values for WarpEx() flags.
_ERR_*
* Error code values for #ignore error compiler flags.
=================
--- Functions ---
=================
-- Mathematical Functions --
============================
float LogToBase(float x, float base)
* Returns the logarithm of x to the given base
int math::Floor(float x)
* Truncates x to an integer
int math::Ceiling(float x)
* Raises x to the nearest integer
int Round(float x)
* Rounds x to the nearest integer
int VBound(int x, int high, int low)
* Bounds x between two values
int Div(float x, float y)
* Modulo's complement; returns the quotient only of x divided by y
int Rand(int min, int max)
* Overload to rand, returning a random integer in the bounds of min and max
float Randf(float n)
* Returns a random floating point number up to n
float Randf(float n1, float n2)
* Overloaded to take two boundaries as arguments
float DegtoRad(float d)
* Converts 'd' in degrees to radians
float RadtoDeg(float r)
* Converts 'r' in radians to degrees
int Sign(int n)
* Returns the sign of n
float Distance(int x1, int y1, int x2, int y2)
* Returns the distance between two sets of coordinates using Pythagoras' Theorem
float LargeDistance(int x1, int y1, int x2, int y2, int divisor);
* Calculates the distance over a scale 'divisor' that would otherwise
overflow Distance().
float Angle(int x1, int y1, int x2, int y2)
* Returns the direction of the vector from point 1 to point 2, in degrees from -180 to 180. (0 = right)
float RadianAngle(int x1, int y1, int x2, int y2)
* The above, but in radians.
float VectorX(int len, float angle)
* Returns the X component of a vector with a degree angle.
* A length of 3 and angle of 0 returns 3.
* A length of 3 and angle of 45 returns approx. 1.57.
* A length of 3 and angle of 90 returns 0.
float VectorY(int len, float angle)
* Returns the Y component of a vector with a degree angle.
* A length of 3 and angle of 0 returns 0.
* A length of 3 and angle of 45 returns approx. 1.57.
* A length of 3 and angle of 90 returns 3.
float Lerp(float p1, float p2, float t)
* Interpolates between p1 and p2 given 't' clamped within range 0,1.
float DotProduct( float x1, float y1, float x2, float y2 )
* Returns the dot product of two vectors.
float CrossProduct( float x1, float y1, float x2, float y2 )
* Returns the cross product of two vectors.
float DistanceSquared( float x, float y )
* Returns the squared distance of a vector.
float Midpoint(float p1, float p2)
* Finds the center of p1 and p2.
float SmoothStep(float p1, float p2, float t)
* Performs a "Smooth" Interpolation given 't' clamped within range 0,1.
float WrapAngle( float radians )
* Wraps radian value towards the range of -PI,PI.
float WrapDegrees( float degrees )
* Wraps degree value towards the range of -180,180.
float TurnTowards( int X, int Y, int targetX, int targetY, float radian_angle, float t )
* Returns an angle pointing (t)percentage more accurate to the target than the specified radian_angle.
int DirAngle(int dir);
* Returns angle of the given direction.
int Dir4Angle(int dir);
* Returns angle of the given direction.
int DirRad(int dir);
* Same as DirAngle, but return value is measured in radians.
int Dir4Rad(int dir);
* Same as Dir4Angle, but return value is measured in radians.
-- Direction Functions --
=========================
* Make sure your angles are in the range -PI to PI (with WrapAngle) before using these functions
int AngleDir8(float angle)
* Converts a counterclockwise degree angle (from -180 to 180) into one of the eight
* standard directions (DIR_UP etc.) used by ZC.
int RadianAngleDir8(float angle)
* The above, but for radian angles.
int AngleDir4(float angle)
* Converts a counterclockwise degree angle (from -180 to 180) into one of the four
* standard directions (DIR_UP, DIR_DOWN, DIR_LEFT, DIR_RIGHT) used by ZC.
int RadianAngleDir4(float angle)
* The above, but for radian angles.
int OppositeDir(int dir)
* Returns the opposite direction to 'dir'
int SpinDir(int dir)
* Converts directions to go round in a circle rather than U, D, L, R
bool Facing(ffc f);
* Returns true if Link is facing the ffc.
bool Above(T);
* Returns true if Link is above the object T.
bool Below(T);
* Returns true if Link is below the object T.
bool LeftOf(T);
* Returns true if Link is to the left of the object T.
bool RightOf(T);
* Returns true if Link is to the right of the object T.
bool DistXY(ffc a, int dist);
* Returns true if Link is within 'dist' pixels distance
of the ffc on both axis.
-- Drawing Functions --
=======================
void DrawString(int layer, int x, int y, int font, int color, int background_color, int format, int opacity,
int string, int start)
* Overload to Screen->DrawString which includes a position to start drawing from in the string
* Does not check for overflow
void DrawString(int layer, int x, int y, int font, int color, int background_color, int format, int opacity,
int string, int start, int end)
* Overload to Screen->DrawString which includes a start and end position to draw the string
* Does not check for overflow
void DrawTileSimple(int x, int y, int tile, int color)
* A very simple layer 0 tile drawing routine.
void DrawToLayer(T ptr, int layer, int opacity)
* Draws a pointer to given layer. Overloaded to take all pointers as arguments
-- Conditional Functions --
===========================
T Cond(bool cond, T a, T b)
* Returns a if cond is true, else b. Overloaded to take all types as arguments
float Choose(float a, float b)
float Choose(float a, float b, float c)
float Choose(float a, float b, float c, float d)
float Choose(float a, float b, float c, float d, float e)
float Choose(float a, float b, float c, float d, float e, float f)
* Chooses one of the options randomly and fairly.
-- Collision Detection Functions --
===================================
bool RectCollision(int box1_x1, int box1_y1, int box1_x2, int box1_y2, int box2_x1, int box2_y1, int box2_x2, int box2_y2)
* Generalized and optimized rectangle collision checking function.
* Returns true if the bounding box of box1 and box2 overlap.
bool SquareCollision(int c1x, int c1y, int side1, int c2x, int c2y, int side2)
* Check for collisions of two squares given upper-left coordinates and a side length for each.
bool SquareCollision2(int c1x, int c1y, int radius1, int c2x, int c2y, int radius2)
* Check for collisions of two squares given center coordinates and a halved side length for each.
bool CircleCollision(int c1x, int c1y, int radius1, int c2x, int c2y, int radius2)
* Returns true if the two circles c1 and c2 overlap.
bool Collision(T a, S b)
* Returns true if there is a collision between the hitboxes of any two pointers
bool LinkCollision(T ptr)
* Returns true if there is a collision between Link's hitbox and any pointer's
int HitboxLeft(T ptr)
* Returns the X coordinate of the left edge of the hitbox for any pointer
int HitboxTop(T ptr)
* Returns the Y coordinate of the top edge of the hitbox for any pointer
int HitboxRight(T ptr)
* Returns the X coordinate of the right edge of the hitbox for any pointer
int HitboxBottom(T ptr)
* Returns the Y coordinate of the bottom edge of the hitbox.
bool CanWalk(int x, int y, int dir, int step, bool full_tile)
* This should allow any scripted object to easily mimic Link styled LOZ solidity collision
* checking, be it Link, FFCs, or enemies.
* Note - You should use full_tile=true if you don't want the upper eight pixels to overlap
* solid combos as per LOZ1 behavior.
bool OnSidePlatform(int x, int y)
bool OnSidePlatform(int x, int y, int xOff, int yOff, int h)
* Returns true if the sprite at (x,y) is standing on a sideview platform on a sideview screen, as worked out
* by ZC's internal code.
-- Functions for accessing data stored in binary format --
==========================================================
bool IsSideview()
* Returns true if Link is on a sideview screen
bool IsDungeonFlag();
* Returns true if Link is on a Dungeon (flagged) screen
bool IsInteriorFlag();
* Returns true if Link is on an Interior (flagged) screen
int HasTriforce(int level);
* Returns if Link has the Triforce piece for a given level.
int HasCompass(int level);
* Returns if Link has the compass for a given level.
int HasMap(int level);
* Returns if Link has the map for a given level.
int HasBossKey(int level);
* Returns if Link has the map for a given level.
int DefeatedLevelBoss(int level);
* Returns if Link has defeated the dungeon boss for a given level.
void SetScreenDBit(int dmap, int screen, int d, int bit, bool state)
void SetScreenDBit(int screen, int d, int bit, bool state)
void SetScreenDBit(int d, int bit, bool state)
* Sets bit 'bit' of Screen->D[] register 'd' to 'state', overloaded to set on other screens
bool GetScreenDBit(int dmap, int screen, int d, int bit)
bool GetScreenDBit(int screen, int d, int bit)
bool GetScreenDBit(int d, int bit)
* Returns the state of bit 'bit' of Screen->D[] register 'd'
* Overloaded to get from other screens
bool InputLeftClick()
* Returns true if the left mouse button is pressed
bool InputRightClick()
* Returns true if the right mouse button is pressed
bool InputMiddleClick()
* Returns true if the middle mouse button is pressed.
* Note that not all mice have a middle button.
int GetEquipmentA()
* Returns the item ID of the item equipped to Link's A button
int GetEquipmentB()
* Returns the item ID of the item equipped to Link's B button
bool UsingItem(int id)
* Returns true if Link is using item 'id'
int ScreenFlag(int category, int flag)
* Returns 1 if Screen Flag 'flag' is set from category 'category', 0 if it's not and -1 if an invalid flag is passed
* Flags are numbered starting from 0
int ScreenEFlag(int category, int flag)
* Returns 1 if Screen Enemy Flag 'flag' is set from category 'category', 0 if it's not and -1 if an invalid flag is passed
* Flags are numbered starting from 0
bool GetDMapFlag(int dmap, int flag)
* Returns true if DMap Flag 'flag' is set on dmap 'dmap'
void SetDMapFlag(int dmap, int flag, bool state)
* Sets a certain DMap flag to 'state'
bool GetItemPickup(item i, int pickup)
* Returns true if an item's Pickup state is set
* Use the IP_ constants for the 'pickup' argument of this function
void SetItemPickup(item i, int pickup, bool state)
* Sets an item's Pickup state to 'state'
bool GetNPCMiscFlag(npc e, int flag)
* Returns true if an npc's Misc. flag is set.
bool GetLevelItem(int level, int itm)
bool GetLevelItem(int itm)
* Returns true if Link has the level item 'itm' from level 'level'
* Overloaded to use the current level if no 'level' arg is entered
* Use the LI_ constants for the 'itm' argument
void SetLevelItem(int level, int itm, bool state)
void SetLevelItem(int itm, bool state)
* Gives or removes a level item from Link's inventory
-- Functions to help handling in-built pointers --
==================================================
lweapon NextToLink(int id, int distx, int disty)
lweapon NextToLink(int id, int dist)
* Creates an lweapon at 'distx, disty' away from where Link is facing
eweapon NextToNPC(npc n, int id, int distx, int disty)
eweapon NextToNPC(npc n, int id, int dist)
* Creates an eweapon at 'distx, disty' away from where npc 'n' is facing
void AimEWeapon(eweapon e, int aimtype)
* Aims eweapon e according to the AT_* constant passed to aimtype
void AimLWeapon(lweapon l, npc n, int aimtype)
void AimLWeapon(lweapon l, int aimtype)
* Aims lweapon l according to the AT_* constant passed to aimtype, overloaded to shoot
* at an npc or at random
int WeaponTypeToID(int weapontype)
* Turns a WPN_* constant to an EW_* constant
*weapon Duplicate(*weapon a)
* Creates and returns an exact copy of the passed weapon. Assumes that the passed pointer is valid.
void MakeBlockable(eweapon a);
* Makes the eweapon a normal type, so that shields block it.
void MakeUnblockable(eweapon a);
* Makes the eweapon a boss type, so that shields ignore it.
npc CreateNPCAt(int id, int x, int y)
* Create an NPC and set its X and Y position in one command
item CreateItemAt(int id, int x, int y)
* Create an Item and set its X and Y position in one command
lweapon CreateLWeaponAt(int id, int x, int y)
* Create an LWeapon and set its X and Y position in one command
eweapon CreateEWeaponAt(int id, int x, int y)
* Create an EWeapon and set its X and Y position in one command
void Remove(T n)
* Removes sprite 'n' from the screen. Overloaded.
int NumLWeaponsOf(int type)
* Returns the number of lweapons of type 'type' currently on the screen
int NumEWeaponsOf(int type)
* Returns the number of weapons of type 'type' currently on the screen
int NumNPCsOf(int type)
* Returns the number of npcs of type 'type' currently on the screen
int NumberEnemies();
* Returns the number of enemy NPCs on the current screen, ignoring
guys, faeries, projectile shooters, unbeatable enemies, and similar.
bool EnemiesAlive();
* Returns true if there are any enemies on the screen that are beatable,
excluding projectile statues, guys, and faeries.
int NumItemsOf(int type)
* Returns the number of items of type 'type' currently on the screen
lweapon LoadLWeaponOf(int type)
* Returns the first LWeapon of the given type. Use the LW_ constants.
* If none exist, it returns an uninitialised pointer.
eweapon LoadEWeaponOf(int type)
* Returns the first EWeapon of the given type. Use the EW_ constants.
* If none exist, it returns an uninitialised pointer.
npc LoadNPCOfType(int type)
* Returns the first NPC of the given type. Use the NPCT_ constants.
* If none exist, it returns an uninitialised pointer.
npc LoadNPCOf(int type)
* Returns the first NPC of the given ID. Use the NPC_ constants.
* If none exist, it returns an uninitialised pointer.
item CreateTimeoutItem(int id, int x, int y)
* Creates a timeout item (such as a rupee or heart) with ID 'id' at '(x, y)'
-- Position Functions --
========================
int GridX(int x)
* Snaps 'x' to the combo grid
* Equivalent to calling ComboX(ComboAt(x, foo));
int GridY(int y)
* Snaps 'y' to the combo grid
* Equivalent to calling ComboY(ComboAt(foo, y));
int AtFrontX(int dir)
int AtFrontY(int dir)
* Returns the correct offset to be at the front of a sprite facing in
* the direction 'dir'
int InFrontX(int dir, int dist)
int InFrontY(int dir, int dist)
* Returns the correct offset to be 'dist' pixels away from the front of
* a sprite facing in the direction 'dir'
int CenterX(ffc anFFC)
int CenterY(ffc anFFC)
int CenterX(npc anNPC)
int CenterY(npc anNPC)
int CenterX(eweapon anEWeapon)
int CenterY(eweapon anEWeapon)
int CenterX(lweapon anLWeapon)
int CenterY(lweapon anLWeapon)
int CenterLinkX()
int CenterLinkY()
* Returns the X or Y coordinate at the center of the given sprite.
-- Combo Functions --
=====================
int ComboAt(int x, int y)
* Finds the location of a combo, given its (x,y) coordinates on the screen
int ComboX(int loc)
int ComboY(int y)
* Return the coordinates of a combo on the screen
bool ComboFI(int x, int y, int flag)
bool ComboFI(int loc, int flag)
* Returns true if the combo at '(x, y)' or 'loc' has either an
* inherent or placed flag of type 'flag'
int GetLayerComboD(int layer, int pos)
* A shorthand way to get a combo on the specified layer.
* Layer 0 is the screen itself.
void SetLayerComboD(int layer, int pos, int combo)
* A shorthand way to set a combo on the specified layer.
* Layer 0 is the screen itself.
int GetLayerComboF(int layer, int pos)
* A shorthand way to get a combo flag on the specified layer.
* Layer 0 is the screen itself.
void SetLayerComboF(int layer, int pos, int flag)
* A shorthand way to set a combo flag on the specified layer.
* Layer 0 is the screen itself.
int GetLayerComboT(int layer, int pos)
* A shorthand way to get a combo type on the specified layer.
* Layer 0 is the screen itself.
void SetLayerComboT(int layer, int pos, int type)
* A shorthand way to set a combo type on the specified layer.
* Layer 0 is the screen itself.
int GetLayerComboS(int layer, int pos)
* A shorthand way to get a combo's solidity on the specified layer.
* Layer 0 is the screen itself.
void SetLayerComboS(int layer, int pos, int solidity)
* A shorthand way to set a combo's solidity on the specified layer.
* Layer 0 is the screen itself.
int GetLayerComboI(int layer, int pos)
* A shorthand way to get a combo inherent flag on the specified layer.
* Layer 0 is the screen itself.
void SetLayerComboI(int layer, int pos, int flag)
* A shorthand way to set a combo inherent flag on the specified layer.
* Layer 0 is the screen itself.
int GetLayerComboC(int layer, int pos)
* A shorthand way to get a combo's CSet on the specified layer.
* Layer 0 is the screen itself.
void SetLayerComboC(int layer, int pos, int cset)
* A shorthand way to set a combo's CSet on the specified layer.
* Layer 0 is the screen itself.
int FirstComboOf(int t, int layer)
* Returns the position of the first instance of the given combo, or -1.
int LastComboOf(int t, int layer)
* Returns the position of the last instance of the given combo, or -1.
int FirstComboTypeOf(int t, int layer)
* Returns the position of the first instance of the given combo, or -1.
int LastComboTypeOf(int t, int layer)
* Returns the position of the last instance of the given combo, or -1.
int FirstComboFlagOf(int t, int layer)
* Returns the position of the first instance of the given combo flag, or -1.
* Checks inherent flags too!
int LastComboFlagOf(int t, int layer)
* Returns the position of the last instance of the given combo flag, or -1.
* Checks inherent flags too!
bool IsWater(int position)
* Returns true if the combo at the given position is water or a swim or dive warp. Shallow water doesn't count.
bool IsPit(int position)
* Returns true if the combo at the given position is a pit.
-- Tile Functions --
====================
void SwapTileRow(int first, int second, int length)
* Swaps a row of tiles of length 'length' between positions 'first' and 'second'
void CopyTileRow(int source, int dest, int length)
* Copies a row of tiles of length 'length' from 'source' onto 'dest'
void ClearTileRow(int ref, int length)
* Clears a row of tiles of length 'length' starting from tile 'ref'
void SwapTileBlock(int first, int last, int second)
* Swaps a block of tiles defined by diagonal corners 'first' and 'last'
* with the block starting with top left tile 'second'
void CopyTileBlock(int sourcefirst, int sourcelast, int destfirst)
* Copies a block of tiles defined by diagonal corners 'sourcefirst' and 'sourcelast'
* onto the block starting with top left tile 'destfirst'
void ClearTileBlock(int reffirst, int reflast)
* Clears a block of tiles defined by diagonal corners 'reffirst' and 'reflast'
-- Miscellaneous Functions --
=============================
void Waitframes(int n)
* Wait for 'n' frames
void NoAction()
* Kills all of Link's inputs, including those from the analogue stick.
void NoAction(bool analogue_stick)
* As NoAction() but the analoge stick is not killed by default.
void WaitNoAction()
void WaitNoAction(int frames)
* NoAction, then Waitframe or (equivalent of) Waitframes
void SetEquipment(int a, int b)
* Writes items to both the A and the b item slots.
void ScreenCopy(int destmap, int destscr, int srcmap, int srcscr)
* Copies the combos and csets from one screen to another.
* Only copies layer 0!
int FFCNum(ffc f)
* Returns the number of an FFC, and -1 for a non-valid FFC (which should never happen)
int NumTriforcePieces()
* Returns the number of Triforce Pieces Link currently has in his inventory.
int NumTriforcePieces(int maxlevel);
* Returns the number of Triforce Pieces Link currently has in his inventory.
* Specify the highest level in your game with arg 'maxlevel'.
void GetNPCName(int ID, int string[])
* Puts the name of an npc into a string
void GetMessage(int ID, int string[])
* Puts string 'ID' into 'string', removing the trailing spaces.
itemdata GetItemData(item i)
* Returns an itemdata pointer from an item pointer
int GetHighestLevelItem(int itemclass)
int GetHighestLevelItem(item i)
* Returns the highest level item of a given itemclass, or of the class 'i' belongs to
void CounterAdd(int counter, int amount);
* Add to a counter without rollover.
void CounterReduce(int counter, int amount);
* Reduce a counter without rollvoer.
void MCounterAdd(int counter, int amount);
* Add to a counter max without rollover.
void MCounterReduce(int counter, int amount);
* Reduce a counter max without rollvoer.
void DCounterAdd(int counter, int amount);
* Add to a drain counter without rollover.
void DCounterReduce(int counter, int amount);
* Reduce a drain counter without rollover.
int DMapToMap(int screen, int dmap)
int MapToDMap(int screen, int dmap)
* Convert between map and DMap screen coordinates
int ScreenItem();
* Returns the item ID for the current screen, if there is one.
bool HasKey(int level);
* Returns true if Link has keys that he can use in the specified level.
bool HasKey();
* Returns true if Link has keys that he can use in the current level.
int NumKeys(int level);
* Returns the total number of keys (normal, and level-specific) that Link
* has, that work in the specified level.
int NumKeys();
* Returns the total number of keys (normal, and level-specific) that Link
* has, that work in the current level.
bool ConsumeKey(int level);
* Uses a key for the current level.
* If Link has a level key for this level, it uses this first.
* If Link does not have a level key for this level, it the tries to
* use a normal key.
* Returns true on success.
* Returns false if Link has no valid keys to use.
bool ConsumeKey();
* As ConsumeKey(int level), except that it is for only the
* current level.
============================
-- Bug Fixes ( 2.53.0 ) --
============================
SquareCollision now properly uses 'side2' arg for its calculation. (Bugfix)
=============================
-- New Includes ( 2.53.0 ) --
=============================
std.zh now includes some new files, that you will want to review. The outline, scope, and purpose of
the new expansions is outlined below.
/******************
* std.zh Settings *
*******************/
std.zh now includes a SETTINGS FILE ( std.cfg ) that has a few options
that you may enable, if you wish to change the behaviour of std.zh at compilation
for your quests. These settings are disbaled by default, and affect only a handful of
minimal mechanical differences as follows:
MAX_HIGHEST_LEVEL_ITEM_CHECK
* The highest item ID to check, with GetHighestLevelItem.
The default value is now 255.
SETLAYERCOMBO_USE_MAPDATA
* If enabled, all SetLayerCombo and GetlayerCombo functions
* will use *mapdata instead of Game->Get/SetCombo functions.
SETLAYERCOMBO_ONLY_USE_MAPDATA
* If enabled, all SetlayerCombo and GetLayerCombo functions
* will use *mapdata for combos on layer 0.
SETLAYERCOMBO_ALWAYS_USE_SETCOMBO
* If enabled, SetLayerCombo* functions will always use Screen->Combo*[]
for layer 0. Otherwise, they will use Game-> combo data.
REVISED_ROTATEPOINT_X_FUNCTION
REVISED_ROTATEPOINT_Y_FUNCTION
* If enabled. the new functions for RotatePoint*() will be used.
* If disabled, the old 2.50.x functions will run, instead.
STD_FORCE_OLD_DISTANCE