Merged New Inventory Project into main branch

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2008-03-08 15:15:25 +00:00
parent e16d166277
commit 43ca24dda8
649 changed files with 93359 additions and 82507 deletions
+4 -3
View File
@@ -63,6 +63,7 @@ enum
ITEMS_WEAPONS, FIRST_ITEMS_BUTTON = ITEMS_WEAPONS,
ITEMS_AMMO,
ITEMS_ARMOUR,
ITEMS_LBEGEAR,
ITEMS_EXPLOSIVES,
ITEMS_EQUIPMENT1,
ITEMS_EQUIPMENT2,
@@ -249,9 +250,9 @@ enum
#define FIRST_MERCS_COLORMODE_BUTTON MERCS_TOGGLECOLOR_BUTTON
#define LAST_MERCS_COLORMODE_BUTTON MERCS_BODYTYPE_UP
#define FIRST_MERCS_COLOR_BUTTON MERCS_HAIRCOLOR_DOWN
#define FIRST_MERCS_COLOR_BUTTON MERCS_HAIRCOLOR_DOWN
#define LAST_MERCS_COLOR_BUTTON MERCS_PANTCOLOR_UP
#define FIRST_MERCS_BODYTYPE_BUTTON MERCS_BODYTYPE_DOWN
#define FIRST_MERCS_BODYTYPE_BUTTON MERCS_BODYTYPE_DOWN
#define LAST_MERCS_BODYTYPE_BUTTON MERCS_BODYTYPE_UP
#define FIRST_MERCS_INVENTORY_BUTTON MERCS_HEAD_SLOT
@@ -264,4 +265,4 @@ enum
#define LAST_MERCS_SCHEDULE_BUTTON MERCS_SCHEDULE_CLEAR
#endif
#endif
#endif
+21 -21
View File
@@ -51,7 +51,7 @@ void EnsureSelectionType();
//Used for offseting cursor to show that it is on the roof rather than on the ground.
//This can be conveniently executed by moving the cursor up and right 3 gridnos for a
//total of -483 -(160*3)-(1*3)
//total of -483 -(160*3)-(1*3)
#define ROOF_OFFSET (-483)
BOOLEAN gfUsingOffset;
@@ -98,7 +98,7 @@ void RemoveCursors()
Assert( gSelectRegion.iTop >= 0 && gSelectRegion.iTop <= gSelectRegion.iBottom );
Assert( gSelectRegion.iLeft >= 0 && gSelectRegion.iLeft <= gSelectRegion.iRight );
for( y = gSelectRegion.iTop; y <= gSelectRegion.iBottom; y++ )
{
{
for( x = gSelectRegion.iLeft; x <= gSelectRegion.iRight; x++ )
{
LEVELNODE* pNode;
@@ -160,14 +160,14 @@ void UpdateCursorAreas()
}
else switch( gusSelectionType )
{
case SMALLSELECTION:
case SMALLSELECTION:
gSelectRegion.iLeft = gSelectRegion.iRight = sGridX;
gSelectRegion.iTop = gSelectRegion.iBottom = sGridY;
fValidCursor = TRUE;
break;
case MEDIUMSELECTION:
case LARGESELECTION:
case XLARGESELECTION:
case MEDIUMSELECTION:
case LARGESELECTION:
case XLARGESELECTION:
//The mouse mode value reflects the size of the cursor.
gSelectRegion.iTop = sGridY - gusSelectionType;
gSelectRegion.iBottom = sGridY + gusSelectionType;
@@ -189,13 +189,13 @@ void UpdateCursorAreas()
//Draw all of the area cursors here.
if( fValidCursor )
{
if( iDrawMode == DRAW_MODE_ENEMY || iDrawMode == DRAW_MODE_CREATURE ||
if( iDrawMode == DRAW_MODE_ENEMY || iDrawMode == DRAW_MODE_CREATURE ||
iDrawMode == DRAW_MODE_REBEL || iDrawMode == DRAW_MODE_CIVILIAN ||
iDrawMode == DRAW_MODE_SCHEDULEACTION )
{
iMapIndex = gSelectRegion.iTop * WORLD_COLS + gSelectRegion.iLeft;
if( !IsLocationSittable( iMapIndex, gfRoofPlacement ) && iDrawMode != DRAW_MODE_SCHEDULEACTION ||
!IsLocationSittableExcludingPeople( iMapIndex, gfRoofPlacement ) && iDrawMode == DRAW_MODE_SCHEDULEACTION )
if( !IsLocationSittable( iMapIndex, gfRoofPlacement ) && iDrawMode != DRAW_MODE_SCHEDULEACTION ||
!IsLocationSittableExcludingPeople( iMapIndex, gfRoofPlacement ) && iDrawMode == DRAW_MODE_SCHEDULEACTION )
{
if( sBadMarker != iMapIndex )
{
@@ -225,7 +225,7 @@ void UpdateCursorAreas()
}
}
else for( y = gSelectRegion.iTop; y <= gSelectRegion.iBottom; y++ )
{
{
for( x = gSelectRegion.iLeft; x <= gSelectRegion.iRight; x++ )
{
iMapIndex = y * WORLD_COLS + x;
@@ -238,11 +238,11 @@ void UpdateCursorAreas()
void ForceAreaSelectionWidth()
{
UINT16 gusDecSelWidth;
//If the anchor isn't set, we don't want to force the size yet.
if( !fAnchored )
return;
gusDecSelWidth = gusSelectionWidth - 1;
//compare the region with the anchor and determine if we are going to force size via
@@ -280,8 +280,8 @@ BOOLEAN HandleAreaSelection()
//When the user releases the left button, then clear and process the area.
if( fAnchored )
{
if( !gfLeftButtonState && !gfCurrentSelectionWithRightButton ||
!gfRightButtonState && gfCurrentSelectionWithRightButton )
if( !gfLeftButtonState && !gfCurrentSelectionWithRightButton ||
!gfRightButtonState && gfCurrentSelectionWithRightButton )
{
fAnchored = FALSE;
ProcessAreaSelection( (BOOLEAN)!gfCurrentSelectionWithRightButton );
@@ -341,8 +341,8 @@ BOOLEAN HandleAreaSelection()
void ValidateSelectionRegionBoundaries()
{
gSelectRegion.iLeft = max( min( 159, gSelectRegion.iLeft ) , 0 );
gSelectRegion.iRight = max( min( 159, gSelectRegion.iRight ), 0 );
gSelectRegion.iTop = max( min( 159, gSelectRegion.iTop ) , 0 );
gSelectRegion.iRight = max( min( 159, gSelectRegion.iRight ), 0 );
gSelectRegion.iTop = max( min( 159, gSelectRegion.iTop ) , 0 );
gSelectRegion.iBottom = max( min( 159, gSelectRegion.iBottom ), 0 );
}
@@ -350,10 +350,10 @@ void EnsureSelectionType()
{
BOOLEAN fPrevBrushEnabledState = gfBrushEnabled;
//At time of writing, the only drawing mode supporting right mouse button
//At time of writing, the only drawing mode supporting right mouse button
//area selections is the cave drawing mode.
gfAllowRightButtonSelections = ( iDrawMode == DRAW_MODE_CAVES );
//if we are erasing, we have more flexibility with the drawing modes.
if( iDrawMode >= DRAW_MODE_ERASE )
{
@@ -440,7 +440,7 @@ void DrawBuildingLayout( INT32 iMapIndex )
if( fAdd )
AddTopmostToTail( iMapIndex, FIRSTPOINTERS1 );
}
curr = curr->next;
curr = curr->next;
}
}
@@ -457,8 +457,8 @@ void RemoveBuildingLayout()
iMapIndex = curr->sGridNo + iOffset;
if( iMapIndex > 0 && iMapIndex < WORLD_MAX )
RemoveTopmost( iMapIndex, FIRSTPOINTERS1 );
curr = curr->next;
curr = curr->next;
}
}
#endif
#endif
+2 -1
View File
@@ -93,6 +93,7 @@ void TerrainTileButtonRegionCallback(MOUSE_REGION *reg,INT32 reason);
void ItemsWeaponsCallback(GUI_BUTTON *btn,INT32 reason);
void ItemsAmmoCallback(GUI_BUTTON *btn,INT32 reason);
void ItemsArmourCallback(GUI_BUTTON *btn,INT32 reason);
void ItemsLBECallback(GUI_BUTTON *btn,INT32 reason);
void ItemsExplosivesCallback(GUI_BUTTON *btn,INT32 reason);
void ItemsEquipment1Callback(GUI_BUTTON *btn,INT32 reason);
void ItemsEquipment2Callback(GUI_BUTTON *btn,INT32 reason);
@@ -154,4 +155,4 @@ void BtnEraseCallback(GUI_BUTTON *btn,INT32 reason);
#endif
#endif
#endif
+15 -9
View File
@@ -401,10 +401,10 @@ void BuildingSawRoomCallback( GUI_BUTTON *btn, INT32 reason )
void BuildingKillBuildingCallback(GUI_BUTTON *btn, INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP)
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
SetEditorBuildingTaskbarMode( BUILDING_KILL_BUILDING );
iDrawMode = DRAW_MODE_KILL_BUILDING;
iDrawMode = DRAW_MODE_KILL_BUILDING;
}
}
@@ -428,10 +428,10 @@ void BuildingMoveBuildingCallback( GUI_BUTTON *btn, INT32 reason )
void BuildingDrawRoomNumCallback(GUI_BUTTON *btn, INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP)
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP)
{
SetEditorBuildingTaskbarMode( BUILDING_DRAW_ROOMNUM );
iDrawMode = DRAW_MODE_ROOMNUM;
iDrawMode = DRAW_MODE_ROOMNUM;
gubCurrRoomNumber = gubMaxRoomNumber;
}
}
@@ -457,7 +457,7 @@ void BuildingToggleRoofViewCallback(GUI_BUTTON *btn,INT32 reason)
{
UnclickEditorButton( BUILDING_TOGGLE_ROOF_VIEW );
}
//Name could be a bit misleading. It'll hide or show the roofs based on the
//Name could be a bit misleading. It'll hide or show the roofs based on the
//fBuildingShowRoofs value.
UpdateRoofsView();
}
@@ -475,7 +475,7 @@ void BuildingToggleWallViewCallback(GUI_BUTTON *btn,INT32 reason)
{
UnclickEditorButton( BUILDING_TOGGLE_WALL_VIEW );
}
//Name could be a bit misleading. It'll hide or show the walls based on the
//Name could be a bit misleading. It'll hide or show the walls based on the
//fBuildingShowWalls value.
UpdateWallsView();
}
@@ -506,7 +506,7 @@ void BtnFakeLightCallback(GUI_BUTTON *btn,INT32 reason)
btn->uiFlags &= (~BUTTON_CLICKED_ON);
else
btn->uiFlags |= BUTTON_CLICKED_ON;
iEditorToolbarState = TBAR_MODE_FAKE_LIGHTING;
}
}
@@ -701,6 +701,12 @@ void ItemsArmourCallback(GUI_BUTTON *btn,INT32 reason)
SetEditorItemsTaskbarMode( ITEMS_ARMOUR );
}
void ItemsLBECallback(GUI_BUTTON *btn,INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP)
SetEditorItemsTaskbarMode( ITEMS_LBEGEAR );
}
void ItemsExplosivesCallback(GUI_BUTTON *btn,INT32 reason)
{
if(reason & MSYS_CALLBACK_REASON_LBUTTON_UP)
@@ -1295,7 +1301,7 @@ void MouseMovedInMercRegion( MOUSE_REGION *reg, INT32 reason )
void MouseClickedInMercRegion( MOUSE_REGION *reg, INT32 reason )
{
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
HandleMercInventoryPanel( reg->RelativeXPos, reg->RelativeYPos, GUI_LCLICK_EVENT );
HandleMercInventoryPanel( reg->RelativeXPos, reg->RelativeYPos, GUI_LCLICK_EVENT );
else if( reason & MSYS_CALLBACK_REASON_RBUTTON_UP )
HandleMercInventoryPanel( reg->RelativeXPos, reg->RelativeYPos, GUI_RCLICK_EVENT );
}
@@ -1340,4 +1346,4 @@ void ItemStatsDeleteCallback( GUI_BUTTON *btn, INT32 reason )
}
#endif
#endif
+9 -6
View File
@@ -44,6 +44,10 @@ void SetEditorItemsTaskbarMode( UINT16 usNewMode )
ClickEditorButton( ITEMS_ARMOUR );
iEditorToolbarState = TBAR_MODE_ITEM_ARMOUR;
break;
case ITEMS_LBEGEAR:
ClickEditorButton( ITEMS_LBEGEAR );
iEditorToolbarState = TBAR_MODE_ITEM_LBEGEAR;
break;
case ITEMS_EXPLOSIVES:
ClickEditorButton( ITEMS_EXPLOSIVES );
iEditorToolbarState = TBAR_MODE_ITEM_EXPLOSIVES;
@@ -75,7 +79,6 @@ void SetEditorItemsTaskbarMode( UINT16 usNewMode )
void SetEditorBuildingTaskbarMode( UINT16 usNewMode )
{
BOOLEAN fNewGroup = FALSE;
BOOLEAN fNewRoofs, fNewWalls, fNewRoomInfo;
if( usNewMode == usCurrentMode )
{
@@ -137,7 +140,7 @@ void SetEditorBuildingTaskbarMode( UINT16 usNewMode )
case BUILDING_PLACE_FLOORS:
case BUILDING_PLACE_TOILETS:
case BUILDING_PLACE_FURNITURE:
case BUILDING_PLACE_DECALS:
case BUILDING_PLACE_DECALS:
case BUILDING_SMART_WALLS:
case BUILDING_SMART_DOORS:
case BUILDING_SMART_WINDOWS:
@@ -185,7 +188,7 @@ void SetEditorBuildingTaskbarMode( UINT16 usNewMode )
fBuildingShowRoomInfo = fNewRoomInfo;
gfRenderWorld = TRUE;
}
}
}
void SetEditorTerrainTaskbarMode( UINT16 usNewMode )
{
@@ -345,11 +348,11 @@ void SetEditorMapInfoTaskbarMode( UINT16 usNewMode )
break;
}
if( fShowExitGrids )
{
{
ShowExitGrids();
}
else
{
{
HideExitGrids();
}
}
@@ -392,4 +395,4 @@ void SetEditorSmoothingMode( UINT8 ubNewMode )
gMapInformation.ubEditorSmoothingType = ubNewMode;
}
#endif
#endif
+243 -239
View File
@@ -7,11 +7,11 @@
#ifdef JA2EDITOR
#ifndef PRECOMPILEDHEADERS
//sgp
//sgp
#include "Button System.h"
#include "Font Control.h"
#include "debug.h"
//editor
//editor
#include "EditorDefines.h"
#include "Editor Callback Prototypes.h"
#include "Editor Taskbar Utils.h"
@@ -34,8 +34,8 @@ void InitEditorItemStatsButtons();
void InitEditorItemStatsButtons()
{
iEditorButton[ ITEMSTATS_PANEL ] =
CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 361, 160, 99, BUTTON_TOGGLE,
iEditorButton[ ITEMSTATS_PANEL ] =
CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 361, 160, 99, BUTTON_TOGGLE,
MSYS_PRIORITY_NORMAL, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK );
SpecifyDisabledButtonStyle( iEditorButton[ ITEMSTATS_PANEL ], DISABLED_STYLE_NONE );
DisableButton( iEditorButton[ ITEMSTATS_PANEL ] );
@@ -52,217 +52,217 @@ void InitEditorMercsToolbar()
STR16 FaceDirs[8] = {L"north",L"northeast",L"east",L"southeast",L"south",L"southwest",L"west",L"northwest"};
INT32 x;
iEditorButton[ MERCS_PLAYERTOGGLE ] =
iEditorButton[ MERCS_PLAYERTOGGLE ] =
CreateCheckBoxButton( iScreenWidthOffset + 4, 2 * iScreenHeightOffset + 362, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsTogglePlayers );
if( gfShowPlayers )
ClickEditorButton( MERCS_PLAYERTOGGLE );
SetButtonFastHelpText( iEditorButton[ MERCS_PLAYERTOGGLE ], L"Toggle viewing of players");
DisableButton( iEditorButton[ MERCS_PLAYERTOGGLE ] );
iEditorButton[ MERCS_ENEMYTOGGLE ] =
iEditorButton[ MERCS_ENEMYTOGGLE ] =
CreateCheckBoxButton( iScreenWidthOffset + 4, 2 * iScreenHeightOffset + 382, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleEnemies );
if( gfShowEnemies )
ClickEditorButton( MERCS_ENEMYTOGGLE );
SetButtonFastHelpText( iEditorButton[ MERCS_ENEMYTOGGLE ], L"Toggle viewing of enemies");
iEditorButton[ MERCS_CREATURETOGGLE ] =
iEditorButton[ MERCS_CREATURETOGGLE ] =
CreateCheckBoxButton( iScreenWidthOffset + 4, 2 * iScreenHeightOffset + 402, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleCreatures );
if( gfShowCreatures )
ClickEditorButton( MERCS_CREATURETOGGLE );
SetButtonFastHelpText( iEditorButton[ MERCS_CREATURETOGGLE ], L"Toggle viewing of creatures");
iEditorButton[ MERCS_REBELTOGGLE ] =
iEditorButton[ MERCS_REBELTOGGLE ] =
CreateCheckBoxButton( iScreenWidthOffset + 4, 2 * iScreenHeightOffset + 422, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleRebels );
if( gfShowRebels )
ClickEditorButton( MERCS_REBELTOGGLE );
SetButtonFastHelpText( iEditorButton[ MERCS_REBELTOGGLE ], L"Toggle viewing of rebels");
iEditorButton[ MERCS_CIVILIANTOGGLE ] =
iEditorButton[ MERCS_CIVILIANTOGGLE ] =
CreateCheckBoxButton( iScreenWidthOffset + 4, 2 * iScreenHeightOffset + 442, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleCivilians );
if( gfShowCivilians )
ClickEditorButton( MERCS_CIVILIANTOGGLE );
SetButtonFastHelpText( iEditorButton[ MERCS_CIVILIANTOGGLE ], L"Toggle viewing of civilians");
iEditorButton[MERCS_PLAYER] =
iEditorButton[MERCS_PLAYER] =
CreateTextButton( L"Player",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 20, 2 * iScreenHeightOffset + 362, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsPlayerTeamCallback );
SpecifyButtonDownTextColors( iEditorButton[MERCS_PLAYER], FONT_YELLOW, FONT_BLACK );
DisableButton( iEditorButton[MERCS_PLAYER] );
iEditorButton[MERCS_ENEMY] =
iEditorButton[MERCS_ENEMY] =
CreateTextButton( L"Enemy",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 20, 2 * iScreenHeightOffset + 382, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsEnemyTeamCallback );
SpecifyButtonDownTextColors( iEditorButton[MERCS_ENEMY], FONT_YELLOW, FONT_BLACK );
iEditorButton[MERCS_CREATURE] =
iEditorButton[MERCS_CREATURE] =
CreateTextButton( L"Creature",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 20, 2 * iScreenHeightOffset + 402, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsCreatureTeamCallback );
SpecifyButtonDownTextColors( iEditorButton[MERCS_CREATURE], FONT_YELLOW, FONT_BLACK );
iEditorButton[MERCS_REBEL] =
iEditorButton[MERCS_REBEL] =
CreateTextButton( L"Rebels",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 20, 2 * iScreenHeightOffset + 422, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsRebelTeamCallback );
SpecifyButtonDownTextColors( iEditorButton[MERCS_REBEL], FONT_YELLOW, FONT_BLACK );
iEditorButton[MERCS_CIVILIAN] =
iEditorButton[MERCS_CIVILIAN] =
CreateTextButton( L"Civilian",(UINT16)BLOCKFONT, 165, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 20, 2 * iScreenHeightOffset + 442, 78, 19, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsCivilianTeamCallback );
SpecifyButtonDownTextColors( iEditorButton[MERCS_CIVILIAN], FONT_YELLOW, FONT_BLACK );
iEditorButton[ MERCS_1 ] =
CreateTextButton( L"DETAILED PLACEMENT", SMALLCOMPFONT, FONT_ORANGE, 60, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 362, 68, 20, BUTTON_TOGGLE,
CreateTextButton( L"DETAILED PLACEMENT", SMALLCOMPFONT, FONT_ORANGE, 60, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 362, 68, 20, BUTTON_TOGGLE,
MSYS_PRIORITY_NORMAL, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK );
DisableButton( iEditorButton[ MERCS_1 ] );
SpecifyDisabledButtonStyle( iEditorButton[ MERCS_1 ], DISABLED_STYLE_NONE );
SpecifyButtonTextOffsets( iEditorButton[ MERCS_1 ], 20, 4, FALSE );
SpecifyButtonTextWrappedWidth( iEditorButton[ MERCS_1 ], 46 );
iEditorButton[ MERCS_DETAILEDCHECKBOX ] =
iEditorButton[ MERCS_DETAILEDCHECKBOX ] =
CreateCheckBoxButton( iScreenWidthOffset + 103, 2 * iScreenHeightOffset + 365, "EDITOR//checkbox.sti", MSYS_PRIORITY_NORMAL, MercsDetailedPlacementCallback );
iEditorButton[ MERCS_GENERAL ] =
iEditorButton[ MERCS_GENERAL ] =
CreateEasyToggleButton( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 382, "EDITOR//MercGeneral.sti", MercsGeneralModeCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_GENERAL ], L"General information mode");
iEditorButton[ MERCS_APPEARANCE ] =
iEditorButton[ MERCS_APPEARANCE ] =
CreateEasyToggleButton( iScreenWidthOffset + 134, 2 * iScreenHeightOffset + 382, "EDITOR//MercAppearance.sti", MercsAppearanceModeCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_APPEARANCE ], L"Physical appearance mode");
iEditorButton[ MERCS_ATTRIBUTES ] =
iEditorButton[ MERCS_ATTRIBUTES ] =
CreateEasyToggleButton( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 408, "EDITOR//MercAttributes.sti", MercsAttributesModeCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_ATTRIBUTES ], L"Attributes mode");
iEditorButton[ MERCS_INVENTORY ] =
iEditorButton[ MERCS_INVENTORY ] =
CreateEasyToggleButton( iScreenWidthOffset + 134, 2 * iScreenHeightOffset + 408, "EDITOR//MercInventory.sti", MercsInventoryModeCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_INVENTORY ], L"Inventory mode");
iEditorButton[ MERCS_PROFILE ] =
iEditorButton[ MERCS_PROFILE ] =
CreateEasyToggleButton( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 434, "EDITOR//MercProfile.sti", MercsProfileModeCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_PROFILE ], L"Profile ID mode");
iEditorButton[ MERCS_SCHEDULE ] =
iEditorButton[ MERCS_SCHEDULE ] =
CreateEasyToggleButton( iScreenWidthOffset + 134, 2 * iScreenHeightOffset + 434, "EDITOR//MercSchedule.sti", MercsScheduleModeCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE ], L"Schedule mode");
//Workaround for identical buttons.
MSYS_SetBtnUserData( iEditorButton[ MERCS_SCHEDULE ], 3, 0xffffffff );
iEditorButton[ MERCS_GLOWSCHEDULE ] =
iEditorButton[ MERCS_GLOWSCHEDULE ] =
CreateEasyToggleButton( iScreenWidthOffset + 134, 2 * iScreenHeightOffset + 434, "EDITOR//MercGlowSchedule.sti", MercsScheduleModeCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_GLOWSCHEDULE ], L"Schedule mode");
HideEditorButton( MERCS_GLOWSCHEDULE );
iEditorButton[ MERCS_DELETE ] =
CreateTextButton( L"DELETE", (UINT16)SMALLCOMPFONT, FONT_DKBLUE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 600, 2 * iScreenHeightOffset + 362, 40, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
CreateTextButton( L"DELETE", (UINT16)SMALLCOMPFONT, FONT_DKBLUE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 600, 2 * iScreenHeightOffset + 362, 40, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsDeleteCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_DELETE ], L"Delete currently selected merc (DEL).");
iEditorButton[ MERCS_NEXT ] =
CreateTextButton( L"NEXT", (UINT16)SMALLCOMPFONT, FONT_DKBLUE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 600, 2 * iScreenHeightOffset + 382, 40, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
CreateTextButton( L"NEXT", (UINT16)SMALLCOMPFONT, FONT_DKBLUE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 600, 2 * iScreenHeightOffset + 382, 40, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsNextCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_NEXT ], L"Find next merc (SPACE).");
//Priority Existance
iEditorButton[ MERCS_PRIORITYEXISTANCE_CHECKBOX ] =
iEditorButton[ MERCS_PRIORITYEXISTANCE_CHECKBOX ] =
CreateCheckBoxButton( iScreenWidthOffset + 170, 2 * iScreenHeightOffset + 365, "EDITOR//checkbox.sti", MSYS_PRIORITY_NORMAL, MercsPriorityExistanceCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_PRIORITYEXISTANCE_CHECKBOX ], L"Toggle priority existance" );
//If merc has keys
iEditorButton[ MERCS_HASKEYS_CHECKBOX ] =
iEditorButton[ MERCS_HASKEYS_CHECKBOX ] =
CreateCheckBoxButton( iScreenWidthOffset + 170, 2 * iScreenHeightOffset + 390, "EDITOR//checkbox.sti", MSYS_PRIORITY_NORMAL, MercsHasKeysCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_HASKEYS_CHECKBOX ], L"Toggle whether or not placement has/naccess to all doors." );
//Orders
iEditorButton[ MERCS_ORDERS_STATIONARY ] =
CreateTextButton( L"STATIONARY", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 368, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
CreateTextButton( L"STATIONARY", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 368, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetOrdersCallback );
iEditorButton[ MERCS_ORDERS_ONGUARD] =
CreateTextButton( L"ON GUARD", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 380, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
iEditorButton[ MERCS_ORDERS_ONGUARD] =
CreateTextButton( L"ON GUARD", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 380, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetOrdersCallback );
iEditorButton[ MERCS_ORDERS_ONCALL ] =
CreateTextButton( L"ON CALL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 392, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
iEditorButton[ MERCS_ORDERS_ONCALL ] =
CreateTextButton( L"ON CALL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 392, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetOrdersCallback );
iEditorButton[ MERCS_ORDERS_SEEKENEMY ] =
CreateTextButton( L"SEEK ENEMY", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 404, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
iEditorButton[ MERCS_ORDERS_SEEKENEMY ] =
CreateTextButton( L"SEEK ENEMY", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 404, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetOrdersCallback );
iEditorButton[ MERCS_ORDERS_CLOSEPATROL ] =
CreateTextButton( L"CLOSE PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 368, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
iEditorButton[ MERCS_ORDERS_CLOSEPATROL ] =
CreateTextButton( L"CLOSE PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 368, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetOrdersCallback );
iEditorButton[ MERCS_ORDERS_FARPATROL ] =
CreateTextButton( L"FAR PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 380, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
iEditorButton[ MERCS_ORDERS_FARPATROL ] =
CreateTextButton( L"FAR PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 380, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetOrdersCallback );
iEditorButton[ MERCS_ORDERS_POINTPATROL ] =
CreateTextButton( L"POINT PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 392, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
iEditorButton[ MERCS_ORDERS_POINTPATROL ] =
CreateTextButton( L"POINT PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 392, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetOrdersCallback );
iEditorButton[ MERCS_ORDERS_RNDPTPATROL ] =
CreateTextButton( L"RND PT PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 404, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
iEditorButton[ MERCS_ORDERS_RNDPTPATROL ] =
CreateTextButton( L"RND PT PATROL", (UINT16)SMALLCOMPFONT, FONT_GRAY2, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 404, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetOrdersCallback );
for ( x = 0; x < 8; x++ )
{
{
MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_ORDERS_BUTTON + x ], 0, x);
}
//Attitudes
iEditorButton[ MERCS_ATTITUDE_DEFENSIVE ] =
CreateTextButton( L"DEFENSIVE", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 424, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
iEditorButton[ MERCS_ATTITUDE_DEFENSIVE ] =
CreateTextButton( L"DEFENSIVE", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 424, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetAttitudeCallback );
iEditorButton[ MERCS_ATTITUDE_BRAVESOLO ] =
CreateTextButton( L"BRAVE SOLO", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 436, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
iEditorButton[ MERCS_ATTITUDE_BRAVESOLO ] =
CreateTextButton( L"BRAVE SOLO", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 436, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetAttitudeCallback );
iEditorButton[ MERCS_ATTITUDE_BRAVEAID ] =
CreateTextButton( L"BRAVE AID", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 448, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
iEditorButton[ MERCS_ATTITUDE_BRAVEAID ] =
CreateTextButton( L"BRAVE AID", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 200, 2 * iScreenHeightOffset + 448, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetAttitudeCallback );
iEditorButton[ MERCS_ATTITUDE_AGGRESSIVE ] =
CreateTextButton( L"AGGRESSIVE", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 424, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
iEditorButton[ MERCS_ATTITUDE_AGGRESSIVE ] =
CreateTextButton( L"AGGRESSIVE", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 424, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetAttitudeCallback );
iEditorButton[ MERCS_ATTITUDE_CUNNINGSOLO ] =
CreateTextButton( L"CUNNING SOLO", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 436, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
iEditorButton[ MERCS_ATTITUDE_CUNNINGSOLO ] =
CreateTextButton( L"CUNNING SOLO", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 436, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetAttitudeCallback );
iEditorButton[ MERCS_ATTITUDE_CUNNINGAID ] =
CreateTextButton( L"CUNNING AID", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 448, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
iEditorButton[ MERCS_ATTITUDE_CUNNINGAID ] =
CreateTextButton( L"CUNNING AID", (UINT16)SMALLCOMPFONT, FONT_GRAY4, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 270, 2 * iScreenHeightOffset + 448, 70, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK,
MercsSetAttitudeCallback );
for ( x = 0; x < 6; x++ )
{
{
MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_ATTITUDE_BUTTON + x ], 0, x);
}
iEditorButton[ MERCS_DIRECTION_W ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 7, BUTTON_USE_DEFAULT,
iEditorButton[ MERCS_DIRECTION_W ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 7, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 360, 2 * iScreenHeightOffset + 365, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback );
iEditorButton[ MERCS_DIRECTION_NW ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 0, BUTTON_USE_DEFAULT,
iEditorButton[ MERCS_DIRECTION_NW ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 0, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 390, 2 * iScreenHeightOffset + 365, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback );
iEditorButton[ MERCS_DIRECTION_N ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 1, BUTTON_USE_DEFAULT,
iEditorButton[ MERCS_DIRECTION_N ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 1, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 420, 2 * iScreenHeightOffset + 365, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback );
iEditorButton[ MERCS_DIRECTION_NE] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 2, BUTTON_USE_DEFAULT,
iEditorButton[ MERCS_DIRECTION_NE] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 2, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 420, 2 * iScreenHeightOffset + 395, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback );
iEditorButton[ MERCS_DIRECTION_E ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 3, BUTTON_USE_DEFAULT,
iEditorButton[ MERCS_DIRECTION_E ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 3, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 420, 2 * iScreenHeightOffset + 425, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback );
iEditorButton[ MERCS_DIRECTION_SE ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 4, BUTTON_USE_DEFAULT,
iEditorButton[ MERCS_DIRECTION_SE ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 4, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 390, 2 * iScreenHeightOffset + 425, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback );
iEditorButton[ MERCS_DIRECTION_S ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 5, BUTTON_USE_DEFAULT,
iEditorButton[ MERCS_DIRECTION_S ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 5, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 360, 2 * iScreenHeightOffset + 425, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback );
iEditorButton[ MERCS_DIRECTION_SW ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 6, BUTTON_USE_DEFAULT,
iEditorButton[ MERCS_DIRECTION_SW ] =
CreateIconButton((INT16)giEditMercDirectionIcons[0], 6, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 360, 2 * iScreenHeightOffset + 395, 30, 30, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsDirectionSetCallback );
for ( x = 0; x < 8; x++ )
{
{
swprintf( TempString, L"Set merc to face %s", FaceDirs[x] );
SetButtonFastHelpText( iEditorButton[ FIRST_MERCS_DIRECTION_BUTTON + x ], TempString );
MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_DIRECTION_BUTTON + x ], 0, x);
}
iEditorButton[ MERCS_DIRECTION_FIND ] =
CreateTextButton( L"Find", (INT16)FONT12POINT1, FONT_MCOLOR_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
iEditorButton[ MERCS_DIRECTION_FIND ] =
CreateTextButton( L"Find", (INT16)FONT12POINT1, FONT_MCOLOR_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 390, 2 * iScreenHeightOffset + 395, 30, 30, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL + 1, DEFAULT_MOVE_CALLBACK, MercsFindSelectedMercCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_DIRECTION_FIND] , L"Find selected merc" );
@@ -287,7 +287,7 @@ void InitEditorMercsToolbar()
iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 445, 40, 15, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsSetRelativeEquipmentCallback );
SpecifyButtonDownTextColors( iEditorButton[ MERCS_EQUIPMENT_GREAT ], FONT_LTBLUE, FONT_BLACK );
for ( x = 0; x < 5; x++ )
{
{
MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_REL_EQUIPMENT_BUTTON + x ], 0, x);
}
@@ -314,37 +314,37 @@ void InitEditorMercsToolbar()
for( x = 0; x < 5; x++ )
MSYS_SetBtnUserData( iEditorButton[ FIRST_MERCS_REL_ATTRIBUTE_BUTTON + x ], 0, x);
iEditorButton[ MERCS_ARMY_CODE ] =
iEditorButton[ MERCS_ARMY_CODE ] =
CreateCheckBoxButton( iScreenWidthOffset + 575, 2 * iScreenHeightOffset + 410, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MercsSetEnemyColorCodeCallback );
MSYS_SetBtnUserData( iEditorButton[ MERCS_ARMY_CODE ], 0, SOLDIER_CLASS_ARMY );
iEditorButton[ MERCS_ADMIN_CODE ] =
iEditorButton[ MERCS_ADMIN_CODE ] =
CreateCheckBoxButton( iScreenWidthOffset + 575, 2 * iScreenHeightOffset + 424, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MercsSetEnemyColorCodeCallback );
MSYS_SetBtnUserData( iEditorButton[ MERCS_ADMIN_CODE ], 0, SOLDIER_CLASS_ADMINISTRATOR );
iEditorButton[ MERCS_ELITE_CODE ] =
iEditorButton[ MERCS_ELITE_CODE ] =
CreateCheckBoxButton( iScreenWidthOffset + 575, 2 * iScreenHeightOffset + 438, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MercsSetEnemyColorCodeCallback );
MSYS_SetBtnUserData( iEditorButton[ MERCS_ELITE_CODE ], 0, SOLDIER_CLASS_ELITE );
iEditorButton[ MERCS_CIVILIAN_GROUP ] =
iEditorButton[ MERCS_CIVILIAN_GROUP ] =
CreateTextButton( gszCivGroupNames[0], (INT16)SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 574, 2 * iScreenHeightOffset + 410, 60, 25, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsCivilianGroupCallback );
iEditorButton[ MERCS_TOGGLECOLOR_BUTTON ] =
iEditorButton[ MERCS_TOGGLECOLOR_BUTTON ] =
CreateCheckBoxButton( iScreenWidthOffset + 180, 2 * iScreenHeightOffset +364, "EDITOR//checkbox.sti", MSYS_PRIORITY_NORMAL, MercsToggleColorModeCallback );
iEditorButton[MERCS_HAIRCOLOR_DOWN] =
iEditorButton[MERCS_HAIRCOLOR_DOWN] =
CreateEasyNoToggleButton( iScreenWidthOffset + 200,2 * iScreenHeightOffset +364,"EDITOR//leftarrow.sti", MercsSetColorsCallback );
iEditorButton[MERCS_HAIRCOLOR_UP] =
iEditorButton[MERCS_HAIRCOLOR_UP] =
CreateEasyNoToggleButton( iScreenWidthOffset + 360,2 * iScreenHeightOffset +364,"EDITOR//rightarrow.sti", MercsSetColorsCallback );
iEditorButton[MERCS_SKINCOLOR_DOWN] =
iEditorButton[MERCS_SKINCOLOR_DOWN] =
CreateEasyNoToggleButton( iScreenWidthOffset + 200,2 * iScreenHeightOffset +388,"EDITOR//leftarrow.sti", MercsSetColorsCallback );
iEditorButton[MERCS_SKINCOLOR_UP] =
iEditorButton[MERCS_SKINCOLOR_UP] =
CreateEasyNoToggleButton( iScreenWidthOffset + 360,2 * iScreenHeightOffset +388,"EDITOR//rightarrow.sti", MercsSetColorsCallback );
iEditorButton[MERCS_VESTCOLOR_DOWN] =
iEditorButton[MERCS_VESTCOLOR_DOWN] =
CreateEasyNoToggleButton( iScreenWidthOffset + 200,2 * iScreenHeightOffset +412,"EDITOR//leftarrow.sti", MercsSetColorsCallback );
iEditorButton[MERCS_VESTCOLOR_UP] =
iEditorButton[MERCS_VESTCOLOR_UP] =
CreateEasyNoToggleButton( iScreenWidthOffset + 360,2 * iScreenHeightOffset +412,"EDITOR//rightarrow.sti", MercsSetColorsCallback );
iEditorButton[MERCS_PANTCOLOR_DOWN] =
iEditorButton[MERCS_PANTCOLOR_DOWN] =
CreateEasyNoToggleButton( iScreenWidthOffset + 200,2 * iScreenHeightOffset +436,"EDITOR//leftarrow.sti", MercsSetColorsCallback );
iEditorButton[MERCS_PANTCOLOR_UP] =
iEditorButton[MERCS_PANTCOLOR_UP] =
CreateEasyNoToggleButton( iScreenWidthOffset + 360,2 * iScreenHeightOffset +436,"EDITOR//rightarrow.sti", MercsSetColorsCallback );
for ( x = FIRST_MERCS_COLOR_BUTTON; x < LAST_MERCS_COLOR_BUTTON; x+=2 )
{
@@ -354,26 +354,26 @@ void InitEditorMercsToolbar()
DisableButton( iEditorButton[ x + 1 ] );
}
iEditorButton[MERCS_BODYTYPE_DOWN] =
iEditorButton[MERCS_BODYTYPE_DOWN] =
CreateEasyNoToggleButton( iScreenWidthOffset + 460, 2 * iScreenHeightOffset +364,"EDITOR//leftarrow.sti", MercsSetBodyTypeCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_BODYTYPE_DOWN ], L"Previous body type");
iEditorButton[MERCS_BODYTYPE_UP] =
iEditorButton[MERCS_BODYTYPE_UP] =
CreateEasyNoToggleButton( iScreenWidthOffset + 560, 2 * iScreenHeightOffset +364,"EDITOR//rightarrow.sti", MercsSetBodyTypeCallback );
SetButtonFastHelpText( iEditorButton[ MERCS_BODYTYPE_UP ], L"Next body type");
iEditorButton[ MERCS_SCHEDULE_VARIANCE1 ] =
iEditorButton[ MERCS_SCHEDULE_VARIANCE1 ] =
CreateCheckBoxButton( iScreenWidthOffset + 309, 2 * iScreenHeightOffset +375, "EDITOR//SmCheckBox.sti", MSYS_PRIORITY_NORMAL, MercsScheduleToggleVariance1Callback );
SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE_VARIANCE1 ], L"Toggle time variance (+ or - 15 minutes)");
iEditorButton[ MERCS_SCHEDULE_VARIANCE2 ] =
iEditorButton[ MERCS_SCHEDULE_VARIANCE2 ] =
CreateCheckBoxButton( iScreenWidthOffset + 309, 2 * iScreenHeightOffset +396, "EDITOR//SmCheckBox.sti", MSYS_PRIORITY_NORMAL, MercsScheduleToggleVariance2Callback );
SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE_VARIANCE2 ], L"Toggle time variance (+ or - 15 minutes)");
iEditorButton[ MERCS_SCHEDULE_VARIANCE3 ] =
iEditorButton[ MERCS_SCHEDULE_VARIANCE3 ] =
CreateCheckBoxButton( iScreenWidthOffset + 309, 2 * iScreenHeightOffset +417, "EDITOR//SmCheckBox.sti", MSYS_PRIORITY_NORMAL, MercsScheduleToggleVariance3Callback );
SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE_VARIANCE3 ], L"Toggle time variance (+ or - 15 minutes)");
iEditorButton[ MERCS_SCHEDULE_VARIANCE4 ] =
iEditorButton[ MERCS_SCHEDULE_VARIANCE4 ] =
CreateCheckBoxButton( iScreenWidthOffset + 309, 2 * iScreenHeightOffset +438, "EDITOR//SmCheckBox.sti", MSYS_PRIORITY_NORMAL, MercsScheduleToggleVariance4Callback );
SetButtonFastHelpText( iEditorButton[ MERCS_SCHEDULE_VARIANCE4 ], L"Toggle time variance (+ or - 15 minutes)");
iEditorButton[ MERCS_SCHEDULE_ACTION1 ] =
CreateTextButton( L"No action", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 186, 2 * iScreenHeightOffset + 373, 77, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleAction1Callback );
@@ -386,7 +386,7 @@ void InitEditorMercsToolbar()
iEditorButton[ MERCS_SCHEDULE_ACTION4 ] =
CreateTextButton( L"No action", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 186, 2 * iScreenHeightOffset + 436, 77, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleAction4Callback );
iEditorButton[ MERCS_SCHEDULE_DATA1A ] =
CreateTextButton( L"", FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 331, 2 * iScreenHeightOffset + 373, 40, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleData1ACallback );
@@ -416,31 +416,31 @@ void InitEditorMercsToolbar()
iScreenWidthOffset + 516, 2 * iScreenHeightOffset + 362, 77, 16, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, MercsScheduleClearCallback );
HideEditorButtons( MERCS_SCHEDULE_DATA1A, MERCS_SCHEDULE_DATA4B );
iEditorButton[ MERCS_HEAD_SLOT ] =
iEditorButton[ MERCS_HEAD_SLOT ] =
CreateCheckBoxButton( MERCPANEL_X+61, MERCPANEL_Y+0, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback );
MSYS_SetBtnUserData( iEditorButton[ MERCS_HEAD_SLOT ], 0, HELMETPOS );
iEditorButton[ MERCS_BODY_SLOT ] =
iEditorButton[ MERCS_BODY_SLOT ] =
CreateCheckBoxButton( MERCPANEL_X+61, MERCPANEL_Y+22, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback );
MSYS_SetBtnUserData( iEditorButton[ MERCS_BODY_SLOT ], 0, VESTPOS );
iEditorButton[ MERCS_LEGS_SLOT ] =
iEditorButton[ MERCS_LEGS_SLOT ] =
CreateCheckBoxButton( MERCPANEL_X+62, MERCPANEL_Y+73, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback );
MSYS_SetBtnUserData( iEditorButton[ MERCS_LEGS_SLOT ], 0, LEGPOS );
iEditorButton[ MERCS_LEFTHAND_SLOT ] =
iEditorButton[ MERCS_LEFTHAND_SLOT ] =
CreateCheckBoxButton( MERCPANEL_X+12, MERCPANEL_Y+43, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback );
MSYS_SetBtnUserData( iEditorButton[ MERCS_LEFTHAND_SLOT ], 0, HANDPOS );
iEditorButton[ MERCS_RIGHTHAND_SLOT ] =
iEditorButton[ MERCS_RIGHTHAND_SLOT ] =
CreateCheckBoxButton( MERCPANEL_X+90, MERCPANEL_Y+42, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback );
MSYS_SetBtnUserData( iEditorButton[ MERCS_RIGHTHAND_SLOT ], 0, SECONDHANDPOS );
iEditorButton[ MERCS_PACK1_SLOT ] =
iEditorButton[ MERCS_PACK1_SLOT ] =
CreateCheckBoxButton( MERCPANEL_X+166, MERCPANEL_Y+6, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback );
MSYS_SetBtnUserData( iEditorButton[ MERCS_PACK1_SLOT ], 0, BIGPOCK1POS );
iEditorButton[ MERCS_PACK2_SLOT ] =
iEditorButton[ MERCS_PACK2_SLOT ] =
CreateCheckBoxButton( MERCPANEL_X+166, MERCPANEL_Y+29, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback );
MSYS_SetBtnUserData( iEditorButton[ MERCS_PACK2_SLOT ], 0, BIGPOCK2POS );
iEditorButton[ MERCS_PACK3_SLOT ] =
iEditorButton[ MERCS_PACK3_SLOT ] =
CreateCheckBoxButton( MERCPANEL_X+166, MERCPANEL_Y+52, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback );
MSYS_SetBtnUserData( iEditorButton[ MERCS_PACK3_SLOT ], 0, BIGPOCK3POS );
iEditorButton[ MERCS_PACK4_SLOT ] =
iEditorButton[ MERCS_PACK4_SLOT ] =
CreateCheckBoxButton( MERCPANEL_X+166, MERCPANEL_Y+75, "EDITOR//smCheckbox.sti", MSYS_PRIORITY_NORMAL+1, MercsInventorySlotCallback );
MSYS_SetBtnUserData( iEditorButton[ MERCS_PACK4_SLOT ], 0, BIGPOCK4POS );
}
@@ -449,103 +449,103 @@ void InitEditorBuildingsToolbar()
{
iEditorButton[BUILDING_TOGGLE_ROOF_VIEW] =
CreateTextButton(L"ROOFS",(UINT16)SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 400, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK,
iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 400, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK,
BuildingToggleRoofViewCallback);
iEditorButton[BUILDING_TOGGLE_WALL_VIEW] =
iEditorButton[BUILDING_TOGGLE_WALL_VIEW] =
CreateTextButton(L"WALLS",(UINT16)SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 415, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK,
iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 415, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK,
BuildingToggleWallViewCallback);
iEditorButton[BUILDING_TOGGLE_INFO_VIEW] =
CreateTextButton(L"ROOM INFO",(UINT16)SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 430, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK,
iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 430, 50, 15, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,BUTTON_NO_CALLBACK,
BuildingToggleInfoViewCallback);
//Selection method buttons
iEditorButton[BUILDING_PLACE_WALLS] =
iEditorButton[BUILDING_PLACE_WALLS] =
CreateEasyToggleButton( iScreenWidthOffset + 180,2 * iScreenHeightOffset + 370,"EDITOR//wall.sti", BuildingWallCallback);
//SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_WALLS],L"Place walls using selection method");
SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_WALLS],
L"Place walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\nPlace walls using selection method\n");
iEditorButton[BUILDING_PLACE_DOORS] =
iEditorButton[BUILDING_PLACE_DOORS] =
CreateEasyToggleButton( iScreenWidthOffset + 210,2 * iScreenHeightOffset + 370,"EDITOR//door.sti", BuildingDoorCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_DOORS],L"Place doors using selection method");
iEditorButton[BUILDING_PLACE_ROOFS] =
iEditorButton[BUILDING_PLACE_ROOFS] =
CreateEasyToggleButton( iScreenWidthOffset + 240,2 * iScreenHeightOffset + 370,"EDITOR//roof.sti", BuildingRoofCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_ROOFS],L"Place roofs using selection method");
iEditorButton[BUILDING_PLACE_WINDOWS] =
iEditorButton[BUILDING_PLACE_WINDOWS] =
CreateEasyToggleButton( iScreenWidthOffset + 180,2 * iScreenHeightOffset + 400,"EDITOR//window.sti", BuildingWindowCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_WINDOWS],L"Place windows using selection method");
iEditorButton[BUILDING_PLACE_BROKEN_WALLS] =
iEditorButton[BUILDING_PLACE_BROKEN_WALLS] =
CreateEasyToggleButton( iScreenWidthOffset + 210, 2 * iScreenHeightOffset + 400,"EDITOR//crackwall.sti", BuildingCrackWallCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_BROKEN_WALLS],L"Place damaged walls using selection method.");
iEditorButton[BUILDING_PLACE_FURNITURE] =
iEditorButton[BUILDING_PLACE_FURNITURE] =
CreateEasyToggleButton( iScreenWidthOffset + 240, 2 * iScreenHeightOffset + 400,"EDITOR//decor.sti", BuildingFurnitureCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_FURNITURE],L"Place furniture using selection method");
iEditorButton[BUILDING_PLACE_DECALS] =
iEditorButton[BUILDING_PLACE_DECALS] =
CreateEasyToggleButton( iScreenWidthOffset + 180, 2 * iScreenHeightOffset + 430,"EDITOR//decal.sti", BuildingDecalCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_DECALS],L"Place wall decals using selection method");
iEditorButton[BUILDING_PLACE_FLOORS] =
iEditorButton[BUILDING_PLACE_FLOORS] =
CreateEasyToggleButton( iScreenWidthOffset + 210, 2 * iScreenHeightOffset + 430,"EDITOR//floor.sti", BuildingFloorCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_FLOORS],L"Place floors using selection method");
iEditorButton[BUILDING_PLACE_TOILETS] =
iEditorButton[BUILDING_PLACE_TOILETS] =
CreateEasyToggleButton( iScreenWidthOffset + 240, 2 * iScreenHeightOffset + 430,"EDITOR//toilet.sti", BuildingToiletCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_PLACE_TOILETS],L"Place generic furniture using selection method");
//Smart method buttons
iEditorButton[BUILDING_SMART_WALLS] =
iEditorButton[BUILDING_SMART_WALLS] =
CreateEasyToggleButton( iScreenWidthOffset + 290, 2 * iScreenHeightOffset + 370,"EDITOR//wall.sti", BuildingSmartWallCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_SMART_WALLS],L"Place walls using smart method");
iEditorButton[BUILDING_SMART_DOORS] =
iEditorButton[BUILDING_SMART_DOORS] =
CreateEasyToggleButton( iScreenWidthOffset + 320, 2 * iScreenHeightOffset + 370,"EDITOR//door.sti", BuildingSmartDoorCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_SMART_DOORS],L"Place doors using smart method");
iEditorButton[BUILDING_SMART_WINDOWS] =
iEditorButton[BUILDING_SMART_WINDOWS] =
CreateEasyToggleButton( iScreenWidthOffset + 290, 2 * iScreenHeightOffset + 400,"EDITOR//window.sti", BuildingSmartWindowCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_SMART_WINDOWS],L"Place windows using smart method");
iEditorButton[BUILDING_SMART_BROKEN_WALLS] =
iEditorButton[BUILDING_SMART_BROKEN_WALLS] =
CreateEasyToggleButton( iScreenWidthOffset + 320, 2 * iScreenHeightOffset + 400,"EDITOR//crackwall.sti", BuildingSmartCrackWallCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_SMART_BROKEN_WALLS],L"Place damaged walls using smart method");
iEditorButton[BUILDING_DOORKEY] =
iEditorButton[BUILDING_DOORKEY] =
CreateEasyToggleButton( iScreenWidthOffset + 290, 2 * iScreenHeightOffset + 430,"EDITOR//key.sti", BuildingDoorKeyCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_DOORKEY], L"Lock or trap existing doors" );
iEditorButton[BUILDING_NEW_ROOM] =
iEditorButton[BUILDING_NEW_ROOM] =
CreateEasyToggleButton( iScreenWidthOffset + 370, 2 * iScreenHeightOffset + 370,"EDITOR//newroom.sti", BuildingNewRoomCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_NEW_ROOM],L"Add a new room");
iEditorButton[BUILDING_CAVE_DRAWING] =
iEditorButton[BUILDING_CAVE_DRAWING] =
CreateEasyToggleButton( iScreenWidthOffset + 370, 2 * iScreenHeightOffset + 370,"EDITOR//caves.sti", BuildingCaveDrawingCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_CAVE_DRAWING],L"Edit cave walls.");
iEditorButton[BUILDING_SAW_ROOM] =
iEditorButton[BUILDING_SAW_ROOM] =
CreateEasyToggleButton( iScreenWidthOffset + 370, 2 * iScreenHeightOffset + 400,"EDITOR//sawroom.sti", BuildingSawRoomCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_SAW_ROOM],L"Remove an area from existing building.");
iEditorButton[BUILDING_KILL_BUILDING] =
iEditorButton[BUILDING_KILL_BUILDING] =
CreateEasyToggleButton( iScreenWidthOffset + 370, 2 * iScreenHeightOffset + 430,"EDITOR//delroom.sti", BuildingKillBuildingCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_KILL_BUILDING],L"Remove a building");
iEditorButton[BUILDING_NEW_ROOF] =
iEditorButton[BUILDING_NEW_ROOF] =
CreateEasyToggleButton( iScreenWidthOffset + 400, 2 * iScreenHeightOffset + 430,"EDITOR//newroof.sti", BuildingNewRoofCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_NEW_ROOF],L"Add/replace building's roof with new flat roof.");
iEditorButton[BUILDING_COPY_BUILDING] =
iEditorButton[BUILDING_COPY_BUILDING] =
CreateEasyToggleButton( iScreenWidthOffset + 430, 2 * iScreenHeightOffset + 430,"EDITOR//copyroom.sti", BuildingCopyBuildingCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_COPY_BUILDING],L"Copy a building");
iEditorButton[BUILDING_MOVE_BUILDING] =
iEditorButton[BUILDING_MOVE_BUILDING] =
CreateEasyToggleButton( iScreenWidthOffset + 460, 2 * iScreenHeightOffset + 430,"EDITOR//moveroom.sti", BuildingMoveBuildingCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_MOVE_BUILDING],L"Move a building");
iEditorButton[BUILDING_DRAW_ROOMNUM] =
iEditorButton[BUILDING_DRAW_ROOMNUM] =
CreateEasyToggleButton( iScreenWidthOffset + 410, 2 * iScreenHeightOffset + 370,"EDITOR//addTileRoom.sti", BuildingDrawRoomNumCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_DRAW_ROOMNUM],L"Draw room number");
iEditorButton[BUILDING_ERASE_ROOMNUM] =
CreateEasyToggleButton( iScreenWidthOffset + 440, 2 * iScreenHeightOffset + 370,"EDITOR//killTileRoom.sti", BuildingEraseRoomNumCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_ERASE_ROOMNUM],L"Erase room numbers");
iEditorButton[BUILDING_TOGGLE_ERASEMODE] =
iEditorButton[BUILDING_TOGGLE_ERASEMODE] =
CreateEasyToggleButton( iScreenWidthOffset + 500, 2 * iScreenHeightOffset + 400,"EDITOR//eraser.sti", BtnEraseCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_TOGGLE_ERASEMODE],L"Toggle erase mode");
iEditorButton[BUILDING_UNDO] =
iEditorButton[BUILDING_UNDO] =
CreateEasyNoToggleButton( iScreenWidthOffset + 530, 2 * iScreenHeightOffset + 400,"EDITOR//undo.sti", BtnUndoCallback);
SetButtonFastHelpText(iEditorButton[BUILDING_UNDO],L"Undo last change");
iEditorButton[BUILDING_CYCLE_BRUSHSIZE] =
iEditorButton[BUILDING_CYCLE_BRUSHSIZE] =
CreateEasyNoToggleButton( iScreenWidthOffset + 500, 2 * iScreenHeightOffset + 430,"EDITOR//paint.sti",BtnBrushCallback);
SetButtonFastHelpText( iEditorButton[ BUILDING_CYCLE_BRUSHSIZE ], L"Cycle brush size");
}
@@ -553,211 +553,215 @@ void InitEditorBuildingsToolbar()
void InitEditorItemsToolbar()
{
SetFontForeground( FONT_MCOLOR_LTRED );
iEditorButton[ITEMS_WEAPONS] =
iEditorButton[ITEMS_WEAPONS] =
CreateTextButton(L"Weapons",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 440, 59, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 440, 59, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsWeaponsCallback);
iEditorButton[ITEMS_AMMO] =
iEditorButton[ITEMS_AMMO] =
CreateTextButton(L"Ammo",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 159, 2 * iScreenHeightOffset + 440, 40, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 159, 2 * iScreenHeightOffset + 440, 40, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsAmmoCallback);
iEditorButton[ITEMS_ARMOUR] =
iEditorButton[ITEMS_ARMOUR] =
CreateTextButton(L"Armour",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 199, 2 * iScreenHeightOffset + 440, 52, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 199, 2 * iScreenHeightOffset + 440, 52, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsArmourCallback);
iEditorButton[ITEMS_EXPLOSIVES] =
CreateTextButton(L"Explosives",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 251, 2 * iScreenHeightOffset + 440, 69, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iEditorButton[ITEMS_LBEGEAR] =
CreateTextButton(L"LBE",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 251, 2 * iScreenHeightOffset + 440, 30, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsLBECallback);
iEditorButton[ITEMS_EXPLOSIVES] =
CreateTextButton(L"Exp",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 281, 2 * iScreenHeightOffset + 440, 39, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsExplosivesCallback);
iEditorButton[ITEMS_EQUIPMENT1] =
iEditorButton[ITEMS_EQUIPMENT1] =
CreateTextButton(L"E1",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 320, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 320, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsEquipment1Callback);
iEditorButton[ITEMS_EQUIPMENT2] =
iEditorButton[ITEMS_EQUIPMENT2] =
CreateTextButton(L"E2",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 341, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 341, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsEquipment2Callback);
iEditorButton[ITEMS_EQUIPMENT3] =
iEditorButton[ITEMS_EQUIPMENT3] =
CreateTextButton(L"E3",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 362, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 362, 2 * iScreenHeightOffset + 440, 21, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsEquipment3Callback);
iEditorButton[ITEMS_TRIGGERS] =
iEditorButton[ITEMS_TRIGGERS] =
CreateTextButton( L"Triggers",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 383, 2 * iScreenHeightOffset + 440, 59, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsTriggersCallback );
iEditorButton[ITEMS_KEYS] =
iEditorButton[ITEMS_KEYS] =
CreateTextButton( L"Keys",(UINT16)BLOCKFONT, FONT_MCOLOR_DKWHITE, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 442, 2 * iScreenHeightOffset + 440, 38, 20, BUTTON_TOGGLE,MSYS_PRIORITY_NORMAL,DEFAULT_MOVE_CALLBACK,
ItemsKeysCallback );
iEditorButton[ITEMS_LEFTSCROLL] =
iEditorButton[ITEMS_LEFTSCROLL] =
CreateEasyNoToggleButton( iScreenWidthOffset + 1, 2 * iScreenHeightOffset + 361,"EDITOR//leftscroll.sti", ItemsLeftScrollCallback);
iEditorButton[ITEMS_RIGHTSCROLL] =
iEditorButton[ITEMS_RIGHTSCROLL] =
CreateEasyNoToggleButton( iScreenWidthOffset + 50, 2 * iScreenHeightOffset + 361,"EDITOR//rightscroll.sti", ItemsRightScrollCallback);
}
void InitEditorMapInfoToolbar()
{
iEditorButton[MAPINFO_ADD_LIGHT1_SOURCE] =
iEditorButton[MAPINFO_ADD_LIGHT1_SOURCE] =
CreateEasyToggleButton( iScreenWidthOffset + 10, SCREEN_HEIGHT - 118, "EDITOR//light.sti", BtnDrawLightsCallback );
SetButtonFastHelpText(iEditorButton[MAPINFO_ADD_LIGHT1_SOURCE],L"Add ambient light source");
iEditorButton[ MAPINFO_LIGHT_PANEL ] =
iEditorButton[ MAPINFO_LIGHT_PANEL ] =
CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, iScreenWidthOffset + 45, SCREEN_HEIGHT - 118, 60, 50, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK );
SpecifyDisabledButtonStyle( iEditorButton[ MAPINFO_LIGHT_PANEL ], DISABLED_STYLE_NONE );
DisableButton( iEditorButton[ MAPINFO_LIGHT_PANEL ] );
iEditorButton[ MAPINFO_PRIMETIME_LIGHT ] =
iEditorButton[ MAPINFO_PRIMETIME_LIGHT ] =
CreateCheckBoxButton( iScreenWidthOffset + 48, SCREEN_HEIGHT - 115, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoPrimeTimeRadioCallback );
iEditorButton[ MAPINFO_NIGHTTIME_LIGHT ] =
iEditorButton[ MAPINFO_NIGHTTIME_LIGHT ] =
CreateCheckBoxButton( iScreenWidthOffset + 48, SCREEN_HEIGHT - 100, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoNightTimeRadioCallback );
iEditorButton[ MAPINFO_24HOUR_LIGHT ] =
iEditorButton[ MAPINFO_24HOUR_LIGHT ] =
CreateCheckBoxButton( iScreenWidthOffset + 48, SCREEN_HEIGHT - 85, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfo24HourTimeRadioCallback );
ClickEditorButton( gbDefaultLightType + MAPINFO_PRIMETIME_LIGHT );
iEditorButton[MAPINFO_TOGGLE_FAKE_LIGHTS] =
iEditorButton[MAPINFO_TOGGLE_FAKE_LIGHTS] =
CreateEasyToggleButton( iScreenWidthOffset + 120, SCREEN_HEIGHT - 118, "EDITOR//fakelight.sti", BtnFakeLightCallback );
SetButtonFastHelpText(iEditorButton[MAPINFO_TOGGLE_FAKE_LIGHTS], L"Toggle fake ambient lights.");
iEditorButton[ MAPINFO_RADIO_PANEL ] =
iEditorButton[ MAPINFO_RADIO_PANEL ] =
CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, iScreenWidthOffset + 207, SCREEN_HEIGHT - 118, 70, 50, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK );
SpecifyDisabledButtonStyle( iEditorButton[ MAPINFO_RADIO_PANEL ], DISABLED_STYLE_NONE );
DisableButton( iEditorButton[ MAPINFO_RADIO_PANEL ] );
iEditorButton[ MAPINFO_RADIO_NORMAL ] =
iEditorButton[ MAPINFO_RADIO_NORMAL ] =
CreateCheckBoxButton( iScreenWidthOffset + 210, SCREEN_HEIGHT - 115, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoNormalRadioCallback );
iEditorButton[ MAPINFO_RADIO_BASEMENT ] =
iEditorButton[ MAPINFO_RADIO_BASEMENT ] =
CreateCheckBoxButton( iScreenWidthOffset + 210, SCREEN_HEIGHT - 100, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoBasementRadioCallback );
iEditorButton[ MAPINFO_RADIO_CAVES ] =
iEditorButton[ MAPINFO_RADIO_CAVES ] =
CreateCheckBoxButton( iScreenWidthOffset + 210, SCREEN_HEIGHT - 85, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, MapInfoCavesRadioCallback );
iEditorButton[MAPINFO_DRAW_EXITGRIDS] =
iEditorButton[MAPINFO_DRAW_EXITGRIDS] =
CreateEasyToggleButton( iScreenWidthOffset + 305, SCREEN_HEIGHT - 108, "EDITOR//exitgridbut.sti", MapInfoDrawExitGridCallback );
SetButtonFastHelpText(iEditorButton[MAPINFO_DRAW_EXITGRIDS],L"Add exit grids (r-clk to query existing).");
iEditorButton[MAPINFO_CYCLE_BRUSHSIZE] =
iEditorButton[MAPINFO_CYCLE_BRUSHSIZE] =
CreateEasyNoToggleButton( iScreenWidthOffset + 420, SCREEN_HEIGHT - 50, "EDITOR//paint.sti", BtnBrushCallback );
SetButtonFastHelpText(iEditorButton[MAPINFO_CYCLE_BRUSHSIZE],L"Cycle brush size");
iEditorButton[MAPINFO_UNDO] =
iEditorButton[MAPINFO_UNDO] =
CreateEasyNoToggleButton( iScreenWidthOffset + 510, SCREEN_HEIGHT - 50, "EDITOR//undo.sti", BtnUndoCallback );
SetButtonFastHelpText(iEditorButton[MAPINFO_UNDO],L"Undo last change");
iEditorButton[MAPINFO_TOGGLE_ERASEMODE] =
iEditorButton[MAPINFO_TOGGLE_ERASEMODE] =
CreateEasyToggleButton( iScreenWidthOffset + 540, SCREEN_HEIGHT - 50, "EDITOR//eraser.sti", BtnEraseCallback);
SetButtonFastHelpText(iEditorButton[MAPINFO_TOGGLE_ERASEMODE],L"Toggle erase mode");
iEditorButton[ MAPINFO_NORTH_POINT ] =
iEditorButton[ MAPINFO_NORTH_POINT ] =
CreateEasyToggleButton( iScreenWidthOffset + 540, SCREEN_HEIGHT - 115, "EDITOR//north.sti", MapInfoEntryPointsCallback);
SetButtonFastHelpText( iEditorButton[ MAPINFO_NORTH_POINT ], L"Specify north point for validation purposes.");
iEditorButton[ MAPINFO_WEST_POINT ] =
iEditorButton[ MAPINFO_WEST_POINT ] =
CreateEasyToggleButton( iScreenWidthOffset + 525, SCREEN_HEIGHT - 94, "EDITOR//west.sti", MapInfoEntryPointsCallback);
SetButtonFastHelpText( iEditorButton[ MAPINFO_WEST_POINT ], L"Specify west point for validation purposes.");
iEditorButton[ MAPINFO_EAST_POINT ] =
iEditorButton[ MAPINFO_EAST_POINT ] =
CreateEasyToggleButton( iScreenWidthOffset + 555, SCREEN_HEIGHT - 94, "EDITOR//east.sti", MapInfoEntryPointsCallback);
SetButtonFastHelpText( iEditorButton[ MAPINFO_EAST_POINT ], L"Specify east point for validation purposes.");
iEditorButton[ MAPINFO_SOUTH_POINT ] =
iEditorButton[ MAPINFO_SOUTH_POINT ] =
CreateEasyToggleButton( iScreenWidthOffset + 540, SCREEN_HEIGHT - 73, "EDITOR//south.sti", MapInfoEntryPointsCallback);
SetButtonFastHelpText( iEditorButton[ MAPINFO_SOUTH_POINT ], L"Specify south point for validation purposes.");
iEditorButton[ MAPINFO_CENTER_POINT ] =
iEditorButton[ MAPINFO_CENTER_POINT ] =
CreateEasyToggleButton( iScreenWidthOffset + 590, SCREEN_HEIGHT - 105, "EDITOR//center.sti", MapInfoEntryPointsCallback);
SetButtonFastHelpText( iEditorButton[ MAPINFO_CENTER_POINT ], L"Specify center point for validation purposes.");
iEditorButton[ MAPINFO_ISOLATED_POINT ] =
iEditorButton[ MAPINFO_ISOLATED_POINT ] =
CreateEasyToggleButton( iScreenWidthOffset + 590, SCREEN_HEIGHT - 84, "EDITOR//isolated.sti", MapInfoEntryPointsCallback);
SetButtonFastHelpText( iEditorButton[ MAPINFO_ISOLATED_POINT ], L"Specify isolated point for validation purposes.");
}
void InitEditorOptionsToolbar()
{
iEditorButton[OPTIONS_NEW_MAP] =
CreateEasyNoToggleButton( iScreenWidthOffset + 71,SCREEN_HEIGHT - 79,"EDITOR//new.sti", BtnNewMapCallback);
iEditorButton[OPTIONS_NEW_MAP] =
CreateEasyNoToggleButton( iScreenWidthOffset + 71,SCREEN_HEIGHT - 79,"EDITOR//new.sti", BtnNewMapCallback);
SetButtonFastHelpText(iEditorButton[OPTIONS_NEW_MAP],L"New map");
iEditorButton[OPTIONS_NEW_BASEMENT] =
CreateEasyNoToggleButton( iScreenWidthOffset + 101,SCREEN_HEIGHT - 79,"EDITOR//new.sti", BtnNewBasementCallback);
iEditorButton[OPTIONS_NEW_BASEMENT] =
CreateEasyNoToggleButton( iScreenWidthOffset + 101,SCREEN_HEIGHT - 79,"EDITOR//new.sti", BtnNewBasementCallback);
SetButtonFastHelpText(iEditorButton[OPTIONS_NEW_BASEMENT],L"New basement");
iEditorButton[OPTIONS_NEW_CAVES] =
iEditorButton[OPTIONS_NEW_CAVES] =
CreateEasyNoToggleButton( iScreenWidthOffset + 131,SCREEN_HEIGHT - 79,"EDITOR//new.sti", BtnNewCavesCallback);
SetButtonFastHelpText(iEditorButton[OPTIONS_NEW_CAVES],L"New cave level");
iEditorButton[OPTIONS_SAVE_MAP] =
CreateEasyNoToggleButton( iScreenWidthOffset + 161,SCREEN_HEIGHT - 79,"EDITOR//save.sti", BtnSaveCallback);
iEditorButton[OPTIONS_SAVE_MAP] =
CreateEasyNoToggleButton( iScreenWidthOffset + 161,SCREEN_HEIGHT - 79,"EDITOR//save.sti", BtnSaveCallback);
SetButtonFastHelpText(iEditorButton[OPTIONS_SAVE_MAP],L"Save map");
iEditorButton[OPTIONS_LOAD_MAP] =
CreateEasyNoToggleButton( iScreenWidthOffset + 191,SCREEN_HEIGHT - 79,"EDITOR//load.sti", BtnLoadCallback);
iEditorButton[OPTIONS_LOAD_MAP] =
CreateEasyNoToggleButton( iScreenWidthOffset + 191,SCREEN_HEIGHT - 79,"EDITOR//load.sti", BtnLoadCallback);
SetButtonFastHelpText(iEditorButton[OPTIONS_LOAD_MAP],L"Load map");
iEditorButton[OPTIONS_CHANGE_TILESET] =
iEditorButton[OPTIONS_CHANGE_TILESET] =
CreateEasyNoToggleButton( iScreenWidthOffset + 221,SCREEN_HEIGHT - 79,"EDITOR//tileset.sti", BtnChangeTilesetCallback);
SetButtonFastHelpText(iEditorButton[OPTIONS_CHANGE_TILESET],L"Select tileset");
iEditorButton[OPTIONS_LEAVE_EDITOR] =
iEditorButton[OPTIONS_LEAVE_EDITOR] =
CreateEasyNoToggleButton( iScreenWidthOffset + 251,SCREEN_HEIGHT - 79,"EDITOR//cancel.sti", BtnCancelCallback);
SetButtonFastHelpText(iEditorButton[OPTIONS_LEAVE_EDITOR],L"Leave Editor mode");
iEditorButton[OPTIONS_QUIT_GAME] =
iEditorButton[OPTIONS_QUIT_GAME] =
CreateEasyNoToggleButton( iScreenWidthOffset + 281,SCREEN_HEIGHT - 79,"EDITOR//cancel.sti", BtnQuitCallback);
SetButtonFastHelpText(iEditorButton[OPTIONS_QUIT_GAME],L"Exit game.");
}
void InitEditorTerrainToolbar()
{
iEditorButton[TERRAIN_FGROUND_TEXTURES] =
iEditorButton[TERRAIN_FGROUND_TEXTURES] =
CreateEasyToggleButton( iScreenWidthOffset + 100,SCREEN_HEIGHT - 80,"EDITOR//downgrid.sti", BtnFgGrndCallback);
SetButtonFastHelpText(iEditorButton[TERRAIN_FGROUND_TEXTURES],L"Draw ground textures");
iEditorButton[TERRAIN_BGROUND_TEXTURES] =
iEditorButton[TERRAIN_BGROUND_TEXTURES] =
CreateEasyToggleButton( iScreenWidthOffset + 130,SCREEN_HEIGHT - 80,"EDITOR//upgrid.sti", BtnBkGrndCallback);
SetButtonFastHelpText(iEditorButton[TERRAIN_BGROUND_TEXTURES],L"Set map ground textures");
iEditorButton[TERRAIN_PLACE_CLIFFS] =
iEditorButton[TERRAIN_PLACE_CLIFFS] =
CreateEasyToggleButton( iScreenWidthOffset + 160,SCREEN_HEIGHT - 80,"EDITOR//banks.sti", BtnBanksCallback);
SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_CLIFFS],L"Place banks and cliffs");
iEditorButton[TERRAIN_PLACE_ROADS] =
iEditorButton[TERRAIN_PLACE_ROADS] =
CreateEasyToggleButton( iScreenWidthOffset + 190,SCREEN_HEIGHT - 80,"EDITOR//road.sti", BtnRoadsCallback);
SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_ROADS],L"Draw roads");
iEditorButton[TERRAIN_PLACE_DEBRIS] =
iEditorButton[TERRAIN_PLACE_DEBRIS] =
CreateEasyToggleButton( iScreenWidthOffset + 220,SCREEN_HEIGHT - 80,"EDITOR//debris.sti", BtnDebrisCallback);
SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_DEBRIS],L"Draw debris");
iEditorButton[TERRAIN_PLACE_TREES] =
iEditorButton[TERRAIN_PLACE_TREES] =
CreateEasyToggleButton( iScreenWidthOffset + 250,SCREEN_HEIGHT - 80,"EDITOR//tree.sti", BtnObjectCallback);
SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_TREES],L"Place trees & bushes");
iEditorButton[TERRAIN_PLACE_ROCKS] =
iEditorButton[TERRAIN_PLACE_ROCKS] =
CreateEasyToggleButton( iScreenWidthOffset + 280,SCREEN_HEIGHT - 80,"EDITOR//num1.sti", BtnObject1Callback);
SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_ROCKS],L"Place rocks");
iEditorButton[TERRAIN_PLACE_MISC] =
iEditorButton[TERRAIN_PLACE_MISC] =
CreateEasyToggleButton( iScreenWidthOffset + 310,SCREEN_HEIGHT - 80,"EDITOR//num2.sti", BtnObject2Callback);
SetButtonFastHelpText(iEditorButton[TERRAIN_PLACE_MISC],L"Place barrels & other junk");
iEditorButton[TERRAIN_FILL_AREA] =
iEditorButton[TERRAIN_FILL_AREA] =
CreateEasyToggleButton( iScreenWidthOffset + 100,SCREEN_HEIGHT - 50,"EDITOR//fill.sti", BtnFillCallback);
SetButtonFastHelpText(iEditorButton[TERRAIN_FILL_AREA],L"Fill area");
iEditorButton[TERRAIN_UNDO] =
iEditorButton[TERRAIN_UNDO] =
CreateEasyNoToggleButton( iScreenWidthOffset + 130,SCREEN_HEIGHT - 50,"EDITOR//undo.sti", BtnUndoCallback);
SetButtonFastHelpText(iEditorButton[TERRAIN_UNDO],L"Undo last change");
iEditorButton[TERRAIN_TOGGLE_ERASEMODE] =
iEditorButton[TERRAIN_TOGGLE_ERASEMODE] =
CreateEasyToggleButton( iScreenWidthOffset + 160,SCREEN_HEIGHT - 50,"EDITOR//eraser.sti", BtnEraseCallback);
SetButtonFastHelpText(iEditorButton[TERRAIN_TOGGLE_ERASEMODE],L"Toggle erase mode");
iEditorButton[TERRAIN_CYCLE_BRUSHSIZE] =
iEditorButton[TERRAIN_CYCLE_BRUSHSIZE] =
CreateEasyNoToggleButton( iScreenWidthOffset + 190,SCREEN_HEIGHT - 50,"EDITOR//paint.sti", BtnBrushCallback);
SetButtonFastHelpText(iEditorButton[TERRAIN_CYCLE_BRUSHSIZE],L"Cycle brush size");
iEditorButton[TERRAIN_RAISE_DENSITY] =
iEditorButton[TERRAIN_RAISE_DENSITY] =
CreateEasyNoToggleButton( iScreenWidthOffset + 280,SCREEN_HEIGHT - 50,"EDITOR//uparrow.sti", BtnIncBrushDensityCallback);
SetButtonFastHelpText(iEditorButton[TERRAIN_RAISE_DENSITY],L"Raise brush density");
iEditorButton[TERRAIN_LOWER_DENSITY] =
iEditorButton[TERRAIN_LOWER_DENSITY] =
CreateEasyNoToggleButton( iScreenWidthOffset + 350,SCREEN_HEIGHT - 50,"EDITOR//downarrow.sti", BtnDecBrushDensityCallback);
SetButtonFastHelpText(iEditorButton[TERRAIN_LOWER_DENSITY],L"Lower brush density");
}
@@ -765,34 +769,34 @@ void InitEditorTerrainToolbar()
void CreateEditorTaskbarInternal()
{
//Create the tabs for the editor taskbar
iEditorButton[ TAB_TERRAIN ] =
iEditorButton[ TAB_TERRAIN ] =
CreateTextButton(L"Terrain", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 100, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK,
iScreenWidthOffset + 100, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK,
TaskTerrainCallback);
SpecifyButtonDownTextColors( iEditorButton[TAB_TERRAIN], FONT_YELLOW, FONT_ORANGE );
iEditorButton[ TAB_BUILDINGS ] =
iEditorButton[ TAB_BUILDINGS ] =
CreateTextButton(L"Buildings", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 190, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK,
iScreenWidthOffset + 190, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK,
TaskBuildingCallback);
SpecifyButtonDownTextColors( iEditorButton[TAB_BUILDINGS], FONT_YELLOW, FONT_ORANGE );
iEditorButton[ TAB_ITEMS ] =
iEditorButton[ TAB_ITEMS ] =
CreateTextButton(L"Items", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 280, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK,
iScreenWidthOffset + 280, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK,
TaskItemsCallback);
SpecifyButtonDownTextColors( iEditorButton[TAB_ITEMS], FONT_YELLOW, FONT_ORANGE );
iEditorButton[ TAB_MERCS ] =
iEditorButton[ TAB_MERCS ] =
CreateTextButton(L"Mercs", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 370, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK,
iScreenWidthOffset + 370, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK,
TaskMercsCallback);
SpecifyButtonDownTextColors( iEditorButton[TAB_MERCS], FONT_YELLOW, FONT_ORANGE );
iEditorButton[ TAB_MAPINFO ] =
iEditorButton[ TAB_MAPINFO ] =
CreateTextButton(L"Map Info", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 460, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK,
iScreenWidthOffset + 460, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK,
TaskMapInfoCallback);
SpecifyButtonDownTextColors( iEditorButton[TAB_MAPINFO], FONT_YELLOW, FONT_ORANGE );
iEditorButton[ TAB_OPTIONS ] =
iEditorButton[ TAB_OPTIONS ] =
CreateTextButton(L"Options", (UINT16)SMALLFONT1, FONT_LTKHAKI, FONT_DKKHAKI, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 550, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK,
iScreenWidthOffset + 550, SCREEN_HEIGHT - 20, 90, 20, BUTTON_TOGGLE,MSYS_PRIORITY_HIGH,BUTTON_NO_CALLBACK,
TaskOptionsCallback);
SpecifyButtonDownTextColors( iEditorButton[TAB_OPTIONS], FONT_YELLOW, FONT_ORANGE );
@@ -807,4 +811,4 @@ void CreateEditorTaskbarInternal()
}
#endif
#endif
+53 -53
View File
@@ -51,7 +51,7 @@ void RenderEditorInfo();
extern ITEM_POOL *gpItemPool;
//editor icon storage vars
//editor icon storage vars
INT32 giEditMercDirectionIcons[2];
UINT32 guiMercInventoryPanel;
UINT32 guiOmertaMap;
@@ -118,7 +118,7 @@ void InitEditorRegions()
INT32 x;
//By doing this, all of the buttons underneath are blanketed and can't be used anymore.
//Any new buttons will cover this up as well. Think of it as a barrier between the editor buttons,
//Any new buttons will cover this up as well. Think of it as a barrier between the editor buttons,
//and the game's interface panel buttons and regions.
MSYS_DefineRegion( &EditorRegion, 0, SCREEN_HEIGHT - 120, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_NORMAL, 0, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK );
@@ -133,19 +133,19 @@ void InitEditorRegions()
gfShowTerrainTileButtons=FALSE;
//Create the region for the items selection window.
MSYS_DefineRegion( &ItemsRegion, iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, iScreenWidthOffset + 540, 2 * iScreenHeightOffset + 440, MSYS_PRIORITY_NORMAL, 0,
MSYS_DefineRegion( &ItemsRegion, iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, iScreenWidthOffset + 540, 2 * iScreenHeightOffset + 440, MSYS_PRIORITY_NORMAL, 0,
(MOUSE_CALLBACK)MouseMovedInItemsRegion, (MOUSE_CALLBACK)MouseClickedInItemsRegion );
MSYS_DisableRegion( &ItemsRegion );
//Create the region for the merc inventory panel.
MSYS_DefineRegion( &MercRegion, iScreenWidthOffset + 175, 2 * iScreenHeightOffset + 361, iScreenWidthOffset + 450, 2 * iScreenHeightOffset + 460, MSYS_PRIORITY_NORMAL, 0,
MSYS_DefineRegion( &MercRegion, iScreenWidthOffset + 175, 2 * iScreenHeightOffset + 361, iScreenWidthOffset + 450, 2 * iScreenHeightOffset + 460, MSYS_PRIORITY_NORMAL, 0,
MouseMovedInMercRegion, MouseClickedInMercRegion );
MSYS_DisableRegion( &MercRegion );
}
void LoadEditorImages()
{
VOBJECT_DESC VObjectDesc;
VOBJECT_DESC VObjectDesc;
//Set up the merc inventory panel
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
@@ -192,8 +192,8 @@ void CreateEditorBuffers()
UINT16 usUselessWidth, usUselessHeight;
UINT8 ubBitDepth;
//create buffer for the transition slot for merc items. This slot contains the newly
//selected item graphic in it's inventory size version. This buffer is then scaled down
//create buffer for the transition slot for merc items. This slot contains the newly
//selected item graphic in it's inventory size version. This buffer is then scaled down
//into the associated merc inventory panel slot buffer which is approximately 20% smaller.
GetCurrentVideoSettings( &usUselessWidth, &usUselessHeight, &ubBitDepth );
vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE;
@@ -289,7 +289,7 @@ void DoTaskbar(void)
}
gfRenderTaskbar = TRUE;
HideEditorToolbar( iCurrentTaskbar );
//Special code when exiting previous editor tab
@@ -350,7 +350,7 @@ void DoTaskbar(void)
break;
case TASK_BUILDINGS:
ClickEditorButton( TAB_BUILDINGS );
if(fBuildingShowRoofs)
if(fBuildingShowRoofs)
ClickEditorButton( BUILDING_TOGGLE_ROOF_VIEW );
if(fBuildingShowWalls)
ClickEditorButton( BUILDING_TOGGLE_WALL_VIEW );
@@ -410,7 +410,7 @@ void DisableEditorTaskbar(void)
void EnableEditorTaskbar(void)
{
INT32 x;
for(x = 0; x < NUMBER_EDITOR_BUTTONS; x++ )
EnableButton( iEditorButton[ x ] );
//Keep permanent buttons disabled.
@@ -425,7 +425,7 @@ void EnableEditorTaskbar(void)
}
//A specialized mprint function that'll restore the editor panel underneath the
//string before rendering the string. This is obviously only useful for drawing text
//string before rendering the string. This is obviously only useful for drawing text
//in the editor taskbar.
void mprintfEditor(INT16 x, INT16 y, STR16 pFontString, ...)
{
@@ -435,7 +435,7 @@ void mprintfEditor(INT16 x, INT16 y, STR16 pFontString, ...)
Assert( pFontString != NULL );
va_start( argptr, pFontString ); // Set up variable argument pointer
va_start( argptr, pFontString ); // Set up variable argument pointer
vswprintf( string, pFontString, argptr); // process gprintf string (get output str)
va_end( argptr );
@@ -471,7 +471,7 @@ void ClearTaskbarRegion( INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom )
//Kris:
//This is a new function which duplicates the older "yellow info boxes" that
//are common throughout the editor. This draws the yellow box with the indentation
//are common throughout the editor. This draws the yellow box with the indentation
//look.
void DrawEditorInfoBox( STR16 str, UINT32 uiFont, UINT16 x, UINT16 y, UINT16 w, UINT16 h )
{
@@ -621,7 +621,7 @@ void RenderMapEntryPointsAndLights()
if( sGridNo != -1 )
{
GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY );
if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
{
DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"North Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED );
}
@@ -630,7 +630,7 @@ void RenderMapEntryPointsAndLights()
if( sGridNo != -1 )
{
GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY );
if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
{
DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"West Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED );
}
@@ -639,7 +639,7 @@ void RenderMapEntryPointsAndLights()
if( sGridNo != -1 )
{
GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY );
if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
{
DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"East Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED );
}
@@ -648,7 +648,7 @@ void RenderMapEntryPointsAndLights()
if( sGridNo != -1 )
{
GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY );
if( sScreenY >= ( - 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
if( sScreenY >= ( - 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
{
DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"South Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED );
}
@@ -657,7 +657,7 @@ void RenderMapEntryPointsAndLights()
if( sGridNo != -1 )
{
GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY );
if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
{
DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"Center Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED );
}
@@ -666,7 +666,7 @@ void RenderMapEntryPointsAndLights()
if( sGridNo != -1 )
{
GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY );
if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
if( sScreenY >= (- 20) && sScreenY < (2 * iScreenHeightOffset + 340) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
{
DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 40, 2, FONT10ARIAL, FONT_YELLOW, L"Isolated Entry Point", FONT_BLACK, TRUE, CENTER_JUSTIFIED );
}
@@ -677,7 +677,7 @@ void RenderMapEntryPointsAndLights()
{
if( LightSprites[ i ].uiFlags & LIGHT_SPR_ACTIVE )
{
// Check for light out of bounds. This actually happens in Drassen.
// Check for light out of bounds. This actually happens in Drassen.
if (LightSprites[ i ].iY < 0 || LightSprites[ i ].iY > WORLD_ROWS ||
LightSprites[ i ].iX < 0 || LightSprites[ i ].iX > WORLD_COLS)
{
@@ -687,7 +687,7 @@ void RenderMapEntryPointsAndLights()
sGridNo = LightSprites[ i ].iY * WORLD_COLS + LightSprites[ i ].iX;
GetGridNoScreenPos( sGridNo, 0, &sScreenX, &sScreenY );
if( sScreenY >= (- 50) && sScreenY < (2 * iScreenHeightOffset + 300) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
if( sScreenY >= (- 50) && sScreenY < (2 * iScreenHeightOffset + 300) && sScreenX >= (- 40) && sScreenX < SCREEN_WIDTH )
{
if( LightSprites[ i ].uiFlags & LIGHT_PRIMETIME )
DisplayWrappedString( sScreenX, (INT16)(sScreenY-5), 50, 2, FONT10ARIAL, FONT_ORANGE, L"Prime", FONT_BLACK, TRUE, CENTER_JUSTIFIED );
@@ -704,27 +704,27 @@ void BuildTriggerName( OBJECTTYPE *pItem, STR16 szItemName )
{
if( pItem->usItem == SWITCH )
{
if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY )
if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY )
swprintf( szItemName, L"Panic Trigger1" );
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_2 )
else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY_2 )
swprintf( szItemName, L"Panic Trigger2" );
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_3 )
else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY_3 )
swprintf( szItemName, L"Panic Trigger3" );
else
swprintf( szItemName, L"Trigger%d", pItem->ItemData.Trigger.BombTrigger.bFrequency - 50 );
swprintf( szItemName, L"Trigger%d", (*pItem)[0]->data.misc.bFrequency - 50 );
}
else
{ //action item
if( pItem->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE )
if( (*pItem)[0]->data.misc.bDetonatorType == BOMB_PRESSURE )
swprintf( szItemName, L"Pressure Action" );
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY )
else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY )
swprintf( szItemName, L"Panic Action1" );
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_2 )
else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY_2 )
swprintf( szItemName, L"Panic Action2" );
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_3 )
else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY_3 )
swprintf( szItemName, L"Panic Action3" );
else
swprintf( szItemName, L"Action%d", pItem->ItemData.Trigger.BombTrigger.bFrequency - 50 );
swprintf( szItemName, L"Action%d", (*pItem)[0]->data.misc.bFrequency - 50 );
}
}
@@ -797,11 +797,11 @@ void RenderSelectedItemBlownUp()
//Display the enlarged item graphic
uiVideoObjectIndex = GetInterfaceGraphicForItem( &Item[ gpItem->usItem ] );
GetVideoObject( &hVObject, uiVideoObjectIndex );
sWidth = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].usWidth;
sOffsetX = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].sOffsetX;
xp = sScreenX + (40 - sWidth - sOffsetX*2) / 2;
sHeight = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].usHeight;
sOffsetY = hVObject->pETRLEObject[ Item[ gpItem->usItem ].ubGraphicNum ].sOffsetY;
yp = sScreenY + (20 - sHeight - sOffsetY*2) / 2;
@@ -818,7 +818,7 @@ void RenderSelectedItemBlownUp()
}
else if( Item[ gpItem->usItem ].usItemClass == IC_KEY )
{
swprintf( szItemName, L"%S", LockTable[ gpItem->ItemData.Key.ubKeyID ].ubEditorName );
swprintf( szItemName, L"%S", LockTable[ (*gpItem)[0]->data.key.ubKeyID ].ubEditorName );
}
else
{
@@ -842,7 +842,7 @@ void RenderSelectedItemBlownUp()
//Count the number of items in the current pool, and display that.
i = 0;
GetItemPool( gsItemGridNo, &pItemPool, 0 );
GetItemPoolFromGround( gsItemGridNo, &pItemPool );
Assert( pItemPool );
while( pItemPool )
{
@@ -852,9 +852,9 @@ void RenderSelectedItemBlownUp()
xp = sScreenX;
yp = sScreenY + 10;
mprintf( xp, yp, L"%d", i );
//If the item is hidden, render a blinking H (just like DG)
if( gWorldItems[ gpItemPool->iItemIndex ].bVisible == HIDDEN_ITEM ||
if( gWorldItems[ gpItemPool->iItemIndex ].bVisible == HIDDEN_ITEM ||
gWorldItems[ gpItemPool->iItemIndex ].bVisible == BURIED )
{
SetFont( FONT10ARIALBOLD );
@@ -871,17 +871,17 @@ void RenderEditorInfo( )
{
CHAR16 FPSText[ 50 ];
static INT32 iSpewWarning = 0;
UINT16 uiMapIndex;
INT16 iMapIndex;
SetFont( FONT12POINT1 );
SetFontForeground( FONT_BLACK );
SetFontBackground( FONT_BLACK );
//Display the mapindex position
if( GetMouseMapPos( &uiMapIndex ) )
swprintf( FPSText, L" (%d) ", uiMapIndex );
if( GetMouseMapPos( &iMapIndex ) )
swprintf( FPSText, L" (%d) ", iMapIndex );
else
swprintf( FPSText, L" " );
swprintf( FPSText, L" " );
mprintfEditor( (UINT16)(iScreenWidthOffset + 50-StringPixLength( FPSText, FONT12POINT1 )/2), 2 * iScreenHeightOffset + 463, FPSText );
switch( iCurrentTaskbar )
@@ -890,7 +890,7 @@ void RenderEditorInfo( )
if( !gfWorldLoaded || giCurrentTilesetID < 0 )
mprintf( iScreenWidthOffset + 260, 2 * iScreenHeightOffset + 445, L"No map currently loaded." );
else
mprintf( iScreenWidthOffset + 260, 2 * iScreenHeightOffset + 445, L"File: %S, Current Tileset: %s",
mprintf( iScreenWidthOffset + 260, 2 * iScreenHeightOffset + 445, L"File: %S, Current Tileset: %s",
gubFilename, gTilesets[ giCurrentTilesetID ].zName );
break;
case TASK_TERRAIN:
@@ -898,7 +898,7 @@ void RenderEditorInfo( )
// WANNE: Comment this two lines, because we always get an exception here.
//if( gusSelectionType == LINESELECTION )
// swprintf( wszSelType[LINESELECTION], L"Width: %d", gusSelectionWidth );
DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, iScreenWidthOffset + 220, 2 * iScreenHeightOffset + 430, 60, 30 );
swprintf( FPSText, L"%d%%", gusSelectionDensity );
DrawEditorInfoBox( FPSText, FONT12POINT1, iScreenWidthOffset + 310, 2 * iScreenHeightOffset + 430, 40, 30 );
@@ -914,7 +914,7 @@ void RenderEditorInfo( )
// WANNE: Comment this two lines, because we always get an exception here.
//if( gusSelectionType == LINESELECTION )
// swprintf( wszSelType[LINESELECTION], L"%d", gusSelectionWidth );
DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, iScreenWidthOffset + 530, 2 * iScreenHeightOffset + 430, 60, 30 );
break;
case TASK_MERCS:
@@ -925,14 +925,14 @@ void RenderEditorInfo( )
// WANNE: EDITOR: Comment this two lines, because we always get an exception here!
//if( gusSelectionType == LINESELECTION )
// swprintf( wszSelType[LINESELECTION], L"Width: %d", gusSelectionWidth );
DrawEditorInfoBox( wszSelType[gusSelectionType], FONT12POINT1, iScreenWidthOffset + 440, 2 * iScreenHeightOffset + 430, 60, 30 );
break;
}
}
//This is in ButtonSystem.c as a hack. Because we need to save the buffer whenever we do a full
//taskbar render, we need to draw the buttons without hilites, hence this flag. This flag is
//This is in ButtonSystem.c as a hack. Because we need to save the buffer whenever we do a full
//taskbar render, we need to draw the buttons without hilites, hence this flag. This flag is
//always true in ButtonSystem.c, so it won't effect anything else.
extern BOOLEAN gfGotoGridNoUI;
@@ -952,13 +952,13 @@ void ProcessEditorRendering()
}
if( gfRenderDrawingMode )
{
if( iCurrentTaskbar == TASK_BUILDINGS || iCurrentTaskbar == TASK_TERRAIN || iCurrentTaskbar == TASK_ITEMS )
if( iCurrentTaskbar == TASK_BUILDINGS || iCurrentTaskbar == TASK_TERRAIN || iCurrentTaskbar == TASK_ITEMS )
{
ShowCurrentDrawingMode();
gfRenderDrawingMode = FALSE;
}
}
//render dynamically changed buttons only
//render dynamically changed buttons only
RenderButtons( );
if( gfSummaryWindowActive )
@@ -979,8 +979,8 @@ void ProcessEditorRendering()
RenderSelectedItemBlownUp();
if( iCurrentTaskbar == TASK_MAPINFO )
RenderMapEntryPointsAndLights();
if( iDrawMode == DRAW_MODE_PLACE_ITEM && eInfo.uiItemType == TBAR_MODE_ITEM_KEYS ||
iDrawMode == DRAW_MODE_DOORKEYS )
if( iDrawMode == DRAW_MODE_PLACE_ITEM && eInfo.uiItemType == TBAR_MODE_ITEM_KEYS ||
iDrawMode == DRAW_MODE_DOORKEYS )
RenderDoorLockInfo();
}
@@ -990,8 +990,8 @@ void ProcessEditorRendering()
BlitBufferToBuffer( FRAME_BUFFER, guiSAVEBUFFER, 0, 2 * iScreenHeightOffset + 360, SCREEN_WIDTH, 120 );
//Make sure this is TRUE at all times.
//It is set to false when before we save the buffer, so the buttons don't get
//rendered with hilites, in case the mouse is over one.
//It is set to false when before we save the buffer, so the buttons don't get
//rendered with hilites, in case the mouse is over one.
gfRenderHilights = TRUE;
RenderButtonsFastHelp();
@@ -999,4 +999,4 @@ void ProcessEditorRendering()
}
#endif
#endif
+2 -2
View File
@@ -4,7 +4,7 @@
#ifndef __EDITOR_TASKBAR_UTILS_H
#define __EDITOR_TASKBAR_UTILS_H
//These are utilities that are used within the editor. This function absorbs the expensive
//These are utilities that are used within the editor. This function absorbs the expensive
//compile time of the SGP dependencies, while allowing the other editor files to hook into it
//without paying, so to speak.
@@ -64,7 +64,7 @@ extern UINT32 guiExclamation;
extern UINT32 guiKeyImage;
extern UINT32 guiMercInvPanelBuffers[9];
extern UINT32 guiMercTempBuffer;
extern INT32 giEditMercImage[2];
extern INT32 giEditMercImage[2];
#endif
#endif
+81 -81
View File
@@ -16,7 +16,7 @@
#include "editscreen.h"
#include "Editor Undo.h"
#include "Render Fun.h" //for access to gubWorldRoomInfo;
#include "Render Fun.h" //for access to gubWorldRoomInfo;
#include "Cursor Modes.h"
#include "Exit Grids.h"
#endif
@@ -24,35 +24,35 @@
/*
Kris -- Notes on how the undo code works:
At the bottom of the hierarchy, we need to determine the state of the undo command. The idea
is that we want to separate undo commands by separating them by new mouse clicks. By holding a mouse
down and painting various objects in the world would all constitute a single undo command. As soon as
the mouse is release, then a new undo command is setup. So, to automate this, there is a call every
At the bottom of the hierarchy, we need to determine the state of the undo command. The idea
is that we want to separate undo commands by separating them by new mouse clicks. By holding a mouse
down and painting various objects in the world would all constitute a single undo command. As soon as
the mouse is release, then a new undo command is setup. So, to automate this, there is a call every
frame to DetermineUndoState().
At the next level, there is a binary tree that keeps track of what map indices have been backup up in
the current undo command. The whole reason to maintain this list, is to avoid multiple map elements of
the same map index from being saved. In the outer code, everytime something is changed, a call to
At the next level, there is a binary tree that keeps track of what map indices have been backup up in
the current undo command. The whole reason to maintain this list, is to avoid multiple map elements of
the same map index from being saved. In the outer code, everytime something is changed, a call to
AddToUndoList() is called, so there are many cases (especially with building/terrain smoothing) that the
same mapindex is added to the undo list. This is also completely transparent, and doesn't need to be
same mapindex is added to the undo list. This is also completely transparent, and doesn't need to be
maintained.
In the outer code, there are several calls to AddToUndoList( iMapIndex ). This function basically looks
In the outer code, there are several calls to AddToUndoList( iMapIndex ). This function basically looks
in the binary tree for an existing entry, and if there isn't, then the entire mapelement is saved (with
the exception of the merc level ). Lights are also supported, but there is a totally different methodology
for accomplishing this. The equivalent function is AddLightToUndoList( iMapIndex ). In this case, only the
the exception of the merc level ). Lights are also supported, but there is a totally different methodology
for accomplishing this. The equivalent function is AddLightToUndoList( iMapIndex ). In this case, only the
light is saved, along with internal maintanance of several flags.
The actual mapelement copy code, is very complex. The mapelement is copied in parallel with a new one which
The actual mapelement copy code, is very complex. The mapelement is copied in parallel with a new one which
has to allocate several nodes of several types because a mapelement contains over a dozen separate lists, and
all of them need to be saved. The structure information of certain mapelements may be multitiled and must
also save the affected gridno's as well. This is also done internally. Basically, your call to
all of them need to be saved. The structure information of certain mapelements may be multitiled and must
also save the affected gridno's as well. This is also done internally. Basically, your call to
AddToUndoList() for any particular gridno, may actually save several entries (like for a car which could be 6+
tiles)
MERCS
Mercs are not supported in the undo code. Because they are so dynamic, and stats could change, they could
move, etc., it doesn't need to be in the undo code. The editor has its own way of dealing with mercs which
Mercs are not supported in the undo code. Because they are so dynamic, and stats could change, they could
move, etc., it doesn't need to be in the undo code. The editor has its own way of dealing with mercs which
doesn't use the undo methodology.
*/
@@ -71,13 +71,13 @@ void DisableUndo()
}
// undo node data element
typedef struct
typedef struct
{
INT32 iMapIndex;
MAP_ELEMENT *pMapTile;
BOOLEAN fLightSaved; //determines that a light has been saved
BOOLEAN fLightSaved; //determines that a light has been saved
UINT8 ubLightRadius; //the radius of the light to build if undo is called
UINT8 ubLightID; //only applies if a light was saved.
UINT8 ubLightID; //only applies if a light was saved.
UINT8 ubRoomNum;
} undo_struct;
@@ -108,27 +108,27 @@ BOOLEAN fNewUndoCmd = TRUE;
BOOLEAN gfIgnoreUndoCmdsForLights = FALSE;
//New pre-undo binary tree stuff
//With this, new undo commands will not duplicate saves in the same command. This will
//With this, new undo commands will not duplicate saves in the same command. This will
//increase speed, and save memory.
typedef struct MapIndexBinaryTree
{
struct MapIndexBinaryTree *left, *right;
UINT16 usMapIndex;
INT16 sMapIndex;
}MapIndexBinaryTree;
MapIndexBinaryTree *top = NULL;
void ClearUndoMapIndexTree();
BOOLEAN AddMapIndexToTree( UINT16 usMapIndex );
void CheckMapIndexForMultiTileStructures( UINT16 usMapIndex );
BOOLEAN AddMapIndexToTree( INT16 sMapIndex );
void CheckMapIndexForMultiTileStructures( INT16 sMapIndex );
void CheckForMultiTilesInTreeAndAddToUndoList( MapIndexBinaryTree *node );
//Recursively deletes all nodes below the node passed including itself.
void DeleteTreeNode( MapIndexBinaryTree **node )
{
if( (*node)->left )
if( (*node)->left )
DeleteTreeNode( &((*node)->left) );
if( (*node)->right )
if( (*node)->right )
DeleteTreeNode( &((*node)->right) );
MemFree( *node );
*node = NULL;
@@ -141,14 +141,14 @@ void ClearUndoMapIndexTree()
DeleteTreeNode( &top );
}
BOOLEAN AddMapIndexToTree( UINT16 usMapIndex )
BOOLEAN AddMapIndexToTree( INT16 sMapIndex )
{
MapIndexBinaryTree *curr, *parent;
if( !top )
{
top = (MapIndexBinaryTree*)MemAlloc( sizeof( MapIndexBinaryTree ) );
Assert( top );
top->usMapIndex = usMapIndex;
top->sMapIndex = sMapIndex;
top->left = NULL;
top->right = NULL;
return TRUE;
@@ -161,26 +161,26 @@ BOOLEAN AddMapIndexToTree( UINT16 usMapIndex )
while( curr )
{
parent = curr;
if( curr->usMapIndex == usMapIndex ) //found a match, so stop
if( curr->sMapIndex == sMapIndex ) //found a match, so stop
return FALSE;
//if the mapIndex is < node's mapIndex, then go left, else right
curr = ( usMapIndex < curr->usMapIndex ) ? curr->left : curr->right;
curr = ( sMapIndex < curr->sMapIndex ) ? curr->left : curr->right;
}
//if we made it this far, then curr is null and parent is pointing
//directly above.
//Create the new node and fill in the information.
curr = (MapIndexBinaryTree*)MemAlloc( sizeof( MapIndexBinaryTree ) );
Assert( curr );
curr->usMapIndex = usMapIndex;
curr->sMapIndex = sMapIndex;
curr->left = NULL;
curr->right = NULL;
//Now link the new node to the parent.
if( curr->usMapIndex < parent->usMapIndex )
if( curr->sMapIndex < parent->sMapIndex )
parent->left = curr;
else
parent->right = curr;
return TRUE;
}
}
//*************************************************************************
//
// Start of Undo code
@@ -236,7 +236,7 @@ BOOLEAN DeleteStackNodeContents( undo_stack *pCurrent )
pData = pCurrent->pData;
pMapTile = pData->pMapTile;
if( !pMapTile )
if( !pMapTile )
return TRUE; //light was saved -- mapelement wasn't saved.
// Free the memory associated with the map tile liked lists
@@ -309,14 +309,14 @@ BOOLEAN DeleteStackNodeContents( undo_stack *pCurrent )
{
pMapTile->pStructureHead = pStructureNode->pNext;
if( pStructureNode->usStructureID > INVALID_STRUCTURE_ID )
{ //Okay to delete the structure data -- otherwise, this would be
{ //Okay to delete the structure data -- otherwise, this would be
//merc structure data that we DON'T want to delete, because the merc node
//that hasn't been modified will still use this structure data!
MemFree( pStructureNode );
}
pStructureNode = pMapTile->pStructureHead;
}
// Free the map tile structure itself
MemFree( pMapTile );
@@ -356,23 +356,23 @@ void CropStackToMaxLength( INT32 iMaxCmds )
}
//We are adding a light to the undo list. We won't save the mapelement, nor will
//we validate the gridno in the binary tree. This works differently than a mapelement,
//because lights work on a different system. By setting the fLightSaved flag to TRUE,
//this will handle the way the undo command is handled. If there is no lightradius in
//We are adding a light to the undo list. We won't save the mapelement, nor will
//we validate the gridno in the binary tree. This works differently than a mapelement,
//because lights work on a different system. By setting the fLightSaved flag to TRUE,
//this will handle the way the undo command is handled. If there is no lightradius in
//our saved light, then we intend on erasing the light upon undo execution, otherwise, we
//save the light radius and light ID, so that we place it during undo execution.
void AddLightToUndoList( INT32 iMapIndex, INT32 iLightRadius, UINT8 ubLightID )
{
undo_stack *pNode;
undo_struct *pUndoInfo;
if( !gfUndoEnabled )
return;
//When executing an undo command (by adding a light or removing one), that command
//actually tries to add it to the undo list. So we wrap the execution of the undo
//actually tries to add it to the undo list. So we wrap the execution of the undo
//command by temporarily setting this flag, so it'll ignore, and not place a new undo
//command. When finished, the flag is cleared, and lights are again allowed to be saved
//command. When finished, the flag is cleared, and lights are again allowed to be saved
//in the undo list.
if( gfIgnoreUndoCmdsForLights )
return;
@@ -389,7 +389,7 @@ void AddLightToUndoList( INT32 iMapIndex, INT32 iLightRadius, UINT8 ubLightID )
}
pUndoInfo->fLightSaved = TRUE;
//if ubLightRadius is 0, then we don't need to save the light information because we
//if ubLightRadius is 0, then we don't need to save the light information because we
//will erase it when it comes time to execute the undo command.
pUndoInfo->ubLightRadius = (UINT8)iLightRadius;
pUndoInfo->ubLightID = ubLightID;
@@ -420,7 +420,7 @@ BOOLEAN AddToUndoList( INT32 iMapIndex )
//Check to see if the tile in question is even on the visible map, then
//if that is true, then check to make sure we don't already have the mapindex
//saved in the new binary tree (which only holds unique mapindex values).
if( GridNoOnVisibleWorldTile( (INT16)iMapIndex ) && AddMapIndexToTree( (UINT16)iMapIndex ) )
if( GridNoOnVisibleWorldTile( (INT16)iMapIndex ) && AddMapIndexToTree( (INT16)iMapIndex ) )
{
if( AddToUndoListCmd( iMapIndex, ++iCount ) )
@@ -439,7 +439,7 @@ BOOLEAN AddToUndoListCmd( INT32 iMapIndex, INT32 iCmdCount )
STRUCTURE *pStructure;
INT32 iCoveredMapIndex;
UINT8 ubLoop;
if ( (pNode = (undo_stack *)MemAlloc(sizeof( undo_stack )) ) == NULL )
{
return( FALSE );
@@ -482,7 +482,7 @@ BOOLEAN AddToUndoListCmd( INT32 iMapIndex, INT32 iCmdCount )
// copy the room number information (it's not in the mapelement structure)
pUndoInfo->ubRoomNum = gubWorldRoomInfo[ iMapIndex ];
pUndoInfo->fLightSaved = FALSE;
pUndoInfo->ubLightRadius = 0;
pUndoInfo->ubLightID = 0;
@@ -496,10 +496,10 @@ BOOLEAN AddToUndoListCmd( INT32 iMapIndex, INT32 iCmdCount )
// loop through pData->pStructureHead list
// for each structure
// find the base tile
// reference the db structure
// if number of tiles > 1
// add all covered tiles to undo list
// find the base tile
// reference the db structure
// if number of tiles > 1
// add all covered tiles to undo list
pStructure = pData->pStructureHead;
while (pStructure)
{
@@ -519,13 +519,13 @@ BOOLEAN AddToUndoListCmd( INT32 iMapIndex, INT32 iCmdCount )
}
void CheckMapIndexForMultiTileStructures( UINT16 usMapIndex )
void CheckMapIndexForMultiTileStructures( INT16 sMapIndex )
{
STRUCTURE * pStructure;
UINT8 ubLoop;
INT32 iCoveredMapIndex;
pStructure = gpWorldLevelData[usMapIndex].pStructureHead;
pStructure = gpWorldLevelData[sMapIndex].pStructureHead;
while (pStructure)
{
if (pStructure->pDBStructureRef->pDBStructure->ubNumberOfTiles > 1)
@@ -535,7 +535,7 @@ void CheckMapIndexForMultiTileStructures( UINT16 usMapIndex )
// for multi-tile structures we have to add, to the undo list, all the other tiles covered by the structure
if (pStructure->fFlags & STRUCTURE_BASE_TILE)
{
iCoveredMapIndex = usMapIndex + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase;
iCoveredMapIndex = sMapIndex + pStructure->pDBStructureRef->ppTile[ubLoop]->sPosRelToBase;
}
else
{
@@ -550,10 +550,10 @@ void CheckMapIndexForMultiTileStructures( UINT16 usMapIndex )
void CheckForMultiTilesInTreeAndAddToUndoList( MapIndexBinaryTree *node )
{
CheckMapIndexForMultiTileStructures( node->usMapIndex );
if( node->left )
CheckMapIndexForMultiTileStructures( node->sMapIndex );
if( node->left )
CheckForMultiTilesInTreeAndAddToUndoList( node->left );
if( node->right )
if( node->right )
CheckForMultiTilesInTreeAndAddToUndoList( node->right );
}
@@ -590,14 +590,14 @@ BOOLEAN ExecuteUndoList( void )
{
iUndoMapIndex = gpTileUndoStack->pData->iMapIndex;
fExitGrid = ExitGridAtGridNo( (UINT16)iUndoMapIndex );
fExitGrid = ExitGridAtGridNo( (INT16)iUndoMapIndex );
// Find which map tile we are to "undo"
if( gpTileUndoStack->pData->fLightSaved )
{ //We saved a light, so delete that light
INT16 sX, sY;
//Turn on this flag so that the following code, when executed, doesn't attempt to
//add lights to the undo list. That would cause problems...
//add lights to the undo list. That would cause problems...
gfIgnoreUndoCmdsForLights = TRUE;
ConvertGridNoToXY( (INT16)iUndoMapIndex, &sX, &sY );
if( !gpTileUndoStack->pData->ubLightRadius )
@@ -612,7 +612,7 @@ BOOLEAN ExecuteUndoList( void )
// of the undo's MAP_ELEMENT with the world's element.
SwapMapElementWithWorld( iUndoMapIndex, gpTileUndoStack->pData->pMapTile );
// copy the room number information back
// copy the room number information back
gubWorldRoomInfo[ iUndoMapIndex ] = gpTileUndoStack->pData->ubRoomNum;
// Now we smooth out the changes...
@@ -627,16 +627,16 @@ BOOLEAN ExecuteUndoList( void )
iCurCount++;
//Kris:
//The new cursor system is somehow interfering with the undo stuff. When
//an undo is called, the item is erased, but a cursor is added! I'm quickly
//The new cursor system is somehow interfering with the undo stuff. When
//an undo is called, the item is erased, but a cursor is added! I'm quickly
//hacking around this by erasing all cursors here.
RemoveAllTopmostsOfTypeRange( iUndoMapIndex, FIRSTPOINTERS, FIRSTPOINTERS );
if( fExitGrid && !ExitGridAtGridNo( (UINT16)iUndoMapIndex ) )
if( fExitGrid && !ExitGridAtGridNo( (INT16)iUndoMapIndex ) )
{ //An exitgrid has been removed, so get rid of the associated indicator.
RemoveTopmost( (UINT16)iUndoMapIndex, FIRSTPOINTERS8 );
}
else if( !fExitGrid && ExitGridAtGridNo( (UINT16)iUndoMapIndex ) )
else if( !fExitGrid && ExitGridAtGridNo( (INT16)iUndoMapIndex ) )
{ //An exitgrid has been added, so add the associated indicator
AddTopmostToTail( (UINT16)iUndoMapIndex, FIRSTPOINTERS8 );
}
@@ -669,7 +669,7 @@ void SmoothUndoMapTileTerrain( INT32 iWorldTile, MAP_ELEMENT *pUndoTile )
pLand = pLand->pNext;
}
}
else if ( gpWorldLevelData[ iWorldTile ].pLandHead == NULL )
else if ( gpWorldLevelData[ iWorldTile ].pLandHead == NULL )
{
// Nothing in world's tile, so smooth out the land in the old tile.
pLand = pUndoLand;
@@ -692,7 +692,7 @@ void SmoothUndoMapTileTerrain( INT32 iWorldTile, MAP_ELEMENT *pUndoTile )
while( pWLand != NULL && !fFound )
{
GetTileType( pWLand->usIndex, &uiWCheckType);
if ( uiCheckType == uiWCheckType )
fFound = TRUE;
@@ -715,7 +715,7 @@ void SmoothUndoMapTileTerrain( INT32 iWorldTile, MAP_ELEMENT *pUndoTile )
while( pLand != NULL && !fFound )
{
GetTileType( pLand->usIndex, &uiCheckType);
if ( uiCheckType == uiWCheckType )
fFound = TRUE;
@@ -731,7 +731,7 @@ void SmoothUndoMapTileTerrain( INT32 iWorldTile, MAP_ELEMENT *pUndoTile )
}
//Because of the potentially huge amounts of memory that can be allocated due to the inefficient
//undo methods coded by Bret, it is feasible that it could fail. Instead of using assertions to
//undo methods coded by Bret, it is feasible that it could fail. Instead of using assertions to
//terminate the program, destroy the memory allocated thusfar.
void DeleteMapElementContentsAfterCreationFail( MAP_ELEMENT *pNewMapElement )
{
@@ -762,7 +762,7 @@ void DeleteMapElementContentsAfterCreationFail( MAP_ELEMENT *pNewMapElement )
}
/*
union
union
{
struct TAG_level_node *pPrevNode; // FOR LAND, GOING BACKWARDS POINTER
ITEM_POOL *pItemPool; // ITEM POOLS
@@ -770,7 +770,7 @@ void DeleteMapElementContentsAfterCreationFail( MAP_ELEMENT *pNewMapElement )
INT32 iPhysicsObjectID; // ID FOR PHYSICS ITEM
INT32 uiAPCost; // FOR AP DISPLAY
}; // ( 4 byte union )
union
union
{
struct
{
@@ -787,7 +787,7 @@ BOOLEAN CopyMapElementFromWorld( MAP_ELEMENT *pNewMapElement, INT32 iMapIndex )
{
MAP_ELEMENT *pOldMapElement;
LEVELNODE *pOldLevelNode;
LEVELNODE *pLevelNode;
LEVELNODE *pLevelNode;
LEVELNODE *pNewLevelNode;
LEVELNODE *tail;
INT32 x;
@@ -832,7 +832,7 @@ BOOLEAN CopyMapElementFromWorld( MAP_ELEMENT *pNewMapElement, INT32 iMapIndex )
//place the new node inside of the new map element
if( !pNewStructure )
{
pNewMapElement->pStructureHead = pStructure;
pNewMapElement->pStructureHead = pStructure;
pNewStructure = pStructure;
}
else
@@ -886,7 +886,7 @@ BOOLEAN CopyMapElementFromWorld( MAP_ELEMENT *pNewMapElement, INT32 iMapIndex )
//place the new node inside of the new map element
if( !pNewLevelNode )
{
pNewMapElement->pLevelNodes[ x ] = pLevelNode;
pNewMapElement->pLevelNodes[ x ] = pLevelNode;
pNewLevelNode = pLevelNode;
}
else
@@ -916,7 +916,7 @@ BOOLEAN CopyMapElementFromWorld( MAP_ELEMENT *pNewMapElement, INT32 iMapIndex )
{ //make sure the structuredata pointer points to the parallel structure
STRUCTURE *pOld, *pNew;
//both lists are exactly the same size and contain the same information,
//but the addresses are different. We will traverse the old list until
//but the addresses are different. We will traverse the old list until
//we find the match, then
pOld = pOldMapElement->pStructureHead;
pNew = pNewMapElement->pStructureHead;
@@ -933,10 +933,10 @@ BOOLEAN CopyMapElementFromWorld( MAP_ELEMENT *pNewMapElement, INT32 iMapIndex )
}
//Kris:
//If this assert should fail, that means there is something wrong with
//the preservation of the structure data within the mapelement.
//the preservation of the structure data within the mapelement.
if( pOld != pOldLevelNode->pStructureData )
{
//OUCH!!! THIS IS HAPPENING. DISABLED IT FOR LINDA'S SAKE
//OUCH!!! THIS IS HAPPENING. DISABLED IT FOR LINDA'S SAKE
Assert( 1 );
}
}
@@ -968,11 +968,11 @@ BOOLEAN SwapMapElementWithWorld( INT32 iMapIndex, MAP_ELEMENT *pUndoMapElement )
pCurrentMapElement = &gpWorldLevelData[ iMapIndex ];
//Transfer the merc level node from the current world to the undo mapelement
//that will replace it. We do this, because mercs aren't associated with
//that will replace it. We do this, because mercs aren't associated with
//undo commands.
pUndoMapElement->pMercHead = gpWorldLevelData[ iMapIndex ].pMercHead;
gpWorldLevelData[ iMapIndex ].pMercHead = NULL;
//Swap the mapelements
TempMapElement = *pCurrentMapElement;
*pCurrentMapElement = *pUndoMapElement;
@@ -986,8 +986,8 @@ void DetermineUndoState()
// Reset the undo command mode if we released the left button.
if( !fNewUndoCmd )
{
if( !gfLeftButtonState && !gfCurrentSelectionWithRightButton ||
!gfRightButtonState && gfCurrentSelectionWithRightButton )
if( !gfLeftButtonState && !gfCurrentSelectionWithRightButton ||
!gfRightButtonState && gfCurrentSelectionWithRightButton )
{
//Clear the mapindex binary tree list, and set up flag for new undo command.
fNewUndoCmd = TRUE;
@@ -997,4 +997,4 @@ void DetermineUndoState()
}
#endif
#endif
+29 -28
View File
@@ -99,15 +99,15 @@ void UpdateBuildingsInfo()
//1) if there isn't structure info here, return.
//2) if there is structure info here, delete it now.
//3) KillBuilding at x-1, y.
//4) KillBuilding at x , y-1.
//4) KillBuilding at x , y-1.
//5) KillBuilding at x+1, y.
//6) KillBuilding at x , y+1.
//6) KillBuilding at x , y+1.
void KillBuilding( UINT32 iMapIndex )
{
BOOLEAN fFound = FALSE;
if( !gfBasement )
fFound |= RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM );
fFound |= RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM );
fFound |= RemoveAllLandsOfTypeRange( iMapIndex, FIRSTFLOOR, LASTFLOOR );
EraseBuilding( iMapIndex );
@@ -120,13 +120,13 @@ void KillBuilding( UINT32 iMapIndex )
return;
}
if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex - WORLD_COLS ) ) )
if( GridNoOnVisibleWorldTile( (INT16)( iMapIndex - WORLD_COLS ) ) )
KillBuilding( iMapIndex - WORLD_COLS );
if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex + WORLD_COLS ) ) )
if( GridNoOnVisibleWorldTile( (INT16)( iMapIndex + WORLD_COLS ) ) )
KillBuilding( iMapIndex + WORLD_COLS );
if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex + 1 ) ) )
if( GridNoOnVisibleWorldTile( (INT16)( iMapIndex + 1 ) ) )
KillBuilding( iMapIndex + 1 );
if( GridNoOnVisibleWorldTile( (UINT16)( iMapIndex - 1 ) ) )
if( GridNoOnVisibleWorldTile( (INT16)( iMapIndex - 1 ) ) )
KillBuilding( iMapIndex - 1 );
if( gfBasement )
@@ -149,7 +149,7 @@ void DeleteBuildingLayout()
MemFree( curr );
}
gpBuildingLayoutList = NULL;
gsBuildingLayoutAnchorGridNo = -1;
gsBuildingLayoutAnchorGridNo = -1;
}
void BuildLayout( INT32 iMapIndex, INT32 iOffset )
@@ -193,16 +193,16 @@ void BuildLayout( INT32 iMapIndex, INT32 iOffset )
BuildLayout( iMapIndex, WORLD_COLS );
}
//The first step is copying a building. After that, it either must be pasted or moved.
//The first step is copying a building. After that, it either must be pasted or moved.
void CopyBuilding( INT32 iMapIndex )
{
AssertMsg( !gpBuildingLayoutList, "Error: Attempting to copy building multiple times." );
AssertMsg( !gpBuildingLayoutList, "Error: Attempting to copy building multiple times." );
//First step is to determine if we have a building in the area that we click. If not, do nothing.
//First step is to determine if we have a building in the area that we click. If not, do nothing.
if( !BuildingAtGridNo( iMapIndex ) )
return;
//Okay, a building does exist here to some undetermined capacity.
//Allocate the basic structure, then calculate the layout. The head node is
//Okay, a building does exist here to some undetermined capacity.
//Allocate the basic structure, then calculate the layout. The head node is
gpBuildingLayoutList = (BUILDINGLAYOUTNODE*)MemAlloc( sizeof( BUILDINGLAYOUTNODE ) );
Assert( gpBuildingLayoutList );
gpBuildingLayoutList->sGridNo = (INT16)iMapIndex;
@@ -210,16 +210,16 @@ void CopyBuilding( INT32 iMapIndex )
//Set the anchor point for this building -- this is where the user clicked.
gsBuildingLayoutAnchorGridNo = (INT16)iMapIndex;
//Now, recursively expand out while adding unique gridnos to our list. The recursion will
//Now, recursively expand out while adding unique gridnos to our list. The recursion will
//terminate when complete.
BuildLayout( iMapIndex, -WORLD_COLS );
BuildLayout( iMapIndex, -1 );
BuildLayout( iMapIndex, 1 );
BuildLayout( iMapIndex, WORLD_COLS );
//We have our layout. Now depending on the mode, we will either move the building or
//copy it. The layout automatically gets deleted as soon as the user releases the mouse
//We have our layout. Now depending on the mode, we will either move the building or
//copy it. The layout automatically gets deleted as soon as the user releases the mouse
//button.
}
@@ -295,7 +295,7 @@ void PasteMapElementToNewMapElement( INT32 iSrcGridNo, INT32 iDstGridNo )
MAP_ELEMENT *pSrcMapElement;
LEVELNODE *pNode;
UINT16 usType;
DeleteStuffFromMapTile( iDstGridNo );
DeleteAllLandLayers( iDstGridNo );
@@ -512,23 +512,23 @@ void InitDoorEditing( INT32 iMapIndex )
DisableEditorTaskbar();
MSYS_DefineRegion( &DoorRegion, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGH-2, 0, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK );
iDoorButton[ DOOR_BACKGROUND ] =
CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, iScreenWidthOffset + 200, iScreenHeightOffset + 130, 240, 100, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH - 1,
CreateTextButton( 0, 0, 0, 0, BUTTON_USE_DEFAULT, iScreenWidthOffset + 200, iScreenHeightOffset + 130, 240, 100, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH - 1,
BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK );
DisableButton( iDoorButton[ DOOR_BACKGROUND ] );
SpecifyDisabledButtonStyle( iDoorButton[ DOOR_BACKGROUND ], DISABLED_STYLE_NONE );
iDoorButton[ DOOR_OKAY ] =
CreateTextButton(L"Okay", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 330, iScreenHeightOffset + 195, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 330, iScreenHeightOffset + 195, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
DoorOkayCallback );
iDoorButton[ DOOR_CANCEL ] =
CreateTextButton(L"Cancel", FONT12POINT1, FONT_BLACK, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 385, iScreenHeightOffset + 195, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
iScreenWidthOffset + 385, iScreenHeightOffset + 195, 50, 30, BUTTON_TOGGLE, MSYS_PRIORITY_HIGH, DEFAULT_MOVE_CALLBACK,
DoorCancelCallback );
InitTextInputModeWithScheme( DEFAULT_SCHEME );
AddTextInputField( iScreenWidthOffset + 210, iScreenHeightOffset + 155, 25, 16, MSYS_PRIORITY_HIGH, L"0", 3, INPUTTYPE_NUMERICSTRICT );
AddTextInputField( iScreenWidthOffset + 210, iScreenHeightOffset + 175, 25, 16, MSYS_PRIORITY_HIGH, L"0", 2, INPUTTYPE_NUMERICSTRICT );
AddTextInputField( iScreenWidthOffset + 210, iScreenHeightOffset + 195, 25, 16, MSYS_PRIORITY_HIGH, L"0", 2, INPUTTYPE_NUMERICSTRICT );
iDoorButton[ DOOR_LOCKED ] =
iDoorButton[ DOOR_LOCKED ] =
CreateCheckBoxButton( iScreenWidthOffset + 210, iScreenHeightOffset + 215, "EDITOR//SmCheckbox.sti", MSYS_PRIORITY_HIGH, DoorToggleLockedCallback );
pDoor = FindDoorInfoAtGridNo( iDoorMapIndex );
@@ -569,20 +569,20 @@ void ExtractAndUpdateDoorInfo()
num = min( max( GetNumericStrictValueFromField( 1 ), 0 ), 10 );
door.ubTrapID = (UINT8)num;
SetInputFieldStringWithNumericStrictValue( 1, num );
if( num )
if( num )
fCursor = TRUE;
num = min( max( GetNumericStrictValueFromField( 2 ), 0 ), 20 );
if( door.ubTrapID && !num )
num = 1; //Can't have a trap without a traplevel!
num = 1; //Can't have a trap without a traplevel!
door.ubTrapLevel = (UINT8)num;
SetInputFieldStringWithNumericStrictValue( 2, num );
if( num )
if( num )
fCursor = TRUE;
if( ButtonList[ iDoorButton[ DOOR_LOCKED ] ]->uiFlags & BUTTON_CLICKED_ON )
{
door.fLocked = TRUE;
door.fLocked = TRUE;
}
else
{
@@ -730,7 +730,7 @@ void SetupTextInputForBuildings()
{
CHAR16 str[4];
InitTextInputModeWithScheme( DEFAULT_SCHEME );
AddUserInputField( NULL ); //just so we can use short cut keys while not typing.
AddUserInputField( NULL ); //just so we can use short cut keys while not typing.
swprintf( str, L"%d", gubMaxRoomNumber );
AddTextInputField( iScreenWidthOffset + 410, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
}
@@ -760,6 +760,7 @@ void ExtractAndUpdateBuildingInfo()
+1 -1
View File
@@ -33,7 +33,7 @@ typedef struct BUILDINGLAYOUTNODE
extern BUILDINGLAYOUTNODE *gpBuildingLayoutList;
extern INT16 gsBuildingLayoutAnchorGridNo;
//The first step is copying a building. After that, it either must be pasted or moved.
//The first step is copying a building. After that, it either must be pasted or moved.
void CopyBuilding( INT32 iMapIndex );
void MoveBuilding( INT32 iMapIndex );
void PasteBuilding( INT32 iMapIndex );
+5 -2
View File
@@ -74,6 +74,7 @@ enum
TBAR_MODE_ITEM_WEAPONS,
TBAR_MODE_ITEM_AMMO,
TBAR_MODE_ITEM_ARMOUR,
TBAR_MODE_ITEM_LBEGEAR,
TBAR_MODE_ITEM_EXPLOSIVES,
TBAR_MODE_ITEM_EQUIPMENT1,
TBAR_MODE_ITEM_EQUIPMENT2,
@@ -221,7 +222,7 @@ enum
DRAW_MODE_SELECT_BRUSH = 200,
DRAW_MODE_FILL_AREA,
DRAW_MODE_UNDO,
DRAW_MODE_ERASE = 1000
DRAW_MODE_ERASE = 1000
};
extern INT32 iEditorButton[NUMBER_EDITOR_BUTTONS];
@@ -244,7 +245,7 @@ extern BOOLEAN gfPendingBasement;
extern BOOLEAN gfPendingCaves;
//When in merc-inventory mode, this flag is set when the user wishes to get an item, which requires hooking
//into the item editing features. It is defined here, so editoritems can get access to this mode which makes
//into the item editing features. It is defined here, so editoritems can get access to this mode which makes
//certain special cases.
extern BOOLEAN gfMercGetItem;
@@ -262,3 +263,5 @@ extern BOOLEAN gfShowItemStatsPanel;
+160 -145
View File
@@ -49,21 +49,21 @@
extern ITEM_POOL *gpEditingItemPool;
//Simply counts the number of items in the world. This is used for display purposes.
//Simply counts the number of items in the world. This is used for display purposes.
UINT16 CountNumberOfEditorPlacementsInWorld( UINT16 usEInfoIndex, UINT16 *pusQuantity ); //wrapper for the next three
UINT16 CountNumberOfItemPlacementsInWorld( UINT16 usItem, UINT16 *pusQuantity );
UINT16 CountNumberOfItemsWithFrequency( UINT16 usItem, INT8 bFrequency );
UINT16 CountNumberOfPressureActionsInWorld();
UINT16 CountNumberOfKeysOfTypeInWorld( UINT8 ubKeyID );
//Finds and selects the next item when right clicking on an item type. Only works if the
//Finds and selects the next item when right clicking on an item type. Only works if the
//item actually exists in the world.
void FindNextItemOfSelectedType(); //wrapper for the next four
void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency );
void SelectNextItemOfType( UINT16 usItem );
void SelectNextPressureAction();
void SelectNextKeyOfType( UINT8 ubKeyID );
INT32 giDefaultExistChance = 100;
typedef struct IPListNode
@@ -85,7 +85,7 @@ void BuildItemPoolList()
KillItemPoolList();
for( i = 0; i < WORLD_MAX; i++ )
{
if( GetItemPool( i, &temp , 0) )
if( GetItemPoolFromGround( i, &temp ) )
{
if( !pIPHead )
{
@@ -151,7 +151,7 @@ void EntryInitEditorItemsInfo()
eInfo.sNumTriggers = NUMBER_TRIGGERS;
for( i=0; i < MAXITEMS; i++ )
{
if ( Item[i].usItemClass == 0 )
if ( Item[i].usItemClass == 0 )
break;
item = &Item[i];
//if( Item[i].fFlags & ITEM_NOT_EDITOR )
@@ -181,6 +181,9 @@ void EntryInitEditorItemsInfo()
case IC_ARMOUR:
eInfo.sNumArmour++;
break;
case IC_LBEGEAR:
eInfo.sLBEGear++;
break;
case IC_GRENADE:
case IC_BOMB:
eInfo.sNumExplosives++;
@@ -188,11 +191,11 @@ void EntryInitEditorItemsInfo()
case IC_MEDKIT:
case IC_KIT:
case IC_FACE:
case IC_MISC:
case IC_MONEY:
if( eInfo.sNumEquipment1 < 30 )
eInfo.sNumEquipment1++;
else if( eInfo.sNumEquipment2 < 30 )
eInfo.sNumEquipment1++;
break;
case IC_MISC:
if( eInfo.sNumEquipment2 < eInfo.sNumEquipment3 )
eInfo.sNumEquipment2++;
else
eInfo.sNumEquipment3++;
@@ -209,7 +212,7 @@ void EntryInitEditorItemsInfo()
void InitEditorItemsInfo(UINT32 uiItemType)
{
VSURFACE_DESC vs_desc;
UINT8 *pDestBuf, *pSrcBuf;
UINT8 *pDestBuf, *pSrcBuf;
UINT32 uiSrcPitchBYTES, uiDestPitchBYTES;
INVTYPE *item;
SGPRect SaveRect, NewRect;
@@ -235,16 +238,16 @@ void InitEditorItemsInfo(UINT32 uiItemType)
else
{ //User selected a different item classification -- delete it first.
ClearEditorItemsInfo();
ClearTaskbarRegion( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 440 );
ClearTaskbarRegion( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 440 );
}
}
else
{
//Clear the menu area, so that the buffer doesn't get corrupted.
ClearTaskbarRegion( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 440 );
ClearTaskbarRegion( iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, iScreenWidthOffset + 480, 2 * iScreenHeightOffset + 440 );
}
EnableEditorRegion( ITEM_REGION_ID );
eInfo.uiItemType = uiItemType;
eInfo.fActive = TRUE;
//Begin initialization of data.
@@ -265,6 +268,11 @@ void InitEditorItemsInfo(UINT32 uiItemType)
eInfo.sScrollIndex = eInfo.sSaveArmourScrollIndex;
eInfo.sSelItemIndex = eInfo.sSaveSelArmourIndex;
break;
case TBAR_MODE_ITEM_LBEGEAR:
eInfo.sNumItems = eInfo.sLBEGear;
eInfo.sScrollIndex = eInfo.sSaveLBEScrollIndex;
eInfo.sSelItemIndex = eInfo.sSaveSelLBEIndex;
break;
case TBAR_MODE_ITEM_EXPLOSIVES:
eInfo.sNumItems = eInfo.sNumExplosives;
eInfo.sScrollIndex = eInfo.sSaveExplosivesScrollIndex;
@@ -307,7 +315,7 @@ void InitEditorItemsInfo(UINT32 uiItemType)
DetermineItemsScrolling();
//calculate the width of the buffer based on the number of items.
//every pair of items (odd rounded up) requires 60 pixels for width.
//the minimum buffer size is 420. Height is always 80 pixels.
//the minimum buffer size is 420. Height is always 80 pixels.
eInfo.sWidth = (eInfo.sNumItems > 12) ? ((eInfo.sNumItems+1)/2)*60 : SCREEN_HEIGHT - 120;
eInfo.sHeight = 80;
@@ -318,7 +326,7 @@ void InitEditorItemsInfo(UINT32 uiItemType)
vs_desc.usHeight = eInfo.sHeight;
vs_desc.ubBitDepth = ubBitDepth;
//!!!Memory check. Create the item buffer
//!!!Memory check. Create the item buffer
if(!AddVideoSurface( &vs_desc, &eInfo.uiBuffer ))
{
eInfo.fKill = TRUE;
@@ -332,10 +340,10 @@ void InitEditorItemsInfo(UINT32 uiItemType)
//copy a blank chunk of the editor interface to the new buffer.
for( i=0; i<eInfo.sWidth; i+=60 )
{
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES, 0+i, 0, iScreenWidthOffset + 100, 2 * iScreenHeightOffset + 360, 60, 80 );
}
UnLockVideoSurface(eInfo.uiBuffer);
UnLockVideoSurface(FRAME_BUFFER);
@@ -364,7 +372,7 @@ void InitEditorItemsInfo(UINT32 uiItemType)
SetFontDestBuffer( eInfo.uiBuffer, 0, 0, eInfo.sWidth, eInfo.sHeight, FALSE );
swprintf( pStr, L"%S", LockTable[ i ].ubEditorName );
DisplayWrappedString(x, (UINT16)(y+25), 60, 2, SMALLCOMPFONT, FONT_WHITE, pStr, FONT_BLACK, TRUE, CENTER_JUSTIFIED );
DisplayWrappedString(x, (UINT16)(y+25), 60, 2, SMALLCOMPFONT, FONT_WHITE, pStr, FONT_BLACK, TRUE, CENTER_JUSTIFIED );
//Calculate the center position of the graphic in a 60 pixel wide area.
sWidth = hVObject->pETRLEObject[item->ubGraphicNum].usWidth;
@@ -373,7 +381,7 @@ void InitEditorItemsInfo(UINT32 uiItemType)
BltVideoObjectOutlineFromIndex( eInfo.uiBuffer, uiVideoObjectIndex, item->ubGraphicNum, sStart, y+2, 0, FALSE );
//cycle through the various slot positions (0,0), (0,40), (60,0), (60,40), (120,0)...
if( y == 0 )
{
y = 40;
@@ -391,7 +399,7 @@ void InitEditorItemsInfo(UINT32 uiItemType)
fTypeMatch = FALSE;
while( usCounter<MAXITEMS && !fTypeMatch )
{
if ( Item[usCounter].usItemClass == 0 )
if ( Item[usCounter].usItemClass == 0 )
break;
item = &Item[usCounter];
//if( Item[usCounter].fFlags & ITEM_NOT_EDITOR )
@@ -433,6 +441,9 @@ void InitEditorItemsInfo(UINT32 uiItemType)
case IC_ARMOUR:
fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_ARMOUR;
break;
case IC_LBEGEAR:
fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_LBEGEAR;
break;
case IC_GRENADE:
case IC_BOMB:
fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_EXPLOSIVES;
@@ -440,13 +451,13 @@ void InitEditorItemsInfo(UINT32 uiItemType)
case IC_MEDKIT:
case IC_KIT:
case IC_FACE:
case IC_MISC:
case IC_MONEY:
fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_EQUIPMENT1;
break;
case IC_MISC:
if( usCounter == ACTION_ITEM || usCounter == SWITCH )
break;
if( iEquipCount < 30 )
fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_EQUIPMENT1;
else if( iEquipCount < 60 )
if( iEquipCount < eInfo.sNumEquipment2 )
fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_EQUIPMENT2;
else
fTypeMatch = eInfo.uiItemType == TBAR_MODE_ITEM_EQUIPMENT3;
@@ -545,7 +556,7 @@ void DetermineItemsScrolling()
DisableEditorButton( ITEMS_LEFTSCROLL );
else
EnableEditorButton( ITEMS_LEFTSCROLL );
//Right most scroll position. Calculated by taking every pair of numItems rounded up,
//Right most scroll position. Calculated by taking every pair of numItems rounded up,
//and subtracting 7 (because a scroll index 0 is disabled if there are <=12 items,
//index 1 for <=14 items, index 2 for <=16 items...
if( eInfo.sScrollIndex == max( ((eInfo.sNumItems+1)/2)-6, 0 ) )
@@ -556,7 +567,7 @@ void DetermineItemsScrolling()
void RenderEditorItemsInfo()
{
UINT8 *pDestBuf, *pSrcBuf;
UINT8 *pDestBuf, *pSrcBuf;
UINT32 uiSrcPitchBYTES, uiDestPitchBYTES;
INVTYPE *item;
HVOBJECT hVObject;
@@ -579,13 +590,13 @@ void RenderEditorItemsInfo()
pDestBuf = LockVideoSurface(FRAME_BUFFER, &uiDestPitchBYTES);
pSrcBuf = LockVideoSurface(eInfo.uiBuffer, &uiSrcPitchBYTES);
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES, iScreenWidthOffset + 110, 2 * iScreenHeightOffset + 360, 60*eInfo.sScrollIndex, 0, 360, 80 );
UnLockVideoSurface(eInfo.uiBuffer);
UnLockVideoSurface(FRAME_BUFFER);
//calculate the min and max index that is currently shown. This determines
//calculate the min and max index that is currently shown. This determines
//if the highlighted and/or selected items are drawn with the outlines.
minIndex = eInfo.sScrollIndex * 2;
maxIndex = minIndex + 11;
@@ -598,7 +609,7 @@ void RenderEditorItemsInfo()
item = &Item[eInfo.pusItemIndex[eInfo.sHilitedItemIndex]];
uiVideoObjectIndex = GetInterfaceGraphicForItem( item );
GetVideoObject( &hVObject, uiVideoObjectIndex );
x = iScreenWidthOffset + (eInfo.sHilitedItemIndex/2 - eInfo.sScrollIndex)*60 + 110;
y = 2 * iScreenHeightOffset + 360 + (eInfo.sHilitedItemIndex % 2) * 40;
sWidth = hVObject->pETRLEObject[item->ubGraphicNum].usWidth;
@@ -618,7 +629,7 @@ void RenderEditorItemsInfo()
item = &Item[eInfo.pusItemIndex[eInfo.sSelItemIndex]];
uiVideoObjectIndex = GetInterfaceGraphicForItem( item );
GetVideoObject( &hVObject, uiVideoObjectIndex );
x = iScreenWidthOffset + (eInfo.sSelItemIndex/2 - eInfo.sScrollIndex)*60 + 110;
y = 2 * iScreenHeightOffset + 360 + (eInfo.sSelItemIndex % 2) * 40;
sWidth = hVObject->pETRLEObject[item->ubGraphicNum].usWidth;
@@ -683,6 +694,10 @@ void ClearEditorItemsInfo()
eInfo.sSaveSelArmourIndex = eInfo.sSelItemIndex;
eInfo.sSaveArmourScrollIndex = eInfo.sScrollIndex;
break;
case TBAR_MODE_ITEM_LBEGEAR:
eInfo.sSaveSelLBEIndex = eInfo.sSelItemIndex;
eInfo.sSaveLBEScrollIndex = eInfo.sScrollIndex;
break;
case TBAR_MODE_ITEM_EXPLOSIVES:
eInfo.sSaveSelExplosivesIndex = eInfo.sSelItemIndex;
eInfo.sSaveExplosivesScrollIndex = eInfo.sScrollIndex;
@@ -708,7 +723,7 @@ void ClearEditorItemsInfo()
eInfo.sSaveKeysScrollIndex = eInfo.sScrollIndex;
break;
}
}
}
void HandleItemsPanel( UINT16 usScreenX, UINT16 usScreenY, INT8 bEvent )
{
@@ -720,13 +735,13 @@ void HandleItemsPanel( UINT16 usScreenX, UINT16 usScreenY, INT8 bEvent )
if( usScreenY >= (2 * iScreenHeightOffset + 400) )
sIndex++;
//Add the converted mouse's XPos into a relative index;
//Calc: starting from 110, for every 60 pixels, add 2 to the index
//Calc: starting from 110, for every 60 pixels, add 2 to the index
sIndex += ((usScreenX-110-iScreenWidthOffset)/60) * 2;
switch( bEvent )
{
case GUI_MOVE_EVENT:
if( sIndex < eInfo.sNumItems )
if( sIndex < eInfo.sNumItems )
{
if( eInfo.sHilitedItemIndex != sIndex )
gfRenderTaskbar = TRUE;
@@ -792,13 +807,13 @@ void HideItemCursor( INT32 iMapIndex )
BOOLEAN TriggerAtGridNo( INT16 sGridNo )
{
ITEM_POOL *pItemPool;
if( !GetItemPool( sGridNo, &pItemPool, 0 ) )
if( !GetItemPoolFromGround( sGridNo, &pItemPool ) )
{
return FALSE;
}
while( pItemPool )
{
if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == SWITCH )
if( gWorldItems[ pItemPool->iItemIndex ].object.usItem == SWITCH )
{
return TRUE;
}
@@ -810,7 +825,6 @@ BOOLEAN TriggerAtGridNo( INT16 sGridNo )
void AddSelectedItemToWorld( INT16 sGridNo )
{
OBJECTTYPE tempObject;
OBJECTTYPE *pObject;
INVTYPE *pItem;
ITEM_POOL *pItemPool;
@@ -823,17 +837,16 @@ void AddSelectedItemToWorld( INT16 sGridNo )
//Extract the currently selected item.
SpecifyItemToEdit( NULL, -1 );
//memset( &tempObject, 0, sizeof( OBJECTTYPE ) );
if( eInfo.uiItemType == TBAR_MODE_ITEM_KEYS )
{
CreateKeyObject( &tempObject, 1, (UINT8)eInfo.sSelItemIndex );
CreateKeyObject( &gTempObject, 1, (UINT8)eInfo.sSelItemIndex );
}
else
{
CreateItem( eInfo.pusItemIndex[eInfo.sSelItemIndex], 100, &tempObject );
CreateItem( eInfo.pusItemIndex[eInfo.sSelItemIndex], 100, &gTempObject );
}
usFlags = 0;
switch( tempObject.usItem )
switch( gTempObject.usItem )
{
case MINE:
if ( bVisibility == BURIED )
@@ -844,11 +857,11 @@ void AddSelectedItemToWorld( INT16 sGridNo )
case MONEY:
case SILVER:
case GOLD:
tempObject.ItemData.Money.bMoneyStatus = 100;
tempObject.ItemData.Money.uiMoneyAmount = 100 + Random( 19901 );
gTempObject[0]->data.objectStatus = 100;
gTempObject[0]->data.money.uiMoneyAmount = 100 + Random( 19901 );
break;
case OWNERSHIP:
tempObject.ItemData.Owner.ubOwnerProfile = NO_PROFILE;
gTempObject[0]->data.owner.ubOwnerProfile = NO_PROFILE;
bVisibility = BURIED;
break;
case SWITCH:
@@ -857,42 +870,42 @@ void AddSelectedItemToWorld( INT16 sGridNo )
return;
}
bVisibility = BURIED;
tempObject.ItemData.Trigger.bBombStatus = 100;
tempObject.ItemData.Trigger.ubBombOwner = 1;
gTempObject[0]->data.objectStatus = 100;
gTempObject[0]->data.misc.ubBombOwner = 1;
if( eInfo.sSelItemIndex < 2 )
tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY;
gTempObject[0]->data.misc.bFrequency = PANIC_FREQUENCY;
else if( eInfo.sSelItemIndex < 4 )
tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_2;
gTempObject[0]->data.misc.bFrequency = PANIC_FREQUENCY_2;
else if( eInfo.sSelItemIndex < 6 )
tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_3;
gTempObject[0]->data.misc.bFrequency = PANIC_FREQUENCY_3;
else
tempObject.ItemData.Trigger.BombTrigger.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2);
gTempObject[0]->data.misc.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2);
usFlags |= WORLD_ITEM_ARMED_BOMB;
break;
case ACTION_ITEM:
bVisibility = BURIED;
tempObject.ItemData.Trigger.bBombStatus = 100;
tempObject.ItemData.Trigger.ubBombOwner = 1;
tempObject.bTrap = gbDefaultBombTrapLevel;
gTempObject[0]->data.objectStatus = 100;
gTempObject[0]->data.misc.ubBombOwner = 1;
gTempObject[0]->data.bTrap = gbDefaultBombTrapLevel;
if( eInfo.sSelItemIndex < PRESSURE_ACTION_ID )
{
tempObject.ItemData.Trigger.bDetonatorType = BOMB_REMOTE;
gTempObject[0]->data.misc.bDetonatorType = BOMB_REMOTE;
if( eInfo.sSelItemIndex < 2 )
tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY;
gTempObject[0]->data.misc.bFrequency = PANIC_FREQUENCY;
else if( eInfo.sSelItemIndex < 4 )
tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_2;
gTempObject[0]->data.misc.bFrequency = PANIC_FREQUENCY_2;
else if( eInfo.sSelItemIndex < 6 )
tempObject.ItemData.Trigger.BombTrigger.bFrequency = PANIC_FREQUENCY_3;
gTempObject[0]->data.misc.bFrequency = PANIC_FREQUENCY_3;
else
tempObject.ItemData.Trigger.BombTrigger.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2);
gTempObject[0]->data.misc.bFrequency = (INT8)(FIRST_MAP_PLACED_FREQUENCY + (eInfo.sSelItemIndex-4) / 2);
}
else
{
tempObject.ItemData.Trigger.bDetonatorType = BOMB_PRESSURE;
tempObject.ItemData.Trigger.BombTrigger.bDelay = 0;
gTempObject[0]->data.misc.bDetonatorType = BOMB_PRESSURE;
gTempObject[0]->data.misc.bDelay = 0;
}
ChangeActionItem( &tempObject, gbActionItemIndex );
tempObject.fFlags |= OBJECT_ARMED_BOMB;
ChangeActionItem( &gTempObject, gbActionItemIndex );
gTempObject.fFlags |= OBJECT_ARMED_BOMB;
if( gbActionItemIndex == ACTIONITEM_SMPIT )
Add3X3Pit( sGridNo );
else if( gbActionItemIndex == ACTIONITEM_LGPIT )
@@ -901,8 +914,8 @@ void AddSelectedItemToWorld( INT16 sGridNo )
break;
}
pObject = InternalAddItemToPool( &sGridNo, &tempObject, bVisibility, 0, usFlags, 0, &iItemIndex );
if( tempObject.usItem != OWNERSHIP )
pObject = InternalAddItemToPool( &sGridNo, &gTempObject, bVisibility, 0, usFlags, 0, -1, &iItemIndex );
if( gTempObject.usItem != OWNERSHIP )
{
gWorldItems[ iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance);
}
@@ -910,40 +923,40 @@ void AddSelectedItemToWorld( INT16 sGridNo )
{
gWorldItems[ iItemIndex ].ubNonExistChance = 0;
}
pItem = &( Item[ pObject->usItem ] );
if( pItem->usItemClass == IC_AMMO )
{
if (Random( 2 ))
{
pObject->ItemData.Ammo.ubShotsLeft[0] = Magazine[ pItem->ubClassIndex ].ubMagSize;
(*pObject)[0]->data.ubShotsLeft = Magazine[ pItem->ubClassIndex ].ubMagSize;
}
else
{
pObject->ItemData.Ammo.ubShotsLeft[0] = (UINT8) Random( Magazine[ pItem->ubClassIndex ].ubMagSize );
(*pObject)[0]->data.ubShotsLeft = (UINT8) Random( Magazine[ pItem->ubClassIndex ].ubMagSize );
}
}
else
{
pObject->ItemData.Generic.bStatus[0] = (INT8)(70 + Random( 26 ));
(*pObject)[0]->data.objectStatus = (INT8)(70 + Random( 26 ));
}
if( pItem->usItemClass & IC_GUN )
{
if ( pObject->usItem == ROCKET_LAUNCHER )
{
pObject->ItemData.Gun.ubGunShotsLeft = 1;
(*pObject)[0]->data.gun.ubGunShotsLeft = 1;
}
else
{
pObject->ItemData.Gun.ubGunShotsLeft = (UINT8)(Random( Weapon[ pObject->usItem ].ubMagSize ));
(*pObject)[0]->data.gun.ubGunShotsLeft = (UINT8)(Random( Weapon[ pObject->usItem ].ubMagSize ));
}
}
if( !GetItemPool( sGridNo, &pItemPool, 0 ) )
if( !GetItemPoolFromGround( sGridNo, &pItemPool ) )
Assert( 0 );
while( pItemPool )
{
if( &(gWorldItems[ pItemPool->iItemIndex ].o) == pObject )
if( &(gWorldItems[ pItemPool->iItemIndex ].object) == pObject )
{
fFound = TRUE;
//ShowSelectedItem();
@@ -952,14 +965,14 @@ void AddSelectedItemToWorld( INT16 sGridNo )
pItemPool = pItemPool->pNext;
}
Assert( fFound );
gpItemPool = pItemPool;
SpecifyItemToEdit( pObject, sGridNo );
//Get access to the itempool.
//search for a current node in list containing same mapindex
pIPCurr = pIPHead;
pIPCurr = pIPHead;
pIPPrev = NULL;
while( pIPCurr )
{
@@ -999,18 +1012,18 @@ void HandleRightClickOnItem( INT16 sGridNo )
IPListNode *pIPCurr;
if( gsItemGridNo == sGridNo )
{ //Clicked on the same gridno as the selected item. Automatically select the next
{ //Clicked on the same gridno as the selected item. Automatically select the next
//item in the same pool.
pItemPool = gpItemPool->pNext;
if( !pItemPool )
{ //currently selected item was last node, so select the head node even if it is the same.
GetItemPool( sGridNo, &pItemPool, 0 );
GetItemPoolFromGround( sGridNo, &pItemPool );
}
}
else if( !GetItemPool( sGridNo, &pItemPool, 0 ) )
else if( !GetItemPoolFromGround( sGridNo, &pItemPool ) )
{
//possibly relocate selected item to this gridno?
return;
return;
}
gpItemPool = pItemPool;
@@ -1028,7 +1041,7 @@ void HandleRightClickOnItem( INT16 sGridNo )
pIPCurr = pIPCurr->next;
}
Assert( gpCurrItemPoolNode );
SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].o, gpItemPool->sGridNo );
SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].object, gpItemPool->sGridNo );
}
extern void DeleteSelectedMercsItem();
@@ -1048,15 +1061,15 @@ void DeleteSelectedItem()
//save the mapindex
if( gpItemPool->pNext )
{
SpecifyItemToEdit( &gWorldItems[ gpItemPool->pNext->iItemIndex ].o, gpItemPool->sGridNo );
SpecifyItemToEdit( &gWorldItems[ gpItemPool->pNext->iItemIndex ].object, gpItemPool->sGridNo );
}
sGridNo = gpItemPool->sGridNo;
//remove the item
if( gWorldItems[ gpItemPool->iItemIndex ].o.usItem == ACTION_ITEM )
if( gWorldItems[ gpItemPool->iItemIndex ].object.usItem == ACTION_ITEM )
{
if( gWorldItems[ gpItemPool->iItemIndex ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT )
if( gWorldItems[ gpItemPool->iItemIndex ].object[0]->data.misc.bActionValue == ACTION_ITEM_SMALL_PIT )
Remove3X3Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
else if( gWorldItems[ gpItemPool->iItemIndex ].o.ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT )
else if( gWorldItems[ gpItemPool->iItemIndex ].object[0]->data.misc.bActionValue == ACTION_ITEM_LARGE_PIT )
Remove5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
}
if( gpEditingItemPool == gpItemPool )
@@ -1064,7 +1077,7 @@ void DeleteSelectedItem()
RemoveItemFromPool( sGridNo, gpItemPool->iItemIndex, 0 );
gpItemPool = NULL;
//determine if there are still any items at this location
if( !GetItemPool( sGridNo, &gpItemPool , 0 ) )
if( !GetItemPoolFromGround( sGridNo, &gpItemPool ) )
{ //no items left, so remove the node from the list.
IPListNode *pIPPrev, *pIPCurr;
pIPCurr = pIPHead;
@@ -1072,7 +1085,7 @@ void DeleteSelectedItem()
while( pIPCurr )
{
if( pIPCurr->sGridNo == sGridNo )
{
{
if( pIPPrev ) //middle of list
pIPPrev->next = pIPCurr->next;
else //head of list
@@ -1084,7 +1097,7 @@ void DeleteSelectedItem()
gpCurrItemPoolNode = pIPHead;
if( gpCurrItemPoolNode )
{
GetItemPool( gpCurrItemPoolNode->sGridNo, &gpItemPool, 0 );
GetItemPoolFromGround( gpCurrItemPoolNode->sGridNo, &gpItemPool );
Assert( gpItemPool );
}
//remove node
@@ -1103,7 +1116,7 @@ void DeleteSelectedItem()
void ShowSelectedItem()
{
if( gpItemPool )
{
{
gpItemPool->bVisible = INVISIBLE;
gWorldItems[ gpItemPool->iItemIndex ].bVisible = INVISIBLE;
}
@@ -1127,16 +1140,16 @@ void SelectNextItemPool()
{
MarkMapIndexDirty( gpItemPool->sGridNo );
}
//go to the next node. If at end of list, choose pIPHead
//go to the next node. If at end of list, choose pIPHead
if( gpCurrItemPoolNode->next )
gpCurrItemPoolNode = gpCurrItemPoolNode->next;
else
else
gpCurrItemPoolNode = pIPHead;
//get the item pool at this node's gridno.
GetItemPool( gpCurrItemPoolNode->sGridNo, &gpItemPool, 0 );
GetItemPoolFromGround( gpCurrItemPoolNode->sGridNo, &gpItemPool );
MarkMapIndexDirty( gpItemPool->sGridNo );
SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].o, gpItemPool->sGridNo );
SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].object, gpItemPool->sGridNo );
if( gsItemGridNo != -1 )
{
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1153,9 +1166,9 @@ void SelectNextItemInPool()
}
else
{
GetItemPool( gpItemPool->sGridNo, &gpItemPool, 0 );
GetItemPoolFromGround( gpItemPool->sGridNo, &gpItemPool );
}
SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].o, gpItemPool->sGridNo );
SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].object, gpItemPool->sGridNo );
MarkWorldDirty();
}
}
@@ -1170,13 +1183,13 @@ void SelectPrevItemInPool()
}
else
{
GetItemPool( gpItemPool->sGridNo, &gpItemPool, 0 );
GetItemPoolFromGround( gpItemPool->sGridNo, &gpItemPool );
while( gpItemPool->pNext )
{
gpItemPool = gpItemPool->pNext;
}
}
SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].o, gpItemPool->sGridNo );
SpecifyItemToEdit( &gWorldItems[ gpItemPool->iItemIndex ].object, gpItemPool->sGridNo );
MarkWorldDirty();
}
}
@@ -1189,7 +1202,7 @@ void FindNextItemOfSelectedType()
if( usItem == ACTION_ITEM || usItem == SWITCH )
{
if( eInfo.sSelItemIndex < PRESSURE_ACTION_ID )
{
{
INT8 bFrequency;
if( eInfo.sSelItemIndex < 2 )
bFrequency = PANIC_FREQUENCY;
@@ -1202,7 +1215,7 @@ void FindNextItemOfSelectedType()
SelectNextTriggerWithFrequency( usItem, bFrequency );
}
else
{
{
SelectNextPressureAction();
}
}
@@ -1230,7 +1243,7 @@ void SelectNextItemOfType( UINT16 usItem )
gpItemPool = gpItemPool->pNext;
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
pObject = &gWorldItems[ gpItemPool->iItemIndex ].object;
if( pObject->usItem == usItem )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
@@ -1246,10 +1259,10 @@ void SelectNextItemOfType( UINT16 usItem )
}
while( curr )
{ //search to the end of the list
GetItemPool( curr->sGridNo, &gpItemPool, 0 );
GetItemPoolFromGround( curr->sGridNo, &gpItemPool );
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
pObject = &gWorldItems[ gpItemPool->iItemIndex ].object;
if( pObject->usItem == usItem )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
@@ -1264,10 +1277,10 @@ void SelectNextItemOfType( UINT16 usItem )
curr = pIPHead;
while( curr )
{ //search to the end of the list
GetItemPool( curr->sGridNo, &gpItemPool, 0 );
GetItemPoolFromGround( curr->sGridNo, &gpItemPool );
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
pObject = &gWorldItems[ gpItemPool->iItemIndex ].object;
if( pObject->usItem == usItem )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
@@ -1294,8 +1307,8 @@ void SelectNextKeyOfType( UINT8 ubKeyID )
gpItemPool = gpItemPool->pNext;
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ItemData.Key.ubKeyID == ubKeyID )
pObject = &gWorldItems[ gpItemPool->iItemIndex ].object;
if( Item[ pObject->usItem ].usItemClass == IC_KEY && (*pObject)[0]->data.key.ubKeyID == ubKeyID )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1310,11 +1323,11 @@ void SelectNextKeyOfType( UINT8 ubKeyID )
}
while( curr )
{ //search to the end of the list
GetItemPool( curr->sGridNo, &gpItemPool, 0 );
GetItemPoolFromGround( curr->sGridNo, &gpItemPool );
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ItemData.Key.ubKeyID == ubKeyID )
pObject = &gWorldItems[ gpItemPool->iItemIndex ].object;
if( Item[ pObject->usItem ].usItemClass == IC_KEY && (*pObject)[0]->data.key.ubKeyID == ubKeyID )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1328,11 +1341,11 @@ void SelectNextKeyOfType( UINT8 ubKeyID )
curr = pIPHead;
while( curr )
{ //search to the end of the list
GetItemPool( curr->sGridNo, &gpItemPool, 0 );
GetItemPoolFromGround( curr->sGridNo, &gpItemPool );
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( Item[ pObject->usItem ].usItemClass == IC_KEY && pObject->ItemData.Key.ubKeyID == ubKeyID )
pObject = &gWorldItems[ gpItemPool->iItemIndex ].object;
if( Item[ pObject->usItem ].usItemClass == IC_KEY && (*pObject)[0]->data.key.ubKeyID == ubKeyID )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1358,8 +1371,8 @@ void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency )
gpItemPool = gpItemPool->pNext;
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( pObject->usItem == usItem && pObject->ItemData.Trigger.BombTrigger.bFrequency == bFrequency )
pObject = &gWorldItems[ gpItemPool->iItemIndex ].object;
if( pObject->usItem == usItem && (*pObject)[0]->data.misc.bFrequency == bFrequency )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1374,11 +1387,11 @@ void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency )
}
while( curr )
{ //search to the end of the list
GetItemPool( curr->sGridNo, &gpItemPool, 0 );
GetItemPoolFromGround( curr->sGridNo, &gpItemPool );
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( pObject->usItem == usItem && pObject->ItemData.Trigger.BombTrigger.bFrequency == bFrequency )
pObject = &gWorldItems[ gpItemPool->iItemIndex ].object;
if( pObject->usItem == usItem && (*pObject)[0]->data.misc.bFrequency == bFrequency )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1392,11 +1405,11 @@ void SelectNextTriggerWithFrequency( UINT16 usItem, INT8 bFrequency )
curr = pIPHead;
while( curr )
{ //search to the end of the list
GetItemPool( curr->sGridNo, &gpItemPool, 0 );
GetItemPoolFromGround( curr->sGridNo, &gpItemPool );
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( pObject->usItem == usItem && pObject->ItemData.Trigger.BombTrigger.bFrequency == bFrequency )
pObject = &gWorldItems[ gpItemPool->iItemIndex ].object;
if( pObject->usItem == usItem && (*pObject)[0]->data.misc.bFrequency == bFrequency )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1422,8 +1435,8 @@ void SelectNextPressureAction()
gpItemPool = gpItemPool->pNext;
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( pObject->usItem == ACTION_ITEM && pObject->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE )
pObject = &gWorldItems[ gpItemPool->iItemIndex ].object;
if( pObject->usItem == ACTION_ITEM && (*pObject)[0]->data.misc.bDetonatorType == BOMB_PRESSURE )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1438,11 +1451,11 @@ void SelectNextPressureAction()
}
while( curr )
{ //search to the end of the list
GetItemPool( curr->sGridNo, &gpItemPool, 0 );
GetItemPoolFromGround( curr->sGridNo, &gpItemPool );
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( pObject->usItem == ACTION_ITEM && pObject->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE )
pObject = &gWorldItems[ gpItemPool->iItemIndex ].object;
if( pObject->usItem == ACTION_ITEM && (*pObject)[0]->data.misc.bDetonatorType == BOMB_PRESSURE )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1456,11 +1469,11 @@ void SelectNextPressureAction()
curr = pIPHead;
while( curr )
{ //search to the end of the list
GetItemPool( curr->sGridNo, &gpItemPool, 0 );
GetItemPoolFromGround( curr->sGridNo, &gpItemPool );
while( gpItemPool )
{
pObject = &gWorldItems[ gpItemPool->iItemIndex ].o;
if( pObject->usItem == ACTION_ITEM && pObject->ItemData.Trigger.bDetonatorType == BOMB_PRESSURE )
pObject = &gWorldItems[ gpItemPool->iItemIndex ].object;
if( pObject->usItem == ACTION_ITEM && (*pObject)[0]->data.misc.bDetonatorType == BOMB_PRESSURE )
{
SpecifyItemToEdit( pObject, gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
CenterScreenAtMapIndex( gsItemGridNo );
@@ -1481,13 +1494,13 @@ UINT16 CountNumberOfItemPlacementsInWorld( UINT16 usItem, UINT16 *pusQuantity )
pIPCurr = pIPHead;
while( pIPCurr )
{
GetItemPool( pIPCurr->sGridNo, &pItemPool, 0 );
GetItemPoolFromGround( pIPCurr->sGridNo, &pItemPool );
while( pItemPool )
{
if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == usItem )
if( gWorldItems[ pItemPool->iItemIndex ].object.usItem == usItem )
{
num++;
*pusQuantity += gWorldItems[ pItemPool->iItemIndex ].o.ubNumberOfObjects;
*pusQuantity += gWorldItems[ pItemPool->iItemIndex ].object.ubNumberOfObjects;
}
pItemPool = pItemPool->pNext;
}
@@ -1504,11 +1517,11 @@ UINT16 CountNumberOfItemsWithFrequency( UINT16 usItem, INT8 bFrequency )
pIPCurr = pIPHead;
while( pIPCurr )
{
GetItemPool( pIPCurr->sGridNo, &pItemPool, 0 );
GetItemPoolFromGround( pIPCurr->sGridNo, &pItemPool );
while( pItemPool )
{
if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == usItem &&
gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Trigger.BombTrigger.bFrequency == bFrequency )
if( gWorldItems[ pItemPool->iItemIndex ].object.usItem == usItem &&
gWorldItems[ pItemPool->iItemIndex ].object[0]->data.misc.bFrequency == bFrequency )
{
num++;
}
@@ -1527,11 +1540,11 @@ UINT16 CountNumberOfPressureActionsInWorld()
pIPCurr = pIPHead;
while( pIPCurr )
{
GetItemPool( pIPCurr->sGridNo, &pItemPool, 0 );
GetItemPoolFromGround( pIPCurr->sGridNo, &pItemPool );
while( pItemPool )
{
if( gWorldItems[ pItemPool->iItemIndex ].o.usItem == ACTION_ITEM &&
gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Trigger.bDetonatorType == BOMB_PRESSURE )
if( gWorldItems[ pItemPool->iItemIndex ].object.usItem == ACTION_ITEM &&
gWorldItems[ pItemPool->iItemIndex ].object[0]->data.misc.bDetonatorType == BOMB_PRESSURE )
{
num++;
}
@@ -1546,7 +1559,7 @@ UINT16 CountNumberOfEditorPlacementsInWorld( UINT16 usEInfoIndex, UINT16 *pusQua
{
UINT16 usNumPlacements;
if( eInfo.uiItemType == TBAR_MODE_ITEM_TRIGGERS )
{ //find identical items with same frequency
{ //find identical items with same frequency
INT8 bFrequency;
if( usEInfoIndex < PRESSURE_ACTION_ID )
{
@@ -1573,7 +1586,7 @@ UINT16 CountNumberOfEditorPlacementsInWorld( UINT16 usEInfoIndex, UINT16 *pusQua
*pusQuantity = usNumPlacements;
}
else
{
{
usNumPlacements = CountNumberOfItemPlacementsInWorld( eInfo.pusItemIndex[ usEInfoIndex], pusQuantity );
}
return usNumPlacements;
@@ -1587,12 +1600,12 @@ UINT16 CountNumberOfKeysOfTypeInWorld( UINT8 ubKeyID )
pIPCurr = pIPHead;
while( pIPCurr )
{
GetItemPool( pIPCurr->sGridNo, &pItemPool, 0 );
GetItemPoolFromGround( pIPCurr->sGridNo, &pItemPool );
while( pItemPool )
{
if( Item[ gWorldItems[ pItemPool->iItemIndex ].o.usItem ].usItemClass == IC_KEY )
if( Item[ gWorldItems[ pItemPool->iItemIndex ].object.usItem ].usItemClass == IC_KEY )
{
if( gWorldItems[ pItemPool->iItemIndex ].o.ItemData.Key.ubKeyID == ubKeyID )
if( gWorldItems[ pItemPool->iItemIndex ].object[0]->data.key.ubKeyID == ubKeyID )
{
num++;
}
@@ -1610,15 +1623,15 @@ void DisplayItemStatistics()
INT16 usItemIndex;
CHAR16 pItemName[SIZE_ITEM_NAME];
INVTYPE *pItem;
if( !eInfo.fActive )
{
return;
}
//If there is nothing else currently highlited by the mouse, use the selected item.
fUseSelectedItem = eInfo.sHilitedItemIndex == -1 || eInfo.sHilitedItemIndex == eInfo.sSelItemIndex;
SetFont( SMALLCOMPFONT );
SetFontForeground( (UINT8)(fUseSelectedItem ? FONT_LTRED : FONT_YELLOW) );
@@ -1643,6 +1656,8 @@ void DisplayItemStatistics()
+12 -9
View File
@@ -12,18 +12,19 @@ typedef struct{
UINT16 *pusItemIndex; //a dynamic array of Item indices
UINT32 uiBuffer; //index of buffer
UINT32 uiItemType; //Weapons, ammo, armour, explosives, equipment
INT16 sWidth, sHeight; //width and height of buffer
INT16 sNumItems; //total number of items in the current class of item.
INT32 sWidth, sHeight; //width and height of buffer
//Kaiden: was previously INT16 - Fix for number of items capped by class
INT16 sNumItems; //total number of items in the current class of item.
INT16 sSelItemIndex; //currently selected item index.
INT16 sHilitedItemIndex;
INT16 sScrollIndex; //current scroll index (0 is far left, 1 is next tile to the right, ...)
INT16 sSaveSelWeaponsIndex, sSaveSelAmmoIndex, sSaveSelArmourIndex, sSaveSelExplosivesIndex,
INT16 sHilitedItemIndex;
INT16 sScrollIndex; //current scroll index (0 is far left, 1 is next tile to the right, ...)
INT16 sSaveSelWeaponsIndex, sSaveSelAmmoIndex, sSaveSelArmourIndex, sSaveSelLBEIndex, sSaveSelExplosivesIndex,
sSaveSelEquipment1Index, sSaveSelEquipment2Index, sSaveSelEquipment3Index,
sSaveSelTriggersIndex, sSaveSelKeysIndex;
INT16 sSaveWeaponsScrollIndex, sSaveAmmoScrollIndex, sSaveArmourScrollIndex, sSaveExplosivesScrollIndex,
sSaveEquipment1ScrollIndex, sSaveEquipment2ScrollIndex, sSaveEquipment3ScrollIndex,
sSaveTriggersScrollIndex, sSaveKeysScrollIndex;
INT16 sNumWeapons, sNumAmmo, sNumArmour, sNumExplosives, sNumEquipment1, sNumEquipment2, sNumEquipment3,
INT16 sSaveWeaponsScrollIndex, sSaveAmmoScrollIndex, sSaveArmourScrollIndex, sSaveLBEScrollIndex,
sSaveExplosivesScrollIndex, sSaveEquipment1ScrollIndex, sSaveEquipment2ScrollIndex,
sSaveEquipment3ScrollIndex, sSaveTriggersScrollIndex, sSaveKeysScrollIndex;
INT16 sNumWeapons, sNumAmmo, sNumArmour, sLBEGear, sNumExplosives, sNumEquipment1, sNumEquipment2, sNumEquipment3,
sNumTriggers, sNumKeys;
}EditorItemsInfo;
@@ -67,3 +68,5 @@ extern INT32 giDefaultExistChance;
+17 -13
View File
@@ -42,7 +42,6 @@
#include "Soldier Init List.h"
#include "strategicmap.h"
#include "Soldier Add.h"
#include "Soldier Control.h"
#include "Soldier Profile Type.h"
#include "Soldier Profile.h"
#include "Text Input.h"
@@ -59,6 +58,10 @@
#include "Simple Render Utils.h"
#endif
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
INT8 gbDefaultLightType = PRIMETIME_LIGHT;
SGPPaletteEntry gEditorLightColor;
@@ -68,10 +71,10 @@ BOOLEAN gfEditorForceShadeTableRebuild = FALSE;
void SetupTextInputForMapInfo()
{
CHAR16 str[10];
InitTextInputModeWithScheme( DEFAULT_SCHEME );
AddUserInputField( NULL ); //just so we can use short cut keys while not typing.
AddUserInputField( NULL ); //just so we can use short cut keys while not typing.
//light rgb fields
swprintf( str, L"%d", gEditorLightColor.peRed );
@@ -98,7 +101,7 @@ void SetupTextInputForMapInfo()
AddTextInputField( iScreenWidthOffset + 338, 2 * iScreenHeightOffset + 363, 30, 18, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_EXCLUSIVE_COORDINATE );
swprintf( str, L"%d", gExitGrid.ubGotoSectorZ );
AddTextInputField( iScreenWidthOffset + 338, 2 * iScreenHeightOffset + 383, 30, 18, MSYS_PRIORITY_NORMAL, str, 1, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gExitGrid.usGridNo );
swprintf( str, L"%d", gExitGrid.sGridNo );
AddTextInputField( iScreenWidthOffset + 338, 2 * iScreenHeightOffset + 403, 40, 18, MSYS_PRIORITY_NORMAL, str, 5, INPUTTYPE_NUMERICSTRICT );
}
@@ -222,13 +225,13 @@ void ExtractAndUpdateMapInfo()
gMapInformation.ubRestrictedScrollID = 0;
else
gMapInformation.ubRestrictedScrollID = (UINT8)temp;
//set up fields for exitgrid information
//set up fields for exitgrid information
Get16BitStringFromField( 7, str );
if( str[0] >= 'a' && str[0] <= 'z' )
str[0] -= 32; //uppercase it!
if( str[0] >= 'A' && str[0] <= 'Z' &&
str[1] >= '0' && str[1] <= '9' )
if( str[0] >= 'A' && str[0] <= 'Z' &&
str[1] >= '0' && str[1] <= '9' )
{ //only update, if coordinate is valid.
gExitGrid.ubGotoSectorY = (UINT8)(str[0] - 'A' + 1);
gExitGrid.ubGotoSectorX = (UINT8)(str[1] - '0');
@@ -237,8 +240,8 @@ void ExtractAndUpdateMapInfo()
gExitGrid.ubGotoSectorX = (UINT8)max( min( gExitGrid.ubGotoSectorX, 16 ), 1 );
gExitGrid.ubGotoSectorY = (UINT8)max( min( gExitGrid.ubGotoSectorY, 16 ), 1 );
}
gExitGrid.ubGotoSectorZ = (UINT8)max( min( GetNumericStrictValueFromField( 8 ), 3 ), 0 );
gExitGrid.usGridNo = (UINT16)max( min( GetNumericStrictValueFromField( 9 ), 25600 ), 0 );
gExitGrid.ubGotoSectorZ = (UINT8)max( min( GetNumericStrictValueFromField( 8 ), 3 ), 0 );
gExitGrid.sGridNo = (INT16)max( min( GetNumericStrictValueFromField( 9 ), 25600 ), 0 );
UpdateMapInfoFields();
}
@@ -253,13 +256,13 @@ BOOLEAN ApplyNewExitGridValuesToTextFields()
SetInputFieldStringWith16BitString( 7, str );
swprintf( str, L"%d", gExitGrid.ubGotoSectorZ );
SetInputFieldStringWith16BitString( 8, str );
swprintf( str, L"%d", gExitGrid.usGridNo );
swprintf( str, L"%d", gExitGrid.sGridNo );
SetInputFieldStringWith16BitString( 9, str );
SetActiveField( 0 );
return TRUE;
}
UINT16 usCurrentExitGridNo = 0;
INT16 usCurrentExitGridNo = 0;
void LocateNextExitGrid()
{
EXITGRID ExitGrid;
@@ -295,6 +298,7 @@ void ChangeLightDefault( INT8 bLightType )
+269 -281
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -5,7 +5,7 @@
#ifndef __EDITORMERCS_H
#define __EDITORMERCS_H
//Merc editing modes. These are used to determine which buttons to show and hide.
//Merc editing modes. These are used to determine which buttons to show and hide.
enum
{
MERC_NOMODE, //used for shutting down mercs tab, to extract any changed information
+16 -15
View File
@@ -72,7 +72,7 @@ void HideTerrainTileButtons()
{
DisableEditorRegion( x );
}
gfShowTerrainTileButtons=FALSE;
gfShowTerrainTileButtons=FALSE;
}
}
@@ -85,7 +85,7 @@ void ShowTerrainTileButtons()
{
EnableEditorRegion( x );
}
gfShowTerrainTileButtons=TRUE;
gfShowTerrainTileButtons=TRUE;
}
}
@@ -122,10 +122,10 @@ void RenderTerrainTileButtons()
ColorFillVideoSurfaceArea(ButtonDestBuffer, usX + 1, usY + 1, usX2, usY2, usFillColorLight);
}
ColorFillVideoSurfaceArea(ButtonDestBuffer, usX + 1, usY + 1, usX2 - 1, usY2 - 1, 0);
SetObjectShade( gTileDatabase[gTileTypeStartIndex[x]].hTileSurface, DEFAULT_SHADE_LEVEL );
BltVideoObject(ButtonDestBuffer, gTileDatabase[gTileTypeStartIndex[x]].hTileSurface, 0, (usX + 1), (usY + 1),
VO_BLT_SRCTRANSPARENCY, NULL);
BltVideoObject(ButtonDestBuffer, gTileDatabase[gTileTypeStartIndex[x]].hTileSurface, 0, (usX + 1), (usY + 1),
VO_BLT_SRCTRANSPARENCY, NULL);
if( fUseTerrainWeights )
{
@@ -135,7 +135,7 @@ void RenderTerrainTileButtons()
}
}
//This callback is used for each of the terrain tile buttons. The userData[0] field
//This callback is used for each of the terrain tile buttons. The userData[0] field
//contains the terrain button's index value.
void TerrainTileButtonRegionCallback(MOUSE_REGION *reg,INT32 reason)
{
@@ -147,9 +147,9 @@ void TerrainTileButtonRegionCallback(MOUSE_REGION *reg,INT32 reason)
{
TerrainForegroundTile = TerrainTileSelected;
CurrentPaste = (UINT16)TerrainForegroundTile;
//iEditorToolbarState = TBAR_MODE_DRAW;
//iEditorToolbarState = TBAR_MODE_DRAW;
if( _KeyDown( SHIFT ) )
{
{
fUseTerrainWeights = TRUE;
}
if( fUseTerrainWeights )
@@ -161,7 +161,7 @@ void TerrainTileButtonRegionCallback(MOUSE_REGION *reg,INT32 reason)
usTotalWeight++;
}
}
else
else
{ //Regular LEFTCLICK selects only that terrain tile.
//When total weight is 0, then the only selected tile is drawn.
ResetTerrainTileWeights();
@@ -195,7 +195,7 @@ void ChooseWeightedTerrainTile()
UINT16 x, usWeight;
INT16 sRandomNum;
if(!usTotalWeight)
{ //Not in the weighted mode. CurrentPaste will already contain the selected tile.
{ //Not in the weighted mode. CurrentPaste will already contain the selected tile.
return;
}
sRandomNum = rand() % usTotalWeight;
@@ -228,7 +228,7 @@ void Fill( INT32 x, INT32 y )
if( count > maxCount )
maxCount = count;
iMapIndex = y * WORLD_COLS + x;
if( !GridNoOnVisibleWorldTile( (INT16)iMapIndex ) )
{
@@ -261,15 +261,15 @@ void TerrainFill( UINT32 iMapIndex )
INT16 sX, sY;
//determine what we should be looking for to replace...
GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex, &guiSearchType );
//check terminating conditions
if( guiSearchType == CurrentPaste )
return;
ConvertGridNoToXY( (INT16)iMapIndex, &sX, &sY );
count = 0;
Fill( sX, sY );
}
@@ -279,6 +279,7 @@ void TerrainFill( UINT32 iMapIndex )
+1 -1
View File
@@ -14,7 +14,7 @@
//Soon to be added to an editor struct
extern UINT16 usTotalWeight;
extern BOOLEAN fPrevShowTerrainTileButtons;
extern BOOLEAN fUseTerrainWeights;
extern BOOLEAN fUseTerrainWeights;
extern INT32 TerrainTileSelected, TerrainForegroundTile,TerrainBackgroundTile;
extern INT32 TerrainTileDrawMode;
+66 -4
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="Editor_2005Express"
ProjectGUID="{60D793F2-90B4-43C9-83B5-221EE11B37E6}"
RootNamespace="Editor_2005Express"
@@ -39,7 +39,7 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;&#x0D;&#x0A;"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
MinimalRebuild="true"
@@ -103,7 +103,6 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/D &quot;_CRT_SECURE_NO_DEPRECATE&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
RuntimeLibrary="0"
RuntimeTypeInfo="false"
@@ -139,6 +138,69 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="MapEditor|Win32"
OutputDirectory="MapEditor"
IntermediateDirectory="MapEditor"
ConfigurationType="4"
InheritedPropertySheets="..\ja2_2005Express.vsprops;..\ja2_2005ExpressEditor.vsprops"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
DisableSpecificWarnings="4100"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
+218 -171
View File
@@ -20,7 +20,6 @@
#include "Item Statistics.h"
#include "Text Input.h"
#include "Action Items.h"
#include "Item types.h"
#include "video.h"
#include "Simple Render Utils.h"
#include "Weapons.h"
@@ -39,7 +38,7 @@ INT32 giSciFiCheckboxButton = -1;
INT32 giAlarmTriggerButton = -1;
INT32 giOwnershipGroupButton = -1;
CHAR16 gszActionItemDesc[ NUM_ACTIONITEMS ][ 30 ] =
CHAR16 gszActionItemDesc[ NUM_ACTIONITEMS ][ 30 ] =
{
L"Klaxon Mine",
L"Flare Mine",
@@ -81,9 +80,9 @@ const STR16 GetActionItemName( OBJECTTYPE *pItem )
{
if( !pItem || pItem->usItem != ACTION_ITEM )
return NULL;
if( pItem->ItemData.Trigger.bActionValue != ACTION_ITEM_BLOW_UP )
if( (*pItem)[0]->data.misc.bActionValue != ACTION_ITEM_BLOW_UP )
{
switch( pItem->ItemData.Trigger.bActionValue )
switch( (*pItem)[0]->data.misc.bActionValue )
{
case ACTION_ITEM_OPEN_DOOR: return gszActionItemDesc[ ACTIONITEM_OPEN ];
case ACTION_ITEM_CLOSE_DOOR: return gszActionItemDesc[ ACTIONITEM_CLOSE ];
@@ -111,7 +110,7 @@ const STR16 GetActionItemName( OBJECTTYPE *pItem )
default: return NULL;
}
}
else switch( pItem->ItemData.Trigger.usBombItem )
else switch( (*pItem)[0]->data.misc.usBombItem )
{
case STUN_GRENADE: return gszActionItemDesc[ ACTIONITEM_STUN ];
case SMOKE_GRENADE: return gszActionItemDesc[ ACTIONITEM_SMOKE ];
@@ -165,6 +164,7 @@ enum
EDITING_GUNS,
EDITING_AMMO,
EDITING_ARMOUR,
EDITING_LBEGEAR,
EDITING_EQUIPMENT,
EDITING_EXPLOSIVES,
EDITING_MONEY,
@@ -198,6 +198,10 @@ void SetupArmourGUI();
void ExtractAndUpdateArmourGUI();
void RemoveArmourGUI();
void SetupLBEGUI();
void ExtractAndUpdateLBEGUI();
void RemoveLBEGUI();
void SetupEquipGUI();
void ExtractAndUpdateEquipGUI();
void RemoveEquipGUI();
@@ -277,6 +281,7 @@ void ExecuteItemStatsCmd( UINT8 ubAction )
case EDITING_GUNS: ExtractAndUpdateGunGUI(); break;
case EDITING_AMMO: ExtractAndUpdateAmmoGUI(); break;
case EDITING_ARMOUR: ExtractAndUpdateArmourGUI(); break;
case EDITING_LBEGEAR: ExtractAndUpdateLBEGUI(); break;
case EDITING_EQUIPMENT: ExtractAndUpdateEquipGUI(); break;
case EDITING_EXPLOSIVES: ExtractAndUpdateExplosivesGUI(); break;
case EDITING_MONEY: ExtractAndUpdateMoneyGUI(); break;
@@ -328,6 +333,7 @@ void RemoveItemGUI()
case EDITING_GUNS: RemoveGunGUI(); break;
case EDITING_AMMO: RemoveAmmoGUI(); break;
case EDITING_ARMOUR: RemoveArmourGUI(); break;
case EDITING_LBEGEAR: RemoveLBEGUI(); break;
case EDITING_EQUIPMENT: RemoveEquipGUI(); break;
case EDITING_EXPLOSIVES: RemoveExplosivesGUI(); break;
case EDITING_MONEY: RemoveMoneyGUI(); break;
@@ -412,6 +418,10 @@ void SpecifyItemToEdit( OBJECTTYPE *pItem, INT32 iMapIndex )
gbEditingMode = EDITING_ARMOUR;
SetupArmourGUI();
break;
case IC_LBEGEAR:
gbEditingMode = EDITING_LBEGEAR;
SetupLBEGUI();
break;
case IC_MEDKIT:
case IC_KIT:
case IC_MISC:
@@ -435,7 +445,7 @@ void SpecifyItemToEdit( OBJECTTYPE *pItem, INT32 iMapIndex )
SetupKeysGUI();
break;
case IC_PUNCH:
if ( gpItem->usItem != NOTHING)
if ( gpItem->exists() == true)
{
gbEditingMode = EDITING_EQUIPMENT;
SetupEquipGUI();
@@ -444,7 +454,7 @@ void SpecifyItemToEdit( OBJECTTYPE *pItem, INT32 iMapIndex )
// else fall through and act as nothing
case IC_NONE:
gbEditingMode = EDITING_NOTHING;
if( !(gpItem->fFlags & OBJECT_UNDROPPABLE) )
if( !((*gpItem).fFlags & OBJECT_UNDROPPABLE) )
gbEditingMode = EDITING_DROPPABLE;
break;
default:
@@ -473,7 +483,7 @@ void UpdateItemStatsPanel()
SetFontForeground( FONT_GRAY2 );
SetFontShadow( FONT_NEARBLACK );
SetFontBackground( FONT_BLACK );
if( gpItem && iCurrentTaskbar == TASK_ITEMS &&
if( gpItem && iCurrentTaskbar == TASK_ITEMS &&
gbEditingMode != EDITING_TRIGGERS && gbEditingMode != EDITING_ACTIONITEMS )
{
mprintf( iScreenWidthOffset + 500, 2 * iScreenHeightOffset + 366, L"Toggle hide flag" );
@@ -516,6 +526,7 @@ void UpdateItemStatsPanel()
mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 404, L"Trap Level" );
break;
case EDITING_ARMOUR:
case EDITING_LBEGEAR:
case EDITING_EQUIPMENT:
mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 384, L"Status" );
mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 404, L"Trap Level" );
@@ -535,7 +546,7 @@ void UpdateItemStatsPanel()
case EDITING_TRIGGERS:
mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 369, L"Trap Level");
mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 389, L"Tolerance" );
if( gpEditingItemPool && gpItem->ItemData.Trigger.BombTrigger.bFrequency >= PANIC_FREQUENCY_3 && gpItem->ItemData.Trigger.BombTrigger.bFrequency <= PANIC_FREQUENCY )
if( gpEditingItemPool && (*gpItem)[0]->data.misc.bFrequency >= PANIC_FREQUENCY_3 && (*gpItem)[0]->data.misc.bFrequency <= PANIC_FREQUENCY )
mprintf( iScreenWidthOffset + 500, 2 * iScreenHeightOffset + 407, L"Alarm Trigger" );
break;
}
@@ -546,7 +557,7 @@ void UpdateItemStatsPanel()
SetFontForeground( FONT_YELLOW );
else if( iPercent >= 50 )
SetFontForeground( FONT_ORANGE );
else
else
SetFontForeground( FONT_RED );
mprintf( iScreenWidthOffset + 512, 2 * iScreenHeightOffset + 444, L"Exist Chance" );
mprintf( iScreenWidthOffset + 587, 2 * iScreenHeightOffset + 366, L"B" );
@@ -601,16 +612,16 @@ void SetupGameTypeFlags()
{
if( gpEditingItemPool )
{
giBothCheckboxButton =
giBothCheckboxButton =
CreateCheckBoxButton( iScreenWidthOffset + 573, 2 * iScreenHeightOffset + 365, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, BothModesCheckboxCallback );
SetButtonFastHelpText( giBothCheckboxButton, L"Item appears in both Sci-Fi and Realistic modes. (|B)" );
giRealisticCheckboxButton =
giRealisticCheckboxButton =
CreateCheckBoxButton( iScreenWidthOffset + 595, 2 * iScreenHeightOffset + 365, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, RealisticOnlyCheckboxCallback );
SetButtonFastHelpText( giRealisticCheckboxButton, L"Item appears in |Realistic mode only." );
giSciFiCheckboxButton =
giSciFiCheckboxButton =
CreateCheckBoxButton( iScreenWidthOffset + 616, 2 * iScreenHeightOffset + 365, "EDITOR//radiobutton.sti", MSYS_PRIORITY_NORMAL, SciFiOnlyCheckboxCallback );
SetButtonFastHelpText( giSciFiCheckboxButton, L"Item appears in |Sci-Fi mode only." );
if( gWorldItems[ gpEditingItemPool->iItemIndex ].usFlags & WORLD_ITEM_REALISTIC_ONLY )
ButtonList[ giRealisticCheckboxButton ]->uiFlags |= (BUTTON_CLICKED_ON | BUTTON_DIRTY);
else if( gWorldItems[ gpEditingItemPool->iItemIndex ].usFlags & WORLD_ITEM_SCIFI_ONLY )
@@ -644,28 +655,28 @@ void SetupGunGUI()
CHAR16 str[20];
INT16 yp;
memset( gfAttachment, 0, NUM_ATTACHMENT_BUTTONS );
swprintf( str, L"%d", gpItem->ItemData.Gun.bGunStatus );
swprintf( str, L"%d", (*gpItem)[0]->data.gun.bGunStatus );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->ItemData.Gun.ubGunShotsLeft );
swprintf( str, L"%d", (*gpItem)[0]->data.gun.ubGunShotsLeft );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->bTrap );
swprintf( str, L"%d", (*gpItem)[0]->data.bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 420, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT );
if( gpEditingItemPool )
{
swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
}
//Attachments are a dynamic part of guns. None, some, or all attachments could be available
//for a particular weapon. Show only the ones that we can apply to this gun.
//Attachments are a dynamic part of guns. None, some, or all attachments could be available
//for a particular weapon. Show only the ones that we can apply to this gun.
yp = 2 * iScreenHeightOffset + 383;
guiAttachmentButton[ SILENCER_ATTACHMENT_BUTTON ] = -1;
if( ValidAttachment( SILENCER, gpItem->usItem ) )
{
guiAttachmentButton[ SILENCER_ATTACHMENT_BUTTON ] =
guiAttachmentButton[ SILENCER_ATTACHMENT_BUTTON ] =
CreateTextButton( L"SILENCER", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment );
yp += 14;
if( FindAttachment( gpItem, SILENCER ) != -1 )
if( FindAttachment( gpItem, SILENCER ) )
{
ButtonList[ guiAttachmentButton[ SILENCER_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON;
gfAttachment[0] = TRUE;
@@ -674,11 +685,11 @@ void SetupGunGUI()
guiAttachmentButton[ SNIPERSCOPE_ATTACHMENT_BUTTON ] = -1;
if( ValidAttachment( SNIPERSCOPE, gpItem->usItem ) )
{
guiAttachmentButton[ SNIPERSCOPE_ATTACHMENT_BUTTON ] =
guiAttachmentButton[ SNIPERSCOPE_ATTACHMENT_BUTTON ] =
CreateTextButton( L"SNIPERSCOPE", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment );
yp += 14;
if( FindAttachment( gpItem, SNIPERSCOPE ) != -1 )
if( FindAttachment( gpItem, SNIPERSCOPE ) )
{
ButtonList[ guiAttachmentButton[ SNIPERSCOPE_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON;
gfAttachment[1] = TRUE;
@@ -687,11 +698,11 @@ void SetupGunGUI()
guiAttachmentButton[ LASERSCOPE_ATTACHMENT_BUTTON ] = -1;
if( ValidAttachment( LASERSCOPE, gpItem->usItem ) )
{
guiAttachmentButton[ LASERSCOPE_ATTACHMENT_BUTTON ] =
guiAttachmentButton[ LASERSCOPE_ATTACHMENT_BUTTON ] =
CreateTextButton( L"LASERSCOPE", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment );
yp += 14;
if( FindAttachment( gpItem, LASERSCOPE ) != -1 )
if( FindAttachment( gpItem, LASERSCOPE ) )
{
ButtonList[ guiAttachmentButton[ LASERSCOPE_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON;
gfAttachment[2] = TRUE;
@@ -700,11 +711,11 @@ void SetupGunGUI()
guiAttachmentButton[ BIPOD_ATTACHMENT_BUTTON ] = -1;
if( ValidAttachment( BIPOD, gpItem->usItem ) )
{
guiAttachmentButton[ BIPOD_ATTACHMENT_BUTTON ] =
guiAttachmentButton[ BIPOD_ATTACHMENT_BUTTON ] =
CreateTextButton( L"BIPOD", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment );
yp += 14;
if( FindAttachment( gpItem, BIPOD ) != -1 )
if( FindAttachment( gpItem, BIPOD ) )
{
ButtonList[ guiAttachmentButton[ BIPOD_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON;
gfAttachment[3] = TRUE;
@@ -713,11 +724,11 @@ void SetupGunGUI()
guiAttachmentButton[ DUCKBILL_ATTACHMENT_BUTTON ] = -1;
if( ValidAttachment( DUCKBILL, gpItem->usItem ) )
{
guiAttachmentButton[ DUCKBILL_ATTACHMENT_BUTTON ] =
guiAttachmentButton[ DUCKBILL_ATTACHMENT_BUTTON ] =
CreateTextButton( L"DUCKBILL", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment );
yp += 14;
if( FindAttachment( gpItem, DUCKBILL ) != -1 )
if( FindAttachment( gpItem, DUCKBILL ) )
{
ButtonList[ guiAttachmentButton[ DUCKBILL_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON;
gfAttachment[4] = TRUE;
@@ -726,11 +737,11 @@ void SetupGunGUI()
guiAttachmentButton[ GLAUNCHER_ATTACHMENT_BUTTON ] = -1;
if( ValidAttachment( UNDER_GLAUNCHER, gpItem->usItem ) )
{
guiAttachmentButton[ GLAUNCHER_ATTACHMENT_BUTTON ] =
guiAttachmentButton[ GLAUNCHER_ATTACHMENT_BUTTON ] =
CreateTextButton( L"G-LAUNCHER", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleAttachment );
yp += 14;
if( FindAttachment( gpItem, UNDER_GLAUNCHER ) != -1 )
if( FindAttachment( gpItem, UNDER_GLAUNCHER ) )
{
ButtonList[ guiAttachmentButton[ GLAUNCHER_ATTACHMENT_BUTTON ] ]->uiFlags |= BUTTON_CLICKED_ON;
gfAttachment[5] = TRUE;
@@ -761,7 +772,7 @@ void ExtractAndUpdateGunGUI()
i = 20 + Random( 81 );
else
i = min( i, 100 );
gpItem->ItemData.Gun.bGunStatus = (INT8)i;
(*gpItem)[0]->data.gun.bGunStatus = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the ammo
i = GetNumericStrictValueFromField( 2 );
@@ -769,12 +780,12 @@ void ExtractAndUpdateGunGUI()
i = Random( 1 + Weapon[ gpItem->usItem ].ubMagSize );
else
i = min( i, Weapon[ gpItem->usItem ].ubMagSize );
gpItem->ItemData.Gun.ubGunShotsLeft = (UINT8)i;
(*gpItem)[0]->data.gun.ubGunShotsLeft = (UINT8)i;
SetInputFieldStringWithNumericStrictValue( 2, i );
//Update the trap level
i = GetNumericStrictValueFromField( 3 );
i = ( i == -1 ) ? 0 : min( i, 20 );
gpItem->bTrap = (INT8)i;
(*gpItem)[0]->data.bTrap = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 3, i );
if( gpEditingItemPool )
{
@@ -790,7 +801,7 @@ void SetupAmmoGUI()
CHAR16 str[20];
swprintf( str, L"%d", gpItem->ubNumberOfObjects );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 1, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->bTrap );
swprintf( str, L"%d", (*gpItem)[0]->data.bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT );
if( gpEditingItemPool )
{
@@ -810,16 +821,15 @@ void ExtractAndUpdateAmmoGUI()
//Update the number of clips
i = GetNumericStrictValueFromField( 1 );
if( i == -1 )
i = 1 + Random( Item[ gpItem->usItem ].ubPerPocket );
i = 1 + Random( ItemSlotLimit(gpItem, STACK_SIZE_LIMIT) );
else
i = max( 1, min( i, Item[ gpItem->usItem ].ubPerPocket ) );
gpItem->ubNumberOfObjects = (UINT8)i;
i = max( 1, min( i, ItemSlotLimit(gpItem, STACK_SIZE_LIMIT) ) );
SetInputFieldStringWithNumericStrictValue( 1, i );
CreateItems( gpItem->usItem, 100, gpItem->ubNumberOfObjects, gpItem );
CreateItems( gpItem->usItem, 100, i, gpItem );
//Update the trap level
i = GetNumericStrictValueFromField( 2 );
i = ( i == -1 ) ? 0 : min( i, 20 );
gpItem->bTrap = (INT8)i;
(*gpItem)[0]->data.bTrap = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 2, i );
if( gpEditingItemPool )
{
@@ -833,9 +843,9 @@ void ExtractAndUpdateAmmoGUI()
void SetupArmourGUI()
{
CHAR16 str[20];
swprintf( str, L"%d", gpItem->ItemData.Generic.bStatus[0] );
swprintf( str, L"%d", (*gpItem)[0]->data.objectStatus );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->bTrap );
swprintf( str, L"%d", (*gpItem)[0]->data.bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT );
if( gpEditingItemPool )
{
@@ -846,10 +856,10 @@ void SetupArmourGUI()
guiCeramicPlatesButton = -1;
if( ValidAttachment( CERAMIC_PLATES, gpItem->usItem ) )
{
guiCeramicPlatesButton =
guiCeramicPlatesButton =
CreateTextButton( L"CERAMIC PLATES", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 558, 2 * iScreenHeightOffset + 375, 72, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleCeramicPlates );
if( FindAttachment( gpItem, CERAMIC_PLATES ) != -1 )
if( FindAttachment( gpItem, CERAMIC_PLATES ) )
{
ButtonList[ guiCeramicPlatesButton ]->uiFlags |= BUTTON_CLICKED_ON;
gfCeramicPlates = TRUE;
@@ -875,12 +885,56 @@ void ExtractAndUpdateArmourGUI()
i = 20 + Random( 81 );
else
i = min( i, 100 );
gpItem->ItemData.Generic.bStatus[0] = (INT8)i;
(*gpItem)[0]->data.objectStatus = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the trap level
i = GetNumericStrictValueFromField( 2 );
i = ( i == -1 ) ? 0 : min( i, 20 );
gpItem->bTrap = (INT8)i;
(*gpItem)[0]->data.bTrap = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 2, i );
if( gpEditingItemPool )
{
giDefaultExistChance = GetNumericStrictValueFromField( 3 );
giDefaultExistChance = ( giDefaultExistChance == -1 ) ? 100 : max( 1, min( giDefaultExistChance, 100 ) );
gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance = (UINT8)(100 - giDefaultExistChance );
SetInputFieldStringWithNumericStrictValue( 3, giDefaultExistChance );
}
}
void SetupLBEGUI()
{
CHAR16 str[20];
swprintf( str, L"%d", (*gpItem)[0]->data.objectStatus );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", (*gpItem)[0]->data.bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT );
if( gpEditingItemPool )
{
swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
}
}
void RemoveLBEGUI()
{
//nothing to remove
}
void ExtractAndUpdateLBEGUI()
{
INT32 i;
//Update the equipment status
i = GetNumericStrictValueFromField( 1 );
if( i == -1 )
i = 20 + Random( 81 );
else
i = min( i, 100 );
(*gpItem)[0]->data.objectStatus = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the trap level
i = GetNumericStrictValueFromField( 2 );
i = ( i == -1 ) ? 0 : min( i, 20 );
(*gpItem)[0]->data.bTrap = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 2, i );
if( gpEditingItemPool )
{
@@ -894,9 +948,9 @@ void ExtractAndUpdateArmourGUI()
void SetupEquipGUI()
{
CHAR16 str[20];
swprintf( str, L"%d", gpItem->ItemData.Generic.bStatus[0] );
swprintf( str, L"%d", (*gpItem)[0]->data.objectStatus );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->bTrap );
swprintf( str, L"%d", (*gpItem)[0]->data.bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT );
if( gpEditingItemPool )
{
@@ -919,12 +973,12 @@ void ExtractAndUpdateEquipGUI()
i = 20 + Random( 81 );
else
i = min( i, 100 );
gpItem->ItemData.Generic.bStatus[0] = (INT8)i;
(*gpItem)[0]->data.objectStatus = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the trap level
i = GetNumericStrictValueFromField( 2 );
i = ( i == -1 ) ? 0 : min( i, 20 );
gpItem->bTrap = (INT8)i;
(*gpItem)[0]->data.bTrap = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 2, i );
if( gpEditingItemPool )
{
@@ -939,15 +993,15 @@ void SetupExplosivesGUI()
{
CHAR16 str[20];
INT16 yp;
swprintf( str, L"%d", gpItem->ItemData.Generic.bStatus[0] );
swprintf( str, L"%d", (*gpItem)[0]->data.objectStatus );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->ubNumberOfObjects );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 400, 25, 15, MSYS_PRIORITY_NORMAL, str, 1, INPUTTYPE_NUMERICSTRICT );
if( Item[ gpItem->usItem ].ubPerPocket == 1 )
if( ItemSlotLimit(gpItem, STACK_SIZE_LIMIT)== 1 )
{
DisableTextField( 2 );
}
swprintf( str, L"%d", gpItem->bTrap );
swprintf( str, L"%d", (*gpItem)[0]->data.bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 420, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT );
if( gpEditingItemPool )
{
@@ -959,11 +1013,11 @@ void SetupExplosivesGUI()
guiDetonatorButton = -1;
if( ValidAttachment( DETONATOR, gpItem->usItem ) )
{
guiDetonatorButton =
guiDetonatorButton =
CreateTextButton( L"DETONATOR", SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 570, yp, 60, 12, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ToggleDetonator );
yp += 14;
if( FindAttachment( gpItem, DETONATOR ) != -1 )
if( FindAttachment( gpItem, DETONATOR ) )
{
ButtonList[ guiDetonatorButton ]->uiFlags |= BUTTON_CLICKED_ON;
gfDetonator = TRUE;
@@ -989,24 +1043,23 @@ void ExtractAndUpdateExplosivesGUI()
i = 20 + Random( 81 );
else
i = min( i, 100 );
gpItem->ItemData.Generic.bStatus[0] = (INT8)i;
(*gpItem)[0]->data.objectStatus = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the quantity
if( Item[ gpItem->usItem ].ubPerPocket > 1 )
if( ItemSlotLimit(gpItem, STACK_SIZE_LIMIT) > 1 )
{
i = GetNumericStrictValueFromField( 2 );
if( i == -1 )
i = 1 + Random( Item[ gpItem->usItem ].ubPerPocket );
i = 1 + Random( ItemSlotLimit(gpItem, STACK_SIZE_LIMIT) );
else
i = max( 1, min( i, Item[ gpItem->usItem ].ubPerPocket ) );
gpItem->ubNumberOfObjects = (UINT8)i;
i = max( 1, min( i, ItemSlotLimit(gpItem, STACK_SIZE_LIMIT) ) );
SetInputFieldStringWithNumericStrictValue( 2, i );
CreateItems( gpItem->usItem, gpItem->ItemData.Generic.bStatus[0], gpItem->ubNumberOfObjects, gpItem );
CreateItems( gpItem->usItem, (INT8)(*gpItem)[0]->data.objectStatus, i, gpItem );
}
//Update the trap level
i = GetNumericStrictValueFromField( 3 );
i = ( i == -1 ) ? 0 : min( i, 20 );
gpItem->bTrap = (INT8)i;
i = ( i == -1 ) ? 0 : min( i, 20 );
(*gpItem)[0]->data.bTrap = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 3, i );
if( gpEditingItemPool )
{
@@ -1020,7 +1073,7 @@ void ExtractAndUpdateExplosivesGUI()
void SetupMoneyGUI()
{
CHAR16 str[20];
swprintf( str, L"%d", gpItem->ItemData.Money.uiMoneyAmount );
swprintf( str, L"%d", (*gpItem)[0]->data.money.uiMoneyAmount );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 45, 15, MSYS_PRIORITY_NORMAL, str, 5, INPUTTYPE_NUMERICSTRICT );
if( gpEditingItemPool )
{
@@ -1038,8 +1091,8 @@ void ExtractAndUpdateMoneyGUI()
i = Random( 20000 );
else
i = max( 1, min( i, 20000 ) );
gpItem->ItemData.Money.uiMoneyAmount = i;
gpItem->ItemData.Money.bMoneyStatus = 100;
(*gpItem)[0]->data.money.uiMoneyAmount = i;
(*gpItem)[0]->data.objectStatus = 100;
SetInputFieldStringWithNumericStrictValue( 1, i );
if( gpEditingItemPool )
{
@@ -1058,10 +1111,10 @@ void RemoveMoneyGUI()
void SetupOwnershipGUI()
{
CHAR16 str[20];
swprintf( str, L"%d", gpItem->ItemData.Owner.ubOwnerProfile );
swprintf( str, L"%d", (*gpItem)[0]->data.owner.ubOwnerProfile );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 380, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
giOwnershipGroupButton =
CreateTextButton( gszCivGroupNames[ gpItem->ItemData.Owner.ubOwnerCivGroup ], SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
giOwnershipGroupButton =
CreateTextButton( gszCivGroupNames[ (*gpItem)[0]->data.owner.ubOwnerCivGroup ], SMALLCOMPFONT, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 415, 80, 25, BUTTON_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, OwnershipGroupButtonCallback );
}
@@ -1075,7 +1128,7 @@ void OwnershipGroupButtonCallback( GUI_BUTTON *btn, INT32 reason )
void SetOwnershipGroup( UINT8 ubNewGroup )
{
gpItem->ItemData.Owner.ubOwnerCivGroup = ubNewGroup;
(*gpItem)[0]->data.owner.ubOwnerCivGroup = ubNewGroup;
SpecifyButtonText( giOwnershipGroupButton, gszCivGroupNames[ ubNewGroup ] );
}
@@ -1088,7 +1141,7 @@ void ExtractAndUpdateOwnershipGUI()
i = Random( 0 );
else
i = max( 0, min( i, 255 ) );
gpItem->ItemData.Owner.ubOwnerProfile = (UINT8)i;
(*gpItem)[0]->data.owner.ubOwnerProfile = (UINT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
}
@@ -1131,9 +1184,9 @@ void SetupActionItemsGUI()
{
CHAR16 str[4];
STR16 pStr;
swprintf( str, L"%d", gpItem->ItemData.Generic.bStatus[0] );
swprintf( str, L"%d", (*gpItem)[0]->data.objectStatus );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 365, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->bTrap );
swprintf( str, L"%d", (*gpItem)[0]->data.bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 385, 25, 15, MSYS_PRIORITY_NORMAL, str, 2, INPUTTYPE_NUMERICSTRICT );
if( gpEditingItemPool )
{
@@ -1141,7 +1194,7 @@ void SetupActionItemsGUI()
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
}
pStr = GetActionItemName( gpItem );
guiActionItemButton =
guiActionItemButton =
CreateTextButton( pStr, FONT10ARIAL, FONT_YELLOW, FONT_BLACK, BUTTON_USE_DEFAULT,
iScreenWidthOffset + 510, 2 * iScreenHeightOffset + 410, 100, 20, BUTTON_NO_TOGGLE, MSYS_PRIORITY_NORMAL, DEFAULT_MOVE_CALLBACK, ActionItemCallback );
}
@@ -1155,14 +1208,14 @@ void ExtractAndUpdateActionItemsGUI()
i = 20 + Random( 81 );
else
i = min( i, 100 );
gpItem->ItemData.Generic.bStatus[0] = (INT8)i;
(*gpItem)[0]->data.objectStatus = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
//Update the trap level
i = GetNumericStrictValueFromField( 2 );
i = ( i == -1 ) ? 0 : min( i, 20 );
if( i != gpItem->bTrap )
if( i != (*gpItem)[0]->data.bTrap )
gbDefaultBombTrapLevel = (INT8)i;
gpItem->bTrap = (INT8)i;
(*gpItem)[0]->data.bTrap = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 2, i );
if( gpEditingItemPool )
@@ -1188,29 +1241,29 @@ void AlarmTriggerCheckboxCallback( GUI_BUTTON *btn, INT32 reason )
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
if( btn->uiFlags & BUTTON_CLICKED_ON )
gpItem->fFlags |= OBJECT_ALARM_TRIGGER;
(*gpItem).fFlags |= OBJECT_ALARM_TRIGGER;
else
gpItem->fFlags &= ~OBJECT_ALARM_TRIGGER;
(*gpItem).fFlags &= ~OBJECT_ALARM_TRIGGER;
}
}
void SetupTriggersGUI()
{
CHAR16 str[4];
swprintf( str, L"%d", gpItem->bTrap );
swprintf( str, L"%d", (*gpItem)[0]->data.bTrap );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 365, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
swprintf( str, L"%d", gpItem->ItemData.Trigger.Area.ubTolerance );
swprintf( str, L"%d", (*gpItem)[0]->data.misc.ubTolerance );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 385, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
if( gpEditingItemPool )
{
swprintf( str, L"%d", 100 - gWorldItems[ gpEditingItemPool->iItemIndex ].ubNonExistChance );
AddTextInputField( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 440, 25, 15, MSYS_PRIORITY_NORMAL, str, 3, INPUTTYPE_NUMERICSTRICT );
if( gpItem->ItemData.Trigger.BombTrigger.bFrequency <= PANIC_FREQUENCY && gpItem->ItemData.Trigger.BombTrigger.bFrequency >= PANIC_FREQUENCY_3 )
if( (*gpItem)[0]->data.misc.bFrequency <= PANIC_FREQUENCY && (*gpItem)[0]->data.misc.bFrequency >= PANIC_FREQUENCY_3 )
{
giAlarmTriggerButton =
giAlarmTriggerButton =
CreateCheckBoxButton( iScreenWidthOffset + 485, 2 * iScreenHeightOffset + 405, "EDITOR//smCheckBox.sti", MSYS_PRIORITY_NORMAL, AlarmTriggerCheckboxCallback );
SetButtonFastHelpText( giAlarmTriggerButton, L"If the panic trigger is an alarm trigger,\nenemies won't attempt to use it if they\nare already aware of your presence.");
if( gpItem->fFlags & OBJECT_ALARM_TRIGGER )
if( (*gpItem).fFlags & OBJECT_ALARM_TRIGGER )
ButtonList[ giAlarmTriggerButton ]->uiFlags |= BUTTON_CLICKED_ON;
}
}
@@ -1222,12 +1275,12 @@ void ExtractAndUpdateTriggersGUI()
//Update the trap level
i = GetNumericStrictValueFromField( 1 );
i = ( i == -1 ) ? 0 : min( i, 20 );
gpItem->bTrap = (INT8)i;
(*gpItem)[0]->data.bTrap = (INT8)i;
SetInputFieldStringWithNumericStrictValue( 1, i );
i = GetNumericStrictValueFromField( 2 );
i = ( i == -1 ) ? 0 : max( 0, min( i, 99 ) );
gpItem->ItemData.Trigger.Area.ubTolerance = (UINT8)i;
(*gpItem)[0]->data.misc.ubTolerance = (UINT8)i;
SetInputFieldStringWithNumericStrictValue( 2, i );
if( gpEditingItemPool )
@@ -1241,7 +1294,7 @@ void ExtractAndUpdateTriggersGUI()
void RemoveTriggersGUI()
{
if( gpEditingItemPool && gpItem->ItemData.Trigger.BombTrigger.bFrequency <= PANIC_FREQUENCY && gpItem->ItemData.Trigger.BombTrigger.bFrequency >= PANIC_FREQUENCY_3 )
if( gpEditingItemPool && (*gpItem)[0]->data.misc.bFrequency <= PANIC_FREQUENCY && (*gpItem)[0]->data.misc.bFrequency >= PANIC_FREQUENCY_3 )
{
if( giAlarmTriggerButton != -1 )
{
@@ -1257,7 +1310,6 @@ void ToggleAttachment( GUI_BUTTON *btn, INT32 reason )
{
INT32 i;
UINT16 usAttachment = 0;
OBJECTTYPE temp;
for( i = 0; i < NUM_ATTACHMENT_BUTTONS; i++ )
{ //Loop through and find the button that was just modified
switch( i )
@@ -1276,17 +1328,16 @@ void ToggleAttachment( GUI_BUTTON *btn, INT32 reason )
{
gfAttachment[ i ] = TRUE;
btn->uiFlags |= BUTTON_CLICKED_ON;
CreateItem( usAttachment, gpItem->ItemData.Gun.bGunStatus, &temp );
AttachObject( NULL, gpItem, &temp );
CreateItem( usAttachment, (*gpItem)[0]->data.gun.bGunStatus, &gTempObject );
gpItem->AttachObject( NULL, &gTempObject );
}
else
{ //Button is out, so remove the attachment
INT8 slot;
gfAttachment[ i ] = FALSE;
btn->uiFlags &= ~BUTTON_CLICKED_ON;
slot = FindAttachment( gpItem, usAttachment );
if( slot != -1 )
RemoveAttachment( gpItem, slot, &temp );
OBJECTTYPE* pAttachment = FindAttachment( gpItem, usAttachment );
if( pAttachment )
gpItem->RemoveAttachment( pAttachment );
}
}
}
@@ -1298,21 +1349,19 @@ void ToggleCeramicPlates( GUI_BUTTON *btn, INT32 reason )
{
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
OBJECTTYPE temp;
gfCeramicPlates ^= TRUE;
if( gfCeramicPlates )
{
btn->uiFlags |= BUTTON_CLICKED_ON;
CreateItem( CERAMIC_PLATES, gpItem->ItemData.Generic.bStatus[0], &temp );
AttachObject( NULL, gpItem, &temp );
CreateItem( CERAMIC_PLATES, (*gpItem)[0]->data.objectStatus, &gTempObject );
gpItem->AttachObject( NULL, &gTempObject );
}
else
{
INT8 slot;
btn->uiFlags &= ~BUTTON_CLICKED_ON;
slot = FindAttachment( gpItem, CERAMIC_PLATES );
if( slot != -1 )
RemoveAttachment( gpItem, slot, &temp );
OBJECTTYPE* pAttachment = FindAttachment( gpItem, CERAMIC_PLATES );
if( pAttachment )
gpItem->RemoveAttachment( pAttachment );
}
}
}
@@ -1321,22 +1370,20 @@ void ToggleDetonator( GUI_BUTTON *btn, INT32 reason )
{
if( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
OBJECTTYPE temp;
if( !gfDetonator )
{
gfDetonator = TRUE;
btn->uiFlags |= BUTTON_CLICKED_ON;
CreateItem( DETONATOR, gpItem->ItemData.Generic.bStatus[0], &temp );
AttachObject( NULL, gpItem, &temp );
CreateItem( DETONATOR, (*gpItem)[0]->data.objectStatus, &gTempObject );
gpItem->AttachObject( NULL, &gTempObject );
}
else
{ //Button is out, so remove the attachment
INT8 slot;
gfDetonator = FALSE;
btn->uiFlags &= ~BUTTON_CLICKED_ON;
slot = FindAttachment( gpItem, DETONATOR );
if( slot != -1 )
RemoveAttachment( gpItem, slot, &temp );
OBJECTTYPE* pAttachment = FindAttachment( gpItem, DETONATOR );
if( pAttachment )
gpItem->RemoveAttachment( pAttachment );
}
}
}
@@ -1352,133 +1399,133 @@ void ActionItemCallback( GUI_BUTTON *btn, INT32 reason )
void ChangeActionItem( OBJECTTYPE *pItem, INT8 bActionItemIndex )
{
pItem->usItem = ACTION_ITEM;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_BLOW_UP;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BLOW_UP;
switch( bActionItemIndex )
{
case ACTIONITEM_TRIP_KLAXON:
pItem->ItemData.Trigger.usBombItem = TRIP_KLAXON;
(*pItem)[0]->data.misc.usBombItem = TRIP_KLAXON;
break;
case ACTIONITEM_FLARE:
pItem->ItemData.Trigger.usBombItem = TRIP_FLARE;
(*pItem)[0]->data.misc.usBombItem = TRIP_FLARE;
break;
case ACTIONITEM_TEARGAS:
pItem->ItemData.Trigger.usBombItem = TEARGAS_GRENADE;
(*pItem)[0]->data.misc.usBombItem = TEARGAS_GRENADE;
break;
case ACTIONITEM_STUN:
pItem->ItemData.Trigger.usBombItem = STUN_GRENADE;
(*pItem)[0]->data.misc.usBombItem = STUN_GRENADE;
break;
case ACTIONITEM_SMOKE:
pItem->ItemData.Trigger.usBombItem = SMOKE_GRENADE;
case ACTIONITEM_SMOKE:
(*pItem)[0]->data.misc.usBombItem = SMOKE_GRENADE;
break;
case ACTIONITEM_MUSTARD:
pItem->ItemData.Trigger.usBombItem = MUSTARD_GRENADE;
(*pItem)[0]->data.misc.usBombItem = MUSTARD_GRENADE;
break;
case ACTIONITEM_MINE:
pItem->ItemData.Trigger.usBombItem = MINE;
(*pItem)[0]->data.misc.usBombItem = MINE;
break;
case ACTIONITEM_OPEN:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_OPEN_DOOR;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_OPEN_DOOR;
break;
case ACTIONITEM_CLOSE:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_CLOSE_DOOR;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_CLOSE_DOOR;
break;
case ACTIONITEM_UNLOCK_DOOR:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_UNLOCK_DOOR;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_UNLOCK_DOOR;
break;
case ACTIONITEM_TOGGLE_LOCK:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_LOCK;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_LOCK;
break;
case ACTIONITEM_UNTRAP_DOOR:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_UNTRAP_DOOR;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_UNTRAP_DOOR;
break;
case ACTIONITEM_TOGGLE_PRESSURE_ITEMS:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_PRESSURE_ITEMS;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_PRESSURE_ITEMS;
break;
case ACTIONITEM_SMPIT:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_SMALL_PIT;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_SMALL_PIT;
break;
case ACTIONITEM_LGPIT:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_LARGE_PIT;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_LARGE_PIT;
break;
case ACTIONITEM_TOGGLE_DOOR:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_DOOR;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_DOOR;
break;
case ACTIONITEM_TOGGLE_ACTION1:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION1;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_ACTION1;
break;
case ACTIONITEM_TOGGLE_ACTION2:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION2;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_ACTION2;
break;
case ACTIONITEM_TOGGLE_ACTION3:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION3;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_ACTION3;
break;
case ACTIONITEM_TOGGLE_ACTION4:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_TOGGLE_ACTION4;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_TOGGLE_ACTION4;
break;
case ACTIONITEM_ENTER_BROTHEL:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_ENTER_BROTHEL;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_ENTER_BROTHEL;
break;
case ACTIONITEM_EXIT_BROTHEL:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_EXIT_BROTHEL;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_EXIT_BROTHEL;
break;
case ACTIONITEM_KINGPIN_ALARM:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_KINGPIN_ALARM;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_KINGPIN_ALARM;
break;
case ACTIONITEM_SEX:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_SEX;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_SEX;
break;
case ACTIONITEM_REVEAL_ROOM:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_REVEAL_ROOM;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_REVEAL_ROOM;
break;
case ACTIONITEM_LOCAL_ALARM:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_LOCAL_ALARM;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_LOCAL_ALARM;
break;
case ACTIONITEM_GLOBAL_ALARM:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_GLOBAL_ALARM;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_GLOBAL_ALARM;
break;
case ACTIONITEM_KLAXON:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_KLAXON;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_KLAXON;
break;
case ACTIONITEM_SMALL:
pItem->ItemData.Trigger.usBombItem = HAND_GRENADE;
(*pItem)[0]->data.misc.usBombItem = HAND_GRENADE;
break;
case ACTIONITEM_MEDIUM:
pItem->ItemData.Trigger.usBombItem = TNT;
(*pItem)[0]->data.misc.usBombItem = TNT;
break;
case ACTIONITEM_LARGE:
pItem->ItemData.Trigger.usBombItem = C4;
(*pItem)[0]->data.misc.usBombItem = C4;
break;
case ACTIONITEM_MUSEUM_ALARM:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_MUSEUM_ALARM;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_MUSEUM_ALARM;
break;
case ACTIONITEM_BLOODCAT_ALARM:
pItem->ItemData.Trigger.usBombItem = NOTHING;
pItem->ItemData.Trigger.bActionValue = ACTION_ITEM_BLOODCAT_ALARM;
(*pItem)[0]->data.misc.usBombItem = NOTHING;
(*pItem)[0]->data.misc.bActionValue = ACTION_ITEM_BLOODCAT_ALARM;
break;
case ACTIONITEM_BIG_TEAR_GAS:
pItem->ItemData.Trigger.usBombItem = BIG_TEAR_GAS;
(*pItem)[0]->data.misc.usBombItem = BIG_TEAR_GAS;
break;
}
@@ -1494,9 +1541,9 @@ void UpdateActionItem( INT8 bActionItemIndex )
//If the previous item was a pit, remove it before changing it
if( gpItem->usItem == ACTION_ITEM )
{
if( gpItem->ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT )
if( (*gpItem)[0]->data.misc.bActionValue == ACTION_ITEM_SMALL_PIT )
Remove3X3Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
else if( gpItem->ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT )
else if( (*gpItem)[0]->data.misc.bActionValue == ACTION_ITEM_LARGE_PIT )
Remove5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
}
@@ -1506,9 +1553,9 @@ void UpdateActionItem( INT8 bActionItemIndex )
//If the new item is a pit, add it so we can see how it looks.
if( gpItem->usItem == ACTION_ITEM )
{
if( gpItem->ItemData.Trigger.bActionValue == ACTION_ITEM_SMALL_PIT )
if( (*gpItem)[0]->data.misc.bActionValue == ACTION_ITEM_SMALL_PIT )
Add3X3Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
else if( gpItem->ItemData.Trigger.bActionValue == ACTION_ITEM_LARGE_PIT )
else if( (*gpItem)[0]->data.misc.bActionValue == ACTION_ITEM_LARGE_PIT )
Add5X5Pit( gWorldItems[ gpItemPool->iItemIndex ].sGridNo );
}
}
+10 -5
View File
@@ -4,12 +4,17 @@
#ifndef __ITEM_STATISTICS_H
#define __ITEM_STATISTICS_H
#include "Item Types.h"
//#include "Item Types.h"
//forward declarations of common classes to eliminate includes
class OBJECTTYPE;
class SOLDIERTYPE;
//Handles the dynamic changing of text input fields and button modes depending on the currently edited
//item. Both the merc's inventory panel, and the items tab use the same code to accomplish this.
//item. Both the merc's inventory panel, and the items tab use the same code to accomplish this.
//Set if we are editing items from the items tab. Otherwise, it is assumed that we are
//Set if we are editing items from the items tab. Otherwise, it is assumed that we are
//editing items from the merc's inventory panel.
extern BOOLEAN gfItemEditingMode;
@@ -40,8 +45,8 @@ void ExecuteItemStatsCmd( UINT8 ubAction );
extern OBJECTTYPE *gpItem;
extern INT16 gsItemGridNo;
//enumerations for all of the different action items. Used by the popup menu for
//changing the type of action item. When modified, an equivalent text array must be
//enumerations for all of the different action items. Used by the popup menu for
//changing the type of action item. When modified, an equivalent text array must be
//changed as well.
enum
{
+4 -2
View File
@@ -948,6 +948,8 @@ UINT32 ProcessFileIO()
CreateMessageBox( L" Error loading file. Try another filename?" );
return LOADSAVE_SCREEN;
}
//ADB these are NOT set yet! but they need to be, duh
CompileWorldMovementCosts();
SetGlobalSectorValues( gzFilename );
RestoreFontSettings();
@@ -958,9 +960,9 @@ UINT32 ProcessFileIO()
//UpdateMercsInSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
AddSoldierInitListTeamToWorld( ENEMY_TEAM, 255 );
AddSoldierInitListTeamToWorld( CREATURE_TEAM, 255 );
AddSoldierInitListTeamToWorld( CREATURE_TEAM, 255 );
AddSoldierInitListTeamToWorld( MILITIA_TEAM, 255 );
AddSoldierInitListTeamToWorld( CIV_TEAM, 255 );
AddSoldierInitListTeamToWorld( CIV_TEAM, 255 );
iCurrentAction = ACTION_NULL;
gbCurrentFileIOStatus = IOSTATUS_NONE;
if( !gfCaves && !gfBasement )
+12 -12
View File
@@ -23,10 +23,10 @@ typedef struct MACROSTRUCT
}MACROSTRUCT;
//road macros
//These define the macros for the 32 road pieces. The column contains the macro ID and
//These define the macros for the 32 road pieces. The column contains the macro ID and
//the second contains the gridno offset from the anchor position (where the user clicks in the world to
//place the road). The actual index of the array refers to the offset from ROADPIECE001.
MACROSTRUCT gRoadMacros[] =
//place the road). The actual index of the array refers to the offset from ROADPIECE001.
MACROSTRUCT gRoadMacros[] =
{
//left 1
{L1, -2 },
@@ -148,19 +148,19 @@ MACROSTRUCT gRoadMacros[] =
{RTL, -322 },
{RTL, -482 },
{RTL, -642 },
{RTL, -802 },
{RTL, -802 },
{RTL, -1 },
{RTL, -161 },
{RTL, -321 },
{RTL, -481 },
{RTL, -641 },
{RTL, -801 },
{RTL, -801 },
{RTL, 0 },
{RTL, -160 },
{RTL, -320 },
{RTL, -480 },
{RTL, -640 },
{RTL, -800 },
{RTL, -800 },
//right half of top-left corner
{RBR, 159 },
{RBR, -1 },
@@ -376,7 +376,7 @@ MACROSTRUCT gRoadMacros[] =
INT16 gsRoadMacroStartIndex[ NUM_ROAD_MACROS ];
//A simple optimization function that calculates the first index in the large database for
//A simple optimization function that calculates the first index in the large database for
//the particular macro ID.
void InitializeRoadMacros()
{
@@ -398,7 +398,7 @@ void InitializeRoadMacros()
// i = ROADPIECES001;
}
//Road macros vary in size from 3 gridnos to 18 gridnos. Using the anchor gridno based off of the original
//Road macros vary in size from 3 gridnos to 18 gridnos. Using the anchor gridno based off of the original
//road system, this function will place the new macro (consisting of multiple road pieces in multiple
//gridnos).
void PlaceRoadMacroAtGridNo( INT32 iMapIndex, INT32 iMacroID )
@@ -416,10 +416,10 @@ void PlaceRoadMacroAtGridNo( INT32 iMapIndex, INT32 iMacroID )
}
}
//The old road system used multi-tiled roads as a single image. The new road system has taken these large
//pieces and chopped them up into single tiled images (to mitigate lighting problems). Some of the larger
//road pieces turned into 18 smaller pieces. So this function will go analyse the world, and replaces any
//locations containing the original road tile information, delete it, and replace it by inserting it's
//The old road system used multi-tiled roads as a single image. The new road system has taken these large
//pieces and chopped them up into single tiled images (to mitigate lighting problems). Some of the larger
//road pieces turned into 18 smaller pieces. So this function will go analyse the world, and replaces any
//locations containing the original road tile information, delete it, and replace it by inserting it's
//equivalent macro.
void ReplaceObsoleteRoads()
{
+7 -7
View File
@@ -5,7 +5,7 @@
#ifndef __ROAD_SMOOTHING_H
#define __ROAD_SMOOTHING_H
//There are the 32 macro definitions that make up all of the road pieces. These enumerations
//There are the 32 macro definitions that make up all of the road pieces. These enumerations
//match up exactly to the previous road system order of graphics (FIRSTROAD1 - FIRSTROAD32)
enum
{
@@ -21,7 +21,7 @@ enum
RTL, //right top-left corner piece
RBR, //right bottom-right corner piece
LBR, //left bottom-right corner piece
L2, //left 2 (variation of the left 1)
L2, //left 2 (variation of the left 1)
R2, //right 2
L3, //left 3
R3, //right 3
@@ -32,7 +32,7 @@ enum
BI, //bottom intersection (piece connecting bottom to right)
LI, //left intersection (piece connecting left to bottom )
TI, //top intersection (piece connecting top to left)
RI, //right intersection (piece connection right to top)
RI, //right intersection (piece connection right to top)
L4, //left 4
R4, //right 4
B4, //bottom 4
@@ -44,14 +44,14 @@ enum
NUM_ROAD_MACROS
};
//The old road system used multi-tiled roads as a single image. The new road system has taken these large
//pieces and chopped them up into single tiled images (to mitigate lighting problems). Some of the larger
//road pieces turned into 18 smaller pieces. So this function will go analyse the world, and replaces any
//The old road system used multi-tiled roads as a single image. The new road system has taken these large
//pieces and chopped them up into single tiled images (to mitigate lighting problems). Some of the larger
//road pieces turned into 18 smaller pieces. So this function will go analyse the world, and replaces any
//locations containing the original road tile information, delete it, and replace it by inserting it's
//equivalent macro.
void ReplaceObsoleteRoads();
//Road macros vary in size from 3 gridnos to 18 gridnos. Using the anchor gridno based off of the original
//Road macros vary in size from 3 gridnos to 18 gridnos. Using the anchor gridno based off of the original
//road system, this function will place the new macro (consisting of multiple road pieces in multiple
//gridnos).
void PlaceRoadMacroAtGridNo( INT32 iMapIndex, INT32 iMacroID );
+46 -44
View File
@@ -37,6 +37,8 @@
#include "World Items.h"
#include "text.h"
#include "Soldier Create.h"
#include "GameVersion.h"
#include "Campaign Types.h"
#endif
extern BOOLEAN gfOverheadMapDirty;
@@ -475,19 +477,19 @@ void DestroySummaryWindow()
if( gpWorldItemsSummaryArray )
{
MemFree( gpWorldItemsSummaryArray );
delete[]( gpWorldItemsSummaryArray );
gpWorldItemsSummaryArray = NULL;
gusWorldItemsSummaryArraySize = 0;
}
if( gpPEnemyItemsSummaryArray )
{
MemFree( gpPEnemyItemsSummaryArray );
delete[]( gpPEnemyItemsSummaryArray );
gpPEnemyItemsSummaryArray = NULL;
gusPEnemyItemsSummaryArraySize = 0;
}
if( gpNEnemyItemsSummaryArray )
{
MemFree( gpNEnemyItemsSummaryArray );
delete[]( gpNEnemyItemsSummaryArray );
gpNEnemyItemsSummaryArray = NULL;
gusNEnemyItemsSummaryArraySize = 0;
}
@@ -709,27 +711,27 @@ void RenderItemDetails()
{
if( index == SWITCH || index == ACTION_ITEM )
{
if( gpWorldItemsSummaryArray[ i ].o.usItem == index )
if( gpWorldItemsSummaryArray[ i ].object.usItem == index )
{
if( gubSummaryItemMode == ITEMMODE_SCIFI && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_REALISTIC_ONLY) ||
gubSummaryItemMode == ITEMMODE_REAL && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_SCIFI_ONLY) )
gubSummaryItemMode == ITEMMODE_REAL && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_SCIFI_ONLY) )
{
pItem = &gpWorldItemsSummaryArray[ i ].o;
if( !pItem->ItemData.Trigger.BombTrigger.bFrequency )
pItem = &gpWorldItemsSummaryArray[ i ].object;
if( !(*pItem)[0]->data.misc.bFrequency )
bFreqIndex = 7;
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY )
else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY )
bFreqIndex = 0;
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_2 )
else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY_2 )
bFreqIndex = 1;
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == PANIC_FREQUENCY_3 )
else if( (*pItem)[0]->data.misc.bFrequency == PANIC_FREQUENCY_3 )
bFreqIndex = 2;
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 1 )
else if( (*pItem)[0]->data.misc.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 1 )
bFreqIndex = 3;
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 2 )
else if( (*pItem)[0]->data.misc.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 2 )
bFreqIndex = 4;
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 3 )
else if( (*pItem)[0]->data.misc.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 3 )
bFreqIndex = 5;
else if( pItem->ItemData.Trigger.BombTrigger.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 4 )
else if( (*pItem)[0]->data.misc.bFrequency == FIRST_MAP_PLACED_FREQUENCY + 4 )
bFreqIndex = 6;
else
continue;
@@ -747,15 +749,14 @@ void RenderItemDetails()
}
continue;
}
if( gpWorldItemsSummaryArray[ i ].o.usItem == index )
if( gpWorldItemsSummaryArray[ i ].object.usItem == index )
{
if( gubSummaryItemMode == ITEMMODE_SCIFI && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_REALISTIC_ONLY) ||
gubSummaryItemMode == ITEMMODE_REAL && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_SCIFI_ONLY) )
gubSummaryItemMode == ITEMMODE_REAL && !(gpWorldItemsSummaryArray[ i ].usFlags & WORLD_ITEM_SCIFI_ONLY) )
{
pItem = &gpWorldItemsSummaryArray[ i ].o;
pItem = &gpWorldItemsSummaryArray[ i ].object;
uiExistChance += (100 - gpWorldItemsSummaryArray[ i ].ubNonExistChance) * pItem->ubNumberOfObjects;
uiStatus += pItem->ItemData.Generic.bStatus[0];
uiQuantity += pItem->ubNumberOfObjects;
uiStatus += (*pItem)[0]->data.objectStatus;
}
}
}
@@ -862,7 +863,7 @@ void RenderItemDetails()
{
pItem = &gpPEnemyItemsSummaryArray[ i ];
uiExistChance += 100 * pItem->ubNumberOfObjects;
uiStatus += pItem->ItemData.Generic.bStatus[0];
uiStatus += (*pItem)[0]->data.objectStatus;
uiQuantity += pItem->ubNumberOfObjects;
}
}
@@ -934,7 +935,7 @@ void RenderItemDetails()
{
pItem = &gpNEnemyItemsSummaryArray[ i ];
uiExistChance += 100 * pItem->ubNumberOfObjects;
uiStatus += pItem->ItemData.Generic.bStatus[0];
uiStatus += (*pItem)[0]->data.objectStatus;
uiQuantity += pItem->ubNumberOfObjects;
}
}
@@ -2014,7 +2015,7 @@ void MapClickCallback( MOUSE_REGION *reg, INT32 reason )
}
if( gpWorldItemsSummaryArray )
{
MemFree( gpWorldItemsSummaryArray );
delete[]( gpWorldItemsSummaryArray );
gpWorldItemsSummaryArray = NULL;
gusWorldItemsSummaryArraySize = 0;
}
@@ -2230,7 +2231,7 @@ void LoadGlobalSummary()
STRING512 MapsDir;
UINT32 uiNumBytesRead;
FLOAT dMajorVersion;
INT32 x,y;
INT32 x,y;
CHAR8 szFilename[40];
CHAR8 szSector[6];
@@ -2758,7 +2759,7 @@ void SummaryUpdateCallback( GUI_BUTTON *btn, INT32 reason )
// ADB: The current sector summary should be set to the array value, not the other way around.
// Also the sector X and Y values are 1-based and the array is 0-based. So subtract 1 from X and Y
gpCurrentSectorSummary = gpSectorSummary[ gsSelSectorX - 1][ gsSelSectorY - 1][ giCurrLevel ];
gfRenderSummary = TRUE;
RemoveProgressBar( 0 );
@@ -2913,6 +2914,9 @@ void ApologizeOverrideAndForceUpdateEverything()
gusNumberOfMapsToBeForceUpdated = 0;
}
//CHRISL: ADB changed the way this load file is handled
extern int gEnemyPreservedTempFileVersion[256];
extern int gCivPreservedTempFileVersion[256];
void SetupItemDetailsMode( BOOLEAN fAllowRecursion )
{
HWFILE hfile;
@@ -2929,19 +2933,19 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion )
//Clear memory for all the item summaries loaded
if( gpWorldItemsSummaryArray )
{
MemFree( gpWorldItemsSummaryArray );
delete[]( gpWorldItemsSummaryArray );
gpWorldItemsSummaryArray = NULL;
gusWorldItemsSummaryArraySize = 0;
}
if( gpPEnemyItemsSummaryArray )
{
MemFree( gpPEnemyItemsSummaryArray );
delete[]( gpPEnemyItemsSummaryArray );
gpPEnemyItemsSummaryArray = NULL;
gusPEnemyItemsSummaryArraySize = 0;
}
if( gpNEnemyItemsSummaryArray )
{
MemFree( gpNEnemyItemsSummaryArray );
delete[]( gpNEnemyItemsSummaryArray );
gpNEnemyItemsSummaryArray = NULL;
gusNEnemyItemsSummaryArraySize = 0;
}
@@ -2993,9 +2997,12 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion )
ShowButton( iSummaryButton[ SUMMARY_SCIFI ] );
ShowButton( iSummaryButton[ SUMMARY_REAL ] );
ShowButton( iSummaryButton[ SUMMARY_ENEMY ] );
gpWorldItemsSummaryArray = (WORLDITEM*)MemAlloc( sizeof( WORLDITEM ) * uiNumItems );
gpWorldItemsSummaryArray = new WORLDITEM[ uiNumItems ];
gusWorldItemsSummaryArraySize = gpCurrentSectorSummary->usNumItems;
FileRead( hfile, gpWorldItemsSummaryArray, sizeof( WORLDITEM ) * uiNumItems, &uiNumBytesRead );
for (unsigned int x = 0; x < uiNumItems; ++x)
{
gpWorldItemsSummaryArray[x].Load(hfile);
}
//NOW, do the enemy's items!
//We need to do two passes. The first pass simply processes all the enemies and counts all the droppable items
@@ -3020,9 +3027,7 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion )
}
if( basic.fDetailedPlacement )
{ //skip static priority placement
// WDS - Clean up inventory handling
FileRead( hfile, &priority, SIZEOF_SOLDIERCREATE_STRUCT, &uiNumBytesRead );
if( uiNumBytesRead != SIZEOF_SOLDIERCREATE_STRUCT )
if ( !priority.Load(hfile, SAVE_GAME_VERSION, false) )
{ //Invalid situation.
FileClose( hfile );
return;
@@ -3039,7 +3044,7 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion )
for( j = 0; j < 9; j++ )
{
pItem = &priority.Inv[ gbMercSlotTypes[ j ] ];
if( pItem->usItem != NOTHING && !( pItem->fFlags & OBJECT_UNDROPPABLE ) )
if( pItem->exists() == true && !( (*pItem).fFlags & OBJECT_UNDROPPABLE ) )
{
usNumItems++;
}
@@ -3058,13 +3063,11 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion )
//Pass 1 completed, so now allocate enough space to hold all the items
if( gusPEnemyItemsSummaryArraySize )
{
gpPEnemyItemsSummaryArray = (OBJECTTYPE*)MemAlloc( sizeof( OBJECTTYPE ) * gusPEnemyItemsSummaryArraySize );
memset( gpPEnemyItemsSummaryArray, 0, sizeof( OBJECTTYPE ) * gusPEnemyItemsSummaryArraySize );
gpPEnemyItemsSummaryArray = new OBJECTTYPE[ gusPEnemyItemsSummaryArraySize ];
}
if( gusNEnemyItemsSummaryArraySize )
{
gpNEnemyItemsSummaryArray = (OBJECTTYPE*)MemAlloc( sizeof( OBJECTTYPE ) * gusNEnemyItemsSummaryArraySize );
memset( gpNEnemyItemsSummaryArray, 0, sizeof( OBJECTTYPE ) * gusNEnemyItemsSummaryArraySize );
gpNEnemyItemsSummaryArray = new OBJECTTYPE[ gusNEnemyItemsSummaryArraySize ];
}
//PASS #2
@@ -3085,9 +3088,7 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion )
}
if( basic.fDetailedPlacement )
{ //skip static priority placement
// WDS - Clean up inventory handling
FileRead( hfile, &priority, SIZEOF_SOLDIERCREATE_STRUCT, &uiNumBytesRead );
if( uiNumBytesRead != SIZEOF_SOLDIERCREATE_STRUCT )
if ( !priority.Load(hfile, SAVE_GAME_VERSION, false) )
{ //Invalid situation.
FileClose( hfile );
return;
@@ -3104,16 +3105,16 @@ void SetupItemDetailsMode( BOOLEAN fAllowRecursion )
for( j = 0; j < 9; j++ )
{
pItem = &priority.Inv[ gbMercSlotTypes[ j ] ];
if( pItem->usItem != NOTHING && !( pItem->fFlags & OBJECT_UNDROPPABLE ) )
if( pItem->exists() == true && !( (*pItem).fFlags & OBJECT_UNDROPPABLE ) )
{
if( basic.fPriorityExistance )
{
memcpy( &(gpPEnemyItemsSummaryArray[ usPEnemyIndex ]), pItem, sizeof( OBJECTTYPE ) );
gpPEnemyItemsSummaryArray[ usPEnemyIndex ] = *pItem;
usPEnemyIndex++;
}
else
{
memcpy( &(gpNEnemyItemsSummaryArray[ usNEnemyIndex ]), pItem, sizeof( OBJECTTYPE ) );
gpNEnemyItemsSummaryArray[ usNEnemyIndex ] = *pItem;
usNEnemyIndex++;
}
}
@@ -3150,4 +3151,5 @@ void ClearSummaryInfo()
}
}
#endif
#endif
+65 -64
View File
@@ -28,7 +28,7 @@ void CalcSmartWallDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex )
void CalcSmartDoorDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex )
{
*pusUseIndex = 4 * ( gubDoorUIValue % 2 ); //open or closed -- odd or even
*pusObjIndex = FIRSTDOOR + gubDoorUIValue / 2;
*pusObjIndex = FIRSTDOOR + gubDoorUIValue / 2;
}
void CalcSmartWindowDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex )
@@ -42,8 +42,8 @@ void CalcSmartBrokenWallDefault( UINT16 *pusObjIndex, UINT16 *pusUseIndex )
switch( gubBrokenWallUIValue )
{
case 0:case 1: *pusUseIndex = 49 + gubBrokenWallUIValue; break;
case 3: *pusUseIndex = 62; break;
case 4: *pusUseIndex = 64; break;
case 3: *pusUseIndex = 62; break;
case 4: *pusUseIndex = 64; break;
}
*pusObjIndex = FIRSTWALL;
}
@@ -56,7 +56,7 @@ UINT16 CalcSmartWindowIndex( UINT16 usWallOrientation )
UINT16 CalcSmartDoorIndex( UINT16 usWallOrientation )
{
//convert the orientation values as the graphics are in reverse order
//orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4
//orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4
//door graphics order: INSIDE_TOP_LEFT=15, INSIDE_TOP_RIGHT=10, OUTSIDE_TOP_LEFT=5, OUTSIDE_TOP_RIGHT=0
usWallOrientation = (4 - usWallOrientation) * 5;
//4 * (gubDoorUIValue%2) evaluates to +4 if the door is open, 0 if closed
@@ -75,19 +75,19 @@ UINT16 CalcSmartBrokenWallIndex( UINT16 usWallOrientation )
if( gubBrokenWallUIValue < 2 ) //broken walls
{
//convert the orientation value as the graphics are in a different order.
//orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4
// 4 6 8 10
//door graphics order: INSIDE_TOP_LEFT=4, INSIDE_TOP_RIGHT=6, OUTSIDE_TOP_LEFT=0, OUTSIDE_TOP_RIGHT=2
//orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4
// 4 6 8 10
//door graphics order: INSIDE_TOP_LEFT=4, INSIDE_TOP_RIGHT=6, OUTSIDE_TOP_LEFT=0, OUTSIDE_TOP_RIGHT=2
usWallOrientation = usWallOrientation * 2 + 2;
usWallOrientation -= usWallOrientation > 6 ? 8 : 0;
return (UINT16)( usWallOrientation + 48 + gubBrokenWallUIValue );
}
//cracked and smudged walls
//convert the orientation value as the graphics are in a different order.
//orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4
//door graphics order: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=5, OUTSIDE_TOP_RIGHT=6
//orientation values: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=3, OUTSIDE_TOP_RIGHT=4
//door graphics order: INSIDE_TOP_LEFT=1, INSIDE_TOP_RIGHT=2, OUTSIDE_TOP_LEFT=5, OUTSIDE_TOP_RIGHT=6
usWallOrientation += usWallOrientation > 1 ? 2 : 0;
usWallOrientation += gubBrokenWallUIValue == 4 ? 2 : 0; //smudged type which is 2 index values higher.
return (UINT16)( usWallOrientation + 57 );
@@ -135,7 +135,7 @@ void DecSmartBrokenWallUIValue()
BOOLEAN CalcWallInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusWallType, UINT16 *pusIndex )
{
return FALSE;
return FALSE;
}
BOOLEAN CalcDoorInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusDoorType, UINT16 *pusIndex )
@@ -205,7 +205,7 @@ BOOLEAN CalcBrokenWallInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusWallTyp
LEVELNODE *pWall = NULL;
UINT32 uiTileType;
UINT16 usWallOrientation;
if( gubBrokenWallUIValue == 2 ) //the hole in the wall
{
*pusWallType = 0xffff;
@@ -247,25 +247,25 @@ BOOLEAN CalcBrokenWallInfoUsingSmartMethod( UINT32 iMapIndex, UINT16 *pusWallTyp
}
//This is a very difficult function to document properly. The reason being is that it is sooo
//subliminal by nature. I have thought up of priorities and choose the best piece to draw based
//on the surrounding conditions. Here are the priorities which are referenced below via comments:
//A) If there is currently a bottom piece and a right piece, immediately exit.
//B) We are currently over a bottom piece. Now, we don't automatically want to draw a right piece here
// for multiple reasons. First, the UI will be too quick and place bottom and right pieces for every
// place the user clicks, which isn't what we want. Therefore, we look to see if there is a right
// piece in the y-1 gridno. It would then make sense to place a right piece down here. Regardless,
//This is a very difficult function to document properly. The reason being is that it is sooo
//subliminal by nature. I have thought up of priorities and choose the best piece to draw based
//on the surrounding conditions. Here are the priorities which are referenced below via comments:
//A) If there is currently a bottom piece and a right piece, immediately exit.
//B) We are currently over a bottom piece. Now, we don't automatically want to draw a right piece here
// for multiple reasons. First, the UI will be too quick and place bottom and right pieces for every
// place the user clicks, which isn't what we want. Therefore, we look to see if there is a right
// piece in the y-1 gridno. It would then make sense to place a right piece down here. Regardless,
// if we encounter a bottom piece here, we will exit.
//C) This is the counterpart to B, but we are looking at a current right piece, and are determining if
//C) This is the counterpart to B, but we are looking at a current right piece, and are determining if
// we should place a bottom piece based on another bottom piece existing in the x-1 gridno.
//D) Now, we analyse the neighboring tiles and determine the orientations that would add weight to the
// current tile either towards drawing a horizontal piece or a vertical piece.
//E) Now that we have the information, we give the highest priority to any weights that match the current
// wall piece type selected by the user. Based on that, we will only consider the best match of the
// type and use it. If there are no matches on type, we continue.
//F) We failed to find weights matching the current wall type, but before we give up using the user's wall
// type, there are two more cases. When there is a bottom wall in the y+1 position or a right wall in
// the x+1 position. If there are matching walls, there, then we draw two pieces to connect the current
//D) Now, we analyse the neighboring tiles and determine the orientations that would add weight to the
// current tile either towards drawing a horizontal piece or a vertical piece.
//E) Now that we have the information, we give the highest priority to any weights that match the current
// wall piece type selected by the user. Based on that, we will only consider the best match of the
// type and use it. If there are no matches on type, we continue.
//F) We failed to find weights matching the current wall type, but before we give up using the user's wall
// type, there are two more cases. When there is a bottom wall in the y+1 position or a right wall in
// the x+1 position. If there are matching walls, there, then we draw two pieces to connect the current
// gridno with the respective position.
void PasteSmartWall( UINT32 iMapIndex )
{
@@ -273,7 +273,7 @@ void PasteSmartWall( UINT32 iMapIndex )
static UINT32 iAloneMapIndex = 0x8000;
UINT16 usWallType;
//These are the counters for the walls of each type
//These are the counters for the walls of each type
UINT16 usNumV[4]={0,0,0,0}; //vertical wall weights
UINT16 usNumH[4]={0,0,0,0}; //horizontal wall weights
@@ -282,8 +282,8 @@ void PasteSmartWall( UINT32 iMapIndex )
return;
//*B* See above documentation
usWallType = GetHorizontalWallType( iMapIndex );
if( usWallType )
{
if( usWallType )
{
if( usWallType == gubWallUIValue )
{
usWallType = GetVerticalWallType( iMapIndex - WORLD_COLS );
@@ -312,12 +312,12 @@ void PasteSmartWall( UINT32 iMapIndex )
}
}
}
return;
return;
}
//*C* See above documentation
usWallType = GetVerticalWallType( iMapIndex );
if( usWallType )
{
if( usWallType )
{
if( usWallType == gubWallUIValue )
{
usWallType = GetHorizontalWallType( iMapIndex - 1 );
@@ -329,25 +329,25 @@ void PasteSmartWall( UINT32 iMapIndex )
BuildWallPiece( iMapIndex, INTERIOR_BOTTOM, gubWallUIValue );
}
}
return;
return;
}
//*D* See above documentation
//Evaluate left adjacent tile
//Evaluate left adjacent tile
if( usWallType = GetVerticalWallType( iMapIndex - 1 ) )
usNumH[ usWallType - FIRSTWALL ]++;
usNumH[ usWallType - FIRSTWALL ]++;
if( usWallType = GetHorizontalWallType( iMapIndex - 1 ) )
usNumH[ usWallType - FIRSTWALL ]++;
//Evaluate right adjacent tile
//Evaluate right adjacent tile
if( usWallType = GetHorizontalWallType( iMapIndex + 1 ) )
usNumH[ usWallType - FIRSTWALL ]++;
//Evaluate upper adjacent tile
usNumH[ usWallType - FIRSTWALL ]++;
//Evaluate upper adjacent tile
if( usWallType = GetVerticalWallType( iMapIndex - WORLD_COLS ) )
usNumV[ usWallType - FIRSTWALL ]++;
usNumV[ usWallType - FIRSTWALL ]++;
if( usWallType = GetHorizontalWallType( iMapIndex - WORLD_COLS ) )
usNumV[ usWallType - FIRSTWALL ]++;
//Evaluate lower adjacent tile
//Evaluate lower adjacent tile
if( usWallType = GetVerticalWallType( iMapIndex + WORLD_COLS ) )
usNumV[ usWallType - FIRSTWALL ]++;
usNumV[ usWallType - FIRSTWALL ]++;
//*E* See above documentation
if( usNumV[gubWallUIValue - FIRSTWALL] | usNumH[gubWallUIValue - FIRSTWALL] )
{
@@ -357,11 +357,11 @@ void PasteSmartWall( UINT32 iMapIndex )
{ //inside
BuildWallPiece( iMapIndex, EXTERIOR_RIGHT, gubWallUIValue );
//Change to extended piece if it is a new top right corner to cover the end part.
if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS + 1 )
if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS + 1 )
&& !GetVerticalWall( iMapIndex - WORLD_COLS ) )
ChangeVerticalWall( iMapIndex, INTERIOR_EXTENDED );
else if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 )
&& !GetVerticalWall( iMapIndex - WORLD_COLS - 1 ) )
else if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 )
&& !GetVerticalWall( iMapIndex - WORLD_COLS - 1 ) )
{
ChangeVerticalWall( iMapIndex, INTERIOR_EXTENDED );
EraseHorizontalWall( iMapIndex - WORLD_COLS );
@@ -370,11 +370,11 @@ void PasteSmartWall( UINT32 iMapIndex )
else
{ //outside
BuildWallPiece( iMapIndex, INTERIOR_RIGHT, gubWallUIValue );
if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS + 1 )
if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS + 1 )
&& !GetVerticalWall( iMapIndex - WORLD_COLS ) )
ChangeVerticalWall( iMapIndex, EXTERIOR_EXTENDED );
else if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 )
&& !GetVerticalWall( iMapIndex - WORLD_COLS - 1 ) )
else if( GetHorizontalWall( iMapIndex - WORLD_COLS ) && !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 )
&& !GetVerticalWall( iMapIndex - WORLD_COLS - 1 ) )
{
ChangeVerticalWall( iMapIndex, EXTERIOR_EXTENDED );
EraseHorizontalWall( iMapIndex - WORLD_COLS );
@@ -383,29 +383,29 @@ void PasteSmartWall( UINT32 iMapIndex )
}
else
{
if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex - WORLD_COLS - 1 )
&& !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 ) )
if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex - WORLD_COLS - 1 )
&& !GetHorizontalWall( iMapIndex - WORLD_COLS - 1 ) )
EraseVerticalWall( iMapIndex - 1);
if( FloorAtGridNo( iMapIndex + WORLD_COLS ) )
{ //inside
BuildWallPiece( iMapIndex, EXTERIOR_BOTTOM, gubWallUIValue );
if( GetVerticalWall( iMapIndex + WORLD_COLS ) )
if( GetVerticalWall( iMapIndex + WORLD_COLS ) )
ChangeVerticalWall( iMapIndex + WORLD_COLS, INTERIOR_EXTENDED );
if( GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) && !GetVerticalWall( iMapIndex - 1 ) )
ChangeVerticalWall( iMapIndex + WORLD_COLS - 1, INTERIOR_EXTENDED );
else if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex + WORLD_COLS - 1 )
&& FloorAtGridNo( iMapIndex ) )
ChangeVerticalWall( iMapIndex + WORLD_COLS - 1, INTERIOR_EXTENDED );
else if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex + WORLD_COLS - 1 )
&& FloorAtGridNo( iMapIndex ) )
ChangeVerticalWall( iMapIndex - 1, INTERIOR_BOTTOMEND );
}
else
{ //outside
BuildWallPiece( iMapIndex, INTERIOR_BOTTOM, gubWallUIValue );
if( GetVerticalWall( iMapIndex + WORLD_COLS ) )
if( GetVerticalWall( iMapIndex + WORLD_COLS ) )
ChangeVerticalWall( iMapIndex + WORLD_COLS, EXTERIOR_EXTENDED );
if( GetVerticalWall( iMapIndex + WORLD_COLS - 1 ) && !GetVerticalWall( iMapIndex - 1 ) )
ChangeVerticalWall( iMapIndex + WORLD_COLS - 1, EXTERIOR_EXTENDED );
else if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex + WORLD_COLS - 1 )
&& FloorAtGridNo( iMapIndex ) )
ChangeVerticalWall( iMapIndex + WORLD_COLS - 1, EXTERIOR_EXTENDED );
else if( GetVerticalWall( iMapIndex - 1 ) && !GetVerticalWall( iMapIndex + WORLD_COLS - 1 )
&& FloorAtGridNo( iMapIndex ) )
ChangeVerticalWall( iMapIndex - 1, EXTERIOR_BOTTOMEND );
}
}
@@ -441,7 +441,7 @@ void PasteSmartWall( UINT32 iMapIndex )
if( usWallType == gubWallUIValue )
{
if(FloorAtGridNo( iMapIndex + WORLD_COLS ) )
{ //inside
{ //inside
BuildWallPiece( iMapIndex + 1, EXTERIOR_BOTTOM, gubWallUIValue );
BuildWallPiece( iMapIndex, EXTERIOR_BOTTOM, gubWallUIValue );
if( !GetVerticalWall( iMapIndex - WORLD_COLS + 1 ) )
@@ -457,7 +457,7 @@ void PasteSmartWall( UINT32 iMapIndex )
else
ChangeVerticalWall( iMapIndex + 1, INTERIOR_BOTTOMEND );
}
}
}
else
{ //outside
BuildWallPiece( iMapIndex + 1, INTERIOR_BOTTOM, gubWallUIValue );
@@ -533,7 +533,7 @@ void PasteSmartWindow( UINT32 iMapIndex )
GetWallOrientation( pWall->usIndex, &usWallOrientation );
usIndex = CalcSmartWindowIndex( usWallOrientation );
//Calculate the new graphic for the window type selected.
AddToUndoList( iMapIndex );
GetTileIndexFromTypeSubIndex( usWallType, usIndex, &usNewWallIndex );
ReplaceStructIndex( iMapIndex, pWall->usIndex, usNewWallIndex );
@@ -623,6 +623,7 @@ void PasteSmartBrokenWall( UINT32 iMapIndex )
+15 -15
View File
@@ -6,7 +6,7 @@
#ifdef JA2EDITOR
#ifndef PRECOMPILEDHEADERS
#ifndef PRECOMPILEDHEADERS
#include <stdlib.h>
#include "worlddef.h" //for LEVELNODE def
#include "worldman.h" //for RemoveXXXX()
@@ -22,7 +22,7 @@
extern UINT16 PickAWallPiece( UINT16 usWallPieceType );
//This method isn't foolproof, but because erasing large areas of buildings could result in
//multiple wall types for each building. When processing the region, it is necessary to
//multiple wall types for each building. When processing the region, it is necessary to
//calculate the roof type by searching for the nearest roof tile.
UINT16 SearchForWallType( UINT32 iMapIndex )
{
@@ -40,7 +40,7 @@ UINT16 SearchForWallType( UINT32 iMapIndex )
}
while( sRadius < 32 )
{
//NOTE: start at the higher y value and go negative because it is possible to have another
//NOTE: start at the higher y value and go negative because it is possible to have another
// structure type one tile north, but not one tile south -- so it'll find the correct wall first.
for( y = sRadius; y >= -sRadius; y-- ) for( x = -sRadius; x <= sRadius; x++ )
{
@@ -73,7 +73,7 @@ UINT16 SearchForWallType( UINT32 iMapIndex )
}
//This method isn't foolproof, but because erasing large areas of buildings could result in
//multiple roof types for each building. When processing the region, it is necessary to
//multiple roof types for each building. When processing the region, it is necessary to
//calculate the roof type by searching for the nearest roof tile.
UINT16 SearchForRoofType( UINT32 iMapIndex )
{
@@ -108,7 +108,7 @@ UINT16 SearchForRoofType( UINT32 iMapIndex )
}
return 0xffff;
}
BOOLEAN RoofAtGridNo( UINT32 iMapIndex )
{
LEVELNODE *pRoof;
@@ -139,7 +139,7 @@ BOOLEAN BuildingAtGridNo( UINT32 iMapIndex )
BOOLEAN ValidDecalPlacement( UINT32 iMapIndex )
{
if( GetVerticalWall( iMapIndex ) || GetHorizontalWall( iMapIndex )
if( GetVerticalWall( iMapIndex ) || GetHorizontalWall( iMapIndex )
|| GetVerticalFence( iMapIndex ) || GetHorizontalFence( iMapIndex ) )
return TRUE;
return FALSE;
@@ -157,7 +157,7 @@ LEVELNODE* GetVerticalWall( UINT32 iMapIndex )
{
GetTileType( pStruct->usIndex, &uiTileType );
if ( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL ||
uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR )
uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR )
{
GetWallOrientation( pStruct->usIndex, &usWallOrientation );
if( usWallOrientation == INSIDE_TOP_RIGHT || usWallOrientation == OUTSIDE_TOP_RIGHT )
@@ -183,7 +183,7 @@ LEVELNODE* GetHorizontalWall( UINT32 iMapIndex )
{
GetTileType( pStruct->usIndex, &uiTileType );
if ( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL ||
uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR )
uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR )
{
GetWallOrientation( pStruct->usIndex, &usWallOrientation );
if( usWallOrientation == INSIDE_TOP_LEFT || usWallOrientation == OUTSIDE_TOP_LEFT )
@@ -398,12 +398,12 @@ void RestoreWalls( UINT32 iMapIndex )
{
return;
}
//we are in a special case here. The user is attempting to restore a wall, though nothing
//is here. We will hook into the smart wall method by tricking it into using the local wall
//we are in a special case here. The user is attempting to restore a wall, though nothing
//is here. We will hook into the smart wall method by tricking it into using the local wall
//type, but only if we have adjacent walls.
fDone = FALSE;
if( pWall = GetHorizontalWall( iMapIndex - 1 ) )
fDone = TRUE;
fDone = TRUE;
if( !fDone && (pWall = GetHorizontalWall( iMapIndex + 1 )) )
fDone = TRUE;
if( !fDone && (pWall = GetVerticalWall( iMapIndex - WORLD_COLS )) )
@@ -412,7 +412,7 @@ void RestoreWalls( UINT32 iMapIndex )
fDone = TRUE;
if( !fDone )
return;
//found a wall. Let's back up the current wall value, and restore it after pasting a smart wall.
//found a wall. Let's back up the current wall value, and restore it after pasting a smart wall.
if( pWall )
{
GetTileType( pWall->usIndex, &uiTileType );
@@ -422,7 +422,7 @@ void RestoreWalls( UINT32 iMapIndex )
if( usWallType != 0xffff )
{
ubSaveWallUIValue = gubWallUIValue; //save the wall UI value.
gubWallUIValue = (UINT8)usWallType; //trick the UI value
gubWallUIValue = (UINT8)usWallType; //trick the UI value
PasteSmartWall( iMapIndex ); //paste smart wall with fake UI value
gubWallUIValue = ubSaveWallUIValue; //restore the real UI value.
}
@@ -443,7 +443,7 @@ UINT16 GetWallClass( LEVELNODE *pWall )
{
if( usWallIndex == gbWallTileLUT[row][col] )
{
return row; //row is the wall class
return row; //row is the wall class
}
}
}
@@ -466,4 +466,4 @@ UINT16 GetHorizontalWallClass( UINT16 iMapIndex )
return 0xffff;
}
#endif
#endif
+5 -5
View File
@@ -65,10 +65,10 @@ typedef struct SUMMARYFILE
// //-----
// 190
//start version 10
EXITGRID ExitGrid[4]; //5*4 // 20
UINT16 usExitGridSize[4]; //2*4 // 8
BOOLEAN fInvalidDest[4]; // 4
UINT8 ubNumExitGridDests; // 1
EXITGRID ExitGrid[4]; //5*4 // 20
UINT16 usExitGridSize[4]; //2*4 // 8
BOOLEAN fInvalidDest[4]; // 4
UINT8 ubNumExitGridDests; // 1
BOOLEAN fTooManyExitGridDests; // 1
// //-----
// // 224
@@ -77,7 +77,7 @@ typedef struct SUMMARYFILE
// //-----
// 225
//start version 12
UINT16 usWarningRoomNums; // 2
UINT16 usWarningRoomNums; // 2
// 227
//start version 13
UINT8 ubEnemiesHaveWaypoints; // 1
+172 -175
View File
@@ -39,9 +39,9 @@ void PasteTextureEx( INT16 sGridNo, UINT16 usType );
void PasteTextureFromRadiusEx( INT16 sGridNo, UINT16 usType, UINT8 ubRadius );
BOOLEAN gfWarning = FALSE;
BOOLEAN gfWarning = FALSE;
BOOLEAN gfDoFill = FALSE;
BOOLEAN gfDoFill = FALSE;
UINT16 CurrentPaste = NO_TILE;
UINT16 gDebrisPaste = NO_TILE;
UINT16 gChangeElevation = FALSE;
@@ -78,9 +78,9 @@ void DeleteStuffFromMapTile( UINT32 iMapIndex )
//UINT32 uiCheckType;
//UINT16 usDummy;
//GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex, &uiCheckType );
//RemoveLand( iMapIndex, gpWorldLevelData[ iMapIndex ].pLandHead->usIndex );
//SmoothTerrainRadius( iMapIndex, uiCheckType, 1, TRUE );
//GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex, &uiCheckType );
//RemoveLand( iMapIndex, gpWorldLevelData[ iMapIndex ].pLandHead->usIndex );
//SmoothTerrainRadius( iMapIndex, uiCheckType, 1, TRUE );
RemoveExitGridFromWorld( iMapIndex );
RemoveAllStructsOfTypeRange( iMapIndex, FIRSTTEXTURE, WIREFRAMES );
@@ -122,20 +122,20 @@ void EraseMapTile( UINT32 iMapIndex )
case DRAW_MODE_EXITGRID:
AddToUndoList( iMapIndex );
RemoveExitGridFromWorld( iMapIndex );
RemoveTopmost( (UINT16)iMapIndex, FIRSTPOINTERS8 );
RemoveTopmost( (INT16)iMapIndex, FIRSTPOINTERS8 );
break;
case DRAW_MODE_GROUND:
case DRAW_MODE_GROUND:
// Is there ground on this tile? if not, get out o here
if ( gpWorldLevelData[ iMapIndex ].pLandHead == NULL )
break;
// is there only 1 ground tile here? if so, get out o here
if ( gpWorldLevelData[ iMapIndex ].pLandHead->pNext == NULL )
break;
AddToUndoList( iMapIndex );
GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex, &uiCheckType );
RemoveLand( iMapIndex, gpWorldLevelData[ iMapIndex ].pLandHead->usIndex );
SmoothTerrainRadius( iMapIndex, uiCheckType, 1, TRUE );
GetTileType( gpWorldLevelData[ iMapIndex ].pLandHead->usIndex, &uiCheckType );
RemoveLand( iMapIndex, gpWorldLevelData[ iMapIndex ].pLandHead->usIndex );
SmoothTerrainRadius( iMapIndex, uiCheckType, 1, TRUE );
break;
case DRAW_MODE_OSTRUCTS:
case DRAW_MODE_OSTRUCTS1:
@@ -217,7 +217,7 @@ void EraseMapTile( UINT32 iMapIndex )
//---------------------------------------------------------------------------------------------------------------
// PasteDebris
//
//
// Place some "debris" on the map at the current mouse coordinates. This function is called repeatedly if
// the current brush size is larger than 1 tile.
//
@@ -232,7 +232,7 @@ void PasteDebris( UINT32 iMapIndex )
pNumSelList = &iNumDebrisSelected;
if ( iMapIndex < 0x8000 )
{
{
AddToUndoList( iMapIndex );
// Remove any debris that is currently at this map location
@@ -343,7 +343,7 @@ void PasteSingleToilet( UINT32 iMapIndex )
// PasteSingleWallCommon
//
// Common paste routine for PasteSingleWall, PasteSingleDoor, PasteSingleDecoration, and
// PasteSingleDecor (above).
// PasteSingleDecor (above).
//
void PasteSingleWallCommon( UINT32 iMapIndex )
{
@@ -352,7 +352,7 @@ void PasteSingleWallCommon( UINT32 iMapIndex )
UINT16 usTempIndex;
if ( iMapIndex < 0x8000 )
{
{
AddToUndoList( iMapIndex );
usUseIndex = pSelList[ iCurBank ].usIndex;
@@ -360,7 +360,7 @@ void PasteSingleWallCommon( UINT32 iMapIndex )
// TEMP STUFF FOR ONROOF THINGS!
if ( (usUseObjIndex >= FIRSTONROOF) && (usUseObjIndex <= SECONDONROOF ) )
{
{
// Add to onroof section!
AddOnRoofToTail( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) );
@@ -382,7 +382,7 @@ void PasteSingleWallCommon( UINT32 iMapIndex )
{
// PLace shadow for doors
if( !gfBasement )
AddExclusiveShadow( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex - FIRSTDOOR + FIRSTDOORSHADOW ] + usUseIndex ) );
AddExclusiveShadow( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex - FIRSTDOOR + FIRSTDOORSHADOW ] + usUseIndex ) );
}
// Is it a wall?
@@ -399,15 +399,15 @@ void PasteSingleWallCommon( UINT32 iMapIndex )
// Slap down wall/window/door/decoration (no smoothing)
AddWallToStructLayer( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex), TRUE );
}
}
}
// Is it a door/window/decoration?
else if ( ( (usUseObjIndex >= FIRSTDOOR) && (usUseObjIndex <= LASTDOOR)) ||
((usUseObjIndex >= FIRSTDECORATIONS) && (usUseObjIndex <= LASTDECORATIONS)) )
((usUseObjIndex >= FIRSTDECORATIONS) && (usUseObjIndex <= LASTDECORATIONS)) )
{
// Slap down wall/window/door/decoration (no smoothing)
AddWallToStructLayer( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex), TRUE );
}
else if ( ((usUseObjIndex >= FIRSTROOF) && (usUseObjIndex <= LASTROOF)) ||
else if ( ((usUseObjIndex >= FIRSTROOF) && (usUseObjIndex <= LASTROOF)) ||
((usUseObjIndex >= FIRSTSLANTROOF) && (usUseObjIndex <= LASTSLANTROOF)) )
{
// Put a roof on this tile (even if nothing else is here)
@@ -423,7 +423,7 @@ void PasteSingleWallCommon( UINT32 iMapIndex )
AddLandToHead( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) );
}
else if( usUseObjIndex >= FIRSTWALLDECAL && usUseObjIndex <= LASTWALLDECAL ||
usUseObjIndex >= FIFTHWALLDECAL && usUseObjIndex <= EIGTHWALLDECAL )
usUseObjIndex >= FIFTHWALLDECAL && usUseObjIndex <= EIGTHWALLDECAL )
{
// Plop a decal here
RemoveAllStructsOfTypeRange( iMapIndex, FIRSTWALLDECAL, LASTWALLDECAL );
@@ -431,7 +431,7 @@ void PasteSingleWallCommon( UINT32 iMapIndex )
AddStructToTail( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) );
}
else if ( usUseObjIndex >= FIRSTISTRUCT && usUseObjIndex <= LASTISTRUCT ||
else if ( usUseObjIndex >= FIRSTISTRUCT && usUseObjIndex <= LASTISTRUCT ||
usUseObjIndex >= FIFTHISTRUCT && usUseObjIndex <= EIGHTISTRUCT )
{
AddStructToHead( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) );
@@ -460,7 +460,7 @@ UINT16 GetRandomIndexByRange( UINT16 usRangeStart, UINT16 usRangeEnd )
usNumInPickList = 0;
for ( usWhich = 0; usWhich < *pNumSelList; usWhich++ )
{
usObject = (UINT16)pSelList[ usWhich ].uiObject;
usObject = (UINT16)pSelList[ usWhich ].uiObject;
if ( (usObject >= usRangeStart) && (usObject <= usRangeEnd) )
{
usPickList[ usNumInPickList ] = usObject;
@@ -476,15 +476,15 @@ UINT16 GetRandomTypeByRange( UINT16 usRangeStart, UINT16 usRangeEnd )
UINT16 usNumInPickList;
UINT16 i;
UINT16 usObject;
UINT32 uiType;
UINT32 uiType;
// Get a list of valid object to select from
usNumInPickList = 0;
for ( i = 0; i < *pNumSelList; i++ )
{
usObject = (UINT16)pSelList[ i ].uiObject;
usObject = (UINT16)pSelList[ i ].uiObject;
if ( (usObject >= usRangeStart) && (usObject <= usRangeEnd) )
{
GetTileType( usObject, &uiType );
GetTileType( usObject, &uiType );
usPickList[ usNumInPickList ] = (UINT16)uiType;
usNumInPickList++;
}
@@ -495,7 +495,7 @@ UINT16 GetRandomTypeByRange( UINT16 usRangeStart, UINT16 usRangeEnd )
//---------------------------------------------------------------------------------------------------------------
// PasteStructure (See also PasteStructure1, PasteStructure2, and PasteStructureCommon)
//
//
// Puts a structure (trees, trucks, etc.) into the world
//
void PasteStructure( UINT32 iMapIndex )
@@ -508,7 +508,7 @@ void PasteStructure( UINT32 iMapIndex )
//---------------------------------------------------------------------------------------------------------------
// PasteStructure1 (See also PasteStructure, PasteStructure2, and PasteStructureCommon)
//
//
// Puts a structure (trees, trucks, etc.) into the world
//
void PasteStructure1( UINT32 iMapIndex )
@@ -521,7 +521,7 @@ void PasteStructure1( UINT32 iMapIndex )
//---------------------------------------------------------------------------------------------------------------
// PasteStructure2 (See also PasteStructure, PasteStructure1, and PasteStructureCommon)
//
//
// Puts a structure (trees, trucks, etc.) into the world
//
void PasteStructure2( UINT32 iMapIndex )
@@ -541,7 +541,6 @@ void PasteStructure2( UINT32 iMapIndex )
//
void PasteStructureCommon( UINT32 iMapIndex )
{
// BOOLEAN fDoPaste = FALSE;
UINT32 fHeadType;
UINT16 usUseIndex;
UINT16 usUseObjIndex;
@@ -549,7 +548,7 @@ void PasteStructureCommon( UINT32 iMapIndex )
BOOLEAN fOkayToAdd;
if ( iMapIndex < 0x8000 )
{
{
/*
if ( gpWorldLevelData[ iMapIndex ].pStructHead != NULL )
{
@@ -566,7 +565,7 @@ void PasteStructureCommon( UINT32 iMapIndex )
iRandSelIndex = GetRandomSelection( );
if ( iRandSelIndex == -1 )
{
return;
return;
}
AddToUndoList( iMapIndex );
@@ -581,9 +580,9 @@ void PasteStructureCommon( UINT32 iMapIndex )
// Actual structure info is added by the functions below
AddStructToHead( iMapIndex, (UINT16)(gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex) );
// For now, adjust to shadows by a hard-coded amount,
// Add mask if in long grass
GetLandHeadType( iMapIndex, &fHeadType );
GetLandHeadType( iMapIndex, &fHeadType );
}
}
}
@@ -606,7 +605,7 @@ void PasteBanks( UINT32 iMapIndex, UINT16 usStructIndex , BOOLEAN fReplace)
UINT16 usUseIndex;
UINT16 usUseObjIndex;
UINT16 usIndex;
pSelList = SelBanks;
pNumSelList = &iNumBanksSelected;
@@ -614,10 +613,10 @@ void PasteBanks( UINT32 iMapIndex, UINT16 usStructIndex , BOOLEAN fReplace)
usUseObjIndex = (UINT16)pSelList[ iCurBank ].uiObject;
if ( iMapIndex < 0x8000 )
{
{
fDoPaste = TRUE;
if ( gpWorldLevelData[ iMapIndex ].pStructHead != NULL )
if ( gpWorldLevelData[ iMapIndex ].pStructHead != NULL )
{
// CHECK IF THE SAME TILE IS HERE
if ( gpWorldLevelData[ iMapIndex ].pStructHead->usIndex == (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) )
@@ -647,7 +646,7 @@ void PasteBanks( UINT32 iMapIndex, UINT16 usStructIndex , BOOLEAN fReplace)
{
AddStructToHead( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex ] + usUseIndex ) );
// Add shadows
if ( !gfBasement && usUseObjIndex == FIRSTCLIFF )
if ( !gfBasement && usUseObjIndex == FIRSTCLIFF )
{
//AddShadowToHead( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex - FIRSTCLIFF + FIRSTCLIFFSHADOW ] + usUseIndex ) );
AddObjectToHead( iMapIndex, (UINT16)( gTileTypeStartIndex[ usUseObjIndex - FIRSTCLIFF + FIRSTCLIFFHANG ] + usUseIndex ) );
@@ -661,7 +660,7 @@ void PasteBanks( UINT32 iMapIndex, UINT16 usStructIndex , BOOLEAN fReplace)
void PasteRoads( UINT32 iMapIndex )
{
UINT16 usUseIndex;
pSelList = SelRoads;
pNumSelList = &iNumRoadsSelected;
@@ -691,56 +690,56 @@ void PasteTexture( UINT32 iMapIndex )
//
void PasteTextureCommon( UINT32 iMapIndex )
{
UINT8 ubLastHighLevel;
UINT16 usTileIndex;
//UINT16 Dummy;
if ( CurrentPaste != NO_TILE && iMapIndex < 0x8000 )
{
UINT8 ubLastHighLevel;
UINT16 usTileIndex;
//UINT16 Dummy;
// Set undo, then set new
AddToUndoList( iMapIndex );
if ( CurrentPaste != NO_TILE && iMapIndex < 0x8000 )
{
if ( CurrentPaste == DEEPWATERTEXTURE )
{
// IF WE ARE PASTING DEEP WATER AND WE ARE NOT OVER WATER, IGNORE!
if ( TypeExistsInLandLayer( iMapIndex, REGWATERTEXTURE, &usTileIndex ) )
{
// Set undo, then set new
AddToUndoList( iMapIndex );
if ( CurrentPaste == DEEPWATERTEXTURE )
{
// IF WE ARE PASTING DEEP WATER AND WE ARE NOT OVER WATER, IGNORE!
if ( TypeExistsInLandLayer( iMapIndex, REGWATERTEXTURE, &usTileIndex ) )
{
if ( !gTileDatabase[ usTileIndex ].ubFullTile )
{
return;
return;
}
}
else
{
}
else
{
return;
}
}
}
}
// Don't draw over floors
if ( TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, FOURTHFLOOR, &usTileIndex ) )
{
return;
}
// Don't draw over floors
if ( TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, FOURTHFLOOR, &usTileIndex ) )
{
return;
}
// Compare heights and do appropriate action
if ( AnyHeigherLand( iMapIndex, CurrentPaste, &ubLastHighLevel ) )
{
// Here we do the following:
// - Remove old type from layer
// - Smooth World with old type
// - Add a 3 by 3 square of new type at head
// - Smooth World with new type
PasteHigherTexture( iMapIndex, CurrentPaste );
// Compare heights and do appropriate action
if ( AnyHeigherLand( iMapIndex, CurrentPaste, &ubLastHighLevel ) )
{
// Here we do the following:
// - Remove old type from layer
// - Smooth World with old type
// - Add a 3 by 3 square of new type at head
// - Smooth World with new type
PasteHigherTexture( iMapIndex, CurrentPaste );
}
else
{
}
else
{
PasteTextureEx( (INT16)iMapIndex, CurrentPaste );
SmoothTerrainRadius( iMapIndex, CurrentPaste, 1, TRUE );
}
}
}
}
@@ -753,17 +752,17 @@ void PasteTextureCommon( UINT32 iMapIndex )
//
void PasteHigherTexture( UINT32 iMapIndex, UINT32 fNewType )
{
UINT16 NewTile;
UINT8 ubLastHighLevel;
UINT32 *puiDeletedTypes = NULL;
UINT8 ubNumTypes;
UINT8 cnt;
UINT16 NewTile;
UINT8 ubLastHighLevel;
UINT32 *puiDeletedTypes = NULL;
UINT8 ubNumTypes;
UINT8 cnt;
// Here we do the following:
// - Remove old type from layer
// - Smooth World with old type
// - Add a 3 by 3 square of new type at head
// - Smooth World with new type
// Here we do the following:
// - Remove old type from layer
// - Smooth World with old type
// - Add a 3 by 3 square of new type at head
// - Smooth World with new type
//if ( iMapIndex < 0x8000 && TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, LASTFLOOR, &NewTile ) )
//ATE: DONOT DO THIS!!!!!!! - I know what was intended - not to draw over floors - this
@@ -771,41 +770,41 @@ void PasteHigherTexture( UINT32 iMapIndex, UINT32 fNewType )
//return;
if ( iMapIndex < 0x8000 && AnyHeigherLand( iMapIndex, fNewType, &ubLastHighLevel ))
{
AddToUndoList( iMapIndex );
if ( iMapIndex < 0x8000 && AnyHeigherLand( iMapIndex, fNewType, &ubLastHighLevel ))
{
AddToUndoList( iMapIndex );
// - For all heigher level, remove
RemoveHigherLandLevels( iMapIndex, fNewType, &puiDeletedTypes, &ubNumTypes );
// - For all heigher level, remove
RemoveHigherLandLevels( iMapIndex, fNewType, &puiDeletedTypes, &ubNumTypes );
// Set with a radius of 1 and smooth according to height difference
SetLowerLandIndexWithRadius( iMapIndex, fNewType, 1 , TRUE );
// Set with a radius of 1 and smooth according to height difference
SetLowerLandIndexWithRadius( iMapIndex, fNewType, 1 , TRUE );
// Smooth all deleted levels
for ( cnt = 0; cnt < ubNumTypes; cnt++ )
{
// Smooth all deleted levels
for ( cnt = 0; cnt < ubNumTypes; cnt++ )
{
SmoothTerrainRadius( iMapIndex, puiDeletedTypes[ cnt ], 1, TRUE );
}
}
MemFree( puiDeletedTypes );
MemFree( puiDeletedTypes );
}
else if ( iMapIndex < 0x8000 )
{
}
else if ( iMapIndex < 0x8000 )
{
AddToUndoList( iMapIndex );
GetTileIndexFromTypeSubIndex( fNewType, REQUIRES_SMOOTHING_TILE, &NewTile );
GetTileIndexFromTypeSubIndex( fNewType, REQUIRES_SMOOTHING_TILE, &NewTile );
SetLandIndex( iMapIndex, NewTile, fNewType, FALSE );
// Smooth item then adding here
SmoothTerrain( iMapIndex, fNewType, &NewTile, FALSE );
if ( NewTile != NO_TILE )
{
if ( NewTile != NO_TILE )
{
// Change tile
SetLandIndex( iMapIndex, NewTile, fNewType, FALSE );
}
}
}
}
}
@@ -816,17 +815,17 @@ void PasteHigherTexture( UINT32 iMapIndex, UINT32 fNewType )
//
BOOLEAN PasteHigherTextureFromRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ubRadius )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT32 iNewIndex;
INT32 iXPos,iYPos;
// Determine start and end indicies and num rows
sTop = ubRadius;
sBottom = -ubRadius;
sLeft = -ubRadius;
sRight = ubRadius;
sLeft = -ubRadius;
sRight = ubRadius;
iXPos = (iMapIndex % WORLD_COLS);
iYPos = (iMapIndex - iXPos) / WORLD_COLS;
@@ -870,7 +869,7 @@ BOOLEAN PasteExistingTexture( UINT32 iMapIndex, UINT16 usIndex )
//UINT16 Dummy;
// If here, we want to make, esentially, what is a type in
// a level other than TOP-MOST the TOP-MOST level.
// a level other than TOP-MOST the TOP-MOST level.
// We should:
// - remove what was top-most
// - re-adjust the world to reflect missing top-most peice
@@ -881,7 +880,7 @@ BOOLEAN PasteExistingTexture( UINT32 iMapIndex, UINT16 usIndex )
//if ( TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, LASTFLOOR, &Dummy ) )
// return( FALSE );
// Get top tile index
// Get top tile index
// Remove all land peices except
GetTileType( usIndex, &uiNewType );
@@ -899,7 +898,7 @@ BOOLEAN PasteExistingTexture( UINT32 iMapIndex, UINT16 usIndex )
SetLandIndex( iMapIndex, usIndex, uiNewType, FALSE );
// ATE: Set this land peice to require smoothing again!
SmoothAllTerrainTypeRadius( iMapIndex, 2, TRUE );
SmoothAllTerrainTypeRadius( iMapIndex, 2, TRUE );
return( TRUE );
}
@@ -912,21 +911,21 @@ BOOLEAN PasteExistingTexture( UINT32 iMapIndex, UINT16 usIndex )
//
BOOLEAN PasteExistingTextureFromRadius( INT32 iMapIndex, UINT16 usIndex, UINT8 ubRadius )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT32 iNewIndex;
INT32 leftmost;
// Determine start end end indicies and num rows
sTop = ubRadius;
sBottom = -ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
if ( iMapIndex >= 0x8000 )
return ( FALSE );
for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ )
{
@@ -936,8 +935,8 @@ BOOLEAN PasteExistingTextureFromRadius( INT32 iMapIndex, UINT16 usIndex, UINT8 u
{
iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2;
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
{
AddToUndoList( iMapIndex );
PasteExistingTexture( iNewIndex, usIndex );
@@ -961,20 +960,20 @@ BOOLEAN SetLowerLandIndexWithRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ub
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT32 iNewIndex;
INT32 iNewIndex;
BOOLEAN fDoPaste = FALSE;
INT32 leftmost;
UINT8 ubLastHighLevel;
UINT32 *puiSmoothTiles = NULL;
INT16 sNumSmoothTiles = 0;
UINT32 *puiSmoothTiles = NULL;
INT16 sNumSmoothTiles = 0;
UINT16 usTemp;
UINT16 NewTile; //,Dummy;
// Determine start end end indicies and num rows
sTop = ubRadius;
sBottom = -ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
if ( iMapIndex >= 0x8000 )
return ( FALSE );
@@ -988,8 +987,8 @@ BOOLEAN SetLowerLandIndexWithRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ub
{
iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2;
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
{
if ( fReplace )
@@ -1003,9 +1002,9 @@ BOOLEAN SetLowerLandIndexWithRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ub
fDoPaste = TRUE;
}
}
//if ( fDoPaste && !TypeRangeExistsInLandLayer( iMapIndex, FIRSTFLOOR, LASTFLOOR, &Dummy ) )
if ( fDoPaste )
if ( fDoPaste )
{
if ( iMapIndex == iNewIndex )
{
@@ -1046,7 +1045,7 @@ BOOLEAN SetLowerLandIndexWithRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ub
// Once here, smooth any tiles that need it
if ( sNumSmoothTiles > 0 )
{
for ( cnt1 = 0; cnt1 < sNumSmoothTiles; cnt1++ )
for ( cnt1 = 0; cnt1 < sNumSmoothTiles; cnt1++ )
{
SmoothTerrainRadius( puiSmoothTiles[ cnt1 ], uiNewType, 10, FALSE );
@@ -1062,17 +1061,17 @@ BOOLEAN SetLowerLandIndexWithRadius( INT32 iMapIndex, UINT32 uiNewType, UINT8 ub
void PasteTextureEx( INT16 sGridNo, UINT16 usType )
{
UINT16 usIndex;
UINT8 ubTypeLevel;
UINT8 ubTypeLevel;
UINT16 NewTile;
// CHECK IF THIS TEXTURE EXISTS!
if ( TypeExistsInLandLayer( sGridNo, usType, &usIndex ) )
{
if ( TypeExistsInLandLayer( sGridNo, usType, &usIndex ) )
{
if ( GetTypeLandLevel( sGridNo, usType, &ubTypeLevel ) )
{
// If top-land , do not change
if ( ubTypeLevel != LANDHEAD )
{
{
PasteExistingTexture( sGridNo, usIndex );
}
}
@@ -1080,10 +1079,10 @@ void PasteTextureEx( INT16 sGridNo, UINT16 usType )
else
{
// Fill with just first tile, smoothworld() will pick proper piece later
GetTileIndexFromTypeSubIndex( usType, REQUIRES_SMOOTHING_TILE, &NewTile );
// Fill with just first tile, smoothworld() will pick proper piece later
GetTileIndexFromTypeSubIndex( usType, REQUIRES_SMOOTHING_TILE, &NewTile );
SetLandIndex( sGridNo, NewTile, usType, FALSE );
SetLandIndex( sGridNo, NewTile, usType, FALSE );
}
}
@@ -1091,21 +1090,21 @@ void PasteTextureEx( INT16 sGridNo, UINT16 usType )
void PasteTextureFromRadiusEx( INT16 sGridNo, UINT16 usType, UINT8 ubRadius )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT32 iNewIndex;
INT32 leftmost;
// Determine start end end indicies and num rows
sTop = ubRadius;
sBottom = -ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
if ( sGridNo >= 0x8000 )
return;
for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ )
{
@@ -1115,8 +1114,8 @@ void PasteTextureFromRadiusEx( INT16 sGridNo, UINT16 usType, UINT8 ubRadius )
{
iNewIndex = sGridNo + ( WORLD_COLS * cnt1 ) + cnt2;
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
{
PasteTextureEx( sGridNo, usType );
}
@@ -1145,12 +1144,10 @@ void RaiseWorldLand( )
BOOLEAN fSomethingRaised = FALSE;
UINT8 ubLoop;
UINT16 usIndex;
BOOLEAN fStopRaise = FALSE;
INT32 iCounterA = 0, iCounterB = 0;
INT32 iStartNumberOfRaises = 0;
INT32 iNumberOfRaises = 0;
BOOLEAN fAboutToRaise = FALSE;
fRaise=FALSE;
fRaiseSet=FALSE;
@@ -1160,7 +1157,7 @@ void RaiseWorldLand( )
gpWorldLevelData[cnt].uiFlags &= (~MAPELEMENT_RAISE_LAND_END );
}
for ( cnt = 0; cnt < WORLD_MAX; cnt++ )
{
@@ -1176,13 +1173,12 @@ void RaiseWorldLand( )
pStruct = pStruct->pNext;
continue;
}
pTileElement = &(gTileDatabase[ pStruct->usIndex ]);
if (pTileElement->fType==FIRSTCLIFF)
{
{
fSomethingRaised = TRUE;
usIndex=pStruct->usIndex;
// DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("Cliff found at count=%d",cnt));
// DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("Cliff found at count=%d",cnt));
if( pTileElement->ubNumberOfTiles > 1 )
{
// DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("Cliff has %d children", pTileElement->ubNumberOfTiles));
@@ -1194,7 +1190,7 @@ void RaiseWorldLand( )
// presently by CLIFF object/tileset 1
// so simply detect this tile set and turn off instead of on
// element 1 is 12 tiles and is unique
sTempGridNo = cnt + pTileElement->pTileLocData[ubLoop].bTileOffsetX + pTileElement->pTileLocData[ubLoop].bTileOffsetY * WORLD_COLS;
// Check for valid gridno
if ( OutOfBounds( (INT16)cnt, (INT16)sTempGridNo ) )
@@ -1202,7 +1198,7 @@ void RaiseWorldLand( )
continue;
}
//if (pTileElement->ubNumberOfTiles==10)
if((usIndex==LAND_DROP_1)||(usIndex==LAND_DROP_2) ||(usIndex==LAND_DROP_4))
if((usIndex==LAND_DROP_1)||(usIndex==LAND_DROP_2) ||(usIndex==LAND_DROP_4))
{
gpWorldLevelData[sTempGridNo].uiFlags &= (~MAPELEMENT_RAISE_LAND_START );
gpWorldLevelData[sTempGridNo].uiFlags |= MAPELEMENT_RAISE_LAND_END;
@@ -1267,10 +1263,10 @@ void RaiseWorldLand( )
}
if (gpWorldLevelData[cnt].uiFlags&MAPELEMENT_RAISE_LAND_START)
{
fRaiseSet=TRUE;
fRaiseSet=TRUE;
}
else if((gpWorldLevelData[cnt].uiFlags&MAPELEMENT_RAISE_LAND_END)&&(!fRaiseSet))
{
{
// there is a dropoff without a rise.
// back up and set beginning to raiseland start
gpWorldLevelData[cnt+((WORLD_ROWS-1)-(cnt%WORLD_ROWS))].uiFlags &= (~MAPELEMENT_RAISE_LAND_END );
@@ -1302,7 +1298,7 @@ void RaiseWorldLand( )
fRaiseSet = FALSE;
}
else if((gpWorldLevelData[cnt].uiFlags&MAPELEMENT_RAISE_LAND_END)||(gpWorldLevelData[cnt-1].uiFlags&MAPELEMENT_RAISE_LAND_END) || ( gpWorldLevelData[cnt+1].uiFlags&MAPELEMENT_RAISE_LAND_END) )
{
{
fRaiseSet=FALSE;
}
if (fRaiseSet)
@@ -1319,20 +1315,20 @@ void RaiseWorldLand( )
// Now go through the world, starting at x=max(x) and y=max(y) and work backwards
// if a cliff is found turn raise flag on, if the end of a screen is found, turn off
// the system uses world_cord=x+y*(row_size)
// the system uses world_cord=x+y*(row_size)
for (cnt=WORLD_MAX-1; cnt >= 0; cnt--)
for (cnt=WORLD_MAX-1; cnt >= 0; cnt--)
{
// reset the RAISE to FALSE
// End of the row
// reset the RAISE to FALSE
// End of the row
if ( !(cnt % WORLD_ROWS) )
{
iNumberOfRaises = 0;
iStartNumberOfRaises = 0;
}
if( ( gpWorldLevelData[cnt].uiFlags & MAPELEMENT_RAISE_LAND_END ) )
if( ( gpWorldLevelData[cnt].uiFlags & MAPELEMENT_RAISE_LAND_END ) )
{
if( cnt > 1 )
{
@@ -1344,11 +1340,11 @@ void RaiseWorldLand( )
}
else if( gpWorldLevelData[cnt].uiFlags & MAPELEMENT_RAISE_LAND_START )
{
// check tile before and after, if either are raise land flagged, then don't increment number of
// check tile before and after, if either are raise land flagged, then don't increment number of
// raises
if( cnt < WORLD_MAX - 2 )
{
if( ( !( gpWorldLevelData[ cnt + 1 ].uiFlags & MAPELEMENT_RAISE_LAND_START) && !( gpWorldLevelData[ cnt + 2 ].uiFlags & MAPELEMENT_RAISE_LAND_START ) ) )
if( ( !( gpWorldLevelData[ cnt + 1 ].uiFlags & MAPELEMENT_RAISE_LAND_START) && !( gpWorldLevelData[ cnt + 2 ].uiFlags & MAPELEMENT_RAISE_LAND_START ) ) )
{
iNumberOfRaises++;
}
@@ -1365,7 +1361,7 @@ void RaiseWorldLand( )
iNumberOfRaises = iStartNumberOfRaises;
continue;
}
if( iNumberOfRaises >= 0 )
{
//DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("Land Raise start at count: %d is raised",cnt ));
@@ -1373,19 +1369,19 @@ void RaiseWorldLand( )
}
}
for (cnt=WORLD_MAX-1; cnt >= 0; cnt--)
for (cnt=WORLD_MAX-1; cnt >= 0; cnt--)
{
if( ( cnt < WORLD_MAX - WORLD_ROWS ) && ( cnt > WORLD_ROWS ) )
{
if( ( gpWorldLevelData[cnt + WORLD_ROWS ].sHeight == gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) && ( gpWorldLevelData[ cnt ].sHeight!= gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) )
if( ( gpWorldLevelData[cnt + WORLD_ROWS ].sHeight == gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) && ( gpWorldLevelData[ cnt ].sHeight!= gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) )
{
gpWorldLevelData[cnt].sHeight = gpWorldLevelData[cnt + WORLD_ROWS ].sHeight;
}
else if( ( gpWorldLevelData[ cnt ].sHeight > gpWorldLevelData[cnt - WORLD_ROWS ].sHeight )&& ( gpWorldLevelData[cnt + WORLD_ROWS ].sHeight != gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) && ( gpWorldLevelData[cnt ].sHeight > gpWorldLevelData[cnt + WORLD_ROWS ].sHeight ) )
else if( ( gpWorldLevelData[ cnt ].sHeight > gpWorldLevelData[cnt - WORLD_ROWS ].sHeight )&& ( gpWorldLevelData[cnt + WORLD_ROWS ].sHeight != gpWorldLevelData[cnt - WORLD_ROWS ].sHeight ) && ( gpWorldLevelData[cnt ].sHeight > gpWorldLevelData[cnt + WORLD_ROWS ].sHeight ) )
{
if( gpWorldLevelData[cnt - WORLD_ROWS ].sHeight > gpWorldLevelData[cnt + WORLD_ROWS ].sHeight )
{
gpWorldLevelData[ cnt ].sHeight = gpWorldLevelData[cnt - WORLD_ROWS ].sHeight;
gpWorldLevelData[ cnt ].sHeight = gpWorldLevelData[cnt - WORLD_ROWS ].sHeight;
}
else
{
@@ -1448,6 +1444,7 @@ void EliminateObjectLayerRedundancy()
+2 -2
View File
@@ -17,9 +17,9 @@
#define DRAW_CLIFFS 1
#define DRAW_CLIFF_LAND 2
extern BOOLEAN gfWarning;
extern BOOLEAN gfWarning;
extern BOOLEAN gfDoFill;
extern BOOLEAN gfDoFill;
extern UINT16 CurrentPaste;
extern UINT16 gDebrisPaste;
extern UINT16 gChangeElevation;
+191 -187
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -36,7 +36,7 @@ void FindTilesetComments(void);
void GetMasterList(void);
void HandleJA2ToolbarSelection( void );
void HandleKeyboardShortcuts( );
void HandleKeyboardShortcuts( );
UINT32 PerformSelectedAction( void );
UINT32 WaitForSelectionWindowResponse( void );
UINT32 WaitForMessageBoxResponse( UINT32 uiCurrentScreen );
@@ -55,7 +55,7 @@ void MapOptimize(void);
extern UINT16 GenericButtonFillColors[40];
//These go together. The taskbar has a specific color scheme.
//These go together. The taskbar has a specific color scheme.
extern UINT16 gusEditorTaskbarColor;
extern UINT16 gusEditorTaskbarHiColor;
extern UINT16 gusEditorTaskbarLoColor;
+6 -5
View File
@@ -49,7 +49,7 @@ void CreateMessageBox( STR16 wzString )
BUTTON_NO_CALLBACK, BUTTON_NO_CALLBACK);
DisableButton( iMsgBoxBgrnd );
SpecifyDisabledButtonStyle( iMsgBoxBgrnd, DISABLED_STYLE_NONE );
iMsgBoxOkImg = LoadButtonImage("EDITOR//ok.sti",0,1,2,3,4);
iMsgBoxCancelImg = LoadButtonImage("EDITOR//cancel.sti",0,1,2,3,4);
@@ -74,7 +74,7 @@ void CreateMessageBox( STR16 wzString )
BOOLEAN MessageBoxHandled()
{
InputAtom DummyEvent;
InputAtom DummyEvent;
while( DequeueEvent( &DummyEvent ) )
{
@@ -134,7 +134,7 @@ void MsgBoxOkClkCallback( GUI_BUTTON *butn, INT32 reason )
butn->uiFlags |= BUTTON_CLICKED_ON;
}
else if ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
{
gubMessageBoxStatus = MESSAGEBOX_DONE;
gfMessageBoxResult = TRUE;
}
@@ -147,7 +147,7 @@ void MsgBoxCnclClkCallback( GUI_BUTTON *butn, INT32 reason )
butn->uiFlags |= BUTTON_CLICKED_ON;
}
else if ( reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
{
gubMessageBoxStatus = MESSAGEBOX_DONE;
gfMessageBoxResult = FALSE;
}
@@ -162,6 +162,7 @@ void MsgBoxCnclClkCallback( GUI_BUTTON *butn, INT32 reason )
+3 -3
View File
@@ -19,7 +19,7 @@ BOOLEAN MessageBoxHandled();
void RemoveMessageBox();
//NOTES:
//Rewrote the damn thing. It is better now because you have less management issues.
//Rewrote the damn thing. It is better now because you have less management issues.
//In your screen's main loop, instead of using the previous method, you would use the following syntax:
//
// if( gubMessageBoxState )
@@ -29,9 +29,9 @@ void RemoveMessageBox();
// return MYCURRENT_SCREEN;
// }
//
// UINT32 ProcessMyOwnMessageBoxResultHandlerFunction()
// UINT32 ProcessMyOwnMessageBoxResultHandlerFunction()
// {
// RemoveMessageBox(); //MUST BE HERE
// RemoveMessageBox(); //MUST BE HERE
// if( gfMessageBoxResult ) //user selected yes
// {
// ...
+121 -120
View File
@@ -61,73 +61,73 @@ UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal )
UINT16 usType = FIRSTWALL;
UINT16 usIndex;
UINT16 usTileIndex;
switch( ubTotal )
{
case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70:
case 0x00: case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70:
case 0x80: case 0x90: case 0xa0: case 0xb0: case 0xc0: case 0xd0: case 0xe0: case 0xf0:
//usIndex = 0;
//usIndex = 0;
//break;
return 0xffff;
case 0x01: case 0x11: case 0x21: case 0x31: case 0x41: case 0x51: case 0x61: case 0x71:
case 0x01: case 0x11: case 0x21: case 0x31: case 0x41: case 0x51: case 0x61: case 0x71:
case 0x81: case 0x91: case 0xa1: case 0xb1: case 0xc1: case 0xd1: case 0xe1: case 0xf1:
usType = SECONDWALL;
usIndex = 1 + (UINT16)Random( 4 );
usIndex = 1 + (UINT16)Random( 4 );
break;
case 0x02: case 0x12: case 0x22: case 0x32: case 0x42: case 0x52: case 0x62: case 0x72:
case 0x02: case 0x12: case 0x22: case 0x32: case 0x42: case 0x52: case 0x62: case 0x72:
case 0x82: case 0x92: case 0xa2: case 0xb2: case 0xc2: case 0xd2: case 0xe2: case 0xf2:
usType = SECONDWALL;
usIndex = 5 + (UINT16)Random( 4 );
usIndex = 5 + (UINT16)Random( 4 );
break;
case 0x03: case 0x13: case 0x43: case 0x53: case 0x83: case 0x93: case 0xc3: case 0xd3:
usIndex = 1;
case 0x03: case 0x13: case 0x43: case 0x53: case 0x83: case 0x93: case 0xc3: case 0xd3:
usIndex = 1;
break;
case 0x04: case 0x14: case 0x24: case 0x34: case 0x44: case 0x54: case 0x64: case 0x74:
case 0x04: case 0x14: case 0x24: case 0x34: case 0x44: case 0x54: case 0x64: case 0x74:
case 0x84: case 0x94: case 0xa4: case 0xb4: case 0xc4: case 0xd4: case 0xe4: case 0xf4:
usType = SECONDWALL;
usIndex = 9 + (UINT16)Random( 4 );
usIndex = 9 + (UINT16)Random( 4 );
break;
case 0x05: case 0x15: case 0x25: case 0x35: case 0x45: case 0x55: case 0x65: case 0x75:
case 0x05: case 0x15: case 0x25: case 0x35: case 0x45: case 0x55: case 0x65: case 0x75:
case 0x85: case 0x95: case 0xa5: case 0xb5: case 0xc5: case 0xd5: case 0xe5: case 0xf5:
usIndex = 2 + (UINT16)Random( 2 );
break;
case 0x06: case 0x16: case 0x26: case 0x36: case 0x86: case 0x96: case 0xa6: case 0xb6:
case 0x06: case 0x16: case 0x26: case 0x36: case 0x86: case 0x96: case 0xa6: case 0xb6:
usIndex = 4;
break;
case 0x07: case 0x17: case 0x87: case 0x97:
usIndex = 5;
break;
case 0x08: case 0x18: case 0x28: case 0x38: case 0x48: case 0x58: case 0x68: case 0x78:
case 0x08: case 0x18: case 0x28: case 0x38: case 0x48: case 0x58: case 0x68: case 0x78:
case 0x88: case 0x98: case 0xa8: case 0xb8: case 0xc8: case 0xd8: case 0xe8: case 0xf8:
usType = SECONDWALL;
usIndex = 13 + (UINT16)Random( 4 );
usIndex = 13 + (UINT16)Random( 4 );
break;
case 0x09: case 0x29: case 0x49: case 0x69: case 0x89: case 0xa9: case 0xc9: case 0xe9:
case 0x09: case 0x29: case 0x49: case 0x69: case 0x89: case 0xa9: case 0xc9: case 0xe9:
usIndex = 6;
break;
case 0x0a: case 0x1a: case 0x2a: case 0x3a: case 0x4a: case 0x5a: case 0x6a: case 0x7a:
case 0x0a: case 0x1a: case 0x2a: case 0x3a: case 0x4a: case 0x5a: case 0x6a: case 0x7a:
case 0x8a: case 0x9a: case 0xaa: case 0xba: case 0xca: case 0xda: case 0xea: case 0xfa:
usIndex = 7 + (UINT16)Random( 2 );
break;
case 0x0b: case 0x4b: case 0x8b: case 0xcb:
case 0x0b: case 0x4b: case 0x8b: case 0xcb:
usIndex = 9;
break;
case 0x0c: case 0x1c: case 0x2c: case 0x3c: case 0x4c: case 0x5c: case 0x6c: case 0x7c:
case 0x0c: case 0x1c: case 0x2c: case 0x3c: case 0x4c: case 0x5c: case 0x6c: case 0x7c:
usIndex = 10;
break;
case 0x0d: case 0x2d: case 0x4d: case 0x6d:
usIndex = 11;
break;
case 0x0e: case 0x1e: case 0x2e: case 0x3e:
case 0x0e: case 0x1e: case 0x2e: case 0x3e:
usIndex = 12;
break;
case 0x0f:
case 0x0f:
usIndex = 13;
break;
case 0x19: case 0x39: case 0x59: case 0x79: case 0x99: case 0xb9: case 0xd9: case 0xf9:
case 0x19: case 0x39: case 0x59: case 0x79: case 0x99: case 0xb9: case 0xd9: case 0xf9:
usIndex = 14 + (UINT16)Random( 2 );
break;
case 0x1b: case 0x5b: case 0x9b: case 0xdb:
case 0x1b: case 0x5b: case 0x9b: case 0xdb:
usIndex = 16;
break;
case 0x1d: case 0x3d: case 0x5d: case 0x7d:
@@ -136,31 +136,31 @@ UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal )
case 0x1f:
usIndex = 18;
break;
case 0x23: case 0x33: case 0x63: case 0x73: case 0xa3: case 0xb3: case 0xe3: case 0xf3:
case 0x23: case 0x33: case 0x63: case 0x73: case 0xa3: case 0xb3: case 0xe3: case 0xf3:
usIndex = 19 + (UINT16)Random( 2 );
break;
case 0x27: case 0x37: case 0xa7: case 0xb7:
usIndex = 21;
break;
case 0x2b: case 0x6b: case 0xab: case 0xeb:
case 0x2b: case 0x6b: case 0xab: case 0xeb:
usIndex = 22;
break;
case 0x2f:
usIndex = 23;
break;
case 0x3b: case 0x7b: case 0xbb: case 0xfb:
case 0x3b: case 0x7b: case 0xbb: case 0xfb:
usIndex = 24 + (UINT16)Random( 3 );
break;
case 0x3f:
usIndex = 27;
break;
case 0x46: case 0x56: case 0x66: case 0x76: case 0xc6: case 0xd6: case 0xe6: case 0xf6:
case 0x46: case 0x56: case 0x66: case 0x76: case 0xc6: case 0xd6: case 0xe6: case 0xf6:
usIndex = 28 + (UINT16)Random( 2 );
break;
case 0x47: case 0x57: case 0xc7: case 0xd7:
usIndex = 30;
break;
case 0x4e: case 0x5e: case 0x6e: case 0x7e:
case 0x4e: case 0x5e: case 0x6e: case 0x7e:
usIndex = 31;
break;
case 0x4f:
@@ -184,7 +184,7 @@ UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal )
case 0x8d: case 0xad: case 0xcd: case 0xed:
usIndex = 42;
break;
case 0x8e: case 0x9e: case 0xae: case 0xbe:
case 0x8e: case 0x9e: case 0xae: case 0xbe:
usIndex = 43;
break;
case 0x8f:
@@ -202,7 +202,7 @@ UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal )
case 0xbf:
usIndex = 50 + (UINT16)Random( 2 );
break;
case 0xce: case 0xde: case 0xee: case 0xfe:
case 0xce: case 0xde: case 0xee: case 0xfe:
usIndex = 52 + (UINT16)Random( 3 );
break;
case 0xcf:
@@ -227,14 +227,14 @@ UINT16 GetCaveTileIndexFromPerimeterValue( UINT8 ubTotal )
// 16 | 1 | 32
// ---+---+---
// 8 | | 2
// 8 | | 2
// ---+---+---
// 128| 4 | 64
//These values are combined in any possible order ranging in
//values from 0 - 255. If there is a cave existing in any of
//These values are combined in any possible order ranging in
//values from 0 - 255. If there is a cave existing in any of
//these bordering gridnos, then the corresponding number is added
//to this total. The lookup table has been precalculated to know
//which piece to use for all of these combinations. In many cases,
//to this total. The lookup table has been precalculated to know
//which piece to use for all of these combinations. In many cases,
//up to 16 combinations can share the same graphic image, as corners
//may not effect the look of the piece.
UINT8 CalcNewCavePerimeterValue( INT32 iMapIndex )
@@ -245,7 +245,7 @@ UINT8 CalcNewCavePerimeterValue( INT32 iMapIndex )
if( CaveAtGridNo( iMapIndex + 1 ) )
ubTotal += 0x02; //east
if( CaveAtGridNo( iMapIndex + WORLD_COLS ) )
ubTotal += 0x04; //south
ubTotal += 0x04; //south
if( CaveAtGridNo( iMapIndex - 1 ) )
ubTotal += 0x08; //west
if( CaveAtGridNo( iMapIndex - WORLD_COLS - 1 ) )
@@ -281,24 +281,24 @@ void AddCave( INT32 iMapIndex, UINT16 usIndex )
#define INTERIOR_BOTTOMEND_SHADOW_INDEX 31
//Wall Look Up Table containing variants and indices with each row being a different walltype.
INT8 gbWallTileLUT[NUM_WALL_TYPES][7] =
{
INT8 gbWallTileLUT[NUM_WALL_TYPES][7] =
{
// The number of variants of this tile type.
// | The first relative index of the wall type (FIRSTWALL, SECONDWALL, etc. ) walltype + 10
// | | The 2nd relative index ( walltype + 11 )
// | The first relative index of the wall type (FIRSTWALL, SECONDWALL, etc. ) walltype + 10
// | | The 2nd relative index ( walltype + 11 )
// | | | 3rd 4th 5th 6th
// | | | | | | |
// | | | | | | |
6, 10, 11, 12, 27, 28, 29, //INTERIOR_L
6, 7, 8, 9, 24, 25, 26, //INTERIOR_R
6, 4, 5, 6, 21, 22, 23, //EXTERIOR_L
6, 1, 2, 3, 18, 19, 20, //EXTERIOR_R
1, 14, 0, 0, 0, 0, 0, //INTERIOR_CORNER
1, 15, 0, 0, 0, 0, 0, //INTERIOR_BOTTOMEND
1, 13, 0, 0, 0, 0, 0, //EXTERIOR_BOTTOMEND
1, 16, 0, 0, 0, 0, 0, //INTERIOR_EXTENDED
1, 57, 0, 0, 0, 0, 0, //EXTERIOR_EXTENDED
1, 56, 0, 0, 0, 0, 0, //INTERIOR_EXTENDED_BOTTOMEND
1, 17, 0, 0, 0, 0, 0, //EXTERIOR_EXTENDED_BOTTOMEND
6, 7, 8, 9, 24, 25, 26, //INTERIOR_R
6, 4, 5, 6, 21, 22, 23, //EXTERIOR_L
6, 1, 2, 3, 18, 19, 20, //EXTERIOR_R
1, 14, 0, 0, 0, 0, 0, //INTERIOR_CORNER
1, 15, 0, 0, 0, 0, 0, //INTERIOR_BOTTOMEND
1, 13, 0, 0, 0, 0, 0, //EXTERIOR_BOTTOMEND
1, 16, 0, 0, 0, 0, 0, //INTERIOR_EXTENDED
1, 57, 0, 0, 0, 0, 0, //EXTERIOR_EXTENDED
1, 56, 0, 0, 0, 0, 0, //INTERIOR_EXTENDED_BOTTOMEND
1, 17, 0, 0, 0, 0, 0, //EXTERIOR_EXTENDED_BOTTOMEND
};
//Roof table -- such a small table, using definitions instead.
@@ -333,9 +333,9 @@ INT8 gbWallTileLUT[NUM_WALL_TYPES][7] =
//PRIVATELY "ENCAPSULATED" FUNCTIONS
//These construction functions do all the smoothing.
//NOTE: passing null for wall/roof type will force the function to search for the nearest
// existing respective type.
void BuildSlantRoof( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom, UINT16 usWallType, UINT16 usRoofType, BOOLEAN fVertical );
//NOTE: passing null for wall/roof type will force the function to search for the nearest
// existing respective type.
void BuildSlantRoof( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom, UINT16 usWallType, UINT16 usRoofType, BOOLEAN fVertical );
void BulldozeNature( UINT32 iMapIndex );
void EraseRoof( UINT32 iMapIndex );
@@ -356,10 +356,10 @@ void BuildSlantRoof( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom, UINT1
if( fVertical )
{
iMapIndex = iBottom * WORLD_COLS + iLeft;
//This happens to be the only mapindex that needs to be backed up. The rest have already been
//This happens to be the only mapindex that needs to be backed up. The rest have already been
//done because of the building code before this.
AddToUndoList( iMapIndex + 8 );
//Add the closest viewable pieces. There are two aframe walls pieces, and extended aframe roof pieces.
//Add the closest viewable pieces. There are two aframe walls pieces, and extended aframe roof pieces.
GetTileIndexFromTypeSubIndex( usWallType, VWALL_LEFT, &usTileIndex );
AddRoofToHead( iMapIndex + 4, usTileIndex );
GetTileIndexFromTypeSubIndex( usWallType, VWALL_RIGHT, &usTileIndex );
@@ -385,10 +385,10 @@ void BuildSlantRoof( INT32 iLeft, INT32 iTop, INT32 iRight, INT32 iBottom, UINT1
else
{
iMapIndex = iTop * WORLD_COLS + iRight;
//This happens to be the only mapindex that needs to be backed up. The rest have already been
//This happens to be the only mapindex that needs to be backed up. The rest have already been
//done because of the building code before this.
AddToUndoList( iMapIndex + 8*WORLD_COLS );
//Add the closest viewable pieces. There are two aframe walls pieces, and extended aframe roof pieces.
//Add the closest viewable pieces. There are two aframe walls pieces, and extended aframe roof pieces.
GetTileIndexFromTypeSubIndex( usWallType, HWALL_LEFT, &usTileIndex );
AddRoofToHead( iMapIndex + 4*WORLD_COLS, usTileIndex );
GetTileIndexFromTypeSubIndex( usWallType, HWALL_RIGHT, &usTileIndex );
@@ -427,16 +427,16 @@ UINT16 PickAWallPiece( UINT16 usWallPieceType )
return usWallPieceChosen;
}
//From a given gridNo and perspective (wallpiece), it will calculate the new piece, and
//From a given gridNo and perspective (wallpiece), it will calculate the new piece, and
//where to place it as well as handle the special cases.
//NOTE: Placing top and left pieces are placed relative to the gridno, and the gridNo will
// shift accordingly to place the piece. Pretend you are the floor, and you want to place a piece to
// the left. You pass your position, and INTERIOR_LEFT, with interior meaning from the inside of a
// building. If you were outside the building, you would call EXTERIOR_LEFT. The left tile will be
// placed on gridNo - 1! Up tiles will be placed on gridNo - 160.
//NOTE: Passing NULL for usWallType will force it to calculate the closest existing wall type, and
// use that for building this new wall. It is necessary for restructuring a building, but not for
// adding on to an existing building, where the type is already known.
//NOTE: Placing top and left pieces are placed relative to the gridno, and the gridNo will
// shift accordingly to place the piece. Pretend you are the floor, and you want to place a piece to
// the left. You pass your position, and INTERIOR_LEFT, with interior meaning from the inside of a
// building. If you were outside the building, you would call EXTERIOR_LEFT. The left tile will be
// placed on gridNo - 1! Up tiles will be placed on gridNo - 160.
//NOTE: Passing NULL for usWallType will force it to calculate the closest existing wall type, and
// use that for building this new wall. It is necessary for restructuring a building, but not for
// adding on to an existing building, where the type is already known.
void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
{
INT16 sIndex;
@@ -461,7 +461,7 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
AddExclusiveShadow( iMapIndex - 1, usTileIndex );
}
if ( pStruct = GetVerticalWall( iMapIndex ) ) //right corner
{ //Special case where placing the new wall will generate a corner to the right, so replace
{ //Special case where placing the new wall will generate a corner to the right, so replace
//the vertical piece with a bottomend.
sIndex = PickAWallPiece( EXTERIOR_BOTTOMEND );
AddToUndoList( iMapIndex );
@@ -489,7 +489,7 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
ubWallClass = EXTERIOR_R;
iMapIndex--;
if( GetHorizontalWall( iMapIndex ) )
{ //Special case where placing the new wall will generate a corner. This piece
{ //Special case where placing the new wall will generate a corner. This piece
//becomes an exterior bottomend, but nothing else is effected.
ubWallClass = EXTERIOR_BOTTOMEND;
}
@@ -522,7 +522,7 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
AddToUndoList( iMapIndex + WORLD_COLS - 1 );
GetTileIndexFromTypeSubIndex( usWallType, sIndex, &usTileIndex );
ReplaceStructIndex( iMapIndex + WORLD_COLS - 1, pStruct->usIndex, usTileIndex );
//NOTE: Not yet checking for interior extended bottomend!
//NOTE: Not yet checking for interior extended bottomend!
}
if( pStruct = GetVerticalWall( iMapIndex ) )
{
@@ -535,7 +535,7 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
case INTERIOR_BOTTOM:
ubWallClass = EXTERIOR_L;
if( pStruct = GetVerticalWall( iMapIndex ) ) //right corner
{ //Special case where placing the new wall will generate a corner to the right, so replace
{ //Special case where placing the new wall will generate a corner to the right, so replace
//the vertical piece with a bottomend.
sIndex = PickAWallPiece( EXTERIOR_BOTTOMEND );
AddToUndoList( iMapIndex );
@@ -580,7 +580,7 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
case INTERIOR_RIGHT:
ubWallClass = EXTERIOR_R;
if( GetHorizontalWall( iMapIndex ) )
{ //Special case where placing the new wall will generate a corner. This piece
{ //Special case where placing the new wall will generate a corner. This piece
//becomes an exterior bottomend, but nothing else is effected.
ubWallClass = EXTERIOR_BOTTOMEND;
}
@@ -591,8 +591,8 @@ void BuildWallPiece( UINT32 iMapIndex, UINT8 ubWallPiece, UINT16 usWallType )
else
ubWallClass = EXTERIOR_EXTENDED;
}
if( !gfBasement && GetHorizontalWall( iMapIndex + 1 ) && !GetHorizontalWall( iMapIndex )
&& !FloorAtGridNo( iMapIndex + WORLD_COLS ) )
if( !gfBasement && GetHorizontalWall( iMapIndex + 1 ) && !GetHorizontalWall( iMapIndex )
&& !FloorAtGridNo( iMapIndex + WORLD_COLS ) )
{
GetTileIndexFromTypeSubIndex( usWallType, INTERIOR_BOTTOMEND_SHADOW_INDEX, &usTileIndex );
AddExclusiveShadow( iMapIndex, usTileIndex );
@@ -618,9 +618,9 @@ void RebuildRoofUsingFloorInfo( INT32 iMapIndex, UINT16 usRoofType )
usRoofType = SearchForRoofType( iMapIndex );
}
if( usRoofType == 0xffff )
return; //no roof type around, so don't draw one.
return; //no roof type around, so don't draw one.
//Analyse the mapindex for walls and set the flags.
//NOTE: There is no support for more than 2 side on a roof, so if there is, draw TOPLEFT
//NOTE: There is no support for more than 2 side on a roof, so if there is, draw TOPLEFT
AddToUndoList( iMapIndex );
EraseRoof( iMapIndex );
@@ -648,8 +648,8 @@ void RebuildRoofUsingFloorInfo( INT32 iMapIndex, UINT16 usRoofType )
//Given a gridno, it will erase the current roof, and calculate the new roof piece based on the
//wall orientions giving priority to the top and left walls before anything else.
//NOTE: passing NULL for usRoofType will force the function to calculate the nearest roof type,
// and use that for the new roof. This is needed when erasing parts of multiple buildings simultaneously.
//NOTE: passing NULL for usRoofType will force the function to calculate the nearest roof type,
// and use that for the new roof. This is needed when erasing parts of multiple buildings simultaneously.
void RebuildRoof( UINT32 iMapIndex, UINT16 usRoofType )
{
UINT16 usRoofIndex, usTileIndex;
@@ -659,9 +659,9 @@ void RebuildRoof( UINT32 iMapIndex, UINT16 usRoofType )
usRoofType = SearchForRoofType( iMapIndex );
}
if( usRoofType == 0xffff )
return; //no roof type around, so don't draw one.
return; //no roof type around, so don't draw one.
//Analyse the mapindex for walls and set the flags.
//NOTE: There is no support for more than 2 side on a roof, so if there is, draw TOPLEFT
//NOTE: There is no support for more than 2 side on a roof, so if there is, draw TOPLEFT
AddToUndoList( iMapIndex );
EraseRoof( iMapIndex );
@@ -685,7 +685,7 @@ void RebuildRoof( UINT32 iMapIndex, UINT16 usRoofType )
{
HideStructOfGivenType( iMapIndex, usRoofType, TRUE );
}
}
}
void BulldozeNature( UINT32 iMapIndex )
{
@@ -702,7 +702,7 @@ void BulldozeNature( UINT32 iMapIndex )
void EraseRoof( UINT32 iMapIndex )
{
AddToUndoList( iMapIndex );
RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM );
RemoveAllRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM );
RemoveAllOnRoofsOfTypeRange( iMapIndex, FIRSTTEXTURE, LASTITEM );
RemoveAllShadowsOfTypeRange( iMapIndex, FIRSTROOF, LASTSLANTROOF );
}
@@ -737,7 +737,7 @@ void EraseBuilding( UINT32 iMapIndex )
//and the TOP_LEFT oriented wall in the gridno up one as well as the other building information at this
//gridno.
void EraseFloorOwnedBuildingPieces( UINT32 iMapIndex )
{
{
LEVELNODE *pStruct = NULL;
UINT32 uiTileType;
UINT16 usWallOrientation;
@@ -755,7 +755,7 @@ void EraseFloorOwnedBuildingPieces( UINT32 iMapIndex )
{
GetTileType( pStruct->usIndex, &uiTileType );
if ( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL ||
uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR )
uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR )
{
GetWallOrientation( pStruct->usIndex, &usWallOrientation );
if( usWallOrientation == INSIDE_TOP_RIGHT || usWallOrientation == OUTSIDE_TOP_RIGHT )
@@ -777,7 +777,7 @@ void EraseFloorOwnedBuildingPieces( UINT32 iMapIndex )
{
GetTileType( pStruct->usIndex, &uiTileType );
if ( uiTileType >= FIRSTWALL && uiTileType <= LASTWALL ||
uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR )
uiTileType >= FIRSTDOOR && uiTileType <= LASTDOOR )
{
GetWallOrientation( pStruct->usIndex, &usWallOrientation );
if( usWallOrientation == INSIDE_TOP_LEFT || usWallOrientation == OUTSIDE_TOP_LEFT )
@@ -810,20 +810,20 @@ void RemoveCaveSectionFromWorld( SGPRect *pSelectRegion )
left = pSelectRegion->iLeft;
right = pSelectRegion->iRight;
bottom = pSelectRegion->iBottom;
//Pass 1: Remove all pieces in area
//Pass 1: Remove all pieces in area
for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ )
{
iMapIndex = y * WORLD_COLS + x;
AddToUndoList( iMapIndex );
RemoveAllStructsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL );
RemoveAllStructsOfTypeRange( iMapIndex, FIRSTWALL, LASTWALL );
}
//Past 2: Go around outside perimeter and smooth each piece
//Past 2: Go around outside perimeter and smooth each piece
for( y = top - 1; y <= bottom + 1; y++ ) for( x = left - 1; x <= right + 1; x++ )
{
iMapIndex = y * WORLD_COLS + x;
if( CaveAtGridNo( iMapIndex ) )
{
ubPerimeterValue = CalcNewCavePerimeterValue( iMapIndex );
ubPerimeterValue = CalcNewCavePerimeterValue( iMapIndex );
usIndex = GetCaveTileIndexFromPerimeterValue( ubPerimeterValue );
AddToUndoList( iMapIndex );
if( usIndex != 0xffff )
@@ -846,7 +846,7 @@ void AddCaveSectionToWorld( SGPRect *pSelectRegion )
left = pSelectRegion->iLeft;
right = pSelectRegion->iRight;
bottom = pSelectRegion->iBottom;
//Pass 1: Add bogus piece to each gridno in region
//Pass 1: Add bogus piece to each gridno in region
for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ )
{
uiMapIndex = y * WORLD_COLS + x;
@@ -857,7 +857,7 @@ void AddCaveSectionToWorld( SGPRect *pSelectRegion )
AddCave( uiMapIndex, usIndex );
}
}
//Past 2: Go around outside perimeter and smooth each piece
//Past 2: Go around outside perimeter and smooth each piece
for( y = top - 1; y <= bottom + 1; y++ ) for( x = left - 1; x <= right + 1; x++ )
{
uiMapIndex = y * WORLD_COLS + x;
@@ -889,9 +889,9 @@ void AddCaveSectionToWorld( SGPRect *pSelectRegion )
// BEGIN PUBLIC FUNCTION IMPLEMENTATION
//--------------------------------------------------------------------------------------------------
//When the user removes a section from a building, it will not only erase the
//When the user removes a section from a building, it will not only erase the
//entire highlighted area, it'll repair the building itself so there are no
//outside walls missing from the new building.
//outside walls missing from the new building.
void RemoveBuildingSectionFromWorld( SGPRect *pSelectRegion )
{
UINT32 top, left, right, bottom, x, y;
@@ -905,17 +905,17 @@ void RemoveBuildingSectionFromWorld( SGPRect *pSelectRegion )
right = pSelectRegion->iRight;
bottom = pSelectRegion->iBottom;
//1ST PASS: Erase all building owned by the floor tile if there is one.
//1ST PASS: Erase all building owned by the floor tile if there is one.
for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ )
{
iMapIndex = y * WORLD_COLS + x;
EraseFloorOwnedBuildingPieces( iMapIndex ); //Erase possible top and left walls in bordering tiles.
}
//2ND PASS: Build new walls whereever there are neighboring floor tiles.
//2ND PASS: Build new walls whereever there are neighboring floor tiles.
for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ )
{
iMapIndex = y * WORLD_COLS + x;
//NOTE: Top and bottom walls MUST be placed first -- it minimizes the number of special cases.
//NOTE: Top and bottom walls MUST be placed first -- it minimizes the number of special cases.
if( y == top )
{
fFloor = FloorAtGridNo( iMapIndex - WORLD_COLS );
@@ -937,15 +937,15 @@ void RemoveBuildingSectionFromWorld( SGPRect *pSelectRegion )
if( x == right )
{
fFloor = FloorAtGridNo( iMapIndex + 1);
if( gfBasement && !fFloor || !gfBasement && fFloor && !GetVerticalWall( iMapIndex ) )
if( gfBasement && !fFloor || !gfBasement && fFloor && !GetVerticalWall( iMapIndex ) )
BuildWallPiece( iMapIndex, EXTERIOR_RIGHT, 0 );
}
}
//3RD PASS: Go around the outside of the region, and rebuild the roof.
//3RD PASS: Go around the outside of the region, and rebuild the roof.
if( gfBasement )
{
usFloorType = GetRandomIndexByRange( FIRSTFLOOR, LASTFLOOR );
if( usFloorType == 0xffff )
if( usFloorType == 0xffff )
usFloorType = FIRSTFLOOR;
for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ )
{
@@ -983,7 +983,7 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion )
bottom = pSelectRegion->iBottom;
//Special case scenario:
//If the user selects a floor without walls, then it is implied that the user wishes to
//If the user selects a floor without walls, then it is implied that the user wishes to
//change the floor for say a kitchen which might have a different floor type.
usWallType = GetRandomIndexByRange( FIRSTWALL, LASTWALL );
usFloorType = GetRandomIndexByRange( FIRSTFLOOR, LASTFLOOR );
@@ -1002,10 +1002,10 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion )
return;
}
//1ST PASS: Determine if there are any floor tiles in this region. If there are, then
// that signifies that we are concantenating this building to an existing one. Otherwise,
// we are just drawing an individual building. If we find a floor, extract the type so
// we know how to draw it later.
//1ST PASS: Determine if there are any floor tiles in this region. If there are, then
// that signifies that we are concantenating this building to an existing one. Otherwise,
// we are just drawing an individual building. If we find a floor, extract the type so
// we know how to draw it later.
fNewBuilding = TRUE;
for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ )
{
@@ -1016,13 +1016,13 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion )
UINT32 uiTileType;
//If a floor is found, then we are adding to an existing structure.
fNewBuilding = FALSE;
//Extract the floor type. We already checked if there was a floor here, so it is assumed.
//Extract the floor type. We already checked if there was a floor here, so it is assumed.
pFloor = gpWorldLevelData[ iMapIndex ].pLandHead;
while( pFloor )
{
GetTileType( pFloor->usIndex, &uiTileType );
if( uiTileType >= FIRSTFLOOR && uiTileType <= LASTFLOOR )
{
{
usFloorType = (UINT16)uiTileType;
break;
}
@@ -1036,7 +1036,7 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion )
}
}
}
if( fNewBuilding )
{
//if( gfBasement )
@@ -1060,19 +1060,19 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion )
return;
}
//2ND PASS: Remove all walls in the region that border no floor tile, or simply walls
// that are considered exterior walls. That way, it won't wreck the inside of a building
// if you select too much interior. Also, gridnos that delete walls will also delete the
// floor and roof tiles there. That signifies that the floorless parts will be resmoothed,
// and rebuilt in the third pass.
//2ND PASS: Remove all walls in the region that border no floor tile, or simply walls
// that are considered exterior walls. That way, it won't wreck the inside of a building
// if you select too much interior. Also, gridnos that delete walls will also delete the
// floor and roof tiles there. That signifies that the floorless parts will be resmoothed,
// and rebuilt in the third pass.
for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ )
{
iMapIndex = y * WORLD_COLS + x;
if( gfBasement )
{
EraseBuilding( iMapIndex );
EraseBuilding( iMapIndex );
}
else if( FloorAtGridNo( iMapIndex ) && !fNewBuilding)
else if( FloorAtGridNo( iMapIndex ) && !fNewBuilding)
{
if( y >= top && !FloorAtGridNo( iMapIndex - WORLD_COLS ) )
{
@@ -1104,11 +1104,11 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion )
BulldozeNature( iMapIndex );
}
}
//3RD PASS: Process the region, and all walls of floorless tiles are rebuilt from interior perspective.
//3RD PASS: Process the region, and all walls of floorless tiles are rebuilt from interior perspective.
for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ )
{
iMapIndex = y * WORLD_COLS + x;
if( !FloorAtGridNo( iMapIndex ) )
if( !FloorAtGridNo( iMapIndex ) )
{
if( y == top && !GetHorizontalWall( iMapIndex - WORLD_COLS ) )
{
@@ -1142,14 +1142,14 @@ void AddBuildingSectionToWorld( SGPRect *pSelectRegion )
if( fSlantRoof )
{
fVertical = (bottom - top == 7) ? FALSE : TRUE;
BuildSlantRoof( left, top, right, bottom, usWallType, usRoofType, fVertical );
BuildSlantRoof( left, top, right, bottom, usWallType, usRoofType, fVertical );
}
//4TH PASS: Process the region, and all floorless tiles get new roofs and floors.
//4TH PASS: Process the region, and all floorless tiles get new roofs and floors.
for( y = top; y <= bottom; y++ ) for( x = left; x <= right; x++ )
{
iMapIndex = y * WORLD_COLS + x;
if( !FloorAtGridNo( iMapIndex ) )
if( !FloorAtGridNo( iMapIndex ) )
{
if( !fSlantRoof )
RebuildRoof( iMapIndex, usRoofType );
@@ -1194,6 +1194,7 @@ void AnalyseCaveMapForStructureInfo()
+22 -21
View File
@@ -1,7 +1,7 @@
// WANNE: EDITOR: todo
//FUNCTIONALITY:
//This popup menu functions IDENTICALLY to Windows95's methodology. You can use the arrow keys, or the
//This popup menu functions IDENTICALLY to Windows95's methodology. You can use the arrow keys, or the
//mouse in two methods. The first method is where you release the mouse button before
//moving the cursor inside the popup menu, which makes it persistant (it won't go away until you click again),
//or non-persistant, where you release the button inside the menu after your initial click (non-persistant).
@@ -76,14 +76,14 @@ user to make a selection or cancel before doing anything else.
There are two modes of operation as soon as the user presses the mouse
on a popup menu activation button.
1) The user releases the mouse before moving the cursor onto
the popup region. The popup menu will end as soon as the
the popup region. The popup menu will end as soon as the
user presses the mouse button. If the cursor is out of the
popup region, then it returns 0.
2) The user holds the mouse while moving the cursor onto the
popup region. The popup menu will end as soon as the user
releases the mouse button. If the cursor is out of the popup
region, then it returns 0.
Returns 0 if nothing in menu was selected, else
returns the menu entry number starting from 1.
@@ -182,7 +182,7 @@ void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection )
gPopup.ubColumns++;
}
//now we have the number of columns as well as the max number of entries per column, and
//the total menu height.
//the total menu height.
//We now calculate the total width of the menu as well as the max width of each column.
ubCounter = 0;
@@ -202,7 +202,7 @@ void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection )
}
usMenuWidth += gPopup.ubColumnWidth[ ubColumn ];
}
//Calculate popup menu boundaries based on direction from argument point.
switch( ubDirection )
{
@@ -214,8 +214,8 @@ void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection )
break;
case DIR_UPLEFT:
gPopup.usLeft = usX - usMenuWidth;
gPopup.usTop = usY - usMenuHeight - 1;
gPopup.usRight = usX;
gPopup.usTop = usY - usMenuHeight - 1;
gPopup.usRight = usX;
gPopup.usBottom = usY - 1;
break;
case DIR_DOWNRIGHT:
@@ -226,13 +226,13 @@ void InitPopupMenu( INT32 iButtonID, UINT8 ubPopupMenuID, UINT8 ubDirection )
break;
case DIR_DOWNLEFT:
gPopup.usLeft = usX - usMenuWidth;
gPopup.usTop = usY + 1;
gPopup.usRight = usX;
gPopup.usTop = usY + 1;
gPopup.usRight = usX;
gPopup.usBottom = usY + usMenuHeight + 1;
break;
}
MSYS_DefineRegion( &popupRegion, 0, 0, 640, 480, MSYS_PRIORITY_HIGHEST,
CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK );
CURSOR_NORMAL, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK );
RenderPopupMenu();
}
@@ -248,13 +248,13 @@ void RenderPopupMenu()
UINT16 usStart;
//Draw the menu
ColorFillVideoSurfaceArea(FRAME_BUFFER,
gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom,
ColorFillVideoSurfaceArea(FRAME_BUFFER,
gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom,
Get16BPPColor(FROMRGB(128, 128, 128) ) );
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES );
SetClippingRegionAndImageWidth( uiDestPitchBYTES, 0, 0, 640, 480 );
usLineColor = Get16BPPColor( FROMRGB( 64, 64, 64 ) );
RectangleDraw( TRUE, gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom,
RectangleDraw( TRUE, gPopup.usLeft, gPopup.usTop, gPopup.usRight, gPopup.usBottom,
usLineColor, pDestBuf );
if( gPopup.ubColumns > 1 )
{ //draw a vertical line between each column
@@ -271,7 +271,7 @@ void RenderPopupMenu()
SetFont( gPopup.usFont);
SetFontBackground( FONT_MCOLOR_BLACK );
SetFontForeground( FONT_MCOLOR_WHITE );
usX = gPopup.usLeft + 1;
ubCounter = 0;
usStart = gPopup.usLeft;
@@ -312,7 +312,7 @@ UINT8 GetPopupIndexFromMousePosition()
UINT8 ubNumEntriesDown;
UINT16 usRelX;
UINT8 ubCount;
if( gusMouseXPos >= gPopup.usLeft
if( gusMouseXPos >= gPopup.usLeft
&& gusMouseXPos <= gPopup.usRight
&& gusMouseYPos > gPopup.usTop //one pixel gap on top ignored
&& gusMouseYPos < gPopup.usBottom - 2 ) //two pixel gap on bottom ignored
@@ -346,7 +346,7 @@ void PopupMenuHandle()
//Attempt to determine if the menu will be persistant or not.
//Determination is made when the mouse's left button is released or if
//the mouse cursor enters the menu region.
if( gusMouseXPos >= gPopup.usLeft
if( gusMouseXPos >= gPopup.usLeft
&& gusMouseXPos <= gPopup.usRight
&& gusMouseYPos > gPopup.usTop //one pixel gap on top ignored
&& gusMouseYPos < gPopup.usBottom - 1 ) //two pixel gap on bottom ignored
@@ -382,15 +382,15 @@ void PopupMenuHandle()
//Check terminating conditions for persistant states.
if( gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT )
fWaitingForLButtonRelease = TRUE;
if( gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT
if( gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_PERSISTANT
|| !gfLeftButtonState && gPopup.ubActiveType == POPUP_ACTIVETYPE_NONPERSISTANT )
{
//Selection conditions via mouse have been met whether the mouse is in the
//Selection conditions via mouse have been met whether the mouse is in the
//menu region or not.
gPopup.ubSelectedIndex = GetPopupIndexFromMousePosition();
if( gPopup.ubSelectedIndex )
{
ProcessPopupMenuSelection();
ProcessPopupMenuSelection();
}
gPopup.fActive = FALSE;
MSYS_RemoveRegion( &popupRegion );
@@ -497,6 +497,7 @@ BOOLEAN ProcessPopupMenuIfActive( )
+19 -19
View File
@@ -2,8 +2,8 @@
#ifdef JA2EDITOR
//popupmenu.h
//Author: Kris Morness
//Created: Sept 4, 1997
//Author: Kris Morness
//Created: Sept 4, 1997
#ifndef __POPUPMENU_H
#define __POPUPMENU_H
@@ -12,30 +12,30 @@
POPUP MENU
DESIGN CONSIDERATIONS
There is currently no support for nested popup menus. Let Kris know if
There is currently no support for nested popup menus. Let Kris know if
you need this.
USER INSTRUCTIONS
The goal of this popup menu system is to create a quick and intuitive
interface system which is functionally similar to Win95 and MacOS.
interface system which is functionally similar to Win95 and MacOS.
As soon as you click on a button which activates the popup menu, the user
will choose a selection in one of three ways:
1) KEYBOARD - at anytime, the user can use the keyboard regardless of mouse
mode. The up/down arrow keys will cycle through the choices and enter will
accept the choice. ESC will cancel the menu without making a choice.
mode. The up/down arrow keys will cycle through the choices and enter will
accept the choice. ESC will cancel the menu without making a choice.
2) When the mousedown event activates the menu, the user releases the mouse before
entering the popup menu region. The menu mode will change and become persistant.
Clicking on the hilighted item will close the popup and activate the choice.
Clicking elsewhere, the popup will be closed without making a selection. This
is functionally equivalent to Win95.
entering the popup menu region. The menu mode will change and become persistant.
Clicking on the hilighted item will close the popup and activate the choice.
Clicking elsewhere, the popup will be closed without making a selection. This
is functionally equivalent to Win95.
3) When the mousedown event activates the menu, the user holds the mouse down and
moves the cursor over the popup region. At this moment the menu becomes
non-persistant and a choice is made by releasing the mouse. If the mouse is
released on a highlighted choice, that choice is selected, otherwise the popup
is cancelled. This is functionally equivalent to MacOS. The small diffence is
that under Win95's standard convention, the release of the mouse outside of the
region doesn't kill the menu, but in MacOS, it does.
moves the cursor over the popup region. At this moment the menu becomes
non-persistant and a choice is made by releasing the mouse. If the mouse is
released on a highlighted choice, that choice is selected, otherwise the popup
is cancelled. This is functionally equivalent to MacOS. The small diffence is
that under Win95's standard convention, the release of the mouse outside of the
region doesn't kill the menu, but in MacOS, it does.
*/
@@ -49,7 +49,7 @@ enum popupMenuIDs
};
//The direction of the popup menu relative to the button
//pressed to activate it or mouse position. In editor mode,
//pressed to activate it or mouse position. In editor mode,
//this will attempt to go up and to the right of the button.
#define UPMASK 0x00
#define DNMASK 0x10
@@ -79,11 +79,11 @@ typedef struct currentPopupMenuInformation{
UINT16 usFont;
BOOLEAN fActive;
BOOLEAN fUseKeyboardInfoUntilMouseMoves;
UINT16 usLeft, usTop, usRight, usBottom; //popup region coords.
UINT16 usLeft, usTop, usRight, usBottom; //popup region coords.
UINT16 usLastMouseX, usLastMouseY;
}CurrentPopupMenuInformation;
//A global var that keeps the popup menu information.
//A global var that keeps the popup menu information.
extern CurrentPopupMenuInformation gPopup;
extern STR16 popupMenuStrings[5];
+81 -81
View File
@@ -49,33 +49,33 @@ SGPPoint SelWinSpacing, SelWinStartPoint, SelWinEndPoint;
//These definitions help define the start and end of the various wall indices.
//This needs to be maintained if the walls change.
#define WALL_LAST_WALL_OFFSET 30
#define WALL_FIRST_AFRAME_OFFSET 31
#define WALL_LAST_AFRAME_OFFSET 34
#define WALL_FIRST_WINDOW_OFFSET 35
#define WALL_LAST_WINDOW_OFFSET 46
#define WALL_FIRST_BROKEN_WALL_OFFSET 47
#define WALL_LAST_BROKEN_WALL_OFFSET 54
#define WALL_FIRST_APPENDED_WALL_OFFSET 55
#define WALL_LAST_APPENDED_WALL_OFFSET 56
#define WALL_LAST_WALL_OFFSET 30
#define WALL_FIRST_AFRAME_OFFSET 31
#define WALL_LAST_AFRAME_OFFSET 34
#define WALL_FIRST_WINDOW_OFFSET 35
#define WALL_LAST_WINDOW_OFFSET 46
#define WALL_FIRST_BROKEN_WALL_OFFSET 47
#define WALL_LAST_BROKEN_WALL_OFFSET 54
#define WALL_FIRST_APPENDED_WALL_OFFSET 55
#define WALL_LAST_APPENDED_WALL_OFFSET 56
#define WALL_FIRST_WEATHERED_WALL_OFFSET 57
#define WALL_LAST_WEATHERED_WALL_OFFSET 64
#define WALL_LAST_WEATHERED_WALL_OFFSET 64
//I've added these definitions to add readability, and minimize conversion time for changes
//incase there are new values, etc.
//incase there are new values, etc.
#define OSTRUCTS_NUMELEMENTS ( LASTOSTRUCT - FIRSTFULLSTRUCT + 22 )
#define OSTRUCTS1_NUMELEMENTS 5
#define OSTRUCTS2_NUMELEMENTS 12
#define BANKSLIST_NUMELEMENTS 5
#define ROADSLIST_NUMELEMENTS 1
#define DEBRISLIST_NUMELEMENTS ( LASTDEBRIS - DEBRISROCKS + 2 + 1 ) //+1 for ANOTHERDEBRIS
#define DEBRISLIST_NUMELEMENTS ( LASTDEBRIS - DEBRISROCKS + 2 + 1 ) //+1 for ANOTHERDEBRIS
#define SINGLEWALL_NUMELEMENTS ( (LASTWALL-FIRSTWALL+1) * 2 )
#define SINGLEDOOR_NUMELEMENTS (( LASTDOOR - FIRSTDOOR + 1 ) * 5)
#define SINGLEWINDOW_NUMELEMENTS ( LASTWALL - FIRSTWALL + 1 )
#define SINGLEROOF_NUMELEMENTS ( (LASTROOF-FIRSTROOF+1) + (LASTSLANTROOF-FIRSTSLANTROOF+1) + \
(LASTWALL-FIRSTWALL+1) + (SECONDONROOF-FIRSTONROOF+1) )
#define SINGLENEWROOF_NUMELEMENTS (LASTROOF-FIRSTROOF+1)
#define SINGLENEWROOF_NUMELEMENTS (LASTROOF-FIRSTROOF+1)
#define SINGLEBROKENWALL_NUMELEMENTS ( (LASTDECORATIONS-FIRSTDECORATIONS+1) + (LASTWALL-FIRSTWALL+1)*2 )
#define SINGLEDECOR_NUMELEMENTS ( LASTISTRUCT - FIRSTISTRUCT + 1 )
#define SINGLEDECAL_NUMELEMENTS ( LASTWALLDECAL - FIRSTWALLDECAL + EIGTHWALLDECAL - FIFTHWALLDECAL + 3 )
@@ -87,8 +87,8 @@ SGPPoint SelWinSpacing, SelWinStartPoint, SelWinEndPoint;
(LASTROOF-FIRSTROOF+1) + (2 ))
//This is a special case for trees which may have varying numbers. There was a problem
//in which we loaded a new tileset which had one less tree in it. When we called BuildSelectionWindow(),
//This is a special case for trees which may have varying numbers. There was a problem
//in which we loaded a new tileset which had one less tree in it. When we called BuildSelectionWindow(),
//it would crash because it thought there was an extra tree which was now invalid.
UINT16 gusNumOStructs = 0;
@@ -104,15 +104,15 @@ DisplaySpec SingleDoor[ SINGLEDOOR_NUMELEMENTS ];
DisplaySpec SingleWindow[ SINGLEWINDOW_NUMELEMENTS ];
DisplaySpec SingleRoof[ SINGLEROOF_NUMELEMENTS ];
DisplaySpec SingleNewRoof[ SINGLENEWROOF_NUMELEMENTS ];
DisplaySpec SingleBrokenWall[ SINGLEBROKENWALL_NUMELEMENTS ];
DisplaySpec SingleBrokenWall[ SINGLEBROKENWALL_NUMELEMENTS ];
DisplaySpec SingleDecor[ SINGLEDECOR_NUMELEMENTS ];
DisplaySpec SingleDecal[ SINGLEDECAL_NUMELEMENTS ];
DisplaySpec SingleFloor[ SINGLEFLOOR_NUMELEMENTS ];
DisplaySpec SingleToilet[ SINGLETOILET_NUMELEMENTS ];
DisplaySpec Room[ ROOM_NUMELEMENTS ];
//These are all of the different selection lists. Changing the max_selections will
//change the number of selections values you can have at a time. This is Bret's gay code,
//These are all of the different selection lists. Changing the max_selections will
//change the number of selections values you can have at a time. This is Bret's gay code,
//though I've cleaned it up a lot.
Selections SelOStructs[MAX_SELECTIONS] = { {FIRSTFULLSTRUCT, 0, 1} }; // Default selections
Selections SelOStructs1[MAX_SELECTIONS] = { {FOURTHOSTRUCT, 0, 1} }; // Default selections
@@ -123,13 +123,13 @@ Selections SelDebris[MAX_SELECTIONS] = { {DEBRISROCKS, 0, 1} };
Selections SelSingleWall[MAX_SELECTIONS] = { {FIRSTWALL, 0, 1} };
Selections SelSingleDoor[MAX_SELECTIONS] = { {FIRSTDOOR, 0, 1} };
Selections SelSingleWindow[MAX_SELECTIONS] = { {FIRSTWALL, 44, 1} };
Selections SelSingleRoof[MAX_SELECTIONS] = { {FIRSTROOF, 0, 1} };
Selections SelSingleNewRoof[MAX_SELECTIONS] = { {FIRSTROOF, 0, 1} };
Selections SelSingleBrokenWall[MAX_SELECTIONS] = { {FIRSTDECORATIONS, 0, 1} };
Selections SelSingleRoof[MAX_SELECTIONS] = { {FIRSTROOF, 0, 1} };
Selections SelSingleNewRoof[MAX_SELECTIONS] = { {FIRSTROOF, 0, 1} };
Selections SelSingleBrokenWall[MAX_SELECTIONS] = { {FIRSTDECORATIONS, 0, 1} };
Selections SelSingleDecor[MAX_SELECTIONS]= { {FIRSTISTRUCT, 0, 1} };
Selections SelSingleDecal[MAX_SELECTIONS] = { {FIRSTWALLDECAL, 0, 1} };
Selections SelSingleFloor[MAX_SELECTIONS] = { {FIRSTFLOOR, 0, 1} };
Selections SelSingleToilet[MAX_SELECTIONS] = { {FIFTHISTRUCT, 0, 1} };
Selections SelSingleFloor[MAX_SELECTIONS] = { {FIRSTFLOOR, 0, 1} };
Selections SelSingleToilet[MAX_SELECTIONS] = { {FIFTHISTRUCT, 0, 1} };
Selections SelRoom[MAX_SELECTIONS] = { {FIRSTWALL, 0, 1} };
// Number of objects currently in the selection list
@@ -147,7 +147,7 @@ INT32 iNumDecorSelected = 1;
INT32 iNumDecalsSelected = 1;
INT32 iNumBrokenWallsSelected = 1;
INT32 iNumFloorsSelected = 1;
INT32 iNumToiletsSelected = 1;
INT32 iNumToiletsSelected = 1;
INT32 iNumRoofsSelected = 1;
INT32 iNumNewRoofsSelected = 1;
INT32 iNumRoomsSelected = 1;
@@ -157,7 +157,7 @@ Selections OldSelList[MAX_SELECTIONS];
INT32 iOldNumSelList;
// Global pointers for selection list
Selections *pSelList;
Selections *pSelList;
INT32 *pNumSelList;
// Global used to indicate which selection to use (changes with the PGUP/PGDWN keys in editor)
@@ -183,15 +183,15 @@ void CreateJA2SelectionWindow( INT16 sWhat )
fAllDone = FALSE;
DisableEditorTaskbar( );
// Load up the button images
iButtonIcons[ CANCEL_ICON ] = LoadGenericButtonIcon( "EDITOR//bigX.sti" );
iButtonIcons[ UP_ICON ] = LoadGenericButtonIcon( "EDITOR//lgUpArrow.sti" );
iButtonIcons[ DOWN_ICON ] = LoadGenericButtonIcon( "EDITOR//lgDownArrow.sti" );
iButtonIcons[ OK_ICON ] = LoadGenericButtonIcon( "EDITOR//checkmark.sti" );
iSelectWin = CreateHotSpot(0, 0, 600, 360, MSYS_PRIORITY_HIGH,
DEFAULT_MOVE_CALLBACK, SelWinClkCallback);
DEFAULT_MOVE_CALLBACK, SelWinClkCallback);
iCancelWin = CreateIconButton((INT16)iButtonIcons[CANCEL_ICON], 0,
BUTTON_USE_DEFAULT, 600, 40,
@@ -221,7 +221,7 @@ void CreateJA2SelectionWindow( INT16 sWhat )
DEFAULT_MOVE_CALLBACK, DwnClkCallback);
SetButtonFastHelpText(iScrollDown,L"Scroll window down");
fButtonsPresent = TRUE;
fButtonsPresent = TRUE;
SelWinSpacing.iX = 2;
SelWinSpacing.iY = 2;
@@ -230,12 +230,12 @@ void CreateJA2SelectionWindow( INT16 sWhat )
SelWinStartPoint.iY = 15;
iTopWinCutOff = 15;
SelWinEndPoint.iX = 599;
SelWinEndPoint.iY = 359;
iBotWinCutOff = 359;
switch( sWhat )
{
case SELWIN_OSTRUCTS:
@@ -352,14 +352,14 @@ void CreateJA2SelectionWindow( INT16 sWhat )
return;
}
BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &SelWinStartPoint, &SelWinEndPoint,
BuildDisplayWindow( pDSpec, usNSpecs, &pDispList, &SelWinStartPoint, &SelWinEndPoint,
&SelWinSpacing, CLEAR_BACKGROUND);
}
//The selection window method is initialized here. This is where all the graphics for all
//the categories are organized and loaded. If you wish to move things around, then this is
//where the initialization part is done. I have also changed this from previously being loaded
//The selection window method is initialized here. This is where all the graphics for all
//the categories are organized and loaded. If you wish to move things around, then this is
//where the initialization part is done. I have also changed this from previously being loaded
//every single time you go into a selection window which was redundant and CPU consuming.
void InitJA2SelectionWindow( void )
{
@@ -416,7 +416,7 @@ void InitJA2SelectionWindow( void )
OStructs1[ iCount + 1 ].uiObjIndx = FIRSTOSTRUCT + iCount;
}
// Other junk! (the "2" button in the "terrain" toolbar)
OStructs2[ 0 ].ubType = DISPLAY_GRAPHIC;
OStructs2[ 0 ].hVObject = gTileDatabase[gTileTypeStartIndex[THIRDOSTRUCT]].hTileSurface;
@@ -536,13 +536,13 @@ void InitJA2SelectionWindow( void )
DebrisList[ iCount ].usEnd = 0;
DebrisList[ iCount ].uiObjIndx = DEBRISROCKS + iCount;
}
// Add one more for new misc debris
// Add one more for new misc debris
DebrisList[ iCount ].ubType = DISPLAY_GRAPHIC;
DebrisList[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[DEBRIS2MISC ] ].hTileSurface;
DebrisList[ iCount ].usStart = DISPLAY_ALL_OBJECTS;
DebrisList[ iCount ].usEnd = 0;
DebrisList[ iCount ].uiObjIndx = DEBRIS2MISC;
//Add yet another one...
//Add yet another one...
iCount++;
DebrisList[ iCount ].ubType = DISPLAY_GRAPHIC;
DebrisList[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[ANOTHERDEBRIS ] ].hTileSurface;
@@ -584,7 +584,7 @@ void InitJA2SelectionWindow( void )
Room[ iCount ].uiObjIndx = FIRSTSLANTROOF + iCount2;
}
//Walls
//Walls
for ( iCount = 0, iCount2 = 0; iCount < (LASTWALL - FIRSTWALL + 1); iCount++, iCount2+=2 )
{
SingleWall[ iCount2 ].ubType = DISPLAY_GRAPHIC;
@@ -634,13 +634,13 @@ void InitJA2SelectionWindow( void )
SingleDoor[ iCount2+4 ].usEnd = 19;
SingleDoor[ iCount2+4 ].uiObjIndx = FIRSTDOOR + iCount;
}
//Windows
//Windows
for ( iCount = 0; iCount < (LASTWALL - FIRSTWALL + 1); iCount++ )
{
{
SingleWindow[ iCount ].ubType = DISPLAY_GRAPHIC;
SingleWindow[ iCount ].hVObject = gTileDatabase[gTileTypeStartIndex[FIRSTWALL + iCount]].hTileSurface;
SingleWindow[ iCount ].usStart = WALL_FIRST_WINDOW_OFFSET;
SingleWindow[ iCount ].usEnd = WALL_LAST_WINDOW_OFFSET;
SingleWindow[ iCount ].usStart = WALL_FIRST_WINDOW_OFFSET;
SingleWindow[ iCount ].usEnd = WALL_LAST_WINDOW_OFFSET;
SingleWindow[ iCount ].uiObjIndx = FIRSTWALL + iCount;
}
//Roofs and slant roofs
@@ -810,11 +810,11 @@ void RemoveJA2SelectionWindow( void )
pDispList = TrashList(pDispList);
}
gfRenderTaskbar = TRUE;
gfOverheadMapDirty = TRUE;
EnableEditorTaskbar( );
}
//----------------------------------------------------------------------------------------------
// TrashList
@@ -828,10 +828,10 @@ DisplayList *TrashList( DisplayList *pNode )
if (pNode->pNext != NULL)
pNode->pNext = TrashList(pNode->pNext);
if (pNode->pNext == NULL)
MemFree(pNode);
return(NULL);
}
@@ -865,9 +865,9 @@ void RenderSelectionWindow( void )
button = ButtonList[iSelectWin];
if ( button == NULL )
return;
if ( (abs( iStartClickX - button->Area.MouseXPos ) > 9) ||
(abs( iStartClickY - (button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY)) > 9) )
if ( (abs( iStartClickX - button->Area.MouseXPos ) > 9) ||
(abs( iStartClickY - (button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY)) > 9) )
{
// iSX = (INT32)iStartClickX;
// iEX = (INT32)button->Area.MouseXPos;
@@ -931,7 +931,7 @@ void SelWinClkCallback( GUI_BUTTON *button, INT32 reason )
if (!(button->uiFlags & BUTTON_ENABLED))
return;
iClickX = button->Area.MouseXPos;
iClickY = button->Area.MouseYPos + iTopWinCutOff - (INT16)SelWinStartPoint.iY;
@@ -976,7 +976,7 @@ void SelWinClkCallback( GUI_BUTTON *button, INT32 reason )
else if (reason & MSYS_CALLBACK_REASON_LBUTTON_UP )
{
button->uiFlags &= (~BUTTON_CLICKED_ON);
if( !gfRenderSquareArea )
return;
@@ -1061,7 +1061,7 @@ void DisplaySelectionWindowGraphicalInformation()
}
SetFont( FONT12POINT1 );
SetFontForeground( FONT_WHITE );
if( pNode )
if( pNode )
{
//usObjIndex = (UINT16)pNode->uiObjIndx;
//usIndex = pNode->uiIndex;
@@ -1074,13 +1074,13 @@ void DisplaySelectionWindowGraphicalInformation()
}
else
{
mprintf( 2, 2, L"File: %S, subindex: %d (%S)",
mprintf( 2, 2, L"File: %S, subindex: %d (%S)",
gTilesets[ giCurrentTilesetID ].TileSurfaceFilenames[ pNode->uiObjIndx ],
pNode->uiIndex, gTileSurfaceName[ pNode->uiObjIndx ] );
}
}
mprintf( 350, 2, L"Current Tileset: %s", gTilesets[ giCurrentTilesetID ].zName );
}
mprintf( 350, 2, L"Current Tileset: %s", gTilesets[ giCurrentTilesetID ].zName );
}
//----------------------------------------------------------------------------------------------
// AddToSelectionList
@@ -1095,12 +1095,12 @@ void AddToSelectionList( DisplayList *pNode )
for (iIndex = 0; iIndex < (*pNumSelList); iIndex++ )
{
if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject &&
pNode->uiIndex == pSelList[ iIndex ].usIndex )
pNode->uiIndex == pSelList[ iIndex ].usIndex )
{
iUseIndex = iIndex;
break;
}
}
}
if ( iUseIndex >= 0 )
{
@@ -1171,13 +1171,13 @@ BOOLEAN RemoveFromSelectionList( DisplayList *pNode )
for (iIndex = 0; iIndex < (*pNumSelList); iIndex++ )
{
if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject &&
pNode->uiIndex == pSelList[ iIndex ].usIndex )
pNode->uiIndex == pSelList[ iIndex ].usIndex )
{
iUseIndex = iIndex;
break;
}
}
}
if ( iUseIndex >= 0 )
{
// Was already in the list, so bump up the count
@@ -1188,7 +1188,7 @@ BOOLEAN RemoveFromSelectionList( DisplayList *pNode )
// Squash the list to remove old entry
for ( iIndex = iUseIndex; iIndex < ((*pNumSelList) - 1); iIndex++ )
pSelList[ iIndex ] = pSelList[ iIndex + 1 ];
(*pNumSelList)--;
fRemoved = TRUE;
}
@@ -1214,7 +1214,7 @@ INT32 GetRandomSelection( void )
fDontUseRandom = FALSE;
return( iCurBank );
}
iTotalCounts = 0;
for (iIndex = 0; iIndex < (*pNumSelList); iIndex++ )
iTotalCounts += (INT32)pSelList[ iIndex ].sCount;
@@ -1248,12 +1248,12 @@ BOOLEAN IsInSelectionList( DisplayList *pNode )
for (iIndex = 0; iIndex < (*pNumSelList) && !fFound; iIndex++ )
{
if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject &&
pNode->uiIndex == pSelList[ iIndex ].usIndex )
pNode->uiIndex == pSelList[ iIndex ].usIndex )
{
fFound = TRUE;
}
}
}
return ( fFound );
}
@@ -1275,13 +1275,13 @@ INT32 FindInSelectionList( DisplayList *pNode )
for (iIndex = 0; iIndex < (*pNumSelList) && !fFound; iIndex++ )
{
if ( pNode->uiObjIndx == pSelList[ iIndex ].uiObject &&
pNode->uiIndex == pSelList[ iIndex ].usIndex )
pNode->uiIndex == pSelList[ iIndex ].usIndex )
{
fFound = TRUE;
iUseIndex = iIndex;
}
}
}
return ( iUseIndex );
}
@@ -1289,7 +1289,7 @@ INT32 FindInSelectionList( DisplayList *pNode )
//----------------------------------------------------------------------------------------------
// SaveSelectionList
//
// Copies the current selection list to a save buffer. Used in case we want to cancel a
// Copies the current selection list to a save buffer. Used in case we want to cancel a
// selection window.
//
void SaveSelectionList( void )
@@ -1326,7 +1326,7 @@ void RestoreSelectionList( void )
void OkClkCallback( GUI_BUTTON *button, INT32 reason )
{
if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
button->uiFlags |= BUTTON_CLICKED_ON;
@@ -1345,7 +1345,7 @@ void OkClkCallback( GUI_BUTTON *button, INT32 reason )
// Button callback function for the selection window's CANCEL button
//
void CnclClkCallback( GUI_BUTTON *button, INT32 reason )
{
{
if (reason & MSYS_CALLBACK_REASON_LBUTTON_DWN )
{
button->uiFlags |= BUTTON_CLICKED_ON;
@@ -1480,14 +1480,14 @@ void DrawSelections( void )
GetClippingRect(&ClipRect);
SetClippingRect(&NewRect);
// SetFont( gpSmallFont );
SetFont( gpLargeFontType1 );
SetObjectShade( gvoLargeFontType1, 0 );
// SetObjectShade( gvoLargeFont, 0 );
DisplayWindowFunc( pDispList, iTopWinCutOff, iBotWinCutOff, &SelWinStartPoint, CLEAR_BACKGROUND );
SetObjectShade( gvoLargeFontType1, 4 );
SetClippingRect(&ClipRect);
@@ -1501,7 +1501,7 @@ void DrawSelections( void )
// properly scrolling the window etc.
//
BOOLEAN BuildDisplayWindow( DisplaySpec *pDisplaySpecs, UINT16 usNumSpecs, DisplayList **pDisplayList,
SGPPoint * pUpperLeft, SGPPoint * pBottomRight,
SGPPoint * pUpperLeft, SGPPoint * pBottomRight,
SGPPoint * pSpacing, UINT16 fFlags )
{
INT32 iCurrX = pUpperLeft->iX;
@@ -1552,7 +1552,7 @@ BOOLEAN BuildDisplayWindow( DisplaySpec *pDisplaySpecs, UINT16 usNumSpecs, Displ
iCurrY += usGreatestHeightInRow + pSpacing->iY;
usGreatestHeightInRow = 0;
}
if ((pCurNode = (DisplayList *)MemAlloc(sizeof(DisplayList))) != FALSE)
{
pCurNode->hObj = pDisplaySpec->hVObject;
@@ -1580,7 +1580,7 @@ BOOLEAN BuildDisplayWindow( DisplaySpec *pDisplaySpecs, UINT16 usNumSpecs, Displ
}
iCurrX += pETRLEObject->usWidth + pSpacing->iX;
}
}
}
}
@@ -1604,7 +1604,7 @@ BOOLEAN DisplayWindowFunc( DisplayList *pNode, INT16 iTopCutOff, INT16 iBottomCu
ETRLEObject * pETRLEObject;
UINT16 usFillColor;
INT16 sCount;
if ( pNode == NULL )
return(TRUE);
@@ -1637,7 +1637,7 @@ BOOLEAN DisplayWindowFunc( DisplayList *pNode, INT16 iTopCutOff, INT16 iBottomCu
usFillColor = SelWinHilightFillColor;
ColorFillVideoSurfaceArea( FRAME_BUFFER, pNode->iX, iCurrY,
pNode->iX + pNode->iWidth,
pNode->iX + pNode->iWidth,
iCurrY + pNode->iHeight, usFillColor);
}
@@ -1646,7 +1646,7 @@ BOOLEAN DisplayWindowFunc( DisplayList *pNode, INT16 iTopCutOff, INT16 iBottomCu
sCount = pSelList[ FindInSelectionList( pNode ) ].sCount;
SetObjectShade( pNode->hObj, DEFAULT_SHADE_LEVEL );
fReturnVal = BltVideoObject( FRAME_BUFFER, pNode->hObj, pNode->uiIndex,
fReturnVal = BltVideoObject( FRAME_BUFFER, pNode->hObj, pNode->uiIndex,
(UINT16)pNode->iX, (UINT16)iCurrY,
VO_BLT_SRCTRANSPARENCY, NULL);
@@ -1670,6 +1670,6 @@ BOOLEAN DisplayWindowFunc( DisplayList *pNode, INT16 iTopCutOff, INT16 iBottomCu
+3 -3
View File
@@ -82,7 +82,7 @@ typedef struct
HVOBJECT hVObject;
UINT16 usStart;
UINT16 usEnd;
UINT32 uiObjIndx;
UINT32 uiObjIndx;
};
struct
{
@@ -141,11 +141,11 @@ extern Selections SelSingleDoor[ MAX_SELECTIONS ];
extern Selections SelSingleWindow[ MAX_SELECTIONS ];
extern Selections SelSingleRoof[ MAX_SELECTIONS ];
extern Selections SelSingleNewRoof[ MAX_SELECTIONS ];
extern Selections SelSingleBrokenWall[ MAX_SELECTIONS ];
extern Selections SelSingleBrokenWall[ MAX_SELECTIONS ];
extern Selections SelSingleDecor[ MAX_SELECTIONS ];
extern Selections SelSingleDecal[ MAX_SELECTIONS ];
extern Selections SelSingleFloor[ MAX_SELECTIONS ];
extern Selections SelSingleToilet[ MAX_SELECTIONS ];
extern Selections SelSingleToilet[ MAX_SELECTIONS ];
extern Selections SelRoom[ MAX_SELECTIONS ];
+111 -110
View File
@@ -23,27 +23,27 @@
#include "Editor Undo.h"
#endif
INT16 gbSmoothStruct[] =
INT16 gbSmoothStruct[] =
{
3, 2, 12, 27, 12, 0,
5, 2, 15, 30, 39, 0,
5, 2, 15, 30, 39, 0,
7, 2, 17, 32, 41, 0,
11, 2, 14, 29, 14, 0,
11, 2, 14, 29, 14, 0,
8, 2, 13, 28, 38, 0,
15, 1, 19, 0, 43, 0,
26, 1, 20, 0, 44, 0,
12, 2, 18, 33, 42, 0,
23, 1, 21, 0, 45, 0,
18, 2, 16, 31, 40, 0,
21, 1, 22, 0, 46, 0,
14, 2, 11, 26, 11, 0,
19, 1, 23, 0, 47, 0,
16, 2, 24, 34, 48, 0,
10, 2, 25, 35, 49, 0,
-1
15, 1, 19, 0, 43, 0,
26, 1, 20, 0, 44, 0,
12, 2, 18, 33, 42, 0,
23, 1, 21, 0, 45, 0,
18, 2, 16, 31, 40, 0,
21, 1, 22, 0, 46, 0,
14, 2, 11, 26, 11, 0,
19, 1, 23, 0, 47, 0,
16, 2, 24, 34, 48, 0,
10, 2, 25, 35, 49, 0,
-1
};
// This is a list of smoothed out water/shoreline textures
// Coding is as such:
// 1st - the corresponding bitvalue for the surrounding water tiles
@@ -51,21 +51,21 @@ INT16 gbSmoothStruct[] =
// 3rd - the first variation
// 4th - the second variation
INT16 gbSmoothWaterStruct[] =
INT16 gbSmoothWaterStruct[] =
// FIRST ENTRY MAJIC NUMBER CALCULATED
// 2nd ENTRY # OF VARIATIONS
// 3rd, 4rth ENTRY TILE NUMBERS ( entry 1, entry 2 )
// 3rd, 4rth ENTRY TILE NUMBERS ( entry 1, entry 2 )
{
1020, 1, 11, 0,
1000, 1, 12, 0,
1020, 1, 11, 0,
1000, 1, 12, 0,
510, 2, 13, 43,
190, 1, 14, 0,
894, 1, 15, 0,
622, 1, 16, 0,
1014, 2, 17, 41,
944, 1, 18, 24,
872, 1, 19, 0,
992, 1, 20, 0,
622, 1, 16, 0,
1014, 2, 17, 41,
944, 1, 18, 24,
872, 1, 19, 0,
992, 1, 20, 0,
62, 1, 21, 0,
190, 2, 22, 14,
620, 1, 23, 0,
@@ -74,51 +74,51 @@ INT16 gbSmoothWaterStruct[] =
434, 1, 28, 0,
110, 1, 29,0,
1010, 1, 30,0,
876, 2, 31, 32,
876, 2, 31, 32,
878, 2, 32, 31,
1004, 2, 32, 31,
1004, 2, 32, 31,
1006, 2, 33, 34,
1008, 2, 34, 33,
1016, 2, 33, 34,
126, 2, 35, 36,
254, 2, 35, 26,
638, 2, 36, 26,
254, 2, 35, 26,
638, 2, 36, 26,
438, 2, 38, 27,
446, 2, 37, 38,
950, 2, 37, 27,
864, 1, 39, 0,
1040, 1, 40, 0,
1040, 1, 40, 0,
1014, 2, 41, 17,
432, 1, 42, 0,
510, 1, 43, 13,
54, 1, 44, 0,
108, 1, 45, 0,
108, 1, 45, 0,
-1
};
BOOLEAN HigherLevel( UINT32 gridno, UINT8 NewLevel );
BOOLEAN ContainsWater( UINT32 gridno );
BOOLEAN HigherLevel( INT32 gridno, UINT8 NewLevel );
BOOLEAN ContainsWater( INT32 gridno );
void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth )
{
int temp=0,type=0;
int temp=0;
int FullTile = FALSE;
UINT16 usOldIndex;
UINT16 usTempIndex;
UINT32 cnt;
BOOLEAN fFound;
UINT32 uiTempIndex;
UINT16 usTileIndex;
UINT16 usTileIndex;
UINT16 land=0;
UINT32 uiTopType;
UINT32 uiTopType;
BOOLEAN fSameTile;
INT16 *pSmoothStruct;
// Check to see if the orginal texture was water, is so, smooth square/hex with
// Check to see if the orginal texture was water, is so, smooth square/hex with
// SmoothWaterTerrain rather than the proceeding method
if( origType==REGWATERTEXTURE)
{
SmoothWaterTerrain( gridno, origType, piNewTile, TRUE);
SmoothWaterTerrain( gridno, origType, piNewTile, TRUE);
return;
}
pSmoothStruct = gbSmoothStruct;
@@ -142,7 +142,7 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm
if ( usOldIndex >= 1 && usOldIndex <= 10 )
{
*piNewTile = NO_TILE;
return;
return;
}
}
@@ -188,7 +188,7 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm
// Now, at this point the height (of "temp") will tell us
// which texture piece to use
// Loop through smooth struct
cnt = 0;
fFound = FALSE;
@@ -210,10 +210,10 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm
}
if ( pSmoothStruct[ cnt + 3 ] )
{
if ( pSmoothStruct[ cnt + 3 ] == usOldIndex )
{
if ( pSmoothStruct[ cnt + 3 ] == usOldIndex )
{
fSameTile = TRUE;
}
}
}
if ( fSameTile )
{
@@ -221,7 +221,7 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm
return;
}
uiTempIndex = rand() % pSmoothStruct[ cnt + 1 ];
land = pSmoothStruct[ cnt + 2 + uiTempIndex ];
land = pSmoothStruct[ cnt + 2 + uiTempIndex ];
fFound = TRUE;
} while( FALSE );
break;
@@ -236,14 +236,14 @@ void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSm
*piNewTile = NO_TILE;
return;
}
// this is a "full" tile, so randomize between the
// this is a "full" tile, so randomize between the
// five available tiles
land = (rand( ) % 10 ) + 1;
FullTile = TRUE;
}
GetTileIndexFromTypeSubIndex( origType, land, &usTileIndex );
*piNewTile = usTileIndex;
}
}
void SmoothExitGridRadius( INT16 sMapIndex, UINT8 ubRadius )
{
@@ -277,14 +277,14 @@ void SmoothExitGridRadius( INT16 sMapIndex, UINT8 ubRadius )
void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth )
{
int temp=0,type=0;
int temp=0;
int FullTile = FALSE;
UINT16 usOldIndex;
UINT16 usTempIndex;
UINT32 cnt;
BOOLEAN fFound;
UINT32 uiTempIndex;
UINT16 usTileIndex;
UINT16 usTileIndex;
UINT16 usExitGridIndex=0;
BOOLEAN fSameTile;
@@ -311,7 +311,7 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth )
if ( usOldIndex >= 1 && usOldIndex <= 10 )
{
*piNewTile = NO_TILE;
return;
return;
}
}
@@ -357,7 +357,7 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth )
// Now, at this point the height (of "temp") will tell us
// which texture piece to use
// Loop through smooth struct
cnt = 0;
fFound = FALSE;
@@ -377,10 +377,10 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth )
}
if ( pSmoothStruct[ cnt + 3 ] )
{
if ( pSmoothStruct[ cnt + 3 ] == usOldIndex )
{
if ( pSmoothStruct[ cnt + 3 ] == usOldIndex )
{
fSameTile = TRUE;
}
}
}
if ( fSameTile )
{
@@ -388,7 +388,7 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth )
return;
}
uiTempIndex = rand() % pSmoothStruct[ cnt + 1 ];
usExitGridIndex = pSmoothStruct[ cnt + 2 + uiTempIndex ];
usExitGridIndex = pSmoothStruct[ cnt + 2 + uiTempIndex ];
fFound = TRUE;
} while( FALSE );
break;
@@ -403,34 +403,34 @@ void SmoothExitGrid(int gridno, UINT16 *piNewTile, BOOLEAN fForceSmooth )
*piNewTile = NO_TILE;
return;
}
// this is a "full" tile, so randomize between the
// this is a "full" tile, so randomize between the
// five available tiles
usExitGridIndex = (rand( ) % 10 ) + 1;
FullTile = TRUE;
}
GetTileIndexFromTypeSubIndex( EXITTEXTURE, usExitGridIndex, &usTileIndex );
*piNewTile = usTileIndex;
}
}
void SmoothTerrainWorld( UINT32 uiCheckType )
{
int cnt;
UINT16 usIndex;
UINT16 NewTile;
// Smooth out entire world surrounding tiles
for ( cnt = 0; cnt < WORLD_MAX; cnt++ )
{
int cnt;
UINT16 usIndex;
UINT16 NewTile;
// Smooth out entire world surrounding tiles
for ( cnt = 0; cnt < WORLD_MAX; cnt++ )
{
if ( TypeExistsInLandLayer( cnt, uiCheckType, &usIndex ) )
{
SmoothTerrain( cnt, uiCheckType, &NewTile, TRUE );
if ( NewTile != NO_TILE )
{
// Change tile
SetLandIndex( cnt, NewTile, uiCheckType, FALSE );
}
if ( NewTile != NO_TILE )
{
// Change tile
SetLandIndex( cnt, NewTile, uiCheckType, FALSE );
}
}
}
}
}
@@ -440,7 +440,7 @@ void SmoothAllTerrainWorld( void )
UINT16 usIndex;
UINT16 NewTile;
UINT32 uiCheckType;
// Smooth out entire world surrounding tiles
// Smooth out entire world surrounding tiles
for ( cnt = 0; cnt < WORLD_MAX; cnt++ )
{
for ( uiCheckType = FIRSTTEXTURE; uiCheckType <= SEVENTHTEXTURE; uiCheckType++ )
@@ -451,8 +451,8 @@ void SmoothAllTerrainWorld( void )
if ( NewTile != NO_TILE )
{
// Change tile
SetLandIndex( cnt, NewTile, uiCheckType, FALSE );
// Change tile
SetLandIndex( cnt, NewTile, uiCheckType, FALSE );
}
}
}
@@ -461,39 +461,39 @@ void SmoothAllTerrainWorld( void )
void SmoothTerrainRadius( UINT32 iMapIndex, UINT32 uiCheckType, UINT8 ubRadius, BOOLEAN fForceSmooth )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT32 iNewIndex;
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2;
INT32 iNewIndex;
UINT16 NewTile;
UINT16 usIndex;
INT32 leftmost;
// Don't bother to smooth floors, they don't need them
if ( uiCheckType >= FIRSTFLOOR && uiCheckType <= LASTFLOOR )
if ( uiCheckType >= FIRSTFLOOR && uiCheckType <= LASTFLOOR )
return;
// Determine start end end indicies and num rows
sTop = ubRadius;
sBottom = -ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ )
{
leftmost = ( ( iMapIndex + ( WORLD_COLS * cnt1 ) )/ WORLD_COLS ) * WORLD_COLS;
for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ )
{
iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2;
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
{
if ( TypeExistsInLandLayer( iNewIndex, uiCheckType, &usIndex ) )
{
SmoothTerrain( iNewIndex, uiCheckType, &NewTile, fForceSmooth );
SmoothTerrain( iNewIndex, uiCheckType, &NewTile, fForceSmooth );
if ( NewTile != NO_TILE )
{
// Change tile
AddToUndoList( iNewIndex );
SetLandIndex( iNewIndex, NewTile, uiCheckType, FALSE );
{
// Change tile
AddToUndoList( iNewIndex );
SetLandIndex( iNewIndex, NewTile, uiCheckType, FALSE );
}
}
}
@@ -503,18 +503,18 @@ void SmoothTerrainRadius( UINT32 iMapIndex, UINT32 uiCheckType, UINT8 ubRadius,
void SmoothAllTerrainTypeRadius( UINT32 iMapIndex, UINT8 ubRadius, BOOLEAN fForceSmooth )
{
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2, cnt3;
INT32 iNewIndex;
INT16 sTop, sBottom;
INT16 sLeft, sRight;
INT16 cnt1, cnt2, cnt3;
INT32 iNewIndex;
UINT16 NewTile;
UINT16 usIndex;
INT32 leftmost;
// Determine start end end indicies and num rows
sTop = ubRadius;
sBottom = -ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
sLeft = - ubRadius;
sRight = ubRadius;
for( cnt3 = FIRSTTEXTURE; cnt3 <= SEVENTHTEXTURE; cnt3++ )
{
for( cnt1 = sBottom; cnt1 <= sTop; cnt1++ )
@@ -523,16 +523,16 @@ void SmoothAllTerrainTypeRadius( UINT32 iMapIndex, UINT8 ubRadius, BOOLEAN fForc
for( cnt2 = sLeft; cnt2 <= sRight; cnt2++ )
{
iNewIndex = iMapIndex + ( WORLD_COLS * cnt1 ) + cnt2;
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
if ( iNewIndex >=0 && iNewIndex < WORLD_MAX &&
iNewIndex >= leftmost && iNewIndex < ( leftmost + WORLD_COLS ) )
{
if ( TypeExistsInLandLayer( iNewIndex, cnt3, &usIndex ) )
{
SmoothTerrain( iNewIndex, cnt3, &NewTile, fForceSmooth );
SmoothTerrain( iNewIndex, cnt3, &NewTile, fForceSmooth );
if ( NewTile != NO_TILE )
{
// Change tile
SetLandIndex( iNewIndex, NewTile, cnt3, FALSE );
// Change tile
SetLandIndex( iNewIndex, NewTile, cnt3, FALSE );
}
}
}
@@ -544,18 +544,18 @@ void SmoothAllTerrainTypeRadius( UINT32 iMapIndex, UINT8 ubRadius, BOOLEAN fForc
void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth )
{
// This procedure will calculate the approriate smooth texture for a water texture
// based on the surrounding water textures. This is done via masking bits within
// based on the surrounding water textures. This is done via masking bits within
// a temp variable, then searching for the right texture and inserting it
int temp=0,type=0;
int temp=0;
int FullTile = FALSE;
UINT16 usOldIndex;
UINT16 usTempIndex;
UINT32 cnt;
BOOLEAN fFound;
UINT32 uiTempIndex;
UINT16 usTileIndex;
UINT16 usTileIndex;
UINT16 land=0;
UINT32 uiTopType;
UINT32 uiTopType;
BOOLEAN fSameTile;
INT16 *pSmoothStruct;
@@ -578,7 +578,7 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF
if ( usOldIndex >= 1 && usOldIndex <= 10 )
{
*piNewTile = NO_TILE;
return;
return;
}
}
// Mask approriate bits in temp for the lookup in the SmoothWaterStruct list
@@ -673,8 +673,8 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF
cnt = 0;
fFound = FALSE;
GetLandHeadType( gridno, &uiTopType );
// Speed up of this while loop using double/quick search will result
// in an incorrect solution due to multiple instances of bitvalues in the list of
// Speed up of this while loop using double/quick search will result
// in an incorrect solution due to multiple instances of bitvalues in the list of
// smoothed water textures
while( pSmoothStruct[ cnt ] != -1 )
{
@@ -690,10 +690,10 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF
}
if ( pSmoothStruct[ cnt + 3 ] )
{
if ( pSmoothStruct[ cnt + 3 ] == usOldIndex )
{
if ( pSmoothStruct[ cnt + 3 ] == usOldIndex )
{
fSameTile = TRUE;
}
}
}
if ( fSameTile )
{
@@ -701,7 +701,7 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF
return;
}
uiTempIndex = rand() % pSmoothStruct[ cnt + 1 ];
land = pSmoothStruct[ cnt + 2 + uiTempIndex ];
land = pSmoothStruct[ cnt + 2 + uiTempIndex ];
fFound = TRUE;
} while( FALSE );
break;
@@ -711,7 +711,7 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF
if ( !fFound )
{
// Check for existance of same tile
if ( usOldIndex >= 1 && usOldIndex <= 10 )
if ( usOldIndex >= 1 && usOldIndex <= 10 )
{
*piNewTile = NO_TILE;
return;
@@ -721,13 +721,14 @@ void SmoothWaterTerrain( int gridno, int origType, UINT16 *piNewTile, BOOLEAN fF
}
GetTileIndexFromTypeSubIndex( origType, land, &usTileIndex );
*piNewTile = usTileIndex;
}
}
#endif
+3 -3
View File
@@ -8,13 +8,13 @@
#define ONELEVELTYPETWOROOF 2
// Area (pointer to SGP rect) +
// Location to check-+--| | |---- Check left and right edges -----| |---- Check top and bottom edges -----|
// Area (pointer to SGP rect) +
// Location to check-+--| | |---- Check left and right edges -----| |---- Check top and bottom edges -----|
#define IsLocationInArea( x, y, r ) ( ((x) >= r->iLeft) && ((x) <= r->iRight) && ((y) >= r->iTop) && ((y) <= r->iBottom) )
void SmoothAllTerrainWorld( void );
void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth );
void SmoothTerrain(int gridno, int origType, UINT16 *piNewTile, BOOLEAN fForceSmooth );
void SmoothTerrainRadius( UINT32 iMapIndex, UINT32 uiCheckType, UINT8 ubRadius, BOOLEAN fForceSmooth );
void SmoothTerrainWorld( UINT32 uiCheckType );