Welcome,
Guest
. Please
login
or
register
.
March 16, 2010, 01:49:40 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Interactive
Modlist
is now online!
131346
Posts in
13306
Topics by
3849
Members
Latest Member:
Kilmor of Gelnor
Pocket Plane Group
Friends and Neighbors
Weimer Republic (WeiDU.org)
WeiDU
(Moderators:
weimer
,
the bigg
)
ADD_AREA_CONTAINER macro
« previous
next »
Pages:
[
1
]
Author
Topic: ADD_AREA_CONTAINER macro (Read 754 times)
Miloch
Barbarian
Planewalker
Offline
Gender:
Posts: 564
ADD_AREA_CONTAINER macro
«
on:
December 27, 2009, 05:21:25 PM »
I need a macro that does this, that GeN1e vaguely alluded to having or to be developing in
this thread
. Though maybe he decided it was too tough for him or something, I dunno. It really shouldn't be much different or tougher than the existing ADD_AREA_REGION_TRIGGER macro. If anything, it doesn't need as many parameters, though it may need just another loop to update vertex references, something which makes my orcish brain go all gelatinous. We use container-adding code originally posted by Ascension64 in the BG1 Fixpack forum, but it
doesn't seem to work
in all cases (though maybe we're not using it right, or the areas in question are hosed to begin with).
I would take a look at it at least though, if I could find the code, but the only things I see under
src/tph/include
are Gort's macros and your own. Maybe I'm not looking in the right place though.
In a related request, we should include Nythrun's resource fixer macros (listed
here
) which have been tested the hell out of in several mods (BG1 NPC, RR, etc.). They're already prefixed in .tpp/.tpa format in Aurora. If you need them posted separately or whatever, I can do that too, as long as I don't have to go through something arcane like git...
Logged
Tutu/BGT Area Map & List
*
Tutu Mod List
*
BG1 Fixpack
*
Lost Items
GeN1e
Planewalker
Offline
Gender:
Posts: 163
Re: ADD_AREA_CONTAINER macro
«
Reply #1 on:
December 27, 2009, 06:40:51 PM »
Here are contents of the old WAPT library, including infotriggers and containers. By 'old' I mean was considered too much hardcoded and ordered into revision, so it wasn't supposed to end up in WeiDU. Till then, here it is.
PS Jeez, it's ridiculous. The latest function was named in a different style than the others.
Code:
// Weidu Area Patching Tool.
//
// Q_AREInitVars, Q_AREAdd_InitVars and Q_AREAdd_Process macros belong to Qwinn and are designed to add any desirable number
// of objects to an area file. They do not, however, cover the writing procedure, leaving all the newly added space empty.
//
// It was concluded that manual writing is time consuming and unappealing, especially for novice modders, so there are
// ADD_AREA_FLOOR_TRIGGER, ADD_AREA_INFO_TRIGGER, ADD_AREA_TRANSITION_TRIGGER and ADD_AREA_CONTAINER functions designed by
// plainab/Sasha Al-Therin and Ardanis/GeN1e to cover the most common tasks of area editing.
//
// wapt_inserter, wapt_routine and wapt_array macros are designed to reduce the overall amount of code. They are not
// supposed to be directly called by a modder. Don't do it, unless you understand everything about of them and really
// know what you're doing. And honestly, I somehow doubt anyone would be interested...
//
// Sasha insisted that the tool should allow for adding multiple objects at once, to realize the full potential of Qwinn's
// work. However, due to certain troubles with assigning new text strings to containers and infotriggers, I had to reduce the
// maximum quantity allowed to 10. Hopefully it's still more than enough.
//
// Also, functions were changed from ACTION, as they initially were, to PATCH. First, due to the abovementioned problems with
// new text strings. Second, in my opinion it's easier to follow.
//////////////////////////////////////
// This macro does the following:
// sets 'bbox' to 0, which is the starting value for all ADD_AREA_ functions
// calculates the total amount of new objects
// calculates the total amount of new vertices
// inserts new objects and vertices using Qwinn's algorithm
// WRITEs new vertices
// sets 'vert_entry' - the starting index of newly added vertices
DEFINE_PATCH_MACRO wapt_inserter BEGIN
bbox=0 // vertex index for bounding box calculation
wapt_object=0
FOR (i=0;i<10;i+=1) BEGIN // calculating the amount of new objects, up to 10
PATCH_IF (VARIABLE_IS_SET $wapt_object_name("%i%")) BEGIN
wapt_object+=1
END
END
vert=0 //calculating the number of new
FOR (i=0;i<wapt_object;i+=1) BEGIN //vertices, to save modder the
vert+= $wapt_vertices("%i%") //trouble of doing it manually
END
LAUNCH_PATCH_MACRO ~wapt_Q_ARE_InitVars~ //launch variable initiation macro
LAUNCH_PATCH_MACRO ~wapt_Q_AREAdd_InitVars~ //launch variable initiation macro for adding new sections
Q_New_Vertx = vert
PATCH_FOR_EACH ob_type IN ~Conta~ ~Entra~ ~Trigg~ BEGIN //which type of object we're adding
PATCH_IF ~%wapt_ob_type%~ STRING_EQUAL_CASE ~%ob_type%~ BEGIN //wapt_ob_type is preset by STR_VAR
SET $Q_New("%ob_type%") = wapt_object
END
END
LAUNCH_PATCH_MACRO ~wapt_Q_AREAdd_Process~ //launch macro that adds new space for above listed entries
vert_entry = Q_Num_Vertx - Q_New_Vertx //starting index for new vertices, used by the main FUNCTION
FOR (i=0;i<vert;i+=1) BEGIN //
WRITE_SHORT (Q_NewOffset_Vertx+i*4) $wapt_vx("%i%") //writing new vertices
WRITE_SHORT (Q_NewOffset_Vertx+i*4+2) $wapt_vy("%i%") //
END
END
/////////////////////////////////////
// This macro does the following:
// sets 'new_loc' - the starting offset for writing down the new object
// writes the object's name, which is 32 char long
// calculates and writes the bounding box for the object
DEFINE_PATCH_MACRO wapt_routine BEGIN // vars used for bbox math: a b c c1 c2 bbox_off
new_loc = $Q_NewOffset("%wapt_ob_type%") + i*$Q_Siz("%wapt_ob_type%") // from where we'll do writing
WRITE_ASCIIE new_loc $wapt_object_name("%i%") // object's name
bbox_off=new_loc+wapt_bbox //offset for this object's bbox, wapt_bbox is preset by INT_VAR
FOR (a=0;a<4;a+=1) BEGIN //0=X_low - left, 1=Y_low - down, 2=X_high - right, 3=Y_high - top
PATCH_IF a=0 OR a=2 BEGIN SPRINT xy ~wapt_vx_~ END ELSE BEGIN SPRINT xy ~wapt_vy_~ END //X or Y coordinate of the vertex
c=bbox //we assume that the extreme vertex is the 1st one of the object
c1=EVALUATE_BUFFER ~%%xy%%c%%~ //coord_value_1=(X/Y)_%vert_index%, coord of object's the 1st vertex
FOR (b=bbox+1;b<$wapt_vertices("%i%")+bbox;b+=1) BEGIN //start with 2nd vertex of the object, finish with the last
c2=EVALUATE_BUFFER ~%%xy%%b%%~ //coord_value_2=(X/Y)_%counter%, other vertices of the object
PATCH_IF (a<2&c2<c1)|(a>1&c2>c1) BEGIN //compare the 1st vertex's value with that of the others, if some exceeds then...
c=b //...mark it as the new extreme and...
c1=c2 //...use it's value to check against the remaining
END
WRITE_SHORT (bbox_off+a*2) EVALUATE_BUFFER ~%%xy%%c%%~ //precisely the box's values for the object, writing that down
END
END
bbox+=$wapt_vertices("%i%") // update the bbox index so it matches the 1st vertex of the next object
END // should ADD_DOOR (it has 3 polygons instead of 1) be introduced, this macro will have to be revamped
///////////////////////////////////
// This macro does the following:
// loads the array block from the main function, 'sol' stands for 'SHORT or LONG (or ASCII)'
// checks if the appropriate variable was set by modder
// if it was, then WRITEs it at the appropriate offset
DEFINE_PATCH_MACRO wapt_array BEGIN // vars used: ia
FOR (ia=0;ia<array;ia+=1) BEGIN // 'array' is set within the main function
PATCH_IF (VARIABLE_IS_SET $wapt($$nam("%ia%")("%i%")) ) BEGIN
PATCH_IF ($sol("%ia%")=2) BEGIN WRITE_SHORT (new_loc+$off("%ia%")) $wapt($$nam("%ia%")("%i%")) END
PATCH_IF ($sol("%ia%")=4) BEGIN WRITE_LONG (new_loc+$off("%ia%")) $wapt($$nam("%ia%")("%i%")) END
PATCH_IF ($sol("%ia%")=8) BEGIN WRITE_ASCIIE (new_loc+$off("%ia%")) $wapt($$nam("%ia%")("%i%")) END
END
END
END
//////////////////////////////////////////////
// Note by Ardanis:
// As you can tell by the prefix, it originally was a Qwinn's macro. I compressed it
// into a more accessible format. A fair example of how to make a good use of arrays.
// Bigg, Weidu's readme says it needs a real example of array usage. Does this pass for one?
DEFINE_PATCH_MACRO ~wapt_Q_ARE_InitVars~ BEGIN
PATCH_IF (GAME_IS ~pst~) BEGIN Q_Game=1 END
PATCH_IF (GAME_IS ~bg2 tob tutu tutu_totsc~) BEGIN Q_Game=2 END
PATCH_IF (GAME_IS ~bg1 totsc iwd how~) BEGIN Q_Game=3 END
DEFINE_ARRAY object BEGIN Actor Trigg Spawn Entra Conta Items Ambie Varia Doors Tiled Vertx Explo Anima Songs RestS MapNo ProTr END
DEFINE_ARRAY Siz BEGIN 0x110 0xc4 0xc8 0x68 0xc0 0x14 0xd4 0x54 0xc8 0x6c 0x4 0x0 0x4c 0x90 0xe4 0x34 0x1A END
DEFINE_ARRAY OoN BEGIN 0x58 0x5a 0x64 0x6c 0x74 0x76 0x82 0x8c 0xa4 0xb4 0x80 0x0 0xac 0x0 0x0 0xc8 0xd0 END
DEFINE_ARRAY OoO BEGIN 0x54 0x5c 0x60 0x68 0x70 0x78 0x84 0x88 0xa8 0xb8 0x7c 0xa0 0xb0 0xbc 0xc0 0xc4 0xcc END
DEFINE_ARRAY SoL BEGIN 2 2 4 4 2 2 2 4 4 4 2 0 4 0 0 4 4 END
FOR (i=0;i<17;i+=1) BEGIN
SET $Q_Siz($object("%i%"))=$Siz("%i%") // size of object's section
SET $Q_OoN($object("%i%"))=$OoN("%i%") // offset of number of objects
SET $Q_OoO($object("%i%"))=$OoO("%i%") // offset of offset of objects
SET $Q_SoL($object("%i%"))=$SoL("%i%") // SHORT or LONG offset of number of objects
PATCH_IF i=15 & Q_Game=1 BEGIN // PST uses different values
Q_OoN_MapNo=0xcc Q_OoO_MapNo=0xc8 END
PATCH_IF $SoL("%i%")=2 BEGIN // number of objects
READ_SHORT $Q_OoN($object("%i%")) $Q_Num($object("%i%")) END // if SoL = 2 = SHORT, then READ_SHORT
PATCH_IF $SoL("%i%")=4 & ( i!=16 | Q_Game=2) BEGIN // non-BG2 games can't have projectiles
READ_LONG $Q_OoN($object("%i%")) $Q_Num($object("%i%")) END // if SoL = 4 = LONG, then READ_LONG
PATCH_IF $SoL("%i%")=0 BEGIN // if SoL = 0 = not needed, don't READ, instead
SET $Q_Num($object("%i%"))=1 END // SET it to 1, as this can't be any other
PATCH_IF i!=16 | Q_Game=2 BEGIN // offset of objects
READ_LONG $Q_OoO($object("%i%")) $Q_Off($object("%i%")) END // offsets' READs always LONG
END
PATCH_IF Q_Game!=2 BEGIN // if it's non-BG2 then set everything
Q_OoN_ProTr=0 Q_OoO_ProTr=0 Q_Num_ProTr=0 Q_Off_ProTr=0 END // related to projectiles to zero
END
/////////////////////////////////////////////////
// Note by Ardanis:
// Again, Qwinn's stuff that was revamped.
DEFINE_PATCH_MACRO ~wapt_Q_AREAdd_InitVars~ BEGIN
FOR (i=0;i<17;i+=1) BEGIN
SET $Q_New($object("%i%"))=0 // number of new objects
SET $Q_NewOffset($object("%i%"))=0 // writing offset for new objects
END
Q_ManualInsert=0 // unnecessary, but may be required for RESHAPE_AREA_POLYGON, should it be added later (unlikely)
END
//////////////////////////////////////////
// Note by Ardanis:
// Unlike the other two Qwinn's macros, this one is almost untouched, except of adding the 'wapt_' prefix to
// it's name and correcting the name of the macro LAUNCHed at the very end, which now has that prefix as well
DEFINE_PATCH_MACRO ~wapt_Q_AREAdd_Process~
BEGIN
// DO NOT use this macro without first running Q_AREAdd_InitVars.
// Documentation for the use of this macro is contained within that macro definition.
PATCH_FOR_EACH "S1" IN
~Actor~ ~Trigg~ ~Spawn~ ~Entra~ ~Conta~ ~Items~ ~Ambie~ ~Varia~ ~Doors~
~Tiled~ ~Vertx~ ~Anima~ ~MapNo~ ~ProTr~
BEGIN
SET "Q_NewSect" = $Q_New("%S1%") // How many new sections user has asked for
PATCH_IF !("Q_NewSect" = 0) THEN
BEGIN
// WRITE_ASCII 0x33c ~%S1%~ #32 // DEBUG
SET "Q_OoNSect" = $Q_OoN("%S1%") // Offset where count of each section is stored
SET "Q_NumSect" = $Q_Num("%S1%") // Original count for that section
SET "Q_SoLSect" = $Q_SoL("%S1%") // Whether original count is stored as long or short
SET "Q_OoOSect1" = $Q_OoO("%S1%") // Offset of offset for the section
SET "Q_Offset1" = $Q_Off("%S1%") // Offset of the section being added to
SET "Q_SizSect" = $Q_Siz("%S1%") // The size of one new section
PATCH_FOR_EACH "S2" IN
~Actor~ ~Trigg~ ~Spawn~ ~Entra~ ~Conta~ ~Items~ ~Ambie~ ~Varia~ ~Doors~
~Tiled~ ~Vertx~ ~Explo~ ~Anima~ ~Songs~ ~RestS~ ~MapNo~ ~ProTr~
BEGIN
// WRITE_ASCII 0x33c ~%S1% %S2%~ #32 // DEBUG
SET "Q_Offset2" = $Q_Off("%S2%") // Offset of each other section
SET "Q_OoOSect2" = $Q_OoO("%S2%") // Offset of that offset
SET "Q_OldInsert" = $Q_NewOffset("%S2%") // Previous insert offsets need to be updated too
PATCH_IF ("Q_Offset2" >= "Q_Offset1") AND NOT ("%S1%" STRING_EQUAL "%S2%") THEN
BEGIN
WRITE_LONG "Q_OoOSect2" ("Q_Offset2" + ("Q_NewSect" * "Q_SizSect"))
END
PATCH_IF ("Q_OldInsert" >= "Q_Offset1") AND NOT ("%S1%" STRING_EQUAL "%S2%") THEN
BEGIN
SET $Q_NewOffset("%S2%") = $Q_NewOffset("%S2%") + ("Q_NewSect" * "Q_SizSect")
END
END
SET $Q_NewOffset("%S1%") = "Q_Offset1" + ("Q_NumSect" * "Q_SizSect")
SET "Q_InsertOffset" = $Q_NewOffset("%S1%")
PATCH_IF "Q_ManualInsert" = 0 THEN
BEGIN
INSERT_BYTES "Q_InsertOffset" ("Q_NewSect" * "Q_SizSect")
END
PATCH_IF "Q_SoLSect" = 2 THEN BEGIN WRITE_SHORT "Q_OoNSect" ("Q_NumSect" + "Q_NewSect") END
ELSE BEGIN WRITE_LONG "Q_OoNSect" ("Q_NumSect" + "Q_NewSect") END
LAUNCH_PATCH_MACRO ~wapt_Q_ARE_InitVars~ // Reset all our variables to their new values
END
END
END
/////////////////////////////////////////////////
DEFINE_PATCH_FUNCTION add_area_transition_trigger
INT_VAR
wapt_bbox=0x22
STR_VAR
wapt_ob_type= ~Trigg~
BEGIN
///////
LAUNCH_PATCH_MACRO wapt_inserter
FOR (i=0;i<wapt_object;i+=1) BEGIN
LAUNCH_PATCH_MACRO wapt_routine
WRITE_SHORT (new_loc + 0x20) 2 // transition trigger
DEFINE_ARRAY nam BEGIN vertices cursor exit_are flags END
DEFINE_ARRAY off BEGIN 0x2a 0x34 0x38 0x60 END
DEFINE_ARRAY sol BEGIN 2 4 8 2 END
array=4 // how long the array block is
LAUNCH_PATCH_MACRO wapt_array
WRITE_ASCIIE (new_loc+0x40) $wapt_exit_name("%i%")
WRITE_LONG (new_loc + 0x2c) vert_entry // vertex index
vert_entry += $wapt_vertices("%i%") // update vertex index for the next object
END
FOR (j=0;j<wapt_object;j+=1) BEGIN // okay, this is a temporary solution, as it couldn't fit into initial framework
SPRINT are_name $wapt_exit_are("%j%")
INNER_ACTION BEGIN
COPY_EXISTING ~%are_name%.are~ ~override~
LAUNCH_PATCH_MACRO ~wapt_Q_ARE_InitVars~
LAUNCH_PATCH_MACRO ~wapt_Q_AREAdd_InitVars~
Q_New_Entra = 1
LAUNCH_PATCH_MACRO ~wapt_Q_AREAdd_Process~
new_loc = Q_NewOffset_Entra
WRITE_ASCIIE new_loc $wapt_exit_name("%j%")
WRITE_SHORT new_loc+0x20 $wapt_exit_x("%j%")
WRITE_SHORT new_loc+0x22 $wapt_exit_y("%j%")
PATCH_IF (VARIABLE_IS_SET $wapt_orient("%j%")) BEGIN
WRITE_SHORT new_loc+0x24 $wapt_orient("%j%")
END
BUT_ONLY
END
END
///
END
////////////////////////////////////////////
DEFINE_PATCH_FUNCTION add_area_floor_trigger
INT_VAR
wapt_bbox=0x22
STR_VAR
wapt_ob_type= ~Trigg~
BEGIN
///////
LAUNCH_PATCH_MACRO wapt_inserter
FOR (i=0;i<wapt_object;i+=1) BEGIN
LAUNCH_PATCH_MACRO wapt_routine
WRITE_SHORT (new_loc+0x20) 0 // floor trap
WRITE_SHORT (new_loc+0x6c) 1 // trigger is active by default
DEFINE_ARRAY nam BEGIN vertices flags detect_diff disarm_diff trapped detected launch_x launch_y script dialog END
DEFINE_ARRAY off BEGIN 0x2a 0x60 0x68 0x6a 0x6c 0x6e 0x70 0x72 0x7c 0xbc END
DEFINE_ARRAY sol BEGIN 2 4 2 2 2 2 2 2 8 8 END
array=10 // how long the array block is
LAUNCH_PATCH_MACRO wapt_array
WRITE_LONG (new_loc + 0x2c) vert_entry // vertex index
vert_entry += $wapt_vertices("%i%") // update vertex index for the next object
END
///
END
///////////////////////////////////////////
DEFINE_PATCH_FUNCTION add_area_info_trigger
INT_VAR
wapt_bbox=0x22
STR_VAR
wapt_ob_type= ~Trigg~
RET
wapt_string_0 wapt_string_1 wapt_string_2 wapt_string_3 wapt_string_4
wapt_string_5 wapt_string_6 wapt_string_7 wapt_string_8 wapt_string_9
BEGIN
///////
LAUNCH_PATCH_MACRO wapt_inserter
FOR (i=0;i<wapt_object;i+=1) BEGIN
LAUNCH_PATCH_MACRO wapt_routine
WRITE_SHORT (new_loc+0x20) 1 // info point
WRITE_LONG (new_loc+0x34) 22 // cursor type is 'info point' by default
DEFINE_ARRAY nam BEGIN vertices cursor script dialog END
DEFINE_ARRAY off BEGIN 0x2a 0x34 0x7c 0xbc END
DEFINE_ARRAY sol BEGIN 2 4 8 8 END
array=4 // how long the array block is
LAUNCH_PATCH_MACRO wapt_array
PATCH_IF (VARIABLE_IS_SET $wapt_string("%i%")) BEGIN
SET $wapt_string("%i%") = (new_loc+0x64)
END
WRITE_LONG (new_loc + 0x2c) vert_entry // vertex index
vert_entry += $wapt_vertices("%i%") // update vertex index for the next object
END
///
END
////////////////////////////////////////
DEFINE_PATCH_FUNCTION add_area_container
INT_VAR
wapt_bbox=0x38
STR_VAR
wapt_ob_type= ~Conta~
RET
wapt_string_0 wapt_string_1 wapt_string_2 wapt_string_3 wapt_string_4
wapt_string_5 wapt_string_6 wapt_string_7 wapt_string_8 wapt_string_9
BEGIN
///////
LAUNCH_PATCH_MACRO wapt_inserter
FOR (i=0;i<wapt_object;i+=1) BEGIN
LAUNCH_PATCH_MACRO wapt_routine
DEFINE_ARRAY nam BEGIN use_x use_y type lock_diff flags detect_diff disarm_diff trapped detected launch_x launch_y script vertices key_item END
DEFINE_ARRAY off BEGIN 0x20 0x22 0x24 0x26 0x28 0x2c 0x2e 0x30 0x32 0x34 0x36 0x48 0x54 0x78 END
DEFINE_ARRAY sol BEGIN 2 2 2 2 4 2 2 2 2 2 2 8 4 8 END
array=14 // how long the array block is
LAUNCH_PATCH_MACRO wapt_array
PATCH_IF (VARIABLE_IS_SET $wapt_string("%i%")) BEGIN
SET $wapt_string("%i%") = (new_loc+0x84)
END
WRITE_LONG (new_loc+0x40) Q_Num_Items
WRITE_LONG (new_loc+0x50) vert_entry // vertex index
vert_entry += $wapt_vertices("%i%") // update vertex index for the next object
END
///
END
////////////////////////////////////////////////////
«
Last Edit: December 27, 2009, 06:44:19 PM by GeN1e
»
Logged
GeN1e
Planewalker
Offline
Gender:
Posts: 163
Re: ADD_AREA_CONTAINER macro
«
Reply #2 on:
December 27, 2009, 07:29:23 PM »
Example usage
Code:
COPY_EXISTING ~ar0500.are~ ~override~
LAUNCH_PATCH_FUNCTION add_area_transition_trigger
INT_VAR
wapt_flags_0 = 512+4
wapt_exit_x_0 = 2500
wapt_exit_y_0 = 1000
wapt_cursor_0 = 42
//wapt_orient_0 = 8
wapt_vertices_0 = 5
wapt_vx_0 = 400
wapt_vy_0 = 2600
wapt_vx_1 = 415
wapt_vy_1 = 2670
wapt_vx_2 = 420
wapt_vy_2 = 2715
wapt_vx_3 = 405
wapt_vy_3 = 2690
wapt_vx_4 = 390
wapt_vy_4 = 2650
STR_VAR
wapt_object_name_0 = ~wapt_0_transition~
wapt_exit_name_0 = ~wapt_0_exit~
wapt_exit_are_0 = ~ar0400~
END
LAUNCH_PATCH_FUNCTION add_area_floor_trigger
INT_VAR
wapt_flags_0 = 4+512
wapt_detected_0 = 0
wapt_trapped_0 = 1
wapt_detect_diff_0 = 65
wapt_disarm_diff_0 = 75
wapt_launch_x_0 = 543
wapt_launch_y_0 = 234
wapt_vertices_0 = 5
wapt_vx_0 = 300
wapt_vy_0 = 2600
wapt_vx_1 = 315
wapt_vy_1 = 2650
wapt_vx_2 = 320
wapt_vy_2 = 2675
wapt_vx_3 = 305
wapt_vy_3 = 2700
wapt_vx_4 = 290
wapt_vy_4 = 2650
wapt_vertices_1 = 4
wapt_vx_5 = 265
wapt_vy_5 = 2550
wapt_vx_6 = 270
wapt_vy_6 = 2575
wapt_vx_7 = 255
wapt_vy_7 = 2600
wapt_vx_8 = 240
wapt_vy_8 = 2550
STR_VAR
wapt_object_name_0 = ~wapt_0_floor_trap~
wapt_script_0 = ~ag#test~
wapt_object_name_1 = ~wapt_1_floor_trap~
wapt_script_1 = ~ag#test1~
END
LAUNCH_PATCH_FUNCTION add_area_container
INT_VAR
wapt_use_point_x_0 = 250
wapt_use_point_y_0 = 2600
wapt_vertices_0 = 5
wapt_string_0 = 55345
wapt_vx_0 = 300
wapt_vy_0 = 2600
wapt_vx_1 = 315
wapt_vy_1 = 2650
wapt_vx_2 = 320
wapt_vy_2 = 2675
wapt_vx_3 = 305
wapt_vy_3 = 2700
wapt_vx_4 = 290
wapt_vy_4 = 2650
wapt_use_point_x_1 = 350
wapt_use_point_y_1 = 2500
wapt_detect_diff_1 = 50
wapt_disarm_diff_1 = 60
wapt_launch_x_1 = 400
wapt_launch_y_1 = 2800
wapt_vertices_1 = 4
wapt_vx_5 = 265
wapt_vy_5 = 2550
wapt_vx_6 = 270
wapt_vy_6 = 2575
wapt_vx_7 = 255
wapt_vy_7 = 2600
wapt_vx_8 = 240
wapt_vy_8 = 2550
wapt_use_point_x_2 = 350
wapt_use_point_y_2 = 2700
wapt_vertices_2 = 4
wapt_vx_9 = 350
wapt_vy_9 = 2700
wapt_vx_10 = 400
wapt_vy_10 = 2750
wapt_vx_11 = 350
wapt_vy_11 = 2650
wapt_vx_12 = 300
wapt_vy_12 = 2700
STR_VAR
wapt_object_name_0 = ~wapt_0_container~
wapt_script_0 = ~ag#test0~
wapt_key_item_0 = ~ag#key0~
wapt_object_name_1 = ~wapt_1_container~
wapt_script_1 = ~ag#test1~
wapt_object_name_2 = ~wapt_2_container~
wapt_script_2 = ~ag#test2~
END
LAUNCH_PATCH_FUNCTION add_area_info_trigger
INT_VAR
wapt_vertices_0 = 5
wapt_string_0 = 55345
wapt_vx_0 = 300
wapt_vy_0 = 2600
wapt_vx_1 = 315
wapt_vy_1 = 2650
wapt_vx_2 = 320
wapt_vy_2 = 2675
wapt_vx_3 = 305
wapt_vy_3 = 2700
wapt_vx_4 = 290
wapt_vy_4 = 2650
wapt_vertices_1 = 4
wapt_vx_5 = 265
wapt_vy_5 = 2550
wapt_vx_6 = 270
wapt_vy_6 = 2575
wapt_vx_7 = 255
wapt_vy_7 = 2600
wapt_vx_8 = 240
wapt_vy_8 = 2550
STR_VAR
wapt_object_name_0 = ~wapt_0_infrotrigger~
wapt_script_0 = ~ag#test~
wapt_object_name_1 = ~wapt_1_infrotrigger~
wapt_script_1 = ~ag#test1~
RET
text_0 = wapt_string_0
END
SAY text_0 ~This is a sample code.~
BUT_ONLY
Logged
Miloch
Barbarian
Planewalker
Offline
Gender:
Posts: 564
Re: ADD_AREA_CONTAINER macro
«
Reply #3 on:
December 28, 2009, 08:53:47 AM »
Quote
Jeez, it's ridiculous. The latest function was named in a different style than the others.
Seems a bit... excessive, though I guess that includes macros/functions for everything area-related, not just containers. Were you planning on standardising it further then?
So does anyone know where the source is to ADD_AREA_REGION_TRIGGER? Is it even in WeiDU? Can't say I've ever tried using it. But the documentation says "The original code released in WeiDU v211 has been overhauled and re-released in v212." So it'd be interesting to see exactly what that means.
Logged
Tutu/BGT Area Map & List
*
Tutu Mod List
*
BG1 Fixpack
*
Lost Items
the bigg
The Avatar of Fighter / Thieves
Moderator
Planewalker
Offline
Gender:
Posts: 3191
Re: ADD_AREA_CONTAINER macro
«
Reply #4 on:
December 28, 2009, 09:13:46 AM »
ADD_ARE_REGION_TRIGGER is 1027-ish
here
. If you don't want a full-fledged git installation (which would take about 15 minutes out of your time), you can sign up with github, fork my WeiDU tree, browse to the file you're interested into and press the edit button.
Logged
Please do not contact me for assistance in using BGT, BP, any other of the 'large mods', or a mod I didn't write or contribute to. I'm not your paid support staff, so I'd suggest you to direct your help questions to the forum relative to the mod you're playing.<br /><br />Thanks for your cooperation.
the bigg
The Avatar of Fighter / Thieves
Moderator
Planewalker
Offline
Gender:
Posts: 3191
Re: ADD_AREA_CONTAINER macro
«
Reply #5 on:
December 30, 2009, 10:44:54 AM »
Added to the standard library. I assume those things have been tested.
Logged
Please do not contact me for assistance in using BGT, BP, any other of the 'large mods', or a mod I didn't write or contribute to. I'm not your paid support staff, so I'd suggest you to direct your help questions to the forum relative to the mod you're playing.<br /><br />Thanks for your cooperation.
Miloch
Barbarian
Planewalker
Offline
Gender:
Posts: 564
Re: ADD_AREA_CONTAINER macro
«
Reply #6 on:
January 13, 2010, 03:52:48 PM »
Quote from: the bigg on January 04, 2010, 04:15:50 PM
Change log for 213:
Quote
...
Added ADD_AREA_FLOOR_TRIGGER, ADD_AREA_INFO_TRIGGER, ADD_AREA_TRANSITION_TRIGGER and ADD_AREA_CONTAINER functions.
Why do I get a "Patching Failed (COPY) (Failure("Unknown function: ADD_AREA_CONTAINER"))" then?
Edit: Holy shit, it's case-sensitive?
Ok, so now WTF is this?
Code:
Install Component [Area Test]?
[I]nstall, or [N]ot Install or [Q]uit?
Installing [Area Test]
[./override/fw0125.are] loaded, 9760 bytes
Copying and patching 1 file ...
[./override/fw2900.are] loaded, 6064 bytes
[./override/fw0125.are] loaded, 9760 bytes
BIFF may be in hard-drive CD-path [C:\Archive\BG2\CD6\/DATA/AREAS.BIF]
BIFF may be in hard-drive CD-path [C:\Archive\BG2\CD5\/DATA/AREAS.BIF]
BIFF may be in hard-drive CD-path [C:\Archive\BG2\CD4\/DATA/AREAS.BIF]
BIFF may be in hard-drive CD-path [C:\Archive\BG2\CD3\/DATA/AREAS.BIF]
BIFF may be in hard-drive CD-path [C:\Archive\BG2\CD2\/DATA/AREAS.BIF]
BIFF may be in hard-drive CD-path [C:\Archive\BG2\CD1\/DATA/AREAS.BIF]
BIFF may be in hard-drive CD-path [C:\Archive\BG1Tutu\/DATA/AREAS.BIF]
[C:\Archive\BG1Tutu\/DATA/AREAS.BIF] 2438836 bytes, 307 files, 0 tilesets
[./override/ar6111.are] loaded, 2776 bytes
[./override/fw2003.are] loaded, 1684 bytes
[./override/fw0125.are] loaded, 9760 bytes
[./override/ar6111.are] loaded, 2776 bytes
[./override/fw2003.are] loaded, 1684 bytes
[./override/fw0125.are] loaded, 9760 bytes
[./override/ar6111.are] loaded, 2776 bytes
[./override/fw2003.are] loaded, 1684 bytes
[./override/fw0125.are] loaded, 9760 bytes
[./override/ar6111.are] loaded, 2776 bytes
[./override/fw2003.are] loaded, 1684 bytes
[./override/fw0125.are] loaded, 9760 bytes
[./override/ar6111.are] loaded, 2776 bytes
[./override/fw2003.are] loaded, 1684 bytes
[./override/fw0125.are] loaded, 9760 bytes
[./override/ar6111.are] loaded, 2776 bytes
[./override/fw2003.are] loaded, 1684 bytes
[./override/fw0125.are] loaded, 9760 bytes
[./override/ar6111.are] loaded, 2776 bytes
[./override/fw2003.are] loaded, 1684 bytes
[./override/fw0125.are] loaded, 9760 bytes
[./override/ar6111.are] loaded, 2776 bytes
[./override/fw2003.are] loaded, 1684 bytes
[./override/fw0125.are] loaded, 9760 bytes
[./override/ar6111.are] loaded, 2776 bytes
[./override/fw2003.are] loaded, 1684 bytes
ERROR: [fw2900.are] -> [override] Patching Failed (COPY) (Not_found)
Stopping installation because of error.
What's with loading the same areas multiple times, and the "Not_found" when obviously it found (and loaded) it?
Code used:
Code:
BEGIN ~Area Test~
ACTION_IF FILE_EXISTS_IN_GAME ~fw0125.are~ BEGIN //Tutu
OUTER_SPRINT lswd ~fw2900~ //Larswood
END ELSE BEGIN //BGT
OUTER_SPRINT lswd ~ar9000~
END
COPY_EXISTING ~%lswd%.are~ ~override~
PATCH_IF SOURCE_SIZE > 0x11b BEGIN
LAUNCH_PATCH_FUNCTION add_area_container
INT_VAR wapt_use_point_x_0 = 4590
wapt_use_point_y_0 = 1525
wapt_type_0 = 8 //Nonvisible
wapt_detect_diff_0 = 100
wapt_disarm_diff_0 = 100
wapt_launch_x_0 = 4600
wapt_launch_y_0 = 1535
wapt_vertices_0 = 6
wapt_vx_0 = 4556
wapt_vy_0 = 1517
wapt_vx_1 = 4562
wapt_vy_1 = 1509
wapt_vx_2 = 4580
wapt_vy_2 = 1505
wapt_vx_3 = 4588
wapt_vy_3 = 1511
wapt_vx_4 = 4580
wapt_vy_4 = 1521
wapt_vx_5 = 4564
wapt_vy_5 = 1525
STR_VAR wapt_object_name_0 = ~Container 1~
END
END
BUT_ONLY
«
Last Edit: January 13, 2010, 04:26:30 PM by Miloch
»
Logged
Tutu/BGT Area Map & List
*
Tutu Mod List
*
BG1 Fixpack
*
Lost Items
the bigg
The Avatar of Fighter / Thieves
Moderator
Planewalker
Offline
Gender:
Posts: 3191
Re: ADD_AREA_CONTAINER macro
«
Reply #7 on:
January 13, 2010, 04:51:41 PM »
I love people who sends tested code my way.
Logged
Please do not contact me for assistance in using BGT, BP, any other of the 'large mods', or a mod I didn't write or contribute to. I'm not your paid support staff, so I'd suggest you to direct your help questions to the forum relative to the mod you're playing.<br /><br />Thanks for your cooperation.
the bigg
The Avatar of Fighter / Thieves
Moderator
Planewalker
Offline
Gender:
Posts: 3191
Re: ADD_AREA_CONTAINER macro
«
Reply #8 on:
January 13, 2010, 05:00:24 PM »
In other words, I don't have the time to debug spaghetti TP2 code written by other people. If you have time to burn, have fun with PATCH_PRINT and the command-line switches --debug-assign and --debug-value.
Logged
Please do not contact me for assistance in using BGT, BP, any other of the 'large mods', or a mod I didn't write or contribute to. I'm not your paid support staff, so I'd suggest you to direct your help questions to the forum relative to the mod you're playing.<br /><br />Thanks for your cooperation.
Miloch
Barbarian
Planewalker
Offline
Gender:
Posts: 564
Re: ADD_AREA_CONTAINER macro
«
Reply #9 on:
January 13, 2010, 08:40:40 PM »
I suppose it's too much to ask OCaml to report something a bit more intelligible than "Not_found"?
I would just reverse all the above from WeiDU unless someone can vouch for it with actual successfully-tested examples. Maybe you'll even get WeiDU under 600k again :\. I'm working with some different code I have better hopes for... at least it executes successfully without some bogus arcane error message.
Edit: but what *is* with loading all those areas multiple times in a row? They appear to be GAME_IS checks but I'm not even using that - is it something the pseudofunction is trying to do?
«
Last Edit: January 13, 2010, 08:44:46 PM by Miloch
»
Logged
Tutu/BGT Area Map & List
*
Tutu Mod List
*
BG1 Fixpack
*
Lost Items
the bigg
The Avatar of Fighter / Thieves
Moderator
Planewalker
Offline
Gender:
Posts: 3191
Re: ADD_AREA_CONTAINER macro
«
Reply #10 on:
January 14, 2010, 05:16:00 AM »
Quote from: Miloch on January 13, 2010, 08:40:40 PM
I suppose it's too much to ask OCaml to report something a bit more intelligible than "Not_found"?
It can't print the line/column number the error is happening at. It can (maybe) figure out the name of the not found variable,
Quote
I would just reverse all the above from WeiDU unless someone can vouch for it with actual successfully-tested examples. Maybe you'll even get WeiDU under 600k again :\. I'm working with some different code I have better hopes for... at least it executes successfully without some bogus arcane error message.
200k are spent on the tp2 parser (which is very space-inefficient); I might shave that down a lot by saving it as a sparse array and uncompressing it on the fly, but don't hold your breath for it. And I'm not a fan of removing functionality, especially when it's fixable.
Quote
Edit: but what *is* with loading all those areas multiple times in a row? They appear to be GAME_IS checks but I'm not even using that - is it something the pseudofunction is trying to do?
Sub-functions use ENGINE_IS, and GAME_IS loads the file rather than just check its availability.
Logged
Please do not contact me for assistance in using BGT, BP, any other of the 'large mods', or a mod I didn't write or contribute to. I'm not your paid support staff, so I'd suggest you to direct your help questions to the forum relative to the mod you're playing.<br /><br />Thanks for your cooperation.
GeN1e
Planewalker
Offline
Gender:
Posts: 163
Re: ADD_AREA_CONTAINER macro
«
Reply #11 on:
January 15, 2010, 04:59:12 PM »
Quote
I would just reverse all the above from WeiDU
Actually, I second that request -
Quote
Here are contents of the old WAPT library, including infotriggers and containers. By 'old' I mean was considered too much hardcoded and ordered into revision, so
it wasn't supposed to end up in WeiDU
. Till then, here it is.
Not_found error == RET, I think I've already complained on it's part. Damn thing gave me nightmares.
OK, yes, I know it's me to blame, sorry for the shit, guys. It seems as if I have picked the wrong file to post from. So I second that request wholeheartedly now.
Logged
the bigg
The Avatar of Fighter / Thieves
Moderator
Planewalker
Offline
Gender:
Posts: 3191
Re: ADD_AREA_CONTAINER macro
«
Reply #12 on:
January 15, 2010, 05:55:38 PM »
Removing the code.
Logged
Please do not contact me for assistance in using BGT, BP, any other of the 'large mods', or a mod I didn't write or contribute to. I'm not your paid support staff, so I'd suggest you to direct your help questions to the forum relative to the mod you're playing.<br /><br />Thanks for your cooperation.
Pages:
[
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
BG2 Completed Mods
-----------------------------
=> Kelsey
=> Banter Packs
=> de'Arnise Romance
=> Unfinished Business
===> UB Workroom
===> Finished Business
=> Quest Pack
===> Quest BETA
=> NPC Flirt Packs
=> Virtue
=> Keto
=> Xan
=> Assassinations
=> Dungeon Crawl
=> Six's Idle Meddlings
=> Turnabout
=> Dungeon-Be-Gone
=> House Of Sim
=> Ashes of Embers
=> Zyraen's Miscellaneous Mods
=> Event Modding: Iron Modder and One-Day NPC
-----------------------------
BG1 Completed Mods
-----------------------------
=> BG1Tutu General
===> BG1Tutu Bugs and Support
===> BG1Tutu V6 Beta
=> Tutu Mods and Modding
=> The Fields of the Dead
=> BG1 Unfinished Business
===> BG1UB Workroom
===> BG1 Finished Business
-----------------------------
IWD Completed Mods
-----------------------------
=> Icewind Dale NPCs
-----------------------------
Works In Progress
-----------------------------
=> Zathali
=> King Strohm's Tomb
===> Surayah
=====> Hessa
===> Cailean
===> Lady Delcia Caan Romance (Replace This Mod!)
-----------------------------
Friends and Neighbors
-----------------------------
=> Weimer Republic (WeiDU.org)
===> Solaufein
===> Solaufein Workshop
===> Valen
===> Ascension/WeiDU
===> Other Weimer Mods
===> WeiDU
===> Icewind Gate II
=> Near Infinity
-----------------------------
Miscellany, Inc.
-----------------------------
=> BG/PST/IWD Gameplay
===> All Other Gaming
=> Mod Discussion and Announcements
=> Infinity Engine Modding Q&A
=> Tutorials
=> Fan Fiction
===> Bad Kelsey: A Challenge
=> Ensign First Class Blather