forked from microsoft/Microsoft-3D-Movie-Maker
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathscrexeg.cpp
1279 lines (1136 loc) · 33.6 KB
/
screxeg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Copyright (c) Microsoft Corporation.
Licensed under the MIT License. */
/***************************************************************************
Author: ShonK
Project: Kauai
Reviewed:
Copyright (c) Microsoft Corporation
Script interpreter for GOB based scripts.
***************************************************************************/
#include "kidframe.h"
ASSERTNAME
RTCLASS(SCEG)
#ifdef DEBUG
// these strings are for debug only error messages
static STN _stn;
#endif // DEBUG
/***************************************************************************
Constructor for a GOB based script interpreter. We don't just keep
the pgob in case the GOB goes away while the script is running.
***************************************************************************/
SCEG::SCEG(PWOKS pwoks, PRCA prca, PGOB pgob) : SCEG_PAR(prca, pwoks->Pstrg())
{
AssertPo(pwoks, 0);
AssertPo(prca, 0);
AssertPo(pgob, 0);
_pwoks = pwoks;
_hid = pgob->Hid();
_grid = pgob->Grid();
_pgob = pvNil;
AssertThis(0);
}
#ifdef DEBUG
/***************************************************************************
Assert the validity of a SCEG.
***************************************************************************/
void SCEG::AssertValid(ulong grf)
{
SCEG_PAR::AssertValid(0);
Assert(hidNil != _hid, 0);
AssertPo(_pwoks, 0);
Assert(_prca != pvNil, 0);
}
#endif // DEBUG
/***************************************************************************
The script is being resumed, so set _pgob to nil (don't know whether
it exists).
***************************************************************************/
bool SCEG::FResume(long *plwReturn, bool *pfPaused)
{
GobMayDie();
return SCEG_PAR::FResume(plwReturn, pfPaused);
}
/***************************************************************************
Return the gob that corresponds to this script interpreter.
***************************************************************************/
PGOB SCEG::_PgobThis(void)
{
AssertThis(0);
if (pvNil != _pgob)
{
AssertPo(_pgob, 0);
Assert(_pgob->Grid() == _grid, "bad value of _pgob");
return _pgob;
}
_pgob = _pwoks->PgobFromGrid(_grid);
return _pgob;
}
/***************************************************************************
Return the gob that is accessible to this script interpreter and has
the given hid.
***************************************************************************/
PGOB SCEG::_PgobFromHid(long hid)
{
AssertThis(0);
if (hid == _hid)
return _PgobThis();
return _pwoks->PgobFromHid(hid);
}
/***************************************************************************
Return the address of the variable table for the GOB associated with
this script interpreter.
***************************************************************************/
PGL *SCEG::_PpglrtvmThis(void)
{
PGOB pgob = _PgobThis();
if (pvNil == pgob)
return pvNil;
return pgob->Ppglrtvm();
}
/***************************************************************************
Return the address of the variable table for the WOKS associated with
this script interpreter.
***************************************************************************/
PGL *SCEG::_PpglrtvmGlobal(void)
{
AssertThis(0);
return _pwoks->Ppglrtvm();
}
/***************************************************************************
Return the address of the variable table for the GOB with given hid.
***************************************************************************/
PGL *SCEG::_PpglrtvmRemote(long lw)
{
PGOB pgob = _PgobFromHid(lw);
if (pvNil == pgob)
return pvNil;
return pgob->Ppglrtvm();
}
/***************************************************************************
Return the current version number of the script compiler.
***************************************************************************/
short SCEG::_SwCur(void)
{
return kswCurSccg;
}
/***************************************************************************
Return the min version number of the script compiler. Read can read
scripts back to this version.
***************************************************************************/
short SCEG::_SwMin(void)
{
return kswMinSccg;
}
/***************************************************************************
Execute a script command.
***************************************************************************/
bool SCEG::_FExecOp(long op)
{
CMD cmd;
PGOB pgob;
PCLOK pclok;
long hid;
long dtim;
long dxp, dyp;
long lw1, lw2, lw3, lw4, clw;
long *qrglw;
void *pv;
hid = _hid; // for "this" operations
switch (op)
{
case kopDestroyGob:
hid = _LwPop();
// fall through
case kopDestroyThis:
if (!_fError && pvNil != (pgob = _PgobFromHid(hid)))
{
GobMayDie();
if (pgob == _pwoks)
{
Debug(_WarnSz(PszLit("Can't Destroy WOKS - destroying all its children")));
PGOB pgobT;
while (pvNil != (pgobT = pgob->PgobFirstChild()))
ReleasePpo(&pgobT);
}
else
ReleasePpo(&pgob);
}
break;
case kopCreateChildGob:
hid = _LwPop();
// fall through
case kopCreateChildThis:
lw1 = _LwPop();
lw2 = _LwPop();
pgob = pvNil;
if (!_fError && pvNil != (pgob = _PgobFromHid(hid)))
{
GobMayDie();
pgob = _pwoks->PgokNew(pgob, lw1, lw2, _prca);
}
else
{
Debug(_WarnSz(PszLit("Missing parent GOB for CreateChild(Gob|This) (gid = %d)"), hid));
}
_Push(pvNil == pgob ? hidNil : pgob->Hid());
break;
case kopCreateHelpGob:
hid = _LwPop();
// fall through
case kopCreateHelpThis:
lw1 = _LwPop();
pgob = pvNil;
if (!_fError && pvNil != (pgob = _PgobFromHid(hid)))
{
GobMayDie();
pgob = _pwoks->PhbalNew(pgob, _prca, lw1);
}
else
{
Debug(_WarnSz(PszLit("Missing parent GOB for CreateHelp(Gob|This) (gid = %d)"), hid));
}
_Push(pvNil == pgob ? hidNil : pgob->Hid());
break;
case kopResizeGob:
hid = _LwPop();
// fall through
case kopResizeThis:
dxp = _LwPop();
dyp = _LwPop();
// REVIEW shonk: should we handle hwnd based gob's?
if (!_fError && pvNil != (pgob = _PgobFromHid(hid)) && hNil == pgob->Hwnd())
{
RC rc;
pgob->GetRc(&rc, cooParent);
rc.xpRight = rc.xpLeft + LwMax(0, dxp);
rc.ypBottom = rc.ypTop + LwMax(0, dyp);
pgob->SetPos(&rc, pvNil);
}
else
{
Debug(_WarnSz(PszLit("Missing GOB for Resize(Gob|This) (gid = %d)"), hid));
}
break;
case kopMoveRelGob:
hid = _LwPop();
// fall through
case kopMoveRelThis:
dxp = _LwPop();
dyp = _LwPop();
// REVIEW shonk: should we handle hwnd based gob's?
if (!_fError && pvNil != (pgob = _PgobFromHid(hid)) && hNil == pgob->Hwnd())
{
RC rc;
pgob->GetRc(&rc, cooParent);
rc.Offset(dxp, dyp);
pgob->SetPos(&rc, pvNil);
}
else
{
Debug(_WarnSz(PszLit("Missing GOB for MoveRel(Gob|This) (gid = %d)"), hid));
}
break;
case kopMoveAbsGob:
hid = _LwPop();
// fall through
case kopMoveAbsThis:
dxp = _LwPop();
dyp = _LwPop();
// REVIEW shonk: should we handle hwnd based gob's?
if (!_fError && pvNil != (pgob = _PgobFromHid(hid)) && hNil == pgob->Hwnd())
{
RC rc;
pgob->GetRc(&rc, cooParent);
if (pgob->FIs(kclsGOK))
{
PT pt;
((PGOK)pgob)->GetPtReg(&pt, cooLocal);
dxp -= pt.xp;
dyp -= pt.yp;
}
rc.Offset(dxp - rc.xpLeft, dyp - rc.ypTop);
pgob->SetPos(&rc, pvNil);
}
else
{
Debug(_WarnSz(PszLit("Missing GOB for MoveAbs(Gob|This) (gid = %d)"), hid));
}
break;
case kopRunScriptGob:
case kopRunScriptThis:
case kopRunScriptCnoGob:
case kopRunScriptCnoThis:
clw = _LwPop(); // the number of parameters
if (kopRunScriptGob == op || kopRunScriptCnoGob == op)
hid = _LwPop();
lw1 = _LwPop(); // the chid of the script
if (_fError)
break;
if (clw > 0)
{
if (pvNil == _QlwGet(clw))
break;
if (!FAllocPv(&pv, LwMul(size(long), clw), fmemNil, mprNormal))
{
Debug(_WarnSz(PszLit("OOM attempting to run script")));
_PopList(clw);
clw = 0;
pv = pvNil;
}
else
{
CopyPb(_QlwGet(clw), pv, LwMul(size(long), clw));
ReverseRglw(pv, clw);
_PopList(clw);
}
}
else
pv = pvNil;
if (pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
Debug(_WarnSz(PszLit("Missing GOB for RunScript[Cno](Gob|This) (gid = %d)"), hid));
lw2 = 0;
}
else
{
tribool tRet;
GobMayDie();
if (kopRunScriptCnoGob == op || kopRunScriptCnoThis == op)
((PGOK)pgob)->FRunScriptCno(lw1, (long *)pv, clw, &lw2, &tRet);
else
((PGOK)pgob)->FRunScript(lw1, (long *)pv, clw, &lw2, &tRet);
if (tYes != tRet)
{
Debug(_WarnSz(PszLit("Running script failed (chid = 0x%x, gid = %d)"), lw1, hid));
lw2 = 0;
}
}
FreePpv(&pv);
_Push(lw2);
break;
case kopChangeStateGob:
hid = _LwPop();
// fall through
case kopChangeStateThis:
lw1 = _LwPop();
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK) || !FIn(lw1, 0, kswMax))
{
Debug(_WarnSz(PszLit("Missing GOB or state out of range for ")
PszLit("ChangeState(Gob|This) (gid = %d, sno = %d)"),
hid, lw1));
}
else
{
GobMayDie();
((PGOK)pgob)->FChangeState(lw1);
}
break;
case kopAnimateGob:
hid = _LwPop();
// fall through
case kopAnimateThis:
lw1 = _LwPop();
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
Debug(_WarnSz(PszLit("Missing GOB for Animate(Gob|This) (gid = %d)"), hid));
}
else
{
GobMayDie();
((PGOK)pgob)->FSetRep(lw1, fgokNil, kctgAnimation);
}
break;
case kopSetPictureGob:
hid = _LwPop();
// fall through
case kopSetPictureThis:
lw1 = _LwPop();
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
Debug(_WarnSz(PszLit("Missing GOB for SetPicture(Gob|This) (gid = %d)"), hid));
}
else
{
GobMayDie();
((PGOK)pgob)->FSetRep(lw1, fgokKillAnim, kctgMbmp);
}
break;
case kopSetRepGob:
hid = _LwPop();
// fall through
case kopSetRepThis:
lw1 = _LwPop();
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
Debug(_WarnSz(PszLit("Missing GOB for SetRep(Gob|This) (gid = %d)"), hid));
}
else
{
GobMayDie();
((PGOK)pgob)->FSetRep(lw1);
}
break;
case kopStateGob:
hid = _LwPop();
// fall through
case kopStateThis:
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
lw1 = 0;
Debug(_WarnSz(PszLit("Missing GOB for State(Gob|This) (gid = %d)"), hid));
}
else
lw1 = ((PGOK)pgob)->Sno();
_Push(lw1);
break;
case kopGidThis:
_Push(_hid);
break;
case kopGidParGob:
hid = _LwPop();
// fall through
case kopGidParThis:
if (pvNil != (pgob = _PgobFromHid(hid)))
pgob = _pwoks->PgobParGob(pgob);
_Push(pvNil == pgob ? hidNil : pgob->Hid());
break;
case kopGidNextSib:
if (pvNil != (pgob = _PgobFromHid(_LwPop())))
pgob = pgob->PgobNextSib();
_Push(pvNil == pgob ? hidNil : pgob->Hid());
break;
case kopGidPrevSib:
if (pvNil != (pgob = _PgobFromHid(_LwPop())))
pgob = pgob->PgobPrevSib();
_Push(pvNil == pgob ? hidNil : pgob->Hid());
break;
case kopGidChild:
if (pvNil != (pgob = _PgobFromHid(_LwPop())))
pgob = pgob->PgobFirstChild();
_Push(pvNil == pgob ? hidNil : pgob->Hid());
break;
case kopFGobExists:
pgob = _PgobFromHid(_LwPop());
_Push(pvNil != pgob);
break;
case kopEnqueueCid:
cmd.cid = _LwPop();
cmd.pgg = pvNil;
hid = _LwPop();
if (hidNil == hid)
cmd.pcmh = pvNil;
else
cmd.pcmh = _pwoks->PcmhFromHid(hid);
cmd.rglw[0] = _LwPop();
cmd.rglw[1] = _LwPop();
cmd.rglw[2] = _LwPop();
cmd.rglw[3] = _LwPop();
if (!_fError)
vpcex->EnqueueCmd(&cmd);
break;
case kopAlert:
case kopPrint:
case kopPrintStat:
case kopAlertStr:
case kopPrintStr:
case kopPrintStrStat:
GobMayDie();
_DoAlert(op);
break;
case kopCreateClock:
hid = _LwPop();
if (hidNil != hid && pvNil != (pclok = _pwoks->PclokFromHid(hid)))
{
Debug(_WarnSz(PszLit("Clock already exists - incrementing ref count (hid = %d)"), hid));
pclok->AddRef();
}
else
{
if (hidNil == hid)
hid = CMH::HidUnique();
if (pvNil == NewObj CLOK(hid))
hid = hidNil;
}
_Push(hid);
break;
case kopDestroyClock:
if (pvNil != (pclok = _pwoks->PclokFromHid(_LwPop())))
ReleasePpo(&pclok);
break;
case kopStartClock:
hid = _LwPop();
lw1 = _LwPop();
if (!_fError && pvNil != (pclok = _pwoks->PclokFromHid(hid)))
pclok->Start(lw1);
else
{
Debug(_WarnSz(PszLit("Missing clock for StartClock (hid = %d)"), hid));
}
break;
case kopStopClock:
if (pvNil != (pclok = _pwoks->PclokFromHid(_LwPop())))
pclok->Stop();
else
{
Debug(_WarnSz(PszLit("Missing clock for StopClock (hid = %d)"), hid));
}
break;
case kopTimeCur:
if (pvNil != (pclok = _pwoks->PclokFromHid(_LwPop())))
_Push(pclok->TimCur());
else
{
Debug(_WarnSz(PszLit("Missing clock for TimeCur (hid = %d)"), hid));
_Push(0);
}
break;
case kopSetAlarmGob:
hid = _LwPop();
case kopSetAlarmThis:
case kopSetAlarm:
lw1 = _LwPop();
dtim = _LwPop();
if (kopSetAlarm == op)
lw2 = chidNil;
else
lw2 = _LwPop();
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || pvNil == (pclok = _pwoks->PclokFromHid(lw1)) ||
!pclok->FSetAlarm(dtim, pgob, lw2))
{
Debug(_WarnSz(PszLit("Setting Alarm failed (hid = %d)"), lw1));
}
break;
case kopXMouseGob:
case kopYMouseGob:
hid = _LwPop();
// fall through
case kopXMouseThis:
case kopYMouseThis:
if (_fError || pvNil == (pgob = _PgobFromHid(hid)))
{
Debug(_WarnSz(PszLit("Missing GOB for (X|Y)Mouse(Gob|This) (gid = %d)"), hid));
_Push(0);
}
else
{
PT pt;
bool fDown;
pgob->GetPtMouse(&pt, &fDown);
_Push(op == kopXMouseThis || op == kopXMouseGob ? pt.xp : pt.yp);
}
break;
case kopGidUnique:
_Push(CMH::HidUnique());
break;
case kopXGob:
case kopYGob:
hid = _LwPop();
// fall through
case kopXThis:
case kopYThis:
if (_fError || pvNil == (pgob = _PgobFromHid(hid)))
{
Debug(_WarnSz(PszLit("Missing GOB for (X|Y)(Gob|This) (gid = %d)"), hid));
_Push(0);
}
else if (pgob->FIs(kclsGOK))
{
PT pt;
((PGOK)pgob)->GetPtReg(&pt);
_Push(op == kopXThis || op == kopXGob ? pt.xp : pt.yp);
}
else
{
RC rc;
pgob->GetRc(&rc, cooParent);
_Push(op == kopXThis || op == kopXGob ? rc.xpLeft : rc.ypTop);
}
break;
case kopZGob:
hid = _LwPop();
// fall through
case kopZThis:
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
Debug(_WarnSz(PszLit("Missing GOB for Z(Gob|This) (gid = %d)"), hid));
_Push(0);
}
else
_Push(((PGOK)pgob)->ZPlane());
break;
case kopSetZGob:
hid = _LwPop();
// fall through
case kopSetZThis:
lw1 = _LwPop();
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
Debug(_WarnSz(PszLit("Missing GOB for SetZ(Gob|This) (gid = %d)"), hid));
}
else
((PGOK)pgob)->SetZPlane(lw1);
break;
case kopSetColorTable:
_SetColorTable(_LwPop());
break;
case kopCell:
_fPaused = fTrue;
// fall through
case kopCellNoPause:
lw1 = _LwPop();
dxp = _LwPop();
dyp = _LwPop();
dtim = _LwPop();
if (_fError || pvNil == (pgob = _PgobThis()))
{
Debug(_WarnSz(PszLit("Missing GOB for Cell[NoPause] (gid = %d)"), hid));
}
else
{
GobMayDie();
((PGOK)pgob)->FSetRep(lw1, fgokNoAnim, ctgNil, dxp, dyp, dtim);
}
break;
case kopGetModifierState:
_Push(_pwoks->GrfcustCur());
break;
case kopChangeModifierState:
lw1 = _LwPop();
lw2 = _LwPop();
if (!_fError)
_pwoks->ModifyGrfcust(lw1, lw2);
break;
case kopTransition:
lw1 = _LwPop();
lw2 = _LwPop();
dtim = _LwPop();
lw3 = _LwPop();
lw4 = _LwPop();
if (!_fError)
{
ACR acr;
PGL pglclr = _PglclrGet((CNO)lw4);
acr.SetFromLw(lw3);
vpappb->SetGft(lw1, lw2, LuMulDiv(dtim, kdtsSecond, kdtimSecond), pglclr, acr);
ReleasePpo(&pglclr);
}
break;
case kopGetEdit:
lw1 = _LwPop();
_DoEditControl(lw1, _LwPop(), fTrue);
break;
case kopSetEdit:
lw1 = _LwPop();
_DoEditControl(lw1, _LwPop(), fFalse);
break;
case kopGetProp:
lw1 = _LwPop();
if (!_fError)
{
GobMayDie();
if (!vpappb->FGetProp(lw1, &lw2))
{
Debug(_WarnSz(PszLit("GetProp failed (prid = %d)"), lw1));
lw2 = 0;
}
_Push(lw2);
}
break;
case kopSetProp:
lw1 = _LwPop();
lw2 = _LwPop();
GobMayDie();
if (!_fError && !vpappb->FSetProp(lw1, lw2))
{
Debug(_WarnSz(PszLit("SetProp failed (prid = %d, val = %d)"), lw1, lw2));
}
break;
case kopLaunch:
lw1 = _LwPop();
GobMayDie();
if (!_fError)
_Push(_FLaunch(lw1));
break;
case kopPlayGob:
hid = _LwPop();
// fall through
case kopPlayThis:
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
Debug(_WarnSz(PszLit("Missing GOB for Play(Gob|This) (gid = %d)"), hid));
}
else
((PGOK)pgob)->FPlay();
break;
case kopPlayingGob:
hid = _LwPop();
// fall through
case kopPlayingThis:
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
Debug(_WarnSz(PszLit("Missing GOB for Playing(Gob|This) (gid = %d)"), hid));
_Push(fFalse);
}
else
_Push(((PGOK)pgob)->FPlaying());
break;
case kopStopGob:
hid = _LwPop();
// fall through
case kopStopThis:
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
Debug(_WarnSz(PszLit("Missing GOB for Stop(Gob|This) (gid = %d)"), hid));
}
else
((PGOK)pgob)->Stop();
break;
case kopCurFrameGob:
hid = _LwPop();
// fall through
case kopCurFrameThis:
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
Debug(_WarnSz(PszLit("Missing GOB for (CurFrame(Gob|This) (gid = %d)"), hid));
_Push(0);
}
else
_Push(((PGOK)pgob)->NfrCur());
break;
case kopCountFramesGob:
hid = _LwPop();
// fall through
case kopCountFramesThis:
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
Debug(_WarnSz(PszLit("Missing GOB for CountFrames(Gob|This) (gid = %d)"), hid));
_Push(0);
}
else
_Push(((PGOK)pgob)->NfrMac());
break;
case kopGotoFrameGob:
hid = _LwPop();
// fall through
case kopGotoFrameThis:
lw1 = _LwPop();
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
Debug(_WarnSz(PszLit("Missing GOB for GotoFrame(Gob|This) (gid = %d)"), hid));
}
else
((PGOK)pgob)->GotoNfr(lw1);
break;
case kopFilterCmdsGob:
hid = _LwPop();
// fall through
case kopFilterCmdsThis:
lw1 = _LwPop();
lw2 = _LwPop();
lw3 = _LwPop();
if (_fError || pvNil == (pgob = _PgobFromHid(hid)) || !pgob->FIs(kclsGOK))
{
Debug(_WarnSz(PszLit("Missing GOB for FilterCmds(Gob|This) (gid = %d)"), hid));
}
else if (!((PGOK)pgob)->FFilterCidHid(lw1, lw2, lw3))
{
Debug(_WarnSz(PszLit("Filtering failed (gid = %d)"), hid));
}
break;
case kopDestroyChildrenGob:
hid = _LwPop();
// fall through
case kopDestroyChildrenThis:
if (!_fError && pvNil != (pgob = _PgobFromHid(hid)))
{
PGOB pgobT;
GobMayDie();
while (pvNil != (pgobT = pgob->PgobFirstChild()))
ReleasePpo(&pgobT);
}
break;
case kopPlaySoundGob:
hid = _LwPop();
// fall through
case kopPlaySoundThis:
lw1 = siiNil;
if (!_fError)
{
pgob = (hidNil == hid) ? pvNil : _PgobFromHid(hid);
if (pvNil != pgob && pgob->FIs(kclsGOK))
{
if (pvNil != (qrglw = _QlwGet(7)))
{
lw1 = ((PGOK)pgob)
->SiiPlaySound(qrglw[6], qrglw[5], qrglw[4], qrglw[3], qrglw[2], 0, qrglw[1], qrglw[0]);
}
}
else
{
#ifdef DEBUG
if (hidNil != hid)
{
_WarnSz(PszLit("No GOK for PlaySound(Gob|This) (gid = %d)"), hid);
}
#endif // DEBUG
if (pvNil != vpsndm && pvNil != (qrglw = _QlwGet(7)))
{
lw1 =
vpsndm->SiiPlay(_prca, qrglw[6], qrglw[5], qrglw[4], qrglw[3], qrglw[2], 0, qrglw[1], qrglw[0]);
}
}
_PopList(7);
}
_Push(lw1);
break;
case kopStopSound:
lw1 = _LwPop();
if (!_fError && pvNil != vpsndm)
vpsndm->Stop(lw1);
break;
case kopStopSoundClass:
lw1 = _LwPop();
lw2 = _LwPop();
if (!_fError && pvNil != vpsndm)
vpsndm->StopAll(lw1, lw2);
break;
case kopPlayingSound:
lw1 = _LwPop();
if (!_fError && pvNil != vpsndm)
_Push(vpsndm->FPlaying(lw1));
break;
case kopPlayingSoundClass:
lw1 = _LwPop();
lw2 = _LwPop();
if (!_fError && pvNil != vpsndm)
_Push(vpsndm->FPlayingAll(lw1, lw2));
break;
case kopPauseSound:
lw1 = _LwPop();
if (!_fError && pvNil != vpsndm)
vpsndm->Pause(lw1);
break;
case kopPauseSoundClass:
lw1 = _LwPop();
lw2 = _LwPop();
if (!_fError && pvNil != vpsndm)
vpsndm->PauseAll(lw1, lw2);
break;
case kopResumeSound:
lw1 = _LwPop();
if (!_fError && pvNil != vpsndm)
vpsndm->Resume(lw1);
break;
case kopResumeSoundClass:
lw1 = _LwPop();
lw2 = _LwPop();
if (!_fError && pvNil != vpsndm)
vpsndm->ResumeAll(lw1, lw2);
break;
case kopPlayMouseSoundGob:
hid = _LwPop();
// fall through
case kopPlayMouseSoundThis:
lw1 = _LwPop();
lw2 = _LwPop();
if (!_fError && pvNil != (pgob = _PgobFromHid(hid)) && pgob->FIs(kclsGOK))
{
_Push(((PGOK)pgob)->SiiPlayMouseSound(lw1, lw2));
}
else
_Push(siiNil);
break;
case kopWidthGob:
case kopHeightGob:
hid = _LwPop();
// fall thru
case kopWidthThis:
case kopHeightThis:
if (!_fError && pvNil != (pgob = _PgobFromHid(hid)))
{
RC rc;
pgob->GetRc(&rc, cooLocal);
if (kopWidthGob == op || kopWidthThis == op)
_Push(rc.Dxp());
else
_Push(rc.Dyp());
}
else
{
Debug(_WarnSz(PszLit("Missing GOB for (Width|Height)(Gob|This) (gid = %d)"), hid));
_Push(0);
}
break;
case kopSetNoSlipGob:
hid = _LwPop();
// fall through
case kopSetNoSlipThis:
lw1 = _LwPop();
if (!_fError && pvNil != (pgob = _PgobFromHid(hid)) && pgob->FIs(kclsGOK))
{
((PGOK)pgob)->SetNoSlip(lw1);
}
else
{
Debug(_WarnSz(PszLit("Missing GOB for SetNoSlip(Gob|This) (gid = %d)"), hid));
}
break;
case kopFIsDescendent:
lw1 = _LwPop();
lw2 = _LwPop();
if (!_fError)
{
PGOB pgobPar = _PgobFromHid(lw2);
if (pvNil == pgobPar || pvNil == (pgob = _PgobFromHid(lw1)))
_Push(0);
else
{
while (pgob != pvNil && pgob != pgobPar)
pgob = _pwoks->PgobParGob(pgob);
_Push(pgob == pgobPar);
}
}
break;
case kopSetMasterVolume:
lw1 = _LwPop();
if (!_fError && pvNil != vpsndm)
vpsndm->SetVlm(lw1);
break;
case kopGetMasterVolume: