Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c76e21e
Merge pull request #5 from TurningWheel/barony-next
Aug 13, 2017
bd92840
Merge remote-tracking branch 'main/barony-next' into barony-next
Aug 15, 2017
b0b0399
Merge pull request #6 from TurningWheel/barony-next
Aug 18, 2017
0e58c2d
+ Added ItemModifyingGUI class which handles all GUI's for Item modif…
Sep 8, 2017
f17c926
* Rearranged code so that inventory doesn't open if Spell is cast but…
Sep 8, 2017
55eb0f0
* Replaced old implementation of item modifying spells with new
Sep 8, 2017
2b4a80d
+ Added 'areThereValidItems()' to check for valid items before castin…
Sep 8, 2017
18f5316
* Fixed 'areThereValidItems()' being private
Sep 8, 2017
50b2032
+ Added checks to prevent spellcast if there are no valid items to be…
Sep 8, 2017
4863aab
+ Added several lines pertaining to the new GUI's and their various f…
Sep 8, 2017
84afe3d
- Removed the deprecated GUI controller init code
Sep 9, 2017
a4790e7
* Updated NUMLANGENTRIES to correct amount
Sep 9, 2017
525203d
- Removed deprecated item_Scroll functions for item modifying GUI scr…
Sep 9, 2017
9075084
* Replaced deprecated code with new itemModifyingGUI implementation
Sep 9, 2017
5510568
+ Added initial setup and final cleanup of itemModifyingGUI
Sep 9, 2017
426c58c
+ Added various documentation comments
Sep 9, 2017
6bf4d3c
+ Added a check to prevent any further progression if bIsActive == false
Sep 9, 2017
7bf01e3
* Tweaked several small things and added gamepadMoveCursor() and more…
Sep 13, 2017
a846892
+ Added Enchant Scrolls functionality and other various tweaks/fixes
Sep 15, 2017
9fcb493
+ Added the new lang entries for Enchant Scrolls
Sep 15, 2017
7f95817
+ Added checks for is player is blind, they cannot read scrolls
Sep 15, 2017
40e3f2e
- Removed a check for instant appraisal on item pickup, it is now han…
Sep 15, 2017
cc3759a
+ Added enum 'ItemArmorType' and its getter function
Sep 15, 2017
7e439ce
- Removed the now deprecated Enchant Weapon and Armor Scrolls functions
Sep 15, 2017
2264446
+ Added braces to if statements
Sep 15, 2017
f3586bd
* Replaced any instance of 'inventoryChest_bmp' with 'itemModifyingGU…
Sep 15, 2017
9a6dafe
+ Added function isMouseWithinGUIBounds()
Sep 15, 2017
2f4d43f
* Changed click check to handle itemModifyingGUI
Sep 15, 2017
317e8b0
* Refactored opening of chest to handle ItemModifyingGUI
Sep 15, 2017
5ef0fba
* Refactored entityClicked() to handle ItemModifyingGUI
Sep 15, 2017
f697335
* Style Guidelines cleanup
Sep 15, 2017
0318ad4
* Refactored open shop menu to handle itemModifyingGUI
Sep 15, 2017
d51ace1
- Removed deprecated handleIdentifyMovement() and handleRemoveCurseMo…
Sep 15, 2017
b63b245
+ Added handleItemModifyingGUIMovement()
Sep 15, 2017
2f7e0df
+ Added initialization and cleanup of AppraisalGUI object
Sep 15, 2017
fa88a8d
* Refactored client opening chest and shop to handle ItemModifyingGUI
Sep 15, 2017
2eccaee
* Refactored drawStatus() to handle ItemModifyingGUI and AppraisalGUI
Sep 15, 2017
6a11798
- Commented out all deprecated code relating to 'updateRightSidebar()'
Sep 15, 2017
34fbdfd
* Refactored gameLogic() and main() to handle ItemModifyingGUI
Sep 15, 2017
e3465c3
* Updated VS Barony Solution to be accurate and added ItemModifyingGU…
Sep 15, 2017
3b2ef25
* Refactored player inventory to handle ItemModifyingGUI
Sep 15, 2017
945cf06
* Refactored interface.cpp to handle ItemModifyingGUI
Sep 15, 2017
94b761e
+ Added freeGUIImage() to handle unloading of image resource
Sep 15, 2017
f87e921
* Refactored interface.hpp to handle ItemModifyingGUI/AppraisalGUI an…
Sep 15, 2017
1d85c0b
- Commented out deprecated versions of ItemModifyingGUI pending removal
Sep 15, 2017
653c1bc
* Renamed functions for much more clarity
Sep 19, 2017
c601549
+ Added the functions for GUI_UpdateServer() for client-sided changes…
Sep 20, 2017
1016c3c
* Modified the packets sent for Identify and Remove Curse spells
Sep 20, 2017
9fd5f6c
+ Refactored IDEN/RCUR into appropriate handlers for ItemModifyingGUI…
Sep 20, 2017
794ad8c
+ Added a small hack to get ItemModifyingGUI working locally, rather …
Sep 20, 2017
985bb36
* Renamed public functions to be more clear and concise
Sep 20, 2017
8eb03c7
* Updated all the new ItemModifyingGUI function names to be correct
Sep 20, 2017
f392cb1
* Changed name to be updated (accidentally commited earlier)
Sep 20, 2017
bc66c67
* Refactored playerinventory.cpp to handle AppraisalGUI
Sep 20, 2017
84623b4
* Refactored gameLogic() to handle AppraisalGUI
Sep 20, 2017
1d4b8ee
* Updated some comments
Sep 21, 2017
cb26e9a
- Removed unused global variables that are replaced by AppraisalGUI
Sep 21, 2017
4f55e66
* Replaced deprecated variables with AppraisalGUI
Sep 21, 2017
75ab86b
* Refactored consumeItem to handle AppraisalGUI
Sep 21, 2017
ff822c9
- Commented out deprecated AppraisalGUI drawing function
Sep 21, 2017
c9ac248
* Refactored actPlayer() to handle AppraisalGUI
Sep 21, 2017
9cc6213
+ Created the new AppraisalGUI class
Sep 21, 2017
956ec85
* Changed DrawGUI() to be public
Sep 21, 2017
855137b
* Replaced updateAppraisalItemBox() with AppraisalGUI->DrawGUI()
Sep 21, 2017
9f08c2e
* Added the actual initialization statement that was forgotten
Sep 21, 2017
29f4d75
+ Resolved merge conflict - Added missing lines
Sep 21, 2017
abb2b6d
* Fixed formatting (spaces -> tabs)
Sep 26, 2017
3b3c499
- Remove the deprecated code entirely
Sep 26, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 25 additions & 22 deletions VS.2015/Barony/Barony.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,6 @@
<ClCompile Include="..\..\src\actsummontrap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\cursors.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\entity_shared.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -324,9 +321,6 @@
<ClCompile Include="..\..\src\interface\drawstatus.cpp">
<Filter>Source Files\interface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\interface\identify_and_appraise.cpp">
<Filter>Source Files\interface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\interface\interface.cpp">
<Filter>Source Files\interface</Filter>
</ClCompile>
Expand All @@ -336,9 +330,6 @@
<ClCompile Include="..\..\src\interface\playerinventory.cpp">
<Filter>Source Files\interface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\interface\removecurse.cpp">
<Filter>Source Files\interface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\interface\screenshot.cpp">
<Filter>Source Files\interface</Filter>
</ClCompile>
Expand Down Expand Up @@ -369,6 +360,12 @@
<ClCompile Include="..\..\src\magic\spell.cpp">
<Filter>Source Files\magic</Filter>
</ClCompile>
<ClCompile Include="..\..\src\interface\AppraisalGUI.cpp">
<Filter>Source Files\interface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\interface\ItemModifyingGUI.cpp">
<Filter>Source Files\interface</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\book.hpp">
Expand Down Expand Up @@ -443,26 +440,32 @@
<ClInclude Include="..\..\src\player.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\collision.hpp">
<Filter>Source Files</Filter>
<ClInclude Include="..\..\src\interface\interface.hpp">
<Filter>Header Files\interface</Filter>
</ClInclude>
<ClInclude Include="..\..\src\colors.hpp">
<Filter>Source Files</Filter>
<ClInclude Include="..\..\src\magic\magic.hpp">
<Filter>Header Files\magic</Filter>
</ClInclude>
<ClInclude Include="..\..\src\cppfuncs.hpp">
<Filter>Source Files</Filter>
<ClInclude Include="..\..\src\interface\AppraisalGUI.hpp">
<Filter>Header Files\interface</Filter>
</ClInclude>
<ClInclude Include="..\..\src\hash.hpp">
<Filter>Source Files</Filter>
<ClInclude Include="..\..\src\interface\ItemModifyingGUI.hpp">
<Filter>Header Files\interface</Filter>
</ClInclude>
<ClInclude Include="..\..\src\paths.hpp">
<Filter>Source Files</Filter>
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\interface\interface.hpp">
<Filter>Header Files\interface</Filter>
<ClInclude Include="..\..\src\collision.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\magic\magic.hpp">
<Filter>Header Files\magic</Filter>
<ClInclude Include="..\..\src\colors.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\cppfuncs.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\hash.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
Expand Down
32 changes: 30 additions & 2 deletions lang/en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2909,6 +2909,8 @@ client (player %d) (direct ip)#
2281 spellbook#
2282 blank spellbook 5#
2283 spellbook#
2284 empty bottle#
2285 empty bottle#

#Additional ingame text.
2350 A fragment breaks away from your %s.#
Expand Down Expand Up @@ -2976,5 +2978,31 @@ dominate the %s into your service!#
2476 You feel the reflect magic spell fail as the
last of your magic is drained!#


2499 end#
2499 Repair an Item#
2500 There are no valid items to use this on!#
2501 This is a scroll of remove curse!#
2502 This is a scroll of repair!#
2503 This is a scroll of enchant weapon!#
2504 This is a scroll of enchant armor!#
2505 Oh no! The scroll was cursed!#
2506 Your %s was unidentified!#
2507 Your %s was cursed!#
2508 Your %s is now broken!#
2509 Your %s was disenchanted!#
2510 You have no remaining items for the scroll's blessing...#
2511 Wow! Your %s was identified too!#
2512 Wow! Your %s was uncursed too!#
2513 You have no items for the scroll's curse...#
2514 Oh no! Your %s was unidentified too!#
2515 Oh no! Your %s was cursed too!#
2516 Oh no! Your %s was broken too!#
2517 Your %s looks perfect now!#
2518 Enchant a Weapon#
2519 Enchant an Armor Piece#
2520 Your %s glows blue!#
2521 Your %s glows violently blue!#
2522 Your %s radiates power!#
2523 Oh no! Your %s was disenchanted too!#
2524 You have no remaining items for the scroll's curse...#

2525 end#
8 changes: 5 additions & 3 deletions src/actchest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,13 @@ void Entity::actChest()
messagePlayer(chestclicked, language[459]);
chestOpener = chestclicked;
openedChest[chestclicked] = this;
if ( removecursegui_active )

// If the ItemModifyingGUI is open, close it
if ( itemModifyingGUI->IsGUIOpen() == true )
{
closeRemoveCurseGUI();
itemModifyingGUI->CloseGUI();
}
identifygui_active = false;

if (chestclicked != 0 && multiplayer == SERVER)
{
//Send all of the items to the client.
Expand Down
74 changes: 3 additions & 71 deletions src/actplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,79 +618,11 @@ void actPlayer(Entity* my)
}
}

if (PLAYER_NUM == clientnum && appraisal_timer > 0)
if ( PLAYER_NUM == clientnum )
{
Item* tempItem = uidToItem(appraisal_item);
if ( tempItem )
if ( appraisalGUI->IsGUIOpen() == true )
{
if ( tempItem->identified )
{
appraisal_timer = 0;
appraisal_item = 0;
}
else if ( tempItem->type == GEM_ROCK )
{
//Auto-succeed on rocks.
tempItem->identified = true;
messagePlayer(clientnum, language[570], tempItem->description());
appraisal_item = 0;
appraisal_timer = 0;
}
else
{
appraisal_timer -= 1; //De-increment appraisal timer.
if (appraisal_timer <= 0)
{
appraisal_timer = 0;

//Cool. Time to identify the item.
bool success = false;
if ( stats[PLAYER_NUM]->PROFICIENCIES[PRO_APPRAISAL] < 100 )
{
if ( tempItem->type != GEM_GLASS )
{
success = (stats[PLAYER_NUM]->PROFICIENCIES[PRO_APPRAISAL] + my->getPER() * 5 >= items[tempItem->type].value / 10);
}
else
{
success = (stats[PLAYER_NUM]->PROFICIENCIES[PRO_APPRAISAL] + my->getPER() * 5 >= 100);
}
}
else
{
success = true; // always succeed when appraisal is maxed out
}
if ( success )
{
tempItem->identified = true;
messagePlayer(clientnum, language[570], tempItem->description());
}
else
{
messagePlayer(clientnum, language[571], tempItem->description());
}

//Attempt a level up.
if ( items[tempItem->type].value > 0 )
{
if ( tempItem->identified )
{
my->increaseSkill(PRO_APPRAISAL);
}
else if ( rand() % 5 == 0 )
{
my->increaseSkill(PRO_APPRAISAL);
}
}

appraisal_item = 0;
}
}
}
else
{
appraisal_timer = 0;
appraisal_item = 0;
appraisalGUI->UpdateGUI();
}
}

Expand Down
52 changes: 30 additions & 22 deletions src/collision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,55 +57,63 @@ Entity* entityClicked()

if ( !(*inputPressed(impulses[IN_USE])) && !(*inputPressed(joyimpulses[INJOY_GAME_USE])) )
{
return NULL;
return nullptr;
}
if ( !shootmode )
{
if ( itemMenuOpen )
{
return NULL;
return nullptr;
}
if ( omousex < camera.winx || omousex >= camera.winx + camera.winw || omousey < camera.winy || omousey >= camera.winy + camera.winh )
{
return NULL;
return nullptr;
}
if (openedChest[clientnum])
if (omousex > CHEST_INVENTORY_X && omousex < CHEST_INVENTORY_X + inventoryChest_bmp->w && omousey > CHEST_INVENTORY_Y && omousey < CHEST_INVENTORY_Y + inventoryChest_bmp->h)
if ( openedChest[clientnum] )
{
if ( omousex > CHEST_INVENTORY_X && omousex < CHEST_INVENTORY_X + inventoryChest_bmp->w && omousey > CHEST_INVENTORY_Y && omousey < CHEST_INVENTORY_Y + inventoryChest_bmp->h )
{
return NULL; //Click falls inside the chest inventory GUI.
return nullptr; //Click falls inside the chest inventory GUI.
}
if (identifygui_active)
if (omousex > IDENTIFY_GUI_X && omousex < IDENTIFY_GUI_X + identifyGUI_img->w && omousey > IDENTIFY_GUI_Y && omousey < IDENTIFY_GUI_Y + identifyGUI_img->h)
}
if ( itemModifyingGUI->IsGUIOpen() == true )
{
if ( itemModifyingGUI->IsMouseWithinGUIBounds() == true )
{
return NULL; //Click falls inside the identify item gui.
return nullptr; // Click falls within the itemModifyingGUI's bounds
}
if (book_open)
if (mouseInBounds(BOOK_GUI_X, BOOK_GUI_X + bookgui_img->w, BOOK_GUI_Y, BOOK_GUI_Y + bookgui_img->h))
}
if ( book_open )
{
if ( mouseInBounds(BOOK_GUI_X, BOOK_GUI_X + bookgui_img->w, BOOK_GUI_Y, BOOK_GUI_Y + bookgui_img->h) )
{
return NULL; //Click falls inside the book GUI.
return nullptr; //Click falls inside the book GUI.
}
if (gui_mode == GUI_MODE_INVENTORY || gui_mode == GUI_MODE_SHOP)
}
if ( gui_mode == GUI_MODE_INVENTORY || gui_mode == GUI_MODE_SHOP )
{
if ( gui_mode == GUI_MODE_INVENTORY )
if (mouseInBounds(RIGHTSIDEBAR_X, RIGHTSIDEBAR_X + rightsidebar_titlebar_img->w, RIGHTSIDEBAR_Y, RIGHTSIDEBAR_Y + rightsidebar_height))
{
if ( mouseInBounds(RIGHTSIDEBAR_X, RIGHTSIDEBAR_X + rightsidebar_titlebar_img->w, RIGHTSIDEBAR_Y, RIGHTSIDEBAR_Y + rightsidebar_height) )
{
return NULL; //Click falls inside the right sidebar.
return nullptr; //Click falls inside the right sidebar.
}
}
//int x = std::max(character_bmp->w, xres/2-inventory_bmp->w/2);
//if (mouseInBounds(x,x+inventory_bmp->w,0,inventory_bmp->h))
//return NULL;
if ( mouseInBounds(INVENTORY_STARTX, INVENTORY_STARTX + INVENTORY_SIZEX * INVENTORY_SLOTSIZE, INVENTORY_STARTY, INVENTORY_STARTY + INVENTORY_SIZEY * INVENTORY_SLOTSIZE) )
{
// clicked in inventory
return NULL;
return nullptr;
}
if ( gui_mode == GUI_MODE_SHOP )
{
int x1 = xres / 2 - SHOPWINDOW_SIZEX / 2, x2 = xres / 2 + SHOPWINDOW_SIZEX / 2;
int y1 = yres / 2 - SHOPWINDOW_SIZEY / 2, y2 = yres / 2 + SHOPWINDOW_SIZEY / 2;
if (mouseInBounds(x1, x2, y1, y2))
{
return NULL;
return nullptr;
}
}
}
Expand All @@ -117,7 +125,7 @@ Entity* entityClicked()
int height = spell_list_titlebar_bmp->h;
int numspells = 0;
node_t* node;
for (node = spellList.first; node != NULL; node = node->next)
for (node = spellList.first; node != nullptr; node = node->next)
{
numspells++;
}
Expand All @@ -128,18 +136,18 @@ Entity* entityClicked()

if (mouseInBounds(MAGICSPELL_LIST_X, MAGICSPELL_LIST_X + spell_list_titlebar_bmp->w, spelllist_y, spelllist_y + height))
{
return NULL;
return nullptr;
}
}
}
if (mouseInBounds(0, 224, 0, 420)) // character sheet
{
return NULL;
return nullptr;
}
int x = xres / 2 - (status_bmp->w / 2);
if (mouseInBounds(x, x + status_bmp->w, yres - status_bmp->h, yres))
{
return NULL;
return nullptr;
}
*inputPressed(impulses[IN_USE]) = 0;
*inputPressed(joyimpulses[INJOY_GAME_USE]) = 0;
Expand Down Expand Up @@ -173,7 +181,7 @@ Entity* entityClicked()
}
else
{
return NULL;
return nullptr;
}
}

Expand Down
Loading