예제 #1
0
/*
 * StatButtonCommand:  User pressed stat button
 */
void StatButtonCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
	int group;
	list_type stat_list;

	group = StatsFindGroupByHwnd(hwndCtl) + 1;  // Skip main stat group
	if (group == GROUP_NONE)
		return;

	if (group != StatsGetCurrentGroup())
	{
		//	ajw Changes to make Inventory act somewhat like one of the stats groups.
		if( StatsGetCurrentGroup() == STATS_INVENTORY )
		{
			//	Inventory must be going away.
			ShowInventory( False );
//			StatsShowGroup( True );
		}

		if( group == STATS_INVENTORY )
		{
			//	The hacks continue... Force previously toggled non-inventory button to repaint and show new unpressed state.
			InvalidateRect( buttons[ StatsGetCurrentGroup()-2 ].hwnd, NULL, FALSE );

			StatsShowGroup( False );
			ShowInventory( True );
			DisplayInventoryAsStatGroup( (BYTE)STATS_INVENTORY );
		}
		else
		{
			// Check stat cache; if group not present, ask server
			if (StatCacheGetEntry(group, &stat_list) == True)
				DisplayStatGroup((BYTE) group, stat_list);
			else
			{
				debug(("Requesting group %d\n", group));
				RequestStats(group);
			}
		}
	}
	if( StatsGetCurrentGroup() == STATS_INVENTORY )
		InventorySetFocus( True );		//	Force focus to leave stats group window after button within it was pushed.
	//	[ xxx Still broken - click on Inv when it is already selected, but drag off of button and release. ]
}
예제 #2
0
bool PlayerBehaviour::SendMessage (csStringID msg_id, iCelPropertyClass* pc,
	celData& ret, iCelParameterBlock* params, va_list arg)
{
	GetActorMove ();

	if(msg_id == id_pccommandinput_forward1)
		pcactormove->Forward(true);
	else if(msg_id == id_pccommandinput_forward0)
		pcactormove->Forward(false);
	else if(msg_id == id_pccommandinput_backward1)
		pcactormove->Backward(true);
	else if(msg_id == id_pccommandinput_backward0)
		pcactormove->Backward(false);
	else if(msg_id == id_pccommandinput_rotateleft1)
		pcactormove->RotateLeft(true);
	else if(msg_id == id_pccommandinput_rotateleft0)
    pcactormove->RotateLeft(false);
	else if(msg_id == id_pccommandinput_rotateright1)
		pcactormove->RotateRight(true);
	else if(msg_id == id_pccommandinput_rotateright0)
		pcactormove->RotateRight(false);
	else if(msg_id == id_pccommandinput_cammode1)
		pcactormove->ToggleCameraMode ();
	else if(msg_id == id_pccommandinput_drop1)
		Drop();
	else if(msg_id == id_pcinventory_addchild)
	{
		GetInventory();
		printf("Got a new object! Objects in inventory:\n");
		ShowInventory();
	}
	else if(msg_id == id_pcinventory_removechild)
	{
		GetInventory();
		printf("Object removed from inventory! Objects in inventory:\n");
		ShowInventory();
	}
	else
		return CommonBehaviour::SendMessage(msg_id, pc, ret, params, arg);

	return true;
}
예제 #3
0
/*
 * InterfaceRedrawModule:  Called when main window needs to be redrawn.
 */
void InterfaceRedrawModule(HDC hdc)
{
	UserAreaRedraw();
  InterfaceDrawElements(hdc);
  StatsDrawBorder();
  StatsMainRedraw();
  StatsDraw();
  if( StatsGetCurrentGroup() == STATS_INVENTORY )
  {
    InvalidateRect( GetHwndInv(), NULL, FALSE );
    ShowInventory(TRUE);
    InventoryRedraw();
  }
}
예제 #4
0
int InventoryManager::Equip(bool *keys)
{
    for (int i = 65; i < 91; i++) //a - w
    {
        if (keys[i] == true)
        {
            int ret = World.getMonsterManager().getMonsterItems().EquipItem(&(*World.getMonsterManager().Player()), i - 65);
            mState = eDisplay;
            keys[i] = false;
            ShowInventory(-1);
            return ret;
        }
    }
    return 1;
}
예제 #5
0
int InventoryManager::Drop(bool *keys)
{
    int find = 0;

    for (int i = 65; i < 91; i++) //a - w
    {
        if (keys[i] == true)
        {
            Unequip(i - 65);

            if (DropItem(i - 65))
            {
                ShowInventory(-1);
                mState = eDisplay;
            }
            keys[i] = false;
        }
    }
    return 1;
}
예제 #6
0
int InventoryManager::Unequip(int item)
{
    ITEMLIST::iterator it;

    ITEMLIST *inventory = &World.getMonsterManager().Player()->inventory;
    MonsterData *player = World.getMonsterManager().Player();

    int i = 0;

    for (it = inventory->begin(); it != inventory->end(); it++, i++)
    {
        if (i == item) //found
        {
            if (it->equipped == 1) //unequip
            {
                it->equipped = 0;
                ShowInventory(-1);
            }
            return 1;
        }
    }
    return 0;
}
예제 #7
0
int InventoryManager::InventoryCommand(bool *keys)
{
    if (keys[VC_X] || keys[VK_ESC]) //inventory look
    {
        keys[VK_ESC] = false;
        keys[VC_X] = false;

        if (mState == eEquip || mState == eDrop)
        {
            ShowInventory(-1);
            mState = eDisplay;
            return 1;
        }
        else if (mState == eDisplay)
        {
            return 0;
        }
    }

    else if (mState == eEquip)
    {
        int ret = Equip(keys);
        if (ret)
            return ret;
    }

    else if (mState == eDrop)
    {
        int ret = Drop(keys);
        if (ret)
            return ret;
    }

    else if (keys[VK_U]) //equip/unequip
    {
        EquipMessage();
        mState = eEquip;
        keys[VK_U] = false;
    }

    else if (keys[VK_D]) //drop
    {
        DropMessage();
        mState = eDrop;
        keys[VK_D] = false;
    }

    else if (keys[VK_E]) //toggle keys
    {
        mShowEquip = true;
        mShowAll = mShowInv = false;

        ShowInventory(1);
        keys[VK_E] = false;
    }
    else if (keys[VK_I]) //toggle keys
    {
        mShowInv = true;
        mShowAll = mShowEquip = false;
        ShowInventory(0);
        keys[VK_E] = false;
    }
    else if (keys[VK_A]) //toggle keys
    {
        mShowAll = !mShowAll;
        ShowInventory(-1);
        keys[VK_E] = false;
    }

    return 1;
}