Skip to content

Commit

Permalink
add hairdresser and can not change hair in room anymore
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <[email protected]>
  • Loading branch information
cosmo-ray committed Dec 2, 2023
1 parent 2374a5b commit 738cd52
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 25 deletions.
7 changes: 5 additions & 2 deletions actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1059,12 +1059,15 @@ local function back_and_reload_mc()
backToGame2()
end

function open_dressup_menu()
function open_dressup_menu(arg0, arg1, arg2)
local wid = Entity.new_array()

print("open_dressup_menu !!!!!!")
print("open_dressup_menu !!!!!!", Entity.wrapp(arg2))
wid["<type>"] = "dressup"

if yIsNNil(Entity.wrapp(arg2)) then
wid.dress_type = yeGetString(arg2)
end
wid.background = "rgba: 140 150 155 255";
wid.char_clothes = phq.pj.inventory;
wid.quit = Entity.new_func(back_and_reload_mc)
Expand Down
3 changes: 2 additions & 1 deletion dress/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function dressUp(caracter)
if yIsNil(objects) then
explosion("OBJECT MUST BE SET FIRST !!!!")
end

caracter = Entity.wrapp(caracter)
local e = caracter.equipement
local objs = objects
Expand Down Expand Up @@ -61,7 +62,7 @@ function dressUp(caracter)
end
if cur_o.equipement_effect then
yePushBack(caracter.eq_effect, cur_o.equipement_effect)
end
end
if cur_o.equipement_callback then
yesCall(ygGet(yeGetString(cur_o.equipement_callback)));
end
Expand Down
56 changes: 35 additions & 21 deletions dress/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ function menu_setup($wid, $mn, $mn_type) {
$cu = ywMenuGetCurrentEntry($mn);
$si = yeGet($cu, "slider_idx");
$mn_pos = yeGetIntAt($wid, 'mn_pos');
$dress_type = yeGetStringAt($wid, "dress_type");
if ($si) {
yeIncrRef($si);
yePush($si, $mn, '_csi_');
Expand All @@ -99,10 +100,13 @@ function menu_setup($wid, $mn, $mn_type) {
ywMenuClear($mn);
echo '$si bef 1 refcount: ', yeRefCount($si), "\n";
if ($mn_type == $GLOBALS['MAIN_MENU']) {
ywMenuPushEntry($mn, 'hairs');
ywMenuPushEntry($mn, 'torso/robe');
ywMenuPushEntry($mn, 'pants/skirt');
ywMenuPushEntry($mn, 'shoes');
if ($dress_type != "dress")
ywMenuPushEntry($mn, 'hairs');
if ($dress_type != "hair") {
ywMenuPushEntry($mn, 'torso/robe');
ywMenuPushEntry($mn, 'pants/skirt');
ywMenuPushEntry($mn, 'shoes');
}
if (yeGetStringAt($wid, "type") == "maker")
ywMenuPushEntry($mn, "save", ygGet('dressup.to_file'));

Expand Down Expand Up @@ -160,11 +164,13 @@ function menu_setup($wid, $mn, $mn_type) {

function reset_character($cwid, $mod, $cw) {
$char = yeGet($cwid, 'character');
print("reset c in !!!" . yeEntitiesUsed() . " \n");
$_c_ = yeGet($cwid, '_c_');
if ($_c_) {
lpcsHandlerNullify($_c_);
yeRemoveChildByEntity($cwid, $_c_);
yeRemoveChildByStr($char, 'clothes');
print("reset c __c__ !!!" . yeEntitiesUsed() . " \n");
}
lpcsHandlerNullify();
yesCall(yeGet($mod, "dressUp"), $char);
Expand All @@ -173,6 +179,7 @@ function reset_character($cwid, $mod, $cw) {
ylpcsHandlerSetOrigXY($ch, 0, 2);
ylpcsHandlerRefresh($ch);
ywCanvasMultiplySize(yeGet($ch, "canvas"), 5);
print("reset c out !!!" . yeEntitiesUsed() . " \n");
}

function action($wid, $eves) {
Expand All @@ -184,6 +191,7 @@ function action($wid, $eves) {
$cur_mn = yeGetIntAt($wid, "cur_mn");
menu_setup($wid, $menu, $cur_mn);
$ret = $YEVE_ACTION;
$dress_type = yeGetStringAt($wid, "dress_type");
print("dress action --- !!!" . yeEntitiesUsed() . " \n");

yeIntRoundBound(yeGet($wid, 'mn_pos'), 0, ywMenuNbEntries($menu) - 1);
Expand All @@ -193,24 +201,30 @@ function action($wid, $eves) {
yeAddAt($wid, 'mn_pos', -1);
} else if (yevIsKeyDown($eves, $Y_ENTER_KEY)) {
$pos = yeGetIntAt($wid, 'mn_pos');
if ($cur_mn == $GLOBALS['MAIN_MENU'] &&
$pos == $GLOBALS['TORSO_MENU_POS']) {
yeSetIntAt($wid, 'cur_mn', $GLOBALS['TORSO_MENU']);
return action($wid, NULL);
} else if ($cur_mn == $GLOBALS['MAIN_MENU'] &&
$pos == $GLOBALS['PANTS_MENU_POS']) {
yeSetIntAt($wid, 'cur_mn', $GLOBALS['PANTS_MENU']);
return action($wid, NULL);
} else if ($cur_mn == $GLOBALS['MAIN_MENU'] &&
$pos == $GLOBALS['SHOES_MENU_POS']) {
yeSetIntAt($wid, 'cur_mn', $GLOBALS['SHOES_MENU']);
return action($wid, NULL);
} else if ($cur_mn == $GLOBALS['MAIN_MENU'] &&
$pos == $GLOBALS['HAIR_MENU_POS']) {
yeSetIntAt($wid, 'cur_mn', $GLOBALS['HAIR_MENU']);
return action($wid, NULL);
} else {
if ($dress_type == "dress")
$pos = $pos + 1;
if ($dress_type == "hair" && $pos == 1)
ywMenuCallActionOnByEntity($menu, $eves, yeGetIntAt($wid, 'mn_pos'));
else {
if ($cur_mn == $GLOBALS['MAIN_MENU'] &&
$pos == $GLOBALS['TORSO_MENU_POS']) {
yeSetIntAt($wid, 'cur_mn', $GLOBALS['TORSO_MENU']);
return action($wid, NULL);
} else if ($cur_mn == $GLOBALS['MAIN_MENU'] &&
$pos == $GLOBALS['PANTS_MENU_POS']) {
yeSetIntAt($wid, 'cur_mn', $GLOBALS['PANTS_MENU']);
return action($wid, NULL);
} else if ($cur_mn == $GLOBALS['MAIN_MENU'] &&
$pos == $GLOBALS['SHOES_MENU_POS']) {
yeSetIntAt($wid, 'cur_mn', $GLOBALS['SHOES_MENU']);
return action($wid, NULL);
} else if ($cur_mn == $GLOBALS['MAIN_MENU'] &&
$pos == $GLOBALS['HAIR_MENU_POS']) {
yeSetIntAt($wid, 'cur_mn', $GLOBALS['HAIR_MENU']);
return action($wid, NULL);
} else {
ywMenuCallActionOnByEntity($menu, $eves, yeGetIntAt($wid, 'mn_pos'));
}
}
} else {
$ret = $YEVE_NOTHANDLE;
Expand Down
5 changes: 5 additions & 0 deletions tileset/House1.json
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,11 @@
"name":"Action",
"type":"string",
"value":"phq.DressUp.Menu"
},
{
"name":"Arg0",
"type":"string",
"value":"dress"
}],
"rotation":0,
"type":"",
Expand Down
7 changes: 6 additions & 1 deletion vn-scenes.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
],
"text_background": "rgba: 255 255 255 120",
"speaker_background": "imgs/hamburg.jpg"
},
},
[ "advancing on your way walking along dark alley, and street",
"you saw a light in the distance,",
"not a plain light as you can see from a building",
Expand Down Expand Up @@ -146,6 +146,11 @@
"text": "Premiumu Bento",
"action": [ "phq.openStore", "Premium Bento" ]
},
{
"text": "Hairdresser (15$)",
"action": [ "phq.pay", 15, ["phq.DressUp.Menu", "hair"],
"not enouth money" ]
},
{
"text": "go to 'the shoes !",
"action":
Expand Down

0 comments on commit 738cd52

Please sign in to comment.