Melee Modding Library  2.0.0
A C library for modding Super Smash Bros Melee
ai.h
Go to the documentation of this file.
1 
7 #ifndef MML_AI_H
8 #define MML_AI_H
9 
11 
12 #define DR_MARIO (1 << 0)
13 #define MARIO (1 << 1)
14 #define LUIGI (1 << 2)
15 #define BOWSER (1 << 3)
16 #define PEACH (1 << 4)
17 #define YOSHI (1 << 5)
18 #define DK (1 << 6)
19 #define FALCON (1 << 7)
20 #define GANON (1 << 8)
21 #define FALCO (1 << 9)
22 #define FOX (1 << 10)
23 #define NESS (1 << 11)
24 #define ICE_CLIMBERS (1 << 12)
25 #define KIRBY (1 << 13)
26 #define SAMUS (1 << 14)
27 #define ZELDA (1 << 15)
28 #define LINK (1 << 16)
29 #define YOUNG_LINK (1 << 17)
30 #define PICHU (1 << 18)
31 #define PIKACHU (1 << 19)
32 #define PUFF (1 << 20)
33 #define MEWTWO (1 << 21)
34 #define MR_GNW (1 << 22)
35 #define MARTH (1 << 23)
36 #define ROY (1 << 24)
37 
38 
39 #include "logic.h"
40 #include "moves.h"
41 #include "controller.h"
42 #include "gctypes.h"
43 #include "input_queue.h"
44 
46 typedef struct
47 {
51  size_t logicSize;
52  size_t logicCapacity;
56  bool active;
58 } AI;
59 
61 #define INIT_AI(port_val, characters_val) \
62 { \
63  .inputQueue = INIT_INPUT_QUEUE(port_val), \
64  .logicQueue = NULL, \
65  .logicSize = 0, \
66  .logicCapacity = 0, \
67  .characters = characters_val, \
68  .port = port_val, \
69  .active = false \
70 }
71 
80 void addLogic(AI* ai, const Logic* logic);
81 
90 void addMove(AI* ai, const Move* move);
91 
98 void updateAI(AI* ai);
99 
106 bool needLogic(const AI* ai);
107 
114 void clearAI(AI* ai);
115 
116 #endif
Controller controller
Definition: ai.h:48
Manages a list of inputs.
Definition: input_queue.h:26
bool needLogic(const AI *ai)
Check if AI has no logic or inputs queued.
Definition: ai.c:56
void clearAI(AI *ai)
Clear all logic and inputs from AI (reset controller)
Definition: ai.c:61
Data types for the gamecube.
Common input sequences.
void updateAI(AI *ai)
Check logic rules and queued inputs.
Definition: ai.c:76
Represents the state of a controller.
Definition: controller.h:45
u32 characters
Definition: ai.h:53
Holds all information about an AI.
Definition: ai.h:46
Represents a single move (string of timed inputs)
Definition: moves.h:23
size_t logicCapacity
Definition: ai.h:52
bool active
Definition: ai.h:56
void addMove(AI *ai, const Move *move)
Tell AI to execute a move.
Definition: ai.c:51
InputQueue inputQueue
Definition: ai.h:49
u32 port
Definition: ai.h:54
Logic * logicQueue
Definition: ai.h:50
Emulate a player&#39;s controller.
Defines structs for AI logic.
uint32_t u32
Definition: gctypes.h:16
void addLogic(AI *ai, const Logic *logic)
Add single logic rule to AI.
Definition: ai.c:34
size_t logicSize
Definition: ai.h:51
Queue inputs for a specific port.
Describes simple if-then logic.
Definition: logic.h:56
u32 opponent
Definition: ai.h:55