mirror of
https://github.com/DaanVandenBosch/phantasmal-world.git
synced 2025-04-04 22:58:29 +08:00
Up to four .qst headers are now parsed. This fixes parsing of The Value of Money.
This commit is contained in:
parent
1d0da754ca
commit
8f8da79041
@ -136,5 +136,4 @@ Features that are in ***bold italics*** are planned and not yet implemented.
|
|||||||
- Switch (none door)
|
- Switch (none door)
|
||||||
- Energy Barrier
|
- Energy Barrier
|
||||||
- Teleporter
|
- Teleporter
|
||||||
- [Load Quest](#load-quest): Can't parse quest 4
|
|
||||||
- [Load Quest](#load-quest): Can't parse quest 125 White Day
|
- [Load Quest](#load-quest): Can't parse quest 125 White Day
|
||||||
|
@ -21,7 +21,7 @@ import { object_data, ObjectType, pso_id_to_object_type } from "./object_types";
|
|||||||
import { parse_qst, QstContainedFile, write_qst } from "./qst";
|
import { parse_qst, QstContainedFile, write_qst } from "./qst";
|
||||||
import { NpcType } from "./npc_types";
|
import { NpcType } from "./npc_types";
|
||||||
|
|
||||||
const logger = Logger.get("data_formats/parsing/quest");
|
const logger = Logger.get("core/data_formats/parsing/quest");
|
||||||
|
|
||||||
export type Quest = {
|
export type Quest = {
|
||||||
readonly id: number;
|
readonly id: number;
|
||||||
|
@ -6,7 +6,7 @@ import { ResizableBufferCursor } from "../../cursor/ResizableBufferCursor";
|
|||||||
import { WritableCursor } from "../../cursor/WritableCursor";
|
import { WritableCursor } from "../../cursor/WritableCursor";
|
||||||
import { ResizableBuffer } from "../../ResizableBuffer";
|
import { ResizableBuffer } from "../../ResizableBuffer";
|
||||||
|
|
||||||
const logger = Logger.get("data_formats/parsing/quest/qst");
|
const logger = Logger.get("core/data_formats/parsing/quest/qst");
|
||||||
|
|
||||||
export type QstContainedFile = {
|
export type QstContainedFile = {
|
||||||
id?: number;
|
id?: number;
|
||||||
@ -110,13 +110,13 @@ type QstHeader = {
|
|||||||
size: number;
|
size: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Read all headers instead of just the first 2.
|
|
||||||
*/
|
|
||||||
function parse_headers(cursor: Cursor): QstHeader[] {
|
function parse_headers(cursor: Cursor): QstHeader[] {
|
||||||
const headers: QstHeader[] = [];
|
const headers: QstHeader[] = [];
|
||||||
|
|
||||||
for (let i = 0; i < 2; ++i) {
|
let prev_quest_id: number | undefined;
|
||||||
|
let prev_file_name: string | undefined;
|
||||||
|
|
||||||
|
for (let i = 0; i < 4; ++i) {
|
||||||
cursor.seek(4);
|
cursor.seek(4);
|
||||||
const quest_id = cursor.u16();
|
const quest_id = cursor.u16();
|
||||||
cursor.seek(38);
|
cursor.seek(38);
|
||||||
@ -125,6 +125,18 @@ function parse_headers(cursor: Cursor): QstHeader[] {
|
|||||||
// Not sure what this is:
|
// Not sure what this is:
|
||||||
const file_name_2 = cursor.string_ascii(24, true, true);
|
const file_name_2 = cursor.string_ascii(24, true, true);
|
||||||
|
|
||||||
|
if (
|
||||||
|
prev_quest_id != undefined &&
|
||||||
|
prev_file_name != undefined &&
|
||||||
|
(quest_id !== prev_quest_id || file_name.slice(0, 5) !== prev_file_name.slice(0, 5))
|
||||||
|
) {
|
||||||
|
cursor.seek(-88);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
prev_quest_id = quest_id;
|
||||||
|
prev_file_name = file_name;
|
||||||
|
|
||||||
headers.push({
|
headers.push({
|
||||||
quest_id,
|
quest_id,
|
||||||
file_name,
|
file_name,
|
||||||
|
Loading…
Reference in New Issue
Block a user