psu_missions: Handle small spawns object. Fix DS b3/4 and SA b3.

This commit is contained in:
Loïc Hoguin 2010-07-17 15:34:49 +02:00
parent 1f9ac7b1f6
commit a6184ed532
2 changed files with 14 additions and 7 deletions

View File

@ -69,9 +69,9 @@ object_init(InstanceID, BlockID, [{key_console, KeySet, _ReqKeyEventsID, TrigEve
object_init(InstanceID, BlockID, Tail, ListNb, ObjectNb + 1, ObjectID + 1, TargetID); object_init(InstanceID, BlockID, Tail, ListNb, ObjectNb + 1, ObjectID + 1, TargetID);
%% @todo save enemies individually, do something, etc. %% @todo save enemies individually, do something, etc.
%% @todo temporarily save the spawn to handle events properly %% @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}), 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) -> 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}}), 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); object_init(InstanceID, BlockID, Tail, ListNb, ObjectNb + 1, ObjectID, TargetID);

View File

@ -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]), 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}; {key_console, KeySet, ReqKeyEvents, TrigEvent};
%% @todo Find out what this object number is. %% @doc Small spawn.
parse_object_args(23, _Params, _Data) -> parse_object_args(23, _Params, Data) ->
unknown_object; %% @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) -> parse_object_args(24, _Params, Data) ->
%% @todo return meaningful information %% @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, << _: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), TrigEvent = convert_eventid(RawTrigEvent),
ReqEvent = convert_eventid(RawReqEvent), ReqEvent = convert_eventid(RawReqEvent),
log("spawn: a(~b) trigevent(~p) reqevent(~p) b(~b) spawnnb(~b)", [UnknownA, TrigEvent, ReqEvent, UnknownB, SpawnNb]), log("spawn (x30): a(~b) trigevent(~p) reqevent(~p) b(~b) spawnnb(~b)", [UnknownA, TrigEvent, ReqEvent, UnknownB, SpawnNb]),
{'spawn', TrigEvent, ReqEvent}; {'spawn', 30, TrigEvent, ReqEvent};
parse_object_args(26, _Params, _Data) -> parse_object_args(26, _Params, _Data) ->
entrance; entrance;