Skip to content
This repository has been archived by the owner on Dec 22, 2021. It is now read-only.

Commit

Permalink
Pilot struct cleanups and renames
Browse files Browse the repository at this point in the history
  • Loading branch information
katajakasa committed Sep 19, 2014
1 parent c1790e7 commit bcd583b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
12 changes: 7 additions & 5 deletions include/shadowdive/pilot.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ typedef struct {
uint8_t power; ///< Pilot power (1-25).
uint8_t agility; ///< Pilot agility (1-25).
uint8_t endurance; ///< Pilot endurance (1-25).
uint8_t unknown_stat; ///< Unknown. Maybe nothing ?
uint16_t offense; ///< Offense preference value (100 high, should be under 200).
uint16_t defense; ///< Defense preference value (100 high, should be under 200).
uint32_t money; ///< Amount of money the pilot currently has
Expand All @@ -63,7 +62,7 @@ typedef struct {
uint8_t difficulty; ///< Difficulty setting
char unk_block_b[2]; ///< Unknown
uint8_t movement; ///< Pilot can move in rankings
char unk_block_c[6]; ///< Unknown
uint16_t unk_block_c[3]; ///< Unknown
char enhancements[11]; ///< Har enchancements. A field for each HAR.

uint8_t secret; ///< This character is a secret character, and only comes out when requirements match
Expand All @@ -85,7 +84,7 @@ typedef struct {
uint8_t att_def; ///< More defensive
uint8_t att_sniper; ///< Tries to sneak in quick hits

char unk_block_d[6]; ///< Unknown
uint16_t unk_block_d[3]; ///< Unknown
int16_t ap_throw; ///< AI Preference for throw moves. Accepted value range (-400, 400).
int16_t ap_special; ///< AI Preference for special moves. Accepted value range (-400, 400).
int16_t ap_jump; ///< AI Preference for jump moves. Accepted value range (-400, 400).
Expand All @@ -98,10 +97,13 @@ typedef struct {
uint32_t unknown_e; ///< Unknown
float learning; ///< How actively this pilot learns your combat tactics. Accepted value range (0-15).
float forget; ///< How quickly this pilot forgets your combat tactics. Accepted value range (0-3).
char unk_block_f[24]; ///< Unknown
char unk_block_f[14]; ///< Unknown
uint16_t enemies_inc_unranked; ///< Enemies in current tournament, including unranked opponents
uint16_t enemies_ex_unranked; ///< Same as above, excluding unranked opponents.
char unk_block_g[6]; ///< Unknown.

uint16_t unk_d_a; ///< Unknown.
uint32_t unk_d_b; ///< Unknown.

uint32_t winnings; ///< Money made by winning opponents
uint32_t total_value; ///< Total value for the pilot
float unk_f_a; ///< Unknown
Expand Down
20 changes: 10 additions & 10 deletions src/pilot.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void sd_pilot_load_player_from_mem(sd_mreader *mr, sd_pilot *pilot) {
pilot->power = (stats_c >> 0) & 0x7F;
pilot->agility = (stats_c >> 7) & 0x7F;
pilot->endurance = (stats_d >> 0) & 0x7F;
pilot->unknown_stat = sd_mread_ubyte(mr);
sd_mskip(mr, 1);

pilot->offense = sd_mread_uword(mr);
pilot->defense = sd_mread_uword(mr);
Expand Down Expand Up @@ -65,7 +65,7 @@ void sd_pilot_load_from_mem(sd_mreader *mr, sd_pilot *pilot) {
pilot->difficulty = (sd_mread_ubyte(mr) >> 3) & 0x3; // 155-156
sd_mread_buf(mr, pilot->unk_block_b, 2);
pilot->movement = sd_mread_ubyte(mr);
sd_mread_buf(mr, pilot->unk_block_c, 6);
sd_mread_buf(mr, (char*)pilot->unk_block_c, 6);
sd_mread_buf(mr, pilot->enhancements, 11);

// Flags (3)
Expand Down Expand Up @@ -98,7 +98,7 @@ void sd_pilot_load_from_mem(sd_mreader *mr, sd_pilot *pilot) {
pilot->att_def = att[2] & 0x7F;
pilot->att_sniper = (att[2] >> 7) & 0x7F;

sd_mread_buf(mr, pilot->unk_block_d, 6);
sd_mread_buf(mr, (char*)pilot->unk_block_d, 6);

pilot->ap_throw = sd_mread_word(mr);
pilot->ap_special = sd_mread_word(mr);
Expand All @@ -116,10 +116,10 @@ void sd_pilot_load_from_mem(sd_mreader *mr, sd_pilot *pilot) {
sd_mread_buf(mr, pilot->unk_block_f, 14);
pilot->enemies_inc_unranked = sd_mread_uword(mr);
pilot->enemies_ex_unranked = sd_mread_uword(mr);
sd_mread_buf(mr, pilot->unk_block_g, 6);
pilot->unk_d_a = sd_mread_uword(mr);
pilot->unk_d_b = sd_mread_udword(mr);
pilot->winnings = sd_mread_udword(mr);
pilot->total_value = sd_mread_udword(mr);

pilot->unk_f_a = sd_mread_float(mr);
pilot->unk_f_b = sd_mread_float(mr);
sd_mskip(mr, 8);
Expand Down Expand Up @@ -165,7 +165,7 @@ void sd_pilot_save_player_to_mem(sd_mwriter *w, const sd_pilot *pilot) {
sd_mwrite_uword(w, stats_b);
sd_mwrite_uword(w, stats_c);
sd_mwrite_ubyte(w, stats_d);
sd_mwrite_ubyte(w, pilot->unknown_stat);
sd_mwrite_fill(w, 0, 1);

sd_mwrite_uword(w, pilot->offense);
sd_mwrite_uword(w, pilot->defense);
Expand Down Expand Up @@ -194,7 +194,7 @@ void sd_pilot_save_to_mem(sd_mwriter *w, const sd_pilot *pilot) {
sd_mwrite_ubyte(w, (pilot->difficulty & 0x3) << 3);
sd_mwrite_buf(w, pilot->unk_block_b, 2);
sd_mwrite_ubyte(w, pilot->movement);
sd_mwrite_buf(w, pilot->unk_block_c, 6);
sd_mwrite_buf(w, (char*)pilot->unk_block_c, 6);
sd_mwrite_buf(w, pilot->enhancements, 11);

// Flags
Expand Down Expand Up @@ -232,7 +232,7 @@ void sd_pilot_save_to_mem(sd_mwriter *w, const sd_pilot *pilot) {
att[2] |= (pilot->att_def & 0x7F);
sd_mwrite_buf(w, (char*)att, 6);

sd_mwrite_buf(w, pilot->unk_block_d, 6);
sd_mwrite_buf(w, (char*)pilot->unk_block_d, 6);

sd_mwrite_word(w, pilot->ap_throw);
sd_mwrite_word(w, pilot->ap_special);
Expand All @@ -250,10 +250,10 @@ void sd_pilot_save_to_mem(sd_mwriter *w, const sd_pilot *pilot) {
sd_mwrite_buf(w, pilot->unk_block_f, 14);
sd_mwrite_uword(w, pilot->enemies_inc_unranked);
sd_mwrite_uword(w, pilot->enemies_ex_unranked);
sd_mwrite_buf(w, pilot->unk_block_g, 6);
sd_mwrite_uword(w, pilot->unk_d_a);
sd_mwrite_udword(w, pilot->unk_d_b);
sd_mwrite_udword(w, pilot->winnings);
sd_mwrite_udword(w, pilot->total_value);

sd_mwrite_float(w, pilot->unk_f_a);
sd_mwrite_float(w, pilot->unk_f_b);
sd_mwrite_fill(w, 0, 8);
Expand Down

0 comments on commit bcd583b

Please sign in to comment.