Skip to content

Commit ae851bc

Browse files
author
lofcz
committed
Aktualizován skript apiPlayerSay
- Nově obsahuje optionální parametr "onlyOnEmptyFront"
1 parent e0f05d0 commit ae851bc

17 files changed

+151
-30
lines changed

SimplexRPGEngine/Engine source/objects/oChest.object.gmx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ if (animate = 2) {image_index = 0; image_speed = 0; animate = 0;}
131131
<kind>1</kind>
132132
<string>/// Draw chest
133133

134-
scrShaderDrawColor()
135-
scrChestDraw()
134+
scrChestDraw();
136135
</string>
137136
</argument>
138137
</arguments>

SimplexRPGEngine/Engine source/objects/oHUD.object.gmx

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ craftingMenuIndex[6] = "Opravit předmět";
7171
craftingTitleHelper = "";
7272
activeComponent = false;
7373
tempComponent = false;
74+
tempSpr = 0;
75+
drawTip = -1;
76+
drawTipAlpha = 0;
77+
drawTipTempIndex = -1;
7478

7579
drawCraftingMenu = 1;
7680
craftingSelectedIndex = -1;
@@ -204,6 +208,11 @@ hotslot[i, 3] = 0;
204208
}
205209

206210

211+
for (i = 0; i &lt; 10; i++)
212+
{
213+
spellAlpha[i] = 0;
214+
}
215+
207216
</string>
208217
</argument>
209218
</arguments>
@@ -313,13 +322,18 @@ temp = false;
313322

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

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

322-
if (hotslot[z, 2] &gt; 0) {if (hotslot[z, 1] == 1) {clr(-1, hotslot[z, 2]); draw_sprite(sSpellsUI, 2, qx, qy); clr();}}
332+
if (hotslot[z, 2] &gt; 0 || hotslot[z, 1] == 2)
333+
{
334+
if (hotslot[z, 1] == 1) {clr(-1, min(hotslot[z, 2],hudAlpha)); draw_sprite(sSpellsUI, 2, qx, qy); clr();}
335+
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();}
336+
}
323337

324338
if (mouse_in(qx, qx + 48, qy, qy + 48) &amp;&amp; canBind)
325339
{
@@ -341,11 +355,21 @@ for (z = 0; z &lt; 9; z++)
341355
hotslot[z, 3] = 1;
342356
temp = true;
343357
}
344-
else if (mouse_check_button_pressed(mb_left))
358+
else
359+
{
360+
if (mouse_check_button_pressed(mb_left))
345361
{
346362
hotslot[z, 0] = 0;
347363
hotslot[z, 3] = 0;
348-
}
364+
if (hotslot[z, 1] == 2) {hotslot[z, 1] = 0;}
365+
}
366+
if (mouse_check_button_pressed(mb_right))
367+
{
368+
drawTip = z;
369+
drawTipTempIndex = z;
370+
}
371+
372+
}
349373
}
350374

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

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

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

379403
qx += 48;
380404
}
405+
qx = 184 + view_xview + 4;
406+
qy = 548 + view_yview - 36;
407+
408+
if (drawTip != -1) {if (mouse_check_button_released(mb_right)) {drawTip = -1;}}
409+
410+
if (drawTip != -1) {drawTipAlpha = lerp(drawTipAlpha, 1, 0.1);}
411+
else {drawTipAlpha = lerp(drawTipAlpha, 0, 0.1);}
412+
413+
if (drawTipAlpha &gt; 0.02)
414+
{
415+
spells = array_length_1d(oSpellMenu.spellUnlocked);
416+
tx = 0;
417+
418+
for (i = 0; i &lt; spells; i++)
419+
{
420+
if (!oSpellMenu.spellUnlocked[i]) {continue;}
421+
422+
clr(c_black, drawTipAlpha / 2 + spellAlpha[i]);
423+
draw_sprite_stretched(sSpells, oSpellMenu.spellDetails[i,2], qx + (tx * 48), qy, 32, 32);
424+
clr(c_black, drawTipAlpha);
425+
draw_circle(qx + (tx * 48) + 15, qy + 15, 16, true);
426+
427+
428+
if (mouse_in(qx + (tx * 48), qx + (tx * 48) + 32, qy, qy + 32))
429+
{
430+
if (drawTip != -1)
431+
{
432+
spellAlpha[i] = lerp(spellAlpha[i], 0.5, 0.1);
433+
}
434+
else {spellAlpha[i] = lerp(spellAlpha[i], 0, 0.1);}
435+
436+
if (mouse_check_button_released(mb_right))
437+
{
438+
hotslot[drawTipTempIndex, 1] = 2;
439+
440+
if (tx == SpellEnum.spellFlash) {hotslot[drawTipTempIndex, 3] = sSpellFlash;}
441+
}
442+
443+
}
444+
else {spellAlpha[i] = lerp(spellAlpha[i], 0, 0.1);}
445+
tx++;
446+
}
447+
}
448+
381449
/*
382450
// Draw binded spells
383451
alg("default", fntPixelHuge);

SimplexRPGEngine/Engine source/objects/oLog.object.gmx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ draw_set_alpha(image_alpha);
126126
if (mode = "normal") {draw_text_colored(x-(string_width(text) / 2),y -yy,text);}
127127
if (mode = "combat") {scrCenterText(); draw_text_transformed(x-(string_width(text)/2),y-(string_height(text)/2),text,scale,scale,0); scrCenterText(0);}
128128

129-
if (sprite != -1)
129+
if (sprite &gt; 0)
130130
{
131131
if (a &lt; sprite_get_number(sprite)) {a += ani;} else {a = 0;}
132132
draw_sprite(sprite,a,x+(string_width(text)/2) + 16,y + 16);
133-
133+
134134
}
135135
draw_set_color(c_black);
136136
draw_set_alpha(1);

SimplexRPGEngine/Engine source/objects/oSlimePart.object.gmx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ image_xscale = random_range(0.8,1.2);
3131
image_yscale = image_xscale;
3232
speed = random_range(4,6);
3333
secure = 6;
34+
tempSpr = 0;
3435
</string>
3536
</argument>
3637
</arguments>

SimplexRPGEngine/Engine source/objects/oSpellMenu.object.gmx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,21 @@ hover = false;
231231

232232
if (mode == "in")
233233
{
234-
if (bacAlpha &lt; 1) {bacAlpha += 0.1; oHUD.draw = false; scrSetActiveComponent(true);}
234+
if (bacAlpha &lt; 1) {bacAlpha = 1; scrSetActiveComponent(true);}
235+
push = 0;
236+
pushValue = 0;
235237
}
236238
if (mode == "out")
237239
{
238-
if (bacAlpha &gt; 0) {bacAlpha -= 0.1;} else {draw = false; mode = ""; oHUD.draw = true; scrSetActiveComponent(false);}
240+
if (bacAlpha &gt; 0) {bacAlpha -= 0.1;} else {draw = false; mode = ""; scrSetActiveComponent(false);}
241+
}
242+
if (mode == "outSlow")
243+
{
244+
if (bacAlpha &gt; 0) {bacAlpha -= 0.05;} else {draw = false; mode = ""; scrSetActiveComponent(false);}
245+
if (push == 1) {pushValue = lerp(pushValue, 800, 0.1);}
239246
}
240247

241-
clr(c_black, bacAlpha / 2);
248+
clr(c_black, bacAlpha / 4 * 3);
242249
draw_rectangle(x, y, x + 800, y + 600, false);
243250
clr(c_black, bacAlpha);
244251
draw_sprite_ext(sTalentMenuIcons, 0, x + 768 + 16, y + 16, 1, 1, 0, c_white, 1);
@@ -255,12 +262,13 @@ if (point_in_rectangle(mouse_x, mouse_y, x + 768, y, x + 800, y + 32))
255262
// Hlavička
256263
clr(c_white, bacAlpha);
257264
alg("center", fntPixelHuge);
258-
draw_text(x + 496, y + 16, "Kouzla");
265+
draw_text(x + 400, y + 24, "Magie");
259266
alg("center", fntPixel);
260267

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

266274
// Vykreslování kouzel

SimplexRPGEngine/Engine source/objects/oStatusMenu.object.gmx

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ hint = "";
4040
hint2 = "";
4141
prevHit = 0;
4242
prevHit2 = 0;
43+
push = 0;
44+
pushValue = 0;
4345

4446

4547

@@ -60,6 +62,8 @@ for(i = 0; i &lt; celkem_vlastnosti; i++)
6062
// consts
6163
incHealth = 5;
6264
incMana = 3;
65+
66+
drawMode = 0;
6367
</string>
6468
</argument>
6569
</arguments>
@@ -178,9 +182,11 @@ ti = 0;
178182
hit = false;
179183

180184
// Lerp main alpha channel
181-
if (activated) {activatedAlpha = lerp(activatedAlpha, 1, 0.1);}
185+
if (activated) {activatedAlpha = lerp(activatedAlpha, 1, 0.1); push = false; pushValue = 0;}
182186
else {activatedAlpha = lerp(activatedAlpha, 0, 0.1);}
183187

188+
if (push) {pushValue = lerp(pushValue, 800, 0.1);}
189+
184190
// Draw form
185191
if (activatedAlpha &gt; 0.05)
186192
{
@@ -191,10 +197,37 @@ clr(c_white, activatedAlpha)
191197

192198
// Draw overall header
193199
alg("center", fntPixelHuge);
194-
draw_text_colored(view_xview + 400, view_yview + 24, oPlayer.name + ", úroveň " + string(oPlayer.vlastnost[vlastnost_level]) + " - " + apiPlayerGetRankName());
195-
fnt();
200+
s = oPlayer.name + ", úroveň " + string(oPlayer.vlastnost[vlastnost_level]) + " - " + apiPlayerGetRankName();
201+
sW = string_width(s);
202+
draw_text_colored(view_xview + 400, view_yview + 24, s);
203+
fnt(fntPixelSmall);
196204
alg();
197205

206+
c1 = c_white;
207+
c2 = c_white;
208+
209+
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))
210+
{
211+
c1 = c_lime;
212+
213+
if (mouse_check_button_pressed(mb_left))
214+
{
215+
activated = false;
216+
oSpellMenu.mode = "in";
217+
oSpellMenu.draw = true;
218+
push = true;
219+
}
220+
}
221+
222+
clr(c1, -1);
223+
draw_text(view_xview + 400 - (sW / 2) - string_width("&lt; Magie") - 16, view_yview + 4, "&lt; Magie");
224+
clr(c2, -1);
225+
draw_text(view_xview + 400 + (sW / 2) + 16, view_yview + 4, "Talenty &gt;");
226+
227+
fnt();
228+
229+
if (drawMode == 0)
230+
{
198231
// Draw attributes
199232
propertyPointsText = "";
200233
if (oPlayer.skillPoints &gt; 0) {propertyPointsText = "(" + scrColorflag(c_lime) + "+" + string(oPlayer.skillPoints) + scrEndColorflag() + ")";}
@@ -473,7 +506,7 @@ draw_text_colored(xx + xoffset, yy + yoffset + 64, "Obrana: " + string(round(oPl
473506
draw_text_colored(xx + xoffset, yy + yoffset + 96, "Šance na kritický úder: " + string(round(oPlayer.vlastnost[vlastnost_kriticka_sance])) + "%");
474507
fnt(fntPixelSmall); draw_text_colored(xx + xoffset + 16, yy + yoffset + 128, "- Kritické poškození: " + string(round(oPlayer.vlastnost[vlastnost_kriticka_nasobic] * 100)) + "%"); fnt();
475508

476-
509+
}
477510
}
478511
</string>
479512
</argument>

SimplexRPGEngine/Engine source/objects/parSolid.object.gmx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ splashMessageAlpha = 0;
4343

4444
hp = -1;
4545
affect = "";
46+
tempSpr = 0;
4647

4748
canColide = true;
4849
particleSystem = false;

SimplexRPGEngine/Engine source/scripts/enemyAPI.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ dmg += choose(-1, -2, 0, 1, 2);
213213
214214
scrGoreFull(object.x,object.y);
215215
scrEnemyGetPosition();
216-
scrLog(dmg,c_black,-1,0,0,object.x,object.y-48,fntPixelHuge);
216+
scrLog(dmg,c_black,0,0,0,object.x,object.y-48,fntPixelHuge);
217217
can_damage = cd;
218218
if (sL != "")
219219
{

SimplexRPGEngine/Engine source/scripts/hudAPI.gml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ for (i = 0; i < 3; i++)
138138
}
139139
}
140140
}
141-
}
141+
}

SimplexRPGEngine/Engine source/scripts/playerAPI.gml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,14 +715,19 @@ if (oPlayer.last_dir == "w") {oPlayer.image_index = 0;}
715715
if (oPlayer.last_dir == "s") {oPlayer.image_index = 12;}
716716
717717
#define apiPlayerSay
718-
/// apiPlayerSay(text)
718+
/// apiPlayerSay(text, [onlyOnEmptyFront])
719719
720-
var t;
720+
var t, o;
721721
t = "Sample text";
722+
o = false;
722723
723724
if (argument_count > 0) {t = argument[0];}
725+
if (argument_count > 1) {o = argument[1];}
726+
727+
if (o) {if (ds_queue_size(oPlayer.speechQueue) > 0 || oPlayer.speechAlpha > 0.02) {return false;}}
724728
725729
ds_queue_enqueue(oPlayer.speechQueue, t);
730+
return true;
726731
727732
#define apiPlayerSayNext
728733
/// apiPlayerSayNext()

0 commit comments

Comments
 (0)