diff --git a/src/psu_missions.erl b/src/psu_missions.erl index c811370..9ed76ec 100644 --- a/src/psu_missions.erl +++ b/src/psu_missions.erl @@ -69,9 +69,9 @@ object_init(InstanceID, BlockID, [{key_console, KeySet, _ReqKeyEventsID, TrigEve object_init(InstanceID, BlockID, Tail, ListNb, ObjectNb + 1, ObjectID + 1, TargetID); %% @todo save enemies individually, do something, etc. %% @todo temporarily save the spawn to handle events properly -object_init(InstanceID, BlockID, [{'spawn', TrigEventID, _ReqEventID}|Tail], ListNb, ObjectNb, ObjectID, TargetID) -> +object_init(InstanceID, BlockID, [{'spawn', NbTargets, TrigEventID, _ReqEventID}|Tail], ListNb, ObjectNb, ObjectID, TargetID) -> egs_db:objects_insert(#objects{id=[InstanceID, {'spawn', TargetID - 1024}], instanceid=InstanceID, type='spawn', blockid=BlockID, triggereventid=TrigEventID}), - object_init(InstanceID, BlockID, Tail, ListNb, ObjectNb + 1, ObjectID + 1, TargetID + 30); + object_init(InstanceID, BlockID, Tail, ListNb, ObjectNb + 1, ObjectID + 1, TargetID + NbTargets); object_init(InstanceID, BlockID, [{warp, DestX, DestY, DestZ, DestDir}|Tail], ListNb, ObjectNb, ObjectID, TargetID) -> egs_db:objects_insert(#objects{id=[InstanceID, {warp, BlockID, ListNb, ObjectNb}], instanceid=InstanceID, type=warp, blockid=BlockID, args={DestX, DestY, DestZ, DestDir}}), object_init(InstanceID, BlockID, Tail, ListNb, ObjectNb + 1, ObjectID, TargetID); diff --git a/src/psu_parser.erl b/src/psu_parser.erl index baef08d..15dfb63 100644 --- a/src/psu_parser.erl +++ b/src/psu_parser.erl @@ -172,18 +172,25 @@ parse_object_args(22, _Params, Data) -> log("key_console: a(~b) keyset(~b) b(~b) c(~b) reqkeyevents(~p) trigevent(~p) d(~b)", [UnknownA, KeySet, UnknownB, UnknownC, ReqKeyEvents, TrigEvent, UnknownD]), {key_console, KeySet, ReqKeyEvents, TrigEvent}; -%% @todo Find out what this object number is. +%% @doc Small spawn. -parse_object_args(23, _Params, _Data) -> - unknown_object; +parse_object_args(23, _Params, Data) -> + %% @todo return meaningful information + << _:704, UnknownA:32/little-unsigned-integer, RawTrigEvent:16/little-unsigned-integer, RawReqEvent:16/little-unsigned-integer, 16#ffff:16, UnknownB:8, SpawnNb:8, _/bits >> = Data, + TrigEvent = convert_eventid(RawTrigEvent), + ReqEvent = convert_eventid(RawReqEvent), + log("spawn (x10): a(~b) trigevent(~p) reqevent(~p) b(~b) spawnnb(~b)", [UnknownA, TrigEvent, ReqEvent, UnknownB, SpawnNb]), + {'spawn', 10, TrigEvent, ReqEvent}; + +%% @doc Big spawn. parse_object_args(24, _Params, Data) -> %% @todo return meaningful information << _:704, UnknownA:32/little-unsigned-integer, RawTrigEvent:16/little-unsigned-integer, RawReqEvent:16/little-unsigned-integer, 16#ffff:16, UnknownB:8, SpawnNb:8, _/bits >> = Data, TrigEvent = convert_eventid(RawTrigEvent), ReqEvent = convert_eventid(RawReqEvent), - log("spawn: a(~b) trigevent(~p) reqevent(~p) b(~b) spawnnb(~b)", [UnknownA, TrigEvent, ReqEvent, UnknownB, SpawnNb]), - {'spawn', TrigEvent, ReqEvent}; + log("spawn (x30): a(~b) trigevent(~p) reqevent(~p) b(~b) spawnnb(~b)", [UnknownA, TrigEvent, ReqEvent, UnknownB, SpawnNb]), + {'spawn', 30, TrigEvent, ReqEvent}; parse_object_args(26, _Params, _Data) -> entrance;