From: <ac...@us...> - 2010-10-31 02:14:49
|
Revision: 6327 http://planeshift.svn.sourceforge.net/planeshift/?rev=6327&view=rev Author: acraig Date: 2010-10-31 02:14:42 +0000 (Sun, 31 Oct 2010) Log Message: ----------- Initial checkin of quickspell bar window ( bartender ). Right now can drag and drop spells on it. Missing the ability to actually cast the spell and to persist the changes after log out. Modified Paths: -------------- trunk/src/client/gui/pawsslot.cpp trunk/src/client/gui/pawsslot.h trunk/src/client/gui/pawsspellbookwindow.cpp trunk/src/client/gui/pawsspellbookwindow.h trunk/src/client/psengine.cpp trunk/src/client/psslotmgr.cpp trunk/src/common/net/messages.h trunk/src/common/paws/pawsmanager.h Modified: trunk/src/client/gui/pawsslot.cpp =================================================================== --- trunk/src/client/gui/pawsslot.cpp 2010-10-30 15:19:46 UTC (rev 6326) +++ trunk/src/client/gui/pawsslot.cpp 2010-10-31 02:14:42 UTC (rev 6327) @@ -64,6 +64,7 @@ reserved = false; drawStackCount = true; + isBartender = false; } @@ -80,7 +81,13 @@ containerID = ident->GetAttributeValueAsInt("container"); slotID = ident->GetAttributeValueAsInt("id"); } - + + csRef<iDocumentNode> bartender = node->GetNode("bartender_slot"); + if ( bartender ) + { + isBartender = bartender->GetContentsValueAsInt(); + } + mgr = psengine->GetSlotManager(); return true; @@ -130,7 +137,9 @@ return parent->OnButtonPressed(button, modifiers, this); } else + { return pawsWidget::OnMouseDown(button, modifiers, x, y ); + } } } @@ -162,6 +171,8 @@ void pawsSlot::PlaceItem( const char* imageName, const char* meshFactName, const char* matName, int count ) { + + printf( "Placing Image: %s\n", imageName); meshfactName = meshFactName; materialName = matName; Modified: trunk/src/client/gui/pawsslot.h =================================================================== --- trunk/src/client/gui/pawsslot.h 2010-10-30 15:19:46 UTC (rev 6326) +++ trunk/src/client/gui/pawsslot.h 2010-10-31 02:14:42 UTC (rev 6327) @@ -71,7 +71,11 @@ void OnUpdateData(const char *dataname,PAWSData& value); void ScalePurifyStatus(); - + + bool IsBartender() { return isBartender; } + + void SetBartenderAction(csString& act) { action = act; } + csString &GetBartenderAction() { return action; } protected: psSlotManager* mgr; csString meshfactName; @@ -91,6 +95,9 @@ pawsTextBox* stackCountLabel; bool handleMouseClicks; bool emptyOnZeroCount; // should the slot clear itself when the stackcount hits 0 ? + + bool isBartender; /// Flag on if this a special bartender slot. + csString action; /// This is the action to do if this a bartender button. }; CREATE_PAWS_FACTORY( pawsSlot ); Modified: trunk/src/client/gui/pawsspellbookwindow.cpp =================================================================== --- trunk/src/client/gui/pawsspellbookwindow.cpp 2010-10-30 15:19:46 UTC (rev 6326) +++ trunk/src/client/gui/pawsspellbookwindow.cpp 2010-10-31 02:14:42 UTC (rev 6327) @@ -33,6 +33,7 @@ #include "paws/pawstextbox.h" #include "paws/pawslistbox.h" #include "paws/pawsmanager.h" +#include "gui/pawsslot.h" #include "gui/pawscontrolwindow.h" @@ -57,7 +58,8 @@ spellList = (pawsListBox*)FindWidget("SpellList"); spellDescription = (pawsMessageTextBox*)FindWidget("Description"); - spellImage = (pawsWidget*)FindWidget("SpellImage"); + spellImage = (pawsSlot*)FindWidget("SpellImage"); + spellImage->DrawStackCount(false); spellList->SetSortingFunc(0, textBoxSortFunc); spellList->SetSortingFunc(5, textBoxSortFunc); @@ -97,7 +99,7 @@ ShowActiveMagic(); return true; } - return false; + return true; } @@ -192,6 +194,9 @@ selectedSpell.Replace( spellName->GetText() ); spellDescription->AddMessage(descriptions_Hash.Get(spellName->GetText(), "Unknown")); spellDescription->ResetScroll(); - spellImage->SetBackground(images_Hash.Get(spellName->GetText(), "")); + //spellImage->SetBackground(images_Hash.Get(spellName->GetText(), "")); + spellImage->PlaceItem(images_Hash.Get(spellName->GetText(),""), "", "", 1); + csString action = "/cast " + csString(spellName->GetText()); + spellImage->SetBartenderAction(action); } } Modified: trunk/src/client/gui/pawsspellbookwindow.h =================================================================== --- trunk/src/client/gui/pawsspellbookwindow.h 2010-10-30 15:19:46 UTC (rev 6326) +++ trunk/src/client/gui/pawsspellbookwindow.h 2010-10-31 02:14:42 UTC (rev 6327) @@ -25,6 +25,7 @@ class pawsTextBox; class pawsListBox; class pawsMessageTextBox; +class pawsSlot; #include "net/cmdbase.h" #include "gui/pawscontrolwindow.h" @@ -58,7 +59,7 @@ pawsListBox* spellList; pawsMessageTextBox* spellDescription; - pawsWidget* spellImage; + pawsSlot* spellImage; csString selectedSpell; Modified: trunk/src/client/psengine.cpp =================================================================== --- trunk/src/client/psengine.cpp 2010-10-30 15:19:46 UTC (rev 6326) +++ trunk/src/client/psengine.cpp 2010-10-31 02:14:42 UTC (rev 6327) @@ -192,7 +192,9 @@ #include "gui/pawsconfigchatbubbles.h" #include "gui/pawsconfigshadows.h" #include "gui/pawsnpcdialog.h" +#include "gui/bartender.h" + // Needed for debugging csString psEngine::hwRenderer = ""; csString psEngine::hwVersion = ""; @@ -817,6 +819,7 @@ RegisterFactory (pawsConfigChatBubblesFactory); RegisterFactory (pawsConfigShadowsFactory); RegisterFactory (pawsNpcDialogWindowFactory); + RegisterFactory (pawsBartenderWindowFactory); RegisterFactory (pawsCraftCancelWindowFactory); } @@ -1406,6 +1409,7 @@ LoadPawsWidget( "GameBoard", "gameboard.xml"); LoadPawsWidget( "Writing window", "bookwriting.xml"); LoadPawsWidget( "NPC dialog window", "dialog.xml"); + LoadPawsWidget( "QuickSpellBar", "quick_spell_bar.xml"); LoadPawsWidget( "Craft status window", "craftcancelwindow.xml" ); LoadCustomPawsWidgets("/data/gui/customwidgetslist.xml"); Modified: trunk/src/client/psslotmgr.cpp =================================================================== --- trunk/src/client/psslotmgr.cpp 2010-10-30 15:19:46 UTC (rev 6326) +++ trunk/src/client/psslotmgr.cpp 2010-10-31 02:14:42 UTC (rev 6327) @@ -217,6 +217,7 @@ void psSlotManager::SetDragDetails( pawsSlot* slot, int count ) { + printf("SetDragDetails: \n"); draggingSlot.containerID = slot->ContainerID(); draggingSlot.slotID = slot->ID(); draggingSlot.stackCount = count; @@ -340,25 +341,51 @@ } else { + printf("Dropping Slot Here\n"); + printf("Target Slot Information: \n"); + printf("Bartender Slot: %d\n", slot->IsBartender()); //printf("Sending slot movement message\n"); - psSlotMovementMsg msg( draggingSlot.containerID, draggingSlot.slotID, + if ( slot->IsBartender() ) + { + CancelDrag(); + slot->PlaceItem( draggingSlot.slot->ImageName(), "", "", draggingSlot.stackCount); + } + else + { + printf("Slot->ID: %d\n", slot->ID() ); + printf("Container: %d\n", slot->ContainerID() ); + printf("DraggingSlot.ID %d\n", draggingSlot.slotID); + + if ( draggingSlot.containerID == CONTAINER_SPELL_BOOK ) + { + // Stop dragging the spell around + CancelDrag(); + + // Set the image to this slot. + slot->PlaceItem( draggingSlot.slot->ImageName(), "", "", draggingSlot.stackCount); + } + else + { + psSlotMovementMsg msg( draggingSlot.containerID, draggingSlot.slotID, slot->ContainerID(), slot->ID(), draggingSlot.stackCount ); - msg.SendMessage(); + msg.SendMessage(); - // Reset widgets/objects/status. - PawsManager::GetSingleton().SetDragDropWidget( NULL ); - isDragging = false; - if(isPlacing) - { - psengine->GetSceneManipulator()->RemoveSelected(); - if(hadInventory) - { - PawsManager::GetSingleton().GetMainWidget()->FindWidget("InventoryWindow")->Show(); + // Reset widgets/objects/status. + PawsManager::GetSingleton().SetDragDropWidget( NULL ); + isDragging = false; + if(isPlacing) + { + psengine->GetSceneManipulator()->RemoveSelected(); + if(hadInventory) + { + PawsManager::GetSingleton().GetMainWidget()->FindWidget("InventoryWindow")->Show(); + } + isPlacing = false; + isRotating = false; + hadInventory = false; + } } - isPlacing = false; - isRotating = false; - hadInventory = false; } - } + } } Modified: trunk/src/common/net/messages.h =================================================================== --- trunk/src/common/net/messages.h 2010-10-30 15:19:46 UTC (rev 6326) +++ trunk/src/common/net/messages.h 2010-10-31 02:14:42 UTC (rev 6327) @@ -61,7 +61,8 @@ CONTAINER_RECEIVING_MONEY = -7, CONTAINER_WORLD = -8, - CONTAINER_GEM_OBJECT = -9 + CONTAINER_GEM_OBJECT = -9, + CONTAINER_SPELL_BOOK = -10 }; struct iSector; Modified: trunk/src/common/paws/pawsmanager.h =================================================================== --- trunk/src/common/paws/pawsmanager.h 2010-10-30 15:19:46 UTC (rev 6326) +++ trunk/src/common/paws/pawsmanager.h 2010-10-31 02:14:42 UTC (rev 6327) @@ -605,8 +605,6 @@ csEventID SelectionNotifyEvent; #endif - - }; /// Stores the relationship between iSndSysData * and sound filename. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |