psu_instance: Handle goggle_target properly.

This commit is contained in:
Loïc Hoguin 2010-09-13 19:36:08 +02:00
parent 330659d3b0
commit 9c12812364
4 changed files with 17 additions and 6 deletions

View File

@ -927,6 +927,12 @@ event({object_crystal_activate, ObjectID}) ->
event({object_event_trigger, BlockID, EventID}) ->
send_1205(EventID, BlockID, 0);
event({object_goggle_target_activate, ObjectID}) ->
{ok, User} = egs_user_model:read(get(gid)),
{BlockID, EventID} = psu_instance:std_event(User#egs_user_model.instancepid, (User#egs_user_model.area)#psu_area.zoneid, ObjectID),
send_1205(EventID, BlockID, 0),
send_1213(ObjectID, 8);
event({object_key_console_enable, ObjectID}) ->
{ok, User} = egs_user_model:read(get(gid)),
{BlockID, [EventID|_]} = psu_instance:std_event(User#egs_user_model.instancepid, (User#egs_user_model.area)#psu_area.zoneid, ObjectID),

View File

@ -93,6 +93,11 @@ object_init([{floor_button, TrigEventID}|Tail], ZoneID, BlockID, ObjectID, Targe
object_insert(#psu_object{id={self(), ZoneID, ObjectID}, instancepid=self(), type=floor_button, args={BlockID, TrigEventID}}),
object_init(Tail, ZoneID, BlockID, ObjectID + 1, TargetID + 1, ListIndex, ObjectIndex + 1);
object_init([{goggle_target, TrigEventID}|Tail], ZoneID, BlockID, ObjectID, TargetID, ListIndex, ObjectIndex) ->
io:format("~p~n", [ObjectID]),
object_insert(#psu_object{id={self(), ZoneID, ObjectID}, instancepid=self(), type=goggle_target, args={BlockID, TrigEventID}}),
object_init(Tail, ZoneID, BlockID, ObjectID + 1, TargetID + 1, ListIndex, ObjectIndex + 1);
%% @doc key: {InstancePid, ZoneID, ObjectID}
object_init([{key, _KeySet, TrigEventID, _ReqEventID}|Tail], ZoneID, BlockID, ObjectID, TargetID, ListIndex, ObjectIndex) ->
object_insert(#psu_object{id={self(), ZoneID, ObjectID}, instancepid=self(), type=key, args={BlockID, [TrigEventID]}}),
@ -124,7 +129,6 @@ object_init([{warp, DestX, DestY, DestZ, DestDir}|Tail], ZoneID, BlockID, Object
object_init([Object|Tail], ZoneID, BlockID, ObjectID, TargetID, ListIndex, ObjectIndex)
when Object =:= boss_gate;
Object =:= shoot_button;
Object =:= goggle_target;
Object =:= trap;
Object =:= sensor ->
object_init(Tail, ZoneID, BlockID, ObjectID + 1, TargetID + 1, ListIndex, ObjectIndex + 1);
@ -142,7 +146,8 @@ object_init([Object|Tail], ZoneID, BlockID, ObjectID, TargetID, ListIndex, Objec
Object =:= colored_minimap_section;
Object =:= fog;
Object =:= pp_cube;
Object =:= healing_pad ->
Object =:= healing_pad;
Object =:= unknown_object_28 ->
object_init(Tail, ZoneID, BlockID, ObjectID, TargetID, ListIndex, ObjectIndex + 1);
%% @doc Ignore everything else for now: objects with an ObjectID but without a TargetID.

View File

@ -290,8 +290,9 @@ parse_object_args(49, _Params, _Data) ->
parse_object_args(50, _Params, _Data) ->
healing_pad;
parse_object_args(51, _Params, _Data) ->
goggle_target;
parse_object_args(51, _Params, Data) ->
<< _Unknown:224, TrigEvent:16/little, _Rest/bits >> = Data,
{goggle_target, TrigEvent};
parse_object_args(53, _Params, _Data) ->
label;

View File

@ -897,8 +897,7 @@ parse(Size, 16#0f0a, Channel, Data) ->
?ASSERT_EQ(VarO, 16#ffffffff),
?ASSERT_EQ(VarV, 1),
?ASSERT_EQ(VarW, 0),
?ASSERT(),
ignore; %% @todo object_goggle_target_activate
{object_goggle_target_activate, ObjectID};
[56, 25] ->
?ASSERT_EQ(VarN, 16#ffffffff),
?ASSERT_EQ(VarO, 16#ffffffff),