subtitle editing and text project compiler rework (#1331)

* add a `subtitle` bucket and rename buckets 67 and 68

* automatic `heap-base`

* subtitles editor

* adjust default params

* bug

* Update subtitle.gc

* fix blue color inconsistency in progress

* void.

* Update subtitle.gc

* Update subtitle.gc

* Extend `heap-base` detection to check for errors

* sometimes it's actually manually set!

* remove broken error check

* rework how compiling text files works

* try out subtitles source v2

* bugfix

* oops

* Update game_text_common.cpp
This commit is contained in:
ManDude
2022-04-24 20:15:16 +01:00
committed by GitHub
parent 0d4b5f8df4
commit 8eb0796f8e
79 changed files with 1739 additions and 1321 deletions
+1
View File
@@ -282,6 +282,7 @@ class StructureType : public ReferenceType {
bool is_always_stack_singleton() const { return m_always_stack_singleton; }
void set_allow_misalign(bool misalign) { m_allow_misalign = misalign; }
void set_gen_inspect(bool gen_inspect) { m_generate_inspect = gen_inspect; }
int size() const { return m_size_in_mem; }
protected:
friend class TypeSystem;
+21 -9
View File
@@ -316,6 +316,7 @@ StructureDefResult parse_structure_def(
int method_count_assert = -1;
uint64_t flag_assert = 0;
bool flag_assert_set = false;
bool set_heapbase = false;
while (!rest->is_empty_list()) {
if (car(rest).is_pair()) {
auto opt_list = &car(rest);
@@ -366,6 +367,7 @@ StructureDefResult parse_structure_def(
}
rest = cdr(rest);
flags.heap_base = hb;
set_heapbase = true;
} else if (opt_name == ":allow-misaligned") {
result.allow_misaligned = true;
} else if (opt_name == ":final") {
@@ -378,6 +380,25 @@ StructureDefResult parse_structure_def(
}
}
if (ts->fully_defined_type_exists(TypeSpec("process")) &&
ts->tc(TypeSpec("process"), TypeSpec(type->get_parent()))) {
// check heap-base if this is a child of process.
auto process_type = ts->get_type_of_type<BasicType>("process");
auto auto_hb = (flags.size - process_type->size() + 0xf) & ~0xf;
if (!set_heapbase) {
// wasnt set manually so set automatically.
flags.heap_base = auto_hb;
} else if (flags.heap_base < auto_hb) {
// was set manually so verify if that's correct.
throw std::runtime_error(
fmt::format("Process heap underflow in type {}: heap-base is {} vs. auto-detected {}",
type->get_name(), flags.heap_base, auto_hb));
//} else if (flags.heap_base != auto_hb) {
// fmt::print("Type {} has manual heap-base ({} vs {}). This is fine. \n", type->get_name(),
// flags.heap_base, auto_hb);
}
}
if (size_assert != -1 && flags.size != u16(size_assert)) {
throw std::runtime_error("Type " + type->get_name() + " came out to size " +
std::to_string(int(flags.size)) + " but size-assert was set to " +
@@ -398,15 +419,6 @@ StructureDefResult parse_structure_def(
flags.flag, flag_assert));
}
if (result.flags.heap_base) {
int heap_start_1 = 112 + result.flags.heap_base;
int heap_start_2 = (result.flags.size + 15) & (~15);
if (heap_start_1 != heap_start_2) {
throw std::runtime_error(fmt::format("Heap base bad on {}: {} vs {}\n", type->get_name(),
heap_start_1, heap_start_2));
}
}
result.flags = flags;
return result;
}
+2 -2
View File
@@ -387,8 +387,8 @@ static std::vector<EncodeInfo> g_encode_info_jak1 = {
};
static std::vector<ReplaceInfo> g_replace_info_jak1 = {
// \" -> " (confusing)
{"\\\"", "\""},
// \" -> " (yeah it looks confusing)
{"\"", "\\\""},
// other
{"A~Y~-21H~-5Vº~Z", "Å"},
+8 -5
View File
@@ -501,7 +501,7 @@
(gmerc-tfrag-tex1 18) ;; generic merc, with tfrag textures, level 1
(shrub-tex0 19)
(shrub0 20)
(shrub-tex1 25)
(shrub1 26)
@@ -557,9 +557,12 @@
(pre-sprite-textures 65) ;; common
(sprite 66)
;; debug spheres? 67
(debug-draw0 67)
(debug 67)
;; debug text 68
(debug-draw1 68)
(debug-no-zbuf 68)
;; extra buckets for pc port
(subtitle 69)
)
(define-extern sinteger type)
@@ -10259,7 +10262,7 @@
(normal-attack 14)
(strong-attack 15)
(indestructible 16)
(fop17 17) ;; unused
(eco-blocked 18)
(respawn 19)
@@ -11365,7 +11368,7 @@
(target-attack 12) ;; all target attacks
(mother-spider 13)
(cak-14 14) ;; unused
(blue-eco-suck 15) ;; manipy, orb-cache-top,
(blue-eco-suck 15) ;; manipy, orb-cache-top,
(unknown-16 16)
(unknown-17 17)
(unknown-18 18)
+2 -2
View File
@@ -4,8 +4,8 @@
;; you can find the game-text-version parsing in .cpp and an enum in goal-lib.gc
(subtitle
(jak1-v1 "game/assets/jak1/subtitle/game_subtitle_en.txt")
(jak1-v1 "game/assets/jak1/subtitle/game_subtitle_es.txt")
(jak1-v1 "game/assets/jak1/subtitle/game_subtitle_en.gs")
(jak1-v1 "game/assets/jak1/subtitle/game_subtitle_es.gs")
)
+1 -1
View File
@@ -5,7 +5,7 @@
(text
(jak1-v1 "assets/game_text.txt")
(jak1-v1 "game/assets/jak1/text/game_text_en.txt")
(jak1-v1 "game/assets/jak1/text/game_text_en.gs")
)
@@ -0,0 +1,222 @@
(language-id 0 6)
;; -----------------
;; intro
("sage-intro-sequence-a"
(24 "SAGE" "I HAVE SPENT MY LIFE SEARCHING FOR THE ANSWERS THAT MY FATHER, AND MY FATHER'S FATHERS FAILED TO FIND.")
(260 "SAGE" "WHO WERE THE PRECURSORS? WHY DID THEY CREATE THE VAST MONOLITHS THAT LITHER OUR PLANET?")
(454 "SAGE" "HOW DID THEY HARNESS ECO, THE LIFE ENERGY OF THE WORLD? WHAT WAS THEIR PURPOSE? AND WHY DID THEY VANISH?")
(708)
(720 "SAGE" "I HAVE ASKED THE PLANTS, BUT THEY DO NOT REMEMBER.")
(818 "SAGE" "THE PLANTS HAVE ASKED THE ROCKS, BUT THE ROCKS DO NOT RECALL.")
(957 "SAGE" "EVEN THE ROCKS DO NOT RECALL...")
(1064)
(1090 "SAGE" "EVERY BONE IN MY BODY TELLS ME THAT THE ANSWERS REST ON THE SHOULDERS OF A YOUNG BOY")
(1297 "SAGE" "OBLIVIOUS TO HIS DESTINY, UNINTERESTED IN THE SEARCH FOR TRUTH, AND REJECTING OF MY GUIDANCE!")
(1545 "SAGE" "AND WHY WOULD HE WANT TO LISTEN TO OLD SAMOS THE SAGE ANYWAY?")
(1689 "SAGE" "I'M ONLY THE MASTER OF GREEN ECO, ONE OF THE WISEST MEN ON THE PLANET!")
(1875)
(1958 "SAGE" "SO IT SEEMS THE ANSWER BEGINS NOT WITH CAREFUL RESEARCH, OR SENSIBLE THINKING.")
(2145 "SAGE" "NAY! AS WITH MANY OF FATE'S MYSTERIES")
(2281 "SAGE" "IT BEGINS WITH BUT A SMALL ACT OF DISOBEDIENCE.")
(2440 "DAXTER" "HEY! UH, JAK? OL' GREEN STUFF TOLD US NOT TO COME HERE!")
)
("sidekick-human-intro-sequence-b"
(547 "OLD MAN" "CONTINUE YOUR SEARCH FOR ARTIFACTS AND ECO.")
(674 "OLD MAN" "IF THE LOCALS POSSESS PRECURSOR ITEMS, YOU KNOW WHAT TO DO.")
(842 "WOMAN" "DEAL HARSHLY WITH ANYBODY WHO STRAYS FROM THE VILLAGE.")
(937 "WOMAN" "WE WILL ATTACK IT IN DUE TIME.")
(1027)
)
("sidekick-human-intro-sequence-c"
(12 "DAXTER" "WHAT ARE WE DOING HERE ANYWAY, JAK? THIS PLACE GIVES ME THE CREEPS!")
(151)
(369 "DAXTER" "HUH?")
(404 "DAXTER" "(GROAN) STUPID PRECURSOR JUNK!")
(496)
(577 "DAXTER" "EEK! WHAT IS THAT DARK OOZE? IT SURE DON'T LOOK FRIENDLY.")
(721)
(777 "DAXTER" "THE SAGE YAPS ON ABOUT THE PRECURSORS THAT BUILT THIS PLACE ALL THE TIME.")
(909 "DAXTER" "\"WHERE DID THEY GO? WHY DID THEY BUILD THIS CRAP?\"")
(1014 "DAXTER" "NOW I LIKE PRECURSOR ORBS AND POWER CELLS AS MUCH AS THE NEXT GUY")
(1124 "DAXTER" "BUT IF YOU ASK ME, THEY MUST HAVE BEEN REAL LOSERS.")
(1212 "DAXTER" "WHOA! HOW DID YOU DO THAT?")
(1271)
(1331 "DAXTER" "JAK, I THINK WE'RE IN TROUBLE!")
(1386)
(1857 "DAXTER" "MAN, THAT STUNG.")
(1919)
(1941 "DAXTER" "I TOLD YOU WE SHOULDN'T 'A' COME HERE, AND YOU LISTENED?")
(2034)
(2057 "DAXTER" "WHAAAT?")
(2101)
(2189 "DAXTER" "WAAAAAAAAHHHHHHHH!!")
(2307 "DAXTER" "OKAY, OKAY. I'M FINE, I'M FINE...")
(2431)
(2481 "DAXTER" "WAAAAAAAAHHHHHHHH!!")
)
("sage-intro-sequence-d1"
(137 "SAGE" "WHAT IN GREEN TARNATION DO YOU TWO WANT?")
(220 "DAXTER" "WE- WE- WE WAS- THEY WAS- I'M- I WAS-")
(283 "SAGE" "DON'T TELL ME! INSTEAD OF HEEDING MY WISDOM, THE TWO OF YOU WENT MUCKING AROUND")
(446 "SAGE" "IN THE ONLY PLACE THAT I TOLD YOU NOT TO GO: MISTY ISLAND!")
(550 "DAXTER" "THAT'S RIGHT! AND THEN-")
(579 "SAGE" "AND, DAXTER, YOU'VE FINALLY TOOK A MUCH-NEEDED BATH, BUT IN A BATHTUB FILLED WITH DARK ECO.")
(793 "DAXTER" "LOOK, OLD MAN, ARE YOU GONNA KEEP YAPPIN', OR YOU GONNA HELP ME OUTTA THIS MESS!?")
(920 "SAGE" "I'M GONNA KEEP YAPPIN'! BECAUSE IN MY PROFESSIONAL OPINION, THE CHANGE IS AN IMPROVEMENT.")
(1079 "SAGE" "AND BESIDES... I COULDN'T HELP YOU IF I WANTED TO.")
(1186 "DAXTER" "WHAT!?")
(1221 "SAGE" "THERE'S ONLY ONE PERSON WHO HAS STUDIED DARK ECO LONG ENOUGH")
(1329 "SAGE" "TO HAVE A CHANCE AT RETURNING YOU TO YOUR PREVIOUS FORM:")
(1431 "SAGE" "GOL ACHERON, THE SAGE.")
(1496 "SAGE" "BUT HE LIVES FAR TO THE NORTH. FAR, FAR TO NORTH. NOBODY HAS SPOKEN TO HIM IN AGES.")
(1718 "SAGE" "I WOULD TELEPORT YOU THERE, BUT I CAN'T DO THAT EITHER.")
(1831 "SAGE" "NONE OF THE THREE SAGES THAT MAINTAIN THE OTHER TELEPORTER GATES")
(1934 "SAGE" "HAVE SEEN FIT TO TURN THEIR ENDS ON FOR QUITE A WHILE!")
)
("sage-intro-sequence-d2"
(3 "SAGE" "THE ONLY OTHER WAY NORTH IS BY FOOT THROUGH THE FIRE CANYON")
(114 "SAGE" "BUT ITS VOLCANIC SOIL IS HOT ENOUGH TO MELT PRECURSOR METAL.")
(224 "SAGE" "YOU CAN'T JUST WALK THROUGH IT.")
(270 "KEIRA" "BUT YOU COULD FLY OVER IT, IF YOU HAD A ZOOMER EQUIPPED WITH A HEAT SHIELD.")
(396 "KEIRA" "I JUST HAPPEN TO BE WORKING ON SUCH A THING AT THIS VERY MOMENT.")
(515 "KEIRA" "ALL I WOULD NEED IS TWENTY POWER CELLS TO GIVE IT ENOUGH ENERGY")
(605 "KEIRA" "TO WITHSTAND THE CANYON'S HEAT. ISN'T THAT RIGHT, DADDY?")
(697)
(699 "SAGE" "YES, KEIRA, THAT MIGHT WORK. BUT WHERE ARE A BOY")
(826 "SAGE" "AND A HALF!")
(857 "SAGE" "GOING TO GET TWENTY POWER CELLS?")
(911 "KEIRA" "FROM THE VILLAGERS! MOST OF THEM HAVE A POWER CELL OR TWO STASHED AWAY SOMEWHERE.")
(1050 "KEIRA" "AND EVEN IF THEY AREN'T WILLING TO JUST GIVE THEM AWAY")
(1133 "KEIRA" "GREASING THEIR PALMS WITH A FEW PRECURSOR ORBS SHOULD DO THE TRICK.")
(1249 "KEIRA" "AND I BET THERE ARE EVEN MORE OF THEM OUT IN THE WILDS JUST WAITING FOR SOME")
(1364 "KEIRA" "BRAVE ADVENTURER TO FIND.")
(1435 "DAXTER" "WELL WE'VE GOT THE BRAVE ADVENTURER, AT LEAST.")
(1529)
(1532 "SAGE" "BRAVE ADVENTURER?")
(1582 "SAGE" "YOU TWO COULDN'T FIND YOUR WAY OUT OF THE VILLAGE WITHOUT TRAINING!")
(1685)
(1689 "SAGE" "BEFORE YOU DO ANYTHING ELSE, YOU BETTER GO THROUGH THE WARP GATE AND GET")
(1810 "SAGE" "SOME PRACTICE ON GEYSER ROCK.")
(1872)
(1878 "DAXTER" "EHH, WE WON'T FIND ANY MORE OF THAT DARK-OO AND ECO STUFF, WILL WE?")
(1993 "DAXTER" "'CAUSE I'D HATE TO FALL IN AGAIN AND TURN INTO YOU!")
(2072 "SAGE" "GET IN THERE! BEFORE I TURN YOU BOTH INTO FERNS!")
(2192)
)
;; -----------------
;; oracle
("oracle-right-eye-1" (0 "ORACLE" "FOR YOUR GIFT, ANOTHER POWER CELL IS YOURS."))
("oracle-left-eye-1" (0 "ORACLE" "YOU HAVE PROVEN YOURSELF WORTHY. HERE IS A POWER CELL."))
("oracle-right-eye-2" (0 "ORACLE" "HERE IS ANOTHER POWER CELL FOR YOUR QUEST."))
("oracle-left-eye-2" (0 "ORACLE" "FOR YOUR SACRIFICE, I OFFER YOU A POWER CELL."))
("oracle-right-eye-3" (0 "ORACLE" "YOU HAVE OBTAINED ANOTHER POWER CELL."))
("oracle-left-eye-3" (0 "ORACLE" "FOR YOUR EFFORT, A POWER CELL IS THE REWARD."))
;; -----------------
;; swamp
("billy-introduction"
(6 "BILLY" "HOWDY, FRIENDS! ENJOYIN' MY BEAUTIFUL SWAMP? I OWN THESE HERE PARTS. EVERYTHING THAT DOESN'T SINK INTO THE MUD, THAT IS! (LAUGHS)")
(349)
(369 "DAXTER" "JUDGING BY THE SMELL, I'D WAGER YOUR BATHTUB SANK IN THE MUD LONG AGO.")
(497)
(519 "BILLY" "WHAT'S A BATHTUB? ANYWAY I GOT BIGGER PROBLEMS NOW...")
(677)
(691 "BILLY" "SEEMS SOME NASTY LURKER VARMINTS ARE GROUSIN' ABOUTS SNATCHIN' EVERYTHING THEY CAN GET THEIR GRUBBY LITTLE PAWS ON.")
(910 "BILLY" "AND SCARED AWAY MY PET HIPHOG, FARTHY.")
(1000 "BILLY" "HE'S BEEN MISSIN' FOR NIGH ON TO A COON'S AGE.")
(1136 :offscreen "BILLY" "I'VE BEEN PUTTIN' OUT HIS FAVORITE SNACK, BUT THOSE ORNERY SWAMP RATS KEEP STEALIN' EM!")
(1318 :offscreen "BILLY" "IF YOU COULD KEEP THOSE PESKY CRITTERS AWAY LONG ENOUGH, I JUST KNOW FARTHY WOULD SMELL THEM VITTLES AND COME BACK!")
(1509)
(1527 "BILLY" "WILL YA HELP ME OUT?")
)
("billy-reject"
(7 "BILLY" "WELL, IF YOU CHANGE YOUR MIND, YOU KNOW WHERE TO FIND ME! (LAUGHS)")
)
("billy-accept"
(5 "BILLY" "GOOD! THOSE RATS WILL BE BACK ANYTIME.")
(109 "BILLY" "SHOOT ALL THEM RATS, AND KEEP 'EM FROM EATING AT LEAST ONE OF THEM SNACKS.")
)
("billy-resolution"
(1 "BILLY" "WELL FRY MY HIDE! YOU SURE KNOW HOW TO SHOOT! THANKS A HEAP FOR THE HELP.")
)
("billy-reminder-1"
(36 "BILLY" "AHH, Y'ALL BACK TO HELP STOP THEM RATS?")
)
;; -----------------
;; citadel
("green-sagecage-introduction"
(130 "SAGE" "IT'S ABOUT TIME YOU TWO DECIDED TO SHOW UP!")
(207 "DAXTER" "NICE TO SEE YOU TOO! DO THEY HAVE YOU MOPPING THE FLOORS NOW?")
(343 "SAGE" "THERE'S NO TIME FOR JOKES, DAXTER. GOL AND MAIA KIDNAPPED US TO SAP OUR ENERGIES TO POWER THEIR ABOMINABLE MACHINE.")
(574 :offscreen "SAGE" "IT APPEARS THEY HAVE COMBINED THE FUNCTIONAL REMAINS OF A PRECURSOR ROBOT WITH SCAVENGED ARTIFACTS FROM ACROSS THE LAND.")
(800 :offscreen "SAGE" "THEN THEY ADDED A FEW DIABOLICAL ADDITIONS OF THEIR OWN, CREATING THE ONE THING CAPABLE OF OPENING THE DARK ECO SILOS.")
(1060 "SAGE" "IF YOU CAN FREE THE FOUR OF US, WE CAN USE OUR COMBINED POWERS")
(1180 "SAGE" "TO BREAK THE FORCE SHIELD SURROUNDING THE ROBOT, BEFORE THEY USE IT TO DESTROY THE WORLD.")
)
("redsage-resolution"
(60 "RED SAGE" "(CHUCKLES) YOU'VE FINALLY COME TO RESCUE ME.")
(190 "RED SAGE" "DO YOU KNOW HOW LONG I'VE BEEN IN HERE? WHAT TOOK YOU SO LONG, YOU KNOW? (CHUCKLES) WHAT ARE YOUR NAMES?")
(429 "DAXTER" "I'M DAXTER! HE'S JAK, HE'S WITH ME.")
(540 :offscreen "RED SAGE" "GOOD JOB, DAXTER. YOU'RE A REAL HERO.")
(670)
(700 "RED SAGE" "YOU'VE GOT TO STOP GOL FROM LAUNCHING THE ROBOT. I'LL USE MY ECO POWER TO HELP OPEN THE SHIELD DOOR.")
)
("bluesage-resolution"
(60 "BLUE SAGE" "GOOD WORK, FELLOWS! OLD SAMOS WAS RIGHT ABOUT YOU!")
(165 "BLUE SAGE" "GREAT PILES OF PRECURSOR METAL! THAT INSIDIOUS MECHANICAL CREATION MUST NOT BE ALLOWED TO WREAK ITS TERRIBLE HAVOC!")
(420 "BLUE SAGE" "I WILL TRY TO ACTUATE THE SHIELD DOOR BY ELLICITING A CONDUIT OF ENERGY BETWEEN MYSELF AND THE VAST PORTAL BELOW!")
(666 "DAXTER" "UH... YEAH. YOU DO THAT. WE'LL UH... JUST GO FIND MORE HELP.")
(873)
(891 :offscreen "DAXTER" "WEIRDO!")
(980)
)
("yellowsage-resolution"
(50 "YELLOW SAGE" "WHO WOULDA THOUGHT I'D LIVE TO SEE THE DAY WHEN I NEEDED TO BE RESCUED BY A BOY AND HIS MUSKRAT!")
(271 "YELLOW SAGE" "(SIGHS) I'M GONNA GIVE GOL AND MAIA A LITTLE PAYBACK FOR THIS EMBARRASSMENT!")
(480 "YELLOW SAGE" "THEN WE'LL SEE ABOUT COOKING UP SOME MUSKRAT STEW...")
(606)
)
("green-sagecage-resolution"
(30 "SAGE" "GOOD WORK, BOYS! YOU'RE REAL HEROES NOW. I'LL COMBINE MY GREEN ECO POWER WITH THE OTHER THREE SAGES")
(284 "SAGE" "AND TOGETHER WE'LL OPEN THE SHIELD DOOR SURROUNDING THE PRECURSOR ROBOT.")
(405 "DAXTER" "YEAH YEAH THAT SOUNDS LIKE A GOOD START. AND THEN AFTER YOU GUYS OPEN THAT SHIELD, WHAT ARE YOU GONNA DO ABOUT THE ROBOT?")
(576 "SAGE" "NOTHING, DAXTER. WE HAVE TO KEEP THE SHIELD OPEN, IT'S UP TO YOU TWO TO FIGURE OUT HOW TO DESTROY THE ROBOT.")
(823 "DAXTER" "OH, GREAT. I GET TO HELP THE GUY THAT TURNED ME INTO A FURBALL DESTROY THE ONLY PERSON WHO CAN TURN ME BACK!")
(1111)
(1156 "SAGE" "FIRST, SAVE THE WORLD! THEN WE'LL TRY TO CONVINCE GOL TO HELP DAXTER.")
)
("green-sagecage-outro-preboss"
(50 "GOL" "YOU'RE TOO LATE, SAMOS. ONCE I POSSESS LIMITLESS DARK ECO, I WILL HAVE THE KEY TO CREATION ITSELF!")
(335 "SAGE" "THIS IS MADNESS! RELEASING THAT MUCH DARK ECO WILL DESTROY EVERYTHING WE KNOW!")
(485 "SAGE" "JUST LOOK WHAT IT'S DONE TO YOU!")
(581 "MAIA" "IT HAS GIVEN US A BEAUTY BEYOND ANYTHING YOU COULD UNDERSTAND.")
(696 "DAXTER" "BEAUTY? HAVE YOU TWO LOOKED IN A MIRROR LATELY?")
(828 "MAIA" "JUST WAIT UNTIL WE OPEN THE SILOS, LITTLE ONE. YOU THINK SHORT AND FUZZY IS BAD?")
(1017 "GOL" "AND TO THINK, YOU TWO TRAVELLED ALL THIS WAY FOR MY HELP.")
(1180 "GOL" "FOOLS! ENJOY YOUR FRONT ROW SEATS TO THE RECREATION OF THE WORLD!")
(1382)
(1605 "SAGE" "JAK! TAKE THE ELEVATOR UP AND STOP THAT ROBOT!")
)
@@ -1,111 +0,0 @@
(language-id 0 6)
;; -----------------
;; oracle
("oracle-right-eye-1" (0 #f "ORACLE" "FOR YOUR GIFT, ANOTHER POWER CELL IS YOURS."))
("oracle-left-eye-1" (0 #f "ORACLE" "YOU HAVE PROVEN YOURSELF WORTHY. HERE IS A POWER CELL."))
("oracle-right-eye-2" (0 #f "ORACLE" "HERE IS ANOTHER POWER CELL FOR YOUR QUEST."))
("oracle-left-eye-2" (0 #f "ORACLE" "FOR YOUR SACRIFICE, I OFFER YOU A POWER CELL."))
("oracle-right-eye-3" (0 #f "ORACLE" "YOU HAVE OBTAINED ANOTHER POWER CELL."))
("oracle-left-eye-3" (0 #f "ORACLE" "FOR YOUR EFFORT, A POWER CELL IS THE REWARD."))
;; -----------------
;; swamp
("billy-introduction"
(6 #f "BILLY" "HOWDY, FRIENDS! ENJOYIN' MY BEAUTIFUL SWAMP? I OWN THESE HERE PARTS. EVERYTHING THAT DOESN'T SINK INTO THE MUD, THAT IS! (LAUGHS)")
(349 #f "" "")
(369 #f "DAXTER" "JUDGING BY THE SMELL, I'D WAGER YOUR BATHTUB SANK IN THE MUD LONG AGO.")
(497 #f "" "")
(519 #f "BILLY" "WHAT'S A BATHTUB? ANYWAY I GOT BIGGER PROBLEMS NOW...")
(677 #f "" "")
(691 #f "BILLY" "SEEMS SOME NASTY LURKER VARMINTS ARE GROUSIN' ABOUTS SNATCHIN' EVERYTHING THEY CAN GET THEIR GRUBBY LITTLE PAWS ON.")
(910 #f "BILLY" "AND SCARED AWAY MY PET HIPHOG, FARTHY.")
(1000 #f "BILLY" "HE'S BEEN MISSIN' FOR NIGH ON TO A COON'S AGE.")
(1136 #t "BILLY" "I'VE BEEN PUTTIN' OUT HIS FAVORITE SNACK, BUT THOSE ORNERY SWAMP RATS KEEP STEALIN' EM!")
(1318 #t "BILLY" "IF YOU COULD KEEP THOSE PESKY CRITTERS AWAY LONG ENOUGH, I JUST KNOW FARTHY WOULD SMELL THEM VITTLES AND COME BACK!")
(1509 #f "" "")
(1527 #f "BILLY" "WILL YA HELP ME OUT?")
)
("billy-reject"
(7 #f "BILLY" "WELL, IF YOU CHANGE YOUR MIND, YOU KNOW WHERE TO FIND ME! (LAUGHS)")
)
("billy-accept"
(5 #f "BILLY" "GOOD! THOSE RATS WILL BE BACK ANYTIME.")
(109 #f "BILLY" "SHOOT ALL THEM RATS, AND KEEP 'EM FROM EATING AT LEAST ONE OF THEM SNACKS.")
)
("billy-resolution"
(1 #f "BILLY" "WELL FRY MY HIDE! YOU SURE KNOW HOW TO SHOOT! THANKS A HEAP FOR THE HELP.")
)
("billy-reminder-1"
(36 #f "BILLY" "AHH, Y'ALL BACK TO HELP STOP THEM RATS?")
)
;; -----------------
;; citadel
("green-sagecage-introduction"
(130 #f "SAGE" "IT'S ABOUT TIME YOU TWO DECIDED TO SHOW UP!")
(207 #f "DAXTER" "NICE TO SEE YOU TOO! DO THEY HAVE YOU MOPPING THE FLOORS NOW?")
(343 #f "SAGE" "THERE'S NO TIME FOR JOKES, DAXTER. GOL AND MAIA KIDNAPPED US TO SAP OUR ENERGIES TO POWER THEIR ABOMINABLE MACHINE.")
(574 #t "SAGE" "IT APPEARS THEY HAVE COMBINED THE FUNCTIONAL REMAINS OF A PRECURSOR ROBOT WITH SCAVENGED ARTIFACTS FROM ACROSS THE LAND.")
(800 #t "SAGE" "THEN THEY ADDED A FEW DIABOLICAL ADDITIONS OF THEIR OWN, CREATING THE ONE THING CAPABLE OF OPENING THE DARK ECO SILOS.")
(1060 #f "SAGE" "IF YOU CAN FREE THE FOUR OF US, WE CAN USE OUR COMBINED POWERS")
(1180 #f "SAGE" "TO BREAK THE FORCE SHIELD SURROUNDING THE ROBOT, BEFORE THEY USE IT TO DESTROY THE WORLD.")
)
("redsage-resolution"
(60 #f "RED SAGE" "(CHUCKLES) YOU'VE FINALLY COME TO RESCUE ME.")
(190 #f "RED SAGE" "DO YOU KNOW HOW LONG I'VE BEEN IN HERE? WHAT TOOK YOU SO LONG, YOU KNOW? (CHUCKLES) WHAT ARE YOUR NAMES?")
(429 #f "DAXTER" "I'M DAXTER! HE'S JAK, HE'S WITH ME.")
(540 #t "RED SAGE" "GOOD JOB, DAXTER. YOU'RE A REAL HERO.")
(670 #f "" "")
(700 #f "RED SAGE" "YOU'VE GOT TO STOP GOL FROM LAUNCHING THE ROBOT. I'LL USE MY ECO POWER TO HELP OPEN THE SHIELD DOOR.")
)
("bluesage-resolution"
(60 #f "BLUE SAGE" "GOOD WORK, FELLOWS! OLD SAMOS WAS RIGHT ABOUT YOU!")
(165 #f "BLUE SAGE" "GREAT PILES OF PRECURSOR METAL! THAT INSIDIOUS MECHANICAL CREATION MUST NOT BE ALLOWED TO WREAK ITS TERRIBLE HAVOC!")
(420 #f "BLUE SAGE" "I WILL TRY TO ACTUATE THE SHIELD DOOR BY ELLICITING A CONDUIT OF ENERGY BETWEEN MYSELF AND THE VAST PORTAL BELOW!")
(666 #f "DAXTER" "UH... YEAH. YOU DO THAT. WE'LL UH... JUST GO FIND MORE HELP.")
(873 #f "" "")
(891 #t "DAXTER" "WEIRDO!")
(980 #f "" "")
)
("yellowsage-resolution"
(50 #f "YELLOW SAGE" "WHO WOULDA THOUGHT I'D LIVE TO SEE THE DAY WHEN I NEEDED TO BE RESCUED BY A BOY AND HIS MUSKRAT!")
(271 #f "YELLOW SAGE" "(SIGHS) I'M GONNA GIVE GOL AND MAIA A LITTLE PAYBACK FOR THIS EMBARRASSMENT!")
(480 #f "YELLOW SAGE" "THEN WE'LL SEE ABOUT COOKING UP SOME MUSKRAT STEW...")
(606 #f "" "")
)
("green-sagecage-resolution"
(30 #f "SAGE" "GOOD WORK, BOYS! YOU'RE REAL HEROES NOW. I'LL COMBINE MY GREEN ECO POWER WITH THE OTHER THREE SAGES")
(284 #f "SAGE" "AND TOGETHER WE'LL OPEN THE SHIELD DOOR SURROUNDING THE PRECURSOR ROBOT.")
(405 #f "DAXTER" "YEAH YEAH THAT SOUNDS LIKE A GOOD START. AND THEN AFTER YOU GUYS OPEN THAT SHIELD, WHAT ARE YOU GONNA DO ABOUT THE ROBOT?")
(576 #f "SAGE" "NOTHING, DAXTER. WE HAVE TO KEEP THE SHIELD OPEN, IT'S UP TO YOU TWO TO FIGURE OUT HOW TO DESTROY THE ROBOT.")
(823 #f "DAXTER" "OH, GREAT. I GET TO HELP THE GUY THAT TURNED ME INTO A FURBALL DESTROY THE ONLY PERSON WHO CAN TURN ME BACK!")
(1111 #f "" "")
(1156 #f "SAGE" "FIRST, SAVE THE WORLD! THEN WE'LL TRY TO CONVINCE GOL TO HELP DAXTER.")
)
("green-sagecage-outro-preboss"
(50 #f "GOL" "YOU'RE TOO LATE, SAMOS. ONCE I POSSESS LIMITLESS DARK ECO, I WILL HAVE THE KEY TO CREATION ITSELF!")
(335 #f "SAGE" "THIS IS MADNESS! RELEASING THAT MUCH DARK ECO WILL DESTROY EVERYTHING WE KNOW!")
(485 #f "SAGE" "JUST LOOK WHAT IT'S DONE TO YOU!")
(581 #f "MAIA" "IT HAS GIVEN US A BEAUTY BEYOND ANYTHING YOU COULD UNDERSTAND.")
(696 #f "DAXTER" "BEAUTY? HAVE YOU TWO LOOKED IN A MIRROR LATELY?")
(828 #f "MAIA" "JUST WAIT UNTIL WE OPEN THE SILOS, LITTLE ONE. YOU THINK SHORT AND FUZZY IS BAD?")
(1017 #f "GOL" "AND TO THINK, YOU TWO TRAVELLED ALL THIS WAY FOR MY HELP.")
(1180 #f "GOL" "FOOLS! ENJOY YOUR FRONT ROW SEATS TO THE RECREATION OF THE WORLD!")
(1382 #f "" "")
(1605 #f "SAGE" "JAK! TAKE THE ELEVATOR UP AND STOP THAT ROBOT!")
)
@@ -0,0 +1,6 @@
(language-id 3)
;; -----------------
;; oracle
("oracle-left-eye-1" (0 "ORÁCULO" "HABÉIS DEMOSTRADO SER HONESTOS. É AQUÍ UNA BATERÍA."))
@@ -1,6 +0,0 @@
(language-id 3)
;; -----------------
;; oracle
("oracle-left-eye-1" (0 #f "ORÁCULO" "HABÉIS DEMOSTRADO SER HONESTOS. É AQUÍ UNA BATERÍA."))
@@ -266,10 +266,11 @@ void OpenGLRenderer::init_bucket_renderers() {
init_bucket_renderer<RenderMux>("sprite", BucketCategory::SPRITE, BucketId::SPRITE,
std::move(sprite_renderers)); // 66
init_bucket_renderer<DirectRenderer>("debug-draw-0", BucketCategory::OTHER,
BucketId::DEBUG_DRAW_0, 0x20000);
init_bucket_renderer<DirectRenderer>("debug-draw-1", BucketCategory::OTHER,
BucketId::DEBUG_DRAW_1, 0x8000);
init_bucket_renderer<DirectRenderer>("debug", BucketCategory::OTHER, BucketId::DEBUG, 0x20000);
init_bucket_renderer<DirectRenderer>("debug-no-zbuf", BucketCategory::OTHER,
BucketId::DEBUG_NO_ZBUF, 0x8000);
init_bucket_renderer<DirectRenderer>("subtitle", BucketCategory::OTHER, BucketId::SUBTITLE,
0x2000);
// for now, for any unset renderers, just set them to an EmptyBucketRenderer.
for (size_t i = 0; i < m_bucket_renderers.size(); i++) {
@@ -502,4 +503,4 @@ void OpenGLRenderer::do_pcrtc_effects(float alp,
glEnable(GL_DEPTH_TEST);
}
}
}
+5 -4
View File
@@ -70,9 +70,10 @@ enum class BucketId {
// 64
PRE_SPRITE_TEX = 65, // maybe it's just common textures?
SPRITE = 66,
DEBUG_DRAW_0 = 67,
DEBUG_DRAW_1 = 68,
MAX_BUCKETS = 69
DEBUG = 67,
DEBUG_NO_ZBUF = 68,
SUBTITLE = 69,
MAX_BUCKETS = 70
};
enum class BucketCategory {
@@ -89,4 +90,4 @@ enum class BucketCategory {
};
constexpr const char* BUCKET_CATEGORY_NAMES[(int)BucketCategory::MAX_CATEGORIES] = {
"tfrag", "tie", "shrub", "tex", "merc", "mercneric", "sprite", "ocean", "other"};
"tfrag", "tie", "shrub", "tex", "merc", "mercneric", "sprite", "ocean", "other"};
+5 -5
View File
@@ -671,7 +671,7 @@
*temp-string*
(add-debug-text-3d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
*temp-string*
(-> arg0 bsphere)
(font-color orange-red)
@@ -1119,7 +1119,7 @@
(when *display-ambient-sound-marks*
(add-debug-text-3d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(symbol->string (res-lump-struct obj 'effect-name symbol :time 0.0))
gp-0
(font-color white)
@@ -1147,7 +1147,7 @@
(when (and (nonzero? a1-7) *common-text*)
(add-debug-text-3d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(lookup-text! *common-text* (the-as game-text-id a1-7) #f)
gp-0
(font-color white)
@@ -1213,7 +1213,7 @@
)
(add-debug-text-3d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(res-lump-struct obj 'name string)
gp-0
(font-color white)
@@ -1221,7 +1221,7 @@
)
(add-debug-text-3d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(symbol->string s5-0)
gp-0
(font-color white)
+5 -5
View File
@@ -249,7 +249,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
a2-0
(the-as (pointer dma-tag) a3-16)
)
@@ -1229,7 +1229,7 @@
(set! (-> a0-3 w) 1.0)
(vector+! a1-2 v1-4 a0-3)
)
(add-debug-line #t (bucket-id debug-draw1) gp-0 s5-0 (new 'static 'rgba :r #xff :a #x80) #f (the-as rgba -1))
(add-debug-line #t (bucket-id debug-no-zbuf) gp-0 s5-0 (new 'static 'rgba :r #xff :a #x80) #f (the-as rgba -1))
(let ((a1-5 s5-0)
(v1-5 gp-0)
(a0-5 s5-0)
@@ -1240,7 +1240,7 @@
(set! (-> a0-5 w) 1.0)
(vector+! a1-5 v1-5 a0-5)
)
(add-debug-line #t (bucket-id debug-draw1) gp-0 s5-0 (new 'static 'rgba :g #xff :a #x80) #f (the-as rgba -1))
(add-debug-line #t (bucket-id debug-no-zbuf) gp-0 s5-0 (new 'static 'rgba :g #xff :a #x80) #f (the-as rgba -1))
(let ((a1-8 s5-0)
(v1-6 gp-0)
(a0-7 s5-0)
@@ -1251,14 +1251,14 @@
(set! (-> a0-7 w) 1.0)
(vector+! a1-8 v1-6 a0-7)
)
(add-debug-line #t (bucket-id debug-draw1) gp-0 s5-0 (new 'static 'rgba :b #xff :a #x80) #f (the-as rgba -1))
(add-debug-line #t (bucket-id debug-no-zbuf) gp-0 s5-0 (new 'static 'rgba :b #xff :a #x80) #f (the-as rgba -1))
(when arg0
(set! (-> s5-0 quad) (-> arg0 quad))
(vector-normalize! s5-0 4096.0)
(vector+! s5-0 gp-0 s5-0)
(add-debug-line
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
gp-0
s5-0
(new 'static 'rgba :r #x7f :g #x7f :a #x80)
+1 -1
View File
@@ -168,7 +168,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-0
(the-as (pointer dma-tag) a3-4)
)
+1 -1
View File
@@ -1341,7 +1341,7 @@
(let ((t1-0 #x40000080))
(add-debug-flat-triangle
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (-> gp-0 0))
(-> gp-0 0 vertex 1)
(-> gp-0 0 vertex 2)
+1 -1
View File
@@ -328,7 +328,7 @@
(when *display-level-spheres*
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> s5-1 info bsphere)
(-> s5-1 info bsphere w)
(new 'static 'rgba :r #xff :a #x80)
+4 -4
View File
@@ -12,14 +12,14 @@
(let ((t1-0 (copy-and-set-field (-> *pat-mode-info* (-> gp-0 pat mode) color) a 64)))
(add-debug-flat-triangle
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (-> gp-0 vertex))
(-> gp-0 vertex 1)
(-> gp-0 vertex 2)
t1-0
)
(#when PC_PORT
(add-debug-outline-triangle #t (bucket-id debug-draw1) (-> gp-0 vertex 0) (-> gp-0 vertex 1) (-> gp-0 vertex 2)
(add-debug-outline-triangle #t (bucket-id debug-no-zbuf) (-> gp-0 vertex 0) (-> gp-0 vertex 1) (-> gp-0 vertex 2)
(static-rgba 0 0 0 64)
)
)
@@ -40,7 +40,7 @@
)
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (-> gp-1 prim-core))
(-> gp-1 prim-core world-sphere w)
t0-1
@@ -2506,7 +2506,7 @@
)
(when v1-12
;; uncomment to view the point that blocks you from exiting duck.
;;(add-debug-point #t (bucket-id debug-draw1) (-> s5-0 closest-pt))
;;(add-debug-point #t (bucket-id debug-no-zbuf) (-> s5-0 closest-pt))
(return #t)
)
)
+16 -16
View File
@@ -551,7 +551,7 @@
(defmethod debug-draw edge-grab-info ((obj edge-grab-info))
(add-debug-line
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (-> obj world-vertex))
(-> obj world-vertex 1)
(new 'static 'rgba :r #xff :a #x60)
@@ -560,28 +560,28 @@
)
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> obj center-hold)
204.8
(new 'static 'rgba :r #xff :g #xff :a #x80)
)
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> obj left-hand-hold)
204.8
(new 'static 'rgba :r #xff :g #xff :a #x60)
)
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> obj right-hand-hold)
204.8
(new 'static 'rgba :r #xff :g #xff :a #x60)
)
(add-debug-outline-triangle
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (-> obj tri-vertex))
(-> obj world-vertex 4)
(-> obj world-vertex 5)
@@ -615,7 +615,7 @@
((-> s3-0 ignore)
(add-debug-line
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
a2-0
a3-0
(new 'static 'rgba :r #x7f :g #x7f :b #x7f :a #x50)
@@ -627,7 +627,7 @@
(else
(add-debug-line
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
a2-0
a3-0
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x60)
@@ -636,7 +636,7 @@
)
(add-debug-vector
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
s2-0
(-> s3-0 outward)
(meters 0.3)
@@ -654,7 +654,7 @@
(defmethod debug-draw-sphere collide-edge-work ((obj collide-edge-work))
(dotimes (s5-0 (the-as int (-> obj num-verts)))
(let ((a2-0 (-> obj verts s5-0)))
(add-debug-sphere #t (bucket-id debug-draw1) a2-0 819.2 (new 'static 'rgba :r #xff :g #xff :a #x80))
(add-debug-sphere #t (bucket-id debug-no-zbuf) a2-0 819.2 (new 'static 'rgba :r #xff :g #xff :a #x80))
)
)
#f
@@ -671,28 +671,28 @@
(while s4-0
(+! s5-0 1)
(set! (-> s3-0 y) (-> s4-0 center-pt y))
(add-debug-sphere #t (bucket-id debug-draw1) s3-0 409.6 (new 'static 'rgba :a #x80))
(add-debug-sphere #t (bucket-id debug-no-zbuf) s3-0 409.6 (new 'static 'rgba :a #x80))
(cond
(s2-0
(set! s2-0 #f)
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> s4-0 center-pt)
614.4
(new 'static 'rgba :r #xff :g #xff :a #x80)
)
(add-debug-sphere #t (bucket-id debug-draw1) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #xff :a #x80))
(add-debug-sphere #t (bucket-id debug-no-zbuf) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #xff :a #x80))
)
(else
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> s4-0 center-pt)
614.4
(new 'static 'rgba :r #x7f :g #x7f :a #x40)
)
(add-debug-sphere #t (bucket-id debug-draw1) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #x7f :a #x40))
(add-debug-sphere #t (bucket-id debug-no-zbuf) (-> s4-0 outward-pt) 409.6 (new 'static 'rgba :r #x7f :a #x40))
)
)
(set! s4-0 (-> s4-0 next))
@@ -703,7 +703,7 @@
(dotimes (s5-1 (the-as int (-> obj num-attempts)))
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (-> obj attempts s5-1))
409.6
(new 'static 'rgba :a #x40)
@@ -719,7 +719,7 @@
)
(add-debug-outline-triangle
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (-> v1-3 vertex))
(-> v1-3 vertex 1)
(-> v1-3 vertex 2)
+1 -1
View File
@@ -73,7 +73,7 @@
(.svf (&-> a2-1 quad) vf1)
(.svf (&-> a3-0 quad) vf2)
(.svf (&-> t0-0 quad) vf3)
(add-debug-flat-triangle #t (bucket-id debug-draw1) a2-1 a3-0 t0-0 t1-0)
(add-debug-flat-triangle #t (bucket-id debug-no-zbuf) a2-1 a3-0 t0-0 t1-0)
)
)
(set! s5-0 (-> (the-as (inline-array collide-mesh-tri) s5-0) 1))
+10 -10
View File
@@ -1183,7 +1183,7 @@
(let ((t1-0 (-> *pat-mode-info* (-> s5-0 best-tri pat mode) hilite-color)))
(add-debug-outline-triangle
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (-> s5-0 best-tri))
(-> s5-0 best-tri vertex 1)
(-> s5-0 best-tri vertex 2)
@@ -1192,7 +1192,7 @@
)
(add-debug-vector
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> s5-0 best-tri intersect)
s2-1
(meters 0.00007324219)
@@ -1200,7 +1200,7 @@
)
(add-debug-vector
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> s5-0 best-tri intersect)
arg0
(meters 0.00007324219)
@@ -1209,7 +1209,7 @@
(if (= (-> obj process type) target)
(add-debug-vector
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> s5-0 best-tri intersect)
(-> obj surface-normal)
(meters 0.5)
@@ -1746,7 +1746,7 @@
(when (and *display-collide-cache* (= (-> obj process type) target))
(debug-draw *collide-cache*)
;; NOTE: added
(add-debug-box #t (bucket-id debug-draw0) (-> s5-0 min) (-> s5-0 max) (new 'static 'rgba :a #x80 :b #x70 :g #x70))
(add-debug-box #t (bucket-id debug) (-> s5-0 min) (-> s5-0 max) (new 'static 'rgba :a #x80 :b #x70 :g #x70))
)
)
(else
@@ -2030,7 +2030,7 @@
"Draw collision debug."
(add-debug-sphere
(or *display-collision-marks* *display-target-marks*)
(bucket-id debug-draw0)
(bucket-id debug)
(target-pos 0)
819.2
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
@@ -2439,7 +2439,7 @@
"Draw our sphere"
(add-debug-sphere
#t
(bucket-id debug-draw0)
(bucket-id debug)
(the-as vector (-> obj prim-core))
(-> obj local-sphere w)
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x40)
@@ -2450,7 +2450,7 @@
"Draw our sphere"
(add-debug-sphere
#t
(bucket-id debug-draw0)
(bucket-id debug)
(the-as vector (-> obj prim-core))
(-> obj local-sphere w)
(the-as rgba (cond
@@ -2472,7 +2472,7 @@
"Draw our sphere"
(add-debug-sphere
#t
(bucket-id debug-draw0)
(bucket-id debug)
(the-as vector (-> obj prim-core))
(-> obj local-sphere w)
(new 'static 'rgba :b #xff :a #x40)
@@ -2483,7 +2483,7 @@
"Draw our sphere"
(add-debug-sphere
#t
(bucket-id debug-draw0)
(bucket-id debug)
(the-as vector (-> obj prim-core))
(-> obj local-sphere w)
(new 'static 'rgba :g #xff :a #x10)
+1 -1
View File
@@ -209,7 +209,7 @@
(.svf (&-> a2-0 quad) vf9)
(add-debug-sphere
#t
(bucket-id debug-draw0)
(bucket-id debug)
a2-0
a3-0
(new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)
+19 -19
View File
@@ -216,7 +216,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s5-3
(the-as (pointer dma-tag) a3-6)
)
@@ -345,7 +345,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s5-6
(the-as (pointer dma-tag) a3-12)
)
@@ -847,7 +847,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-0
(the-as (pointer dma-tag) a3-2)
)
@@ -942,7 +942,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s4-0
(the-as (pointer dma-tag) a3-2)
)
@@ -1017,7 +1017,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s5-2
(the-as (pointer dma-tag) a3-4)
)
@@ -1070,7 +1070,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s4-0
(the-as (pointer dma-tag) a3-2)
)
@@ -1189,7 +1189,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s5-1
(the-as (pointer dma-tag) a3-4)
)
@@ -1246,7 +1246,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s4-0
(the-as (pointer dma-tag) a3-2)
)
@@ -1360,7 +1360,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s5-1
(the-as (pointer dma-tag) a3-4)
)
@@ -1535,7 +1535,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s1-0
(the-as (pointer dma-tag) a3-4)
)
@@ -1586,7 +1586,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s1-1
(the-as (pointer dma-tag) a3-8)
)
@@ -1680,7 +1680,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
(the-as pointer s4-1)
(the-as (pointer dma-tag) a3-15)
)
@@ -1977,7 +1977,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-2
(the-as (pointer dma-tag) a3-17)
)
@@ -2008,7 +2008,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-3
(the-as (pointer dma-tag) a3-21)
)
@@ -2066,7 +2066,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-1
(the-as (pointer dma-tag) a3-1)
)
@@ -2108,7 +2108,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-3
(the-as (pointer dma-tag) a3-3)
)
@@ -2151,7 +2151,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-4
(the-as (pointer dma-tag) a3-5)
)
@@ -2182,7 +2182,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-5
(the-as (pointer dma-tag) a3-7)
)
@@ -2246,7 +2246,7 @@
(debug-print-channels (-> self skel) (the-as symbol *stdcon*))
(add-debug-x
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self root trans)
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
)
+2 -2
View File
@@ -894,7 +894,7 @@
(set! (-> gp-0 0 x) (* (sin (-> arg0 stick0-dir)) (-> arg0 stick0-speed)))
(set! (-> gp-0 0 y) (* (cos (-> arg0 stick0-dir)) (-> arg0 stick0-speed)))
(dotimes (s5-1 32)
(with-dma-buffer-add-bucket ((s3-0 (-> (current-frame) debug-buf)) (bucket-id debug-draw0))
(with-dma-buffer-add-bucket ((s3-0 (-> (current-frame) debug-buf)) (bucket-id debug))
(draw-sprite2d-xy s3-0
(the int (* 120.0 (-> gp-0 s5-1 x)))
(the int (* 144.0 (-> gp-0 s5-1 y)))
@@ -1010,7 +1010,7 @@
(when arg1
(dotimes (s5-1 (1- (-> arg0 num-points)))
(if (!= (+ s5-1 1) (-> arg0 h-first))
(add-debug-line #t (bucket-id debug-draw1)
(add-debug-line #t (bucket-id debug-no-zbuf)
(-> arg0 points s5-1)
(-> arg0 points (1+ s5-1))
(static-rgba #x80 #xc0 #x80 #x80) #f (the-as rgba -1))
+6 -6
View File
@@ -760,7 +760,7 @@
(else (font-color dim-gray)) ;; a parent, but not selected
))
(with-dma-buffer-add-bucket ((s3-0 (-> (current-frame) debug-buf))
(bucket-id debug-draw1))
(bucket-id debug-no-zbuf))
;; NOTE: the draw-string-adv advances too far on widescreen.
;; NOTE 2: should be fixed?
(draw-string-adv (-> item name) s3-0 s5-0)
@@ -797,7 +797,7 @@
)
)
(with-dma-buffer-add-bucket ((s4-0 (-> (current-frame) debug-buf))
(bucket-id debug-draw1))
(bucket-id debug-no-zbuf))
(draw-string (-> item name) s4-0 v1-2)
)
)
@@ -828,7 +828,7 @@
)
)
(with-dma-buffer-add-bucket ((s4-0 (-> (current-frame) debug-buf))
(bucket-id debug-draw1))
(bucket-id debug-no-zbuf))
(draw-string (-> item name) s4-0 v1-2)
)
)
@@ -856,7 +856,7 @@
)
)
(with-dma-buffer-add-bucket ((s1-0 (-> (current-frame) debug-buf))
(bucket-id debug-draw1))
(bucket-id debug-no-zbuf))
(draw-string-adv (-> item name) s1-0 s5-0)
(draw-string-adv ":" s1-0 s5-0)
(cond
@@ -940,7 +940,7 @@
)
)
(with-dma-buffer-add-bucket ((s0-0 (-> (current-frame) debug-buf))
(bucket-id debug-draw1))
(bucket-id debug-no-zbuf))
;; PC PORT : fixed for widescreen
(draw-sprite2d-xy s0-0 (correct-x-int x-pos) y-pos (correct-x-int (-> menu pix-width)) (-> menu pix-height) (static-rgba #x00 #x00 #x00 #x40))
)
@@ -964,7 +964,7 @@
)
(set-origin! (-> menu context font) s3-1 s2-1)
(with-dma-buffer-add-bucket ((sv-16 (-> (current-frame) debug-buf))
(bucket-id debug-draw1))
(bucket-id debug-no-zbuf))
(draw-string ">" sv-16 (-> menu context font))
)
)
+1 -1
View File
@@ -54,7 +54,7 @@
)
(add-debug-x
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self root trans)
(the-as rgba (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80))
)
+1 -1
View File
@@ -463,7 +463,7 @@
(defmacro with-dma-buffer-add-bucket (bindings &key (bucket-group (-> (current-frame) bucket-group)) &rest body)
"Bind a dma-buffer to a variable and use it on a block to allow adding things to a new bucket.
usage: (with-dma-buffer-add-bucket ((buffer-name buffer) bucket-id) &rest body)
example: (with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf)) (bucket-id debug-draw1)) ...)"
example: (with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf)) (bucket-id debug-no-zbuf)) ...)"
`(let ((,(caar bindings) ,(cadar bindings)))
(with-dma-bucket (,(caar bindings) ,bucket-group ,(cadr bindings))
+13 -10
View File
@@ -183,7 +183,7 @@
(next 2) ;; addr=after tag, next-tag=ADDR
(ref 3) ;; addr=ADDR, next-tag=after tag
(refs 4) ;; ref, but stall controled
(call 5) ;;
(call 5) ;;
(ret 6) ;;
(end 7) ;; next, but ends.
)
@@ -208,11 +208,11 @@
;; DMA data is divided into buckets.
;; At the end of a frame, the buckets are all connected together and sent.
;; the buckets are organized by renderer.
(defconstant BUCKET_COUNT (#if PC_PORT 70 69))
(defenum bucket-id
:type int32
:bitfield #f
(bucket-0 0) ;; ?
(bucket-1 1) ;; ?
(bucket-2 2) ;; ?
@@ -236,11 +236,11 @@
(gmerc-tfrag-tex1 18) ;; generic merc, with tfrag textures, level 1
(shrub-tex0 19)
(shrub0 20)
(shrub-tex1 25)
(shrub1 26)
(generic-foreground 30) ;; ?
(alpha-tex0 31)
@@ -258,11 +258,11 @@
(tfrag-dirt-near-1 42)
(tfrag-ice-1 43)
(tfrag-ice-near-1 44)
(bucket-45 45) ;; merc
(bucket-46 46)
(shadow 47)
(pris-tex0 48)
@@ -296,9 +296,12 @@
(pre-sprite-textures 65) ;; common
(sprite 66)
;; debug spheres? 67
(debug-draw0 67)
(debug 67)
;; debug text 68
(debug-draw1 68)
(debug-no-zbuf 68)
;; extra buckets for pc port
(subtitle 69)
)
;; A DMA bucket is a way of sorting data within a dma buffer.
+15 -17
View File
@@ -134,12 +134,12 @@
(when (sphere-cull (-> arg0 bsphere))
(add-debug-sphere
#t
(bucket-id debug-draw0)
(bucket-id debug)
(-> arg0 bsphere)
(-> arg0 bsphere w)
(new 'static 'rgba :r #x80 :a #x80)
)
(add-debug-text-3d #t (bucket-id debug-draw1) arg1 (-> arg0 bsphere) (font-color white) (the-as vector2h #f))
(add-debug-text-3d #t (bucket-id debug-no-zbuf) arg1 (-> arg0 bsphere) (font-color white) (the-as vector2h #f))
)
)
)
@@ -659,7 +659,7 @@
(if *display-lights*
(add-debug-lights
#t
(bucket-id debug-draw0)
(bucket-id debug)
(the-as (inline-array light) (-> s3-0 light-group))
(-> arg1 origin)
)
@@ -899,7 +899,6 @@
(none)
)
;; definition for symbol *debug-hook*, type (function none)
(define *debug-hook* main-debug-hook)
(define *add-sphere* #f)
@@ -908,9 +907,9 @@
(defun real-main-draw-hook ()
"The main drawing function. This dispatches all renderers and is called directly from the display-loop
in main.gc."
in main.gc"
(when *slow-frame-rate*
(dotimes (v1-2 40000000) ;; was 50000
(dotimes (v1-2 50000000) ;; was 50000
(nop!)
(nop!)
(nop!)
@@ -919,7 +918,7 @@
(nop!)
)
)
"Function to be executed to set up for engine dma"
"Function to be executed to set up for engine dma" ;; accidental docstring from the original game
;; update render enables from the debug menu
(set! *vu1-enable-user* *vu1-enable-user-menu*)
@@ -1333,7 +1332,7 @@
;; get the increment in seconds unit.
(let ((scaled-seconds (* (the int time-ratio) (the int (-> disp time-factor)))))
;; tell the sparticle system
(set-particle-frame-time (min 12 scaled-seconds))
(set-particle-frame-time (min (seconds 0.04) scaled-seconds))
;; the "not real" frame counters only count when unpaused
(when (not (paused?))
@@ -1433,15 +1432,14 @@
)
;; add the buckets
(set! (-> new-frame bucket-group)(dma-buffer-add-buckets (-> new-frame calc-buf) 69))
(set! (-> new-frame bucket-group) (dma-buffer-add-buckets (-> new-frame calc-buf) BUCKET_COUNT))
)
;; initialize the debug bucket
(debug-init-buffer
(bucket-id debug-draw1)
(new 'static 'gs-zbuf :zbp #x1c0 :psm (gs-psm ct24) :zmsk #x1)
(new 'static 'gs-test :zte #x1 :ztst (gs-ztest always))
)
(debug-init-buffer (bucket-id debug-no-zbuf)
(new 'static 'gs-zbuf :zbp #x1c0 :psm (gs-psm ct24) :zmsk #x1)
(new 'static 'gs-test :zte #x1 :ztst (gs-ztest always))
)
;; setup our drawing offset for even/odd offset
(set-draw-env-offset (-> disp frames new-frame-idx draw) 2048 2048 odd-even)
@@ -1465,7 +1463,7 @@
(*post-draw-hook* (-> disp frames (-> disp on-screen) frame calc-buf))
;; iterate through all buckets and append a final GS state reset.
(dotimes (bucket-idx 69)
(dotimes (bucket-idx BUCKET_COUNT)
(let* ((this-global-buf (-> this-frame global-buf))
(a2-0 (-> this-global-buf base))
)
@@ -1517,7 +1515,7 @@
(set! (-> v1-14 base) (&+ (the-as pointer a0-10) 16))
)
;; patch the buckets. Now sending the calc buf will send everything!
(dma-buffer-patch-buckets (-> this-frame bucket-group) 69)
(dma-buffer-patch-buckets (-> this-frame bucket-group) BUCKET_COUNT)
;; append the final END.
(let* ((v1-15 this-calc-buf)
(a0-13 (the-as object (-> v1-15 base)))
@@ -1574,7 +1572,7 @@
(>= (the-as int (-> *display* base-frame-counter)) (the-as int (-> *game-info* blackout-time)))
;; this is a hack. this is initialized to #x493e0. It prevents controller-loss pause from
;; triggering in the first few seconds of gameplay.
(< #x49764 (the-as int (-> *display* real-frame-counter)))
(< (seconds 1003) (-> *display* real-frame-counter))
)
(and (logtest? (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r2)) ;; debug press
(paused?)
+4 -4
View File
@@ -271,7 +271,7 @@
(defun execute-math-engine ()
(#when PC_PORT
(with-dma-buffer-add-bucket ((debug-buf (-> (current-frame) debug-buf))
(bucket-id debug-draw1))
(bucket-id debug-no-zbuf))
(when (-> *pc-settings* display-actor-counts)
(draw-string-xy (string-format "M: ~D/~D A: ~D" (-> *matrix-engine* length) MATRIX_ENGINE_AMOUNT (process-count *active-pool*)) debug-buf 8 (- 224 18) (font-color default) (font-flags shadow kerning))
)
@@ -300,7 +300,7 @@
(when (and parent (nonzero? parent) (-> parent joint) (-> parent parent))
(let ((child (vector<-cspace! (new-stack-vector0) (-> obj node-list data i)))
)
(add-debug-line #t (bucket-id debug-draw0) child (vector<-cspace! (new-stack-vector0) parent) (new 'static 'rgba :g #xff :a #x40) #f (the rgba -1))
(add-debug-line #t (bucket-id debug) child (vector<-cspace! (new-stack-vector0) parent) (new 'static 'rgba :g #xff :a #x40) #f (the rgba -1))
)
)
)
@@ -402,8 +402,8 @@
(defun draw-joint-spheres ((arg0 process-drawable))
(dotimes (s5-0 (-> arg0 node-list length))
(let ((a2-0 (vector<-cspace! (new-stack-vector0) (-> arg0 node-list data s5-0))))
(add-debug-sphere #t (bucket-id debug-draw0) a2-0 819.2 (new 'static 'rgba :g #xff :a #x40))
;;(add-debug-text-sphere #t (bucket-id debug-draw0) a2-0 819.2 (the string (-> arg0 node-list data s5-0 joint name)) (new 'static 'rgba :g #xff :a #x40))
(add-debug-sphere #t (bucket-id debug) a2-0 819.2 (new 'static 'rgba :g #xff :a #x40))
;;(add-debug-text-sphere #t (bucket-id debug) a2-0 819.2 (the string (-> arg0 node-list data s5-0 joint name)) (new 'static 'rgba :g #xff :a #x40))
)
)
#f
+15 -15
View File
@@ -862,7 +862,7 @@
(let ((s1-1 (the-as process-drawable (-> s0-0 extra process))))
(add-debug-x
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> s1-1 root trans)
(new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80)
)
@@ -878,7 +878,7 @@
)
(add-debug-text-3d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(symbol->string (-> s1-1 state name))
(-> s1-1 root trans)
(font-color white)
@@ -910,7 +910,7 @@
(if (and (the-as structure v0-10) (= (-> v0-10 type) symbol))
(add-debug-text-3d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(symbol->string v0-10)
(-> s1-1 root trans)
(font-color white)
@@ -921,7 +921,7 @@
)
)
((or (= arg0 'full) (-> s0-0 extra process))
(add-debug-x #t (bucket-id debug-draw1) s1-0 (the-as rgba (if (-> s0-0 extra process)
(add-debug-x #t (bucket-id debug-no-zbuf) s1-0 (the-as rgba (if (-> s0-0 extra process)
(the-as uint #x8080ff80)
(the-as uint #x800000ff)
)
@@ -982,13 +982,13 @@
(when (and (type-type? (-> s0-3 type) process-drawable) (nonzero? (-> (the-as process-drawable s0-3) draw)))
(add-debug-x
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> (the-as process-drawable s0-3) root trans)
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
)
(add-debug-sphere
#t
(bucket-id debug-draw0)
(bucket-id debug)
(vector+!
(new 'stack-no-clear 'vector)
(-> (the-as process-drawable s0-3) draw origin)
@@ -1022,7 +1022,7 @@
(s4-2 (-> (the-as process-drawable s5-2) root trans))
)
(when s3-2
(add-debug-x #t (bucket-id debug-draw1) s4-2 (the-as rgba (if (-> s3-2 extra process)
(add-debug-x #t (bucket-id debug-no-zbuf) s4-2 (the-as rgba (if (-> s3-2 extra process)
(the-as uint #x8080ff80)
(the-as uint #x800000ff)
)
@@ -1030,7 +1030,7 @@
)
(add-debug-text-3d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(res-lump-struct s3-2 'name string)
s4-2
(the-as font-color (if (logtest? (-> s3-2 extra perm status) (entity-perm-status bit-0 bit-1))
@@ -1042,7 +1042,7 @@
)
(add-debug-text-3d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(symbol->string (-> (the-as process-drawable s5-2) state name))
s4-2
(font-color white)
@@ -1071,7 +1071,7 @@
)
(add-debug-sphere
#t
(bucket-id debug-draw0)
(bucket-id debug)
(vector+!
(new 'stack-no-clear 'vector)
(-> (the-as process-drawable s5-2) draw origin)
@@ -1091,7 +1091,7 @@
(if v0-35
(add-debug-box
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (&+ v0-35 0))
(the-as vector (&+ v0-35 16))
(the-as rgba (if (is-object-visible? (-> s5-3 extra level) a1-31)
@@ -1155,7 +1155,7 @@
(countdown (s2-4 (-> s3-4 length))
(add-debug-box
#t
(bucket-id debug-draw0)
(bucket-id debug)
(the-as vector (-> s3-4 data s2-4))
(the-as vector (+ (the-as uint (-> s3-4 data 0 max)) (* s2-4 32)))
(the-as rgba (if (zero? (-> s4-4 index))
@@ -1936,14 +1936,14 @@
(let* ((e (-> inspect-info entity)) (name (res-lump-struct e 'name string)))
(set! *display-actor-anim* (the string (and (-> inspect-info show-actor-info) name)))
;; draw trans
(add-debug-x #t (bucket-id debug-draw1) (-> e trans) (static-rgba 255 255 0 128))
(add-debug-x #t (bucket-id debug-no-zbuf) (-> e trans) (static-rgba 255 255 0 128))
(if (or (not (-> inspect-info show-actor-info)) (!= (-> e type) entity-actor) (and (= (-> e type) entity-actor) (not (-> (the entity-actor e) extra process))))
(add-debug-text-3d #t (bucket-id debug-draw1) name (-> e trans) (font-color red) (new 'static 'vector2h :y 8)))
(add-debug-text-3d #t (bucket-id debug-no-zbuf) name (-> e trans) (font-color red) (new 'static 'vector2h :y 8)))
;; start writing text
(let* ((begin-y (- 16 (* (-> inspect-info scroll-y) 8))) (cur-y begin-y) (y-adv 8))
(with-dma-buffer-add-bucket ((debug-buf (-> (current-frame) debug-buf))
(bucket-id debug-draw1))
(bucket-id debug-no-zbuf))
;; basic info, actor id, etc
(draw-string-xy
(string-format "~3L~A~0L ~A~%tags: ~D size: ~D aid: #x~x~%R1/L1 scroll L3 toggle display-actor-info~%--------------------" (-> e type) name (length e) (asize-of e) (-> e aid))
+5 -5
View File
@@ -29,8 +29,8 @@
)
;; add text and vector
(add-debug-text-sphere #t (bucket-id debug-draw1) (-> obj trans) 819.2 (symbol->string (-> obj name)) s5-0)
(add-debug-vector #t (bucket-id debug-draw1) (-> obj trans) (-> obj normal) 8192.0 s5-0)
(add-debug-text-sphere #t (bucket-id debug-no-zbuf) (-> obj trans) 819.2 (symbol->string (-> obj name)) s5-0)
(add-debug-vector #t (bucket-id debug-no-zbuf) (-> obj trans) (-> obj normal) 8192.0 s5-0)
)
0
(none)
@@ -929,12 +929,12 @@
(defmethod debug-draw! continue-point ((obj continue-point))
"Draw a continue point."
(add-debug-x #t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> obj trans)
(new 'static 'rgba :r #xff :a #x80)
)
(add-debug-text-3d #t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> obj name)
(-> obj trans)
(font-color white)
@@ -943,7 +943,7 @@
(let ((a3-2 (vector-z-quaternion! (new-stack-vector0) (-> obj quat))))
(add-debug-vector
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> obj trans)
a3-2
8192.0
+6 -6
View File
@@ -18,7 +18,7 @@
(defun letterbox ()
"Draw the letterbox black rectangles"
(with-dma-buffer-add-bucket ((dma-buf (-> (current-frame) global-buf))
(bucket-id debug-draw1)) ;; debug-draw1 is one of the last buckets
(bucket-id debug-no-zbuf)) ;; debug-no-zbuf is one of the last buckets
;; draw the two sprites
(#cond
((not PC_PORT)
@@ -75,7 +75,7 @@
(defun blackout ()
"Draw the blackout rectangle, convering the entire screen in darkness."
(with-dma-buffer-add-bucket ((dma-buf (-> (current-frame) global-buf))
(bucket-id debug-draw1)) ;; debug-draw1 is one of the last buckets
(bucket-id debug-no-zbuf)) ;; debug-no-zbuf is one of the last buckets
(draw-sprite2d-xy dma-buf 0 0 512 224 (new 'static 'rgba :a #x80))
)
(none)
@@ -330,7 +330,7 @@
)
(defmethod draw screen-filter ((obj screen-filter))
(with-dma-buffer-add-bucket ((buf (-> (current-frame) global-buf)) (bucket-id debug-draw1))
(with-dma-buffer-add-bucket ((buf (-> (current-frame) global-buf)) (bucket-id debug-no-zbuf))
(draw-sprite2d-xy buf -256 (- (-> *video-parms* screen-hy)) 512 (-> *video-parms* screen-sy) (-> obj color))
)
(none)
@@ -467,7 +467,7 @@
(-> (current-frame) debug-buf)
(-> (current-frame) global-buf)
))
(bucket-id debug-draw0))
(bucket-id debug))
(show-iop-memory dma-buff)
)
)
@@ -749,7 +749,7 @@
;; debug dma
(with-dma-buffer-add-bucket ((debug-buf (-> disp frames (-> disp on-screen) frame debug-buf))
(bucket-id debug-draw1))
(bucket-id debug-no-zbuf))
(when *display-profile*
(dma-buffer-add-gs-set debug-buf
(alpha-1 (new 'static 'gs-alpha :b 1 :d 1))
@@ -850,7 +850,7 @@
(-> disp frames (-> disp on-screen) frame debug-buf)
(-> disp frames (-> disp on-screen) frame global-buf)
))
(bucket-id debug-draw0))
(bucket-id debug))
(if (and (= *master-mode* 'pause) (!= *cheat-mode* 'camera))
(draw-string-xy (lookup-text! *common-text* (game-text-id pause) #f)
s3-1 256 160 (font-color orange-red) (font-flags shadow kerning middle large))
@@ -89,7 +89,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s5-0
(the-as (pointer dma-tag) a3-4)
)
@@ -118,7 +118,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s5-1
(the-as (pointer dma-tag) a3-7)
)
+1 -1
View File
@@ -192,7 +192,7 @@
(dotimes (s3-0 (/ (-> obj point-count) 2))
(add-debug-line
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector s4-0)
(the-as vector (&-> s4-0 4))
(the-as rgba s5-0)
+5 -5
View File
@@ -1122,15 +1122,15 @@
(+! (-> p3 x) (+ x0 3145728.0))
(+! (-> p3 z) (+ y0 3145728.0))
(add-debug-flat-triangle #t (bucket-id debug-draw1) p0 p1s p2s color0)
;; (add-debug-flat-triangle #t (bucket-id debug-draw1) p3 p1 p2 color0)
(add-debug-outline-triangle #t (bucket-id debug-draw1) p0 p1 p2 color1)
(add-debug-outline-triangle #t (bucket-id debug-draw1) p3 p1 p2 color1)
(add-debug-flat-triangle #t (bucket-id debug-no-zbuf) p0 p1s p2s color0)
;; (add-debug-flat-triangle #t (bucket-id debug-no-zbuf) p3 p1 p2 color0)
(add-debug-outline-triangle #t (bucket-id debug-no-zbuf) p0 p1 p2 color1)
(add-debug-outline-triangle #t (bucket-id debug-no-zbuf) p3 p1 p2 color1)
(format (clear *temp-string*) "o: ~d ~d ~d ~b" x y (+ (* 6 y) x) masks)
(add-debug-text-3d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
*temp-string*
p0
(font-color orange-red)
+1 -1
View File
@@ -122,7 +122,7 @@
(vector+! s5-0 s5-0 (-> arg0 root trans))
(add-debug-sphere
#t
(bucket-id debug-draw0)
(bucket-id debug)
s5-0
2048.0
(new 'static 'rgba :r #xff :g #xff :a #x80)
+3 -3
View File
@@ -17,7 +17,7 @@
(dotimes (s3-0 (/ (-> s4-0 length) 2))
(add-debug-line
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> s4-0 data (* s3-0 2))
(-> s4-0 data (+ (* s3-0 2) 1))
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
@@ -999,8 +999,8 @@
(-> arg1 global-buf)
(edge-debug-lines (-> obj debug-data debug-lines))
(add-debug-sphere #t (bucket-id debug-draw0) (-> obj bsphere) (-> obj bsphere w) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80))
;;(add-debug-x #t (bucket-id debug-draw0) (-> obj bsphere) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80))
(add-debug-sphere #t (bucket-id debug) (-> obj bsphere) (-> obj bsphere w) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80))
;;(add-debug-x #t (bucket-id debug) (-> obj bsphere) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80))
(none)
)
+3 -3
View File
@@ -382,7 +382,7 @@
(logtest? (-> *display* real-actual-frame-counter) 4)
)
))
(with-dma-buffer-add-bucket ((s5-0 (-> (current-frame) global-buf)) (bucket-id debug-draw0))
(with-dma-buffer-add-bucket ((s5-0 (-> (current-frame) global-buf)) (bucket-id debug))
(dma-buffer-add-gs-set-flusha s5-0
(zbuf-1 (new 'static 'gs-zbuf :zbp #x1c0 :psm (gs-psm ct24)))
(test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest greater-equal) :aref #x26 :zte #x1 :ztst (gs-ztest greater-equal)))
@@ -501,7 +501,7 @@
(set! (-> s2-0 y) (-> s5-0 top-plane))
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
s2-0
8192.0
(new 'static 'rgba :a #x80)
@@ -510,7 +510,7 @@
(set! (-> s2-0 y) (-> s5-0 bot-plane))
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
s2-0
8192.0
(new 'static 'rgba :a #x80)
+17 -17
View File
@@ -190,7 +190,7 @@
)
(add-debug-line
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(vector+! gp-0 s5-0 (the-as vector (-> s2-0 (-> arg0 vertex 0))))
(vector+! s4-0 s5-0 (the-as vector (-> s2-0 (-> arg0 vertex 1))))
arg1
@@ -199,7 +199,7 @@
)
(add-debug-line
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(vector+! gp-0 s5-0 (the-as vector (-> s2-0 (-> arg0 vertex 1))))
(vector+! s4-0 s5-0 (the-as vector (-> s2-0 (-> arg0 vertex 2))))
arg1
@@ -208,7 +208,7 @@
)
(add-debug-line
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(vector+! gp-0 s5-0 (the-as vector (-> s2-0 (-> arg0 vertex 2))))
(vector+! s4-0 s5-0 (the-as vector (-> s2-0 (-> arg0 vertex 0))))
arg1
@@ -1630,18 +1630,18 @@
(set! (-> s5-0 debug-time) (the-as uint (-> *display* actual-frame-counter)))
(add-debug-sphere
(logtest? (-> obj flags) (nav-control-flags navcf1))
(bucket-id debug-draw0)
(bucket-id debug)
(-> s5-0 bounds)
(-> s5-0 bounds w)
(new 'static 'rgba :r #xff :g #xff :a #x20)
)
(add-debug-vector #t (bucket-id debug-draw1) (-> s5-0 origin) *x-vector* (meters 1.0) *color-red*)
(add-debug-vector #t (bucket-id debug-draw1) (-> s5-0 origin) *z-vector* (meters 1.0) *color-blue*)
(add-debug-vector #t (bucket-id debug-no-zbuf) (-> s5-0 origin) *x-vector* (meters 1.0) *color-red*)
(add-debug-vector #t (bucket-id debug-no-zbuf) (-> s5-0 origin) *z-vector* (meters 1.0) *color-blue*)
(when (logtest? (-> obj flags) (nav-control-flags navcf2))
(dotimes (s3-0 (-> s5-0 vertex-count))
(add-debug-x
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(vector+! s4-0 (-> s5-0 origin) (the-as vector (-> s5-0 vertex s3-0)))
*color-green*
)
@@ -1677,9 +1677,9 @@
(set! (-> s0-0 x) (- (-> a0-15 x) (-> v1-20 x)))
(set! (-> s0-0 y) (+ (-> a0-15 y) (-> v1-20 y)))
(set! (-> s0-0 z) (+ (-> a0-15 z) (-> v1-20 z)))
(add-debug-line #t (bucket-id debug-draw1) sv-192 s2-0 (the-as rgba sv-208) #f (the-as rgba -1))
(add-debug-line #t (bucket-id debug-draw1) s2-0 s1-0 (the-as rgba sv-208) #f (the-as rgba -1))
(add-debug-line #t (bucket-id debug-draw1) s1-0 s0-0 (the-as rgba sv-208) #f (the-as rgba -1))
(add-debug-line #t (bucket-id debug-no-zbuf) sv-192 s2-0 (the-as rgba sv-208) #f (the-as rgba -1))
(add-debug-line #t (bucket-id debug-no-zbuf) s2-0 s1-0 (the-as rgba sv-208) #f (the-as rgba -1))
(add-debug-line #t (bucket-id debug-no-zbuf) s1-0 s0-0 (the-as rgba sv-208) #f (the-as rgba -1))
(let ((t9-7 add-debug-line)
(a0-19 #t)
(a1-13 68)
@@ -1755,7 +1755,7 @@
(when (logtest? (-> obj flags) (nav-control-flags navcf7))
(dotimes (s3-3 (the-as int (-> s5-0 static-sphere-count)))
(let ((s2-2 (-> s5-0 static-sphere s3-3)))
(add-debug-sphere #t (bucket-id debug-draw0) (the-as vector s2-2) (-> s2-2 trans w) *color-blue*)
(add-debug-sphere #t (bucket-id debug) (the-as vector s2-2) (-> s2-2 trans w) *color-blue*)
(let ((s1-2 add-debug-text-3d)
(s0-2 #t)
)
@@ -1793,7 +1793,7 @@
)
(add-debug-line
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(vector+! a2-22 v1-80 (the-as vector (-> obj portal 0)))
(vector+! a3-13 v1-80 (the-as vector (-> obj portal 1)))
(new 'static 'rgba :r #xff :g #x80 :b #x40 :a #x80)
@@ -1804,7 +1804,7 @@
)
(add-debug-vector
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> obj shape trans)
(-> obj travel)
(meters 0.00024414062)
@@ -1812,7 +1812,7 @@
)
(add-debug-vector
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(vector+! (new 'stack-no-clear 'vector) (-> obj shape trans) (new 'static 'vector :y 4096.0 :w 1.0))
(-> obj old-travel)
(meters 0.00024414062)
@@ -1820,7 +1820,7 @@
)
(add-debug-x
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(vector+! (new 'stack-no-clear 'vector) (-> obj shape trans) (-> obj travel))
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
)
@@ -1828,7 +1828,7 @@
(when (logtest? (-> obj flags) (nav-control-flags navcf7))
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (-> obj shape root-prim prim-core))
(-> obj shape nav-radius)
(new 'static 'rgba :g #xff :b #xff :a #x20)
@@ -1838,7 +1838,7 @@
(vector+! s4-0 (-> s5-0 origin) (the-as vector (&-> v1-95 x)))
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
s4-0
(- (-> v1-95 w) (-> obj shape nav-radius))
(new 'static 'rgba :g #xff :b #xff :a #x20)
+4 -4
View File
@@ -35,7 +35,7 @@
(if (and (logtest? (-> obj flags) (path-control-flag draw-line)) (< s5-1 (+ (-> obj curve num-cverts) -1)))
(add-debug-line
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
s4-1
(-> obj cverts (+ s5-1 1))
(new 'static 'rgba :r #xff :g #x80 :a #x80)
@@ -44,7 +44,7 @@
)
)
(if (logtest? (-> obj flags) (path-control-flag draw-point))
(add-debug-x #t (bucket-id debug-draw1) s4-1 (new 'static 'rgba :r #xff :a #x80))
(add-debug-x #t (bucket-id debug-no-zbuf) s4-1 (new 'static 'rgba :r #xff :a #x80))
)
(when (logtest? (-> obj flags) (path-control-flag draw-text))
(let ((s3-1 add-debug-text-3d)
@@ -292,7 +292,7 @@
(if (and (logtest? (-> obj flags) (path-control-flag draw-line)) (> (-> obj curve num-cverts) 0))
(add-debug-curve2
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as curve (&-> obj cverts))
(new 'static 'rgba :r #xff :g #x80 :a #x80)
#f
@@ -301,7 +301,7 @@
(dotimes (s5-1 (-> obj curve num-cverts))
(let ((s4-1 (-> obj cverts s5-1)))
(if (logtest? (-> obj flags) (path-control-flag draw-point))
(add-debug-x #t (bucket-id debug-draw1) s4-1 (new 'static 'rgba :r #xff :a #x80))
(add-debug-x #t (bucket-id debug-no-zbuf) s4-1 (new 'static 'rgba :r #xff :a #x80))
)
(when (logtest? (-> obj flags) (path-control-flag draw-text))
(let ((s3-1 add-debug-text-3d)
+1 -1
View File
@@ -97,7 +97,7 @@
)
(add-debug-line
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
prev-pos
pos
(new 'static 'rgba :r #xff :a #x80)
@@ -925,7 +925,7 @@
)
(add-debug-sphere
*display-actor-vis*
(bucket-id debug-draw0)
(bucket-id debug)
gp-1
(-> gp-1 w)
(new 'static 'rgba :g #xff :a #x80)
+3 -3
View File
@@ -70,7 +70,7 @@
(defun-debug joint-mod-debug-draw ((mod joint-mod))
"Draw a frame at the bone."
;; I believe this draws a set of coordinate axes that represent the transformation matrix.
(add-debug-matrix #t (bucket-id debug-draw1) (-> mod joint bone transform))
(add-debug-matrix #t (bucket-id debug-no-zbuf) (-> mod joint bone transform))
(none)
)
@@ -425,7 +425,7 @@
(if (and (= (-> gp-0 process type) target) (!= (-> gp-0 blend) 0.0))
(add-debug-text-sphere
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> gp-0 target)
819.2
"look"
@@ -559,7 +559,7 @@
(if (and (= (-> gp-0 process type) target) (!= (-> gp-0 blend) 0.0))
(add-debug-text-sphere
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> gp-0 target)
819.2
"look"
+22 -22
View File
@@ -93,7 +93,7 @@
(let ((s2-0 (-> arg0 history-data (logand (+ (-> arg0 unknown-halfword00) s4-0) 127))))
(add-debug-line
(logtest? s5-0 2)
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> v1-19 trans)
(-> s2-0 trans)
(the-as rgba (+ #xffff00 (shl s4-0 24)))
@@ -102,7 +102,7 @@
)
(add-debug-vector
(logtest? s5-0 4)
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> s2-0 trans)
(-> s2-0 transv)
(meters 0.000024414063)
@@ -111,7 +111,7 @@
(when (zero? (logand (-> s2-0 status) 256))
(add-debug-line
(logtest? s5-0 1)
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> s1-0 intersect)
(-> s2-0 intersect)
(the-as rgba (+ #xffffff (shl s4-0 24)))
@@ -124,7 +124,7 @@
)
(add-debug-vector
(logtest? s5-0 32)
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> s2-0 intersect)
(-> s2-0 surface-normal)
(meters 1.0)
@@ -132,7 +132,7 @@
)
(add-debug-vector
(logtest? s5-0 16)
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> s2-0 intersect)
(-> s2-0 local-normal)
(meters 1.0)
@@ -141,7 +141,7 @@
)
(add-debug-vector
(logtest? s5-0 8)
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> s2-0 trans)
(-> s2-0 transv-out)
(meters 0.000024414063)
@@ -633,7 +633,7 @@
(vector+! gp-1 gp-1 (-> self control trans))
(add-debug-text-sphere
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
gp-1
819.2
"target"
@@ -809,7 +809,7 @@
(vector+! gp-1 gp-1 (-> self control trans))
(add-debug-text-sphere
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
gp-1
819.2
"ltransv"
@@ -820,7 +820,7 @@
(vector+! gp-1 gp-1 (-> self control trans))
(add-debug-text-sphere
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
gp-1
819.2
"btransv"
@@ -934,7 +934,7 @@
)
(add-debug-vector
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self control trans)
gp-0
(meters 2.0)
@@ -942,7 +942,7 @@
)
(add-debug-vector
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self control trans)
s5-0
(meters 2.0)
@@ -951,7 +951,7 @@
)
(add-debug-vector
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self control trans)
(-> self control unknown-matrix01 vector 2)
(meters 2.0)
@@ -1196,7 +1196,7 @@
)
(add-debug-vector
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self control trans)
(-> self control ground-poly-normal)
(meters 2.0)
@@ -1204,7 +1204,7 @@
)
(add-debug-vector
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self control trans)
(-> self control local-normal)
(meters 2.0)
@@ -1212,7 +1212,7 @@
)
(add-debug-vector
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self control trans)
(-> self control unknown-dynamics00 gravity-normal)
(meters 2.5)
@@ -1220,7 +1220,7 @@
)
(add-debug-vector
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self control trans)
(-> self control dynam gravity-normal)
(meters 3.0)
@@ -1344,7 +1344,7 @@
(when *display-edge-collision-marks*
(add-debug-vector
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> (the-as swingpole s4-0) root trans)
(the-as vector (&-> s4-0 stack 16))
(meters 3.0)
@@ -1352,21 +1352,21 @@
)
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> (the-as swingpole s4-0) root trans)
(-> (the-as swingpole s4-0) range)
(new 'static 'rgba :r #xff :g #xff :a #x80)
)
(add-debug-sphere
#t
(bucket-id debug-draw0)
(bucket-id debug)
(-> self control unknown-vector90)
819.2
(new 'static 'rgba :r #xff :a #x80)
)
(add-debug-sphere #t (bucket-id debug-draw1) s3-0 819.2 (new 'static 'rgba :g #xff :a #x80))
(add-debug-sphere #t (bucket-id debug-draw1) s2-0 819.2 (new 'static 'rgba :g #xff :b #x40 :a #x80))
(add-debug-sphere #t (bucket-id debug-draw1) s5-0 819.2 (new 'static 'rgba :b #xff :a #x80))
(add-debug-sphere #t (bucket-id debug-no-zbuf) s3-0 819.2 (new 'static 'rgba :g #xff :a #x80))
(add-debug-sphere #t (bucket-id debug-no-zbuf) s2-0 819.2 (new 'static 'rgba :g #xff :b #x40 :a #x80))
(add-debug-sphere #t (bucket-id debug-no-zbuf) s5-0 819.2 (new 'static 'rgba :b #xff :a #x80))
)
)
(let ((s4-2 (vector-! (new-stack-vector0) s5-0 (-> self control unknown-vector90))))
+3 -3
View File
@@ -182,21 +182,21 @@
(debug-print-channels (-> self skel) (the-as symbol *stdcon*))
(add-debug-sphere
*display-sidekick-stats*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self parent-override 0 control unknown-cspace10 parent bone transform vector 3)
409.6
(new 'static 'rgba :g #xff :a #x80)
)
(add-debug-sphere
*display-sidekick-stats*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self node-list data 3 bone transform vector 3)
409.6
(new 'static 'rgba :r #xff :g #xff :a #x80)
)
(add-debug-sphere
*display-sidekick-stats*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self draw origin)
409.6
(new 'static 'rgba :r #xff :g #x80 :a #x80)
+4 -4
View File
@@ -1166,7 +1166,7 @@
((logtest? (-> gp-0 state-flags) 1024)
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> gp-0 alt-cam-pos)
819.2
(new 'static 'rgba :r #xff :a #x80)
@@ -1176,7 +1176,7 @@
((logtest? #x20000 (-> gp-0 state-flags))
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> gp-0 alt-cam-pos)
819.2
(new 'static 'rgba :r #xff :a #x80)
@@ -1189,7 +1189,7 @@
(set! (-> (the-as vector s5-0) y) (fmax (-> (the-as vector s5-0) y) (-> gp-0 alt-cam-pos y)))
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector s5-0)
819.2
(new 'static 'rgba :r #xff :a #x80)
@@ -1200,7 +1200,7 @@
(else
(add-debug-sphere
*display-camera-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (&-> (-> gp-0 control) unknown-qword00))
819.2
(new 'static 'rgba :r #xff :a #x80)
+5 -5
View File
@@ -170,7 +170,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-0
(the-as (pointer dma-tag) a3-7)
)
@@ -565,7 +565,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s4-1
(the-as (pointer dma-tag) a3-12)
)
@@ -789,7 +789,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-0
(the-as (pointer dma-tag) a3-7)
)
@@ -1192,7 +1192,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-0
(the-as (pointer dma-tag) a3-7)
)
@@ -1473,7 +1473,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-0
(the-as (pointer dma-tag) a3-7)
)
+2 -2
View File
@@ -1776,7 +1776,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s4-0
(the-as (pointer dma-tag) a3-4)
)
@@ -1885,7 +1885,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
s4-4
(the-as (pointer dma-tag) a3-9)
)
+4 -4
View File
@@ -2392,7 +2392,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-0
(the-as (pointer dma-tag) a3-4)
)
@@ -2414,7 +2414,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-1
(the-as (pointer dma-tag) a3-6)
)
@@ -2436,7 +2436,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-2
(the-as (pointer dma-tag) a3-8)
)
@@ -2458,7 +2458,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-3
(the-as (pointer dma-tag) a3-10)
)
+186 -231
View File
@@ -233,9 +233,10 @@
)
(defun load-level-text-files ((arg0 int))
"If needed, load text"
"Load the text files needed for level idx.
This function made more sense back when text files were split up, but in the end they put everything
in a single text group and file."
;; just load common. These flags are not yet understood.
(if (or *level-text-file-load-flag* (>= arg0 0))
(load-game-text-info "common" '*common-text* *common-text-heap*)
)
@@ -323,28 +324,28 @@
(set-vector! s5-0 128 128 128 128)
(add-debug-line2d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (-> gp-0 vector))
(-> gp-0 vector 1)
(the-as vector s5-0)
)
(add-debug-line2d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> gp-0 vector 1)
(-> gp-0 vector 2)
(the-as vector s5-0)
)
(add-debug-line2d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> gp-0 vector 2)
(-> gp-0 vector 3)
(the-as vector s5-0)
)
(add-debug-line2d
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> gp-0 vector 3)
(the-as vector (-> gp-0 vector))
(the-as vector s5-0)
@@ -399,7 +400,7 @@
(none)
)
(defun print-game-text ((str string) (font-ctxt font-context) (alpha symbol) (offset-thing int) (arg4 int))
(defun print-game-text ((str string) (font-ctxt font-context) (opaque symbol) (alpha int) (line-height int))
"Print text. Not worth commenting until we get stack variables in lets, I think"
(local-vars
(sv-112 float)
@@ -424,238 +425,192 @@
(sv-208 symbol)
(sv-212 symbol)
)
(let
((gp-0
(new
'stack
'font-context
*font-default-matrix*
(the int (-> font-ctxt origin x))
(the int (-> font-ctxt origin y))
0.0
(font-color default)
(font-flags shadow kerning)
)
)
)
(when (< 0.1 (-> font-ctxt scale))
(set! sv-112 (-> font-ctxt mat vector 0 x))
(set! sv-116 (-> font-ctxt mat vector 1 y))
(set! sv-120 (-> *video-parms* relative-x-scale))
(set! sv-124 (-> *video-parms* relative-y-scale))
(set! sv-128 (-> *video-parms* relative-x-scale-reciprical))
(set! sv-132 (-> *video-parms* relative-y-scale-reciprical))
(set! sv-136 (-> font-ctxt scale))
(set! (-> gp-0 origin z) (-> font-ctxt origin z))
(set! (-> gp-0 flags) (-> font-ctxt flags))
(set! (-> gp-0 color) (-> font-ctxt color))
(set! (-> gp-0 scale) sv-136)
(when (logtest? (-> gp-0 flags) (font-flags left))
(logclear! (-> gp-0 flags) (font-flags left))
(let ((f30-0 (-> gp-0 width))
(f28-0 (-> gp-0 height))
)
(set! (-> gp-0 width) (-> font-ctxt width))
(set! (-> gp-0 height) (-> font-ctxt height))
(+!
(-> gp-0 origin y)
(the
float
(the
int
(* 0.5 (- (-> gp-0 height) (print-game-text str gp-0 #t 128 22)))
)
)
)
(set! (-> gp-0 width) f30-0)
(set! (-> gp-0 height) f28-0)
)
)
(set! (-> gp-0 mat vector 0 x) (* (-> gp-0 mat vector 0 x) sv-136))
(set! (-> gp-0 mat vector 1 y) (* (-> gp-0 mat vector 1 y) sv-136))
(set!
(-> *video-parms* relative-x-scale)
(* (-> *video-parms* relative-x-scale) sv-136)
)
(set!
(-> *video-parms* relative-y-scale)
(* (-> *video-parms* relative-y-scale) sv-136)
)
(set!
(-> *video-parms* relative-x-scale-reciprical)
(/ 1.0 (-> *video-parms* relative-x-scale))
)
(set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 sv-136))
(set! sv-140 (-> str data))
(set! sv-144 (-> gp-0 origin x))
(set! sv-148 (-> gp-0 origin x))
(set! sv-152 (+ (-> gp-0 origin x) (-> font-ctxt width)))
(set! sv-156 (+ (-> gp-0 origin y) (-> font-ctxt height)))
(set!
sv-160
(* (get-string-length " " gp-0) (-> *video-parms* relative-x-scale))
)
(set! sv-164 (* (if (logtest? (-> gp-0 flags) 32)
(the float arg4)
14.0
)
sv-136
)
)
(set! sv-168 0)
(if (logtest? (-> gp-0 flags) 4)
(+! (-> gp-0 origin x) (* 0.5 (-> font-ctxt width)))
)
(set! sv-176 (the-as int (-> sv-140 0))) ;; char
(set! sv-184 0)
(set! sv-192 0)
(set! sv-200 0)
(set! sv-208 (the-as symbol #f))
(set! sv-212 (the-as symbol #f))
(set! (-> *game-text-line* data 0) (the-as uint 0))
(while
(or (not (and (zero? sv-176) (zero? sv-184) (zero? sv-192)))
(>= sv-156 (-> gp-0 origin y))
)
(cond
((= sv-176 32)
(set! (-> *game-text-word* data sv-184) (the-as uint sv-176))
(set! sv-184 (+ sv-184 1))
(set! sv-208 #t)
)
((zero? sv-176)
(if (zero? sv-184)
(set! sv-212 #t)
(set! sv-208 #t)
)
)
(else
(if (= sv-176 95)
(set! sv-176 32)
)
(set! (-> *game-text-word* data sv-184) (the-as uint sv-176))
(set! sv-184 (+ sv-184 1))
)
)
(when (= sv-208 #t)
(set! (-> *game-text-word* data sv-184) (the-as uint 0))
(let* ((f30-1 sv-144)
(f0-49
(*
(get-string-length *game-text-word* gp-0)
(-> *video-parms* relative-x-scale)
)
(let ((gp-0 (new
'stack
'font-context
*font-default-matrix*
(the int (-> font-ctxt origin x))
(the int (-> font-ctxt origin y))
0.0
(font-color default)
(font-flags shadow kerning)
)
)
(f1-14 (+ f30-1 f0-49))
)
(if (= (-> *game-text-word* data (+ sv-184 -1)) 32)
(set! f1-14 (- f1-14 sv-160))
)
(cond
((< sv-152 f1-14)
(set! sv-144 (+ sv-148 f0-49))
(set! sv-212 #t)
)
(else
(set! sv-144 (+ sv-144 f0-49))
)
(when (< 0.1 (-> font-ctxt scale))
(set! sv-112 (-> font-ctxt mat vector 0 x))
(set! sv-116 (-> font-ctxt mat vector 1 y))
(set! sv-120 (-> *video-parms* relative-x-scale))
(set! sv-124 (-> *video-parms* relative-y-scale))
(set! sv-128 (-> *video-parms* relative-x-scale-reciprical))
(set! sv-132 (-> *video-parms* relative-y-scale-reciprical))
(set! sv-136 (-> font-ctxt scale))
(set! (-> gp-0 origin z) (-> font-ctxt origin z))
(set! (-> gp-0 flags) (-> font-ctxt flags))
(set! (-> gp-0 color) (-> font-ctxt color))
(set! (-> gp-0 scale) sv-136)
(when (logtest? (-> gp-0 flags) (font-flags left))
(logclear! (-> gp-0 flags) (font-flags left))
(let ((f30-0 (-> gp-0 width))
(f28-0 (-> gp-0 height))
)
(set! (-> gp-0 width) (-> font-ctxt width))
(set! (-> gp-0 height) (-> font-ctxt height))
(+! (-> gp-0 origin y)
(the float (the int (* 0.5 (- (-> gp-0 height) (print-game-text str gp-0 #t 128 22)))))
)
(set! (-> gp-0 width) f30-0)
(set! (-> gp-0 height) f28-0)
)
)
)
)
(when (= sv-212 #t)
(when (>= sv-200 (the-as int (-> gp-0 start-line)))
(let ((f30-2 (+ (-> gp-0 origin y) sv-164)))
(when (>= sv-156 f30-2)
(when (= (-> *game-text-line* data (+ sv-192 -1)) 32)
(set! (-> *game-text-line* data (+ sv-192 -1)) (the-as uint 0))
(when
(and
(= (-> *game-text-line* data (+ sv-192 -5)) 126)
(= (-> *game-text-line* data (+ sv-192 -2)) 72)
(set! (-> gp-0 mat vector 0 x) (* (-> gp-0 mat vector 0 x) sv-136))
(set! (-> gp-0 mat vector 1 y) (* (-> gp-0 mat vector 1 y) sv-136))
(set! (-> *video-parms* relative-x-scale) (* (-> *video-parms* relative-x-scale) sv-136))
(set! (-> *video-parms* relative-y-scale) (* (-> *video-parms* relative-y-scale) sv-136))
(set! (-> *video-parms* relative-x-scale-reciprical) (/ 1.0 (-> *video-parms* relative-x-scale)))
(set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 sv-136))
(set! sv-140 (-> str data))
(set! sv-144 (-> gp-0 origin x))
(set! sv-148 (-> gp-0 origin x))
(set! sv-152 (+ (-> gp-0 origin x) (-> font-ctxt width)))
(set! sv-156 (+ (-> gp-0 origin y) (-> font-ctxt height)))
(set! sv-160 (* (get-string-length " " gp-0) (-> *video-parms* relative-x-scale)))
(set! sv-164 (* (if (logtest? (-> gp-0 flags) (font-flags large))
(the float line-height)
14.0
)
sv-136
)
)
(set! (-> *game-text-line* data (+ sv-192 -5)) (the-as uint 0))
0
)
(set! sv-168 0)
(if (logtest? (-> gp-0 flags) (font-flags middle))
(+! (-> gp-0 origin x) (* 0.5 (-> font-ctxt width)))
)
)
(when
(and
(= (-> *game-text-line* data (+ sv-192 -4)) 126)
(= (-> *game-text-line* data (+ sv-192 -1)) 72)
)
(set! (-> *game-text-line* data (+ sv-192 -4)) (the-as uint 0))
0
)
(if (nonzero? (-> *game-text-line* data 0))
(set! sv-168 (+ sv-168 1))
)
(when (not alpha)
(let*
((s1-1
(-> *display* frames (-> *display* on-screen) frame global-buf)
)
(s2-1 (-> s1-1 base))
)
(set-font-color-alpha (-> font-ctxt color) offset-thing)
(draw-string *game-text-line* s1-1 gp-0)
(set-font-color-alpha (-> font-ctxt color) 128)
(set! (-> gp-0 color) (-> *font-work* last-color))
(let ((a3-3 (-> s1-1 base)))
(let ((v1-127 (the-as object (-> s1-1 base))))
(set!
(-> (the-as dma-packet v1-127) dma)
(new 'static 'dma-tag :id (dma-tag-id next))
)
(set! (-> (the-as dma-packet v1-127) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-127) vif1) (new 'static 'vif-tag))
(set! (-> s1-1 base) (&+ (the-as pointer v1-127) 16))
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
s2-1
(the-as (pointer dma-tag) a3-3)
)
)
)
)
(set! (-> gp-0 origin y) f30-2)
)
)
(set! sv-200 (+ sv-200 1))
(set! (-> *game-text-line* data 0) (the-as uint 0))
(set! sv-192 0)
(set! sv-212 (the-as symbol #f))
)
(when (= sv-208 #t)
(copy-charp<-charp
(&-> *game-text-line* data sv-192)
(-> *game-text-word* data)
)
(set! sv-192 (+ sv-192 sv-184))
(set! sv-184 0)
(set! sv-208 (the-as symbol #f))
)
(when (nonzero? sv-176)
(set! sv-140 (&-> sv-140 1))
(set! sv-176 (the-as int (-> sv-140 0)))
(set! sv-184 0)
(set! sv-192 0)
(set! sv-200 0)
(set! sv-208 (the-as symbol #f))
(set! sv-212 (the-as symbol #f))
(set! (-> *game-text-line* data 0) (the-as uint 0))
(while (or (not (and (zero? sv-176) (zero? sv-184) (zero? sv-192))) (>= sv-156 (-> gp-0 origin y)))
(cond
((= sv-176 32)
(set! (-> *game-text-word* data sv-184) (the-as uint sv-176))
(set! sv-184 (+ sv-184 1))
(set! sv-208 #t)
)
((zero? sv-176)
(if (zero? sv-184)
(set! sv-212 #t)
(set! sv-208 #t)
)
)
(else
(if (= sv-176 95)
(set! sv-176 32)
)
(set! (-> *game-text-word* data sv-184) (the-as uint sv-176))
(set! sv-184 (+ sv-184 1))
)
)
(when (= sv-208 #t)
(set! (-> *game-text-word* data sv-184) (the-as uint 0))
(let* ((f30-1 sv-144)
(f0-49 (* (get-string-length *game-text-word* gp-0) (-> *video-parms* relative-x-scale)))
(f1-14 (+ f30-1 f0-49))
)
(if (= (-> *game-text-word* data (+ sv-184 -1)) 32)
(set! f1-14 (- f1-14 sv-160))
)
(cond
((< sv-152 f1-14)
(set! sv-144 (+ sv-148 f0-49))
(set! sv-212 #t)
)
(else
(set! sv-144 (+ sv-144 f0-49))
)
)
)
)
(when (= sv-212 #t)
(when (>= sv-200 (the-as int (-> gp-0 start-line)))
(let ((f30-2 (+ (-> gp-0 origin y) sv-164)))
(when (>= sv-156 f30-2)
(when (= (-> *game-text-line* data (+ sv-192 -1)) 32)
(set! (-> *game-text-line* data (+ sv-192 -1)) (the-as uint 0))
(when (and (= (-> *game-text-line* data (+ sv-192 -5)) 126) (= (-> *game-text-line* data (+ sv-192 -2)) 72))
(set! (-> *game-text-line* data (+ sv-192 -5)) (the-as uint 0))
0
)
)
)
(when (and (= (-> *game-text-line* data (+ sv-192 -4)) 126) (= (-> *game-text-line* data (+ sv-192 -1)) 72))
(set! (-> *game-text-line* data (+ sv-192 -4)) (the-as uint 0))
0
)
(if (nonzero? (-> *game-text-line* data 0))
(set! sv-168 (+ sv-168 1))
)
(when (not opaque)
(let* ((s1-1 (-> *display* frames (-> *display* on-screen) frame global-buf))
(s2-1 (-> s1-1 base))
)
(set-font-color-alpha (-> font-ctxt color) alpha)
(draw-string *game-text-line* s1-1 gp-0)
(set-font-color-alpha (-> font-ctxt color) 128)
(set! (-> gp-0 color) (-> *font-work* last-color))
(let ((a3-3 (-> s1-1 base)))
(let ((v1-127 (the-as object (-> s1-1 base))))
(set! (-> (the-as dma-packet v1-127) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> (the-as dma-packet v1-127) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-127) vif1) (new 'static 'vif-tag))
(set! (-> s1-1 base) (&+ (the-as pointer v1-127) 16))
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug)
s2-1
(the-as (pointer dma-tag) a3-3)
)
)
)
)
(set! (-> gp-0 origin y) f30-2)
)
)
(set! sv-200 (+ sv-200 1))
(set! (-> *game-text-line* data 0) (the-as uint 0))
(set! sv-192 0)
(set! sv-212 (the-as symbol #f))
)
(when (= sv-208 #t)
(copy-charp<-charp (&-> *game-text-line* data sv-192) (-> *game-text-word* data))
(set! sv-192 (+ sv-192 sv-184))
(set! sv-184 0)
(set! sv-208 (the-as symbol #f))
)
(when (nonzero? sv-176)
(set! sv-140 (&-> sv-140 1))
(set! sv-176 (the-as int (-> sv-140 0)))
)
)
(set! (-> gp-0 mat vector 0 x) sv-112)
(set! (-> gp-0 mat vector 1 y) sv-116)
(set! (-> *video-parms* relative-x-scale) sv-120)
(set! (-> *video-parms* relative-y-scale) sv-124)
(set! (-> *video-parms* relative-x-scale-reciprical) sv-128)
(set! (-> *video-parms* relative-y-scale-reciprical) sv-132)
(with-pc
(if (and *debug-segment* (-> *pc-settings* display-text-box))
(draw-debug-text-box font-ctxt)))
(if (> sv-168 0)
(* sv-164 (the float sv-168))
0.0
)
)
)
(set! (-> gp-0 mat vector 0 x) sv-112)
(set! (-> gp-0 mat vector 1 y) sv-116)
(set! (-> *video-parms* relative-x-scale) sv-120)
(set! (-> *video-parms* relative-y-scale) sv-124)
(set! (-> *video-parms* relative-x-scale-reciprical) sv-128)
(set! (-> *video-parms* relative-y-scale-reciprical) sv-132)
(with-pc
(if (and *debug-segment* (-> *pc-settings* display-text-box))
(draw-debug-text-box font-ctxt)))
(if (> sv-168 0)
(* sv-164 (the float sv-168))
0.0
)
)
)
)
(defun disable-level-text-file-loading ()
+1 -20
View File
@@ -356,24 +356,6 @@
"out/iso/GAME.CGO"
)
;;;;;;;;;;;;;;;;;;;;;
;; hub1 Group
;;;;;;;;;;;;;;;;;;;;;
;; the hub1 group is a group of files required to play the first hub (village1, jungle, beach, misty, training, firecanyon)
(group "hub1"
"out/iso/0COMMON.TXT"
"out/iso/0SUBTIT.TXT"
"out/iso/KERNEL.CGO"
"out/iso/GAME.CGO"
"out/iso/VI1.DGO"
"out/iso/TRA.DGO"
"out/iso/FIC.DGO"
"out/iso/JUN.DGO"
"out/iso/BEA.DGO"
"out/iso/MIS.DGO"
)
;;;;;;;;;;;;;;;;;;;;;;;;
;; Common Level Objects
;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1929,8 +1911,7 @@
)
(group-list "text"
`(
"out/iso/0COMMON.TXT"
`("out/iso/0COMMON.TXT"
"out/iso/0SUBTIT.TXT"
)
)
+8 -5
View File
@@ -913,11 +913,6 @@
`(make-group "engine")
)
(defmacro mh1 ()
"Make hub1"
`(make-group "hub1")
)
;;;;;;;;;;;;;;;;;;;
;; enum stuff
;;;;;;;;;;;;;;;;;;;
@@ -983,6 +978,14 @@
(defconstant *user* (__get-user))
(defmacro user? (&rest users)
(cond
((null? users) #f)
((eq? *user* (car users)) #t)
(#t `(user? ,@(cdr users)))
)
)
+41 -47
View File
@@ -5,64 +5,58 @@
;; name in dgo: air-h
;; dgos: BEA, L1
;; definition of type air-box
;; DECOMP BEGINS
(deftype air-box (structure)
((vecs vector 2 :inline :offset-assert 0)
(x-pos float :offset 0)
(height-level float :offset 4)
(z-pos float :offset 8)
(cos-angle float :offset 12)
(x-length float :offset 16)
(z-length float :offset 24)
(sin-angle float :offset 28)
((vecs vector 2 :inline :offset-assert 0)
(x-pos float :offset 0)
(height-level float :offset 4)
(z-pos float :offset 8)
(cos-angle float :offset 12)
(x-length float :offset 16)
(z-length float :offset 24)
(sin-angle float :offset 28)
)
:method-count-assert 9
:size-assert #x20
:flag-assert #x900000020
)
;; definition for function point-in-air-box-area?
(defun point-in-air-box-area? ((arg0 float) (arg1 float) (arg2 air-box))
(let ((v0-0 #f))
(let ((f0-2 (+ (* arg0 (-> arg2 vecs 0 w)) (* arg1 (-> arg2 vecs 1 w))))
(f1-5 (- (* arg1 (-> arg2 vecs 0 w)) (* arg0 (-> arg2 vecs 1 w))))
)
(if
(and
(>= f0-2 0.0)
(>= f1-5 0.0)
(< f0-2 (-> arg2 vecs 1 x))
(< f1-5 (-> arg2 vecs 1 z))
)
(set! v0-0 #t)
)
)
v0-0
)
)
;; definition for function point-in-air-box?
(defun point-in-air-box? ((arg0 vector) (arg1 air-box))
(when (< (-> arg1 vecs 0 y) (-> arg0 y))
(let ((f1-2 (- (-> arg0 x) (the-as float (-> arg1 vecs 0 x))))
(f2-1 (- (-> arg0 z) (-> arg1 vecs 0 z)))
(v1-0 arg1)
(v0-0 #f)
)
(let ((f0-5 (+ (* f1-2 (-> v1-0 vecs 0 w)) (* f2-1 (-> v1-0 vecs 1 w))))
(f1-4 (- (* f2-1 (-> v1-0 vecs 0 w)) (* f1-2 (-> v1-0 vecs 1 w))))
(let ((f0-2 (+ (* arg0 (-> arg2 cos-angle)) (* arg1 (-> arg2 sin-angle))))
(f1-5 (- (* arg1 (-> arg2 cos-angle)) (* arg0 (-> arg2 sin-angle))))
)
(if (and (>= f0-2 0.0) (>= f1-5 0.0) (< f0-2 (-> arg2 x-length)) (< f1-5 (-> arg2 z-length)))
(set! v0-0 #t)
)
(if
(and
(>= f0-5 0.0)
(>= f1-4 0.0)
(< f0-5 (-> v1-0 vecs 1 x))
(< f1-4 (-> v1-0 vecs 1 z))
)
(set! v0-0 #t)
)
)
v0-0
)
)
)
(defun point-in-air-box? ((arg0 vector) (arg1 air-box))
(when (< (-> arg1 height-level) (-> arg0 y))
(let ((f1-2 (- (-> arg0 x) (the-as float (-> arg1 x-pos))))
(f2-1 (- (-> arg0 z) (-> arg1 z-pos)))
(v1-0 arg1)
(v0-0 #f)
)
(let ((f0-5 (+ (* f1-2 (-> v1-0 cos-angle)) (* f2-1 (-> v1-0 sin-angle))))
(f1-4 (- (* f2-1 (-> v1-0 cos-angle)) (* f1-2 (-> v1-0 sin-angle))))
)
(if (and (>= f0-5 0.0) (>= f1-4 0.0) (< f0-5 (-> v1-0 x-length)) (< f1-4 (-> v1-0 z-length)))
(set! v0-0 #t)
)
)
v0-0
)
)
)
0
+1 -1
View File
@@ -698,7 +698,7 @@
)
(countdown (s3-0 (-> obj tuning num-spring-points))
(vector-matrix*! s4-0 (-> s5-0 local-pos) gp-0)
(add-debug-sphere #t (bucket-id debug-draw0) s4-0 2048.0 (new 'static 'rgba :r #xff :g #xff :b #xff :a #x40))
(add-debug-sphere #t (bucket-id debug) s4-0 2048.0 (new 'static 'rgba :r #xff :g #xff :b #xff :a #x40))
(&+! s5-0 48)
)
)
+1 -1
View File
@@ -1453,7 +1453,7 @@
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id debug-draw0)
(bucket-id debug)
gp-0
(the-as (pointer dma-tag) a3-1)
)
+1 -1
View File
@@ -1785,7 +1785,7 @@
(if (nonzero? gp-0)
(debug-percent-bar
#t
(bucket-id debug-draw0)
(bucket-id debug)
192
160
(* 0.0033333334 (the float gp-0))
+1 -1
View File
@@ -345,7 +345,7 @@
)
(add-debug-vector
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
s4-1
s3-0
(meters 0.00024414062)
+5 -5
View File
@@ -199,7 +199,7 @@
(let ((f30-4 (* (deg-diff f30-3 0.0) (-> self racer slide-grip-mult))))
(add-debug-vector
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self control trans)
(-> self control transv)
(meters 0.000061035156)
@@ -226,7 +226,7 @@
(vector-float*! gp-1 gp-1 0.5)
(add-debug-vector
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self control trans)
gp-1
(meters 0.00024414062)
@@ -235,7 +235,7 @@
(vector+! gp-1 gp-1 (-> self control trans))
(add-debug-text-sphere
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
gp-1
819.2
"ltransv"
@@ -246,7 +246,7 @@
(vector+! gp-1 gp-1 (-> self control trans))
(add-debug-text-sphere
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
gp-1
819.2
"nose"
@@ -365,7 +365,7 @@
(+! (-> a2-1 y) (-> self racer cushion-bob))
(add-debug-sphere
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
a2-1
819.2
(new 'static 'rgba :r #xff :b #xff :a #x80)
+6 -6
View File
@@ -184,7 +184,7 @@
(vector-flatten! s4-1 s4-1 (-> self control local-normal))
(add-debug-vector
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self control trans)
s4-1
(meters 0.00024414062)
@@ -252,7 +252,7 @@
(vector-flatten! s3-1 s3-1 (-> self control local-normal))
(add-debug-vector
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self control trans)
s3-1
(meters 2.0)
@@ -265,7 +265,7 @@
(vector-flatten! s4-2 s4-2 (-> self control local-normal))
(add-debug-vector
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self control trans)
s4-2
(meters 2.0)
@@ -302,7 +302,7 @@
(vector-float*! gp-1 gp-1 0.5)
(add-debug-vector
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> self control trans)
gp-1
(meters 0.00024414062)
@@ -311,7 +311,7 @@
(vector+! gp-1 gp-1 (-> self control trans))
(add-debug-text-sphere
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
gp-1
819.2
"ltransv"
@@ -322,7 +322,7 @@
(vector+! gp-1 gp-1 (-> self control trans))
(add-debug-text-sphere
*display-target-marks*
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
gp-1
819.2
"nose"
+1 -1
View File
@@ -687,7 +687,7 @@
(let* ((a0-0 (-> self spawn-joint-array gp-0))
(a2-0 (-> self node-list data a0-0 bone transform))
)
(add-debug-matrix #t (bucket-id debug-draw1) a2-0)
(add-debug-matrix #t (bucket-id debug-no-zbuf) a2-0)
)
)
#f
+6 -6
View File
@@ -121,7 +121,7 @@
(set! (-> s3-0 w) 1.0)
(add-debug-line
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
s4-0
s3-0
(new 'static 'rgba :r #xff :g #xff :a #x80)
@@ -130,7 +130,7 @@
)
(add-debug-vector
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
s4-0
s5-0
(meters 0.00024414062)
@@ -447,14 +447,14 @@
(debug-draw (-> obj path))
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> obj dest-circle)
(-> obj dest-circle w)
(new 'static 'rgba :g #xff :a #x80)
)
(add-debug-x
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(-> obj target-point)
(new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
)
@@ -834,14 +834,14 @@
(dummy-16 (-> self controller))
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (-> self boat-path))
614400.0
(new 'static 'rgba :b #xff :a #x80)
)
(add-debug-sphere
#t
(bucket-id debug-draw1)
(bucket-id debug-no-zbuf)
(the-as vector (&-> self stack 848))
409600.0
(new 'static 'rgba :b #xff :a #x80)
-6
View File
@@ -23,9 +23,6 @@
|#
(#when PC_PORT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -580,7 +577,4 @@
))
)
+2 -7
View File
@@ -22,9 +22,6 @@
|#
;; is this necessary?
(#when PC_PORT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; updates
@@ -796,15 +793,13 @@
(defun-debug draw-build-revision ()
(with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf))
(bucket-id debug-draw1))
(bucket-id debug-no-zbuf))
(draw-string-xy *pc-settings-built-sha*
buf
0
(* 10 (-> *video-parms* relative-y-scale))
(font-color flat-yellow)
(font-flags kerning))))
) ;; when PC_PORT
(font-flags shadow kerning))))
+6 -2
View File
@@ -374,7 +374,7 @@
(set! (-> *progress-carousell* x-offset) 0)
)
(set! (-> font origin y) (the float (+ y-off 3)))
;(set-color! font (font-color lighter-lighter-blue))
(set-color! font (font-color lighter-lighter-blue))
0
(let ((next-lang (mod (+ old-lang 1) max-lang))
(prev-lang (mod (+ max-lang -1 old-lang) max-lang))
@@ -387,6 +387,7 @@
(let ((a2-22 (- 200 (+ (-> *progress-carousell* x-offset) 100))))
(print-string-in-carousell (-> options prev-lang) font a2-22 #f)
)
(set-color! font (font-color lighter-lighter-blue))
(let ((a2-23 (+ (-> *progress-carousell* x-offset) 100)))
(cond
((< a2-23 150)
@@ -413,6 +414,7 @@
)
)
)
(set-color! font (font-color lighter-lighter-blue))
(let ((a2-27 (- 200 (+ (-> *progress-carousell* x-offset) 100))))
(print-string-in-carousell (-> options next-lang) font a2-27 #t)
)
@@ -1218,7 +1220,7 @@
(set! (-> obj language-x-offset) 0)
)
(set! (-> font origin y) (the float (+ y-off 3)))
;(set-color! font (font-color lighter-lighter-blue))
(set-color! font (font-color lighter-lighter-blue))
0
(let ((next-lang (mod (+ old-lang 1) max-lang))
(prev-lang (mod (+ max-lang -1 old-lang) max-lang))
@@ -1231,6 +1233,7 @@
(let ((a2-22 (- 200 (+ (-> obj language-x-offset) 100))))
(print-language-name prev-lang font a2-22 #f)
)
(set-color! font (font-color lighter-lighter-blue))
(let ((a2-23 (+ (-> obj language-x-offset) 100)))
(cond
((< a2-23 150)
@@ -1257,6 +1260,7 @@
)
)
)
(set-color! font (font-color lighter-lighter-blue))
(let ((a2-27 (- 200 (+ (-> obj language-x-offset) 100))))
(print-language-name (the int next-lang) font a2-27 #t)
)
+454 -93
View File
@@ -7,24 +7,21 @@
It automatically detects the currently playing cutscene and plays the subtitles for it on channel 0.
Channel 1 and 2 are reserved for ambient sounds, which cannot be auto-detected, so the ambient-control needs to
notify the subtitle process manually (TODO: verify this!)
Similarly to the generic text file, only one subtitles text file is loaded at once, stored in a specific
heap.
In Jak 2, the subtitles are stored directly within the .STR files. We don't have that luxury here, unfortunately.
|#
(#when PC_PORT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconstant PC_SUBTITLE_FILE_SIZE (* 64 1024))
(defconstant PC_SUBTITLE_FILE_SIZE (* 64 1024)) ;; 64K heap for subtitles. adjust later if necessary.
(defconstant PC_SUBTITLE_FILE_NAME "subtit")
(defglobalconstant PC_SUBTITLE_DEBUG #f)
@@ -43,7 +40,13 @@
(defenum pc-subtitle-channel
:type int16
(invalid -1) (movie 0) (ambient 1) (hint 2))
(defconstant SUBTITLE_CHANNEL_COUNT 3)
(defenum pc-subtitle-flags
:bitfield #t
:type uint32
(offscreen) ;; speaker is offscreen.
)
;; information about a single line of subtitles
(deftype subtitle-keyframe (structure)
@@ -51,7 +54,7 @@
(frame int32) ;; the frame to play the subtitle line on
(string string) ;; the text for the subtitle line
(speaker string) ;; name of the speaker. leave blank for no speaker.
(offscreen symbol) ;; speaker is offscreen.
(flags pc-subtitle-flags) ;; flags
)
:pack-me
)
@@ -65,17 +68,17 @@
(length int16)
;; data
(keyframes (inline-array subtitle-keyframe))
;; now we store a way to identify and lookup the subtitles.
;; the game-text-id if this is for a hint
(id game-text-id :offset 8)
;; the name of the spool-anim
(name string :offset 8)
;; the 8-character name for an ambient or hint
(hash uint64 :offset 8)
)
:size-assert #x10 ;; compact!
@@ -88,31 +91,60 @@
(dummy int32)
(data subtitle-text :inline :dynamic)
)
(:methods
(get-scene-by-name (_type_ pc-subtitle-channel string) subtitle-text)
)
)
(defmacro subtitle-flags? (sub &rest flags)
`(logtest? (-> ,sub flags) (pc-subtitle-flags ,@flags)))
;;;----------------------------------
;; process type
;;;----------------------------------
;; graphic parameters for subtitles
(deftype subtitle-bank (structure)
(
(scale float)
(width float)
(height float)
(lines float)
)
)
(define *SUBTITLE-bank*
(new 'static 'subtitle-bank
:scale 0.49
:width 0.85
:height 0.8
:lines 3.0
))
;; the subtitle process! it lives on the PC actor pool and awaits for incoming subtitle messages, or a movie
(deftype subtitle (process)
(
(font font-context)
(font font-context) ;; the font to use for the subtitles.
(bank-backup subtitle-bank :inline) ;; debug backup.
( spool-name string)
(old-spool-name string)
(cur-channel pc-subtitle-channel)
(want-subtitle subtitle-keyframe) ;; the subtitle we want to display
)
:heap-base #x10
(:methods
(subtitle-format (_type_ subtitle-keyframe) string)
)
(:states
subtitle-debug)
)
@@ -141,14 +173,14 @@
(defmethod get-scene-by-name subtitle-text-info ((obj subtitle-text-info) (kind pc-subtitle-channel) (name string))
"get a subtitle scene info with the corresponding name. #f = none found"
(dotimes (i (-> obj length))
;; name and kind matches, return that!
(when (and (= kind (-> obj data i kind)) (string= (-> obj data i name) name))
(return (-> obj data i))
)
)
(the subtitle-text #f))
(defun load-subtitle-text-info ((txt-name string) (curr-text symbol) (heap kheap))
@@ -157,57 +189,77 @@
curr-text = a symbol to a subtitle-text-info to link the file to
heap = the text heap to load the file onto"
(local-vars (v0-2 int) (heap-sym-heap subtitle-text-info) (lang pc-subtitle-lang) (load-status int) (heap-free int))
(set! heap-sym-heap (the-as subtitle-text-info (-> curr-text value)))
(set! lang (-> *pc-settings* subtitle-language))
(set! load-status 0)
(set! heap-free (&- (-> heap top) (the-as uint (-> heap base))))
(when (or (= heap-sym-heap #f)
(!= (-> heap-sym-heap lang) lang)
)
(kheap-reset heap)
(let ((heap-sym-heap (the-as subtitle-text-info (-> curr-text value)))
(lang (-> *pc-settings* subtitle-language))
(load-status 0)
(heap-free (&- (-> heap top) (the-as uint (-> heap base)))))
(while (not (str-load (string-format "~D~S.TXT" lang txt-name) -1 (logand -64 (&+ (-> heap current) 63)) (&- (-> heap top) (-> heap current))))
(return 0)
)
;; current text has nothing loaded, or language doesn't match.
(when (or (= heap-sym-heap #f)
(!= (-> heap-sym-heap lang) lang)
)
;; so reload.
(label retry)
(let ((v1-20 (str-load-status (the-as (pointer int32) (& load-status)))))
(when (= v1-20 'error)
(format 0 "Error loading subtitle~%")
(return 0)
(goto loaded)
;; reset the text heap.
(kheap-reset heap)
;; try to load load...
(while (not (str-load (string-format "~D~S.TXT" lang txt-name) -1 (logand -64 (&+ (-> heap current) 63)) (&- (-> heap top) (-> heap current))))
(return 0)
)
;; load succeeded. check status.
(label retry)
(let ((status (str-load-status (the-as (pointer int32) (& load-status)))))
(when (= status 'error)
(format 0 "Error loading subtitle~%")
(return 0)
(goto loaded)
)
(cond
((>= load-status (+ heap-free -300))
(format 0 "Game subtitle heap overrun!~%")
(return 0)
)
((= status 'busy)
;; still loading.
(goto retry)
)
)
)
(cond
((>= load-status (+ heap-free -300))
(format 0 "Game subtitle heap overrun!~%")
(return 0)
)
((= v1-20 'busy)
(goto retry)
)
)
)
(label loaded)
(let ((s2-1 (logand -64 (&+ (-> heap current) 63))))
(flush-cache 0)
(set! (-> curr-text value) (link s2-1 (-> (string-format "~D~S.TXT" lang txt-name) data) load-status heap 0))
)
(if (<= (the-as int (-> curr-text value)) 0)
(set! (-> curr-text value) (the-as object #f))
)
)
(label loaded)
;; link the text file!
(let ((new-mem (logand -64 (&+ (-> heap current) 63))))
(flush-cache 0)
(set! (-> curr-text value) (link new-mem (-> (string-format "~D~S.TXT" lang txt-name) data) load-status heap 0))
)
;; if linking failed just make the text invalid.
(if (<= (the-as int (-> curr-text value)) 0)
(set! (-> curr-text value) (the-as object #f))
)
))
0)
(defun load-level-subtitle-files ((idx int))
"If needed, load subtitles"
"Load the subtitle files needed for level idx.
This function made more sense back when text files were split up, but in the end they put everything
in a single text group and file."
;; just load common. These flags are not yet understood.
;; just load common.
(if (or *level-text-file-load-flag* (>= idx 0))
(load-subtitle-text-info PC_SUBTITLE_FILE_NAME '*subtitle-text* *subtitle-text-heap*)
)
(none)
)
(none))
(defmacro reload-subtitles ()
"rebuild and reload subtitles."
`(begin
(asm-text-file subtitle :files ("game/assets/game_subtitle.gp"))
(+! (-> *subtitle-text* lang) (the-as pc-subtitle-lang 1))))
@@ -216,22 +268,237 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun-recursive print-game-subtitle float ((str string) (font-ctxt font-context) (opaque symbol) (alpha int) (line-height int))
"Print text. Not worth commenting until we get stack variables in lets, I think"
(local-vars
(sv-112 float)
(sv-116 float)
(sv-120 float)
(sv-124 float)
(sv-128 float)
(sv-132 float)
(sv-136 float)
(sv-140 (pointer uint8))
(sv-144 float)
(sv-148 float)
(sv-152 float)
(sv-156 float)
(sv-160 float)
(sv-164 float)
(sv-168 int)
(sv-176 int)
(sv-184 int)
(sv-192 int)
(sv-200 int)
(sv-208 symbol)
(sv-212 symbol)
)
(let ((gp-0 (new
'stack
'font-context
*font-default-matrix*
(the int (-> font-ctxt origin x))
(the int (-> font-ctxt origin y))
0.0
(font-color default)
(font-flags shadow kerning)
)
)
)
(when (< 0.1 (-> font-ctxt scale))
(set! sv-112 (-> font-ctxt mat vector 0 x))
(set! sv-116 (-> font-ctxt mat vector 1 y))
(set! sv-120 (-> *video-parms* relative-x-scale))
(set! sv-124 (-> *video-parms* relative-y-scale))
(set! sv-128 (-> *video-parms* relative-x-scale-reciprical))
(set! sv-132 (-> *video-parms* relative-y-scale-reciprical))
(set! sv-136 (-> font-ctxt scale))
(set! (-> gp-0 origin z) (-> font-ctxt origin z))
(set! (-> gp-0 flags) (-> font-ctxt flags))
(set! (-> gp-0 color) (-> font-ctxt color))
(set! (-> gp-0 scale) sv-136)
(when (logtest? (-> gp-0 flags) (font-flags left))
(logclear! (-> gp-0 flags) (font-flags left))
(let ((f30-0 (-> gp-0 width))
(f28-0 (-> gp-0 height))
)
(set! (-> gp-0 width) (-> font-ctxt width))
(set! (-> gp-0 height) (-> font-ctxt height))
(+! (-> gp-0 origin y)
(the float (the int (* 0.5 (- (-> gp-0 height) (print-game-subtitle str gp-0 #t 128 22)))))
)
(set! (-> gp-0 width) f30-0)
(set! (-> gp-0 height) f28-0)
)
)
(set! (-> gp-0 mat vector 0 x) (* (-> gp-0 mat vector 0 x) sv-136))
(set! (-> gp-0 mat vector 1 y) (* (-> gp-0 mat vector 1 y) sv-136))
(set! (-> *video-parms* relative-x-scale) (* (-> *video-parms* relative-x-scale) sv-136))
(set! (-> *video-parms* relative-y-scale) (* (-> *video-parms* relative-y-scale) sv-136))
(set! (-> *video-parms* relative-x-scale-reciprical) (/ 1.0 (-> *video-parms* relative-x-scale)))
(set! (-> *video-parms* relative-y-scale-reciprical) (/ 1.0 sv-136))
(set! sv-140 (-> str data))
(set! sv-144 (-> gp-0 origin x))
(set! sv-148 (-> gp-0 origin x))
(set! sv-152 (+ (-> gp-0 origin x) (-> font-ctxt width)))
(set! sv-156 (+ (-> gp-0 origin y) (-> font-ctxt height)))
(set! sv-160 (* (get-string-length " " gp-0) (-> *video-parms* relative-x-scale)))
(set! sv-164 (* (if (logtest? (-> gp-0 flags) (font-flags large))
(the float line-height)
14.0
)
sv-136
)
)
(set! sv-168 0)
(if (logtest? (-> gp-0 flags) (font-flags middle))
(+! (-> gp-0 origin x) (* 0.5 (-> font-ctxt width)))
)
(set! sv-176 (the-as int (-> sv-140 0)))
(set! sv-184 0)
(set! sv-192 0)
(set! sv-200 0)
(set! sv-208 (the-as symbol #f))
(set! sv-212 (the-as symbol #f))
(set! (-> *game-text-line* data 0) (the-as uint 0))
(while (or (not (and (zero? sv-176) (zero? sv-184) (zero? sv-192))) (>= sv-156 (-> gp-0 origin y)))
(cond
((= sv-176 32)
(set! (-> *game-text-word* data sv-184) (the-as uint sv-176))
(set! sv-184 (+ sv-184 1))
(set! sv-208 #t)
)
((zero? sv-176)
(if (zero? sv-184)
(set! sv-212 #t)
(set! sv-208 #t)
)
)
(else
(if (= sv-176 95)
(set! sv-176 32)
)
(set! (-> *game-text-word* data sv-184) (the-as uint sv-176))
(set! sv-184 (+ sv-184 1))
)
)
(when (= sv-208 #t)
(set! (-> *game-text-word* data sv-184) (the-as uint 0))
(let* ((f30-1 sv-144)
(f0-49 (* (get-string-length *game-text-word* gp-0) (-> *video-parms* relative-x-scale)))
(f1-14 (+ f30-1 f0-49))
)
(if (= (-> *game-text-word* data (+ sv-184 -1)) 32)
(set! f1-14 (- f1-14 sv-160))
)
(cond
((< sv-152 f1-14)
(set! sv-144 (+ sv-148 f0-49))
(set! sv-212 #t)
)
(else
(set! sv-144 (+ sv-144 f0-49))
)
)
)
)
(when (= sv-212 #t)
(when (>= sv-200 (the-as int (-> gp-0 start-line)))
(let ((f30-2 (+ (-> gp-0 origin y) sv-164)))
(when (>= sv-156 f30-2)
(when (= (-> *game-text-line* data (+ sv-192 -1)) 32)
(set! (-> *game-text-line* data (+ sv-192 -1)) (the-as uint 0))
(when (and (= (-> *game-text-line* data (+ sv-192 -5)) 126) (= (-> *game-text-line* data (+ sv-192 -2)) 72))
(set! (-> *game-text-line* data (+ sv-192 -5)) (the-as uint 0))
0
)
)
)
(when (and (= (-> *game-text-line* data (+ sv-192 -4)) 126) (= (-> *game-text-line* data (+ sv-192 -1)) 72))
(set! (-> *game-text-line* data (+ sv-192 -4)) (the-as uint 0))
0
)
(if (nonzero? (-> *game-text-line* data 0))
(set! sv-168 (+ sv-168 1))
)
(when (not opaque)
(let* ((s1-1 (-> *display* frames (-> *display* on-screen) frame global-buf))
(s2-1 (-> s1-1 base))
)
(set-font-color-alpha (-> font-ctxt color) alpha)
(draw-string *game-text-line* s1-1 gp-0)
(set-font-color-alpha (-> font-ctxt color) 128)
(set! (-> gp-0 color) (-> *font-work* last-color))
(let ((a3-3 (-> s1-1 base)))
(let ((v1-127 (the-as object (-> s1-1 base))))
(set! (-> (the-as dma-packet v1-127) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> (the-as dma-packet v1-127) vif0) (new 'static 'vif-tag))
(set! (-> (the-as dma-packet v1-127) vif1) (new 'static 'vif-tag))
(set! (-> s1-1 base) (&+ (the-as pointer v1-127) 16))
)
(dma-bucket-insert-tag
(-> *display* frames (-> *display* on-screen) frame bucket-group)
(bucket-id subtitle)
s2-1
(the-as (pointer dma-tag) a3-3)
)
)
)
)
(set! (-> gp-0 origin y) f30-2)
)
)
(set! sv-200 (+ sv-200 1))
(set! (-> *game-text-line* data 0) (the-as uint 0))
(set! sv-192 0)
(set! sv-212 (the-as symbol #f))
)
(when (= sv-208 #t)
(copy-charp<-charp (&-> *game-text-line* data sv-192) (-> *game-text-word* data))
(set! sv-192 (+ sv-192 sv-184))
(set! sv-184 0)
(set! sv-208 (the-as symbol #f))
)
(when (nonzero? sv-176)
(set! sv-140 (&-> sv-140 1))
(set! sv-176 (the-as int (-> sv-140 0)))
)
)
(set! (-> gp-0 mat vector 0 x) sv-112)
(set! (-> gp-0 mat vector 1 y) sv-116)
(set! (-> *video-parms* relative-x-scale) sv-120)
(set! (-> *video-parms* relative-y-scale) sv-124)
(set! (-> *video-parms* relative-x-scale-reciprical) sv-128)
(set! (-> *video-parms* relative-y-scale-reciprical) sv-132)
(if (> sv-168 0)
(* sv-164 (the float sv-168))
0.0
)
)
)
)
(defmethod subtitle-format subtitle ((obj subtitle) (keyframe subtitle-keyframe))
"check settings and format subtitle accordingly."
(cond
((= 0 (length (-> keyframe speaker)))
;; there's no speaker so who cares.
(string-format "~S" (-> keyframe string))
)
((or (= #t (-> *pc-settings* subtitle-speaker?))
(and (= 'auto (-> *pc-settings* subtitle-speaker?)) (-> keyframe offscreen)))
(and (= 'auto (-> *pc-settings* subtitle-speaker?)) (subtitle-flags? keyframe offscreen)))
;; there is a speaker and we do want it.
(string-format "~3L~S:~0L ~S" (-> keyframe speaker) (-> keyframe string))
)
(else
(string-format "~S" (-> keyframe string))
)
)
)
(defun subtitle? ()
@@ -243,41 +510,47 @@
(defstate subtitle-process (subtitle)
:event (behavior ((from process) (argc int) (msg symbol) (block event-message-block))
(case msg
(('subtitle-start)
0
)
(('debug)
(go subtitle-debug)
)
)
)
:code (behavior ()
(loop
(suspend))
)
:trans (behavior ()
(load-level-subtitle-files 0)
;; reset params
(set! (-> self want-subtitle) (the subtitle-keyframe #f))
(set! (-> self spool-name) #f)
(set! (-> self cur-channel) (pc-subtitle-channel invalid))
(none))
:post (behavior ()
;; check what kind of subtitles are running
(when (and (movie?) (-> *art-control* spool-lock) (-> *art-control* active-stream))
;; there's a cutscene happening and an active spool with a valid owner.
(set! (-> self spool-name) (-> *art-control* active-stream))
(set! (-> self cur-channel) (pc-subtitle-channel movie))
(with-proc ((handle->process (-> *art-control* spool-lock)))
(format *stdcon* "current spool frame is ~D~%" (the int (ja-aframe-num 0)))
(format *stdcon* "movie spool detected~%current spool frame is ~D~%" (the int (ja-aframe-num 0)))
)
)
;; do subtitles
(case (-> self cur-channel)
(((pc-subtitle-channel movie))
;; cutscenes, check if user toggled subtitles
(if (and (= 'game *master-mode*) (cpad-pressed? 0 square))
(not! (-> *pc-settings* subtitles?)))
(when (subtitle?)
;; subtitles on! get a subtitle info that matches our current cutscene, and find at what point we're in.
(let ((scene (get-scene-by-name *subtitle-text* (-> self cur-channel) (-> self spool-name))))
@@ -294,28 +567,121 @@
(when (>= pos (-> scene keyframes i frame))
(set! keyframe (-> scene keyframes i)))
)
(when keyframe
;; we got the closest keyframe! finally just render the subtitles!
(print-game-text (subtitle-format self keyframe) (-> self font) #f 128 22)
(#when PC_SUBTITLE_DEBUG
(draw-debug-text-box (-> self font))
)
)
;; and save it!
(set! (-> self want-subtitle) keyframe)
)
)
)
;; keep this for later
(set! (-> self old-spool-name) (-> self spool-name))
)
)
)
(when *debug-segment*
(when (and (cpad-hold? 0 l3) (cpad-pressed? 0 start))
(cpad-clear! 0 start)
(send-event self 'debug)
)
)
(none))
:post (behavior ()
;; set font settings.
(set! (-> self font origin x) (* (- 1.0 (-> *SUBTITLE-bank* width)) 256))
(set! (-> self font origin y) (* (-> *SUBTITLE-bank* height) 224))
(set-width! (-> self font) (the int (* (-> *SUBTITLE-bank* width) 512)))
(set-height! (-> self font) (the int (* (-> *SUBTITLE-bank* lines) 11)))
(set-scale! (-> self font) (-> *SUBTITLE-bank* scale))
(when (-> self want-subtitle)
;; we got a valid subtitle! render it.
(print-game-subtitle (subtitle-format self (-> self want-subtitle)) (-> self font) #f 128 22)
(#when PC_SUBTITLE_DEBUG
(draw-debug-text-box (-> self font))
)
)
0)
)
(defstate subtitle-debug (subtitle)
:event (behavior ((from process) (argc int) (msg symbol) (block event-message-block))
(case msg
(('debug)
(go subtitle-process)
)
)
)
:enter (behavior ()
(mem-copy! (the pointer (-> self bank-backup)) (the pointer *SUBTITLE-bank*) (size-of subtitle-bank))
(set-master-mode 'pause)
)
:exit (behavior ()
(toggle-pause) (none)) ;; todo fuck
:trans (behavior ()
(with-dma-buffer-add-bucket ((buf (-> (current-frame) debug-buf))
(bucket-id debug))
(draw-string-xy "~3LSUBTITLE DEBUG!~0L" buf 16 40 (font-color default) (font-flags shadow kerning))
(draw-string-xy "Square: reset" buf 16 48 (font-color default) (font-flags shadow kerning))
(draw-string-xy "Up/down: Move vertically" buf 16 56 (font-color default) (font-flags shadow kerning))
(draw-string-xy "Triangle+R1/L1: width" buf 16 64 (font-color default) (font-flags shadow kerning))
(draw-string-xy "Triangle+R2/L2: height" buf 16 72 (font-color default) (font-flags shadow kerning))
(draw-string-xy "Circle+R1/L1: scale" buf 16 80 (font-color default) (font-flags shadow kerning))
(draw-string-xy "L3+Start: exit" buf 16 88 (font-color default) (font-flags shadow kerning))
)
(when (= 'pause *master-mode*)
(when (cpad-pressed? 0 square)
(mem-copy! (the pointer *SUBTITLE-bank*) (the pointer (-> self bank-backup)) (size-of subtitle-bank))
)
(when (cpad-hold? 0 up) (+! (-> *SUBTITLE-bank* height) -0.01))
(when (cpad-hold? 0 down) (+! (-> *SUBTITLE-bank* height) 0.01))
(cond
((cpad-hold? 0 triangle)
(when (cpad-hold? 0 r1) (-! (-> *SUBTITLE-bank* width) 0.01))
(when (cpad-hold? 0 l1) (+! (-> *SUBTITLE-bank* width) 0.01))
(when (cpad-hold? 0 r2) (-! (-> *SUBTITLE-bank* lines) 0.05))
(when (cpad-hold? 0 l2) (+! (-> *SUBTITLE-bank* lines) 0.05))
)
((cpad-hold? 0 circle)
(when (cpad-hold? 0 r1) (+! (-> *SUBTITLE-bank* scale) 0.01))
(when (cpad-hold? 0 l1) (-! (-> *SUBTITLE-bank* scale) 0.01))
)
)
)
(when (and (cpad-hold? 0 l3) (cpad-pressed? 0 start))
(cpad-clear! 0 start)
(send-event self 'debug)
)
(none))
:code (-> subtitle-process code)
:post (-> subtitle-process post)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; helper functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -333,11 +699,19 @@
)
(defbehavior subtitle-init-by-other subtitle ()
"external initializer for subtitle process"
(set! (-> self font) (new 'process 'font-context *font-default-matrix*
0 0 0.0 (font-color default) (font-flags shadow kerning middle large)))
(go subtitle-process)
)
(defun subtitle-stop ()
"kill the subtitle process"
(kill-by-type subtitle *active-pool*)
(kill-by-type subtitle *display-pool*)
(set! *subtitle* (the (pointer subtitle) #f)))
(defun subtitle-start ()
@@ -346,20 +720,10 @@
(when *subtitle*
(subtitle-stop)
)
(set! *subtitle* (process-new subtitle
(lambda :behavior subtitle ()
(set! (-> self font) (new 'process 'font-context *font-default-matrix*
(the int (* 0.12 256)) (+ 112 (* 11 5)) 0.0
(font-color default)
(font-flags shadow kerning middle large)))
(set-scale! (-> self font) 0.5)
(set-width! (-> self font) (the int (* 0.88 256 2)))
(set-height! (-> self font) (* 11 3))
(go subtitle-process)
)
:from *pc-dead-pool* :to *active-pool*
:stack-size (* 1 1024)))
(set! *subtitle* (process-new subtitle subtitle-init-by-other
:from *pc-dead-pool* :to *display-pool*
:stack-size (* 1 1024)))
)
@@ -367,7 +731,4 @@
(subtitle-start)
)
+1 -2
View File
@@ -27,11 +27,10 @@ add_library(compiler
compiler/compilation/State.cpp
compiler/compilation/Static.cpp
compiler/Util.cpp
data_compiler/game_text.cpp
data_compiler/game_text_common.cpp
data_compiler/dir_tpages.cpp
data_compiler/DataObjectGenerator.cpp
data_compiler/game_count.cpp
data_compiler/game_subtitle.cpp
debugger/Debugger.cpp
debugger/DebugInfo.cpp
listener/Listener.cpp
+1 -2
View File
@@ -18,8 +18,7 @@
#include "goalc/emitter/Register.h"
#include "goalc/listener/Listener.h"
#include "goalc/make/MakeSystem.h"
#include "goalc/data_compiler/game_text.h"
#include "goalc/data_compiler/game_subtitle.h"
#include "goalc/data_compiler/game_text_common.h"
enum MathMode { MATH_INT, MATH_BINT, MATH_FLOAT, MATH_INVALID };
+27 -23
View File
@@ -15,8 +15,7 @@
#include "goalc/compiler/IR.h"
#include "goalc/data_compiler/dir_tpages.h"
#include "goalc/data_compiler/game_count.h"
#include "goalc/data_compiler/game_text.h"
#include "goalc/data_compiler/game_subtitle.h"
#include "goalc/data_compiler/game_text_common.h"
/*!
* Exit the compiler. Disconnects the listener and tells the target to reset itself.
@@ -82,29 +81,34 @@ Val* Compiler::compile_asm_data_file(const goos::Object& form, const goos::Objec
Val* Compiler::compile_asm_text_file(const goos::Object& form, const goos::Object& rest, Env* env) {
(void)env;
auto args = get_va(form, rest);
va_check(form, args, {goos::ObjectType::SYMBOL, goos::ObjectType::INTEGER},
{{"files", {true, goos::ObjectType::PAIR}}});
auto kind = symbol_string(args.unnamed.at(0));
va_check(form, args, {goos::ObjectType::SYMBOL}, {{"files", {true, goos::ObjectType::PAIR}}});
// list of files per text version.
std::unordered_map<GameTextVersion, std::vector<std::string>> inputs;
// what kind of text file?
const auto kind = symbol_string(args.unnamed.at(0));
// open all project files specified (usually one).
for_each_in_list(args.named.at("files"), [this, &inputs, &form, &kind](const goos::Object& o) {
if (o.is_string()) {
open_text_project(kind, o.as_string()->data, inputs);
} else {
throw_compiler_error(form, "Invalid object {} in asm-text-file files list.", o.print());
}
});
// compile files.
if (kind == "subtitle") {
std::vector<std::string> files;
for_each_in_list(args.named.at("files"), [this, &files, &form](const goos::Object& o) {
if (o.is_string()) {
files.push_back(o.as_string()->data);
} else {
throw_compiler_error(form, "Invalid object {} in asm-text-file files list.", o.print());
}
});
compile_game_subtitle(files, (GameTextVersion)args.unnamed.at(1).as_int());
for (auto& [ver, in] : inputs) {
GameSubtitleDB db;
compile_game_subtitle(in, ver, db);
}
} else if (kind == "text") {
std::vector<std::string> files;
for_each_in_list(args.named.at("files"), [this, &files, &form](const goos::Object& o) {
if (o.is_string()) {
files.push_back(o.as_string()->data);
} else {
throw_compiler_error(form, "Invalid object {} in asm-text-file files list.", o.print());
}
});
compile_game_text(files, (GameTextVersion)args.unnamed.at(1).as_int());
for (auto& [ver, in] : inputs) {
GameTextDB db;
compile_game_text(in, ver, db);
}
} else {
throw_compiler_error(form, "The option {} was not recognized for asm-text-file.", kind);
}
-192
View File
@@ -1,192 +0,0 @@
/*!
* @file game_subtitle.cpp
* Builds the XSUBTIT.TXT text files. Each file contains all the strings used as subtitles for
* cutscenes, hints and ambient speech, along with the timings.
*
* This kind of file is completely custom.
*/
#include <algorithm>
#include <new>
#include <queue>
#include "game_subtitle.h"
#include "DataObjectGenerator.h"
#include "common/goos/Reader.h"
#include "common/util/FileUtil.h"
#include "common/goos/ParseHelpers.h"
#include "third-party/fmt/core.h"
namespace {
int64_t get_int(const goos::Object& obj) {
if (obj.is_int()) {
return obj.integer_obj.value;
}
throw std::runtime_error(obj.print() + " was supposed to be an integer, but isn't");
}
const goos::Object& car(const goos::Object& x) {
if (!x.is_pair()) {
throw std::runtime_error("invalid pair");
}
return x.as_pair()->car;
}
const goos::Object& cdr(const goos::Object& x) {
if (!x.is_pair()) {
throw std::runtime_error("invalid pair");
}
return x.as_pair()->cdr;
}
std::string uppercase(const std::string& in) {
std::string result;
result.reserve(in.size());
for (auto c : in) {
if (c >= 'a' && c <= 'z') {
c -= ('a' - 'A');
}
result.push_back(c);
}
return result;
}
/*!
* Parse a game subtitle file.
* Information is added to the game subtitles database.
*
* The file should begin with (language-id x y z...) with the given language IDs.
* Each entry should be (name (frame "line-text-0" "line-text-1") ... )
* This adds the subtitle to each of the specified languages.
*/
void parse(const goos::Object& data, GameTextVersion text_ver, GameSubtitleDB& db) {
auto font = get_font_bank(text_ver);
std::map<int, std::shared_ptr<GameSubtitleBank>> banks;
for_each_in_list(data.as_pair()->cdr, [&](const goos::Object& obj) {
if (obj.is_pair()) {
auto& head = car(obj);
if (head.is_symbol() && head.as_symbol()->name == "language-id") {
if (banks.size() != 0) {
throw std::runtime_error("Languages have been set multiple times.");
}
if (cdr(obj).is_empty_list()) {
throw std::runtime_error("At least one language must be set.");
}
for_each_in_list(cdr(obj), [&](const goos::Object& obj) {
auto lang = get_int(obj);
if (!db.bank_exists(lang)) {
// database has no lang yet
banks[lang] = db.add_bank(std::make_shared<GameSubtitleBank>(lang));
} else {
banks[lang] = db.bank_by_id(lang);
}
});
}
else if (head.is_string()) {
if (banks.size() == 0) {
throw std::runtime_error("At least one language must be set before defining entries.");
}
GameSubtitleSceneInfo scene(head.as_string()->data);
for_each_in_list(cdr(obj), [&](const goos::Object& entry) {
if (entry.is_pair()) {
if (!car(entry).is_int() || !car(cdr(entry)).is_symbol() ||
!car(cdr(cdr(entry))).is_string() || !car(cdr(cdr(cdr(entry)))).is_string()) {
throw std::runtime_error(
"Each entry must be of format (number symbol \"string\" \"string\")");
}
auto line = font->convert_utf8_to_game(car(cdr(cdr(cdr(entry)))).as_string()->data);
auto speaker = font->convert_utf8_to_game(car(cdr(cdr(entry))).as_string()->data);
auto offscreen = car(cdr(entry)).as_symbol()->name != "#f";
scene.add_line(car(entry).as_int(), line, speaker, offscreen);
} else {
throw std::runtime_error("Each entry must be a list");
}
});
for (auto& [lang, bank] : banks) {
if (!bank->scene_exists(scene.name())) {
bank->add_scene(scene);
} else {
// this should copy the data, so it's safe to delete the new one afterwards.
auto& old_scene = bank->scene_by_name(scene.name());
old_scene.from_other_scene(scene);
}
}
} else {
throw std::runtime_error("Invalid game subtitles file entry: " + head.print());
}
} else {
throw std::runtime_error("Invalid game subtitles file");
}
});
if (banks.size() == 0) {
throw std::runtime_error("At least one language must be set.");
}
}
/*!
* Write game subtitle data to a file. Uses the V2 object format which is identical between GOAL and
* OpenGOAL.
*/
void compile(GameSubtitleDB& db) {
for (const auto& [lang, bank] : db.banks()) {
DataObjectGenerator gen;
gen.add_type_tag("subtitle-text-info"); // type
gen.add_word(bank->scenes().size()); // length
gen.add_word(lang); // lang
gen.add_word(0); // dummy
// fifo queue for scene data arrays
std::queue<int> array_link_sources;
// now add all the scene infos
for (auto& [name, scene] : bank->scenes()) {
gen.add_word(0 |
(scene.lines().size() << 16)); // kind (lower 16 bits), length (upper 16 bits)
array_link_sources.push(gen.words());
gen.add_word(0); // keyframes (linked later)
gen.add_ref_to_string_in_pool(scene.name()); // name
gen.add_word(0); // pad (string is 4 bytes but we have 8)
}
// now add all the scene *data!* (keyframes)
for (auto& [name, scene] : bank->scenes()) {
// link inline-array with reference from earlier
gen.link_word_to_word(array_link_sources.front(), gen.words());
array_link_sources.pop();
for (auto& subtitle : scene.lines()) {
gen.add_word(subtitle.frame); // frame
gen.add_ref_to_string_in_pool(subtitle.line); // line
gen.add_ref_to_string_in_pool(subtitle.speaker); // speaker
gen.add_symbol_link(subtitle.offscreen ? "#t" : "#f"); // offscreen
}
}
auto data = gen.generate_v2();
file_util::create_dir_if_needed(file_util::get_file_path({"out", "iso"}));
file_util::write_binary_file(
file_util::get_file_path(
{"out", "iso", fmt::format("{}{}.TXT", lang, uppercase("subtit"))}),
data.data(), data.size());
}
}
} // namespace
void compile_game_subtitle(const std::vector<std::string>& filenames, GameTextVersion text_ver) {
GameSubtitleDB db;
goos::Reader reader;
for (auto& filename : filenames) {
fmt::print("[Build Game Subtitle] {}\n", filename.c_str());
auto code = reader.read_from_file({filename});
parse(code, text_ver, db);
}
compile(db);
}
-210
View File
@@ -1,210 +0,0 @@
/*!
* @file game_text.cpp
* Builds the XCOMMON.TXT text files. Each file contains all the strings that appear in the game
* translated into a language.
*
* The decompiler/data/game_text.cpp file extracts text from the game and creates a file that
* can be read with these functions.
*/
#include <algorithm>
#include "game_text.h"
#include "common/goos/Reader.h"
#include "DataObjectGenerator.h"
#include "common/util/FileUtil.h"
#include "common/util/FontUtils.h"
#include "common/goos/ParseHelpers.h"
#include "third-party/fmt/core.h"
namespace {
int64_t get_int(const goos::Object& obj) {
if (obj.is_int()) {
return obj.integer_obj.value;
}
throw std::runtime_error(obj.print() + " was supposed to be an integer, but isn't");
}
const goos::Object& car(const goos::Object& x) {
if (!x.is_pair()) {
throw std::runtime_error("invalid pair");
}
return x.as_pair()->car;
}
const goos::Object& cdr(const goos::Object& x) {
if (!x.is_pair()) {
throw std::runtime_error("invalid pair");
}
return x.as_pair()->cdr;
}
std::string get_string(const goos::Object& x) {
if (x.is_string()) {
return x.as_string()->data;
}
throw std::runtime_error(x.print() + " was supposed to be a string, but isn't");
}
std::string uppercase(const std::string& in) {
std::string result;
result.reserve(in.size());
for (auto c : in) {
if (c >= 'a' && c <= 'z') {
c -= ('a' - 'A');
}
result.push_back(c);
}
return result;
}
/*!
* Parse a game text file.
* Information is added to the game text database.
*
* The file should begin with (language-id x y z...) with the given language IDs.
* Each entry should be (id "line for 1st language" "line for 2nd language" ...)
* This adds the text line to each of the specified languages.
*/
void parse(const goos::Object& data, GameTextVersion text_ver, GameTextDB& db) {
auto font = get_font_bank(text_ver);
std::vector<std::shared_ptr<GameTextBank>> banks;
bool group_name_set = false;
std::string possible_group_name;
for_each_in_list(data.as_pair()->cdr, [&](const goos::Object& obj) {
if (obj.is_pair()) {
auto& head = car(obj);
if (head.is_symbol() && head.as_symbol()->name == "language-id") {
if (banks.size() != 0) {
throw std::runtime_error("Languages have been set multiple times.");
}
if (cdr(obj).is_empty_list()) {
throw std::runtime_error("At least one language must be set.");
}
if (!group_name_set) {
throw std::runtime_error("Text group must be set before languages.");
}
for_each_in_list(cdr(obj), [&](const goos::Object& obj) {
auto lang = get_int(obj);
if (!db.bank_exists(possible_group_name, lang)) {
// database has no lang in this group yet
banks.push_back(db.add_bank(possible_group_name, std::make_shared<GameTextBank>(lang)));
} else {
banks.push_back(db.bank_by_id(possible_group_name, lang));
}
});
} else if (head.is_symbol() && head.as_symbol()->name == "group-name") {
if (group_name_set) {
throw std::runtime_error("group-name has been set multiple times.");
}
group_name_set = true;
possible_group_name = get_string(car(cdr(obj)));
if (!cdr(cdr(obj)).is_empty_list()) {
throw std::runtime_error("group-name has too many arguments");
}
}
else if (head.is_int()) {
if (banks.size() == 0) {
throw std::runtime_error("At least one language must be set before defining entries.");
}
int i = 0;
int id = head.as_int();
for_each_in_list(cdr(obj), [&](const goos::Object& entry) {
if (entry.is_string()) {
if (i >= int(banks.size())) {
throw std::runtime_error(fmt::format("Too many strings in text id #x{:x}", id));
}
auto line = font->convert_utf8_to_game(entry.as_string()->data);
banks[i++]->set_line(id, line);
} else {
throw std::runtime_error(fmt::format("Non-string value in text id #x{:x}", id));
}
});
if (i != int(banks.size())) {
throw std::runtime_error(
fmt::format("Not enough strings specified in text id #x{:x}", id));
}
} else {
throw std::runtime_error("Invalid game text file entry: " + head.print());
}
} else {
throw std::runtime_error("Invalid game text file");
}
});
if (banks.size() == 0) {
throw std::runtime_error("At least one language must be set.");
}
}
/*
(deftype game-text (structure)
((id uint32 :offset-assert 0)
(text basic :offset-assert 4)
)
)
(deftype game-text-info (basic)
((length int32 :offset-assert 4)
(language-id int32 :offset-assert 8)
(group-name basic :offset-assert 12)
(data game-text :dynamic :offset-assert 16)
)
)
*/
/*!
* Write game text data to a file. Uses the V2 object format which is identical between GOAL and
* OpenGOAL, so this should produce exactly identical files to what is found in the game.
*/
void compile(GameTextDB& db) {
for (const auto& [group_name, banks] : db.groups()) {
for (const auto& [lang, bank] : banks) {
DataObjectGenerator gen;
gen.add_type_tag("game-text-info"); // type
gen.add_word(bank->lines().size()); // length
gen.add_word(lang); // language-id
// this string is found in the string pool.
gen.add_ref_to_string_in_pool(group_name); // group-name
// now add all the datas: (the lines are already sorted by id)
for (auto& [id, line] : bank->lines()) {
gen.add_word(id); // id
// these strings must be in the string pool, as sometimes there are duplicate
// strings in a single language, and these strings should be stored once and have multiple
// references to them.
gen.add_ref_to_string_in_pool(line); // text
}
auto data = gen.generate_v2();
file_util::create_dir_if_needed(file_util::get_file_path({"out", "iso"}));
file_util::write_binary_file(
file_util::get_file_path(
{"out", "iso", fmt::format("{}{}.TXT", lang, uppercase(group_name))}),
data.data(), data.size());
}
}
}
} // namespace
/*!
* Read a game text description file and generate GOAL objects.
*/
void compile_game_text(const std::vector<std::string>& filenames, GameTextVersion text_ver) {
GameTextDB db;
goos::Reader reader;
for (auto& filename : filenames) {
fmt::print("[Build Game Text] {}\n", filename.c_str());
auto code = reader.read_from_file({filename});
parse(code, text_ver, db);
}
compile(db);
}
-62
View File
@@ -1,62 +0,0 @@
#pragma once
#include "common/util/FontUtils.h"
#include "common/util/Assert.h"
#include <string>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
class GameTextBank {
public:
GameTextBank(int lang_id) : m_lang_id(lang_id) {}
int lang() const { return m_lang_id; }
const std::map<int, std::string>& lines() const { return m_lines; }
bool line_exists(int id) const { return m_lines.find(id) != m_lines.end(); }
std::string line(int id) { return m_lines.at(id); }
void set_line(int id, std::string line) { m_lines[id] = line; }
private:
int m_lang_id;
std::map<int, std::string> m_lines;
};
/*!
* The text database contains a text bank for each language for each text group.
* Each text bank contains a list of text lines. Very simple.
*/
class GameTextDB {
public:
const std::unordered_map<std::string, std::map<int, std::shared_ptr<GameTextBank>>>& groups()
const {
return m_banks;
}
const std::map<int, std::shared_ptr<GameTextBank>>& banks(std::string group) const {
return m_banks.at(group);
}
bool bank_exists(std::string group, int id) const {
if (m_banks.find(group) == m_banks.end())
return false;
return m_banks.at(group).find(id) != m_banks.at(group).end();
}
std::shared_ptr<GameTextBank> add_bank(std::string group, std::shared_ptr<GameTextBank> bank) {
ASSERT(!bank_exists(group, bank->lang()));
m_banks[group][bank->lang()] = bank;
return bank;
}
std::shared_ptr<GameTextBank> bank_by_id(std::string group, int id) {
if (!bank_exists(group, id)) {
return nullptr;
}
return m_banks.at(group).at(id);
}
private:
std::unordered_map<std::string, std::map<int, std::shared_ptr<GameTextBank>>> m_banks;
};
void compile_game_text(const std::vector<std::string>& filenames, GameTextVersion text_ver);
+408
View File
@@ -0,0 +1,408 @@
/*!
* @file game_text.cpp
* Builds the XCOMMON.TXT text files. Each file contains all the strings that appear in the game
* translated into a language.
*
* The decompiler/data/game_text.cpp file extracts text from the game and creates a file that
* can be read with these functions.
*
* Also builds the XSUBTIT.TXT text files. Each file contains all the strings used as subtitles for
* cutscenes, hints and ambient speech, along with the timings.
* This kind of file is completely custom.
*/
#include <algorithm>
#include <queue>
#include "game_text_common.h"
#include "common/goos/Reader.h"
#include "DataObjectGenerator.h"
#include "common/util/FileUtil.h"
#include "common/util/FontUtils.h"
#include "common/goos/ParseHelpers.h"
#include "third-party/fmt/core.h"
namespace {
int64_t get_int(const goos::Object& obj) {
if (obj.is_int()) {
return obj.integer_obj.value;
}
throw std::runtime_error(obj.print() + " was supposed to be an integer, but isn't");
}
const goos::Object& car(const goos::Object& x) {
if (!x.is_pair()) {
throw std::runtime_error("invalid pair");
}
return x.as_pair()->car;
}
const goos::Object& cdr(const goos::Object& x) {
if (!x.is_pair()) {
throw std::runtime_error("invalid pair");
}
return x.as_pair()->cdr;
}
std::string get_string(const goos::Object& x) {
if (x.is_string()) {
return x.as_string()->data;
}
throw std::runtime_error(x.print() + " was supposed to be a string, but isn't");
}
std::string uppercase(const std::string& in) {
std::string result;
result.reserve(in.size());
for (auto c : in) {
if (c >= 'a' && c <= 'z') {
c -= ('a' - 'A');
}
result.push_back(c);
}
return result;
}
/*!
* Parse a game text file.
* Information is added to the game text database.
*
* The file should begin with (language-id x y z...) with the given language IDs.
* Each entry should be (id "line for 1st language" "line for 2nd language" ...)
* This adds the text line to each of the specified languages.
*/
void parse_text(const goos::Object& data, GameTextVersion text_ver, GameTextDB& db) {
auto font = get_font_bank(text_ver);
std::vector<std::shared_ptr<GameTextBank>> banks;
std::string possible_group_name;
for_each_in_list(data.as_pair()->cdr, [&](const goos::Object& obj) {
if (obj.is_pair()) {
auto& head = car(obj);
if (head.is_symbol() && head.as_symbol()->name == "language-id") {
if (banks.size() != 0) {
throw std::runtime_error("Languages have been set multiple times.");
}
if (cdr(obj).is_empty_list()) {
throw std::runtime_error("At least one language must be set.");
}
if (possible_group_name.empty()) {
throw std::runtime_error("Text group must be set before languages.");
}
for_each_in_list(cdr(obj), [&](const goos::Object& obj) {
auto lang = get_int(obj);
if (!db.bank_exists(possible_group_name, lang)) {
// database has no lang in this group yet
banks.push_back(db.add_bank(possible_group_name, std::make_shared<GameTextBank>(lang)));
} else {
banks.push_back(db.bank_by_id(possible_group_name, lang));
}
});
} else if (head.is_symbol() && head.as_symbol()->name == "group-name") {
if (!possible_group_name.empty()) {
throw std::runtime_error("group-name has been set multiple times.");
}
possible_group_name = get_string(car(cdr(obj)));
if (possible_group_name.empty()) {
throw std::runtime_error("invalid group-name.");
}
if (!cdr(cdr(obj)).is_empty_list()) {
throw std::runtime_error("group-name has too many arguments");
}
}
else if (head.is_int()) {
if (banks.size() == 0) {
throw std::runtime_error("At least one language must be set before defining entries.");
}
int i = 0;
int id = head.as_int();
for_each_in_list(cdr(obj), [&](const goos::Object& entry) {
if (entry.is_string()) {
if (i >= int(banks.size())) {
throw std::runtime_error(fmt::format("Too many strings in text id #x{:x}", id));
}
auto line = font->convert_utf8_to_game(entry.as_string()->data);
banks[i++]->set_line(id, line);
} else {
throw std::runtime_error(fmt::format("Non-string value in text id #x{:x}", id));
}
});
if (i != int(banks.size())) {
throw std::runtime_error(
fmt::format("Not enough strings specified in text id #x{:x}", id));
}
} else {
throw std::runtime_error("Invalid game text file entry: " + head.print());
}
} else {
throw std::runtime_error("Invalid game text file");
}
});
if (banks.size() == 0) {
throw std::runtime_error("At least one language must be set.");
}
}
/*
(deftype game-text (structure)
((id uint32 :offset-assert 0)
(text basic :offset-assert 4)
)
)
(deftype game-text-info (basic)
((length int32 :offset-assert 4)
(language-id int32 :offset-assert 8)
(group-name basic :offset-assert 12)
(data game-text :dynamic :offset-assert 16)
)
)
*/
/*!
* Write game text data to a file. Uses the V2 object format which is identical between GOAL and
* OpenGOAL, so this should produce exactly identical files to what is found in the game.
*/
void compile_text(GameTextDB& db) {
for (const auto& [group_name, banks] : db.groups()) {
for (const auto& [lang, bank] : banks) {
DataObjectGenerator gen;
gen.add_type_tag("game-text-info"); // type
gen.add_word(bank->lines().size()); // length
gen.add_word(lang); // language-id
// this string is found in the string pool.
gen.add_ref_to_string_in_pool(group_name); // group-name
// now add all the datas: (the lines are already sorted by id)
for (auto& [id, line] : bank->lines()) {
gen.add_word(id); // id
// these strings must be in the string pool, as sometimes there are duplicate
// strings in a single language, and these strings should be stored once and have multiple
// references to them.
gen.add_ref_to_string_in_pool(line); // text
}
auto data = gen.generate_v2();
file_util::create_dir_if_needed(file_util::get_file_path({"out", "iso"}));
file_util::write_binary_file(
file_util::get_file_path(
{"out", "iso", fmt::format("{}{}.TXT", lang, uppercase(group_name))}),
data.data(), data.size());
}
}
}
/*!
* Parse a game subtitle file.
* Information is added to the game subtitles database.
*
* The file should begin with (language-id x y z...) for the given language IDs.
* Each scene should be (scene-name <entry 1> <entry 2> ... )
* This adds the subtitle to each of the specified languages.
*/
void parse_subtitle(const goos::Object& data, GameTextVersion text_ver, GameSubtitleDB& db) {
auto font = get_font_bank(text_ver);
std::map<int, std::shared_ptr<GameSubtitleBank>> banks;
for_each_in_list(data.as_pair()->cdr, [&](const goos::Object& obj) {
if (obj.is_pair()) {
auto& head = car(obj);
if (head.is_symbol() && head.as_symbol()->name == "language-id") {
if (banks.size() != 0) {
throw std::runtime_error("Languages have been set multiple times.");
}
if (cdr(obj).is_empty_list()) {
throw std::runtime_error("At least one language must be set.");
}
for_each_in_list(cdr(obj), [&](const goos::Object& obj) {
auto lang = get_int(obj);
if (!db.bank_exists(lang)) {
// database has no lang yet
banks[lang] = db.add_bank(std::make_shared<GameSubtitleBank>(lang));
} else {
banks[lang] = db.bank_by_id(lang);
}
});
}
else if (head.is_string()) {
if (banks.size() == 0) {
throw std::runtime_error("At least one language must be set before defining entries.");
}
GameSubtitleSceneInfo scene(head.as_string()->data);
for_each_in_list(cdr(obj), [&](const goos::Object& entry) {
if (entry.is_pair()) {
// expected formats:
// (time <args>)
// all arguments have default values. the arguments are:
// "speaker" "line" - two strings. one for the speaker's name and one for the actual
// line. speaker can be empty. default is just empty string.
// :offscreen - speaker is offscreen. default is not offscreen.
if (!car(entry).is_int()) {
throw std::runtime_error("Each entry must start with a timestamp (number)");
}
auto time = car(entry).as_int();
goos::StringObject *speaker = nullptr, *line = nullptr;
bool offscreen = false;
for_each_in_list(cdr(entry), [&](const goos::Object& arg) {
if (arg.is_string()) {
if (!speaker) {
speaker = arg.as_string();
} else if (!line) {
line = arg.as_string();
} else {
throw std::runtime_error("Invalid string in subtitle entry");
}
} else if (speaker && !line) {
throw std::runtime_error(
"Invalid object in subtitle entry, expecting actual line string after speaker");
} else if (arg.is_symbol()) {
if (arg.as_symbol()->name == ":offscreen") {
offscreen = true;
}
}
});
auto line_str = font->convert_utf8_to_game(line ? line->data : "");
auto speaker_str = font->convert_utf8_to_game(speaker ? speaker->data : "");
scene.add_line(time, line_str, speaker_str, offscreen);
} else {
throw std::runtime_error("Each entry must be a list");
}
});
for (auto& [lang, bank] : banks) {
if (!bank->scene_exists(scene.name())) {
bank->add_scene(scene);
} else {
// this should copy the data, so it's safe to delete the new one afterwards.
auto& old_scene = bank->scene_by_name(scene.name());
old_scene.from_other_scene(scene);
}
}
} else {
throw std::runtime_error("Invalid game subtitles file entry: " + head.print());
}
} else {
throw std::runtime_error("Invalid game subtitles file");
}
});
if (banks.size() == 0) {
throw std::runtime_error("At least one language must be set.");
}
}
/*!
* Write game subtitle data to a file. Uses the V2 object format which is identical between GOAL and
* OpenGOAL.
*/
void compile_subtitle(GameSubtitleDB& db) {
for (const auto& [lang, bank] : db.banks()) {
DataObjectGenerator gen;
gen.add_type_tag("subtitle-text-info"); // type
gen.add_word(bank->scenes().size()); // length
gen.add_word(lang); // lang
gen.add_word(0); // dummy
// fifo queue for scene data arrays
std::queue<int> array_link_sources;
// now add all the scene infos
for (auto& [name, scene] : bank->scenes()) {
gen.add_word(0 |
(scene.lines().size() << 16)); // kind (lower 16 bits), length (upper 16 bits)
array_link_sources.push(gen.words());
gen.add_word(0); // keyframes (linked later)
gen.add_ref_to_string_in_pool(scene.name()); // name
gen.add_word(0); // pad (string is 4 bytes but we have 8)
}
// now add all the scene *data!* (keyframes)
for (auto& [name, scene] : bank->scenes()) {
// link inline-array with reference from earlier
gen.link_word_to_word(array_link_sources.front(), gen.words());
array_link_sources.pop();
for (auto& subtitle : scene.lines()) {
gen.add_word(subtitle.frame); // frame
gen.add_ref_to_string_in_pool(subtitle.line); // line
gen.add_ref_to_string_in_pool(subtitle.speaker); // speaker
gen.add_word(subtitle.offscreen); // offscreen
}
}
auto data = gen.generate_v2();
file_util::create_dir_if_needed(file_util::get_file_path({"out", "iso"}));
file_util::write_binary_file(
file_util::get_file_path(
{"out", "iso", fmt::format("{}{}.TXT", lang, uppercase("subtit"))}),
data.data(), data.size());
}
}
} // namespace
/*!
* Read a game text description file and generate GOAL objects.
*/
void compile_game_text(const std::vector<std::string>& filenames,
GameTextVersion text_ver,
GameTextDB& db) {
goos::Reader reader;
for (auto& filename : filenames) {
fmt::print("[Build Game Text] {}\n", filename.c_str());
auto code = reader.read_from_file({filename});
parse_text(code, text_ver, db);
}
compile_text(db);
}
void compile_game_subtitle(const std::vector<std::string>& filenames,
GameTextVersion text_ver,
GameSubtitleDB& db) {
goos::Reader reader;
for (auto& filename : filenames) {
fmt::print("[Build Game Subtitle] {}\n", filename.c_str());
auto code = reader.read_from_file({filename});
parse_subtitle(code, text_ver, db);
}
compile_subtitle(db);
}
static const std::unordered_map<std::string, GameTextVersion> s_text_ver_enum_map = {
{"jak1-v1", GameTextVersion::JAK1_V1}};
void open_text_project(const std::string& kind,
const std::string& filename,
std::unordered_map<GameTextVersion, std::vector<std::string>>& inputs) {
goos::Reader reader;
auto& proj = reader.read_from_file({filename}).as_pair()->cdr.as_pair()->car;
if (!proj.is_pair() || !proj.as_pair()->car.is_symbol() ||
proj.as_pair()->car.as_symbol()->name != kind) {
throw std::runtime_error(fmt::format("invalid {} project", kind));
}
goos::for_each_in_list(proj.as_pair()->cdr, [&](const goos::Object& o) {
if (!o.is_pair()) {
throw std::runtime_error(fmt::format("invalid entry in {} project", kind));
}
auto& ver = o.as_pair()->car.as_symbol()->name;
auto& in = o.as_pair()->cdr.as_pair()->car.as_string()->data;
inputs[s_text_ver_enum_map.at(ver)].push_back(in);
});
}
@@ -3,9 +3,69 @@
#include "common/util/Assert.h"
#include <string>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
/*!
* The text bank contains all lines (accessed with an ID) for a language.
*/
class GameTextBank {
public:
GameTextBank(int lang_id) : m_lang_id(lang_id) {}
int lang() const { return m_lang_id; }
const std::map<int, std::string>& lines() const { return m_lines; }
bool line_exists(int id) const { return m_lines.find(id) != m_lines.end(); }
std::string line(int id) { return m_lines.at(id); }
void set_line(int id, std::string line) { m_lines[id] = line; }
private:
int m_lang_id;
std::map<int, std::string> m_lines;
};
/*!
* The text database contains a text bank for each language for each text group.
* Each text bank contains a list of text lines. Very simple.
*/
class GameTextDB {
public:
const std::unordered_map<std::string, std::map<int, std::shared_ptr<GameTextBank>>>& groups()
const {
return m_banks;
}
const std::map<int, std::shared_ptr<GameTextBank>>& banks(std::string group) const {
return m_banks.at(group);
}
bool bank_exists(std::string group, int id) const {
if (m_banks.find(group) == m_banks.end())
return false;
return m_banks.at(group).find(id) != m_banks.at(group).end();
}
std::shared_ptr<GameTextBank> add_bank(std::string group, std::shared_ptr<GameTextBank> bank) {
ASSERT(!bank_exists(group, bank->lang()));
m_banks[group][bank->lang()] = bank;
return bank;
}
std::shared_ptr<GameTextBank> bank_by_id(std::string group, int id) {
if (!bank_exists(group, id)) {
return nullptr;
}
return m_banks.at(group).at(id);
}
private:
std::unordered_map<std::string, std::map<int, std::shared_ptr<GameTextBank>>> m_banks;
};
/*!
* The subtitle scene info (accessed through the scene name) contains all lines and their timestamps
* and other settings.
*/
class GameSubtitleSceneInfo {
public:
GameSubtitleSceneInfo() {}
@@ -38,6 +98,9 @@ class GameSubtitleSceneInfo {
std::vector<SubtitleLine> m_lines;
};
/*!
* The subtitle bank contains subtitles for all scenes in a language.
*/
class GameSubtitleBank {
public:
GameSubtitleBank(int lang_id) : m_lang_id(lang_id) {}
@@ -84,4 +147,13 @@ class GameSubtitleDB {
std::map<int, std::shared_ptr<GameSubtitleBank>> m_banks;
};
void compile_game_subtitle(const std::vector<std::string>& filenames, GameTextVersion text_ver);
void compile_game_text(const std::vector<std::string>& filenames,
GameTextVersion text_ver,
GameTextDB& db);
void compile_game_subtitle(const std::vector<std::string>& filenames,
GameTextVersion text_ver,
GameSubtitleDB& db);
void open_text_project(const std::string& kind,
const std::string& filename,
std::unordered_map<GameTextVersion, std::vector<std::string>>& inputs);
+19 -37
View File
@@ -10,7 +10,7 @@
#include "third-party/fmt/core.h"
#include "goalc/data_compiler/dir_tpages.h"
#include "goalc/data_compiler/game_count.h"
#include "goalc/data_compiler/game_text.h"
#include "goalc/data_compiler/game_text_common.h"
CompilerTool::CompilerTool(Compiler* compiler) : Tool("goalc"), m_compiler(compiler) {}
@@ -67,34 +67,6 @@ DgoDescription parse_desc_file(const std::string& filename, goos::Reader& reader
});
return desc;
}
static const std::unordered_map<std::string, GameTextVersion> s_text_ver_enum_map = {
{"jak1-v1", GameTextVersion::JAK1_V1}};
std::unordered_map<GameTextVersion, std::vector<std::string>> open_text_project(
const std::string& kind,
const std::string& filename) {
goos::Reader reader;
auto& proj = reader.read_from_file({filename}).as_pair()->cdr.as_pair()->car;
if (!proj.is_pair() || !proj.as_pair()->car.is_symbol() ||
proj.as_pair()->car.as_symbol()->name != kind) {
throw std::runtime_error(fmt::format("invalid {} project", kind));
}
std::unordered_map<GameTextVersion, std::vector<std::string>> inputs;
goos::for_each_in_list(proj.as_pair()->cdr, [&](const goos::Object& o) {
if (!o.is_pair()) {
throw std::runtime_error(fmt::format("invalid entry in {} project", kind));
}
auto& ver = o.as_pair()->car.as_symbol()->name;
auto& in = o.as_pair()->cdr.as_pair()->car.as_string()->data;
inputs[s_text_ver_enum_map.at(ver)].push_back(in);
});
return inputs;
}
} // namespace
DgoTool::DgoTool() : Tool("dgo") {}
@@ -159,8 +131,10 @@ bool TextTool::needs_run(const ToolInput& task) {
}
std::vector<std::string> deps;
for (auto& [ver, inputs] : open_text_project("text", task.input.at(0))) {
for (auto& in : inputs) {
std::unordered_map<GameTextVersion, std::vector<std::string>> inputs;
open_text_project("text", task.input.at(0), inputs);
for (auto& [ver, files] : inputs) {
for (auto& in : files) {
deps.push_back(in);
}
}
@@ -168,8 +142,11 @@ bool TextTool::needs_run(const ToolInput& task) {
}
bool TextTool::run(const ToolInput& task) {
for (auto& [ver, in] : open_text_project("text", task.input.at(0))) {
compile_game_text(in, ver);
GameTextDB db;
std::unordered_map<GameTextVersion, std::vector<std::string>> inputs;
open_text_project("text", task.input.at(0), inputs);
for (auto& [ver, in] : inputs) {
compile_game_text(in, ver, db);
}
return true;
}
@@ -188,8 +165,10 @@ bool SubtitleTool::needs_run(const ToolInput& task) {
}
std::vector<std::string> deps;
for (auto& [ver, inputs] : open_text_project("subtitle", task.input.at(0))) {
for (auto& in : inputs) {
std::unordered_map<GameTextVersion, std::vector<std::string>> inputs;
open_text_project("subtitle", task.input.at(0), inputs);
for (auto& [ver, files] : inputs) {
for (auto& in : files) {
deps.push_back(in);
}
}
@@ -197,8 +176,11 @@ bool SubtitleTool::needs_run(const ToolInput& task) {
}
bool SubtitleTool::run(const ToolInput& task) {
for (auto& [ver, in] : open_text_project("subtitle", task.input.at(0))) {
compile_game_subtitle(in, ver);
GameSubtitleDB db;
std::unordered_map<GameTextVersion, std::vector<std::string>> inputs;
open_text_project("subtitle", task.input.at(0), inputs);
for (auto& [ver, in] : inputs) {
compile_game_subtitle(in, ver, db);
}
return true;
}
-1
View File
@@ -2,7 +2,6 @@
#include "goalc/make/Tool.h"
#include "common/goos/Reader.h"
#include "goalc/data_compiler/game_subtitle.h"
class Compiler;
+1 -1
View File
@@ -30,7 +30,7 @@ class WithGameTests : public ::testing::Test {
shared_compiler->compiler.run_test_no_load(
"test/goalc/source_templates/with_game/test-build-game.gc");
shared_compiler->compiler.run_front_end_on_string(
"(asm-text-file text 10 :files (\"test/test_data/test_game_text.txt\"))");
"(asm-text-file text :files (\"test/test_data/test_game_text.gp\"))");
} catch (std::exception& e) {
fprintf(stderr, "caught exception %s\n", e.what());
EXPECT_TRUE(false);
+2
View File
@@ -0,0 +1,2 @@
(text
(jak1-v1 "test/test_data/test_game_text.txt"))