jak3: add discord rpc and fix some decomp (#3500)

This commit is contained in:
Hat Kid 2024-05-01 13:49:26 +02:00 committed by GitHub
parent 5705359df9
commit 3ff3760621
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 3739 additions and 968 deletions

View file

@ -7599,7 +7599,7 @@
)
(deftype level-load-info (basic)
((name-list symbol 6 :offset-assert 4) ;; guessed by decompiler
((name-list symbol 6 :offset-assert 4 :score -1) ;; guessed by decompiler
(name symbol :offset 4) ;; guessed by decompiler
(visname symbol :offset 8) ;; guessed by decompiler
(nickname symbol :offset 12) ;; guessed by decompiler
@ -10004,6 +10004,10 @@
(credits-08b4 #x08b4)
(credits-08b5 #x08b5)
(credits-08b6 #x08b6)
;; PC port IDs START
(discord-rpc-not-in-mission #x1200)
(discord-rpc-in-side-mission #x1201)
)
;; ---text-h:text-id
@ -13238,6 +13242,13 @@
)
;; ---traffic-h:vehicle-type
;; +++traffic-h:vehicle-type-u8
(defenum vehicle-type-u8
:type uint8
:copy-entries vehicle-type
)
;; ---traffic-h:vehicle-type-u8
(deftype traffic-danger-info (structure)
((sphere sphere :inline :offset-assert 0)
(velocity vector :inline :offset-assert 16)
@ -17272,7 +17283,7 @@
(dust-storm handle :offset-assert 768)
(flut-count int32 :offset-assert 776)
(death-resetter resetter-spec :inline :offset-assert 780)
(current-vehicle game-vehicle-u8 :offset-assert 796)
(current-vehicle vehicle-type-u8 :offset-assert 796)
(vehicle-turbo-ready float :offset-assert 800)
(percent-complete float :offset-assert 804)
)
@ -53385,13 +53396,6 @@
)
)
;; +++vehicle-h:vehicle-type-u8
(defenum vehicle-type-u8
:type uint8
:copy-entries vehicle-type
)
;; ---vehicle-h:vehicle-type-u8
(deftype rigid-body-vehicle-constants (rigid-body-object-constants)
((flags uint32 :offset-assert 208)
(object-type uint8 :offset-assert 212)
@ -58396,8 +58400,8 @@
)
)
(define-extern have-earned-vehicle-v-type? (function int symbol))
(define-extern have-vehicle-v-type? (function int symbol))
(define-extern have-earned-vehicle-v-type? (function vehicle-type symbol))
(define-extern have-vehicle-v-type? (function vehicle-type symbol))
(define-extern kill-player-process-init-by-other (function process symbol object :behavior kill-player-process))
(define-extern kill-player-process-spawn (function process process symbol kill-player-process))
@ -73234,7 +73238,7 @@
)
(deftype prebot-gun-shot (projectile)
((whoosh-sound uint32 :offset-assert 512)
((whoosh-sound sound-id :offset-assert 512)
)
:method-count-assert 41
:size-assert #x204

View file

@ -28,13 +28,13 @@
"DGO/WCB.DGO",
"DGO/WCASEEM.DGO",
"DGO/WASCAST.DGO",
// // arena
// arena
"DGO/WASSTADA.DGO",
"DGO/WASSTADB.DGO",
"DGO/WASSTADC.DGO",
"DGO/ARENACST.DGO",
// // desert
// "DGO/DESA.DGO",
// desert
"DGO/DESA.DGO",
"DGO/DESB.DGO",
"DGO/DESBATTL.DGO",
// "DGO/DESBCST.DGO",
@ -90,32 +90,32 @@
"DGO/MINEE.DGO",
// city
"DGO/CWI.DGO", // ctywide
// "DGO/CFA.DGO", // ctyfarm
// "DGO/CFB.DGO",
// "DGO/CGB.DGO", // ctygen
// "DGO/CIA.DGO", // ctyind
// "DGO/CIB.DGO",
// "DGO/CPO.DGO", // ctyport
// "DGO/CTA.DGO", // ctyslum
// "DGO/CTB.DGO",
// "DGO/CTC.DGO",
// "DGO/CTYPEPA.DGO", // citizens
// "DGO/CTYPEPB.DGO", // predator
// "DGO/CTYPEPC.DGO", // empty
// "DGO/CTYPESA.DGO", // guards
// "DGO/CTYPESB.DGO", // metal heads
// "DGO/CTYPESC.DGO", // kg
// "DGO/CTYCARA.DGO", // cars
// "DGO/CTYCARB.DGO", // bikes
// "DGO/CTYCARC.DGO", // hellcat
// "DGO/CTYCARKG.DGO", // empty
// "DGO/ONINTENT.DGO",
// "DGO/VIN.DGO",
// "DGO/HHG.DGO", // hiphog
// "DGO/GGA.DGO", // gungame
// "DGO/GUNGAME1.DGO",
// "DGO/GUNGAME2.DGO",
// "DGO/POWERGD.DGO",
"DGO/CFA.DGO", // ctyfarm
"DGO/CFB.DGO",
"DGO/CGB.DGO", // ctygen
"DGO/CIA.DGO", // ctyind
"DGO/CIB.DGO",
"DGO/CPO.DGO", // ctyport
"DGO/CTA.DGO", // ctyslum
"DGO/CTB.DGO",
"DGO/CTC.DGO",
"DGO/CTYPEPA.DGO", // citizens
"DGO/CTYPEPB.DGO", // predator
"DGO/CTYPEPC.DGO", // empty
"DGO/CTYPESA.DGO", // guards
"DGO/CTYPESB.DGO", // metal heads
"DGO/CTYPESC.DGO", // kg
"DGO/CTYCARA.DGO", // cars
"DGO/CTYCARB.DGO", // bikes
"DGO/CTYCARC.DGO", // hellcat
"DGO/CTYCARKG.DGO", // empty
"DGO/ONINTENT.DGO",
"DGO/VIN.DGO",
"DGO/HHG.DGO", // hiphog
"DGO/GGA.DGO", // gungame
"DGO/GUNGAME1.DGO",
"DGO/GUNGAME2.DGO",
"DGO/POWERGD.DGO",
"DGO/FREEHQ.DGO",
// "DGO/FREECAST.DGO",
// "DGO/CITYCAST.DGO",
@ -123,20 +123,20 @@
// "DGO/SLUMBSET.DGO", // sewer-met-hum-intro
// sewer
"DGO/SEA.DGO",
// "DGO/SEB.DGO",
// "DGO/SEC.DGO",
// "DGO/SED.DGO",
// "DGO/SEE.DGO",
// "DGO/SEF.DGO",
// "DGO/SEG.DGO",
// "DGO/SEH.DGO",
// "DGO/SEI.DGO",
// "DGO/SEJ.DGO",
// "DGO/SEK.DGO",
// "DGO/SEL.DGO",
// "DGO/SEM.DGO",
// "DGO/SEN.DGO",
// "DGO/SEO.DGO",
"DGO/SEB.DGO",
"DGO/SEC.DGO",
"DGO/SED.DGO",
"DGO/SEE.DGO",
"DGO/SEF.DGO",
"DGO/SEG.DGO",
"DGO/SEH.DGO",
"DGO/SEI.DGO",
"DGO/SEJ.DGO",
"DGO/SEK.DGO",
"DGO/SEL.DGO",
"DGO/SEM.DGO",
"DGO/SEN.DGO",
"DGO/SEO.DGO",
// mhcity
"DGO/MHCA.DGO",
"DGO/MHCB.DGO",
@ -159,28 +159,28 @@
"DGO/STA.DGO",
"DGO/STAA.DGO",
"DGO/STB.DGO",
// // rubble
// "DGO/RUBA.DGO",
// "DGO/RUBA2.DGO",
// "DGO/RUBB.DGO",
// "DGO/RUBC.DGO",
// "DGO/RBCT.DGO",
// rubble
"DGO/RUBA.DGO",
"DGO/RUBA2.DGO",
"DGO/RUBB.DGO",
"DGO/RUBC.DGO",
"DGO/RBCT.DGO",
// comb
"DGO/COMBA.DGO",
// "DGO/COMBB.DGO",
// "DGO/COMBC.DGO",
// "DGO/COMBD.DGO",
// "DGO/COMBE.DGO",
// "DGO/COMBN.DGO",
"DGO/COMBB.DGO",
"DGO/COMBC.DGO",
"DGO/COMBD.DGO",
"DGO/COMBE.DGO",
"DGO/COMBN.DGO",
"DGO/COMBX.DGO",
"DGO/RAILA.DGO",
// "DGO/RAILB.DGO",
// "DGO/RAILB2.DGO",
// "DGO/RAILC.DGO",
// "DGO/RAILCST.DGO",
// "DGO/RAILD.DGO",
// "DGO/RAILE.DGO",
// "DGO/RAILF.DGO",
"DGO/RAILB.DGO",
"DGO/RAILB2.DGO",
"DGO/RAILC.DGO",
"DGO/RAILCST.DGO",
"DGO/RAILD.DGO",
"DGO/RAILE.DGO",
"DGO/RAILF.DGO",
"DGO/RAILX.DGO",
// // precursor
// "DGO/PRECA.DGO",
@ -224,7 +224,7 @@
"DGO/LBBTCHA1.DGO",
"DGO/LBBTCHA2.DGO",
"DGO/LBBTCHA3.DGO",
// "DGO/LBIPED.DGO",
"DGO/LBIPED.DGO",
// "DGO/LBLOWCST.DGO",
// "DGO/LBLOWTKG.DGO",
// "DGO/LBLOWTMH.DGO",
@ -242,7 +242,7 @@
// "DGO/LDAMPECK.DGO",
// "DGO/LDAMPKSM.DGO",
// "DGO/LDAMSIG.DGO",
// "DGO/LDAX.DGO",
"DGO/LDAX.DGO",
// "DGO/LDESGCST.DGO",
// "DGO/LDMPCKGN.DGO",
// "DGO/LERROL.DGO",
@ -259,23 +259,23 @@
"DGO/LFREEOUT.DGO",
// "DGO/LGUNNORM.DGO",
// "DGO/LGUNRNC.DGO",
// "DGO/LJAK.DGO",
// "DGO/LJAKC.DGO",
// "DGO/LJAKCKLV.DGO",
// "DGO/LJAKKLEV.DGO",
// "DGO/LJAKNDAX.DGO",
// "DGO/LJAKSIG.DGO",
"DGO/LJAK.DGO",
"DGO/LJAKC.DGO",
"DGO/LJAKCKLV.DGO",
"DGO/LJAKKLEV.DGO",
"DGO/LJAKNDAX.DGO",
"DGO/LJAKSIG.DGO",
// "DGO/LJINX.DGO",
// "DGO/LJKCDMKL.DGO",
// "DGO/LJKDMPK.DGO",
// "DGO/LJKDXVIN.DGO",
// "DGO/LJKFEET.DGO",
"DGO/LJKFEET.DGO",
// "DGO/LJNDKLEV.DGO",
// "DGO/LKEIRA.DGO",
"DGO/LKLEEVER.DGO",
"DGO/LMECH.DGO",
// "DGO/LMHCA.DGO",
// "DGO/LMHCB.DGO",
"DGO/LMHCA.DGO",
"DGO/LMHCB.DGO",
"DGO/LNSTCST.DGO",
"DGO/LNSTOA.DGO",
"DGO/LNSTOBB.DGO",
@ -290,11 +290,11 @@
// "DGO/LPRENME.DGO",
// "DGO/LPTRL.DGO",
// "DGO/LSAMOS.DGO",
// "DGO/LSEEMWCA.DGO",
// "DGO/LSIG.DGO",
// "DGO/LSIGJAKC.DGO",
// "DGO/LSIGKLV.DGO",
// "DGO/LSNKWHLS.DGO",
"DGO/LSEEMWCA.DGO",
"DGO/LSIG.DGO",
"DGO/LSIGJAKC.DGO",
"DGO/LSIGKLV.DGO",
"DGO/LSNKWHLS.DGO",
// "DGO/LTNFXHIP.DGO",
// "DGO/LTNJXHIP.DGO",
"DGO/LTORN.DGO",
@ -302,8 +302,8 @@
// "DGO/LTORNSAM.DGO",
"DGO/LTOWA.DGO",
"DGO/LTOWB.DGO",
// "DGO/LTOWCITY.DGO",
// "DGO/LTRTWHLS.DGO",
"DGO/LTOWCITY.DGO",
"DGO/LTRTWHLS.DGO",
// "DGO/LVINCST.DGO",
"DGO/LWASBBV.DGO",
"DGO/LWASSIG.DGO",

View file

@ -25,6 +25,7 @@ endif()
set(RUNTIME_SOURCE
external/discord_jak1.cpp
external/discord_jak2.cpp
external/discord_jak3.cpp
external/discord.cpp
graphics/display.cpp
graphics/gfx_test.cpp

View file

@ -10,9 +10,9 @@
;; NOTE : we compile using the fixed v2 encoding because it's what we use.
(file "$DECOMP/assets/game_text.txt") ;; this is the decompiler-generated file!
;; add custom files down here
(file-json 0 jak2 "common" '("game/assets/jak3/text/game_custom_text_en-US.json"))
(file-json 5 jak2 "common" '("game/assets/jak3/text/game_custom_text_ja-JP.json"))
(file-json 7 jak2 "common" '("game/assets/jak3/text/game_custom_text_en-GB.json"))
(file-json 0 jak3 "common" '("game/assets/jak3/text/game_custom_text_en-US.json"))
(file-json 6 jak3 "common" '("game/assets/jak3/text/game_custom_text_ja-JP.json"))
(file-json 11 jak3 "common" '("game/assets/jak3/text/game_custom_text_en-GB.json"))
)

View file

@ -1,2 +1,4 @@
{
"1200": "Not in a mission",
"1201": "Playing a bonus mission"
}

View file

@ -7,6 +7,7 @@
#include "common/log/log.h"
#include "discord_jak3.h"
#include "game/runtime.h"
int gDiscordRpcEnabled;
@ -14,7 +15,8 @@ int64_t gStartTime;
static const std::map<GameVersion, std::string> rpc_client_ids = {
{GameVersion::Jak1, "938876425585434654"},
{GameVersion::Jak2, "1060390251694149703"}};
{GameVersion::Jak2, "1060390251694149703"},
{GameVersion::Jak3, "1226307413355790416"}};
void handleDiscordReady(const DiscordUser* user) {
lg::info("Discord: connected to user {}#{} - {}", user->username, user->discriminator,
@ -34,10 +36,14 @@ void handleDiscordJoinRequest(const DiscordUser* /*request*/) {}
void handleDiscordSpectate(const char* /*secret*/) {}
void init_discord_rpc() {
if (g_game_version != GameVersion::Jak1 && g_game_version != GameVersion::Jak2) {
if (g_game_version != GameVersion::Jak1 && g_game_version != GameVersion::Jak2 &&
g_game_version != GameVersion::Jak3) {
lg::error("Game version unsupported for Discord RPC - {}", fmt::underlying(g_game_version));
return;
}
if (g_game_version == GameVersion::Jak3) {
jak3::remap_hack();
}
gDiscordRpcEnabled = 1;
DiscordEventHandlers handlers;
memset(&handlers, 0, sizeof(handlers));

81
game/external/discord_jak3.cpp vendored Normal file
View file

@ -0,0 +1,81 @@
#include "discord_jak3.h"
namespace jak3 {
const std::map<std::string, std::string> level_names = {
{"intro", "Intro"},
{"title", "Title screen"},
{"wascity", "Spargus City"},
{"waspala", "Wasteland Palace"},
{"wasstad", "Arena of Death"},
{"wasdoors", "Spargus City (Garage)"},
{"desert", "Wasteland"},
{"hang", "Wasteland (Glider)"},
{"temple", "Monk Temple"},
{"mine", "Eco Mine"},
{"comb", "Catacombs"},
{"rail", "Catacombs"},
{"nst", "Metal Head Nest"},
{"factory", "KG War Factory"},
{"ctyslum", "New Haven"},
{"precur", "Dark Maker Ship"},
{"volcano", "Great Volcano"},
{"ctyport", "Haven City (Port)"},
{"ctyind", "Haven City (Industrial Zone)"},
{"ctygen", "Haven City (Main Town)"},
{"stadium", "Stadium Ruins"},
{"rubble", "Stadium Ruins"},
{"vinroom", "Power Station"},
{"onintent", "Onin's Tent"},
{"freehq", "Freedom HQ"},
{"hiphog", "Naughty Ottsel"},
{"gungame", "Gun Course"},
{"sew", "Sewer"},
{"forest", "Haven Forest"},
};
// for remapping sub-level names to the matching one in level_names
std::map<std::string, std::string> level_name_remap = {
{"introcst", "intro"}, {"templex", "temple"}, {"combx", "comb"}, {"volcanox", "volcano"},
{"railx", "rail"}, {"railb2", "rail"}, {"rubblea2", "rubble"}, {"wasstada", "wasstad"},
};
const std::map<std::string, std::pair<char, char>> level_remap_hack = {
{"forest", {'a', 'b'}}, {"factory", {'a', 'd'}}, {"stadium", {'a', 'b'}},
{"hang", {'a', 'b'}}, {"wascity", {'a', 'b'}}, {"nst", {'a', 'b'}},
{"mhcity", {'a', 'b'}}, {"sew", {'a', 'o'}}, {"comb", {'a', 'n'}},
{"rail", {'a', 'e'}}, {"desert", {'a', 'h'}}, {"temple", {'a', 'd'}},
{"ctygen", {'a', 'c'}}, {"ctyind", {'a', 'b'}}, {"ctyslum", {'a', 'c'}},
{"mine", {'a', 'e'}}, {"rubble", {'a', 'c'}}, {"precur", {'a', 'd'}},
};
void remap_hack() {
for (auto& name : level_remap_hack) {
auto base_name = name.first;
auto suffix_start = name.second.first;
auto suffix_end = name.second.second;
for (int i = 0; i < suffix_end - suffix_start; i++) {
auto suffix = static_cast<char>(suffix_start + i);
std::string level(base_name);
level.push_back(suffix);
level_name_remap.insert(std::make_pair(level, base_name));
}
}
}
// levels that are not affected by time of day
const std::vector<std::string> indoor_levels = {
"intro", "introcst", "title", "sew", "gungame", "precur", "hideout",
"vinroom", "onintent", "hiphog", "nst", "comb", "rail", "freehq",
};
// time of day string to append to level name for icons
const char* time_of_day_str(float time) {
int hour = static_cast<int>(time);
if (hour > 6 && hour < 19) {
return "day";
} else {
return "night";
}
}
} // namespace jak3

11
game/external/discord_jak3.h vendored Normal file
View file

@ -0,0 +1,11 @@
#pragma once
#include "discord.h"
namespace jak3 {
extern const std::map<std::string, std::string> level_names;
extern std::map<std::string, std::string> level_name_remap;
void remap_hack();
extern const std::vector<std::string> indoor_levels;
const char* time_of_day_str(float time);
} // namespace jak3

View file

@ -373,7 +373,7 @@ void InitMachine_PCPort() {
make_function_symbol_from_c("pc-encode-utf8-string", (void*)kmachine_extras::encode_utf8_string);
// discord rich presence
// make_function_symbol_from_c("pc-discord-rpc-update", (void*)update_discord_rpc);
make_function_symbol_from_c("pc-discord-rpc-update", (void*)kmachine_extras::update_discord_rpc);
// debugging tools
// make_function_symbol_from_c("alloc-vagdir-names", (void*)alloc_vagdir_names);

View file

@ -8,12 +8,140 @@
#include "common/symbols.h"
#include "common/util/FontUtils.h"
#include "game/external/discord_jak3.h"
#include "game/kernel/common/Symbol4.h"
#include "game/kernel/common/kmachine.h"
#include "game/kernel/common/kscheme.h"
namespace jak3 {
namespace kmachine_extras {
using namespace jak3;
void update_discord_rpc(u32 discord_info) {
if (gDiscordRpcEnabled) {
DiscordRichPresence rpc;
char state[128];
char large_image_key[128];
char large_image_text[128];
char small_image_key[128];
char small_image_text[128];
auto info = discord_info ? Ptr<DiscordInfo>(discord_info).c() : NULL;
if (info) {
// Get the data from GOAL
int orbs = (int)info->orb_count;
int gems = (int)info->gem_count;
// convert encodings
std::string status = get_font_bank(GameTextVersion::JAK3)
->convert_game_to_utf8(Ptr<String>(info->status).c()->data());
// get rid of special encodings like <COLOR_WHITE>
std::regex r("<.*?>");
while (std::regex_search(status, r)) {
status = std::regex_replace(status, r, "");
}
char* level = Ptr<String>(info->level).c()->data();
auto cutscene = Ptr<Symbol4<u32>>(info->cutscene)->value();
float time = info->time_of_day;
float percent_completed = info->percent_completed;
std::bitset<64> focus_status = info->focus_status;
auto vehicle = static_cast<VehicleType>(info->current_vehicle);
char* task = Ptr<String>(info->task).c()->data();
// Construct the DiscordRPC Object
const char* full_level_name =
get_full_level_name(level_names, level_name_remap, Ptr<String>(info->level).c()->data());
memset(&rpc, 0, sizeof(rpc));
// if we have an active task, set the mission specific image for it
if (strcmp(task, "unknown") != 0) {
strcpy(large_image_key, task);
} else {
// if we are in an outdoors level, use the picture for the corresponding time of day
if (!indoors(indoor_levels, level)) {
char level_with_tod[128];
strcpy(level_with_tod, level);
strcat(level_with_tod, "-");
strcat(level_with_tod, time_of_day_str(time));
strcpy(large_image_key, level_with_tod);
} else {
strcpy(large_image_key, level);
}
}
strcpy(large_image_text, full_level_name);
if (!strcmp(full_level_name, "unknown")) {
strcpy(large_image_key, full_level_name);
strcpy(large_image_text, level);
}
rpc.largeImageKey = large_image_key;
if (cutscene != offset_of_s7()) {
strcpy(state, "Watching a cutscene");
// temporarily move these counters to the large image tooltip during a cutscene
strcat(large_image_text,
fmt::format(" | {:.0f}% | Orbs: {} | Gems: {} | {}", percent_completed,
std::to_string(orbs), std::to_string(gems), get_time_of_day(time))
.c_str());
} else {
strcpy(state, fmt::format("{:.0f}% | Orbs: {} | Gems: {} | {}", percent_completed,
std::to_string(orbs), std::to_string(gems), get_time_of_day(time))
.c_str());
}
rpc.largeImageText = large_image_text;
rpc.state = state;
// check for any special conditions to display for the small image
if (FOCUS_TEST(focus_status, FocusStatus::Board)) {
strcpy(small_image_key, "focus-status-board");
strcpy(small_image_text, "On the JET-Board");
} else if (FOCUS_TEST(focus_status, FocusStatus::Mech)) {
strcpy(small_image_key, "focus-status-mech");
strcpy(small_image_text, "Controlling a Dark Maker bot");
} else if (FOCUS_TEST(focus_status, FocusStatus::Pilot)) {
// TODO vehicle images
strcpy(small_image_key, "focus-status-pilot");
auto vehicle_name = VehicleTypeToString(vehicle);
if (!strcmp(task, "comb-travel") || !strcmp(task, "comb-wild-ride")) {
strcpy(small_image_text, "Driving the Catacombs Rail Rider");
} else if (!strcmp(task, "desert-glide")) {
strcpy(small_image_text, "Flying the Glider");
} else if (!strcmp(task, "factory-sky-battle")) {
strcpy(small_image_text, "Flying the Hellcat");
} else {
if (vehicle_name != "Unknown") {
strcpy(small_image_text, fmt::format("Driving the {}", vehicle_name).c_str());
} else {
strcpy(small_image_key, "");
strcpy(small_image_text, "");
}
}
} else if (FOCUS_TEST(focus_status, FocusStatus::Indax)) {
strcpy(small_image_key, "focus-status-indax");
strcpy(small_image_text, "Playing as Daxter");
} else if (FOCUS_TEST(focus_status, FocusStatus::Dark)) {
strcpy(small_image_key, "focus-status-dark");
strcpy(small_image_text, "Dark Jak");
} else if (FOCUS_TEST(focus_status, FocusStatus::Light)) {
strcpy(small_image_key, "focus-status-light");
strcpy(small_image_text, "Light Jak");
} else if (FOCUS_TEST(focus_status, FocusStatus::Turret)) {
strcpy(small_image_key, "focus-status-turret");
strcpy(small_image_text, "In a Gunpod");
} else if (FOCUS_TEST(focus_status, FocusStatus::Gun)) {
strcpy(small_image_key, "focus-status-gun");
strcpy(small_image_text, "Using a Gun");
} else {
strcpy(small_image_key, "");
strcpy(small_image_text, "");
}
rpc.smallImageKey = small_image_key;
rpc.smallImageText = small_image_text;
rpc.startTimestamp = gStartTime;
rpc.details = status.c_str();
rpc.partySize = 0;
rpc.partyMax = 0;
Discord_UpdatePresence(&rpc);
}
} else {
Discord_ClearPresence();
}
}
void pc_set_levels(u32 lev_list) {
if (!Gfx::GetCurrentRenderer()) {
@ -63,3 +191,4 @@ void encode_utf8_string(u32 src_str_ptr, u32 str_dest_ptr) {
}
} // namespace kmachine_extras
} // namespace jak3

View file

@ -5,7 +5,9 @@
#include "common/common_types.h"
#include "common/util/json_util.h"
namespace jak3 {
namespace kmachine_extras {
void update_discord_rpc(u32 discord_info);
void pc_set_levels(u32 lev_list);
void pc_set_active_levels(u32 lev_list);
u32 alloc_vagdir_names(u32 heap_sym);
@ -13,4 +15,103 @@ inline u64 bool_to_symbol(const bool val);
// TODO - move to common
void encode_utf8_string(u32 src_str_ptr, u32 str_dest_ptr);
struct DiscordInfo {
float orb_count; // float
float gem_count; // float
s32 death_count; // int32
u32 status; // string
u32 level; // string
u32 cutscene; // symbol - bool
float time_of_day; // float
float percent_completed; // float
u64 focus_status; // uint64
s32 current_vehicle; // int32
u32 task; // string
};
enum class VehicleType : s32 {
h_bike_a = 0,
h_bike_b = 1,
h_bike_c = 2,
h_car_a = 3,
h_car_b = 4,
h_car_c = 5,
h_bike_d = 6,
h_hellcat = 7,
h_warf = 8,
h_glider = 9,
h_sled = 10,
h_kg_pickup = 11,
v_turtle = 12,
v_snake = 13,
v_scorpion = 14,
v_toad = 15,
v_fox = 16,
v_rhino = 17,
v_mirage = 18,
v_x_ride = 19,
v_marauder = 20,
v_faccar = 21,
v_catapult = 22,
v_marauder_b = 23,
test_car = 25,
wbike_test = 26,
vt27 = 27,
evan_test_bike = 29,
Max = 30
};
const std::map<VehicleType, std::string> vehicle_remap = {
{VehicleType::v_turtle, "Tough Puppy"}, {VehicleType::v_snake, "Sand Shark"},
{VehicleType::v_toad, "Dune Hopper"}, {VehicleType::v_scorpion, "Gila Stomper"},
{VehicleType::v_fox, "Heat Seeker"}, {VehicleType::v_rhino, "Slam Dozer"},
{VehicleType::v_mirage, "Dust Demon"}, {VehicleType::v_x_ride, "Desert Screamer"},
};
inline std::string VehicleTypeToString(VehicleType v) {
return vehicle_remap.find(v) != vehicle_remap.end() ? vehicle_remap.at(v) : "Unknown";
}
enum class FocusStatus : u64 {
Disable = 0,
Dead = 1,
Ignore = 2,
Inactive = 3,
Dangerous = 4,
InAir = 5,
Hit = 6,
Grabbed = 7,
InHead = 8,
TouchWater = 9,
OnWater = 10,
UnderWater = 11,
EdgeGrab = 12,
Pole = 13,
PilotRiding = 14,
Flut = 15,
Tube = 16,
Light = 17,
Board = 18,
Gun = 19,
Pilot = 20,
Mech = 21,
Dark = 22,
Rail = 23,
Halfpipe = 24,
Carry = 25,
Super = 26,
Shooting = 27,
Indax = 28,
Arrestable = 29,
Teleporting = 30,
Invulnerable = 31,
Turret = 32,
NoGravity = 33,
GunNoTarget = 34,
Max = 64
};
#define FOCUS_TEST(status, foc) (status.test(static_cast<size_t>(foc)))
} // namespace kmachine_extras
} // namespace jak3

View file

@ -109,6 +109,14 @@
;; ---vehicle-type
;; +++vehicle-type-u8
(defenum vehicle-type-u8
:type uint8
:copy-entries vehicle-type
)
;; ---vehicle-type-u8
;; DECOMP BEGINS
(define *traffic-manager* (the-as traffic-manager #f))

View file

@ -412,7 +412,7 @@
(dust-storm handle)
(flut-count int32)
(death-resetter resetter-spec :inline)
(current-vehicle game-vehicle-u8)
(current-vehicle vehicle-type-u8)
(vehicle-turbo-ready float)
(percent-complete float)
)

View file

@ -476,7 +476,7 @@
(set! (-> this old-vehicles) (game-vehicles))
(set! (-> this secrets) (game-secrets))
(set! (-> this purchase-secrets) (game-secrets))
(set! (-> this current-vehicle) (game-vehicle-u8 v-turtle v-snake v-toad v-fox))
(set! (-> this current-vehicle) (vehicle-type-u8 vt27))
(set-continue!
this
(cond
@ -2189,7 +2189,7 @@
(set! (-> gp-0 distance) 0.0)
(set! (-> gp-0 health-bar-vehicle) 0.0)
(set! (-> gp-0 dust-storm) (the-as handle #f))
(set! (-> gp-0 current-vehicle) (game-vehicle-u8 v-turtle v-snake v-toad v-fox))
(set! (-> gp-0 current-vehicle) (vehicle-type-u8 vt27))
)
0

View file

@ -1898,7 +1898,7 @@
(set! (-> this vehicles) (the-as game-vehicles (-> (the-as game-save-tag s4-0) user-uint64)))
)
(((game-save-elt vehicle))
(set! (-> this current-vehicle) (the-as game-vehicle-u8 (-> (the-as game-save-tag s4-0) user-uint8 0)))
(set! (-> this current-vehicle) (the-as vehicle-type-u8 (-> (the-as game-save-tag s4-0) user-uint8 0)))
)
(((game-save-elt items))
(set! (-> this items) (the-as game-items (-> (the-as game-save-tag s4-0) user-uint64)))
@ -2998,6 +2998,7 @@
(else
(case *kernel-boot-message*
(('play 'preview)
;; og:preserve-this
(#when PC_PORT
(pc-settings-save))
(auto-save-command 'auto-save 0 0 *default-pool* #f)

View file

@ -80,7 +80,8 @@
;; DECOMP BEGINS
(defun-debug game-task->string ((task game-task))
;; og:preserve-this removed from debug segment
(defun game-task->string ((task game-task))
(case task
(((game-task sewer-hum-kg))
"sewer-hum-kg"

View file

@ -3364,3 +3364,78 @@
)
)
)
;; og:preserve-this added
(defun get-active-mission-description ((info discord-info))
"Added in PC port to retrieve a string for the currently active mission to display in Discord."
(let* ((nodes (-> *game-info* sub-task-list))
(level (level-get-target-inside *level*))
(task-level-idx (if level (-> level info task-level) 0))
(side-missions-start (the int (game-task-node desert-bbush-get-to-1-introduction)))
(side-missions-end (the int (game-task-node desert-bbush-destroy-interceptors-resolution)))
; (gg-node? (lambda ((node game-task-node-info))
; (or (= (-> node task) (game-task city-red-gun-training))
; (= (-> node task) (game-task city-yellow-gun-training))
; (= (-> node task) (game-task city-blue-gun-training))
; (= (-> node task) (game-task city-dark-gun-training)))))
)
(dotimes (i (-> nodes length))
(when (nonzero? i)
(let* ((node (-> nodes i))
(mgr-info (-> node manager))
(mgr-handle (if mgr-info (-> mgr-info manager) (the handle #f))))
;; if we are not in a valid task level, just return.
(when (= task-level-idx 0)
(return (lookup-text! *common-text* (text-id discord-rpc-not-in-mission) #f))
)
;; check for gungame (there is probably a better way to do this)
; (when (and (= (-> level name) 'gungame)
; (gg-node? node)
; (task-node-open? (the game-task-node i)))
; (awhen (process-by-ename "training-manager-2")
; (if (= (-> it next-state name) 'course)
; (let ((feat (-> *setting-control* user-current features)))
; (cond
; ((not (logtest? feat (game-feature gun-yellow gun-blue gun-dark)))
; (set! (-> info task) "city-red-gun-training")
; (return (lookup-text! *common-text* (text-id discord-rpc-red-gun-training) #f))
; )
; ((not (logtest? feat (game-feature gun-red gun-blue gun-dark)))
; (set! (-> info task) "city-yellow-gun-training")
; (return (lookup-text! *common-text* (text-id discord-rpc-yellow-gun-training) #f))
; )
; ((not (logtest? feat (game-feature gun-red gun-yellow gun-dark)))
; (set! (-> info task) "city-blue-gun-training")
; (return (lookup-text! *common-text* (text-id discord-rpc-blue-gun-training) #f))
; )
; (else
; (set! (-> info task) "city-dark-gun-training")
; (return (lookup-text! *common-text* (text-id discord-rpc-dark-gun-training) #f))
; )
; )
; )
; )
; )
; )
;; check for side missions
(when (and (>= i side-missions-start)
(<= i side-missions-end)
(task-node-open? (the game-task-node i))
mgr-handle)
(set! (-> info task) (game-task->string (-> node task)))
(return (lookup-text! *common-text* (text-id discord-rpc-in-side-mission) #f))
)
;; check for any other tasks
(when (and ; (not (gg-node? node))
(task-node-open? (the game-task-node i))
(!= (-> node description) (the text-id 0))
(= (-> *task-level* task-level-idx) (-> node level)))
(set! (-> info task) (game-task->string (-> node task)))
(return (lookup-text! *common-text* (-> node description) #f))
)
)
)
)
(lookup-text! *common-text* (text-id discord-rpc-not-in-mission) #f)
)
)

File diff suppressed because it is too large Load diff

View file

@ -15,7 +15,7 @@
(defglobalconstant LEVEL_HEAP_SIZE (* NUM_LEVEL_PAGES LEVEL_PAGE_SIZE))
;(defglobalconstant DEBUG_LEVEL_HEAP_MULT 1.5) ;; level heap in debug mode is 1.5x larger
(defglobalconstant DEBUG_LEVEL_HEAP_MULT 1.1) ;; we're gonna use debug mode-style heaps but we don't actually need them at 1.5x size right now
(defglobalconstant DEBUG_LEVEL_HEAP_MULT 1.2) ;; we're gonna use debug mode-style heaps but we don't actually need them at 1.5x size right now
(defglobalconstant DEBUG_LEVEL_PAGE_SIZE (* 1024 (* DEBUG_LEVEL_HEAP_MULT LEVEL_PAGE_SIZE_KB)))
(defglobalconstant DEBUG_LEVEL_HEAP_SIZE (* NUM_LEVEL_PAGES DEBUG_LEVEL_PAGE_SIZE))

View file

@ -193,19 +193,19 @@
(set! (-> self mode-param2) (-> arg0 vehicle-type))
(when (= (-> arg0 vehicle-type) 28)
(let ((v1-172 (cond
((have-vehicle-v-type? (the-as int (-> self game current-vehicle)))
((have-vehicle-v-type? (the-as vehicle-type (-> self game current-vehicle)))
(the-as int (-> self game current-vehicle))
)
((have-vehicle-v-type? 13)
((have-vehicle-v-type? (vehicle-type v-snake))
13
)
((have-vehicle-v-type? 12)
((have-vehicle-v-type? (vehicle-type v-turtle))
12
)
((have-vehicle-v-type? 14)
((have-vehicle-v-type? (vehicle-type v-scorpion))
14
)
((have-vehicle-v-type? 15)
((have-vehicle-v-type? (vehicle-type v-toad))
15
)
)

View file

@ -138,7 +138,7 @@
(define-extern pre-intro-play (function none))
(define-extern intro-play (function none))
(define-extern find-nearest-entity (function vector type entity))
(define-extern have-vehicle-v-type? (function int symbol))
(define-extern have-vehicle-v-type? (function vehicle-type symbol))
(define-extern entity-birth-no-kill (function entity process))
(define-extern process-drawable-burn-effect (function time-frame rgbaf :behavior target))
(define-extern warp-gate type)

View file

@ -277,7 +277,7 @@
(let ((s4-1 (handle->process (-> s5-0 vehicle))))
(when s4-1
(send-event *traffic-manager* 'player-enter-vehicle (-> (the-as vehicle s4-1) info object-type))
(set! (-> self game current-vehicle) (the-as game-vehicle-u8 (-> (the-as vehicle s4-1) info vehicle-type)))
(set! (-> self game current-vehicle) (-> (the-as vehicle s4-1) info vehicle-type))
(set! (-> s5-0 entity) (-> (the-as vehicle s4-1) entity))
(set! (-> s5-0 gun?) (logtest? (-> (the-as vehicle s4-1) info flags) 32))
(set! (-> s5-0 enable-cam-side-shift) (logtest? (-> (the-as vehicle s4-1) info flags) 128))

View file

@ -1344,6 +1344,10 @@
(credits-08b4 #x08b4)
(credits-08b5 #x08b5)
(credits-08b6 #x08b6)
;; PC port IDs START
(discord-rpc-not-in-mission #x1200)
(discord-rpc-in-side-mission #x1201)
)
;; ---text-id

View file

@ -161,13 +161,9 @@
*target*
)
((= arg0 'sidekick)
(when *target*
(let ((v1-13 (-> *target* sidekick)))
(if v1-13
(the-as process (-> v1-13 0 self))
)
(if *target*
(ppointer->process (-> *target* sidekick))
)
)
)
((= arg0 'parent)
(let ((v1-16 (-> pp parent)))
@ -1266,34 +1262,34 @@
(set! (-> v1-82 func)
(lambda ((arg0 script-context))
(when (-> arg0 side-effect?)
(if (and (not (-> arg0 param 2)) (= (-> *game-info* current-vehicle) 27))
(if (and (not (-> arg0 param 2)) (= (-> *game-info* current-vehicle) (vehicle-type-u8 vt27)))
(return (the-as object 0))
)
(let ((gp-0 (-> arg0 param 1)))
(cond
((string= (the-as string gp-0) "turtle")
(set! (-> *game-info* current-vehicle) (game-vehicle-u8 v-scorpion v-toad))
(set! (-> *game-info* current-vehicle) (vehicle-type-u8 v-turtle))
)
((string= (the-as string gp-0) "scorpion")
(set! (-> *game-info* current-vehicle) (game-vehicle-u8 v-snake v-scorpion v-toad))
(set! (-> *game-info* current-vehicle) (vehicle-type-u8 v-scorpion))
)
((string= (the-as string gp-0) "toad")
(set! (-> *game-info* current-vehicle) (game-vehicle-u8 v-turtle v-snake v-scorpion v-toad))
(set! (-> *game-info* current-vehicle) (vehicle-type-u8 v-toad))
)
((string= (the-as string gp-0) "snake")
(set! (-> *game-info* current-vehicle) (game-vehicle-u8 v-turtle v-scorpion v-toad))
(set! (-> *game-info* current-vehicle) (vehicle-type-u8 v-snake))
)
((string= (the-as string gp-0) "rhino")
(set! (-> *game-info* current-vehicle) (game-vehicle-u8 v-turtle v-fox))
(set! (-> *game-info* current-vehicle) (vehicle-type-u8 v-rhino))
)
((string= (the-as string gp-0) "fox")
(set! (-> *game-info* current-vehicle) (game-vehicle-u8 v-fox))
(set! (-> *game-info* current-vehicle) (vehicle-type-u8 v-fox))
)
((string= (the-as string gp-0) "mirage")
(set! (-> *game-info* current-vehicle) (game-vehicle-u8 v-snake v-fox))
(set! (-> *game-info* current-vehicle) (vehicle-type-u8 v-mirage))
)
((string= (the-as string gp-0) "x-ride")
(set! (-> *game-info* current-vehicle) (game-vehicle-u8 v-turtle v-snake v-fox))
(set! (-> *game-info* current-vehicle) (vehicle-type-u8 v-x-ride))
)
)
)
@ -2278,10 +2274,10 @@
(else
(set! a1-17 (ppointer->process (-> *setting-control* user-current movie)))
(cond
(a1-17
(empty)
a1-17
)
((the-as process a1-17)
(empty)
a1-17
)
(else
*entity-pool*
)
@ -2335,10 +2331,10 @@
(else
(set! a1-21 (ppointer->process (-> *setting-control* user-current movie)))
(cond
(a1-21
(empty)
a1-21
)
((the-as process a1-21)
(empty)
a1-21
)
(else
*entity-pool*
)
@ -2548,10 +2544,10 @@
(else
(set! s4-0 (ppointer->process (-> *setting-control* user-current movie)))
(cond
(s4-0
(empty)
s4-0
)
((the-as process s4-0)
(empty)
s4-0
)
(else
*entity-pool*
)
@ -3819,10 +3815,10 @@
(else
(set! a1-9 (ppointer->process (-> *setting-control* user-current movie)))
(cond
(a1-9
(empty)
a1-9
)
((the-as process a1-9)
(empty)
a1-9
)
(else
*entity-pool*
)

View file

@ -156,14 +156,6 @@
(declare-type vehicle-physics-work structure)
(declare-type vehicle-wheel-state structure)
;; +++vehicle-type-u8
(defenum vehicle-type-u8
:type uint8
:copy-entries vehicle-type
)
;; ---vehicle-type-u8
;; DECOMP BEGINS
(deftype vehicle-info (structure)

View file

@ -127,48 +127,50 @@
)
(define *bbush-menu* (new 'static 'bbush-menu
:title-text (text-id text-0624)
:req-text (text-id text-0860)
:req-check (lambda () (case (-> *game-info* current-vehicle)
((13 16 18 19)
#t
)
(else
#f
)
)
)
:item-count 5
:items (new 'static 'inline-array bbush-menu-item 10
(new 'static 'bbush-menu-item
:text (text-id text-0629)
:node (game-task-node desert-bbush-air-time-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-0628)
:node (game-task-node desert-bbush-total-air-time-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-062b)
:node (game-task-node desert-bbush-jump-distance-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-062a)
:node (game-task-node desert-bbush-total-jump-distance-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-062c)
:node (game-task-node desert-bbush-roll-count-introduction)
)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
)
)
(define *bbush-menu*
(new 'static 'bbush-menu
:title-text (text-id text-0624)
:req-text (text-id text-0860)
:req-check (lambda ()
(case (-> *game-info* current-vehicle)
(((vehicle-type-u8 v-snake) (vehicle-type-u8 v-fox) (vehicle-type-u8 v-mirage) (vehicle-type-u8 v-x-ride))
#t
)
(else
#f
)
)
)
:item-count 5
:items (new 'static 'inline-array bbush-menu-item 10
(new 'static 'bbush-menu-item
:text (text-id text-0629)
:node (game-task-node desert-bbush-air-time-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-0628)
:node (game-task-node desert-bbush-total-air-time-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-062b)
:node (game-task-node desert-bbush-jump-distance-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-062a)
:node (game-task-node desert-bbush-total-jump-distance-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-062c)
:node (game-task-node desert-bbush-roll-count-introduction)
)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
)
)
)
(deftype des-burning-bush (process-focusable)
((task game-task-control)

View file

@ -758,8 +758,8 @@
(dotimes (v1-11 2)
(set! (-> this veh-fx v1-11) (the-as handle #f))
)
(if (= (-> *game-info* current-vehicle) (game-vehicle-u8 v-turtle v-snake v-toad v-fox))
(set! (-> *game-info* current-vehicle) (game-vehicle-u8 v-turtle v-scorpion v-toad))
(if (= (-> *game-info* current-vehicle) (vehicle-type-u8 vt27))
(set! (-> *game-info* current-vehicle) (vehicle-type-u8 v-snake))
)
(none)
)

View file

@ -102,7 +102,7 @@
(set! (-> this vehicle) (the-as handle #f))
)
((and (nonzero? (-> *setting-control* user-current vehicles))
(have-vehicle-v-type? (the-as int (-> this v-type)))
(have-vehicle-v-type? (the-as vehicle-type (-> this v-type)))
)
(when (not (handle->process (-> this arrow)))
(let ((s5-1 (new 'stack-no-clear 'task-arrow-params)))
@ -138,10 +138,10 @@
(defmethod w-parking-spot-method-23 ((this w-parking-spot))
(let ((v1-0 #t)
(s5-0 (-> this v-type))
(s5-0 (the-as uint (-> this v-type)))
)
(if (= s5-0 (game-vehicle-u8 v-scorpion v-toad v-fox))
(set! s5-0 (-> *game-info* current-vehicle))
(if (= (the-as game-vehicle-u8 s5-0) (game-vehicle-u8 v-scorpion v-toad v-fox))
(set! s5-0 (the-as uint (-> *game-info* current-vehicle)))
)
(when *target*
(let ((v1-3 (-> *vehicle-info* handle-by-vehicle-type s5-0)))

View file

@ -45,49 +45,49 @@
(none)
)
(defun have-earned-vehicle-v-type? ((arg0 int))
(defun have-earned-vehicle-v-type? ((arg0 vehicle-type))
(case arg0
((12)
(((vehicle-type v-turtle))
(let ((v1-2 (-> *game-info* vehicles)))
(logtest? v1-2 (game-vehicles v-turtle))
)
)
((13)
(((vehicle-type v-snake))
(let ((v1-5 (-> *game-info* vehicles)))
(logtest? v1-5 (game-vehicles v-snake))
)
)
((14)
(((vehicle-type v-scorpion))
(let ((v1-8 (-> *game-info* vehicles)))
(logtest? v1-8 (game-vehicles v-scorpion))
)
)
((15)
(((vehicle-type v-toad))
(let ((v1-11 (-> *game-info* vehicles)))
(logtest? v1-11 (game-vehicles v-toad))
)
)
((16)
(((vehicle-type v-fox))
(let ((v1-14 (-> *game-info* vehicles)))
(logtest? v1-14 (game-vehicles v-fox))
)
)
((17)
(((vehicle-type v-rhino))
(let ((v1-17 (-> *game-info* vehicles)))
(logtest? v1-17 (game-vehicles v-rhino))
)
)
((18)
(((vehicle-type v-mirage))
(let ((v1-20 (-> *game-info* vehicles)))
(logtest? v1-20 (game-vehicles v-mirage))
)
)
((19)
(((vehicle-type v-x-ride))
(let ((v1-23 (-> *game-info* vehicles)))
(logtest? v1-23 (game-vehicles v-x-ride))
)
)
((21)
(((vehicle-type v-faccar))
#t
)
(else
@ -96,9 +96,9 @@
)
)
(defun have-vehicle-v-type? ((arg0 int))
(defun have-vehicle-v-type? ((arg0 vehicle-type))
(case arg0
((12)
(((vehicle-type v-turtle))
(let ((v1-2 (-> *game-info* vehicles)))
(let ((a0-3 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-3)
@ -108,7 +108,7 @@
(logtest? v1-2 (game-vehicles v-turtle))
)
)
((13)
(((vehicle-type v-snake))
(let ((v1-5 (-> *game-info* vehicles)))
(let ((a0-6 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-6)
@ -118,7 +118,7 @@
(logtest? v1-5 (game-vehicles v-snake))
)
)
((14)
(((vehicle-type v-scorpion))
(let ((v1-8 (-> *game-info* vehicles)))
(let ((a0-9 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-9)
@ -128,7 +128,7 @@
(logtest? v1-8 (game-vehicles v-scorpion))
)
)
((15)
(((vehicle-type v-toad))
(let ((v1-11 (-> *game-info* vehicles)))
(let ((a0-12 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-12)
@ -138,7 +138,7 @@
(logtest? v1-11 (game-vehicles v-toad))
)
)
((16)
(((vehicle-type v-fox))
(let ((v1-14 (-> *game-info* vehicles)))
(let ((a0-15 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-15)
@ -148,7 +148,7 @@
(logtest? v1-14 (game-vehicles v-fox))
)
)
((17)
(((vehicle-type v-rhino))
(let ((v1-17 (-> *game-info* vehicles)))
(let ((a0-18 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-18)
@ -158,7 +158,7 @@
(logtest? v1-17 (game-vehicles v-rhino))
)
)
((18)
(((vehicle-type v-mirage))
(let ((v1-20 (-> *game-info* vehicles)))
(let ((a0-21 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-21)
@ -168,7 +168,7 @@
(logtest? v1-20 (game-vehicles v-mirage))
)
)
((19)
(((vehicle-type v-x-ride))
(let ((v1-23 (-> *game-info* vehicles)))
(let ((a0-24 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-24)
@ -178,7 +178,7 @@
(logtest? v1-23 (game-vehicles v-x-ride))
)
)
((21)
(((vehicle-type v-faccar))
#t
)
(else
@ -202,7 +202,7 @@
)
(defmethod vehicle-method-128 ((this wvehicle))
(have-vehicle-v-type? (the-as int (-> this info vehicle-type)))
(have-vehicle-v-type? (the-as vehicle-type (-> this info vehicle-type)))
)
(defmethod vehicle-method-144 ((this wvehicle))
@ -262,7 +262,7 @@
)
(defmethod vehicle-method-145 ((this wvehicle))
(when (not (have-earned-vehicle-v-type? (the-as int (-> this info vehicle-type))))
(when (not (have-earned-vehicle-v-type? (the-as vehicle-type (-> this info vehicle-type))))
(let ((gp-0
(new 'stack 'font-context *font-default-matrix* 22 320 0.0 (font-color default) (font-flags shadow kerning))
)

View file

@ -1274,7 +1274,7 @@
)
)
(cond
((have-vehicle-v-type? (the-as int (-> this info vehicle-type)))
((have-vehicle-v-type? (the-as vehicle-type (-> this info vehicle-type)))
(if (not (-> this minimap))
(set! (-> this minimap) (add-icon! *minimap* this (the-as uint 133) (the-as int #f) (the-as vector #t) 0))
)

View file

@ -662,7 +662,7 @@
)
(deftype prebot-gun-shot (projectile)
((whoosh-sound uint32)
((whoosh-sound sound-id)
)
)
@ -731,10 +731,10 @@
(cond
((zero? v1-0)
(sound-play "launch-bomb" :position (-> this root trans))
(set! (-> this whoosh-sound) (the-as uint (sound-play "bomb-whoosh" :position (-> this root trans))))
(set! (-> this whoosh-sound) (sound-play "bomb-whoosh" :position (-> this root trans)))
)
((= v1-0 (projectile-options po0))
(sound-stop (the-as sound-id (-> this whoosh-sound)))
(sound-stop (-> this whoosh-sound))
(sound-play "bomb-explode" :position (-> this root trans))
)
((= v1-0 (projectile-options po0 po1))

View file

@ -13,17 +13,17 @@
(let ((gp-0 (the-as int (-> *game-info* current-vehicle))))
(when (or (< (the-as uint gp-0) (the-as uint 12))
(< (the-as uint 19) (the-as uint gp-0))
(not (have-vehicle-v-type? gp-0))
(not (have-vehicle-v-type? (the-as vehicle-type gp-0)))
)
(let ((s5-0 12))
(countdown (s4-0 8)
(if (have-vehicle-v-type? s5-0)
(if (have-vehicle-v-type? (the-as vehicle-type s5-0))
(set! gp-0 s5-0)
)
(+! s5-0 1)
)
)
(set! (-> *game-info* current-vehicle) (the-as game-vehicle-u8 gp-0))
(set! (-> *game-info* current-vehicle) (the-as vehicle-type-u8 gp-0))
)
)
0

View file

@ -124,7 +124,8 @@
(cutscene? symbol)
(time-of-day float)
(percent-complete float)
(focus-status uint32)
(focus-status uint64)
(current-vehicle int32)
(task string) ;; currenly active game-task used for mission specific images
)
)

View file

@ -273,7 +273,6 @@
(defmethod update-discord-rpc ((obj pc-settings-jak3))
"update discord rpc module"
(when #f
(let ((info (new 'stack 'discord-info)))
(set! (-> info orb-count) (-> *game-info* skill-total))
(set! (-> info gem-count) (-> *game-info* gem-total))
@ -295,9 +294,10 @@
(set! (-> info time-of-day) (-> *time-of-day-context* time))
(set! (-> info percent-complete) (calculate-percentage *game-info*))
(set! (-> info focus-status) (if *target* (-> *target* focus-status) 0))
(set! (-> info current-vehicle) (the int (-> *game-info* current-vehicle)))
;; TODO - update to new with-profiler syntax
(pc-discord-rpc-update info)
))
)
(none))
(defmethod update-speedrun ((obj pc-settings-jak3))

View file

@ -376,7 +376,7 @@
(dust-storm handle)
(flut-count int32)
(death-resetter resetter-spec :inline)
(current-vehicle game-vehicle-u8)
(current-vehicle vehicle-type-u8)
(vehicle-turbo-ready float)
(percent-complete float)
)

View file

@ -481,7 +481,7 @@
(set! (-> this old-vehicles) (game-vehicles))
(set! (-> this secrets) (game-secrets))
(set! (-> this purchase-secrets) (game-secrets))
(set! (-> this current-vehicle) (game-vehicle-u8 v-turtle v-snake v-toad v-fox))
(set! (-> this current-vehicle) (vehicle-type-u8 vt27))
(set-continue!
this
(cond
@ -2218,7 +2218,7 @@
(set! (-> gp-0 distance) 0.0)
(set! (-> gp-0 health-bar-vehicle) 0.0)
(set! (-> gp-0 dust-storm) (the-as handle #f))
(set! (-> gp-0 current-vehicle) (game-vehicle-u8 v-turtle v-snake v-toad v-fox))
(set! (-> gp-0 current-vehicle) (vehicle-type-u8 vt27))
)
;; failed to figure out what this is:

View file

@ -1859,7 +1859,7 @@
(set! (-> this vehicles) (the-as game-vehicles (-> (the-as game-save-tag s4-0) user-uint64)))
)
(((game-save-elt vehicle))
(set! (-> this current-vehicle) (the-as game-vehicle-u8 (-> (the-as game-save-tag s4-0) user-uint8 0)))
(set! (-> this current-vehicle) (the-as vehicle-type-u8 (-> (the-as game-save-tag s4-0) user-uint8 0)))
)
(((game-save-elt items))
(set! (-> this items) (the-as game-items (-> (the-as game-save-tag s4-0) user-uint64)))

View file

@ -230,7 +230,7 @@
(goto cfg-42)
)
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~1Tname-list[6] @ #x~X~%" (-> this name-list))
(format #t "~1Tname-list[6] @ #x~X~%" (&-> this name))
(format #t "~1Tname: ~A~%" (-> this name))
(format #t "~1Tvisname: ~A~%" (-> this visname))
(format #t "~1Tnickname: ~A~%" (-> this nickname))

File diff suppressed because it is too large Load diff

View file

@ -192,19 +192,19 @@
(set! (-> self mode-param2) (-> arg0 vehicle-type))
(when (= (-> arg0 vehicle-type) 28)
(let ((v1-172 (cond
((have-vehicle-v-type? (the-as int (-> self game current-vehicle)))
((have-vehicle-v-type? (the-as vehicle-type (-> self game current-vehicle)))
(the-as int (-> self game current-vehicle))
)
((have-vehicle-v-type? 13)
((have-vehicle-v-type? (vehicle-type v-snake))
13
)
((have-vehicle-v-type? 12)
((have-vehicle-v-type? (vehicle-type v-turtle))
12
)
((have-vehicle-v-type? 14)
((have-vehicle-v-type? (vehicle-type v-scorpion))
14
)
((have-vehicle-v-type? 15)
((have-vehicle-v-type? (vehicle-type v-toad))
15
)
)

View file

@ -270,7 +270,7 @@
(let ((s4-1 (handle->process (-> s5-0 vehicle))))
(when s4-1
(send-event *traffic-manager* 'player-enter-vehicle (-> (the-as vehicle s4-1) info object-type))
(set! (-> self game current-vehicle) (the-as game-vehicle-u8 (-> (the-as vehicle s4-1) info vehicle-type)))
(set! (-> self game current-vehicle) (-> (the-as vehicle s4-1) info vehicle-type))
(set! (-> s5-0 entity) (-> (the-as vehicle s4-1) entity))
(set! (-> s5-0 gun?) (logtest? (-> (the-as vehicle s4-1) info flags) 32))
(set! (-> s5-0 enable-cam-side-shift) (logtest? (-> (the-as vehicle s4-1) info flags) 128))

View file

@ -130,48 +130,50 @@
)
;; definition for symbol *bbush-menu*, type bbush-menu
(define *bbush-menu* (new 'static 'bbush-menu
:title-text (text-id text-0624)
:req-text (text-id text-0860)
:req-check (lambda () (case (-> *game-info* current-vehicle)
((13 16 18 19)
#t
)
(else
#f
)
)
)
:item-count 5
:items (new 'static 'inline-array bbush-menu-item 10
(new 'static 'bbush-menu-item
:text (text-id text-0629)
:node (game-task-node desert-bbush-air-time-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-0628)
:node (game-task-node desert-bbush-total-air-time-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-062b)
:node (game-task-node desert-bbush-jump-distance-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-062a)
:node (game-task-node desert-bbush-total-jump-distance-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-062c)
:node (game-task-node desert-bbush-roll-count-introduction)
)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
)
)
(define *bbush-menu*
(new 'static 'bbush-menu
:title-text (text-id text-0624)
:req-text (text-id text-0860)
:req-check (lambda ()
(case (-> *game-info* current-vehicle)
(((vehicle-type-u8 v-snake) (vehicle-type-u8 v-fox) (vehicle-type-u8 v-mirage) (vehicle-type-u8 v-x-ride))
#t
)
(else
#f
)
)
)
:item-count 5
:items (new 'static 'inline-array bbush-menu-item 10
(new 'static 'bbush-menu-item
:text (text-id text-0629)
:node (game-task-node desert-bbush-air-time-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-0628)
:node (game-task-node desert-bbush-total-air-time-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-062b)
:node (game-task-node desert-bbush-jump-distance-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-062a)
:node (game-task-node desert-bbush-total-jump-distance-introduction)
)
(new 'static 'bbush-menu-item
:text (text-id text-062c)
:node (game-task-node desert-bbush-roll-count-introduction)
)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
(new 'static 'bbush-menu-item)
)
)
)
;; definition of type des-burning-bush
(deftype des-burning-bush (process-focusable)
@ -1750,7 +1752,3 @@
;; failed to figure out what this is:
0

View file

@ -840,8 +840,8 @@
(dotimes (v1-11 2)
(set! (-> this veh-fx v1-11) (the-as handle #f))
)
(if (= (-> *game-info* current-vehicle) (game-vehicle-u8 v-turtle v-snake v-toad v-fox))
(set! (-> *game-info* current-vehicle) (game-vehicle-u8 v-turtle v-scorpion v-toad))
(if (= (-> *game-info* current-vehicle) (vehicle-type-u8 vt27))
(set! (-> *game-info* current-vehicle) (vehicle-type-u8 v-snake))
)
(none)
)

View file

@ -123,7 +123,7 @@
(set! (-> this vehicle) (the-as handle #f))
)
((and (nonzero? (-> *setting-control* user-current vehicles))
(have-vehicle-v-type? (the-as int (-> this v-type)))
(have-vehicle-v-type? (the-as vehicle-type (-> this v-type)))
)
(when (not (handle->process (-> this arrow)))
(let ((s5-1 (new 'stack-no-clear 'task-arrow-params)))
@ -162,10 +162,10 @@
;; WARN: Return type mismatch int vs none.
(defmethod w-parking-spot-method-23 ((this w-parking-spot))
(let ((v1-0 #t)
(s5-0 (-> this v-type))
(s5-0 (the-as uint (-> this v-type)))
)
(if (= s5-0 (game-vehicle-u8 v-scorpion v-toad v-fox))
(set! s5-0 (-> *game-info* current-vehicle))
(if (= (the-as game-vehicle-u8 s5-0) (game-vehicle-u8 v-scorpion v-toad v-fox))
(set! s5-0 (the-as uint (-> *game-info* current-vehicle)))
)
(when *target*
(let ((v1-3 (-> *vehicle-info* handle-by-vehicle-type s5-0)))
@ -299,7 +299,3 @@
0
)
)

View file

@ -43,49 +43,49 @@
)
;; definition for function have-earned-vehicle-v-type?
(defun have-earned-vehicle-v-type? ((arg0 int))
(defun have-earned-vehicle-v-type? ((arg0 vehicle-type))
(case arg0
((12)
(((vehicle-type v-turtle))
(let ((v1-2 (-> *game-info* vehicles)))
(logtest? v1-2 (game-vehicles v-turtle))
)
)
((13)
(((vehicle-type v-snake))
(let ((v1-5 (-> *game-info* vehicles)))
(logtest? v1-5 (game-vehicles v-snake))
)
)
((14)
(((vehicle-type v-scorpion))
(let ((v1-8 (-> *game-info* vehicles)))
(logtest? v1-8 (game-vehicles v-scorpion))
)
)
((15)
(((vehicle-type v-toad))
(let ((v1-11 (-> *game-info* vehicles)))
(logtest? v1-11 (game-vehicles v-toad))
)
)
((16)
(((vehicle-type v-fox))
(let ((v1-14 (-> *game-info* vehicles)))
(logtest? v1-14 (game-vehicles v-fox))
)
)
((17)
(((vehicle-type v-rhino))
(let ((v1-17 (-> *game-info* vehicles)))
(logtest? v1-17 (game-vehicles v-rhino))
)
)
((18)
(((vehicle-type v-mirage))
(let ((v1-20 (-> *game-info* vehicles)))
(logtest? v1-20 (game-vehicles v-mirage))
)
)
((19)
(((vehicle-type v-x-ride))
(let ((v1-23 (-> *game-info* vehicles)))
(logtest? v1-23 (game-vehicles v-x-ride))
)
)
((21)
(((vehicle-type v-faccar))
#t
)
(else
@ -95,9 +95,9 @@
)
;; definition for function have-vehicle-v-type?
(defun have-vehicle-v-type? ((arg0 int))
(defun have-vehicle-v-type? ((arg0 vehicle-type))
(case arg0
((12)
(((vehicle-type v-turtle))
(let ((v1-2 (-> *game-info* vehicles)))
(let ((a0-3 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-3)
@ -107,7 +107,7 @@
(logtest? v1-2 (game-vehicles v-turtle))
)
)
((13)
(((vehicle-type v-snake))
(let ((v1-5 (-> *game-info* vehicles)))
(let ((a0-6 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-6)
@ -117,7 +117,7 @@
(logtest? v1-5 (game-vehicles v-snake))
)
)
((14)
(((vehicle-type v-scorpion))
(let ((v1-8 (-> *game-info* vehicles)))
(let ((a0-9 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-9)
@ -127,7 +127,7 @@
(logtest? v1-8 (game-vehicles v-scorpion))
)
)
((15)
(((vehicle-type v-toad))
(let ((v1-11 (-> *game-info* vehicles)))
(let ((a0-12 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-12)
@ -137,7 +137,7 @@
(logtest? v1-11 (game-vehicles v-toad))
)
)
((16)
(((vehicle-type v-fox))
(let ((v1-14 (-> *game-info* vehicles)))
(let ((a0-15 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-15)
@ -147,7 +147,7 @@
(logtest? v1-14 (game-vehicles v-fox))
)
)
((17)
(((vehicle-type v-rhino))
(let ((v1-17 (-> *game-info* vehicles)))
(let ((a0-18 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-18)
@ -157,7 +157,7 @@
(logtest? v1-17 (game-vehicles v-rhino))
)
)
((18)
(((vehicle-type v-mirage))
(let ((v1-20 (-> *game-info* vehicles)))
(let ((a0-21 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-21)
@ -167,7 +167,7 @@
(logtest? v1-20 (game-vehicles v-mirage))
)
)
((19)
(((vehicle-type v-x-ride))
(let ((v1-23 (-> *game-info* vehicles)))
(let ((a0-24 (-> *setting-control* user-current vehicles)))
(if (nonzero? a0-24)
@ -177,7 +177,7 @@
(logtest? v1-23 (game-vehicles v-x-ride))
)
)
((21)
(((vehicle-type v-faccar))
#t
)
(else
@ -206,7 +206,7 @@
;; definition for method 128 of type wvehicle
(defmethod vehicle-method-128 ((this wvehicle))
(have-vehicle-v-type? (the-as int (-> this info vehicle-type)))
(have-vehicle-v-type? (the-as vehicle-type (-> this info vehicle-type)))
)
;; definition for method 144 of type wvehicle
@ -270,7 +270,7 @@
;; definition for method 145 of type wvehicle
;; WARN: Return type mismatch int vs none.
(defmethod vehicle-method-145 ((this wvehicle))
(when (not (have-earned-vehicle-v-type? (the-as int (-> this info vehicle-type))))
(when (not (have-earned-vehicle-v-type? (the-as vehicle-type (-> this info vehicle-type))))
(let ((gp-0
(new 'stack 'font-context *font-default-matrix* 22 320 0.0 (font-color default) (font-flags shadow kerning))
)

View file

@ -1302,7 +1302,7 @@
)
)
(cond
((have-vehicle-v-type? (the-as int (-> this info vehicle-type)))
((have-vehicle-v-type? (the-as vehicle-type (-> this info vehicle-type)))
(if (not (-> this minimap))
(set! (-> this minimap) (add-icon! *minimap* this (the-as uint 133) (the-as int #f) (the-as vector #t) 0))
)

View file

@ -697,7 +697,7 @@
;; definition of type prebot-gun-shot
(deftype prebot-gun-shot (projectile)
((whoosh-sound uint32)
((whoosh-sound sound-id)
)
)
@ -785,10 +785,10 @@
(cond
((zero? v1-0)
(sound-play "launch-bomb" :position (-> this root trans))
(set! (-> this whoosh-sound) (the-as uint (sound-play "bomb-whoosh" :position (-> this root trans))))
(set! (-> this whoosh-sound) (sound-play "bomb-whoosh" :position (-> this root trans)))
)
((= v1-0 (projectile-options po0))
(sound-stop (the-as sound-id (-> this whoosh-sound)))
(sound-stop (-> this whoosh-sound))
(sound-play "bomb-explode" :position (-> this root trans))
)
((= v1-0 (projectile-options po0 po1))

View file

@ -10,17 +10,17 @@
(let ((gp-0 (the-as int (-> *game-info* current-vehicle))))
(when (or (< (the-as uint gp-0) (the-as uint 12))
(< (the-as uint 19) (the-as uint gp-0))
(not (have-vehicle-v-type? gp-0))
(not (have-vehicle-v-type? (the-as vehicle-type gp-0)))
)
(let ((s5-0 12))
(countdown (s4-0 8)
(if (have-vehicle-v-type? s5-0)
(if (have-vehicle-v-type? (the-as vehicle-type s5-0))
(set! gp-0 s5-0)
)
(+! s5-0 1)
)
)
(set! (-> *game-info* current-vehicle) (the-as game-vehicle-u8 gp-0))
(set! (-> *game-info* current-vehicle) (the-as vehicle-type-u8 gp-0))
)
)
0