Skip to content

Commit

Permalink
Aktualizován skript apiPlayerSay
Browse files Browse the repository at this point in the history
- Nově obsahuje optionální parametr "onlyOnEmptyFront"
  • Loading branch information
lofcz committed Dec 12, 2016
1 parent e0f05d0 commit ae851bc
Show file tree
Hide file tree
Showing 17 changed files with 151 additions and 30 deletions.
3 changes: 1 addition & 2 deletions SimplexRPGEngine/Engine source/objects/oChest.object.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ if (animate = 2) {image_index = 0; image_speed = 0; animate = 0;}
<kind>1</kind>
<string>/// Draw chest

scrShaderDrawColor()
scrChestDraw()
scrChestDraw();
</string>
</argument>
</arguments>
Expand Down
80 changes: 74 additions & 6 deletions SimplexRPGEngine/Engine source/objects/oHUD.object.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ craftingMenuIndex[6] = "Opravit předmět";
craftingTitleHelper = "";
activeComponent = false;
tempComponent = false;
tempSpr = 0;
drawTip = -1;
drawTipAlpha = 0;
drawTipTempIndex = -1;

drawCraftingMenu = 1;
craftingSelectedIndex = -1;
Expand Down Expand Up @@ -204,6 +208,11 @@ hotslot[i, 3] = 0;
}


for (i = 0; i &lt; 10; i++)
{
spellAlpha[i] = 0;
}

</string>
</argument>
</arguments>
Expand Down Expand Up @@ -313,13 +322,18 @@ temp = false;

for (z = 0; z &lt; 9; z++)
{
clr(c_black, hudAlpha);
draw_sprite(sSpellsUI, 4, qx, qy);

// Adjust slot alpha effect
if (hotslot[z, 3] == 1 || hotslot[z, 3] == 2) {hotslot[z, 2] = lerp(hotslot[z, 2], 1, 0.1);}
if (hotslot[z, 3] == 1 || hotslot[z, 3] == 2 || hotslot[z, 1] == 2) {hotslot[z, 2] = lerp(hotslot[z, 2], 1, 0.1);}
else {hotslot[z, 2] = lerp(hotslot[z, 2], 0, 0.1); if (hotslot[z, 2] &lt; 0.05) {hotslot[z, 1] = 0;}}

if (hotslot[z, 2] &gt; 0) {if (hotslot[z, 1] == 1) {clr(-1, hotslot[z, 2]); draw_sprite(sSpellsUI, 2, qx, qy); clr();}}
if (hotslot[z, 2] &gt; 0 || hotslot[z, 1] == 2)
{
if (hotslot[z, 1] == 1) {clr(-1, min(hotslot[z, 2],hudAlpha)); draw_sprite(sSpellsUI, 2, qx, qy); clr();}
if (hotslot[z, 1] == 2) {clr(-1, min(hotslot[z, 2],hudAlpha)); draw_sprite(hotslot[z, 3], 0, qx, qy); draw_sprite(sSpellsUI, 1, qx, qy); clr();}
}

if (mouse_in(qx, qx + 48, qy, qy + 48) &amp;&amp; canBind)
{
Expand All @@ -341,11 +355,21 @@ for (z = 0; z &lt; 9; z++)
hotslot[z, 3] = 1;
temp = true;
}
else if (mouse_check_button_pressed(mb_left))
else
{
if (mouse_check_button_pressed(mb_left))
{
hotslot[z, 0] = 0;
hotslot[z, 3] = 0;
}
if (hotslot[z, 1] == 2) {hotslot[z, 1] = 0;}
}
if (mouse_check_button_pressed(mb_right))
{
drawTip = z;
drawTipTempIndex = z;
}

}
}

if (hotslot[z, 0] != 0)
Expand All @@ -354,9 +378,9 @@ for (z = 0; z &lt; 9; z++)
}

// Check if item still exists in the inventory &amp;&amp; draw it's count
clr();
clr(-1, hudAlpha);
var number = -1;
if (hotslot[z, 3] != 0 &amp;&amp; !temp)
if (hotslot[z, 3] != 0 &amp;&amp; !temp &amp;&amp; hotslot[z, 1] != 2)
{

number = inventoryNumber(hotslot[z, 0]);
Expand All @@ -378,6 +402,50 @@ for (z = 0; z &lt; 9; z++)

qx += 48;
}
qx = 184 + view_xview + 4;
qy = 548 + view_yview - 36;

if (drawTip != -1) {if (mouse_check_button_released(mb_right)) {drawTip = -1;}}

if (drawTip != -1) {drawTipAlpha = lerp(drawTipAlpha, 1, 0.1);}
else {drawTipAlpha = lerp(drawTipAlpha, 0, 0.1);}

if (drawTipAlpha &gt; 0.02)
{
spells = array_length_1d(oSpellMenu.spellUnlocked);
tx = 0;

for (i = 0; i &lt; spells; i++)
{
if (!oSpellMenu.spellUnlocked[i]) {continue;}

clr(c_black, drawTipAlpha / 2 + spellAlpha[i]);
draw_sprite_stretched(sSpells, oSpellMenu.spellDetails[i,2], qx + (tx * 48), qy, 32, 32);
clr(c_black, drawTipAlpha);
draw_circle(qx + (tx * 48) + 15, qy + 15, 16, true);


if (mouse_in(qx + (tx * 48), qx + (tx * 48) + 32, qy, qy + 32))
{
if (drawTip != -1)
{
spellAlpha[i] = lerp(spellAlpha[i], 0.5, 0.1);
}
else {spellAlpha[i] = lerp(spellAlpha[i], 0, 0.1);}

if (mouse_check_button_released(mb_right))
{
hotslot[drawTipTempIndex, 1] = 2;

if (tx == SpellEnum.spellFlash) {hotslot[drawTipTempIndex, 3] = sSpellFlash;}
}

}
else {spellAlpha[i] = lerp(spellAlpha[i], 0, 0.1);}
tx++;
}
}

/*
// Draw binded spells
alg("default", fntPixelHuge);
Expand Down
4 changes: 2 additions & 2 deletions SimplexRPGEngine/Engine source/objects/oLog.object.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ draw_set_alpha(image_alpha);
if (mode = "normal") {draw_text_colored(x-(string_width(text) / 2),y -yy,text);}
if (mode = "combat") {scrCenterText(); draw_text_transformed(x-(string_width(text)/2),y-(string_height(text)/2),text,scale,scale,0); scrCenterText(0);}

if (sprite != -1)
if (sprite &gt; 0)
{
if (a &lt; sprite_get_number(sprite)) {a += ani;} else {a = 0;}
draw_sprite(sprite,a,x+(string_width(text)/2) + 16,y + 16);

}
draw_set_color(c_black);
draw_set_alpha(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ image_xscale = random_range(0.8,1.2);
image_yscale = image_xscale;
speed = random_range(4,6);
secure = 6;
tempSpr = 0;
</string>
</argument>
</arguments>
Expand Down
20 changes: 14 additions & 6 deletions SimplexRPGEngine/Engine source/objects/oSpellMenu.object.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,21 @@ hover = false;

if (mode == "in")
{
if (bacAlpha &lt; 1) {bacAlpha += 0.1; oHUD.draw = false; scrSetActiveComponent(true);}
if (bacAlpha &lt; 1) {bacAlpha = 1; scrSetActiveComponent(true);}
push = 0;
pushValue = 0;
}
if (mode == "out")
{
if (bacAlpha &gt; 0) {bacAlpha -= 0.1;} else {draw = false; mode = ""; oHUD.draw = true; scrSetActiveComponent(false);}
if (bacAlpha &gt; 0) {bacAlpha -= 0.1;} else {draw = false; mode = ""; scrSetActiveComponent(false);}
}
if (mode == "outSlow")
{
if (bacAlpha &gt; 0) {bacAlpha -= 0.05;} else {draw = false; mode = ""; scrSetActiveComponent(false);}
if (push == 1) {pushValue = lerp(pushValue, 800, 0.1);}
}

clr(c_black, bacAlpha / 2);
clr(c_black, bacAlpha / 4 * 3);
draw_rectangle(x, y, x + 800, y + 600, false);
clr(c_black, bacAlpha);
draw_sprite_ext(sTalentMenuIcons, 0, x + 768 + 16, y + 16, 1, 1, 0, c_white, 1);
Expand All @@ -255,12 +262,13 @@ if (point_in_rectangle(mouse_x, mouse_y, x + 768, y, x + 800, y + 32))
// Hlavička
clr(c_white, bacAlpha);
alg("center", fntPixelHuge);
draw_text(x + 496, y + 16, "Kouzla");
draw_text(x + 400, y + 24, "Magie");
alg("center", fntPixel);

bs = "Nemáš žádné body magie";
if (oPlayer.spellPoints &gt; 0) {bs = "Máš " + string(oPlayer.spellPoints) + " " + scrInflect("bod", oPlayer.talentPoints) + " bodů magie";}
draw_text(x + 496, y + 36, bs);
fnt(fntPixel);
if (oPlayer.spellPoints &gt; 0) {bs = "Máš " + string(oPlayer.spellPoints) + " " + scrInflect("bod", oPlayer.talentPoints) + " bodů čarodějnictví.";}
draw_text(x + 400, y + 42, bs);
alg();

// Vykreslování kouzel
Expand Down
41 changes: 37 additions & 4 deletions SimplexRPGEngine/Engine source/objects/oStatusMenu.object.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ hint = "";
hint2 = "";
prevHit = 0;
prevHit2 = 0;
push = 0;
pushValue = 0;



Expand All @@ -60,6 +62,8 @@ for(i = 0; i &lt; celkem_vlastnosti; i++)
// consts
incHealth = 5;
incMana = 3;

drawMode = 0;
</string>
</argument>
</arguments>
Expand Down Expand Up @@ -178,9 +182,11 @@ ti = 0;
hit = false;

// Lerp main alpha channel
if (activated) {activatedAlpha = lerp(activatedAlpha, 1, 0.1);}
if (activated) {activatedAlpha = lerp(activatedAlpha, 1, 0.1); push = false; pushValue = 0;}
else {activatedAlpha = lerp(activatedAlpha, 0, 0.1);}

if (push) {pushValue = lerp(pushValue, 800, 0.1);}

// Draw form
if (activatedAlpha &gt; 0.05)
{
Expand All @@ -191,10 +197,37 @@ clr(c_white, activatedAlpha)

// Draw overall header
alg("center", fntPixelHuge);
draw_text_colored(view_xview + 400, view_yview + 24, oPlayer.name + ", úroveň " + string(oPlayer.vlastnost[vlastnost_level]) + " - " + apiPlayerGetRankName());
fnt();
s = oPlayer.name + ", úroveň " + string(oPlayer.vlastnost[vlastnost_level]) + " - " + apiPlayerGetRankName();
sW = string_width(s);
draw_text_colored(view_xview + 400, view_yview + 24, s);
fnt(fntPixelSmall);
alg();

c1 = c_white;
c2 = c_white;

if (mouse_in(view_xview + 400 - (sW / 2) - string_width("&lt; Magie") - 16, view_xview + 400 - (sW / 2) - 16, view_yview + 10, view_yview + 24))
{
c1 = c_lime;

if (mouse_check_button_pressed(mb_left))
{
activated = false;
oSpellMenu.mode = "in";
oSpellMenu.draw = true;
push = true;
}
}

clr(c1, -1);
draw_text(view_xview + 400 - (sW / 2) - string_width("&lt; Magie") - 16, view_yview + 4, "&lt; Magie");
clr(c2, -1);
draw_text(view_xview + 400 + (sW / 2) + 16, view_yview + 4, "Talenty &gt;");

fnt();

if (drawMode == 0)
{
// Draw attributes
propertyPointsText = "";
if (oPlayer.skillPoints &gt; 0) {propertyPointsText = "(" + scrColorflag(c_lime) + "+" + string(oPlayer.skillPoints) + scrEndColorflag() + ")";}
Expand Down Expand Up @@ -473,7 +506,7 @@ draw_text_colored(xx + xoffset, yy + yoffset + 64, "Obrana: " + string(round(oPl
draw_text_colored(xx + xoffset, yy + yoffset + 96, "Šance na kritický úder: " + string(round(oPlayer.vlastnost[vlastnost_kriticka_sance])) + "%");
fnt(fntPixelSmall); draw_text_colored(xx + xoffset + 16, yy + yoffset + 128, "- Kritické poškození: " + string(round(oPlayer.vlastnost[vlastnost_kriticka_nasobic] * 100)) + "%"); fnt();


}
}
</string>
</argument>
Expand Down
1 change: 1 addition & 0 deletions SimplexRPGEngine/Engine source/objects/parSolid.object.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ splashMessageAlpha = 0;

hp = -1;
affect = "";
tempSpr = 0;

canColide = true;
particleSystem = false;
Expand Down
2 changes: 1 addition & 1 deletion SimplexRPGEngine/Engine source/scripts/enemyAPI.gml
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ dmg += choose(-1, -2, 0, 1, 2);
scrGoreFull(object.x,object.y);
scrEnemyGetPosition();
scrLog(dmg,c_black,-1,0,0,object.x,object.y-48,fntPixelHuge);
scrLog(dmg,c_black,0,0,0,object.x,object.y-48,fntPixelHuge);
can_damage = cd;
if (sL != "")
{
Expand Down
2 changes: 1 addition & 1 deletion SimplexRPGEngine/Engine source/scripts/hudAPI.gml
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ for (i = 0; i < 3; i++)
}
}
}
}
}
9 changes: 7 additions & 2 deletions SimplexRPGEngine/Engine source/scripts/playerAPI.gml
Original file line number Diff line number Diff line change
Expand Up @@ -715,14 +715,19 @@ if (oPlayer.last_dir == "w") {oPlayer.image_index = 0;}
if (oPlayer.last_dir == "s") {oPlayer.image_index = 12;}
#define apiPlayerSay
/// apiPlayerSay(text)
/// apiPlayerSay(text, [onlyOnEmptyFront])
var t;
var t, o;
t = "Sample text";
o = false;
if (argument_count > 0) {t = argument[0];}
if (argument_count > 1) {o = argument[1];}
if (o) {if (ds_queue_size(oPlayer.speechQueue) > 0 || oPlayer.speechAlpha > 0.02) {return false;}}
ds_queue_enqueue(oPlayer.speechQueue, t);
return true;
#define apiPlayerSayNext
/// apiPlayerSayNext()
Expand Down
4 changes: 3 additions & 1 deletion SimplexRPGEngine/Engine source/scripts/scrChestDraw.gml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/// scrChestDraw()

scrShaderDrawColor();

if (animate == 1)
{
image_speed = animate_speed;
Expand Down Expand Up @@ -107,7 +109,7 @@ if (open)
clr();
alg();

if (keyboard_check_pressed(ord("E")) && distance_to_object(oPlayer) < open_dis && text) {apiPlayerReverseState(); if (instance_number(oLockpickingScreen) == 0 && inventoryNumber(itemEnum.itemLockpick) > 0) {scrLockpickingIni(tumblers); for(j = 0; j < combinations; j++) { scrLockpickingAddTumblerCombination(c[j, 0], c[j, 1], c[j, 2]);}} else {if (apiPlayerGetSpeechSize() == 0) {apiPlayerSay("Potřebuji paklíč");}}}
if (keyboard_check_pressed(ord("E")) && distance_to_object(oPlayer) < open_dis && text) {apiPlayerReverseState(); if (instance_number(oLockpickingScreen) == 0 && inventoryNumber(itemEnum.itemLockpick) > 0) {scrLockpickingIni(tumblers); for(j = 0; j < combinations; j++) { scrLockpickingAddTumblerCombination(c[j, 0], c[j, 1], c[j, 2]);}} else {if (apiPlayerGetSpeechSize() == 0) {apiPlayerSay("Potřebuji paklíč", true);}}}
}
}
}
1 change: 0 additions & 1 deletion SimplexRPGEngine/Engine source/scripts/scrMinimapDraw.gml
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,3 @@ sizey = height/leny;
}



8 changes: 6 additions & 2 deletions SimplexRPGEngine/Engine source/scripts/scrSpellCreate.gml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
#define scrSpellCreate
/// scrSpellCreate(spell, level)
/// scrSpellCreate(spell, level, unlocked)

var spell, level;
var spell, level, u;
spell = SpellEnum.spellFlash;
level = 0;
u = true;

if (argument_count > 0) {spell = argument[0];}
if (argument_count > 1) {level = argument[1];}
if (argument_count > 2) {u = argument[2];}

spellLevel[spell,0] = 0;
spellLevel[spell,1] = 0;
ds_list_add(spellList, "");
ds_list_add(spellListAlpha, 0);
tempSpell = spell;
spellUnlocked[spell] = u;


#define scrSpellCreateDetails
/// scrSpellCreateDetails(spellNameLevel1, spellNameLevel2, spellNameLevel3, spellDetailsLevel1, spellDetailsLevel2, spellDetailsLevel3, spellImageIndexLevel1, spellImageIndexLevel2, spellImageIndexLevel3)
Expand Down
4 changes: 2 additions & 2 deletions SimplexRPGEngine/Engine source/scripts/scrSpellDraw.gml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ draw_text_colored(210, 410 + string_height(spellDetails[spell, 1]) + 32, index);

if (spellLevel[spell, 1] == 1)
{
spellDetails[spell, 0] = spellDetails[spell, 3];
spellDetails[spell, 0] = spellDetails[spell, 3];
spellDetails[spell, 1] = spellDetails[spell, 4];
spellDetails[spell, 2] = spellDetails[spell, 5];
}
Expand Down Expand Up @@ -220,7 +220,7 @@ front_surface=surface_create(card_width,card_height);
if (choosenSpell != -1)
{
draw_clear_alpha(0,0);
draw_sprite_ext(sSpells,spellDetails[max(choosenSpell,0), 2],0,0, 1, 1, 0, c_white, 1);//draw the sprite in the top left corner of the surface.
draw_sprite_ext(sSpells,spellDetails[max(choosenSpell,0), 2],0,0, 1, 1, 0, c_white, 1);
}
}
surface_reset_target();
Expand Down
Binary file modified SimplexRPGEngine/Engine source/sprites/images/sSpellFlash_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ae851bc

Please sign in to comment.