aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2024-03-11 22:57:55 -0400
committerB. Stack <bgstack15@gmail.com>2024-03-11 22:57:55 -0400
commita3875b4300d017773f67def3045d08dd51cf59d2 (patch)
tree9ede79962666631c067dc40146c57eb815bfe67a
parentadd get/set plane stats (diff)
downloadsrb_lib-a3875b4300d017773f67def3045d08dd51cf59d2.tar.gz
srb_lib-a3875b4300d017773f67def3045d08dd51cf59d2.tar.bz2
srb_lib-a3875b4300d017773f67def3045d08dd51cf59d2.zip
progress for day
-rw-r--r--.gitignore1
-rw-r--r--srb_lib.py28
2 files changed, 19 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index 0f71379..ea568cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
__pycache__
*.new
.*.swp
+tmp.*
diff --git a/srb_lib.py b/srb_lib.py
index 192fc22..9e82ca4 100644
--- a/srb_lib.py
+++ b/srb_lib.py
@@ -71,10 +71,13 @@ LEVELSETS = [
]
# relative to player profile
-POS_LEVEL_START = 0x2D8
+POS_LEVEL_START = 0x2D4
+POS_INCOMPLETE_BALLOON_START = POS_LEVEL_START + 0x1E0
+# WORKHERE: put the POS relative balloon start on each levelset.
+# level 0 balloon count is in 0x1E0 but there's an extra (8*setid) bytes and which balloons are taken is stored 0x1E4 (2 bytes, little-endian)
# each level position is POS_LEVEL_START + (4*level["pos_r"])
# the relative position is because each level set gets 7 (or 6 plus 1 blank) slots, but not all levelsets have 6 levels.
-# WORKHERE 2024-03-11-2 19:29 porifle 3 replay mission 0, get the letter and maybe a few more balloons?
+#
LEVELS = [
{"id":0, "pos_r":0, "setid":0,"name":"Defend Island"},
{"id":1, "pos_r":1, "setid":0,"name":"Recover Plans"},
@@ -103,13 +106,17 @@ LEVELS = [
# hex values
# WOKRHERE: profile 2 level statuses are off somehow?! they are 4 bytes closer to front than the calculation shows.
LEVEL_STATUSES = {
- "59": "all-balloons,all-letters,sergeant",
- "5B": "all-balloons,all-letters,colonel",
- "5D": "all-balloons,all-letters,colonel",
- "60": "all-balloons,all-letters,colonel",
- "62": "all-balloons,all-letters,colonel",
- "63": "all-balloons,all-letters,colonel",
- "64": "all-balloons,all-letters,general"
+ "4A": "3-balloons,no-letters,under-time,good-health,corporal",
+ "47": "2-balloons,no-letters,under-time,good-health,orporal",
+ "59": "all-balloons,all-letters,under-time,good-health,sergeant",
+ "5B": "all-balloons,all-letters,under-time,good-health,colonel",
+ "5B": "9-balloons,no-letter,under-time,good-health,colonel",
+ "5D": "all-balloons,all-letters,under-time,good-health,colonel",
+ "5E": "all-balloons,no-letter,under-time,good-health,colonel",
+ "60": "all-balloons,all-letters,under-time,good-health,colonel",
+ "62": "all-balloons,all-letters,under-time,good-health,colonel",
+ "63": "all-balloons,all-letters,under-time,good-health,colonel",
+ "64": "all-balloons,all-letters,under-time,good-health,general"
}
POS_TUTORIAL_COMPLETED = 0x2D0 # bool
@@ -317,7 +324,8 @@ def get_level_status(data_object,profile_id,level):
ferror(f"Unable to get level status for {level}.")
print(f"Debug: got level_obj {level_obj} and message {message}")
profile_level_status = data[PROFILE_START_POSITION[profile_id]+POS_LEVEL_START+(4*level_obj["pos_r"])]
- print(f"Debug: got level status {profile_level_status:x} at pos 0x{PROFILE_START_POSITION[profile_id]+POS_LEVEL_START+(4*level_obj['pos_r'])}")
+ profile_level_balloon_status = data[PROFILE_START_POSITION[profile_id]+POS_INCOMPLETE_BALLOON_START+(4*level_obj["pos_r"])]
+ print(f"Debug: got level status {profile_level_status:x} at pos 0x{profile_level_status:x} and balloon status 0x{profile_level_balloon_status:x}")
# it comes back as an int, but does it look better as a hex?
return hex(profile_level_status)
bgstack15