Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
party.c
Go to the documentation of this file.
1#include "engine/game.h"
2#include "field/field_map.h"
3
4/* The new game's player name, deck names, starter deck and partners */
5void initNewGameData(void) {
6 TextTools cls;
7 s32 i;
8 s32 j;
9 s16 *dst;
10 u16 *src;
11 DigimonData *e;
12
13 initTextTools(&cls);
15 GAME.party[0] = -1;
16 GAME.party[1] = -1;
17 GAME.party[2] = -1;
18 for (j = 0; j < DECK_COUNT; j++) {
20 }
22 for (i = 0; i < PARTNER_COUNT; i++) {
23 e = &DIGIMON_DATA[i];
28 /* the battle stats, then the resistances */
30 src = e->battleStats;
31 for (j = 0; j < 6; j++) {
32 *dst++ = *src++;
33 }
34 src = e->resistances;
35 for (j = 0; j < 7; j++) {
36 *dst++ = *src++;
37 }
38 }
39}
40
41/* The partner index of party member `index`, or -1 */
43 if (index >= PARTY_SIZE) {
44 return -1;
45 }
46 return GAME.party[index];
47}
48
49/* Gives the party STARTER_PARTIES[set], unlocking its partners */
50void setParty(s32 set) {
51 s32 i;
52 u8 partner;
53
54 for (i = 0; i < PARTY_SIZE; i++) {
55 partner = STARTER_PARTIES[set][i];
56 GAME.party[i] = partner;
57 GAME.partners[partner].unlocked = partner + 3;
58 }
59 GAME.partySet = set;
60}
61
62/* Gives `count` copies of a card (up to CARD_COPIES_MAX) and marks it seen */
63void addCards(s32 card, s32 count) {
64 GAME.cardsSeen[card] = 1;
65 GAME.cards[card] += count;
66 if (GAME.cards[card] > CARD_COPIES_MAX) {
68 }
69}
70
71/* Gives the starter deck's cards and puts them in every deck */
72void giveStarterDeck(void) {
73 s32 i;
74 s32 j;
75
76 for (i = 0; i < DECK_SIZE; i++) {
78 }
79 for (j = 0; j < DECK_COUNT; j++) {
80 for (i = 0; i < DECK_SIZE; i++) {
81 GAME.decks[j].cards[i] = STARTER_DECK[i];
82 }
83 }
84}
85
86/* setParty's partners, by starter pack */
88 { PARTNER_KOTEMON, PARTNER_RENAMON, PARTNER_PATAMON }, /* STARTER_PACK_BALANCED */
89 { PARTNER_MONMON, PARTNER_AGUMON, PARTNER_RENAMON }, /* STARTER_PACK_POWERFUL */
90 { PARTNER_KUMAMON, PARTNER_GUILMON, PARTNER_PATAMON }, /* STARTER_PACK_MANIAC */
91};
92
93/* The cards of giveStarterDeck's deck */
95 24, 24, 24, 45, 45, 50, 59, 60, 95, 99,
96 100, 100, 102, 122, 138, 141, 141, 143, 145, 181,
97 184, 185, 185, 188, 221, 224, 228, 230, 230, 230,
98 267, 268, 268, 270, 274, 303, 313, 314, 314, 314,
99};
signed int s32
Definition common.h:11
unsigned int u32
Definition common.h:12
signed short s16
Definition common.h:9
unsigned short u16
Definition common.h:10
unsigned char u8
Definition common.h:8
DigimonData DIGIMON_DATA[55]
55 entries: the 52 Digimon, then three placeholders (0x1D4-0x1D6)
Definition digimon.c:7
GameState GAME
The save data, the game mode and the methods.
Definition state.c:64
What the stage overlays and the executable use of FIELDSTG (fieldstg.h has the rest): its layers and ...
#define TEXT_CARD_SHOP
CRDSHP: STCRDSHP's, and STCRDDEK's.
Definition file.h:207
#define TEXT_NAME_ENTRY
NAMEDT: the keyboard's.
Definition file.h:219
#define TEXT_FILE(file)
Definition file.h:190
#define TEXT_DIGIMON_NAMES
DIGNAM.
Definition file.h:211
FileCache FILE_CACHE
The file cache.
Definition file_cache.c:7
char * strcpy(char *dst, const char *src)
#define STAT_STRENGTH
the six battle stats
Definition game_state.h:286
#define STAT_MP
Definition game_state.h:283
#define PARTY_SIZE
How many partners the party holds.
Definition game_state.h:475
#define STAT_MAX_HP
Definition game_state.h:282
#define DECK_COUNT
Definition game_state.h:262
#define STAT_HP
Definition game_state.h:281
#define DECK_SIZE
The cards of a deck, and the decks the player has.
Definition game_state.h:261
#define STAT_LEVEL
Indices of a partner's stats (PartnerStats.stats, computeStats, setStat)
Definition game_state.h:279
#define STAT_MAX_MP
Definition game_state.h:284
#define CARD_COPIES_MAX
The copies of a card the player can have.
Definition game_state.h:265
@ PARTNER_PATAMON
Definition game_state.h:471
@ PARTNER_KOTEMON
Definition game_state.h:464
@ PARTNER_GUILMON
Definition game_state.h:469
@ PARTNER_RENAMON
Definition game_state.h:470
@ PARTNER_AGUMON
Definition game_state.h:467
@ PARTNER_MONMON
Definition game_state.h:466
@ PARTNER_KUMAMON
Definition game_state.h:465
@ PARTNER_COUNT
Definition game_state.h:472
void addCards(s32 card, s32 count)
Gives count copies of a card (up to CARD_COPIES_MAX) and marks it seen.
Definition party.c:63
void giveStarterDeck(void)
Gives the starter deck's cards and puts them in every deck.
Definition party.c:72
u8 STARTER_PARTIES[][3]
setParty's partners, by starter pack
Definition party.c:87
s32 STARTER_DECK[40]
The cards of giveStarterDeck's deck.
Definition party.c:94
void initNewGameData(void)
The new game's player name, deck names, starter deck and partners.
Definition party.c:5
s32 getPartyMember(u32 index)
The partner index of party member index, or -1.
Definition party.c:42
void setParty(s32 set)
Gives the party STARTER_PARTIES[set], unlocking its partners.
Definition party.c:50
char name[0x16]
Definition game_state.h:274
s16 cards[40]
Definition game_state.h:275
Digimon definition (DIGIMON_DATA, 52 of them; the first 8 are the partners)
Definition game_state.h:86
u8 nameId
string in file 0x4F
Definition game_state.h:105
u16 battleStats[6]
Definition game_state.h:88
u16 resistances[7]
Definition game_state.h:89
void *(* load)(u32 file)
Definition file.h:92
void(* giveStarterDeck)(void)
Definition game_state.h:27
s8 cards[0x13D]
counts, up to CARD_COPIES_MAX
Definition game_state.h:514
char name[0x18]
the player's
Definition game_state.h:509
u8 cardsSeen[0x149]
Definition game_state.h:515
Deck decks[3]
Definition game_state.h:516
Partner partners[PARTNER_COUNT]
Definition game_state.h:517
s32 party[3]
partner indices
Definition game_state.h:511
s32 partySet
setParty's: the starter pack (enum StarterPack)
Definition game_state.h:519
GameFuncs funcs
Definition game_state.h:582
s16 stats[19]
Definition game_state.h:306
char name[0x18]
Definition game_state.h:304
PartnerStats info
Definition game_state.h:349
s32 unlocked
partner id + 3, 0 while locked
Definition game_state.h:347
Text helpers (initTextTools)
Definition text.h:93
char *(* getString)()
(table, index)
Definition text.h:94
void initTextTools(TextTools *obj)
Clears a text tools object, gives it its methods and binds it.
Definition text_tools.c:193