Skip to content

Commit fc66e82

Browse files
committed
3.0.0-prerelease.41+2024-02-17
1 parent d8efced commit fc66e82

File tree

16 files changed

+153
-17
lines changed

16 files changed

+153
-17
lines changed

dist/create/index.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/files/headers/tango/1.3/tango_functions.zh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ void __Tango_FuncGoto(int newString)
550550
}
551551

552552
// Implementation of @pressa
553-
int __Tango_FuncPressA()
553+
void __Tango_FuncPressA()
554554
{
555555
Game->PlaySound(__Tango_GetCurrStyleData(TANGO_STYLE_TEXT_END_SFX));
556556
__Tango_SetCurrSlotData(__TSDIDX_STATE, __TANGO_STATE_PRESS_A);

dist/files/include/std_zh/std_constants.zh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4364,3 +4364,14 @@ enum //Hero->Sliding constants
43644364
SLD_MAX
43654365
};
43664366

4367+
enum = long {
4368+
WEBSOCKET_STATE_CONNECTING,
4369+
WEBSOCKET_STATE_OPEN,
4370+
WEBSOCKET_STATE_CLOSING,
4371+
WEBSOCKET_STATE_CLOSED
4372+
};
4373+
4374+
enum = long {
4375+
WEBSOCKET_MESSAGE_TYPE_TEXT = 1L,
4376+
WEBSOCKET_MESSAGE_TYPE_BINARY = 2L
4377+
};

dist/files/include/std_zh/std_functions.zh

Lines changed: 131 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -524,9 +524,25 @@ bool Collision(combodata f)
524524
//Finds the location of a combo, given its (x,y) coordinates on the screen
525525
int ComboAt(int x, int y)
526526
{
527-
x = VBound(x,255,0);
528-
y = VBound(y,175,0);
529-
return (y & 240)+(x>>4);
527+
// Don't actually need this yet.
528+
// if (Region->ID)
529+
// {
530+
// x = VBound(x, Region->Width - 1, 0);
531+
// y = VBound(y, Region->Height - 1, 0);
532+
// // Floor'd because in ZScript, ints aren't ints?!
533+
// int scr_dx = Floor(x / 256);
534+
// int scr_dy = Floor(y / 176);
535+
// int offset_pos = (scr_dx + scr_dy * Region->ScreenWidth)*176;
536+
// int pos = ((y%176) & 240)+((x%256)>>4);
537+
// return offset_pos + pos;
538+
// }
539+
// else
540+
{
541+
// Fast path.
542+
x = VBound(x,255,0);
543+
y = VBound(y,175,0);
544+
return (y & 240)+(x>>4);
545+
}
530546
}
531547

532548
//Returns true if the combo at '(x, y)' has either an inherent or place flag of type 'flag'
@@ -542,14 +558,122 @@ bool ComboFI(int loc, int flag)
542558
return Screen->ComboF[loc] == flag || Screen->ComboI[loc] == flag;
543559
}
544560

561+
// Note: all of the `Region->ID` checks in these various functions are minor performance improvements. The functions
562+
// likely work even without that.
563+
545564
//Return the coordinates of a combo on the screen
546-
int ComboX(int loc)
565+
int ComboX(int rpos)
566+
{
567+
// Don't actually need this yet.
568+
// if (Region->ID)
569+
// {
570+
// int scr_index = Floor(rpos / 176);
571+
// int scr_width = Region->ScreenWidth;
572+
// int scr_dx = scr_index % scr_width;
573+
// int scr_dy = Floor(scr_index / scr_width);
574+
// int pos = rpos % 176;
575+
// return scr_dx*16*16 + pos%16*16;
576+
// }
577+
// else
578+
{
579+
return rpos%16*16;
580+
}
581+
}
582+
int ComboY(int rpos)
583+
{
584+
// Don't actually need this yet.
585+
// if (Region->ID)
586+
// {
587+
// int scr_index = Floor(rpos / 176);
588+
// int scr_width = Region->ScreenWidth;
589+
// int scr_dx = scr_index % scr_width;
590+
// int scr_dy = Floor(scr_index / scr_width);
591+
// int pos = rpos % 176;
592+
// return scr_dy*11*16 + (pos&0xF0);
593+
// }
594+
// else
595+
{
596+
return rpos&0xF0;
597+
}
598+
}
599+
600+
// Given a screen index, returns the screen offset in the X direction in the current region.
601+
// Example: If the region origin is screen 5, `RegionRelativeScreenX(8) == 3`
602+
int RegionRelativeScreenX(int scr)
547603
{
548-
return loc%16*16;
604+
if (Region->ID)
605+
{
606+
return scr%16 - Region->OriginScreen%16;
607+
}
608+
else
609+
{
610+
return 0;
611+
}
549612
}
550-
int ComboY(int loc)
613+
614+
// Given a screen index, returns the screen offset in the Y direction in the current region.
615+
int RegionRelativeScreenY(int scr)
616+
{
617+
if (Region->ID)
618+
{
619+
return Floor(scr/16) - Floor(Region->OriginScreen/16);
620+
}
621+
else
622+
{
623+
return 0;
624+
}
625+
}
626+
627+
// Given a screen index, returns the world offset in the x direction for the current region.
628+
int RegionWorldOffsetX(int scr)
629+
{
630+
if (Region->ID)
631+
{
632+
return RegionRelativeScreenX(scr) * 256;
633+
}
634+
else
635+
{
636+
return 0;
637+
}
638+
}
639+
640+
// Given a screen index, returns the world offset in the y direction for the current region.
641+
int RegionWorldOffsetY(int scr)
642+
{
643+
if (Region->ID)
644+
{
645+
return RegionRelativeScreenY(scr) * 176;
646+
}
647+
else
648+
{
649+
return 0;
650+
}
651+
}
652+
653+
// Returns true if the given screen index is inside the current region.
654+
// When not in a region, only returns true if scr is equal to Game->CurScreen.
655+
bool RegionIncludesScreen(int scr)
656+
{
657+
if (Region->ID)
658+
{
659+
int dx = RegionRelativeScreenX(scr);
660+
if (dx < 0 || dx > Region->ScreenWidth) return false;
661+
662+
int dy = RegionRelativeScreenY(scr);
663+
if (dy < 0 || dy > Region->ScreenHeight) return false;
664+
665+
return true;
666+
}
667+
668+
return scr == Game->CurScreen;
669+
}
670+
671+
// Returns the FFC ID of the screen `scr`, which must be within the current Region.
672+
// `index` is the screen-specific index of the FFC (what you would see in the editor on that screen).
673+
int RegionGetFFCId(int scr, int index)
551674
{
552-
return loc&0xF0;
675+
int offset = 128 * (RegionRelativeScreenX(scr) + RegionRelativeScreenY(scr)*Region->ScreenWidth);
676+
return offset + index;
553677
}
554678

555679
//Returns a if cond is true, else b. Overloaded.

dist/files/tilesets/classic.qst

-1.42 MB
Binary file not shown.

dist/play/index.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/sw.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/zeditor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/zeditor.wasm

177 KB
Binary file not shown.

dist/zplayer.data

103 KB
Binary file not shown.

0 commit comments

Comments
 (0)