Add careful movement type to proto. Not used yet.

develop
Japa Mala Illo 2017-12-26 12:34:46 +05:30
parent f5fc7fe1a1
commit e9e5113ff7
4 changed files with 86 additions and 49 deletions

@ -7,53 +7,70 @@ import "RemoteFortressReader.proto";
enum AdvmodeMenu enum AdvmodeMenu
{ {
Default = 0; Default = 0;
Look = 1; Look = 1;
ConversationAddress = 2; ConversationAddress = 2;
ConversationSelect = 3; ConversationSelect = 3;
ConversationSpeak = 4; ConversationSpeak = 4;
Inventory = 5; Inventory = 5;
Drop = 6; Drop = 6;
ThrowItem = 7; ThrowItem = 7;
Wear = 8; Wear = 8;
Remove = 9; Remove = 9;
Interact = 10; Interact = 10;
Put = 11; Put = 11;
PutContainer = 12; PutContainer = 12;
Eat = 13; Eat = 13;
ThrowAim = 14; ThrowAim = 14;
Fire = 15; Fire = 15;
Get = 16; Get = 16;
Unk17 = 17; Unk17 = 17;
CombatPrefs = 18; CombatPrefs = 18;
Companions = 19; Companions = 19;
MovementPrefs = 20; MovementPrefs = 20;
SpeedPrefs = 21; SpeedPrefs = 21;
InteractAction = 22; InteractAction = 22;
MoveCarefully = 23; MoveCarefully = 23;
Announcements = 24; Announcements = 24;
UseBuilding = 25; UseBuilding = 25;
Travel = 26; Travel = 26;
Unk27 = 27; Unk27 = 27;
Unk28 = 28; Unk28 = 28;
SleepConfirm = 29; SleepConfirm = 29;
SelectInteractionTarget = 30; SelectInteractionTarget = 30;
Unk31 = 31; Unk31 = 31;
Unk32 = 32; Unk32 = 32;
FallAction = 33; FallAction = 33;
ViewTracks = 34; ViewTracks = 34;
Jump = 35; Jump = 35;
Unk36 = 36; Unk36 = 36;
AttackConfirm = 37; AttackConfirm = 37;
AttackType = 38; AttackType = 38;
AttackBodypart = 39; AttackBodypart = 39;
AttackStrike = 40; AttackStrike = 40;
Unk41 = 41; Unk41 = 41;
Unk42 = 42; Unk42 = 42;
DodgeDirection = 43; DodgeDirection = 43;
Unk44 = 44; Unk44 = 44;
Unk45 = 45; Unk45 = 45;
Build = 46; Build = 46;
}
enum CarefulMovementType
{
DEFAULT_MOVEMENT = 0;
RELEASE_ITEM_HOLD = 1;
RELEASE_TILE_HOLD = 2;
ATTACK_CREATURE = 3;
HOLD_TILE = 4;
MOVE = 5;
CLIMB = 6;
HOLD_ITEM = 7;
BUILDING_INTERACT = 8;
ITEM_INTERACT = 9;
ITEM_INTERACT_GUIDE = 10;
ITEM_INTERACT_RIDE = 11;
ITEM_INTERACT_PUSH = 12;
} }
message MoveCommandParams message MoveCommandParams
@ -66,6 +83,7 @@ message MovementOption
optional RemoteFortressReader.Coord dest = 1; optional RemoteFortressReader.Coord dest = 1;
optional RemoteFortressReader.Coord source = 2; optional RemoteFortressReader.Coord source = 2;
optional RemoteFortressReader.Coord grab = 3; optional RemoteFortressReader.Coord grab = 3;
optional CarefulMovementType movement_type = 4;
} }
message MenuContents message MenuContents

@ -188,6 +188,7 @@ command_result MoveCommand(DFHack::color_ostream &stream, const MoveCommandParam
} }
return CR_OK; return CR_OK;
} }
command_result JumpCommand(DFHack::color_ostream &stream, const MoveCommandParams *in) command_result JumpCommand(DFHack::color_ostream &stream, const MoveCommandParams *in)
{ {
if (!in->has_direction()) if (!in->has_direction())
@ -262,3 +263,18 @@ command_result MenuQuery(DFHack::color_ostream &stream, const EmptyMessage *in,
return CR_OK; return CR_OK;
} }
command_result MovementSelectCommand(DFHack::color_ostream &stream, const dfproto::IntMessage *in)
{
if (!(df::global::ui_advmode->menu == ui_advmode_menu::MoveCarefully))
return CR_OK;
int choice = in->value();
int page = choice / 5;
int select = choice % 5;
for (int i = 0; i < page; i++)
{
keyQueue.push(interface_key::SECONDSCROLL_PAGEDOWN);
}
keyQueue.push((interface_key::interface_key)(interface_key::OPTION1 + select));
return CR_OK;
}

@ -7,6 +7,8 @@
DFHack::command_result MoveCommand(DFHack::color_ostream &stream, const AdventureControl::MoveCommandParams *in); DFHack::command_result MoveCommand(DFHack::color_ostream &stream, const AdventureControl::MoveCommandParams *in);
DFHack::command_result JumpCommand(DFHack::color_ostream &stream, const AdventureControl::MoveCommandParams *in); DFHack::command_result JumpCommand(DFHack::color_ostream &stream, const AdventureControl::MoveCommandParams *in);
DFHack::command_result MenuQuery(DFHack::color_ostream &stream, const dfproto::EmptyMessage *in, AdventureControl::MenuContents *out); DFHack::command_result MenuQuery(DFHack::color_ostream &stream, const dfproto::EmptyMessage *in, AdventureControl::MenuContents *out);
DFHack::command_result MovementSelectCommand(DFHack::color_ostream &stream, const dfproto::IntMessage *in);
void KeyUpdate(); void KeyUpdate();

@ -293,8 +293,9 @@ DFhackCExport RPCService *plugin_rpcconnect(color_ostream &)
svc->addFunction("GetReports", GetReports, SF_ALLOW_REMOTE); svc->addFunction("GetReports", GetReports, SF_ALLOW_REMOTE);
svc->addFunction("MoveCommand", MoveCommand, SF_ALLOW_REMOTE); svc->addFunction("MoveCommand", MoveCommand, SF_ALLOW_REMOTE);
svc->addFunction("JumpCommand", JumpCommand, SF_ALLOW_REMOTE); svc->addFunction("JumpCommand", JumpCommand, SF_ALLOW_REMOTE);
svc->addFunction("MenuQuery", MenuQuery, SF_ALLOW_REMOTE); svc->addFunction("MenuQuery", MenuQuery, SF_ALLOW_REMOTE);
return svc; svc->addFunction("MovementSelectCommand", MovementSelectCommand, SF_ALLOW_REMOTE);
return svc;
} }
// This is called right before the plugin library is removed from memory. // This is called right before the plugin library is removed from memory.