fork/training-mode-ce

git clone https://git.julia.blue/fork/training-mode-ce

AitchAdd better recoveries to training lab, add wall teching, improve Marth/Sheik recoveries slightly (#311)ef3398c

master
5.2 KiB201 linesraw
1#include "../MexTK/mex.h"
2#include "events.h"
3
4static void Exit(GOBJ *menu);
5static void Reset(void);
6
7static void ChangePlayerPercent(GOBJ *menu_gobj, int value);
8static void ChangeCustomKB_MagMin(GOBJ *menu_gobj, int value);
9static void ChangeCustomKB_MagMax(GOBJ *menu_gobj, int value);
10static void ChangeCustomKB_AngMin(GOBJ *menu_gobj, int value);
11static void ChangeCustomKB_AngMax(GOBJ *menu_gobj, int value);
12static void ChangeCustomKB_DmgMin(GOBJ *menu_gobj, int value);
13static void ChangeCustomKB_DmgMax(GOBJ *menu_gobj, int value);
14
15static EventMenu Menu_Main;
16static EventMenu Menu_CustomHitStrength;
17
18// Common values -------------------------------------------------
19
20typedef struct KBValues {
21    float mag_min, mag_max;
22    float ang_min, ang_max;
23    float dmg_min, dmg_max;
24} KBValues;
25
26enum options_kbvals {
27    KBVALS_WEAK,
28    KBVALS_NORMAL,
29    KBVALS_HARD,
30    KBVALS_SHALLOW,
31    KBVALS_CUSTOM,
32    
33    KBVALS_COUNT
34};
35
36#define CUSTOMKB_INIT_MAGMIN 100
37#define CUSTOMKB_INIT_MAGMAX 120
38#define CUSTOMKB_INIT_ANGMIN 45
39#define CUSTOMKB_INIT_ANGMAX 60
40#define CUSTOMKB_INIT_DMGMIN 50
41#define CUSTOMKB_INIT_DMGMAX 80
42
43static const char *Values_HitStrength[] = {"Weak", "Normal", "Hard", "Shallow", "Custom"};
44static KBValues HitStrength_KBRange[] = {
45    {
46         80.f, 100.f, // mag
47         45.f,  60.f, // ang
48         10.f,  40.f, // dmg
49    },
50    {
51        106.f, 120.f, // mag
52         45.f,  60.f, // ang
53         50.f,  80.f, // dmg
54    },
55    {
56        140.f, 200.f, // mag
57         65.f,  70.f, // ang
58         80.f, 110.f, // dmg
59    },
60    {
61        110.f, 130.f, // mag
62         20.f,  40.f, // ang
63         60.f,  80.f, // dmg
64    },
65    {
66        CUSTOMKB_INIT_MAGMIN, CUSTOMKB_INIT_MAGMAX,
67        CUSTOMKB_INIT_ANGMIN, CUSTOMKB_INIT_ANGMAX,
68        CUSTOMKB_INIT_DMGMIN, CUSTOMKB_INIT_DMGMAX,
69    },
70};
71
72enum options_initial {
73    OPT_MAIN_RECOVERY,
74    OPT_MAIN_PERCENT,
75    OPT_MAIN_HITSTRENGTH,
76    OPT_MAIN_HITSTRENGTH_CUSTOMMENU,
77    OPT_MAIN_EXIT,
78    
79    OPT_MAIN_COUNT
80};
81
82static EventOption Options_Main[] = {
83    {
84        .kind = OPTKIND_MENU,
85        .menu = 0, // Set in Event_Init
86        .name = "Recovery Options",
87        .desc = {"Alter the CPU's recovery options."},
88    },
89    {
90        .kind = OPTKIND_INT,
91        .value_num = 999,
92        .name = "Player Percent",
93        .desc = {"Adjust the player's percent."},
94        .format = "%d%%",
95        .OnChange = ChangePlayerPercent,
96    },
97    {
98        .kind = OPTKIND_STRING,
99        .name = "Hit Strength",
100        .desc = {"How far the CPU will be knocked back."},
101        .values = Values_HitStrength,
102        .value_num = countof(Values_HitStrength),
103        .val = 1,
104    },
105    {
106        .kind = OPTKIND_MENU,
107        .menu = &Menu_CustomHitStrength,
108        .name = "Customize Hit Strength",
109        .desc = {"Manually adjust where and how far the CPU",
110                 "will be knocked back."},
111    },
112    {
113        .kind = OPTKIND_FUNC,
114        .name = "Exit",
115        .desc = {"Return to the Event Select Screen."},
116        .OnSelect = Exit,
117    }};
118
119static EventMenu Menu_Main = {
120    .name = "Edgeguard",
121    .option_num = sizeof(Options_Main) / sizeof(EventOption),
122    .options = Options_Main,
123};
124
125// Custom Hit Strength ---------------------------------
126
127enum options_custom_hit_strength {
128    OPT_CUSTOMHIT_MAGMIN,
129    OPT_CUSTOMHIT_MAGMAX,
130    OPT_CUSTOMHIT_ANGMIN,
131    OPT_CUSTOMHIT_ANGMAX,
132    OPT_CUSTOMHIT_DMGMIN,
133    OPT_CUSTOMHIT_DMGMAX,
134    
135    OPT_CUSTOMHIT_COUNT
136};
137
138static EventOption Options_CustomHitStrength[] = {
139    {
140        .kind = OPTKIND_INT,
141        .value_num = 301,
142        .val = CUSTOMKB_INIT_MAGMIN,
143        .name = "Knockback Min",
144        .desc = {"Adjust the minimum of how far the CPU will fly."},
145        .format = "%d",
146        .OnChange = ChangeCustomKB_MagMin,
147    },
148    {
149        .kind = OPTKIND_INT,
150        .value_num = 301,
151        .val = CUSTOMKB_INIT_MAGMAX,
152        .name = "Knockback Max",
153        .desc = {"Adjust the maximum of how far the CPU will fly."},
154        .format = "%d",
155        .OnChange = ChangeCustomKB_MagMax,
156    },
157    
158    {
159        .kind = OPTKIND_INT,
160        .value_num = 91,
161        .val = CUSTOMKB_INIT_ANGMIN,
162        .name = "Angle Min",
163        .desc = {"Adjust the minimum angle the CPU will fly."},
164        .format = "%d",
165        .OnChange = ChangeCustomKB_AngMin,
166    },
167    {
168        .kind = OPTKIND_INT,
169        .value_num = 91,
170        .val = CUSTOMKB_INIT_ANGMAX,
171        .name = "Angle Max",
172        .desc = {"Adjust the maximum angle the CPU will fly."},
173        .format = "%d",
174        .OnChange = ChangeCustomKB_AngMax,
175    },
176    
177    {
178        .kind = OPTKIND_INT,
179        .value_num = 1000,
180        .val = CUSTOMKB_INIT_DMGMIN,
181        .name = "Percent Min",
182        .desc = {"Adjust the CPU's minimum percent."},
183        .format = "%d%",
184        .OnChange = ChangeCustomKB_DmgMin,
185    },
186    {
187        .kind = OPTKIND_INT,
188        .value_num = 1000,
189        .val = CUSTOMKB_INIT_DMGMAX,
190        .name = "Percent Max",
191        .desc = {"Adjust the CPU's maximum percent."},
192        .format = "%d%",
193        .OnChange = ChangeCustomKB_DmgMax,
194    },
195};
196
197static EventMenu Menu_CustomHitStrength = {
198    .name = "Custom Hit Strength",
199    .option_num = sizeof(Options_CustomHitStrength) / sizeof(EventOption),
200    .options = Options_CustomHitStrength,
201};