diff --git a/source/twilight/sample/config.cc b/source/twilight/sample/config.cc new file mode 100644 index 0000000..7fd499b --- /dev/null +++ b/source/twilight/sample/config.cc @@ -0,0 +1,102 @@ + +/* +** Ball, Release v1.0 - 19 July 1993. +** C Source Code - "Config.cc" - Source Support Segment +** +** Routines here are mostly by Josef Wankerl (thanks Joe! & Diz :) & GS+ +** Suscribe to GS+; it's a great mag! +** +** Copyright 1993 DigiSoft Innovations, All Rights Reserved. +** +** Permission granted to use this source in any module designed for +** Twilight II for the Apple IIGS. +*/ + +/*****************************************************************************\ +|* LoadConfigResource- +|* This function attempts to load a named rT2ModuleWord resource. If +|* the resource exists, the value of the rT2ModuleWord resource is +|* returned, otherwise a default value is returned. +\*****************************************************************************/ + +Word LoadConfigResource (char *Name, Word DefaultValue) { + + Word Result, fileID; + Long rID; + Handle ConfigData; + struct { + word Type; + Long ID; + } HandleInfo; + + +/* Attempt to load the named resource */ + + rID = RMFindNamedResource((Word) rT2ModuleWord, (Ptr) Name, &fileID); + + ConfigData = LoadResource((Word) rT2ModuleWord, rID); + if (toolerror ()) + Result = DefaultValue; /* Resource does not exist, so return the default value */ + else + { + HLock(ConfigData); /* Resource exists, return the rT2Module word value */ + Result = **(word **)ConfigData; + HUnlock(ConfigData); + + ReleaseResource(3, (Word) rT2ModuleWord, rID); + } + + return Result; +} + + + +/*****************************************************************************\ +|* SaveConfigResource- +|* This function takes a Word value and saves it as a rT2ModuleWord +|* resource in the Twilight.Setup file. The value is saved and a +|* name is added. Any previous rT2ModuleWord with the same name is +|* first removed before the new value is added. +\*****************************************************************************/ + +void SaveConfigResource (char *Name, Word SaveValue) { + + Word FileID; + Long ResourceID; + Word **ConfigData; + +/* Check to see if the named resource already exists */ + + ResourceID = RMFindNamedResource (rT2ModuleWord, Name, &FileID); + if (!toolerror()) { + char NullString = '\x000'; + +/* The resource already exists, so first remove the name from */ +/* the resource, then remove the resource itself */ + + RMSetResourceName (rT2ModuleWord, ResourceID, &NullString); + RemoveResource (rT2ModuleWord, ResourceID); + } + +/* Create new handle for the future resource */ + + ConfigData = + (Word **) NewHandle (sizeof (Word), GetCurResourceApp(), attrLocked, NULL); + **ConfigData = SaveValue; + +/* Find a new ID for the resource and add it */ + + ResourceID = UniqueResourceID (0, rT2ModuleWord); + AddResource ((Handle) ConfigData, 0, rT2ModuleWord, ResourceID); + if (toolerror ()) + DisposeHandle ((Handle) ConfigData); + + else { + +/* Set the name of the resource if it was added correctly */ + + RMSetResourceName (rT2ModuleWord, ResourceID, Name); + UpdateResourceFile (SetupFileNumber); + } + +} \ No newline at end of file diff --git a/source/twilight/sample/makefile b/source/twilight/sample/makefile new file mode 100644 index 0000000..4c42914 --- /dev/null +++ b/source/twilight/sample/makefile @@ -0,0 +1,27 @@ + +# Twilight II Spirographics UNIX MakeFile +# by Jim Maricondo +# v1.0 - 18 Jul 93 6:22pm + +# First deal with all the dfork... + +ball.d.root: ball.cc config.cc 22/t2.h + compile +w ball.cc keep=ball.d + +ball.d: ball.d.root ball.d.a + link +w ball.d keep=ball.d + +# Now work with the rfork... + +ball.r: ball.rez 22/t2common.rez + compile ball.rez keep=ball.r + +# Now put it together. +# filetype ball $bc $4004 + +ballgraphics: ball.r ball.d + duplicate -d ball.d ball + duplicate -r ball.r ball + setfile -at $4004 -t $bc ball -m . + cp ball *:system:cdevs:twilight:ball + 22:beep diff --git a/source/twilight/sample/old/ball.cc.oldie b/source/twilight/sample/old/ball.cc.oldie new file mode 100644 index 0000000..e73500d --- /dev/null +++ b/source/twilight/sample/old/ball.cc.oldie @@ -0,0 +1,274 @@ + +/* +** Ball, Release v1.0 - 16 July 1993. (4 spaces = 1 tab) +** +** A Twilight II module by James C Smith and James R Maricondo. +** Parts based off the original T2 C shell by Josef Wankerl. +** +** Copyright 1993 DigiSoft Innovations, All Rights Reserved. +** +** Permission granted to use this source in any module designed for Twilight II. +*/ + +/* pragmas */ + +#pragma keep "Ball.d" +#pragma cdev Ball +#pragma optimize -2 +#pragma debug 0 + +/* defines */ + +#define ballCtlList 1l + +#define RedStr 1l +#define BlueStr 2l +#define GreenStr 3l +#define PurpleStr 4l +#define YellowStr 5l +#define TurquoiseStr 6l +#define ballColorStr 10l +#define useSoundStr 20l + +#define colorMenu 1l + +#define colorCtl 1l +#define useSoundCtl 2l +#define ballStrCtl 3l +#define ballIconCtl 4l +#define ballLineCtl 5l + +#define blueMenuItem 1l +#define greenMenuItem 2l +#define redMenuItem 3l +#define turquoiseMenuItem 4l +#define purpleMenuItem 5l +#define yellowMenuItem 6l + +#define ballIcon 0x0010DD01l + +/* includes */ + +#include "22:T2.h" +#include +#include +#include +#include +#include + +pascal void SysBeep() inline(0x2C03,dispatcher); +pascal LongWord TickCount() inline(0x1006,dispatcher); + +#pragma lint -1 + +/* prototypes */ + +LongWord Ball(LongWord, LongWord, Word); +LongWord MakeT2Ball(void); +void LoadSetupT2Ball(void); +void SaveConfigResource(char *, Word); +Word LoadConfigResource(char *, Word); +LongWord HitT2Ball(LongWord); +void SaveT2Ball(void); + +/* globals */ + +char *ConfigNameString="\pBall Setup"; + +unsigned int BallColor, SoundFlag; +Word *movePtr; +long NewTick, OldTick; + +Word SetupFileNumber; +GrafPortPtr SetupWindow; + +Long X,Y,XV,YV, BallSize, GravityValue; +Rect MyRect, OldRect; +Word MyColorTable[16]; + +/* other source files */ + +#include "config.cc" + +/* main functions */ + +LongWord BlankT2Ball(void) { + + int temp; + + InitColorTable(MyColorTable); + SetColorTable(0, MyColorTable); + BallSize=10; + GravityValue=8000; + X=100<<16; + Y=15<<16; + XV=4<<16; + YV=0; + SetPenMode(modeXOR); + SetSolidPenPat(0xF); + while (!(*movePtr)) { + YV+=GravityValue; + X+=XV; + Y+=YV; + if((X+BallSize>(320<<16))|(X-BallSize<0)) + XV=-XV; + if((Y+BallSize>(200<<16))|(Y-BallSize<0)) + YV=-YV; + +asm { + lda MyRect+0 + sta OldRect+0 + lda MyRect+2 + sta OldRect+2 + lda MyRect+4 + sta OldRect+4 + lda MyRect+6 + sta OldRect+6 +}; + + + MyRect.v1=(Y>>16)-BallSize; + MyRect.h1=(X>>16)-BallSize; + MyRect.v2=(Y>>16)+BallSize; + MyRect.h2=(X>>16)+BallSize; + +asm { + lda MyRect + clc + adc BallSize + sta temp + + lda temp + cmp #200 + bcc fine + lda #199 + sta temp + +fine: sep #0x30 +waitloop: lda >0xe0c02f + asl a + lda >0xe0c02e + rol a + cmp temp + bne waitloop + rep #0x30 +}; + + PaintOval(&OldRect); + PaintOval(&MyRect); + +/* +l0: lda >0xe1c019 + bmi l0 +l1: lda >0xe1c019 + bpl l1 +};*/ + +/* SetSolidPenPat(0); + FrameOval(&MyRect);*/ + } + ClearScreen (0); + return (LongWord) NULL; +} + + + + +void SaveT2Ball(void) { + + Word OptionWord; + Word FileNumber; + +#ifdef zzz +/* Save current resource file and switch in Twilight.Setup */ + FileNumber = GetCurResourceFile (); + SetCurResourceFile (SetupFileNumber); +/* Save control values */ + ConfigNumBalls = GetCtlValue (GetCtlHandleFromID (SetupWindow, NumBallsPopup)); + OptionWord=ConfigNumBalls; + SaveConfigResource(ConfigNameString, OptionWord); +/* Restore old resource file */ + SetCurResourceFile (FileNumber); +#endif +} + + + + +LongWord HitT2Ball(LongWord ControlHit) { + + LongWord EnableFlag = 0L; + + if (ControlHit == 1 || ControlHit == 2) + EnableFlag = 1L; + + return EnableFlag; +} + + + +LongWord MakeT2Ball(void) { + + CtlRecHndl junk; + Word FileNumber; + + FileNumber = GetCurResourceFile (); + SetCurResourceFile (SetupFileNumber); + LoadSetupT2Ball(); + SetCurResourceFile (FileNumber); + junk=NewControl2(SetupWindow, resourceToResource, (long) ballCtlList); + SetCtlValue (BallColor, GetCtlHandleFromID (SetupWindow, colorCtl)); + SetCtlValue (SoundFlag, GetCtlHandleFromID (SetupWindow, useSoundCtl)); + + return 5L; +} + + +/* +|* LoadSetupT2Message- *| +|* This function loads in the messages configuration data. *| +|*/ + +void LoadSetupT2Ball(void) { + + Word OptionWord; + +/* Option Word format +** 0x000F = Num Balls +*/ + OptionWord = LoadConfigResource (ConfigNameString, 0x8FF0); + BallColor = OptionWord & 0x0FFF; + SoundFlag = OptionWord & 0x8000; +} + + + + +LongWord Ball(LongWord data2, LongWord data1, Word message) { + + LongWord Result = 1L; + + switch (message) { + case MakeT2: + SetupWindow = (GrafPortPtr) data1; + SetupFileNumber = (Word) data2; + Result = MakeT2Ball (); + break; + case BlankT2: + movePtr=(Word *) data1; + Result = BlankT2Ball (); + break; + case SaveT2: + SaveT2Ball(); + break; + case LoadSetupT2: + LoadSetupT2Ball(); + break; + case HitT2: + Result = HitT2Ball(data2); + case UnloadSetupT2: + case KillT2: + break; + } + return Result; +} diff --git a/source/twilight/sample/old/ball.rez0 b/source/twilight/sample/old/ball.rez0 new file mode 100644 index 0000000..b1ee2ff --- /dev/null +++ b/source/twilight/sample/old/ball.rez0 @@ -0,0 +1,383 @@ +// -------------------------------------------------------------------- +// Genesys created REZ data code +// Simple Software Systems International, Inc. +// APWREZ.SCG 1.2 +// -------------------------------------------------------------------- + +#include "types.rez" + +// --- Icon Definitions + +resource rIcon (ICON_00000001, $0000) { + $8000, // kind + $0014, // height + $0016, // width + + $"F00000000000000000000F" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0F044000000000000000F0" + $"0F444400000DDD000000F0" + $"0F44770000DDDDD00000F0" + $"0F0777700ADDDDD00000F0" + $"0F077660BBDDDDD00000F0" + $"0F00666BBBBDDD030000F0" + $"0F0066EBBBB003000000F0" + $"0F000EEEBB0000330000F0" + $"0F000EEEE00000300000F0" + $"0F0000EE000000033000F0" + $"0FFFFFFFFFFFFFFFFAFFF0" + $"0000000000000000000000" + $"F0FFFFFFFFFFFFFFFFFF0F" + $"F0FFFFFFFFFFFFFFFFFF0F" + $"F0FF4AFFFFFFFFFFFFFF0F" + $"F0CCCCCCCCCCCCCCCCCC0F" + $"F0FFFFFFFFFFFFFFFAFF0F" + $"F00000000000000000000F", + + $"0FFFFFFFFFFFFFFFFFFFF0" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0"; +}; + +// --- Control List Definitions + +resource rControlList (CTLLST_00000005, $0000) { + { + CTLTMP_00010012, // control 1 + CTLTMP_00007003, // control 2 + CTLTMP_00010013, // control 3 + CTLTMP_00007002, // control 4 + CTLTMP_00007001, // control 5 + CTLTMP_00007000, // control 6 + CTLTMP_00006FFF, // control 7 + CTLTMP_00006FFE, // control 8 + }; +}; + +// --- Control Templates + +resource rControlTemplate (CTLTMP_00006FFE, $0000) { + $00006FFE, // ID + { 61, 74, 0, 0}, // rect + popUpControl {{ + $0040, // flag + $1002, // moreFlags + $00000000, // refCon + $0000, // titleWidth + MENU_00000002, // menuRef + $01FF, // initialValue + 0 // colorTableRef + }}; +}; + +resource rControlTemplate (CTLTMP_00006FFF, $0000) { + $00006FFF, // ID + { 75, 78, 84,188}, // rect + checkControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + PSTR_000000FE, // titleRef + $0001 // initialValue + }}; +}; + +resource rControlTemplate (CTLTMP_00007000, $0000) { + $00007000, // ID + { 49,114, 59,209}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + LETXTBOX_00000001, // textRef + LETXTBOX_00000001_CNT, // textSize + $0001 // just + }}; +}; + +resource rControlTemplate (CTLTMP_00007001, $0000) { + $00007001, // ID + { 26,138, 49,186}, // rect + iconButtonControl {{ + $0004, // flag + $1020, // moreFlags + $00000000, // refCon + ICON_00000001, // iconRef + 0, // titleRef + 0, // colorTableRef + $0000, // displayMode + }}; +}; + +resource rControlTemplate (CTLTMP_00007002, $0000) { + $00007002, // ID + { 4,232, 16,286}, // rect + simpleButtonControl {{ + $0000, // flag + $3002, // moreFlags + $00000000, // refCon + PSTR_000000FD, // titleRef + 0, // colorTableRef + {"T","t",$0100,$0100} // key equivalents + }}; +}; + +resource rControlTemplate (CTLTMP_00007003, $0000) { + $07FEFFFE, // ID + { 4,290, 16,344}, // rect + simpleButtonControl {{ + $0000, // flag + $3002, // moreFlags + $00000000, // refCon + PSTR_00000012, // titleRef + 0, // colorTableRef + {"S","s",$0100,$0100} // key equivalents + }}; +}; + +resource rControlTemplate (CTLTMP_00010012, $0000) { + $07FEFFFF, // ID + { 53, 60, 92,274}, // rect + {{ + $0002, // flag + $1000, // moreFlags + $00000000, // refCon +resource rControlTemplate (CTLTMP_00010013, $0000) { + $07FEFFFD, // ID + { 4, 4, 0, 0}, // rect + popUpControl {{ + $0040, // flag + $1082, // moreFlags + $00000000, // refCon + $0000, // titleWidth + MENU_00000001, // menuRef + $0200 // initialValue + }}; +}; + +// --- rPString Templates + +resource rPString (PSTR_00000001, $C018) { + "Screen Corners" +}; + +resource rPString (PSTR_00000002, $C018) { + "Options" +}; + +resource rPString (PSTR_00000012, $0000) { + "Save" +}; + +resource rPString (PSTR_000000FC, $0000) { + "Setup: " +}; + +resource rPString (PSTR_000000FD, $0000) { + "Test" +}; + +resource rPString (PSTR_000000FE, $0000) { + "Use Sound" +}; + +resource rPString (PSTR_000000FF, $0000) { + " Ball Color: " +}; + +resource rPString (PSTR_00000100, $0000) { + "Red" +}; + +resource rPString (PSTR_00000107, $C018) { + "Blue" +}; + +resource rPString (PSTR_00000108, $C018) { + "Green" +}; + +resource rPString (PSTR_00000109, $C018) { + "Purple" +}; + +resource rPString (PSTR_0000010A, $C018) { + "Yellow" +}; + +resource rPString (PSTR_0000010B, $C018) { + "Turquoise" +}; + +// --- Menu Definitions + +resource rMenu (MENU_00000001, $0018) { + $0001, // menuID + $A008, // menuFlag + PSTR_000000FC, { // menuTitleRef + MENUITEM_00000200, + MENUITEM_00000201 + }; +}; + +resource rMenu (MENU_00000002, $0000) { + $0002, // menuID + $A000, // menuFlag + PSTR_000000FF, { // menuTitleRef + MENUITEM_000001FF, + MENUITEM_00000107, + MENUITEM_00000108, + MENUITEM_00000109, + MENUITEM_0000010A, + MENUITEM_0000010B + }; +}; + +// --- Menu Item Definitions + +resource rMenuItem (MENUITEM_00000107, $C018) { + $000F, // itemID + "","", // itemChar, itemAltChar + NIL, // itemCheck + $8000, // itemFlag + PSTR_00000107 // itemTitleRef +}; + +resource rMenuItem (MENUITEM_00000108, $C018) { + $00F0, // itemID + "","", // itemChar, itemAltChar + NIL, // itemCheck + $8000, // itemFlag + PSTR_00000108 // itemTitleRef +}; + +resource rMenuItem (MENUITEM_00000109, $C018) { + $0F0F, // itemID + "","", // itemChar, itemAltChar + NIL, // itemCheck + $8000, // itemFlag + PSTR_00000109 // itemTitleRef +}; + +resource rMenuItem (MENUITEM_0000010A, $C018) { + $0FF0, // itemID + "","", // itemChar, itemAltChar + NIL, // itemCheck + $8000, // itemFlag + PSTR_0000010A // itemTitleRef +}; + +resource rMenuItem (MENUITEM_0000010B, $C018) { + $00FF, // itemID + "","", // itemChar, itemAltChar + NIL, // itemCheck + $8000, // itemFlag + PSTR_0000010B // itemTitleRef +}; + +resource rMenuItem (MENUITEM_000001FF, $0000) { + $0F00, // itemID + "","", // itemChar, itemAltChar + NIL, // itemCheck + $8000, // itemFlag + PSTR_00000100 // itemTitleRef +}; + +resource rMenuItem (MENUITEM_00000200, $C018) { + $0200, // itemID + "","", // itemChar, itemAltChar + NIL, // itemCheck + $8000, // itemFlag + PSTR_00000001 // itemTitleRef +}; + +resource rMenuItem (MENUITEM_00000201, $C018) { + $0201, // itemID + "","", // itemChar, itemAltChar + NIL, // itemCheck + $8040, // itemFlag + PSTR_00000002 // itemTitleRef +}; + +// --- rTextForLETextBox2 Templates + +#define LETXTBOX_00000001_CNT 40 /* move this line to the top of this file */ + +resource rTextForLETextBox2 (LETXTBOX_00000001, $0000) { + "\$01" + "J" + "\$00" + "\$00" + "\$01" + "L" + "\$00" + "\$00" + "\$01" + "R" + "\$04" + "\$00" + "\$01" + "F" + "\$FE" + "\$FF" + "\$00" + "\$08" + "\$01" + "C" + "\$00" + "\$00" + "\$01" + "B" + "\$FF" + "\$FF" + " Ball Options " +}; + +// --- Window Templates + +resource rWindParam1 (WPARAM1_00000FFF, $0000) { + $C0A8, // plFrame (frame bits) + PSTR_000000FC, // plTitle (title ID) + $00000000, // p1RefCon + { 0, 0, 0, 0}, // p1ZoomRect + WCOLOR_00000001, // p1ColorTable + {$0000, $0000}, // p1YOrigin, p1XOrigin + {$0000, $0000}, // p1DataHeight, p1DataWidth + {$0000, $0000}, // p1MaxHeight, p1MaxWidth + {$0000, $0000}, // p1VerScroll, p1HorScroll + {$0000, $0000}, // p1VerPage, p1HorPage + $00000000, // p1InfoText (info RefCon) + $0000, // p1InfoHeight + { 50,146,180,494}, // p1Position + infront, // p1Plane + CTLLST_00000005, // plControlList + $0A09 // plInDesc +}; + +// --- Window Color Templates + +resource rWindColor (WCOLOR_00000001, $0000) { + $0000, // frameColor + $0F00, // titleColor + $020F, // tBarColor + $F0FF, // growColor + $00F0 // infoColor +}; + diff --git a/source/twilight/sample/old/ball.rez1 b/source/twilight/sample/old/ball.rez1 new file mode 100644 index 0000000..d801c86 Binary files /dev/null and b/source/twilight/sample/old/ball.rez1 differ diff --git a/source/twilight/sample/old/sound.bin b/source/twilight/sample/old/sound.bin new file mode 100644 index 0000000..76080d7 --- /dev/null +++ b/source/twilight/sample/old/sound.bin @@ -0,0 +1 @@ +‰‹ˆ~{xqpstvƒ…‰Ž‰‰ƒ}yxrrwxz€……†‡umv™˜ž›slcghmy…Š™™“‘‹vtlhmrv}‹Ž’–”Žˆƒwqomkpw{„‹‘‰‚~vpooos{…‹ŽŒŠ‚~ytpqsu{€…‰Ž‘“wfcb`ozŒ“””—Š…zmmmlox}‹Šwpopps}†‹ŽŒŒ…{wqptuyƒ„ˆˆ€xn–˜——‚|qidkko€Š’š—‘†{urjhqtyƒŒ‘—”Ї€wpplksy~„Ž’†€|ropoqv~‰ŽŒˆ€|wrpqtv~ƒ‡‹Ž}gba_nxŒ–•–˜Œ„~xkjkjmw~‚Œ’‘‘‘‹€}unloor}ƒ‡’Œ„}yuoosuy„†‰‰€wsŠ•—•‘}vofdnnt€ŒŒ“˜’‹…vtqllsx{‡Ž‘•†ƒ{sppmnx|ˆŽˆ‚}xpoqqu{‚„‹‹Š‰„|zurrtwz…‰ŒŽ‹Œ‹€jbaamwƒŒ——˜˜„}wkijjnvƒ“’’‘‹€|tmkmos~„‰Ž“‘ŽŒ„}wtpnqtw„‡‰‰„xtŒ’•’Œtqggpry„’–ŽŠ‡usqnov{~‰ŽŽ‘Œƒ€xrppor{„‰ŽŒ‹„zvppsty„†‹Œ‰ˆ…€zxtstwz}„†‰‹‹Šˆ‡ˆnebcmvƒŒ—˜˜—Ž…|vlijkov€…Ž““’‘Šƒzvmkmot{„‰’‘‹†}xspnquy€…ˆŠ‰„yvŠ‘“Š~upiirt{…’”‰…€tsqoqw|€ŠŽŽŠwrpqqt|€…ŠŒ‹Š‚}yupqtu{€…‡‹Œˆ‡ƒywtsux{„‡‰‹Šˆ†……ƒridelt}‰‘–—–“‡€wqjjkmu|„‰‘“’‹„{vokmotzƒˆŽ‘‘‹‡~ytqoquy„ˆ‰‰…{wˆ‘’Šupjiqt|…Ž’”ˆ„trqoqw}Š‰~vqpqqu}†‹Ž‹‰‚}xtpqtv|†ˆ‹Œˆ†‚~xvtstxzƒˆ‰‹‹ˆ…ƒ‚„~mgghr{‡Ž––•“‰xskjlnt{ƒˆ“’‹†|wqmloty‚‡Œ‘Š‡ztropux~ƒˆ‰ˆ…|x…‘’‘‹vqkiqs{ƒŽ‘”Š…€vsqopv|€‰Ž‹‚wrpqqt|€…ŠŽŒŠ†~zurqsuy€„‡ŠŒŠ‡…{wurswy~ƒ‡‰‹‹ˆ†ƒrkhiow„Š”–•“„zunjkmrw†Œ‘’Œˆ~ysolnsw…‹Ž‹ˆ|vsppsw|€†ˆˆ†~yƒ‘“’…xrlhnqx‹Ž’”‘Œ‡ƒxsqnnsy~„‘‡|tpporv~ˆŒŽŒˆ€|vrpqsv~‚†ŠŒ‰‡|xurruw|†ˆ‹‹‰‡„‚€‚wniiks€†••”‰}xqlkmpt~ƒŠŽ’Š{uqmmru|‚ˆ‹‰„xuqpsvz~„†‡‡€z€“’ˆ}soijpt}†””ŽŠ„~tromrw|‚‹Ž‘މ‚~uqpopu|€‡‹Š‚~xspqsu|…ˆŒŒŠˆƒ~yvsruw{€…ˆŠ‹Šˆ…ƒ€‚~rihhn{ƒ”––“ށ{tnjknqzˆ““†wsmlorx~‡Š‘Œ‰‚|vsposv{€†‡ˆ‡|А‡~tqkkru}…’“‰ƒ~urporx~‚ŠŽŽˆ~vrqqrv~‡‹Œ‹ˆ|wtpqtw}‚†ˆ‹‹ˆ†}xvssvx}†‰ŠŠˆ†ƒ…ykghiv‰“˜˜–“„}tohilow€…Œ‘•’Ž‹ysojlru~…ŒŽ’’‰‚|tronsw|ˆŠ‹‰ƒ}ƒ‹Š‡„}usppw{‡ŽŽˆ‚~{ustux}ƒ†ŠŒŠ‰‡ƒ{yustwz}ƒ†‡‰‰‡ƒ{xvutw{~ƒ†ˆˆˆ†~{yvwxy}€ƒ…‡‡†„}}‚‹…wligm{ƒŽ––•‘‹}wqkjmqt€†‹“Š‡~wrplnuyˆˆ„}xrqrrx}ƒ†‹Œ‰‡{{ƒƒ‚zy{z~€ƒ„ˆ‡„„~||zz|}~„„……ƒ€{{{{|~€€ƒ„‚‚‚€~}|z{||~€‚‚ƒ‚}|{||}€€‚‚€~~~ƒ‡ŒŽnides}Š“˜—”Ž€ypkhjpu€‡“‰„{tnmmpy‡Œ‘Ž‹‚|vsoqvy€†‹Œ‹…{xwy{|‚„…‡†…ƒ€~|{z{}‚„†…„ƒ€~|{z{|~ƒ„…„‚€~|zzz{}‚ƒ…„‚€~|zyz{~€‚ƒ„„‚}{{{|~‚„„ƒ‚€€€„‰’‰pf_^lzŒ˜Ÿž—Ž{qfabht~Œ“˜˜ˆ}tjhjmy‹‘•“‡|uomot~„Œ‘Žˆ‚zuqrx}„……‡ˆˆ†ƒ|xwyz~‚†‡‰‡ƒ€{xvwx|€„†‡†ƒ€|zxxz|€‚……„ƒ}zzz{~€‚ƒ„ƒ}|{|}‚ƒ„ƒ‚€}|{{}‚„…„ƒ‚†ug]\hy‘¦‘“‡na[\hv‹•žž‘‡vkcdlvˆ—˜‘‡zrjjry†Ž”“އ{tnmsz„‹‘‘‡}wrnpx€Š’†~upos|ƒŒŽŠ€yqorw‡‰ƒ{vrsx}…‰Š‰ƒ}wuuxƒˆˆ†‚|xvw{€…ˆˆ†}ywy{„‡‡„{yxz€ƒ‡‰‰ˆŠŒzh^]k}š₯§oZU^n‰˜€‘~g^^g}Œ›ž”ˆtjdhx„“™˜Žƒslkpˆ’”…xrps}…ŽŽ‰…}xtv|‰‹Š†~yuv{€‡Š‰…~yuuz…ˆ‡„~zxy|€ƒ„ƒ€|zz{‚„„{zz|ƒƒ}}}~€€~~€€€‚‚ƒ…ˆ†wjis–”‰tgbj}‰–—}qijv‚’‹‚uoovƒŠŽŒ‚zssyˆ‹‰„|xwy€„‡‡‚zz|ƒ†Š†{xy„ˆˆƒ€{z}……„‚}zz}€‚…„€~|{}‚}}}~€€~}}~€€~~~~€€€~~~~€€€~~~€€€€€€‚„†€vqu…‘vprzŠ‹ƒ|vw|„„}z{‚~|{}ƒƒ‚~||}ƒƒ‚~}|}€‚~|{|‚ŠŒ†{wuy…ŒŒ…{yz~†‰‡zx|€…‡„€zz}€„„~{{~‚‚}||€~}}~€€~}~€€€~~~€€~}~€€~~€‚„„}tv~ƒŠŒ‚yqt~„ˆ‡€zvx„†„~{y{€ƒƒ}||~ƒ‚€}}~€‚‚}}~€}||}}ˆ‹„xuw{ˆŽŠ‚xw|ˆ‰„~yz€ƒ†„|{}‚…ƒ}|}‚ƒ~}}~€}}~€~}}€€€~}}~€€€~}~~€€€~~~€€€€€€‚„wu{ˆ‹…}ss{‚ˆˆ{vxƒ†„~{z|„ƒ€|{|‚ƒ}}‚~}~€€}}}}~~†‹†yuuzˆŽ‹ƒxw{‰‰ƒ|yz~„‡…€{z~„„€}{}‚‚}|}‚€~|}€€~}}~€€~}~€€~~~€€~€€€€€ƒƒ|vw|…Љ‚xtx~†‰…€xx|€††~z{‚„ƒ}|~ƒƒ}~€‚‚€~~€€~}~~€†Štqw€‘ˆ€us|„Œ‹‚|wy†ˆ…{z}ƒ†„}{}€ƒ„||€ƒ‚€~}}€€€~~€€€€~~~€€€€~~€€€€€€€€€€€€€‚}yz€„‰‡€{wxƒ‡†€}yz‚……€~{|„ƒ€}}~‚ƒ€~~€~~~€~|}ƒŒˆxpnvˆ“Œ|tqvƒ‹‹€xtwˆ‹Š{wx€„‰ˆ}xy~‚††~zz}€„…‚{z|‚ƒ‚€}|}‚‚€~}}~€‚€~~€€‚€€€€€~~‚ƒ‚~}}‚‚~~~€€€€€€€€€€€€€€~}|{|ƒ’€ujkxƒ”˜’ˆxootŠ’‘†urw}†‹‹‡€{wx}†‡…‚}{z{€„„‚€}||}€‚‚€~}}~€€‚€€~}~€€€~€€€€€€€€~~~€‚‚€~~€‚‚€~~€€€€€€€€€€€~}}}}|||‚Œ––‹€ngfm€šž–Œzofht–˜“†}olnt€‰‘“†{tnov}‡ŒŽŒ„~ussu}‚ˆ‹Š†{vuu{„‡‰‡‚~ywwy~…†…„€}{z{}ƒƒ€ƒƒƒ€|{{}„……„~|{{}€ƒ„ƒƒ€~}~~€‚‚ƒ‚€€~~~~~€€}|zz€‰”–’Š|qihow…˜™”€wnlnt†“’†uqnqx~ƒŒŽ‹ƒ~vrqry~…‰ŒŒˆƒ}xtsvy€ƒ‰Š‰‡‚~ywvx|ƒ†‰ˆ…ƒ~|yyz|ƒ„ƒ‚€‚€€~}||~‚ƒ„„ƒ‚€~}}~~€‚ƒƒƒ‚€€~~}}~€‚ƒ‚€}|{zz{|~€‡’“’yojjoy€Œ’••’Š‚ztoorw€…‘‘‰ƒ|vqpru~‚‰ŒŽˆƒ}xtstv|€†‰‹‹‡„{vuuv{ƒ‡‰‰‡…€~zwvwz}„‡ˆ‡†‚€|zzzzz}‚…‡‡‡…|zyy{}€‚…‡‡…‚~|{z{|€‚ƒ……„‚€}{{{}~€€€„‰Šˆ…{vtuw}€†‰‹‹‰†~zwww{~‚…ˆ‰‰‡„}{wwy{…†ˆ‡…‚€}{yyz|‚„†††…€}{zz{}€„…†…ƒ‚~{{{|€‚„††††‚xvtty}ƒ‡‹Œ‰ƒ€zwttwy‚‡‰Š‰‡ƒ€|ywwxz…‡‰‰†„€~{yxy|~‚………„……„~|xxy{…‡ˆˆ…ƒ}zyy{}‚„††…„|{zz|~€‚………„‚€}|z{|}€ƒ„…„‚€}|||}€‚ƒƒƒ‚€}|}}€‚ƒ„„„ƒ‚ƒ‚€yvssv|ˆŒŽŽ‰…~ytrsuz…ˆ‹‹‰†€|wvtvz~ƒ‡ŠŠ‰‡‚€{ywxz}„‡ˆ‡†ƒ€~|{|}€„…‡‡…ƒ€|{{|€ƒ…††„‚€}{z{|€ƒ„…„ƒ}{{|}€€‚„„„‚€}||}}€ƒ„„ƒ€}}}~€‚ƒƒ‚€~~€€ƒ†ˆ„€xursz€‡‹Ž‰„}yssux}‡‰‹‰„{xuux|„‰Š‰†‚€{yxy}€„†ˆˆ†ƒ€~|{{{}€ƒ†ˆ‰†„€}yxz|€ƒ†ˆ‡†{zy{}€„†††ƒ€}{z{}„……„}{{|~€ƒ„…„‚€}|{{}€„„„‚~||~‚ƒƒƒ€~~~€…‡ˆ‚zwssy‡‹ŽŒ‡yursy~„‰‹Š†{wuuz~ƒ‡‰ˆ†‚}zxx|ƒ…ˆˆ…‚~|z{~€ƒƒƒƒ‚€€€€€‚‚€€€€€€€~~~€€€€€~€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ƒƒ„ƒ}zww|€‡Š‹‰‚~vtux€…‰‹‡ƒ}yvvz„‡‰‡‚zxy{€ƒ‡‡…ƒ|zz}€ƒ……„€€€€€€€‚ƒƒ€€~€‚ƒ‚€€€€€€€€€€€€€€€€€~€€€€€€€€€€€€€€€€€€€€€€€€€€€‚‚€~||}€ƒ…†„{z{}ƒ††ƒ€}{{|„…„‚€}{|~€‚„„ƒ€~}}€‚€€‚……‚€{zz}…‡‡„}zz|€ƒ‡‡…‚|z{„†…ƒ€}{{}€‚„„ƒ€}|}‚ƒ‚€€}}}€‚‚€}}~€€‚‚‚€~~€‚‚€€€€~€‚‚‚€}}€‚‚‚€~~€‚‚‚€€~€‚‚€€~€€€€€‚…‡†‚zxy|…‰Š†ƒ}zxy~†ˆˆ†~zy{}‚…‡†„}{z{„……ƒ€~{{|~ƒ„„‚€~|||€‚ƒƒ‚€}|~€‚ƒƒ‚€~~~€‚‚‚€€€€€€€€€€€€€€€€€€€‚†‡‡„€{xvx~‡ŠŠˆƒzxxz€ƒ‡‰ˆ†~zyz|€‚†‡†„€~zzz}€‚…†…ƒ€~{z{}€‚„…„ƒ€~|||~€ƒ„„‚~}}~‚ƒƒ‚€~}~€‚‚‚‚€~~}~€‚ƒƒ‚~~}~€‚‚‚€~~~€€‚€~~}}~€€ƒ†ˆˆ†ƒ}zvvy|‚†Š‹‰†~zxxz~…‡ˆ‡„‚~{yy{}€ƒ†††„|zz{~€‚„……„€}|{{}ƒ„„ƒ‚€~}||}€‚ƒ„ƒ‚~}}~€‚‚‚~€‚‚‚€€~~~€‚‚‚‚€€~~€€‚‚€€€€€€€€~~~‚…‡ˆ†„€}zxy{~€„†ˆˆ…ƒ€~{zz|~€ƒ„††…ƒ}{{{|€‚„……ƒ€~|||}€‚„„ƒ‚€€~}|}~€ƒƒƒ‚€~}}~€€‚ƒƒƒ‚€€~~~€€€‚‚‚€€€€‚‚€€€€€€€€€€€€€€€€€€‚„„„ƒ€}{{|}€€ƒ„†…„‚€}|||~€‚„„„ƒ€~||}~€€‚ƒ„ƒ‚€~}}}~€‚ƒƒ‚€~}}~~€€‚‚‚‚€€~~~€€‚‚‚‚€€€€}}|}€‚ƒ„„„ƒ€€~}||}~€‚ƒ„„‚€}}}}~€€‚ƒƒƒ‚€€~~~~€€‚ƒƒƒ‚€~~~€€‚ƒƒ‚‚€€~~€€‚‚‚‚€€~~€€‚‚‚€€€~€€€€€€€€€€€€€€€€€€€€‚€€}|||}ƒ………„€~||||~€‚„„ƒ‚€€~}|}€‚ƒƒƒ‚€~€€‚€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‚‚‚€}|||€‚„……ƒ~|{|~€ƒ„„ƒ€~}|}€‚ƒƒƒ‚€~~€‚ƒƒ‚€~~€‚ƒƒ‚€~~~€‚ƒƒ‚€€~~~€‚‚‚€€~~~€‚‚‚€€~~€€‚€€€€€€€€€€€€€€€€€€€€}}}~€ƒ„„ƒ€}||}€ƒ„ƒ‚€}}}€ƒƒ‚€~~€‚ƒƒ‚€€€€€€‚ƒ‚€€‚ƒ‚€€‚‚‚€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‚ƒ‚€~~€‚‚‚€€~~~€‚‚€€‚‚€€€€€€€€€€€‚€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‚‚€€‚‚€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‚‚€€€‚‚‚€€€‚€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‚‚‚€€€€‚‚‚€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‚‚‚€€€€‚€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ \ No newline at end of file diff --git a/source/twilight/sample/old/spiro.cc b/source/twilight/sample/old/spiro.cc new file mode 100644 index 0000000..5355f5e --- /dev/null +++ b/source/twilight/sample/old/spiro.cc @@ -0,0 +1,354 @@ + +/* +* "BallBounce" v1.0 - Sample Twilight II Module in Orca/C +* +* v1.0 - 30 May 1993 by James R. Maricondo +* = +* = +*/ + +#pragma keep "ball.d" +#pragma optimize -1 +#pragma cdev BallBounce +#include "ball.h" +#pragma lint -1 + +/* Strings */ + +char toT2String[]=toT2Str; +char ImageDelayStr[]="\pSpiro: ImageDelay"; +char SmallPenStr[]="\pSpiro: SmallPen"; + +/* Prototypes */ + + extern int random(void); + extern void set_random_seed(void); + extern void init_random(char *); + + LongWord MakeT2Message(void); + void LoadSetupT2Message(void); + void SaveConfigResource(char *, word); + word LoadConfigResource(char *, word); + LongWord HitT2Message(LongWord); + LongWord BlankT2Message(void); + void SaveT2Message(void); + +/* Global Variables */ + +Word *movePtr; +Word ImageDelay; /* Image delay */ +Word SmallPen; /* Force small pen size? */ + +Word SetupFileNumber; +GrafPortPtr SetupWindow; + +/*------ SPIROGRAPHICS main drawing control routine ------*/ + +LongWord BlankT2Message (void) { + + extended vertex_angle, rotation_angle; + unsigned int shapes, sides; + Word startSane, MyID; + Long TargetTick; + + struct startupToolsOut spiroToolsOut; + Ptr spiroToolsOutP = (Ptr) &spiroToolsOut; + + MyID = MMStartUp(); + + startSane = SANEStatus(); + if (!startSane) { + SendRequest(t2StartupTools, stopAfterOne+sendToName, (long) toT2String, + (long) (((long) MyID<<16) + startshut_sane), + (Ptr) spiroToolsOutP); + if (spiroToolsOut.errors) + return (LongWord) NULL; + } + + SetPenMode(modeCopy); + SetSolidPenPat(-1); + SetPenSize(1,1); + init_random(toT2String); + +/* +* vertex_angle and rotation_angle can be any number in the range 1 thru 359 +* repetitions should be between 10-45 +* sides should be between 1-40 +* the fewer sides, the fewer repetitions should be executed <- unimplemented +*/ + + while (!(*movePtr)) { + vertex_angle = (int) (random() & 31); /*32(cur),<<23>>,25,35,45,60*/ + rotation_angle = (int) (random() % 38); /*40,50,70,80*/ + shapes = (random() & 31) + 14; /*31-45(cur),35-45,25-47,30-45,30-50*/ + sides = (random() & 15); /*16(cur),18,25,40*/ + + if (vertex_angle > 23) + vertex_angle = 0; + +/* +* Now the variables have whole numbers. This is acceptable, but it will +* prevent us from seeing many unique shapes (like a triangle, where +* vertex_angle must be ~ 1.5) that only can be generated with radians with +* decimals. So give both randomized radian measures decimals, by adding +* a random number between 0 and 1. +*/ + + vertex_angle += ((unsigned int) random() / 65534.9); + rotation_angle += ((unsigned int) random() / 65534.9); + + if (draw_spirographic(vertex_angle, rotation_angle, shapes, sides)) + break; + + TargetTick = GetTick () + (ImageDelay * 60); + while ((!(*movePtr)) && (GetTick () < TargetTick)); + if (*movePtr) + break; + + ClearScreen(0); + } + + if (!startSane) + SendRequest(t2ShutdownTools, stopAfterOne+sendToName, (long) toT2String, + (long) startshut_sane, + (long) NULL); + +/* No error occurred, so return a NULL handle */ + + return (LongWord) NULL; +} + +/*****************************************************************************\ +|* SaveConfigResource- +|* This function takes a word value and saves it as a rT2ModuleWord +|* resource in the Twilight.Setup file. The value is saved and a *| +|* name is added. Any previous rT2ModuleWord with the same name is +|* first removed before the new value is added. +\*****************************************************************************/ + +void SaveConfigResource (char *Name, Word SaveValue) { + + Word FileID; + Long ResourceID; + Word **ConfigData; + +/* Check to see if the named resource already exists */ + + ResourceID = RMFindNamedResource (rT2ModuleWord, Name, &FileID); + if (!toolerror ()) + { + char NullString = '\x000'; + +/* The resource already exists, so first remove the name from */ +/* the resource, then remove the resource itself */ + + RMSetResourceName (rT2ModuleWord, ResourceID, &NullString); + RemoveResource (rT2ModuleWord, ResourceID); + } + +/* Create new handle for the future resource */ + + ConfigData = + (Word **) NewHandle (sizeof (Word), GetCurResourceApp(), attrLocked, 0L); + **ConfigData = SaveValue; + +/* Find a new ID for the resource and add it */ + + ResourceID = UniqueResourceID (0, rT2ModuleWord); + AddResource ((handle) ConfigData, 0, rT2ModuleWord, ResourceID); + if (toolerror ()) + DisposeHandle ((handle) ConfigData); + else + { + +/* Set the name of the resource if it was added correctly */ + + RMSetResourceName (rT2ModuleWord, ResourceID, Name); + UpdateResourceFile (SetupFileNumber); + } +} + + +/*****************************************************************************\ +|* LoadConfigResource- *| +|* This function attempts to load a named rT2ModuleWord resource. If *| +|* the resource exists, the value of the rT2ModuleWord resource is *| +|* returned, otherwise a default value is returned. *| +\*****************************************************************************/ + +Word LoadConfigResource (char *Name, Word DefaultValue) { + + Word Result, fileID; + Long rID; + Handle ConfigData; + +/**************************************/ +/* Attempt to load the named resource */ +/**************************************/ + + rID = RMFindNamedResource((Word) rT2ModuleWord, (Ptr) Name, &fileID); + + ConfigData = LoadResource((Word) rT2ModuleWord, rID); + if (toolerror ()) + Result = DefaultValue; /* Resource does not exist, so return the default value */ + else { + HLock(ConfigData); /* Resource exists, return the rT2Module word value */ + Result = **(word **)ConfigData; + HUnlock(ConfigData); + + ReleaseResource(3, (Word) rT2ModuleWord, rID); + } + + return Result; +} + + +/*****************************************************************************\ +|* LoadSetupT2Message- *| +|* This function loads in the messages configuration data. *| +\*****************************************************************************/ + +void LoadSetupT2Message(void) { + + ImageDelay = LoadConfigResource (ImageDelayStr, 7u); + SmallPen = LoadConfigResource (SmallPenStr, FALSE); +} + + +/*****************************************************************************\ +|* MakeT2Message- *| +|* This function creates the controls for the messages setup window *| +|* and sets the value of the controls the the current setup. *| +\*****************************************************************************/ + +LongWord MakeT2Message(void) { + + int i; + Word FileNumber; + + pointer *extraInfoH; + handle df_rez_ctlH; + handle df_ctlH; + +/* Save current resource file and switch in Twilight.Setup */ + + FileNumber = GetCurResourceFile (); + SetCurResourceFile (SetupFileNumber); + +/* Make absolutely sure that the messages configuration data is loaded */ + + LoadSetupT2Message (); + +/* Restore old resource file */ + + SetCurResourceFile (FileNumber); + +/* Create setup controls and set their states to match current setup */ + + NewControl2 (SetupWindow, resourceToResource, MainControlList); + + df_rez_ctlH = LoadResource (rControlTemplate, imageDelayCtl_rID); + extraInfoH = (pointer *) GetWRefCon( (GrafPortPtr) SetupWindow); + (long) (*df_rez_ctlH)[14] = (long) *extraInfoH; + df_ctlH = (handle) NewControl2((WindowPtr) SetupWindow, singlePtr, (long) *df_rez_ctlH); + ReleaseResource (3, rControlTemplate, imageDelayCtl_rID); + MakeThisCtlTarget ((CtlRecHndl) df_ctlH); + + CallCtlDefProc ((CtlRecHndl) df_ctlH, (word) SetFieldValue, (((long)ImageDelay<<16)+34ul)); + SetCtlValue (SmallPen, GetCtlHandleFromID (SetupWindow, forceSmallPenCtl)); + +/* Return the number of the last control */ + + return LastCtl; +} + + +/*****************************************************************************\ +|* HitT2Message- +|* This function checks to see which control has been hit, and if a +|* control that requires the "Update" button has been hit, the +|* EnableFlag is set to true. +\*****************************************************************************/ + +LongWord HitT2Message (LongWord ControlHit) { + +/* LongWord EnableFlag = 0L;*/ + + if ((ControlHit == imageDelayCtl) || (ControlHit == forceSmallPenCtl)) + return 1L; +/* EnableFlag = 1L;*/ + else + return 0L; + +/* Return the update button enable flag */ + +/* return EnableFlag;*/ +} + + +/*****************************************************************************\ +|* SaveT2Message- +|* This function saves the values of all setup controls. +\*****************************************************************************/ + +void SaveT2Message (void) { + + Word FileNumber; + +/* Save current resource file and switch in Twilight.Setup */ + + FileNumber = GetCurResourceFile (); + SetCurResourceFile (SetupFileNumber); + +/* Save control values */ + + ImageDelay = (unsigned int) CallCtlDefProc (GetCtlHandleFromID (SetupWindow, + imageDelayCtl), GetFieldValue, 34ul); + + SaveConfigResource (ImageDelayStr, ImageDelay); + SmallPen = GetCtlValue (GetCtlHandleFromID (SetupWindow, forceSmallPenCtl)); + SaveConfigResource (SmallPenStr, SmallPen); + +/* Restore old resource file */ + + SetCurResourceFile (FileNumber); +} + +/*****************************************************************************\ +|* BallBounce- +|* This function checks the Twilight II message parameter and *| +|* dispatches control to the appropriate message handler. *| +\*****************************************************************************/ + +LongWord BallBounce (LongWord data2, LongWord data1, Word message) { + + LongWord Result = 1L; + + switch (message) + { + case MakeT2: +/* Save pointer to setup window and resource file number of Twilight.Setup */ + SetupWindow = (GrafPortPtr) data1; + SetupFileNumber = (Word) data2; +/* Create the setup controls */ + Result = MakeT2Message(); + break; + case SaveT2: + SaveT2Message(); + break; + case BlankT2: + movePtr=(Word *) data1; + Result = BlankT2Message(); + break; + case LoadSetupT2: + LoadSetupT2Message(); + case UnloadSetupT2: + case KillT2: + break; + case HitT2: + Result = HitT2Message(data2); + break; + } + + return Result; +} \ No newline at end of file diff --git a/source/twilight/sample/old/spiro.h b/source/twilight/sample/old/spiro.h new file mode 100644 index 0000000..849885a --- /dev/null +++ b/source/twilight/sample/old/spiro.h @@ -0,0 +1,46 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "22:t2.h" + +#define MAX_X 640 +#define MAX_Y 200 +#define CENTER_Y MAX_Y/2 +#define CENTER_X MAX_X/2 +/* Aspect ratio = 1.27 for 320 mode for standard displays + 2.54 for 640 mode for standard displays + 2.10 for 640 mode for Jim's condensed-type display */ +#define SCALE_X 2.10 +#define PI 3.141592653589793 + +/* resource IDs */ + +#define imageDelayCtl_rID 1L +#define forceSmallPenCtl_rID 2L +#define imageDelayStatTextCtl_rID 3L +#define spiroOptsStatTextCtl_rID 4L +#define iconCtl_rID 5L + +#define MainControlList 1L + +/* Control IDs */ + +#define forceSmallPenCtl 1L +#define imageDelayTxtCtl 2L +#define iconCtl 3L +#define imageDelayCtl 4L + +#define LastCtl imageDelayCtl + + \ No newline at end of file diff --git a/source/twilight/sample/old/spiro.rez b/source/twilight/sample/old/spiro.rez new file mode 100644 index 0000000..bfdff03 --- /dev/null +++ b/source/twilight/sample/old/spiro.rez @@ -0,0 +1,226 @@ + +#include "types.rez" +#include "22:T2Common.Rez" + +// --- type rDataList ($1986) defines +#define imageDelayDataList 1 +// --- type rTaggedStrings ($802E) defines +#define field1Strings 1 +// --- type $8003 defines +#define spiroCtlLst 1 +// --- type $8004 defines +#define imageDelayCtl 1 +#define forceSmallPenCtl 2 +#define imageDelayStatTextCtl 3 +#define spiroOptsStatTextCtl 4 +#define iconCtl 5 +// --- type $8006 defines +#define forceSmallPen_pstr 2 +#define spiroOpts_pstr 3 +// --- type $800B defines +#define imageDelay_LText 1 + + +// --- custom resource type defines + +resource rT2ModuleFlags (moduleFlags) { + fSetup + + fFadeOut + + fFadeIn + + fLeavesUsableScreen + + fGrafPort640, // module flags + $01, // enabled flag (unimplemented) + $0110, // minimum T2 version required + NIL, // reserved + "Spirographics" // module name +}; + +// --- Icon Definitions + +resource rIcon (moduleIcon) { + $8000, // kind + $0014, // height + $0016, // width + + $"F00000000000000000000F" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0F0000000EEE00000000F0" + $"0F000000E000E0000000F0" + $"0F00000E00E00E000000F0" + $"0F0000E00E0E0E0D0000F0" + $"0F0000E0E00B0E0E0000F0" + $"0F0000E0E0000E0E0000F0" + $"0F0000E00E00E00E0000F0" + $"0F00000E00EE00E00000F0" + $"0F000000E0000E000000F0" + $"0F0000000EEEE0000000F0" + $"0FFFFFFFFFFFFFFFFAFFF0" + $"0000000000000000000000" + $"F0FFFFFFFFFFFFFFFFFF0F" + $"F0FFFFFFFFFFFFFFFFFF0F" + $"F0FF4AFFFFFFFFFFFFFF0F" + $"F0CCCCCCCCCCCCCCCCCC0F" + $"F0FFFFFFFFFFFFFFFAFF0F" + $"F00000000000000000000F", + + $"0FFFFFFFFFFFFFFFFFFFF0" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFFFFFFFFFFFF" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0" + $"0FFFFFFFFFFFFFFFFFFFF0"; +}; + +// --- Control List Definitions + +resource rControlList (spiroCtlLst) { + { + iconCtl, // control 3 + imageDelayStatTextCtl, // control 5 + forceSmallPenCtl, // control 6 + }; +}; + +// --- Control Templates + +resource rControlTemplate (forceSmallPenCtl) { + 1, // ID + { 92, 14,101,232}, // rect + checkControl {{ + $0000, // flag + $3002, // moreFlags + $00000000, // refCon + forceSmallPen_pstr, // titleRef + $0000, // initialValue + 0, // colorTableRef + {"F","f",$0100,$0100} // key equivalents + }}; +}; + +resource rControlTemplate (imageDelayStatTextCtl) { + 2, // ID + { 77, 12, 87,249}, // rect + statTextControl {{ + $0000, // flag + $1002, // moreFlags + $00000000, // refCon + imageDelay_LText // textRef + }}; +}; + +resource rControlTemplate (iconCtl) { + 3, // ID + { 30, 58, 63,286}, // rect + iconButtonControl {{ + $000C, // flag + $1022, // moreFlags + NIL, // refCon + moduleIcon, // iconRef + spiroOpts_pstr, // titleRef + NIL, // colorTableRef + $0000 // displayMode + }}; +}; + +resource rControlTemplate (imageDelayCtl,locked) { + 4, // control ID + { 75,250, 88,302}, // rect - 306 + dataFieldControl {{ + ctlVisible, // flag + fCtlCanBeTarget+RefIsResource, + NIL, // refCon + imageDelayDataList, // dataListRef + {0,0,0,0,0,0,0,0} // fieldValues + }}; +}; + +// --- rPString Templates + +resource rPString (forceSmallPen_pstr) { + "Force Small Pen Size" +}; + +resource rPString (spiroOpts_pstr) { + "Spirographics Options" +}; + +// --- rTextForLETextBox2 Templates + +resource rTextForLETextBox2 (imageDelay_LText) { + "Delay between images (seconds):" +}; + +resource rTextForLETextBox2 (moduleMessage) { + TBLeftJust + TBBackColor TBColorF + TBForeColor TBColor4 + "Spirographics" + TBForeColor TBColor1 + " generates intriguing progressive geometric " + "figures randomly on the screen.\nWho said geometry was boring?" +}; + +// --- datafield stuff + +/* This structure describes the relative locations and strings associated with + each data field. Since there may be from 1 to 8 data fields in each control, + these location/string reference pairs repeat for each field. */ + +resource rDataList (imageDelayDataList, nospecialmemory,nocrossbank) { + { + {2,6}, // relative location of this field + field1Strings // reference to this field's string list + }; +}; + +/* These are the tagged strings that are associated with each field in the + control. The tag value that is specified is used to track the current value + of each field. If you wish only to have a list of integers displayed, simply + provide the tag values and null (empty) strings as in the second field. */ + +resource rTaggedStrings (field1Strings) { + { + 0,"0", + 1,"1", + 2,"2", + 3,"3", + 4,"4", + 5,"5", + 6,"6", + 7,"7", + 8,"8", + 9,"9", + 10,"10", + 15,"15", + 20,"20", + 25,"25", + 30,"30", + 45,"45", + 60,"60", + 120,"120" + }; +}; + +// --- rVersion Templates + +resource rVersion (moduleVersion) { + {1,0,0,release,0}, // Version + verUS, // US Version + "T2 Spirographics Module", // program's name + "By Jim Maricondo.\n" + "Copyright 1992-93, Jim Maricondo." // copyright notice +}; diff --git a/source/twilight/sample/rSound.bin b/source/twilight/sample/rSound.bin new file mode 100644 index 0000000..fb16c1d Binary files /dev/null and b/source/twilight/sample/rSound.bin differ diff --git a/source/twilight/sample/t2.h b/source/twilight/sample/t2.h new file mode 100644 index 0000000..0789ce5 --- /dev/null +++ b/source/twilight/sample/t2.h @@ -0,0 +1,142 @@ + +/******************************************** +* File: T2.h +* +* v1.0 - Josef W. Wankerl - 8 June 1992 +* v1.0a - Jim R. Maricondo - 23 December 1992 +* v1.0.1 - Jim R. Maricondo - 3 January 1993 +* v1.0.2 - Jim R. Maricondo and James C. Smith - 9 January 1993 +* v1.0.3 - Jim R. Maricondo - 31 January 1993 (bf) +* v1.0.4 - JRM - 03 Feb 1993 *ROJAC '93* - new ipc stuff +* v1.0.5 - JRM - 28 Feb 1993 *AFS_NYC!* - new blank_screen getbuffers.. +* v1.0.6 - JRM - 03 Mar 1993 - new bmr and lmr, getinfo rec +* v1.0.7 - JRM - 06 Mar 1993 - (bmi/lmi/etc) +* v1.0.8 - JRM - 01 Apr 1993 - mcp lmr +* v1.0.9 - JRM - 31 May 1993 - new mr/mi for public release +* v1.1 - JRM - 19 Jul 1993 - released to the public at KFest '93 +* v1.1.1 - JRM - 08 Jul 1994 - new structure: freqOffsetOut +* +********************************************/ + +#ifndef __TYPES__ +#include +#endif + +#ifndef __T2__ +#define __T2__ + +#define toT2Str "\pDYA~Twilight II~" + +/* Action message codes sent to modules. */ +#define MakeT2 0 +#define SaveT2 1 +#define BlankT2 2 +#define LoadSetupT2 3 +#define UnloadSetupT2 4 +#define KillT2 5 +#define HitT2 6 + +/* Resources types. */ +#define rT2ModuleFlags 0x1000u +#define rT2ExtSetup1 0x1001u +#define rT2ModuleWord 0x1002u + +/* DataField equates. */ +#define SetFieldValue 0x8000u /* custom control messages that are */ +#define GetFieldValue 0x8001u /* accepted by DataField */ + +/* DataOut structure for t2StartupTools */ +typedef struct startupToolsOut { + Word recvCount; + Word errors; /* returned errors */ +}; + +/* DataOut structure for t2CalcFreqOffset */ +typedef struct freqOffsetOut { + Word recvCount; + Word freqOffset; /* returned converted frequency */ +}; + +/* t2StartupTools flag bits */ +#define startshut_sane 1ul +#define startshut_sound 2ul + +/* DataOut structure for t2GetBuffers */ +typedef struct getBuffersOut { + Word recvCount; + void ** shr_main_bufferH; /* handle to bank E1 buffer */ + void ** shr_aux_bufferH; /* handle to bank 01 buffer */ + void ** palette_bufferH; /* handle to palette buffer */ +}; + +/* this is wrigged to always return ALL info available */ +/* to make it easier for C */ + +typedef struct getInfoOut { + Word recvCount; + Word start_offset; /* -- $0 -- copy from this byte of the buffer */ + Word end_offset; /* -- $E -- to this byte of the buffer */ + Word state_word; /* state word */ + Word count_selected_modules; /* # selected modules */ + Word tii_version; /* version of T2 in Toolbox TN 100 format */ + void * noblank_cursor320P; /* pointers to noblank cursors */ + void * noblank_cursor640P; +}; + +/* +* t2GetInfo - +* dataIn: reserved (pass zero) +* dataOut: pointer to structure +* +00 - word output - count +* +02 - word input - start buffer offset (FROM this byte) +* +04 - word input - end buffer offset (TO this byte) +* (end buffer offset minus start buffer offset = SIZE) +* +06 - byte array output - returned information output buffer +* +06+SIZE - eos - end of structure +* +* Buffer information available (`-`=through) +* 00,01= state word +* 02,03= number of modules selected in random mode (1 if rm off) +* 04,05= version of Twilight II +* 06,07,08,09= pointer to 320 mode don't blank cursor +* 0a,0b,0c,0d= pointer to 640 mode don't blank cursor +*/ + +/* T2 External IPC */ +#define t2TurnOn 0x9000u +#define t2TurnOff 0x9001u +#define t2BoxOverrideOff 0x9002u +#define t2BoxOverrideOn 0x9003u +#define t2GetInfo 0x9004u +#define t2StartupTools 0x9005u +#define t2ShutdownTools 0x9006u +#define t2ShareMemory 0x9007u +#define t2SetBlinkProc 0x9008u +#define t2ForceBkgBlank 0x9009u +#define t2BkgBlankNow 0x900Au +#define t2GetBuffers 0x900Bu +#define t2Reserved1 0x900Cu +#define t2CalcFreqOffset 0x900Du + +/* bits of BlankT2's T2Result [blankMessageResult] */ +#define bmrNextModule 0x01000000ul /* goto next module */ +#define bmrFadeIn 0x02000000ul /* fade in after all */ +#define bmrLeavesUsableScreen 0x04000000ul /* leaves usable screen */ +#define bmrLeavesCycleScreen 0x08000000ul /* leaves cycle-able screen */ + +/* bits of LoadSetupT2's T2Result [loadMessageResult] */ +#define lmrReqUsableScreen 0x0001ul /* requires usable screen */ +#define lmrFadeOut 0x0002ul /* fade out after all */ +#define lmrMostCommonPalette 0x0004ul /* mcp after all */ +#define lmrPrematureExit 0x0008ul /* exits before movePtr=true */ + +/* Bits of flag word passed to modules at loadsetupT2 time in T2data2 (lo) */ +/* lmi = loadmessageinput */ +#define lmiOverrideSound 0x0001u /* bit0- 1=override sound, 0=sound ok */ + +/* bits of flag word passed to mdoules at blankT2 time in T2Data2 (lo) */ +/* (bmi = blankMessageInput) */ +#define bmiBlankNow 0x0001u /* bit0- 1=from blank now, 0= not */ +#define bmiCycleColors 0x0002u /* prev mdl left cycle-able screen */ + +#endif /* __T2__ */ \ No newline at end of file diff --git a/source/twilight/sample/t2common.equ b/source/twilight/sample/t2common.equ new file mode 100644 index 0000000..e93fe68 --- /dev/null +++ b/source/twilight/sample/t2common.equ @@ -0,0 +1,116 @@ + + +* T2 Common Module Equates. By Jim Maricondo. +* Copyright DigiSoft Innovations 1993, All rights reserved. +* v1.0 - 05/24/92 - Initial Version. +* v1.1 - 05/29/92 - Revised 'cuz of new t2common.rez. - T2 v1.0d33 +* v1.2 - 10/24/92 - IPC equates added - T2 v1.0.1b1. - datafield added +* v1.3 - 12/13/92 - mfOverrideSound added - T2 v1.0.1b2 +* v1.4 - 01/31/93 - bf bits added. - T2 v1.0.1f2. +* v1.5 - 02/03/93 - (ROJAC!!) new IPC revised - T2 v1.0.1f2 +* v1.6 - 02/07/93 - $D001 - T2 v1.0.1f2 +* v1.7 - 03/02/93 - bmr, lmr, etc - T2 v1.1f3 +* v1.7a - 03/06/93 - bmi, lmi, etc - T2 v1.1f3 +* v1.7c - 03/28/93 - bytearray - T2 v1.1f5 +* v1.8d - 04/01/93 - mcp lmr - T2 v1.1f5 +* v1.8e - 05/31/93 - new mr/mi - T2 v1.1 release + +* Resources types. + +rT2ModuleFlags gequ $D001 +rT2ExtSetup1 gequ $1001 +rT2ModuleWord gequ $1002 ; reztype for module words in T2 setup +rT2String gequ $1010 ; used only by T2! +rByteArray gequ $1012 + +* Action message codes sent to modules. + +MakeT2 gequ 0 ; Make module-specific ctls. +SaveT2 gequ 1 ; Save new preferences +BlankT2 gequ 2 ; Blank the screen. +LoadSetupT2 gequ 3 ; Load any resources from yo' fork +UnloadSetupT2 gequ 4 ; Dispose of any resources from yo' fk. +KillT2 gequ 5 ; Module setup being closed. +HitT2 gequ 6 ; Setup window control hit. + +* How the stack is setup when a module gets called. + +dp gequ 1 ; This is how the stack is set up +Bank gequ dp+2 ; with DP at the top and Result +rtlAddr gequ Bank+1 ; occuping the top 4 bytes +T2data2 gequ rtlAddr+3 +T2data1 gequ T2data2+4 +T2Message gequ T2data1+4 +T2Result gequ T2Message+2 +T2StackSize gequ T2Result+4 + +* Softswitches + +KBD gequ >$E0C000 +KBDSTRB gequ >$E0C010 +RDVBLBAR gequ >$E0C019 ; bit 7 = 1 if not VBL +TBCOLOR gequ >$E0C022 +KEYMODREG gequ >$E0C025 ; keyboard modifier register +NEWVIDEO gequ >$E0C029 +VERTCNT gequ >$E0C02E +SPKR gequ >$E0C030 +CLOCKCTL gequ >$E0C034 ; border color / rtc register +SHADOW gequ >$E0C035 +INCBUSYFLG gequ >$E10064 ; increment busy flag +DECBUSYFLG gequ >$E10068 ; decrement busy flag +SHR gequ >$E12000 +SCBS gequ >$E19D00 +PALETTES gequ >$E19E00 + +* Boolean logic + +FALSE gequ 0 +TRUE gequ 1 + +* T2 External IPC + +t2TurnOn gequ $9000 +t2TurnOff gequ $9001 +t2BoxOverrideOff gequ $9002 +t2BoxOverrideOn gequ $9003 +t2GetInfo gequ $9004 +t2StartupTools gequ $9005 +t2ShutdownTools gequ $9006 +t2ShareMemory gequ $9007 +t2SetBlinkProc gequ $9008 +t2ForceBkgBlank gequ $9009 +t2BkgBlankNow gequ $900A +t2GetBuffers gequ $900B +t2Reserved1 gequ $900C ; was t2GetVersion +t2CalcFreqOffset gequ $900D + +* T2 Private IPC + +reqDLZSS gequ $8007 +t2PrivGetProcs gequ $9020 + +* DataField equates. + +SetFieldValue gequ $8000 ;custom control messages that are +GetFieldValue gequ $8001 ; accepted by DataField + +* Flag word passed to modules at loadsetupT2 time in T2data2 (lo) +* (lmi = loadMessageInput) +lmiOverrideSound gequ $0001 ; bit 0. 1=override sound, 0=sound ok + +* Flag word passed to mdoules at blankT2 time in T2Data2 (lo) +* (bmi = blankMessageInput) +bmiBlankNow gequ $0001 +bmiCycleColors gequ $0002 ; prev module left color cycle-able scrn + +* bits of BlankT2's T2Result - _hi_ word (blankmessageresult) +bmrNextModule gequ $0100 +bmrFadeIn gequ $0200 +bmrLeavesUsableScreen gequ $0400 +bmrLeavesCycleScreen gequ $0800 ; left color cycle-able screen after all + +* bits of LoadSetupT2's T2Result - lo word (loadmessageresult) +lmrReqUsableScreen gequ $0001 ; requires usable screen +lmrFadeOut gequ $0002 ; fade out after all +lmrMostCommonPalette gequ $0004 ; mcp after all +lmrPrematureExit gequ $0008 ; exits before movePtr=true diff --git a/source/twilight/sample/t2common.rez b/source/twilight/sample/t2common.rez new file mode 100644 index 0000000..24344dc --- /dev/null +++ b/source/twilight/sample/t2common.rez @@ -0,0 +1,91 @@ + +// ===================================================== +// T2 Common Module Resources. +// Copyright 1992-93 Jim Maricondo and DigiSoft Innovations. +// +// v1.0 - 05/24/92 - Initial Version. +// v1.1 - 05/29/92 - Cleaned up, revised module flags. - T2 v1.0d33 +// v1.2 - 06/11/92 - Added fOpenRForkWriteEnabled - T2 v1.0d34 +// v1.3 - 09/18/92 - v1.1 about string - T2 v1.0d37 +// v1.4 - 11/28/92 - DC -> DSI - T2 v1.0.1b1 +// v1.5 - 1/2/93 - Misc cleanup - T2 v1.0.1b3 (?) +// v1.5a - 1/9/93 - Changed comments - T2 v1.0.1b4 +// v1.6 - 1/28/93 - Revised for _NEW_ rT2ModuleFlags format. - T2 v1.0.1f1 +// v1.7 - 2/7/93 - "f" flag word names, $D001 - T2 v1.0.1f2 +// v1.7a - 2/16/93 - $1000 -> $D001 - T2 v1.0.1f2 +// v1.8 - 03/02/93 - new moduleflagword bits - T2 v1.1f3 +// v1.9 - 03/28/93 - mostcommonpalette - t2 v1.1f4 +// v2.0 - 06/19/93 - fixed up for release at KFest '93 +// ===================================================== + +// ===================================================== +// Module resource IDs. +// ===================================================== + +/***** Required *****/ +// #define moduleName $00000001 +#define moduleMessage $0010DD01 +#define moduleIcon $0010DD01 +#define moduleVersion $00000001 +#define moduleFlags $00000001 + +/***** Added for you... *****/ +#define moduleComment $00000001 +#define moduleInfo $00000002 + +// ===================================================== +// --- custom resource type defines +// ===================================================== +#define rT2ModuleFlags $D001 +#define rT2ExtSetup1 $1001 +#define rT2ModuleWord $1002 +#define rT2String $1010 // reserved for use by tii only! +#define rByteArray $1012 + + +// ===================================================== +// Defined bits of T2ModuleFlags module flag word. +// ===================================================== +#define fSetup $0001 +#define fFadeOut $0002 +#define fFadeIn $0004 +#define fGrafPort320 $0008 +#define fGrafPort640 $0010 +#define fLoadSetupBoot $0020 +#define fLoadSetupBlank $0040 +#define fOpenRForkWriteEnabled $0080 +#define fMostCommonPalette $0100 +#define fReqUsableScreen $0200 +#define fLeavesUsableScreen $0400 +#define fLeavesCycleScreen $0800 +#define fPrematureExit $1000 +#define fForeground $0000 +#define fBackground $4000 +#define fInternal $8000 + +// ===================================================== +// Custom resource type defines. +// ===================================================== +type rT2ModuleFlags { + byte = $01; /* module flags version - use 1 */ + hex unsigned word; /* module flags word */ + byte; /* enabled flag (unimplemented) - use 1 now */ + hex unsigned word; /* minimum T2 version required */ + hex unsigned word; /* reserved */ + pstring[25]; /* module name */ +}; + +type rT2ModuleWord { + unsigned word; +}; + +// ===================================================== +// Current common comments. +// ===================================================== + +resource rComment (moduleInfo) { + "This is a Twilight II\$AA screen saver module. " + "Place in the \$D2Twilight\$D3 module folder (located in the same directory " + "as the Twilight II control panel) and access via Twilight II!\n" + "For more information, refer to the Twilight II manual." +}; diff --git a/source/twilight/sample/tii.G2MF.jun14 b/source/twilight/sample/tii.G2MF.jun14 new file mode 100644 index 0000000..009d522 Binary files /dev/null and b/source/twilight/sample/tii.G2MF.jun14 differ