Skip to content

Commit 82718d0

Browse files
authored
Merge pull request #360 from YAL-Forks/vdiachenko/unsupported-cleanup-and-cc
Conditional compilation tagging and old function cleanup
2 parents a05703e + 28a9df1 commit 82718d0

File tree

110 files changed

+2200
-7952
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+2200
-7952
lines changed

scripts/Builders/yyPrimBuilder.js

Lines changed: 53 additions & 297 deletions
Large diffs are not rendered by default.

scripts/CameraManager.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ CCamera.prototype.ApplyMatrices = function () {
519519
WebGL_SetMatrix(MATRIX_VIEW, this.m_viewMat);
520520
}
521521
else {
522+
// @if feature("2d")
522523
WebGL_SetMatrix(MATRIX_VIEW, this.m_viewMat);
523524
// Work out port scaling
524525
var wscale = g_clipw / g_worldw;
@@ -535,6 +536,7 @@ CCamera.prototype.ApplyMatrices = function () {
535536

536537
// for some reason this function takes the matrix transposed
537538
graphics._setTransform(g_transform[0], g_transform[3], g_transform[1], g_transform[4], g_transform[2], g_transform[5]);
539+
// @endif
538540
}
539541

540542
if (g_RenderTargetActive == -1) {

scripts/Effects.js

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,32 +58,14 @@ var types_created = false, // whether the types have been create
5858
// #############################################################################################
5959
function Speed_Factor()
6060
{
61-
if(g_isZeus)
62-
{
63-
64-
if( ( g_GameTimer.GetFPS() <= 30) || (Fps <= 30) ){
65-
return 1.0;
66-
}
67-
68-
if( (g_GameTimer.GetFPS()/ Fps) < 1.2 ){
69-
return 30.0/g_GameTimer.GetFPS();
70-
}else{
71-
return 30.0/Fps;
72-
}
73-
}
74-
else
75-
{
76-
77-
78-
if( ( g_RunRoom.GetSpeed() <= 30) || (Fps <= 30) ){
79-
return 1.0;
80-
}
61+
if( ( g_GameTimer.GetFPS() <= 30) || (Fps <= 30) ){
62+
return 1.0;
63+
}
8164

82-
if( (g_RunRoom.GetSpeed() / Fps) < 1.2 ){
83-
return 30.0/g_RunRoom.GetSpeed();
84-
}else{
85-
return 30.0/Fps;
86-
}
65+
if( (g_GameTimer.GetFPS()/ Fps) < 1.2 ){
66+
return 30.0/g_GameTimer.GetFPS();
67+
}else{
68+
return 30.0/Fps;
8769
}
8870
}
8971

scripts/Events.js

Lines changed: 39 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ function HandleOSEvents() {
9393
// #############################################################################################
9494
function HandleOther()
9595
{
96+
// @if event("OutsideEvent") || event("BoundaryEvent") || event("OutsideView*") || event("BoundaryView*")
9697
var bbox, i, viewIndex;
9798
var pViews = null;
9899
if (g_RunRoom.m_enableviews)
@@ -111,6 +112,7 @@ function HandleOther()
111112
if (!inst.marked && (inst.createCounter <= count))
112113
{
113114
// Outside events
115+
// @if event("OutsideEvent")
114116
if (pObject.REvent[EVENT_OTHER_OUTSIDE])
115117
{
116118
var outside = false;
@@ -131,8 +133,10 @@ function HandleOther()
131133
}
132134
inst.fOutsideRoom = outside;
133135
}
136+
// @endif OutsideEvent
134137

135138
// Boundary events
139+
// @if event("BoundaryEvent")
136140
if (pObject.REvent[EVENT_OTHER_BOUNDARY])
137141
{
138142
if (sprite_exists(inst.sprite_index) || sprite_exists(inst.mask_index))
@@ -151,10 +155,12 @@ function HandleOther()
151155
}
152156
}
153157
}
158+
// @endif
154159

155160

156161
// Handle view related "other" events
157162
//for (i in pViews)
163+
// @if event("OutsideView*") || event("BoundaryView*")
158164
if (pViews) {
159165
for (viewIndex = 0; viewIndex < pViews.length; viewIndex++) {
160166
//if (!pViews.hasOwnProperty(i)) continue;
@@ -179,6 +185,7 @@ function HandleOther()
179185
}
180186

181187
// Outside view events
188+
// @if event("OutsideView*")
182189
if (pObject.REvent[EVENT_OTHER_OUTSIDE_VIEW0 + viewIndex]) {
183190

184191
// Make a distinction whether the instance has a mask (or sprite) || not
@@ -200,8 +207,10 @@ function HandleOther()
200207
}
201208
}
202209
}
210+
// @endif OutsideView
203211

204212
// Boundary view events
213+
// @if event("BoundaryView*")
205214
if (pObject.REvent[EVENT_OTHER_BOUNDARY_VIEW0 + viewIndex]) {
206215
if (sprite_exists(inst.sprite_index) || sprite_exists(inst.mask_index)) {
207216

@@ -238,12 +247,14 @@ function HandleOther()
238247
}*/
239248
}
240249
}
250+
// @endif BoundaryView
241251
}
242252
}
243253
}
254+
// @endif OutsideView || BoundaryView
244255
}
245256
}
246-
257+
// @endif Outside || Boundary || OutsideView || BoundaryView
247258
}
248259

249260

@@ -369,45 +380,6 @@ function HandleCollision()
369380
}*/
370381

371382

372-
// #############################################################################################
373-
/// Function:<summary>
374-
/// Given a point, do a collision test with each instance that has the desired
375-
/// event. (mouse click etc).
376-
/// </summary>
377-
///
378-
/// In: <param name="_event">Primary event</param>
379-
/// <param name="_sub_event">Secondary event</param>
380-
/// <param name="x">X Point to test with</param>
381-
/// <param name="y">Y Point to test with</param>
382-
///
383-
// #############################################################################################
384-
function DoPointToInstance( _event, _sub_event, _x,_y )
385-
{
386-
// First scale the coordinate into the current screen scale.
387-
//_x = _x * scale;
388-
389-
// Might be better to loop through objects, rather than active instances... less getSprite stuff...
390-
for(var i=g_RunRoom.m_Active.length-1;i>=0;i-- )
391-
{
392-
var pInst = g_RunRoom.m_Active.Get(i);
393-
// with( pInst )
394-
{
395-
if (pInst.bbox_dirty) pInst.Compute_BoundingBox();
396-
if (!pInst.marked && pInst.pObject.REvent[_event | _sub_event])
397-
{
398-
var pSprite = g_pSpriteManager.Get( pInst.sprite_index );
399-
var ox = pSprite.xOrigin;
400-
var oy = pSprite.yOrigin;
401-
if ((_x >= pInst.bbox.left) && (_x < pInst.bbox.right) && (_y >= pInst.bbox.top) && (_y < pInst.bbox.bottom))
402-
{
403-
pInst.PerformEvent(_event, _sub_event, pInst, pInst); // timer enum starts at 1..
404-
}
405-
}
406-
}
407-
}
408-
}
409-
410-
411383

412384
// #############################################################################################
413385
/// Function:<summary>
@@ -416,6 +388,7 @@ function DoPointToInstance( _event, _sub_event, _x,_y )
416388
// #############################################################################################
417389
function HandleMouse()
418390
{
391+
// @if eventType("Mouse")
419392
if (g_RunRoom)
420393
{
421394
var ind;
@@ -554,7 +527,8 @@ function HandleMouse()
554527
{
555528
g_pInstanceManager.PerformEvent(EVENT_MOUSE_WHEEL_DOWN,0);
556529
}
557-
}
530+
}
531+
// @endif mouse events
558532
}
559533

560534

@@ -565,6 +539,7 @@ function HandleMouse()
565539
// #############################################################################################
566540
function HandleTimeLine()
567541
{
542+
// @if feature("timelines")
568543
var ind1,ind2,j;
569544
var pool = g_RunRoom.m_Active.pool;
570545
var count = g_currentCreateCounter++;
@@ -616,6 +591,7 @@ function HandleTimeLine()
616591
}
617592
}
618593
}
594+
// @endif
619595
}
620596

621597
// #############################################################################################
@@ -800,6 +776,7 @@ function event_lookup(_event, _subevent)
800776
case GML_EVENT_OTHER_ENDOFPATH: return EVENT_OTHER_ENDOFPATH;
801777
case GML_EVENT_OTHER_NOHEALTH: return EVENT_OTHER_NOHEALTH;
802778
case GML_EVENT_OTHER_CLOSEBUTTON: return EVENT_OTHER_CLOSEBUTTON;
779+
// @if event("OutsideView*")
803780
case GML_EVENT_OTHER_OUTSIDE_VIEW0: return EVENT_OTHER_OUTSIDE_VIEW0;
804781
case GML_EVENT_OTHER_OUTSIDE_VIEW1: return EVENT_OTHER_OUTSIDE_VIEW1;
805782
case GML_EVENT_OTHER_OUTSIDE_VIEW2: return EVENT_OTHER_OUTSIDE_VIEW2;
@@ -808,6 +785,8 @@ function event_lookup(_event, _subevent)
808785
case GML_EVENT_OTHER_OUTSIDE_VIEW5: return EVENT_OTHER_OUTSIDE_VIEW5;
809786
case GML_EVENT_OTHER_OUTSIDE_VIEW6: return EVENT_OTHER_OUTSIDE_VIEW6;
810787
case GML_EVENT_OTHER_OUTSIDE_VIEW7: return EVENT_OTHER_OUTSIDE_VIEW7;
788+
// @endif
789+
// @if event("BoundaryView*")
811790
case GML_EVENT_OTHER_BOUNDARY_VIEW0: return EVENT_OTHER_BOUNDARY_VIEW0;
812791
case GML_EVENT_OTHER_BOUNDARY_VIEW1: return EVENT_OTHER_BOUNDARY_VIEW1;
813792
case GML_EVENT_OTHER_BOUNDARY_VIEW2: return EVENT_OTHER_BOUNDARY_VIEW2;
@@ -816,22 +795,25 @@ function event_lookup(_event, _subevent)
816795
case GML_EVENT_OTHER_BOUNDARY_VIEW5: return EVENT_OTHER_BOUNDARY_VIEW5;
817796
case GML_EVENT_OTHER_BOUNDARY_VIEW6: return EVENT_OTHER_BOUNDARY_VIEW6;
818797
case GML_EVENT_OTHER_BOUNDARY_VIEW7: return EVENT_OTHER_BOUNDARY_VIEW7;
819-
case GML_ev_user0: return EVENT_OTHER_USER0;
820-
case GML_ev_user1: return EVENT_OTHER_USER1;
821-
case GML_ev_user2: return EVENT_OTHER_USER2;
822-
case GML_ev_user3: return EVENT_OTHER_USER3;
823-
case GML_ev_user4: return EVENT_OTHER_USER4;
824-
case GML_ev_user5: return EVENT_OTHER_USER5;
825-
case GML_ev_user6: return EVENT_OTHER_USER6;
826-
case GML_ev_user7: return EVENT_OTHER_USER7;
827-
case GML_ev_user8: return EVENT_OTHER_USER8;
828-
case GML_ev_user9: return EVENT_OTHER_USER9;
829-
case GML_ev_user10: return EVENT_OTHER_USER10;
830-
case GML_ev_user11: return EVENT_OTHER_USER11;
831-
case GML_ev_user12: return EVENT_OTHER_USER12;
832-
case GML_ev_user13: return EVENT_OTHER_USER13;
833-
case GML_ev_user14: return EVENT_OTHER_USER14;
834-
case GML_ev_user15: return EVENT_OTHER_USER15;
798+
// @endif
799+
// @if event("UserEvent*")
800+
case GML_EVENT_OTHER_USER0: return EVENT_OTHER_USER0;
801+
case GML_EVENT_OTHER_USER1: return EVENT_OTHER_USER1;
802+
case GML_EVENT_OTHER_USER2: return EVENT_OTHER_USER2;
803+
case GML_EVENT_OTHER_USER3: return EVENT_OTHER_USER3;
804+
case GML_EVENT_OTHER_USER4: return EVENT_OTHER_USER4;
805+
case GML_EVENT_OTHER_USER5: return EVENT_OTHER_USER5;
806+
case GML_EVENT_OTHER_USER6: return EVENT_OTHER_USER6;
807+
case GML_EVENT_OTHER_USER7: return EVENT_OTHER_USER7;
808+
case GML_EVENT_OTHER_USER8: return EVENT_OTHER_USER8;
809+
case GML_EVENT_OTHER_USER9: return EVENT_OTHER_USER9;
810+
case GML_EVENT_OTHER_USER10: return EVENT_OTHER_USER10;
811+
case GML_EVENT_OTHER_USER11: return EVENT_OTHER_USER11;
812+
case GML_EVENT_OTHER_USER12: return EVENT_OTHER_USER12;
813+
case GML_EVENT_OTHER_USER13: return EVENT_OTHER_USER13;
814+
case GML_EVENT_OTHER_USER14: return EVENT_OTHER_USER14;
815+
case GML_EVENT_OTHER_USER15: return EVENT_OTHER_USER15;
816+
// @endif
835817
case GML_EVENT_OTHER_ANIMATIONUPDATE: return EVENT_OTHER_ANIMATIONUPDATE;
836818
case GML_EVENT_OTHER_ANIMATIONEVENT: return EVENT_OTHER_ANIMATIONEVENT;
837819
case GML_EVENT_OTHER_WEB_IMAGE_LOAD: return EVENT_OTHER_WEB_IMAGE_LOAD;

0 commit comments

Comments
 (0)