forked from pret/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotes_pokeemerald.txt
94 lines (57 loc) · 3.66 KB
/
notes_pokeemerald.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
GetPokemonSpriteToDisplay function in pokedex.c
battle_setup.c StartRegiBattle
main.h has gMain and Main
CB2_EndSafariBattle(void) i safari_zone.c
BATTLE_TYPE_SAFARI sökning i Clion ger mycket intressanta grejor
battle_util.c verkar ha intressanta funktioner för battles (eg HandleFaintedMonActions)
den har också extern const gBattlescriptsForSafariActions[]
battle_interface.c battle_gfx_sfx_util.c intressant
gBattleTypeFlags intressant
battle_scripts_2.s intressant
battle_main
battle_scripts_2.s och battle_util.c har nog allt
battle.h Window Ids for sStandardBattleWindowTemplates / sBattleArenaWindowTemplates
battle_controller_player.c
static void PlayerHandleChooseAction(void)
battle_bg.c
battle_controller_safari.c är npg nyckeln
-----STRUKTUR FÖR BATTLE------
battle_controller_player.c har HandleInputChooseAction(void) där ens battle choice väljs.
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, 0); körs om FIGHT väljs.
Det verkar som det leder till battle_main.c static void (* const sTurnActionsFuncsTable[])(void) =
{
[B_ACTION_USE_MOVE] = HandleAction_UseMove,
Det verkar leda till battle_util.c med en funktion HandleAction_UseMove (jag har lagt till HandleAction_HarryMove)
dowildbattle i mapscripts är starten av encounters, ScrCmd_dowildbattle(struct ScriptContext *ctx) är i scrcmd.c
i battle_setup.c, gMain.savedCallback = CB2_EndScriptedWildBattle;
gBattleTypeFlags = 0;
CreateBattleStartTask(GetWildBattleTransition(), 0); MÅSTE vara nyckeln, specifikt createbattlestarttask, CB2_InitBattle battle_main.c
------------END BATTLE SEQUENCE-------
dowildbattle, setwildbattle
battle_setup.c har DoHarryBattle grej look at it
i battle_setup.c, har gBattleTypeFlags en influens över hur battlen blir påverkad?
battle_setup.c, CreateBattleStartTask() har u8 taskId = CreateTask(Task_BattleStart, 1); kan vara något
kolla på battle_controller_safari.c, nyckeln till att göra egen battle instance
i battle_controller_harry.c så har vi HandleInputChooseAction() som har PlayerBufferExecCompleted()
#define FLAG_UNUSED_0x88E (SYSTEM_FLAGS + 0x2E) // Unused Flag will be used for HarryBattle
(i flags.h)
BattleSetup_StartScriptedWildBattle är nog vad jag ska använda o hämta flagga i
CB2_HandleStartBattle där har vi den (battle_main.c)
CB2_InitBattleInternal in battle_main.c
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED)))
{
CreateNPCTrainerParty(&gEnemyParty[0], gTrainerBattleOpponent_A, TRUE);
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
CreateNPCTrainerParty(&gEnemyParty[PARTY_SIZE / 2], gTrainerBattleOpponent_B, FALSE);
SetWildMonHeldItem();
för att reverta, sök PUNG i filerna
piss mechanic
Yeah they're just regular functions that take no arguments. Write your function, put it in this table: https://github.com/pret/pokeemerald/blob/master/data/script_cmd_table.inc and then write a macro for it in asm/macros/event.inc. The first .byte of the macro is the index into that table
Seti — Today at 23:09
ah ok! thanks!
GriffinR — Today at 23:10
You can take a look at the existing functions in scrcmd.c to see how they read additional script data to take arguments indirectly
Also if it's something you're only going to use once or twice, you should skip all of that. Just write your function and do callnative YourFunctionName in a script
does anyone know how the games map scripts work btw? They sure dont look like C code at least
GriffinR — 22/11/2022 00:38
They're data hidden away by assembly macros. They're interpreted by the C code in script.c to call functions in scrcmd.c