Jump to content

Removing Info Points from Existing Areas


erebusant

Recommended Posts

Deleting vertices is a bit more tricky because you have to go through all sections in ARE file and update vertex indexes.

 

Here's a macro you can use, seems to be working though I suggest you test it for a while before trusting me. ???

 

And if The Bigg is reading, it would be nice to have something large and ugly like this incorporated into WeiDU sometime...

 

Usage examples:

// Usage paramerers:
// TRIGGERNAME = Name of info trigger to delete (ex.: "REPTRAP1")
// TRIGGERTYPE = 0 for Proximity Triggers, 1 for Info Triggers, 2 for Travel Triggers
COPY_EXISTING ~AR6700.ARE~ ~OVERRIDE~
SPRINT TRIGGERNAME "REPTRAP1"
SET TRIGGERTYPE = 0
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
BUT_ONLY_IF_IT_CHANGES

COPY_EXISTING ~AR6506.ARE~ ~OVERRIDE~
SPRINT TRIGGERNAME "DOOR0015"
SET TRIGGERTYPE = 2
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
BUT_ONLY_IF_IT_CHANGES

 

And the macro itself:

 

DEFINE_PATCH_MACRO ~DELETE_INFO_TRIGGER~ BEGIN
 READ_LONG 0x54 "DIT_actor_off"
 READ_LONG 0x5c "DIT_info_off"
 READ_SHORT 0x5a "DIT_info_num"
 READ_LONG 0x60 "DIT_spawn_off"
 READ_LONG 0x68 "DIT_ent_off"
 READ_LONG 0x70 "DIT_cont_off"
 READ_SHORT 0x74 "DIT_cont_num"
 READ_LONG 0x78 "DIT_item_off"
 READ_LONG 0x7c "DIT_vert_off"
 READ_SHORT 0x80 "DIT_vert_num"
 READ_LONG 0x84 "DIT_amb_off"
 READ_LONG 0x88 "DIT_var_off"
 READ_LONG 0xa0 "DIT_bmp_off"
 READ_LONG 0xa4 "DIT_door_num"
 READ_LONG 0xa8 "DIT_door_off"
 READ_LONG 0xb0 "DIT_anim_off"
 READ_LONG 0xb8 "DIT_tiled_off"
 READ_LONG 0xbc "DIT_song_off"
 READ_LONG 0xc0 "DIT_rest_off"
 READ_LONG 0xc4 "DIT_note_off"
 SET DIT_found = (BNOT 0x0)
 FOR(index = 0; (index < DIT_info_num) AND (DIT_found = (BNOT 0x0)); index = index + 1) BEGIN
  READ_ASCII ("%DIT_info_off%" + "%index%"*0xC4	   ) DIT_cur_name (32)
  // the following is simply to truncate all null symbols from our string
  SET DIT_length = 0
  INNER_PATCH_SAVE DIT_cur_name "%DIT_cur_name%" BEGIN
	  FOR (index2 = 0; index2 < 32; index2 = index2 + 1) BEGIN
		READ_BYTE "%index2%" DIT_byte
		PATCH_IF ("%DIT_byte%" = 0) BEGIN SET index2 = 32 END
		ELSE BEGIN SET DIT_length += 1 END
	  END
  END
  SNPRINT "%DIT_length%" DIT_real_name "%DIT_cur_name%"
  READ_SHORT ("%DIT_info_off%" + "%index%"*0xC4 + 0x20) DIT_cur_type
  READ_SHORT ("%DIT_info_off%" + "%index%"*0xC4 + 0x2A) DIT_cur_numvert
  READ_LONG  ("%DIT_info_off%" + "%index%"*0xC4 + 0x2C) DIT_cur_vertidx
  PATCH_IF !("%DIT_real_name%" STRING_COMPARE_CASE "%TRIGGERNAME%") AND ("%DIT_cur_type%" = "%TRIGGERTYPE%") BEGIN
	SET DIT_found = "%index%"		
  END
 END
 PATCH_IF !("%DIT_found%" = (BNOT 0x0)) BEGIN
FOR(index = 0; index < DIT_info_num; index = index + 1) BEGIN
  READ_LONG ("%DIT_info_off%" + "%index%"*0xC4 + 0x2C) DIT_loop_vertidx
  PATCH_IF NOT ("%DIT_loop_vertidx%" < "%DIT_cur_vertidx%") BEGIN
	WRITE_LONG ("%DIT_info_off%" + "%index%"*0xC4 + 0x2C) "%DIT_loop_vertidx%" - "%DIT_cur_numvert%"
  END
END	
FOR(index = 0; index < DIT_cont_num; index = index + 1) BEGIN
  READ_LONG ("%DIT_cont_off%" + "%index%"*0xC0 + 0x50) DIT_loop_vertidx
  PATCH_IF NOT ("%DIT_loop_vertidx%" < "%DIT_cur_vertidx%") BEGIN
	WRITE_LONG ("%DIT_cont_off%" + "%index%"*0xC0 + 0x50) "%DIT_loop_vertidx%" - "%DIT_cur_numvert%"
  END
END
FOR(index = 0; index < DIT_door_num; index = index + 1) BEGIN
  READ_LONG ("%DIT_door_off%" + "%index%"*0xC8 + 0x2c) DIT_loop_vertidx
  PATCH_IF NOT ("%DIT_loop_vertidx%" < "%DIT_cur_vertidx%") BEGIN
	WRITE_LONG ("%DIT_door_off%" + "%index%"*0xC8 + 0x2c) "%DIT_loop_vertidx%" - "%DIT_cur_numvert%"
  END
  READ_LONG ("%DIT_door_off%" + "%index%"*0xC8 + 0x34) DIT_loop_vertidx
  PATCH_IF NOT ("%DIT_loop_vertidx%" < "%DIT_cur_vertidx%") BEGIN
	WRITE_LONG ("%DIT_door_off%" + "%index%"*0xC8 + 0x34) "%DIT_loop_vertidx%" - "%DIT_cur_numvert%"
  END
  READ_LONG ("%DIT_door_off%" + "%index%"*0xC8 + 0x48) DIT_loop_vertidx
  PATCH_IF NOT ("%DIT_loop_vertidx%" < "%DIT_cur_vertidx%") BEGIN
	WRITE_LONG ("%DIT_door_off%" + "%index%"*0xC8 + 0x48) "%DIT_loop_vertidx%" - "%DIT_cur_numvert%"
  END
  READ_LONG ("%DIT_door_off%" + "%index%"*0xC8 + 0x50) DIT_loop_vertidx
  PATCH_IF NOT ("%DIT_loop_vertidx%" < "%DIT_cur_vertidx%") BEGIN
	WRITE_LONG ("%DIT_door_off%" + "%index%"*0xC8 + 0x50) "%DIT_loop_vertidx%" - "%DIT_cur_numvert%"
  END
END	
DELETE_BYTES ("%DIT_info_off%" + "%DIT_found%"*0xC4) 0xC4
SET DIT_info_num = ("%DIT_info_num%" - 1)
WRITE_SHORT 0x5a "%DIT_info_num%"
PATCH_IF NOT ("%DIT_actor_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_actor_off" = ("%DIT_actor_off%" - 0XC4)
  WRITE_LONG 0x54 "%DIT_actor_off%"
END
PATCH_IF NOT ("%DIT_spawn_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_spawn_off" = ("%DIT_spawn_off%" - 0XC4)
  WRITE_LONG 0x60 "%DIT_spawn_off%"
END
PATCH_IF NOT ("%DIT_ent_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_ent_off" = ("%DIT_ent_off%" - 0XC4)
  WRITE_LONG 0x68 "%DIT_ent_off%"
END
PATCH_IF NOT ("%DIT_cont_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_cont_off" = ("%DIT_cont_off%" - 0XC4)
  WRITE_LONG 0x70 "%DIT_cont_off%"
END
PATCH_IF NOT ("%DIT_item_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_item_off" = ("%DIT_item_off%" - 0XC4)
  WRITE_LONG 0x78 "%DIT_item_off%"
END
PATCH_IF NOT ("%DIT_vert_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_vert_off" = ("%DIT_vert_off%" - 0XC4)
  WRITE_LONG 0x7c "%DIT_vert_off%"
END
PATCH_IF NOT ("%DIT_amb_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_amb_off" = ("%DIT_amb_off%" - 0XC4)
  WRITE_LONG 0x84 "%DIT_amb_off%"
END
PATCH_IF NOT ("%DIT_var_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_var_off" = ("%DIT_var_off%" - 0XC4)
  WRITE_LONG 0x88 "%DIT_var_off%"
END
PATCH_IF NOT ("%DIT_bmp_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_bmp_off" = ("%DIT_bmp_off%" - 0XC4)
  WRITE_LONG 0xa0 "%DIT_bmp_off%"
END
PATCH_IF NOT ("%DIT_door_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_door_off" = ("%DIT_door_off%" - 0XC4)
  WRITE_LONG 0xa8 "%DIT_door_off%"
END
PATCH_IF NOT ("%DIT_anim_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_anim_off" = ("%DIT_anim_off%" - 0XC4)
  WRITE_LONG 0xb0 "%DIT_anim_off%"
END
PATCH_IF NOT ("%DIT_tiled_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_tiled_off" = ("%DIT_tiled_off%" - 0XC4)
  WRITE_LONG 0xb8 "%DIT_tiled_off%"
END
PATCH_IF NOT ("%DIT_song_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_song_off" = ("%DIT_song_off%" - 0XC4)
  WRITE_LONG 0xbc "%DIT_song_off%"
END
PATCH_IF NOT ("%DIT_rest_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_rest_off" = ("%DIT_rest_off%" - 0XC4)
  WRITE_LONG 0xc0 "%DIT_rest_off%"
END
PATCH_IF NOT ("%DIT_note_off%" < "%DIT_info_off%") BEGIN
  SET "DIT_note_off" = ("%DIT_note_off%" - 0XC4)
  WRITE_LONG 0xc4 "%DIT_note_off%"
END	
DELETE_BYTES ("%DIT_vert_off%" + "%DIT_cur_vertidx%"*0x04) "%DIT_cur_numvert%"*0x04
WRITE_SHORT 0x80 ("%DIT_vert_num%" - "%DIT_cur_numvert%")
PATCH_IF NOT ("%DIT_actor_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0x54 ("%DIT_actor_off%" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_info_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0x5c ("DIT_info_off" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_spawn_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0x60 ("DIT_spawn_off" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_ent_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0x68 ("DIT_ent_off" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_cont_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0x70 ("DIT_cont_off" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_item_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0x78 ("DIT_item_off" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_amb_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0x84 ("DIT_amb_off" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_var_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0x88 ("DIT_var_off" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_bmp_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0xa0 ("DIT_bmp_off" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_door_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0xa8 ("DIT_door_off" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_anim_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0xb0 ("DIT_anim_off" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_tiled_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0xb8 ("DIT_tiled_off" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_song_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0xbc ("DIT_song_off" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_rest_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0xc0 ("DIT_rest_off" - 0x04*"%DIT_cur_numvert%")
END
PATCH_IF NOT ("%DIT_note_off%" < "%DIT_vert_off%") BEGIN
  WRITE_LONG 0xc4 ("DIT_note_off" - 0x04*"%DIT_cur_numvert%")
END
 END

END
Link to comment
You would be much better off deactivating the trigger point via script than deleting the whole structure.

I think you are right! I tried the macro and at least it parses, and says it's copying and patching the area, but it never actually changed anything or removed the info point and it's vertices.

It works much simpler by adding the following to my .tp2:

//Deactivating Travel Triggers from ARW000 & ARW500 to enable WM6 travel
ACTION_IF
 FILE_EXISTS_IN_GAME ~BP-BGT_WM6.wm6~ // WM6 installation marker
THEN BEGIN
EXTEND_TOP	~ARW000.BCS~   ~BP-BGT_Worldmap/BAF/BGT/ARW000.BAF~
EXTEND_TOP	~ARW500.BCS~   ~BP-BGT_Worldmap/BAF/BGT/ARW500.BAF~
COPY ~BP-BGT_Worldmap/ARW000SR.bmp~		~override~
COPY ~BP-BGT_Worldmap/ARW500SR.bmp~		~override~
END

and extending the top of ARW000.bcs with the following:

IF
Exists(Player1)
THEN
RESPONSE #100
	TriggerActivation("DoorNorthA",False)
	TriggerActivation("DoorNorthB",False)
	TriggerActivation("DoorNorthC",False)
	TriggerActivation("DoorNorthD",False)
	TriggerActivation("DoorNorthE",False)
	TriggerActivation("DoorNorthF",False)
	TriggerActivation("DoorNorthG",False)
	Continue()
END

and extending the top of ARW500.bcs with the following:

IF
Exists(Player1)
THEN
RESPONSE #100
	TriggerActivation("TravelSouth",False)
	TriggerActivation("TravelSouth2",False)
	TriggerActivation("TravelSouth3",False)
	TriggerActivation("TravelSouth4",False)
	TriggerActivation("TravelSouth5",False)
	TriggerActivation("TravelSouth6",False)
	TriggerActivation("TravelSouth7",False)
	Continue()
END

Thanks for the help!! ???

Link to comment

May I suggest:

IF
 OnCreation()
 Global("ExitsDeactivated","ARW000",0)
THEN
 RESPONSE #100
SetGlobal("ExitsDeactivated","ARW000",1)
TriggerActivation("DoorNorthA",False)
TriggerActivation("DoorNorthB",False)
TriggerActivation("DoorNorthC",False)
TriggerActivation("DoorNorthD",False)
TriggerActivation("DoorNorthE",False)
TriggerActivation("DoorNorthF",False)
TriggerActivation("DoorNorthG",False)
Continue()
END

 

So you're not reclosing the doors fifteen times per second ???

 

If you're just concerned about macro length, you could cut that down to about sixty lines or so by using more ()? : value conditionals and fewer PATCH_IFs - though it won't run any faster.

Link to comment

Yes, it doesn't work because trigger names in your case are longer than 8 chars. READ_ASCII by default reads 8 symbols only; I can specify to read all 32, but then the compare will always fail - the string must first be truncated leaving out all zero symbols.

 

I don't suppose there's a hidden WeiDU routine for getting REAL string length?.. ???

Link to comment

Fixed it. ??? (see edited macro code)

 

The following should now work:

COPY_EXISTING ~ARW000.ARE~ ~OVERRIDE~
SPRINT TRIGGERNAME "DoorNorthA"
SET TRIGGERTYPE = 2
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
SPRINT TRIGGERNAME "DoorNorthB"
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
SPRINT TRIGGERNAME "DoorNorthC"
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
SPRINT TRIGGERNAME "DoorNorthD"
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
SPRINT TRIGGERNAME "DoorNorthE"
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
SPRINT TRIGGERNAME "DoorNorthF"
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
SPRINT TRIGGERNAME "DoorNorthG"
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
BUT_ONLY_IF_IT_CHANGES

Link to comment

Trimming extra nulls is pretty easy

INNER_PATCH_SAVE ~DIT_cur_name~ ~%DIT_cur_name%~ BEGIN
 FOR ("i" = 0x1f; "i" > (0x0 - 0x1); "i" -= 0x1) BEGIN
READ_BYTE "i" "null_test"
PATCH_IF ("null_test" = 0x00) THEN BEGIN
  DELETE_BYTES "i" 0x1
END
 END
END

 

before you do your string comparing business.

Link to comment
Fixed it. ??? (see edited macro code)

 

The following should now work:

COPY_EXISTING ~ARW000.ARE~ ~OVERRIDE~
SPRINT TRIGGERNAME "DoorNorthA"
SET TRIGGERTYPE = 2
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
SPRINT TRIGGERNAME "DoorNorthB"
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
SPRINT TRIGGERNAME "DoorNorthC"
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
SPRINT TRIGGERNAME "DoorNorthD"
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
SPRINT TRIGGERNAME "DoorNorthE"
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
SPRINT TRIGGERNAME "DoorNorthF"
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
SPRINT TRIGGERNAME "DoorNorthG"
LAUNCH_PATCH_MACRO ~DELETE_INFO_TRIGGER~
BUT_ONLY_IF_IT_CHANGES

 

And the hex patch works perfectly too!! :( Pretty dang good pro5!!

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...