TempleOSCDV5.00.ISO
This commit is contained in:
1 parent
122df6338e
commit
f6eacf7744
374 files changed
+11078
-11204
No files matched your search
Binary file not shown.
@@ -1,194 +0,0 @@
|
||||
I64 num_people=100;
|
||||
|
||||
U0 SongTask(I64)
|
||||
{//Song by the Holy Spirit
|
||||
Fs->task_end_cb=&SndTaskEndCB;
|
||||
MusicSettingsRst;
|
||||
while (TRUE) {
|
||||
Play("3eGFqGetBEFeBEEFetBDCeCFqF");
|
||||
Play("eGFqGetBEFeBEEFetBDCeCFqF");
|
||||
Play("AetDAAqBDeBEqEetECDGBG");
|
||||
Play("qAetDAAqBDeBEqEetECDGBG");
|
||||
}
|
||||
}
|
||||
|
||||
U0 HoldCourt()
|
||||
{
|
||||
I64 accused,crime,victim;
|
||||
Bool old_form=LBts(&(DocPut)->flags,DOCf_FORM);
|
||||
|
||||
DocDblBufStart;
|
||||
'\n';
|
||||
accused=RandU32%3;
|
||||
"%s",LstSub(accused,
|
||||
"A man \0A woman \0A child \0");
|
||||
|
||||
crime=RandU32&3;
|
||||
"%s",LstSub(crime,
|
||||
"commits murder\0commits adultery\0"
|
||||
"commits blasphemy\0commits idolatry\0");
|
||||
|
||||
if (crime<=1) {
|
||||
'' CH_SPACE;
|
||||
victim=RandU32%3;
|
||||
"%s",LstSub(victim,"to a man\0to a woman\0to a child\0to an animal\0");
|
||||
}
|
||||
if (!(RandU32%5))
|
||||
", again!";
|
||||
else
|
||||
'.';
|
||||
"\n\n\n\n"
|
||||
"$$LM,4$$"
|
||||
"\n\n$$BT,\"Show Mercy\",LE=0$$\n\n"
|
||||
"\n\n$$BT,\"Punish\",LE=1$$\n\n"
|
||||
"\n\n$$BT,\"Really Punish\",LE=2$$\n\n"
|
||||
"$$LM,0$$";
|
||||
DocDblBufEnd;
|
||||
DocMenu(DocPut);
|
||||
|
||||
LBEqu(&(DocPut)->flags,DOCf_FORM,old_form);
|
||||
DocBottom;
|
||||
}
|
||||
|
||||
#define T_BREAK_CAMP 0
|
||||
#define T_TALK_WITH_GOD 1
|
||||
#define T_VIEW_CLOUDS 2
|
||||
#define T_HOLD_COURT 3
|
||||
#define T_VIEW_MAP 4
|
||||
#define T_WATER_ROCK 5
|
||||
#define T_BATTLE 6
|
||||
#define T_QUAIL 7
|
||||
#define T_MOSES_COMICS 8
|
||||
#define T_HELP 9
|
||||
#define T_QUIT 10
|
||||
|
||||
Bool TakeTurn()
|
||||
{
|
||||
I64 i;
|
||||
Bool res,old_form=LBts(&(DocPut)->flags,DOCf_FORM);
|
||||
num_people*=1.0+0.01*((RandU16%100)-30);
|
||||
if (num_people>MAX_PEOPLE)
|
||||
num_people=MAX_PEOPLE;
|
||||
|
||||
if (!Fs->song_task)
|
||||
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
|
||||
Camp(num_people);
|
||||
Kill(Fs->song_task);
|
||||
|
||||
DocDblBufStart;
|
||||
"$$LM,4$$"
|
||||
"\n\n$$BT,\"Break Camp\",LE=T_BREAK_CAMP$$\n\n"
|
||||
"\n\n$$BT,\"Talk with God\",LE=T_TALK_WITH_GOD$$\n\n"
|
||||
"\n\n$$BT,\"View Clouds\",LE=T_VIEW_CLOUDS$$\n\n"
|
||||
"\n\n$$BT,\"Hold Court\",LE=T_HOLD_COURT$$\n\n"
|
||||
"\n\n$$BT,\"View Map\",LE=T_VIEW_MAP$$\n\n"
|
||||
"\n\n$$BT,\"Make Water\",LE=T_WATER_ROCK$$\n\n"
|
||||
"\n\n$$BT,\"Battle\",LE=T_BATTLE$$\n\n"
|
||||
"\n\n$$BT,\"Beg for Meat\",LE=T_QUAIL$$\n\n"
|
||||
"\n\n$$BT,\"Moses Comics\",LE=T_MOSES_COMICS$$\n\n"
|
||||
"\n\n$$BT,\"Help\",LE=T_HELP$$\n\n"
|
||||
"\n\n$$BT,\"Quit\",LE=T_QUIT$$\n\n"
|
||||
"$$LM,0$$";
|
||||
DocDblBufEnd;
|
||||
i=DocMenu(DocPut,DOF_DONT_TEXT_ATTR);
|
||||
|
||||
LBEqu(&(DocPut)->flags,DOCf_FORM,old_form);
|
||||
DocBottom;
|
||||
|
||||
if (!(0<=i<T_QUIT))
|
||||
res=FALSE;
|
||||
else {
|
||||
switch (i) {
|
||||
case T_BREAK_CAMP:
|
||||
break;
|
||||
case T_TALK_WITH_GOD:
|
||||
UpTheMountain;
|
||||
break;
|
||||
case T_VIEW_CLOUDS:
|
||||
CloudScene;
|
||||
break;
|
||||
case T_HOLD_COURT:
|
||||
HoldCourt;
|
||||
break;
|
||||
case T_VIEW_MAP:
|
||||
AEMap;
|
||||
break;
|
||||
case T_WATER_ROCK:
|
||||
WaterRock;
|
||||
break;
|
||||
case T_BATTLE:
|
||||
Battle;
|
||||
break;
|
||||
case T_QUAIL:
|
||||
Quail;
|
||||
break;
|
||||
case T_MOSES_COMICS:
|
||||
ViewComics;
|
||||
break;
|
||||
case T_HELP:
|
||||
PopUpEd("::/Adam/God/HSNotes.DD.Z",Fs);
|
||||
PopUpOk("Add your own story-line...\nLike old school toys.\n");
|
||||
break;
|
||||
}
|
||||
res=TRUE;
|
||||
}
|
||||
Refresh;
|
||||
Fs->song_task=NULL;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 TMsg(CDC *dc,U8 *msg)
|
||||
{
|
||||
F64 t0=tS;
|
||||
while (tS-t0<1.5) {
|
||||
if (Blink(5))
|
||||
dc->color=BLACK;
|
||||
else
|
||||
dc->color=RED;
|
||||
GrRect(dc,0,GR_HEIGHT-FONT_HEIGHT*3,GR_WIDTH,FONT_HEIGHT*2);
|
||||
dc->color=BLACK;
|
||||
GrRect(dc,2,GR_HEIGHT-FONT_HEIGHT*3+2,GR_WIDTH-4,FONT_HEIGHT*2-4);
|
||||
dc->color=YELLOW;
|
||||
GrPrint(dc,(GR_WIDTH-StrLen(msg)*FONT_WIDTH)/2,
|
||||
GR_HEIGHT-5*FONT_HEIGHT/2,"%s",msg);
|
||||
Refresh;
|
||||
if (ScanChar)
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
U0 Trailer()
|
||||
{
|
||||
CDC *dc=DCAlias;
|
||||
WinBorder;
|
||||
WinMax;
|
||||
Cd(Fs->parent_task->cur_dir);
|
||||
Type("AESplash.DD");
|
||||
Sleep(500);
|
||||
try {
|
||||
TMsg(dc,"Leaving all behind, they fled.");
|
||||
TMsg(dc,"Found themselves in a desert.");
|
||||
TMsg(dc,"God! We're gonna die!");
|
||||
TMsg(dc,"\"Trust Me!\"");
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
DCFill;
|
||||
DCDel(dc);
|
||||
}
|
||||
|
||||
U0 AfterEgypt()
|
||||
{
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
|
||||
AutoComplete;
|
||||
WinBorder;
|
||||
WinMax;
|
||||
DocClear;
|
||||
PopUp("Trailer;",Fs);
|
||||
try //Catch <CTRL-ALT-c>.
|
||||
while (TakeTurn);
|
||||
catch
|
||||
PutExcept;
|
||||
DocClear;
|
||||
SettingsPop;
|
||||
}
|
||||
Binary file not shown.
@@ -1,26 +0,0 @@
|
||||
U0 ViewComics()
|
||||
{
|
||||
I64 i=0;
|
||||
U8 *st;
|
||||
CDirEntry *tmpde=FilesFind("Comics/*.DD*"),*tmpde1=tmpde;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrint(doc,"$$LTBLUE$$");
|
||||
while (tmpde) {
|
||||
st=StrNew(tmpde->name);
|
||||
FileExtRem(st);
|
||||
tmpde->user_data=DocPrint(doc,"$$MU-UL,\"%-10ts\",LE=%d$$ ",st,tmpde);
|
||||
Free(st);
|
||||
tmpde=tmpde->next;
|
||||
if ((i++&3)==3)
|
||||
DocPrint(doc,"\n");
|
||||
}
|
||||
while (TRUE) {
|
||||
if ((tmpde=PopUpMenu(doc))>0)
|
||||
Ed(tmpde->full_name);
|
||||
else
|
||||
break;
|
||||
}
|
||||
DocDel(doc);
|
||||
DirTreeDel(tmpde1);
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,97 +0,0 @@
|
||||
I64 type_weights[OT_NUM_TYPES]={0,30,30,15,30,30,1,1,1};
|
||||
|
||||
I64 mp_not_done_flags;
|
||||
U0 MPDrawHoreb(CDC *dc2)
|
||||
{
|
||||
CTask *task=dc2->win_task;
|
||||
CDC *dc=DCAlias(dc2,task);
|
||||
I64 i,j,dx,dy,dz,w=task->pix_width,h=task->pix_height,r[16],cx=w>>1;
|
||||
F64 s,m,a,x1,y1,x2,y2;
|
||||
Obj *tmpo;
|
||||
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotY(r,-é);
|
||||
Mat4x4RotX(r,77*ã/180);
|
||||
for (i=Gs->num;i<O_NUM_OBJS+O_NUM_PEBBLES;i+=mp_cnt) {
|
||||
tmpo=&objs[i];
|
||||
tmpo->x1=tmpo->x+vx; tmpo->y1=tmpo->y; tmpo->z1=tmpo->z+vz;
|
||||
Mat4x4MulXYZ(r,&tmpo->x1,&tmpo->y1,&tmpo->z1);
|
||||
if (tmpo->type==OT_SHEEP ||
|
||||
tmpo->type==OT_GOAT1 || tmpo->type==OT_GOAT2) {
|
||||
dx=100*tmpo->dx; dy=100*tmpo->dy; dz=100*tmpo->dz;
|
||||
Mat4x4MulXYZ(r,&dx,&dy,&dz);
|
||||
if (dx<0)
|
||||
tmpo->sym=TRUE;
|
||||
else
|
||||
tmpo->sym=FALSE;
|
||||
}
|
||||
if (tmpo->z1>=0) {
|
||||
s=100.0/(AbsI64(tmpo->z1)+50);
|
||||
if (tmpo->type) {
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4Scale(dc->r,s*2);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
if (tmpo->sym) {
|
||||
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
|
||||
DCSymmetrySet(dc,s*tmpo->x1+cx,s*tmpo->y1+h,
|
||||
s*tmpo->x1+cx,s*tmpo->y1+h+10);
|
||||
}
|
||||
Sprite3B(dc,s*tmpo->x1+cx,s*tmpo->y1+h,tmpo->z1,imgs[tmpo->type]);
|
||||
} else {
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
dc->color=pebble_colors[tmpo->num&3];
|
||||
GrPlot3(dc,s*tmpo->x1+cx,s*tmpo->y1+h,tmpo->z1);
|
||||
}
|
||||
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
|
||||
if (tmpo==&objs[O_BURNING_BUSH]) {//draw burning bush
|
||||
dc->x=s*tmpo->x1+cx;
|
||||
dc->y=s*tmpo->y1+h;
|
||||
dc->z=tmpo->z1;
|
||||
dc->pen_width=1;
|
||||
dc->color=winmgr.updates&15;
|
||||
for (j=0;j<45;j++) {
|
||||
m=Sqr(Rand); a=2*ã*Rand;
|
||||
P2R(&x1,&y1,m,a);
|
||||
m=Sqr(Rand); a=2*ã*Rand;
|
||||
P2R(&x2,&y2,m,a);
|
||||
GrLine3(dc,20*x1,20*y1-25,0,20*x2,20*y2-25,0);
|
||||
}
|
||||
if (SqrI64(s*tmpo->x1)+SqrI64(s*tmpo->y1)<300*300)
|
||||
horeb_done=TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
dc->depth_buf=NULL;
|
||||
DCDel(dc);
|
||||
LBtr(&mp_not_done_flags,Gs->num);
|
||||
}
|
||||
|
||||
U0 DrawHoreb(CTask *task,CDC *dc)
|
||||
{
|
||||
I64 i,x,y,z,w=task->pix_width,h=task->pix_height,r[16],cx=w>>1,cy=h>>1;
|
||||
F64 s;
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotY(r,-é);
|
||||
Mat4x4RotX(r,77*ã/180);
|
||||
//Sun
|
||||
x=vx; y=0; z=1000000+vz;
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
s=100.0/(AbsI64(z)+50);
|
||||
if (y<0) {
|
||||
dc->color=BROWN;
|
||||
GrCircle(dc,s*x+cx,15,15);
|
||||
dc->color=YELLOW;
|
||||
GrFloodFill(dc,s*x+cx,15);
|
||||
}
|
||||
DCDepthBufAlloc(dc);
|
||||
mp_not_done_flags=1<<mp_cnt-1;
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
JobQue(&MPDrawHoreb,dc,i);
|
||||
while (mp_not_done_flags)
|
||||
Yield;
|
||||
if (Blink) {
|
||||
dc->color=LTRED;
|
||||
GrPrint(dc,cx-21*FONT_WIDTH/2,cy-FONT_HEIGHT/2,"Find the Burning Bush.");
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
I64 type_weights[OT_NUM_TYPES]={0,30,30,15,30,3,1,1,1};
|
||||
|
||||
I64 ObjCompare(Obj *o1,Obj *o2)
|
||||
{
|
||||
return o2->z1-o1->z1;
|
||||
}
|
||||
|
||||
U0 DrawHoreb(CTask *task,CDC *dc)
|
||||
{
|
||||
I64 i,j,x,y,z,dx,dy,dz,
|
||||
w=task->pix_width,
|
||||
h=task->pix_height,r[16],
|
||||
cx=w>>1,cy=h>>1;
|
||||
F64 s,m,a,x1,y1,x2,y2;
|
||||
Obj *o_sort[O_NUM_OBJS+O_NUM_PEBBLES],*tmpo;
|
||||
|
||||
Mat4x4IdentEqu(r);
|
||||
Mat4x4RotY(r,-é);
|
||||
Mat4x4RotX(r,77*ã/180);
|
||||
|
||||
//Sun
|
||||
x=vx; y=0; z=1000000+vz;
|
||||
Mat4x4MulXYZ(r,&x,&y,&z);
|
||||
s=100.0/(AbsI64(z)+50);
|
||||
if (y<0) {
|
||||
dc->color=BROWN;
|
||||
GrCircle(dc,s*x+cx,15,15);
|
||||
dc->color=YELLOW;
|
||||
GrFloodFill(dc,s*x+cx,15);
|
||||
}
|
||||
|
||||
for (i=0;i<O_NUM_OBJS+O_NUM_PEBBLES;i++) {
|
||||
tmpo=&objs[i];
|
||||
o_sort[i]=tmpo;
|
||||
tmpo->x1=tmpo->x+vx; tmpo->y1=tmpo->y; tmpo->z1=tmpo->z+vz;
|
||||
Mat4x4MulXYZ(r,&tmpo->x1,&tmpo->y1,&tmpo->z1);
|
||||
if (tmpo->type==OT_SHEEP ||
|
||||
tmpo->type==OT_GOAT1 || tmpo->type==OT_GOAT2) {
|
||||
dx=100*tmpo->dx; dy=100*tmpo->dy; dz=100*tmpo->dz;
|
||||
Mat4x4MulXYZ(r,&dx,&dy,&dz);
|
||||
if (dx<0)
|
||||
tmpo->sym=TRUE;
|
||||
else
|
||||
tmpo->sym=FALSE;
|
||||
}
|
||||
}
|
||||
QSortI64(o_sort,O_NUM_OBJS+O_NUM_PEBBLES,&ObjCompare);
|
||||
|
||||
for (i=0;i<O_NUM_OBJS+O_NUM_PEBBLES;i++) {
|
||||
tmpo=o_sort[i];
|
||||
if (tmpo->z1<0) break;
|
||||
s=100.0/(AbsI64(tmpo->z1)+50);
|
||||
if (tmpo->type) {
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4Scale(dc->r,s*2);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
if (tmpo->sym) {
|
||||
dc->flags|=DCF_SYMMETRY|DCF_JUST_MIRROR;
|
||||
DCSymmetrySet(dc,s*tmpo->x1+cx,s*tmpo->y1+h,
|
||||
s*tmpo->x1+cx,s*tmpo->y1+h+10);
|
||||
}
|
||||
Sprite3B(dc,s*tmpo->x1+cx,s*tmpo->y1+h,0,imgs[tmpo->type]);
|
||||
} else {
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
dc->color=pebble_colors[tmpo->num&3];
|
||||
GrPlot3(dc,s*tmpo->x1+cx,s*tmpo->y1+h,tmpo->z1);
|
||||
}
|
||||
dc->flags&=~(DCF_SYMMETRY|DCF_JUST_MIRROR);
|
||||
if (o_sort[i]==&objs[O_BURNING_BUSH]) {//draw burning bush
|
||||
dc->x=s*tmpo->x1+cx;
|
||||
dc->y=s*tmpo->y1+h;
|
||||
dc->z=0;
|
||||
|
||||
dc->pen_width=1;
|
||||
dc->color=winmgr.updates&15;
|
||||
for (j=0;j<45;j++) {
|
||||
m=Sqr(Rand); a=2*ã*Rand;
|
||||
P2R(&x1,&y1,m,a);
|
||||
m=Sqr(Rand); a=2*ã*Rand;
|
||||
P2R(&x2,&y2,m,a);
|
||||
GrLine3(dc,20*x1,20*y1-25,0,20*x2,20*y2-25,0);
|
||||
}
|
||||
|
||||
if (SqrI64(s*tmpo->x1)+SqrI64(s*tmpo->y1)<300*300)
|
||||
horeb_done=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (Blink) {
|
||||
dc->color=LTRED;
|
||||
GrPrint(dc,cx-21*FONT_WIDTH/2,cy-FONT_HEIGHT/2,"Find the Burning Bush.");
|
||||
}
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
U0 AnimateTask(I64)
|
||||
{
|
||||
I64 i;
|
||||
F64 t;
|
||||
Obj *tmpo;
|
||||
while (TRUE) {
|
||||
t=tS;
|
||||
for (i=0;i<O_NUM_OBJS+O_NUM_PEBBLES;i++) {
|
||||
tmpo=&objs[i];
|
||||
if (tmpo->type==OT_SHEEP ||
|
||||
tmpo->type==OT_GOAT1 || tmpo->type==OT_GOAT2) {
|
||||
tmpo->x+=tmpo->dx;
|
||||
tmpo->y+=tmpo->dy;
|
||||
tmpo->z+=tmpo->dz;
|
||||
tmpo->dx=5*Cos(0.5*t+tmpo->é);
|
||||
tmpo->dz=5*Sin(0.5*t+tmpo->é);
|
||||
}
|
||||
}
|
||||
Sleep(20);
|
||||
}
|
||||
}
|
||||
|
||||
U0 Init()
|
||||
{
|
||||
Obj *tmpo;
|
||||
I64 i,j,k,total=0;
|
||||
|
||||
for (i=0;i<OT_NUM_TYPES;i++)
|
||||
total+=type_weights[i];
|
||||
|
||||
MemSet(objs,0,sizeof(objs));
|
||||
for (i=0;i<O_NUM_OBJS+O_NUM_PEBBLES;i++) {
|
||||
tmpo=&objs[i];
|
||||
tmpo->num=i;
|
||||
tmpo->x=RandU32&0x1FFF-0x1000;
|
||||
tmpo->y=0;
|
||||
tmpo->z=RandU32&0x1FFF-0x1000;
|
||||
tmpo->é=2*ã*Rand;
|
||||
tmpo->sym=RandU16&1;
|
||||
|
||||
if (i<O_NUM_OBJS) {
|
||||
k=0;
|
||||
j=RandU32%total;
|
||||
while (TRUE) {
|
||||
j-=type_weights[k];
|
||||
if (j<0)
|
||||
break;
|
||||
else
|
||||
k++;
|
||||
}
|
||||
tmpo->type=k;
|
||||
} else
|
||||
tmpo->type=OT_PEBBLE;
|
||||
}
|
||||
objs[O_BURNING_BUSH].type=OT_BUSH1;
|
||||
|
||||
vx=0; vz=0; é=0;
|
||||
horeb_done=FALSE;
|
||||
}
|
||||
|
||||
#define ANIMATE_STEPS 5
|
||||
|
||||
U0 AnimateéTask(F64 a)
|
||||
{
|
||||
I64 i;
|
||||
for (i=0;i<ANIMATE_STEPS;i++) {
|
||||
é+=a/ANIMATE_STEPS;
|
||||
Sleep(20);
|
||||
}
|
||||
}
|
||||
|
||||
U0 AnimateVTask(F64 v)
|
||||
{
|
||||
I64 i;
|
||||
for (i=0;i<ANIMATE_STEPS;i++) {
|
||||
vx+=v/ANIMATE_STEPS*Sin(é);
|
||||
vz+=v/ANIMATE_STEPS*Cos(é);
|
||||
Sleep(20);
|
||||
}
|
||||
}
|
||||
|
||||
U0 Horeb()
|
||||
{
|
||||
I64 sc;
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Play {"
|
||||
" Restart(,'\n');"
|
||||
" Fwd(,,SC_CURSOR_UP);"
|
||||
" Bwd(,,SC_CURSOR_DOWN);"
|
||||
" Left(,,SC_CURSOR_LEFT);"
|
||||
" Right(,,SC_CURSOR_RIGHT);"
|
||||
"}"
|
||||
);
|
||||
SettingsPush(Fs,TSF_SAME_SONG); //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
try {
|
||||
Fs->text_attr=YELLOW<<4+BLUE;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
|
||||
-WIF_SELF_GRAB_SCROLL-WIF_FOCUS_TASK_MENU;
|
||||
AutoComplete;
|
||||
WinBorder;
|
||||
WinMax;
|
||||
DocClear;
|
||||
"$$BG,LTCYAN$$%h6c",'\n';
|
||||
"$$BG,YELLOW$$%h30c",'\n';
|
||||
BibleVerse(,"Exodus,3:1",21);
|
||||
Init;
|
||||
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
|
||||
Fs->draw_it=&DrawHoreb;
|
||||
while (!horeb_done)
|
||||
switch (GetKey(&sc)) {
|
||||
case 0:
|
||||
switch (sc.u8[0]) {
|
||||
case SC_CURSOR_LEFT:
|
||||
Spawn(&AnimateéTask,(-ã/100)(I64),"Animate é",,Fs);
|
||||
break;
|
||||
case SC_CURSOR_RIGHT:
|
||||
Spawn(&AnimateéTask,( ã/100)(I64),"Animate é",,Fs);
|
||||
break;
|
||||
case SC_CURSOR_UP:
|
||||
Spawn(&AnimateVTask,(-40.0 )(I64),"Animate V",,Fs);
|
||||
break;
|
||||
case SC_CURSOR_DOWN:
|
||||
Spawn(&AnimateVTask,( 40.0 )(I64),"Animate V",,Fs);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '\n':
|
||||
Init;
|
||||
break;
|
||||
case CH_SHIFT_ESC:
|
||||
case CH_ESC:
|
||||
goto hr_done;
|
||||
}
|
||||
hr_done: //Don't goto out of try
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
DocClear;
|
||||
SettingsPop(Fs,TSF_SAME_SONG);
|
||||
MenuPop;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#help_index "Games"
|
||||
|
||||
Cd(__DIR__);;
|
||||
#include "Comics"
|
||||
#include "/Demo/Graphics/Camp"
|
||||
#include "/Demo/MultiCore/Clouds"
|
||||
#include "/Demo/Graphics/Mountain"
|
||||
#include "Map"
|
||||
#include "Battle"
|
||||
#include "WaterRock"
|
||||
#include "Quail"
|
||||
#include "HorebA"
|
||||
|
||||
#if mp_cnt>=4
|
||||
#include "HorebBMP"
|
||||
#else
|
||||
#include "HorebBSP"
|
||||
#endif
|
||||
|
||||
#include "HorebC"
|
||||
#include "GodTalking"
|
||||
#include "AfterEgypt"
|
||||
|
||||
#help_index ""
|
||||
@@ -1,77 +0,0 @@
|
||||
I64 x=0,y=0;
|
||||
|
||||
U0 DrawMap(CTask *,CDC *dc)
|
||||
{
|
||||
static I64 last_x;
|
||||
static Bool last_left;
|
||||
if (x<last_x)
|
||||
last_left=TRUE;
|
||||
else if (x>last_x)
|
||||
last_left=FALSE;
|
||||
dc->pen_width=1;
|
||||
if (last_left)
|
||||
Sprite3(dc,x,y,0,left_imgs [ToI64(6.0*tS)&3]);
|
||||
else
|
||||
Sprite3(dc,x,y,0,right_imgs[ToI64(6.0*tS)&3]);
|
||||
last_x=x;
|
||||
}
|
||||
|
||||
#define AE1_MIN 0.02
|
||||
#define AE1_MAX 0.05
|
||||
#define AE2_MIN 0.15
|
||||
#define AE2_MAX 0.30
|
||||
|
||||
U0 AEMap()
|
||||
{
|
||||
I64 i=0,
|
||||
cx=Fs->pix_width>>1,
|
||||
cy=Fs->pix_height>>1,
|
||||
c_min=MinI64(cx,cy),
|
||||
*r=NULL,
|
||||
x1=0,y1=0,z1=0,
|
||||
x_last=x1,y_last=y1;
|
||||
F64 a,a1=(AE1_MAX+AE1_MIN)/2,a2=(AE2_MAX+AE2_MIN)/2,a2_total=a2,
|
||||
x_scale=ToF64(cx)/c_min,y_scale=ToF64(cy)/c_min;
|
||||
CDC *dc=DCAlias;
|
||||
|
||||
SettingsPush(Fs,TSF_SAME_SONG); //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->text_attr=YELLOW<<4+BLUE;
|
||||
DocClear;
|
||||
"$$BG,YELLOW$$%h*c",TEXT_ROWS,'\n';
|
||||
BibleVerse(,"Exodus,16:35",3);
|
||||
Fs->draw_it=&DrawMap;
|
||||
try {
|
||||
while (!ScanChar) {
|
||||
dc->color=BLACK;
|
||||
a1=Clamp(Wrap(a1+(AE1_MAX+AE1_MIN)/5.0*(Rand-0.5)),-AE1_MAX,AE1_MAX);
|
||||
a=a1;
|
||||
if ( 0.0<=a<=AE1_MIN) a=AE1_MIN;
|
||||
if (-AE1_MIN<=a<=0.0) a=-AE1_MIN;
|
||||
Free(r);
|
||||
r=Mat4x4IdentNew;
|
||||
Mat4x4RotZ(r,a);
|
||||
Mat4x4MulXYZ(r,&x1,&y1,&z1);
|
||||
|
||||
a2=Clamp(Wrap(a2+(AE2_MAX+AE2_MIN)/5.0*(Rand-0.5)),-AE2_MAX,AE2_MAX);
|
||||
a=a2;
|
||||
if ( 0.0<=a<=AE2_MIN) a=AE2_MIN;
|
||||
if (-AE2_MIN<=a<=0.0) a=-AE2_MIN;
|
||||
a2_total+=a;
|
||||
|
||||
x1=ClampI64(x1+6.0*Cos(a2_total),-c_min+10,c_min-10);
|
||||
y1=ClampI64(y1+6.0*Sin(a2_total),-c_min+10,c_min-10);
|
||||
|
||||
x=x_scale*x1+cx; y=y_scale*y1+cy;
|
||||
if (i++&1)
|
||||
GrLine(dc,x_last,y_last,x,y);
|
||||
x_last=x; y_last=y;
|
||||
Sleep(15);
|
||||
}
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
DocClear;
|
||||
SettingsPop(Fs,TSF_SAME_SONG);
|
||||
Free(r);
|
||||
DCFill(dc);
|
||||
DCDel(dc);
|
||||
}
|
||||
Binary file not shown.
@@ -1,3 +0,0 @@
|
||||
Cd(__DIR__);;
|
||||
#include "Load"
|
||||
AfterEgypt;
|
||||
Binary file not shown.
+22
-22
@@ -232,8 +232,8 @@ Frame imgs[LAST_STOPPED_DRIBBLING+1]={
|
||||
{{$IB,"<22>",BI=22$,$IB,"<23>",BI=23$},DRIBBLE_T/NUM_STOPPED_DRIBBLING_IMGS},
|
||||
};
|
||||
|
||||
RegSetDftEntry("TempleOS/KeepAway","I64 best_score0=0,best_score1=9999;\n");
|
||||
RegExeBranch("TempleOS/KeepAway");
|
||||
RegDft("TempleOS/KeepAway","I64 best_score0=0,best_score1=9999;\n");
|
||||
RegExe("TempleOS/KeepAway");
|
||||
|
||||
F64 game_t_end,foul_t_end;
|
||||
I64 score0,score1;
|
||||
@@ -283,7 +283,7 @@ U0 DrawObj(CDC *dc,Obj *o,F64 tt)
|
||||
tmps=SpriteInterpolate((tt-o->last_t0)/(o->next_t0-o->last_t0),
|
||||
imgs[o->last_img].img[o->team],
|
||||
imgs[o->next_img].img[o->team]);
|
||||
SpriteY3B(dc,o->x,(o->y-o->z)/2,GR_Z_ALL-o->y,tmps,o->é);
|
||||
Sprite3YB(dc,o->x,(o->y-o->z)/2,GR_Z_ALL-o->y,tmps,o->é);
|
||||
Free(tmps);
|
||||
}
|
||||
}
|
||||
@@ -442,8 +442,8 @@ U0 AnimateTask(CTask *parent_task)
|
||||
if (score0-score1>best_score0-best_score1) {
|
||||
best_score0=score0;
|
||||
best_score1=score1;
|
||||
Snd(2000);Sleep(100); Snd(0);Sleep(100);
|
||||
Snd(2000);Sleep(100); Snd(0);Sleep(100);
|
||||
Snd(86);Sleep(100); Snd;Sleep(100);
|
||||
Snd(86);Sleep(100); Snd;Sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,13 +498,13 @@ U0 AnimateTask(CTask *parent_task)
|
||||
score1+=6;
|
||||
else
|
||||
score1+=2;
|
||||
Noise(250,1000,1000);
|
||||
Noise(250,74,74);
|
||||
} else {
|
||||
if (t0<shot_land_t+0.1)
|
||||
score0+=6;
|
||||
else
|
||||
score0+=2;
|
||||
Noise(250,2000,2000);
|
||||
Noise(250,86,86);
|
||||
}
|
||||
last_owner=o;
|
||||
}
|
||||
@@ -515,8 +515,8 @@ U0 AnimateTask(CTask *parent_task)
|
||||
Shoot(o);
|
||||
if (!o->shooting) {
|
||||
if (o==human) {
|
||||
dx=(ip.pos.x-parent_task->pix_left-parent_task->scroll_x)-o->x;
|
||||
dy=(ip.pos.y-parent_task->pix_top-parent_task->scroll_y)*2-o->y;
|
||||
dx=(ms.pos.x-parent_task->pix_left-parent_task->scroll_x)-o->x;
|
||||
dy=(ms.pos.y-parent_task->pix_top-parent_task->scroll_y)*2-o->y;
|
||||
} else {
|
||||
if (!someone_has_ball && o->nearest_man_dd>4*MAN_SQR_RADIUS &&
|
||||
o->nearest_ball) {
|
||||
@@ -551,7 +551,7 @@ U0 AnimateTask(CTask *parent_task)
|
||||
if (o==human && t0>o->foul_t0+1.0 &&
|
||||
dt && d/dt>FOUL_VELOCITY_THRESHOLD &&
|
||||
objs[j].team) {
|
||||
Noise(250,500,500);
|
||||
Noise(250,62,62);
|
||||
score1+=1;
|
||||
foul_t_end=t0+1.0;
|
||||
}
|
||||
@@ -577,33 +577,33 @@ U0 AnimateTask(CTask *parent_task)
|
||||
o->x=parent_task->pix_width-COURT_BORDER-1-o->radius;
|
||||
o->DxDt=-COLLISION_DAMP*o->DxDt;
|
||||
if (o==ball)
|
||||
Noise(10,1000,2000);
|
||||
Noise(10,74,86);
|
||||
}
|
||||
if (o->x-o->radius<COURT_BORDER) {
|
||||
o->x=COURT_BORDER+o->radius;
|
||||
o->DxDt=-COLLISION_DAMP*o->DxDt;
|
||||
if (o==ball)
|
||||
Noise(10,1000,2000);
|
||||
Noise(10,74,86);
|
||||
}
|
||||
|
||||
if (o->y+o->radius*2>=(parent_task->pix_height-COURT_BORDER)*2) {
|
||||
o->y=(parent_task->pix_height-COURT_BORDER)*2-1-o->radius*2;
|
||||
o->DyDt=-COLLISION_DAMP*o->DyDt;
|
||||
if (o==ball)
|
||||
Noise(10,1000,2000);
|
||||
Noise(10,74,86);
|
||||
}
|
||||
if (o->y-o->radius*2<2*COURT_BORDER) {
|
||||
o->y=COURT_BORDER*2+o->radius*2;
|
||||
o->DyDt=-COLLISION_DAMP*o->DyDt;
|
||||
if (o==ball)
|
||||
Noise(10,1000,2000);
|
||||
Noise(10,74,86);
|
||||
}
|
||||
|
||||
if (o->z-o->radius*2<0) {
|
||||
o->z=o->radius*2;
|
||||
o->DzDt=-COLLISION_DAMP*o->DzDt;
|
||||
if (o->DzDt>ROLL_VELOCITY_THRESHOLD)
|
||||
Noise(10,1000,2000);
|
||||
Noise(10,74,86);
|
||||
if (o!=ball)
|
||||
o->DzDt=0;
|
||||
} else if (o->z-o->radius*2>0)
|
||||
@@ -647,7 +647,7 @@ U0 Init()
|
||||
|
||||
U0 KeepAway()
|
||||
{
|
||||
I64 msg_code,a1,a2;
|
||||
I64 msg_code,arg1,arg2;
|
||||
|
||||
PopUpOk(
|
||||
"Pass or hand-off to your team to score points.$$FG$$\n\n"
|
||||
@@ -683,19 +683,19 @@ U0 KeepAway()
|
||||
|
||||
try {
|
||||
while (TRUE) {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_DOWN|1<<MSG_IP_R_DOWN|1<<MSG_KEY_DOWN);
|
||||
msg_code=GetMsg(&arg1,&arg2,
|
||||
1<<MSG_MS_L_DOWN|1<<MSG_MS_R_DOWN|1<<MSG_KEY_DOWN);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_L_DOWN:
|
||||
case MSG_MS_L_DOWN:
|
||||
ka_shoot:
|
||||
Shoot(human);
|
||||
break;
|
||||
case MSG_IP_R_DOWN:
|
||||
case MSG_MS_R_DOWN:
|
||||
ka_jump:
|
||||
human->DzDt=JUMP_VELOCITY;
|
||||
break;
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
case '\n':
|
||||
Init;
|
||||
break;
|
||||
@@ -715,7 +715,7 @@ ka_done: //Don't goto out of try
|
||||
} catch
|
||||
PutExcept;
|
||||
SettingsPop;
|
||||
RegWriteBranch("TempleOS/KeepAway","I64 best_score0=%d,best_score1=%d;\n",
|
||||
RegWrite("TempleOS/KeepAway","I64 best_score0=%d,best_score1=%d;\n",
|
||||
best_score0,best_score1);
|
||||
MenuPop;
|
||||
}
|
||||
|
||||
+3
-3
@@ -114,7 +114,7 @@ U0 Init()
|
||||
"Too large\n";
|
||||
else if (table_size<1) {
|
||||
"No table specified, aborting.\n";
|
||||
ThrowBreak;
|
||||
throw;
|
||||
}
|
||||
} while (table_size>MAX_TABLE_SIZE);
|
||||
|
||||
@@ -148,7 +148,7 @@ U0 Init()
|
||||
}
|
||||
if (!num_inputs_entered) {
|
||||
"No inputs specified, aborting.\n";
|
||||
ThrowBreak;
|
||||
throw;
|
||||
}
|
||||
|
||||
"\nEnter the hex truth table columns values of the outputs.\n";
|
||||
@@ -174,7 +174,7 @@ U0 Init()
|
||||
|
||||
if (!num_outputs_entered) {
|
||||
"No output specified, aborting.\n";
|
||||
ThrowBreak;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,18 +7,18 @@ U0 Song()
|
||||
music.stacatto_factor= 0.902;
|
||||
try {
|
||||
while (!ScanKey) {
|
||||
Play("3qEsCDCDqCDeEGsEBEBeCBsDADA",
|
||||
Play("5qEsCDCDqCDeEGsE4B5E4B5eC4B5sD4A5D4A",
|
||||
"Be \0like \0 \0a \0 \0child \0 \0 \0 \0"
|
||||
"some \0 \0re\0 \0spect.\n\0 \0 \0 \0 \0 \0");
|
||||
Play("qEsCDCDqCDeEGsEBEBeCBsDADA",
|
||||
Play("5qEsCDCDqCDeEGsE4B5E4B5eC4B5sD4A5D4A",
|
||||
"Ma\0tur\0 \0i\0 \0ty \0 \0 \0 \0don't \0 \0"
|
||||
"ne\0 \0glect.\n\0 \0 \0 \0 \0 \0");
|
||||
Play("eBDqF2sG3A2G3AqAAAetDAAsDBDB");
|
||||
Play("eBDqF2sG3A2G3AqAAAetDAAsDBDB");
|
||||
Play("4eB5DqF4sGAGAqAAA5etD4AA5sD4B5D4B");
|
||||
Play("4eB5DqF4sGAGAqAAA5etD4AA5sD4B5D4B");
|
||||
}
|
||||
} catch
|
||||
PutExcept;
|
||||
Snd(0);
|
||||
Snd;
|
||||
}
|
||||
|
||||
Song;
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
$WW,1$$FG,5$$TX+CX,"Psalmody Help"$$FG$
|
||||
|
||||
* The keyboard can be used as an organ by typing letter keys or clicking the mouse on the keyboard diagram$FG$. You can "record" notes by pressing the red button and typing letters. They will appear on the musical staff. You can edit and save them.
|
||||
* The keyboard can be used as an organ by typing letter keys or clicking the mouse on the keyboard diagram$FG$. You can "record" notes by pressing the red bttn and typing letters. They will appear on the musical staff. You can edit and save them.
|
||||
|
||||
* The clipboard can be used to cut and paste.
|
||||
|
||||
@@ -8,7 +8,7 @@ $WW,1$$FG,5$$TX+CX,"Psalmody Help"$$FG$
|
||||
|
||||
* The first line of the $LK,"HolyC",A="FI:::/Doc/HolyC.DD"$ song files is a comment with a category recognized by $LK,"JukeBox",A="FF:::/Apps/Psalmody/JukeBox.HC,JukeBox"$(). The categories are $FG,2$"no nothing"$FG$, $FG,2$"has words"$FG$, $FG,2$"has graphics"$FG$, or $FG,2$"special"$FG$. The third character in the song comment is a digit rating number, shown in $LK,"JukeBox",A="FF:::/Apps/Psalmody/JukeBox.HC,JukeBox"$(). You can set the song rating in $LK,"JukeBox",A="FF:::/Apps/Psalmody/JukeBox.HC,JukeBox"$() by pressing $FG,2$0$FG$-$FG,2$9$FG$. You can press $FG,2$<DELETE>$FG$ to delete songs.
|
||||
|
||||
* You can take the $LK,"Play",A="MN:Play"$() stmts out of a song file and place them in your programs. You can also add a song to a document with $FG,2$<CTRL-l>$FG$, but you should do it after pressing $FG,2$<CTRL-t>$FG$ because the clipboard-insert in $FG,2$<CTRL-l>$FG$ is screwy. See this $SO,"<Song>",A="2qG3ECB2eGG3qCeFDsBGBG2qG3ECB2eGG3qCeFDsBGBGqEeEFqEB2eG3FetCAGqFCEeEFqEB2eG3FetCAGqFC"$ after pressing $FG,2$<CTRL-t>$FG$, now.
|
||||
* You can take the $LK,"Play",A="MN:Play"$() stmts out of a song file and place them in your programs. You can also add a song to a document with $FG,2$<CTRL-l>$FG$, but you should do it after pressing $FG,2$<CTRL-t>$FG$ because the clipboard-insert in $FG,2$<CTRL-l>$FG$ is screwy. See this $SO,"<Song>",A="4qG5EC4BeGG5qCeFD4sB5G4B5G4qG5EC4BeGG5qCeFD4sB5G4B5GqEeEFqE4BeG5FetC4A5GqFCEeEFqE4BeG5FetC4A5GqFC"$ after pressing $FG,2$<CTRL-t>$FG$, now.
|
||||
|
||||
* You can call $LK,"JukeBox",A="FF:::/Apps/Psalmody/JukeBox.HC,JukeBox"$("~/Psalmody"); to play your songs.
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ CTask *SingleSong(U8 *msg,U8 *name)
|
||||
CTask *task=Spawn(&SrvCmdLine,NULL,name,,Fs);
|
||||
StrCpy(task->task_title,name);
|
||||
task->title_src=TTS_LOCKED_CONST;
|
||||
TaskExe(task,Fs,";",1<<SVCf_WAKE_MASTER|1<<SVCf_FREE_ON_COMPLETE);
|
||||
TaskExe(task,Fs,";",1<<JOBf_WAKE_MASTER|1<<JOBf_FREE_ON_COMPLETE);
|
||||
WinHorz(task->win_left,task->win_left+50,task);
|
||||
WinVert(2,2+8,task);
|
||||
TaskExe(task,NULL,msg,1<<SVCf_EXIT_ON_COMPLETE|1<<SVCf_FREE_ON_COMPLETE);
|
||||
TaskExe(task,NULL,msg,1<<JOBf_EXIT_ON_COMPLETE|1<<JOBf_FREE_ON_COMPLETE);
|
||||
DocPut(task)->max_entries=100;
|
||||
return task;
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@ This uses four types of ctrls
|
||||
|
||||
2) The $LK,"CCtrl",A="MN:CCtrl"$ type for the tempo/stacatto sliders.
|
||||
|
||||
3) The active $LK,"CDoc",A="MN:CDoc"$ sprite buttons with macros for left/record/play/right.
|
||||
3) The active $LK,"CDoc",A="MN:CDoc"$ sprite bttns with macros for left/record/play/right.
|
||||
|
||||
4) Hand-made ctrls for the kbdgraphic, notes and staff.
|
||||
|
||||
This uses four types of output
|
||||
|
||||
1) The $LK,"CDoc",A="MN:CDoc"$ for the text and buttons and kbdgraphic.
|
||||
1) The $LK,"CDoc",A="MN:CDoc"$ for the text and bttns and kbdgraphic.
|
||||
|
||||
2) The Fs->draw_it() for the staff region, drawn every refresh.
|
||||
|
||||
@@ -22,9 +22,6 @@ This uses four types of output
|
||||
See $LK,"GrUpdateTaskWin",A="MN:GrUpdateTaskWin"$(), $LK,"GrUpdateTasks",A="MN:GrUpdateTasks"$() and $LK,"GrUpdateScrn",A="MN:GrUpdateScrn"$().
|
||||
$WW,1$$WW,0$*/
|
||||
|
||||
#define NOTE_REST MIN_I64
|
||||
#define OCTAVE_REST MIN_I64
|
||||
|
||||
#define PSMT_HEAD 0
|
||||
#define PSMT_NOTE 1
|
||||
#define PSMT_METER 2
|
||||
@@ -41,14 +38,7 @@ class PsmNote
|
||||
I64 x,y;
|
||||
U8 *word;
|
||||
I64 type,flags;
|
||||
union {
|
||||
I64 note;
|
||||
I64 meter_top;
|
||||
};
|
||||
union {
|
||||
I64 octave;
|
||||
I64 meter_bottom;
|
||||
}
|
||||
I64 ona,meter_top,meter_bottom;
|
||||
I64 duration,width;
|
||||
U8 ascii[32];
|
||||
};
|
||||
@@ -62,8 +52,7 @@ class PsmCtrl
|
||||
PsmNote head;
|
||||
PsmNote clipboard;
|
||||
CMenuEntry *incomplete_entry,*record_entry;
|
||||
I64 scrn_x,
|
||||
tool;
|
||||
I64 scrn_x,tool;
|
||||
PsmNote *cur_note;
|
||||
CDC *dc2;
|
||||
Bool playing;
|
||||
|
||||
@@ -69,7 +69,7 @@ CCtrl *TempoNew()
|
||||
{
|
||||
CCtrl *c=CAlloc(sizeof(CCtrl));
|
||||
c->win_task=Fs;
|
||||
c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_IP;
|
||||
c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;
|
||||
c->type=CTRLT_GENERIC;
|
||||
c->state=&tempo_state;
|
||||
c->draw_it=&DrawTempoCtrl;
|
||||
|
||||
@@ -53,13 +53,10 @@ $ID,-8$
|
||||
F64 psm_durations[PSM_NUM_DURATIONS+1]={
|
||||
2*.25/3,.25,2*.5/3,.5,2.0/3.0,0.5*1.5,1.0,1.5,2.0,3.0,4.0,6.0,1000000.0};
|
||||
U8 *psm_duration_lst="st\0s\0et\0e\0qt\0e.\0q\0q.\0h\0h.\0w\0w.\0";
|
||||
U8 *psm_duration_imgs[PSM_NUM_DURATIONS]={$IB,"<1>",BI=1$,$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,
|
||||
$IB,"<2>",BI=2$,$IB,"<3>",BI=3$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$,$IB,"<3>",BI=3$,
|
||||
$IB,"<4>",BI=4$,$IB,"<4>",BI=4$,$IB,"<5>",BI=5$,$IB,"<5>",BI=5$};
|
||||
U8 *psm_duration_imgs[PSM_NUM_DURATIONS]={
|
||||
$IB,"<1>",BI=1$,$IB,"<1>",BI=1$,$IB,"<2>",BI=2$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$,$IB,"<2>",BI=2$,$IB,"<3>",BI=3$,$IB,"<3>",BI=3$,$IB,"<4>",BI=4$,$IB,"<4>",BI=4$,$IB,"<5>",BI=5$,$IB,"<5>",BI=5$};
|
||||
Bool psm_triplet_durations[PSM_NUM_DURATIONS]={TRUE,FALSE,TRUE,
|
||||
FALSE,TRUE,FALSE,FALSE,FALSE,
|
||||
FALSE,FALSE,FALSE,FALSE};
|
||||
|
||||
FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE};
|
||||
|
||||
Bool PsmBlink()
|
||||
{
|
||||
@@ -117,7 +114,7 @@ U0 PsmSetOctave(I64 octave)
|
||||
I64 i;
|
||||
U8 buf[STR_LEN];
|
||||
CMenuEntry *tmpse;
|
||||
for (i=0;i<=6;i++) {
|
||||
for (i=1;i<=7;i++) {
|
||||
StrPrint(buf,"Snd/Octave%d",i);
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,buf)) {
|
||||
if (i==octave)
|
||||
@@ -149,7 +146,7 @@ U0 PsmRecalcNoteXY()
|
||||
{
|
||||
F64 measure_len=4,measure_left=measure_len;
|
||||
PsmNote *tmpn=psm.head.next;
|
||||
I64 x=8-psm.scrn_x,note,octave;
|
||||
I64 x=8-psm.scrn_x,ona,note,octave;
|
||||
while (TRUE) {
|
||||
tmpn->x=x;
|
||||
tmpn->y=50;
|
||||
@@ -157,22 +154,18 @@ U0 PsmRecalcNoteXY()
|
||||
break;
|
||||
else {
|
||||
if (tmpn->type!=PSMT_METER) {
|
||||
octave=tmpn->octave;
|
||||
if (octave!=OCTAVE_REST) {
|
||||
note=tmpn->note;
|
||||
if (tmpn->ona!=ONA_REST) {
|
||||
ona=tmpn->ona;
|
||||
if (Bt(&tmpn->flags,PSMf_SHARP))
|
||||
note--;
|
||||
ona--;
|
||||
if (Bt(&tmpn->flags,PSMf_FLAT))
|
||||
note++;
|
||||
if (note<0) {
|
||||
note=11;
|
||||
octave--;
|
||||
} else if (note>11) {
|
||||
note=0;
|
||||
octave++;
|
||||
}
|
||||
ona++;
|
||||
octave=Ona2Octave(ona);
|
||||
note =Ona2Note (ona);
|
||||
note=music.note_map[*LstSub(note,psm_note_lst)-'A'];
|
||||
tmpn->y=(15+(psm_note_map[note]-7*(octave-2)))*4;
|
||||
if (note<3)
|
||||
octave++;
|
||||
tmpn->y=(15+(psm_note_map[note]-7*(octave-4)))*4;
|
||||
}
|
||||
}
|
||||
x+=tmpn->width;
|
||||
@@ -237,7 +230,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
} else if (tmpn->flags&PSMF_SEL)
|
||||
dc->color=RED;
|
||||
else {
|
||||
if (tmpn->note!=NOTE_REST)
|
||||
if (tmpn->ona!=ONA_REST)
|
||||
dc->color=BLACK;
|
||||
else
|
||||
dc->color=LTGRAY;
|
||||
@@ -314,21 +307,19 @@ U0 DrawPickTools()
|
||||
psm.dc2->color=ROPF_DITHER+WHITE<<16+RED;
|
||||
else
|
||||
psm.dc2->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
GrBorder(psm.dc2,PSM_TOOLS_X,PSM_TOOLS_Y,
|
||||
PSM_TOOLS_X+10,PSM_TOOLS_Y+10);
|
||||
GrBorder(psm.dc2,PSM_TOOLS_X,PSM_TOOLS_Y,PSM_TOOLS_X+10,PSM_TOOLS_Y+10);
|
||||
|
||||
if (psm.tool==PSMTT_PTR_TOOL)
|
||||
psm.dc2->color=RED;
|
||||
else
|
||||
psm.dc2->color=BLACK;
|
||||
(*gr.fp_draw_input_ptr)(psm.dc2,PSM_TOOLS_X+15,PSM_TOOLS_Y);
|
||||
(*gr.fp_draw_ms)(psm.dc2,PSM_TOOLS_X+15,PSM_TOOLS_Y);
|
||||
psm.dc2->color=BLACK;
|
||||
}
|
||||
|
||||
Bool PsmGetPickToolBox(I64 xx,I64 yy)
|
||||
{
|
||||
if (PSM_TOOLS_X<=xx<PSM_TOOLS_X+27 &&
|
||||
PSM_TOOLS_Y<=yy<PSM_TOOLS_Y+15) {
|
||||
if (PSM_TOOLS_X<=xx<PSM_TOOLS_X+27 && PSM_TOOLS_Y<=yy<PSM_TOOLS_Y+15) {
|
||||
PsmMarkSel(0,0,FALSE);
|
||||
if (xx<PSM_TOOLS_X+13)
|
||||
psm.tool=PSMTT_BOX_TOOL;
|
||||
|
||||
@@ -149,24 +149,22 @@ U0 PsmLoadSongStr(U8 *st,I64 *psm_octave,F64 *psm_duration)
|
||||
Bts(&tmpn->flags,PSMf_FLAT);
|
||||
note--;
|
||||
st++;
|
||||
if (note<0) //Ab
|
||||
note=11;
|
||||
else if (note==2) //Cb
|
||||
*psm_octave-=1;
|
||||
} else if (*st=='#') {
|
||||
Bts(&tmpn->flags,PSMf_SHARP);
|
||||
note++;
|
||||
st++;
|
||||
if (note>11) //G#
|
||||
note=0;
|
||||
else if (note==3) //B#
|
||||
*psm_octave+=1;
|
||||
}
|
||||
if (note<0) {
|
||||
note=11;
|
||||
*psm_octave-=1;
|
||||
} else if (note>11) {
|
||||
note=0;
|
||||
*psm_octave+=1;
|
||||
}
|
||||
tmpn->note=note;
|
||||
tmpn->octave=*psm_octave;
|
||||
} else {
|
||||
tmpn->note=NOTE_REST;
|
||||
tmpn->octave=OCTAVE_REST;
|
||||
}
|
||||
tmpn->ona=Note2Ona(note,*psm_octave);
|
||||
} else
|
||||
tmpn->ona=ONA_REST;
|
||||
if (*psm_duration<=2*.25/3)
|
||||
i=0;
|
||||
else if (*psm_duration<=.25)
|
||||
@@ -251,11 +249,11 @@ U8 *PsmCvtSong()
|
||||
{
|
||||
PsmNote *tmpn;
|
||||
U8 *st,*src,*dst;
|
||||
I64 i,note,octave,last_octave,last_duration;
|
||||
I64 i,ona,note,octave,last_octave,last_duration;
|
||||
|
||||
i=0;
|
||||
tmpn=psm.head.next;
|
||||
last_octave=OCTAVE_REST;
|
||||
last_octave=MIN_I64;
|
||||
last_duration=-1;
|
||||
while (tmpn!=&psm.head) {
|
||||
dst=&tmpn->ascii;
|
||||
@@ -265,25 +263,19 @@ U8 *PsmCvtSong()
|
||||
*dst++='/';
|
||||
*dst++=tmpn->meter_bottom+'0';
|
||||
} else {
|
||||
octave=tmpn->octave;
|
||||
note=tmpn->note;
|
||||
if (note!=NOTE_REST) {
|
||||
if (tmpn->ona!=ONA_REST) {
|
||||
ona=tmpn->ona;
|
||||
if (Bt(&tmpn->flags,PSMf_SHARP))
|
||||
note--;
|
||||
ona--;
|
||||
if (Bt(&tmpn->flags,PSMf_FLAT))
|
||||
note++;
|
||||
if (note<0) {
|
||||
note=11;
|
||||
octave--;
|
||||
} else if (note>11) {
|
||||
note=0;
|
||||
octave++;
|
||||
}
|
||||
ona++;
|
||||
octave=Ona2Octave(ona);
|
||||
note =Ona2Note (ona);
|
||||
note=music.note_map[*LstSub(note,psm_note_lst)-'A'];
|
||||
}
|
||||
if (Bt(&tmpn->flags,PSMf_TIE))
|
||||
*dst++='(';
|
||||
if (octave!=last_octave && note!=NOTE_REST) {
|
||||
if (octave!=last_octave && tmpn->ona!=ONA_REST) {
|
||||
*dst++=octave+'0';
|
||||
last_octave=octave;
|
||||
}
|
||||
@@ -294,7 +286,7 @@ U8 *PsmCvtSong()
|
||||
*dst++=src[1];
|
||||
last_duration=tmpn->duration;
|
||||
}
|
||||
if (note!=NOTE_REST) {
|
||||
if (tmpn->ona!=ONA_REST) {
|
||||
src=LstSub(note,psm_note_lst);
|
||||
*dst++=src[0];
|
||||
if (src[1])
|
||||
@@ -419,7 +411,7 @@ U8 *PsmSaveSong(U8 *dirname,U8 *full_filename)
|
||||
" }\n"
|
||||
" } catch\n"
|
||||
" PutExcept;\n"
|
||||
" Snd(0);\n"
|
||||
" Snd;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"Song;\n");
|
||||
|
||||
+146
-181
@@ -41,43 +41,27 @@ U0 PsmRightClick(I64 x,I64 y)
|
||||
} else {
|
||||
switch (i) {
|
||||
case PSMR_REST:
|
||||
if (tmpn->type==PSMT_NOTE) {
|
||||
tmpn->octave=OCTAVE_REST;
|
||||
tmpn->note=NOTE_REST;
|
||||
}
|
||||
if (tmpn->type==PSMT_NOTE)
|
||||
tmpn->ona=ONA_REST;
|
||||
break;
|
||||
case PSMR_SHARP:
|
||||
if (tmpn->type==PSMT_NOTE && tmpn->octave!=OCTAVE_REST) {
|
||||
if (tmpn->type==PSMT_NOTE && tmpn->ona!=ONA_REST) {
|
||||
if (Btr(&tmpn->flags,PSMf_FLAT))
|
||||
tmpn->note++;
|
||||
tmpn->ona++;
|
||||
if (Btc(&tmpn->flags,PSMf_SHARP))
|
||||
tmpn->note--;
|
||||
tmpn->ona--;
|
||||
else
|
||||
tmpn->note++;
|
||||
if (tmpn->note<0) {
|
||||
tmpn->note=11;
|
||||
tmpn->octave--;
|
||||
} else if (tmpn->note>11) {
|
||||
tmpn->note=0;
|
||||
tmpn->octave++;
|
||||
}
|
||||
tmpn->ona++;
|
||||
}
|
||||
break;
|
||||
case PSMR_FLAT:
|
||||
if (tmpn->type==PSMT_NOTE && tmpn->octave!=OCTAVE_REST) {
|
||||
if (tmpn->type==PSMT_NOTE && tmpn->ona!=ONA_REST) {
|
||||
if (Btr(&tmpn->flags,PSMf_SHARP))
|
||||
tmpn->note--;
|
||||
tmpn->ona--;
|
||||
if (Btc(&tmpn->flags,PSMf_FLAT))
|
||||
tmpn->note++;
|
||||
tmpn->ona++;
|
||||
else
|
||||
tmpn->note--;
|
||||
if (tmpn->note<0) {
|
||||
tmpn->note=11;
|
||||
tmpn->octave--;
|
||||
} else if (tmpn->note>11) {
|
||||
tmpn->note=0;
|
||||
tmpn->octave++;
|
||||
}
|
||||
tmpn->ona--;
|
||||
}
|
||||
break;
|
||||
case PSMR_TIE:
|
||||
@@ -123,35 +107,35 @@ U0 PsmRightClick(I64 x,I64 y)
|
||||
|
||||
U0 PsmLeftClickPickNoteBox(I64 duration)
|
||||
{
|
||||
I64 o,n,msg_code,a1,a2;
|
||||
I64 o,n,msg_code,arg1,arg2;
|
||||
PsmNote *tmpn,*tmpn1;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP|1<<MSG_IP_MOVE);
|
||||
if (msg_code==MSG_IP_MOVE) {
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP|1<<MSG_MS_MOVE);
|
||||
if (msg_code==MSG_MS_MOVE) {
|
||||
DrawDC2;
|
||||
DrawNote(psm.dc2,a1,a2,duration);
|
||||
DrawNote(psm.dc2,arg1,arg2,duration);
|
||||
}
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
if (a2<13*FONT_HEIGHT) {
|
||||
if (a1>psm.head.last->x)
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
if (arg2<13*FONT_HEIGHT) {
|
||||
if (arg1>psm.head.last->x)
|
||||
tmpn1=psm.head.last;
|
||||
else if (a1<psm.head.next->x)
|
||||
else if (arg1<psm.head.next->x)
|
||||
tmpn1=&psm.head;
|
||||
else
|
||||
tmpn1=PsmFindNote(a1-PSM_NOTE_SPACING/2,a2);
|
||||
tmpn1=PsmFindNote(arg1-PSM_NOTE_SPACING/2,arg2);
|
||||
tmpn=CAlloc(sizeof(PsmNote));
|
||||
tmpn->type=PSMT_NOTE;
|
||||
a2=a2/4-15;
|
||||
n=-a2%7;
|
||||
o=2+a2/-7;
|
||||
n=-n;
|
||||
arg2=arg2/4-15;
|
||||
n=arg2%7;
|
||||
o=4+arg2/-7;
|
||||
if (n<0) {
|
||||
n+=7;
|
||||
o++;
|
||||
}
|
||||
n=psm_note_inverse_map[n];
|
||||
tmpn->note=n;
|
||||
tmpn->octave=o;
|
||||
if (n<3)
|
||||
o--;
|
||||
tmpn->ona=Note2Ona(n,o);
|
||||
tmpn->duration=duration;
|
||||
PsmSetWidth(tmpn);
|
||||
QueIns(tmpn,tmpn1);
|
||||
@@ -162,22 +146,22 @@ U0 PsmLeftClickPickNoteBox(I64 duration)
|
||||
|
||||
U0 PsmLeftClickPickMeterBox(I64 top,I64 bottom)
|
||||
{
|
||||
I64 msg_code,a1,a2;
|
||||
I64 msg_code,arg1,arg2;
|
||||
PsmNote *tmpn,*tmpn1;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP|1<<MSG_IP_MOVE);
|
||||
if (msg_code==MSG_IP_MOVE) {
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP|1<<MSG_MS_MOVE);
|
||||
if (msg_code==MSG_MS_MOVE) {
|
||||
DrawDC2;
|
||||
DrawTimeSignature(psm.dc2,a1,a2,top,bottom);
|
||||
DrawTimeSignature(psm.dc2,arg1,arg2,top,bottom);
|
||||
}
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
if (a2<13*FONT_HEIGHT) {
|
||||
if (a1>=psm.head.x)
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
if (arg2<13*FONT_HEIGHT) {
|
||||
if (arg1>=psm.head.x)
|
||||
tmpn1=psm.head.last;
|
||||
else if (a1<psm.head.next->x)
|
||||
else if (arg1<psm.head.next->x)
|
||||
tmpn1=&psm.head;
|
||||
else
|
||||
tmpn1=PsmFindNote(a1-PSM_NOTE_SPACING/2,a2);
|
||||
tmpn1=PsmFindNote(arg1-PSM_NOTE_SPACING/2,arg2);
|
||||
tmpn=CAlloc(sizeof(PsmNote));
|
||||
tmpn->type=PSMT_METER;
|
||||
tmpn->meter_top=top;
|
||||
@@ -192,40 +176,39 @@ U0 PsmLeftClickPickMeterBox(I64 top,I64 bottom)
|
||||
U0 PsmLeftClickStaffPtr(I64 x,I64 y)
|
||||
{
|
||||
PsmNote *tmpn,*tmpn1;
|
||||
I64 o,n,msg_code,a1,a2,n_original,o_original;
|
||||
I64 o,n,msg_code,arg1,arg2,n_original,o_original;
|
||||
psm.cur_note=tmpn=PsmFindNote(x,y);
|
||||
if (tmpn!=&psm.head) {
|
||||
if (tmpn->type==PSMT_NOTE) {
|
||||
n_original=tmpn->note;
|
||||
o_original=tmpn->octave;
|
||||
o_original=Ona2Octave(tmpn->ona);
|
||||
n_original=Ona2Note (tmpn->ona);
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP|1<<MSG_IP_MOVE);
|
||||
if (msg_code==MSG_IP_L_UP) {
|
||||
tmpn1=PsmFindNote(a1,a2);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP|1<<MSG_MS_MOVE);
|
||||
if (msg_code==MSG_MS_L_UP) {
|
||||
tmpn1=PsmFindNote(arg1,arg2);
|
||||
if (tmpn1==&psm.head || tmpn1==tmpn)
|
||||
goto move_note;
|
||||
else {
|
||||
Free(tmpn1->word);
|
||||
tmpn1->word=tmpn->word;
|
||||
tmpn->word=NULL;
|
||||
tmpn->note=n_original;
|
||||
tmpn->octave=o_original;
|
||||
tmpn->ona=Note2Ona(n_original,o_original);
|
||||
}
|
||||
} else {
|
||||
move_note:
|
||||
a2=a2/4-15;
|
||||
n=-a2%7;
|
||||
o=2+a2/-7;
|
||||
n=-n;
|
||||
arg2=arg2/4-15;
|
||||
n=arg2%7;
|
||||
o=4+arg2/-7;
|
||||
if (n<0) {
|
||||
n+=7;
|
||||
o++;
|
||||
}
|
||||
n=psm_note_inverse_map[n];
|
||||
tmpn->note=n;
|
||||
tmpn->octave=o;
|
||||
if (n<3)
|
||||
o--;
|
||||
tmpn->ona=Note2Ona(n,o);
|
||||
}
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
PsmSetWidth(tmpn);
|
||||
}
|
||||
}
|
||||
@@ -233,17 +216,17 @@ move_note:
|
||||
|
||||
U0 PsmLeftClickStaffBox(I64 x,I64 y)
|
||||
{
|
||||
I64 msg_code,a1,a2;
|
||||
I64 msg_code,arg1,arg2;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP|1<<MSG_IP_MOVE);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_UP|1<<MSG_MS_MOVE);
|
||||
DrawDC2;
|
||||
psm.dc2->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
GrBorder(psm.dc2,x,y,a1,a2);
|
||||
if (msg_code==MSG_IP_L_UP) {
|
||||
if (x>a1) SwapI64(&x,&a1);
|
||||
PsmMarkSel(x,a1,TRUE);
|
||||
GrBorder(psm.dc2,x,y,arg1,arg2);
|
||||
if (msg_code==MSG_MS_L_UP) {
|
||||
if (x>arg1) SwapI64(&x,&arg1);
|
||||
PsmMarkSel(x,arg1,TRUE);
|
||||
}
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
} while (msg_code!=MSG_MS_L_UP);
|
||||
DrawDC2;
|
||||
}
|
||||
|
||||
@@ -366,14 +349,12 @@ U0 PsmPopMode()
|
||||
|
||||
U0 Psalmody(U8 *dirname="~/Psalmody")
|
||||
{
|
||||
Bool was_playing;
|
||||
I64 a1,a2,msg_code=0,col,
|
||||
note=NOTE_REST,octave=OCTAVE_REST,psm_octave=3,timeout_val,timeout_val2,
|
||||
old_doc_flags;
|
||||
Bool was_playing,is_null=TRUE,was_null=TRUE;
|
||||
I64 arg1,arg2,msg_code=0,col,ona=ONA_REST,last_ona=ONA_REST,
|
||||
psm_octave=4,timeout_val,timeout_val2,old_doc_flags;
|
||||
U8 *filename=NULL,*st,*st2;
|
||||
PsmNote *tmpn;
|
||||
F64 f=0,last_f=0,psm_duration=1.0,
|
||||
d,evt_time=tS,note_down_time=tS;
|
||||
F64 psm_duration=1.0,d,evt_time=tS,note_down_time=tS;
|
||||
CCtrl *c=TempoNew;
|
||||
|
||||
if (DocPut) old_doc_flags=DocPut->flags;
|
||||
@@ -421,13 +402,13 @@ U0 Psalmody(U8 *dirname="~/Psalmody")
|
||||
" MarkIncomplete(MSG_CMD,PSMF_INCOMPLETE);"
|
||||
"}"
|
||||
"Snd {"
|
||||
" Octave0(,'0');"
|
||||
" Octave1(,'1');"
|
||||
" Octave2(,'2');"
|
||||
" Octave3(,'3');"
|
||||
" Octave4(,'4');"
|
||||
" Octave5(,'5');"
|
||||
" Octave6(,'6');"
|
||||
" Octave7(,'7');"
|
||||
"}"
|
||||
"Help {"
|
||||
" Help(,,SC_F1);"
|
||||
@@ -449,23 +430,23 @@ U0 Psalmody(U8 *dirname="~/Psalmody")
|
||||
while (TRUE) {
|
||||
was_playing=FALSE;
|
||||
mo_start:
|
||||
if (ip.pos_text.y-Fs->win_top<18)
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP|
|
||||
1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|1<<MSG_IP_R_UP|
|
||||
1<<MSG_IP_MOVE|1<<MSG_CMD);
|
||||
if (ms.pos_text.y-Fs->win_top<18)
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP|
|
||||
1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|1<<MSG_MS_R_UP|
|
||||
1<<MSG_MS_MOVE|1<<MSG_CMD);
|
||||
else
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP|
|
||||
1<<MSG_IP_MOVE|1<<MSG_CMD);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP|
|
||||
1<<MSG_MS_MOVE|1<<MSG_CMD);
|
||||
mo_got_msg:
|
||||
if (msg_code==MSG_KEY_DOWN && a1==CH_SPACE && !a2) {
|
||||
//The Window Mgr sets the Doc cur_entry to a button
|
||||
//and generates a <SPACE> when the Doc Buttons are clicked.
|
||||
if (msg_code==MSG_KEY_DOWN && arg1==CH_SPACE && !arg2) {
|
||||
//The Window Mgr sets the Doc cur_entry to a bttn
|
||||
//and generates a <SPACE> when the Doc Bttns are clicked.
|
||||
//This is so that kbd and mouse are the same for Doc's.
|
||||
//We must now pass the <SPACE> onto the Doc handler.
|
||||
PutKey(a1,a2);
|
||||
//We must now pass the <SPACE> onto the Doc hndlr.
|
||||
PutKey(arg1,arg2);
|
||||
goto mo_start;
|
||||
}
|
||||
if (msg_code!=MSG_IP_MOVE) {
|
||||
if (msg_code!=MSG_MS_MOVE) {
|
||||
DocBottom;
|
||||
if (was_playing || DocPut->cur_entry->y>=Fs->win_height-2) {
|
||||
PsmMenu(psm_octave);
|
||||
@@ -473,11 +454,12 @@ mo_got_msg:
|
||||
}
|
||||
}
|
||||
|
||||
octave=psm_octave;
|
||||
ona=Note2Ona(3,psm_octave+1); //C
|
||||
is_null=TRUE;
|
||||
switch (msg_code) {
|
||||
case MSG_CMD:
|
||||
PsmPopMode;
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
case PSMF_CD:
|
||||
st2=dirname;
|
||||
if (dirname=PopUpPickDir) {
|
||||
@@ -496,75 +478,71 @@ mo_got_msg:
|
||||
break;
|
||||
case MSG_KEY_DOWN:
|
||||
evt_time=tS;
|
||||
if ('0'<=a1<='9') {
|
||||
psm_octave=a1-'0';
|
||||
if ('0'<=arg1<='9') {
|
||||
psm_octave=arg1-'0';
|
||||
PsmMenu(psm_octave);
|
||||
col=0;
|
||||
} else {
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
start:
|
||||
case 'a': note=7; octave--; break;
|
||||
case 's': note=8; octave--; break;
|
||||
case 'e': note=9; octave--; break;
|
||||
case 'd': note=10; octave--; break;
|
||||
case 'r': note=11; octave--; break;
|
||||
case 'f': note=0; break;
|
||||
case 't': note=1; break;
|
||||
case 'g': note=2; break;
|
||||
case 'h': note=3; break;
|
||||
case 'u': note=4; break;
|
||||
case 'j': note=5; break;
|
||||
case 'i': note=6; break;
|
||||
case 'k': note=7; break;
|
||||
case 'l': note=8; break;
|
||||
case 'p': note=9; break;
|
||||
case ';': note=10; break;
|
||||
case '[': note=11; break;
|
||||
case '\'': note=0; octave++; break;
|
||||
case ']': note=1; octave++; break;
|
||||
case 'a': ona-=8; break;
|
||||
case 's': ona-=7; break;
|
||||
case 'e': ona-=6; break;
|
||||
case 'd': ona-=5; break;
|
||||
case 'r': ona-=4; break;
|
||||
case 'f': ona-=3; break;
|
||||
case 't': ona-=2; break;
|
||||
case 'g': ona--; break;
|
||||
case 'h': break;
|
||||
case 'u': ona++; break;
|
||||
case 'j': ona+=2; break;
|
||||
case 'i': ona+=3; break;
|
||||
case 'k': ona+=4; break;
|
||||
case 'l': ona+=5; break;
|
||||
case 'p': ona+=6; break;
|
||||
case ';': ona+=7; break;
|
||||
case '[': ona+=8; break;
|
||||
case '\'': ona+=9; break;
|
||||
case ']': ona+=10; break;
|
||||
case CH_SPACE: ona=ONA_REST; break;
|
||||
end:
|
||||
f=Note2Freq(note,octave);
|
||||
break;
|
||||
case CH_SPACE:
|
||||
note=NOTE_REST;
|
||||
octave=OCTAVE_REST;
|
||||
f=-1; //rest
|
||||
is_null=FALSE;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
switch (a2.u8[0]) {
|
||||
switch (arg2.u8[0]) {
|
||||
case SC_CURSOR_LEFT:
|
||||
if (a2&SCF_CTRL) {
|
||||
if (arg2&SCF_CTRL) {
|
||||
while (psm.cur_note->last!=&psm.head) {
|
||||
psm.cur_note=psm.cur_note->last;
|
||||
if (psm.cur_note!=&psm.head)
|
||||
LBEqu(&psm.cur_note->flags,PSMf_SEL,a2&SCF_SHIFT);
|
||||
LBEqu(&psm.cur_note->flags,PSMf_SEL,arg2&SCF_SHIFT);
|
||||
}
|
||||
} else {
|
||||
if (psm.cur_note->last!=&psm.head) {
|
||||
psm.cur_note=psm.cur_note->last;
|
||||
if (psm.cur_note!=&psm.head)
|
||||
LBEqu(&psm.cur_note->flags,PSMf_SEL,a2&SCF_SHIFT);
|
||||
LBEqu(&psm.cur_note->flags,PSMf_SEL,arg2&SCF_SHIFT);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SC_CURSOR_RIGHT:
|
||||
if (a2&SCF_CTRL) {
|
||||
if (arg2&SCF_CTRL) {
|
||||
while (psm.cur_note!=&psm.head) {
|
||||
if (psm.cur_note!=&psm.head)
|
||||
LBEqu(&psm.cur_note->flags,PSMf_SEL,a2&SCF_SHIFT);
|
||||
LBEqu(&psm.cur_note->flags,PSMf_SEL,arg2&SCF_SHIFT);
|
||||
psm.cur_note=psm.cur_note->next;
|
||||
}
|
||||
} else {
|
||||
if (psm.cur_note!=&psm.head) {
|
||||
if (psm.cur_note!=&psm.head)
|
||||
LBEqu(&psm.cur_note->flags,PSMf_SEL,a2&SCF_SHIFT);
|
||||
LBEqu(&psm.cur_note->flags,PSMf_SEL,arg2&SCF_SHIFT);
|
||||
psm.cur_note=psm.cur_note->next;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SC_DELETE:
|
||||
if (a2&SCF_SHIFT)
|
||||
if (arg2&SCF_SHIFT)
|
||||
PsmCutToClipboard;
|
||||
else {
|
||||
tmpn=psm.cur_note;
|
||||
@@ -576,9 +554,9 @@ mo_got_msg:
|
||||
}
|
||||
break;
|
||||
case SC_INS:
|
||||
if (a2&SCF_SHIFT)
|
||||
if (arg2&SCF_SHIFT)
|
||||
PsmPasteClipboard;
|
||||
else if (a2&SCF_CTRL)
|
||||
else if (arg2&SCF_CTRL)
|
||||
PsmCopyToClipboard;
|
||||
break;
|
||||
case SC_F1:
|
||||
@@ -615,7 +593,7 @@ mo_got_msg:
|
||||
if (filename) {
|
||||
psm.scrn_x=0;
|
||||
psm_duration=1.0;
|
||||
psm_octave=3;
|
||||
psm_octave=4;
|
||||
PsmSongDel(&psm.head);
|
||||
psm.cur_note=&psm.head;
|
||||
PsmLoadSong(filename,&psm_octave,&psm_duration);
|
||||
@@ -645,7 +623,7 @@ mo_got_msg:
|
||||
Free(filename);
|
||||
filename=NULL;
|
||||
psm_duration=1.0;
|
||||
psm_octave=3;
|
||||
psm_octave=4;
|
||||
PsmSongDel(&psm.head);
|
||||
psm.cur_note=&psm.head;
|
||||
psm.scrn_x=0;
|
||||
@@ -664,19 +642,18 @@ mo_got_msg:
|
||||
while (tmpn!=&psm.head) {
|
||||
if (tmpn->type!=PSMT_METER) {
|
||||
timeout_val=cnts.jiffies;
|
||||
if (ip.pos_text.y-Fs->win_top<18)
|
||||
msg_code=ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN|
|
||||
1<<MSG_IP_L_DOWN|1<<MSG_IP_R_UP|1<<MSG_CMD);
|
||||
if (ms.pos_text.y-Fs->win_top<18)
|
||||
msg_code=ScanMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|
|
||||
1<<MSG_MS_L_DOWN|1<<MSG_MS_R_UP|1<<MSG_CMD);
|
||||
else
|
||||
msg_code=ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN|
|
||||
1<<MSG_IP_L_DOWN|1<<MSG_CMD);
|
||||
msg_code=ScanMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|
|
||||
1<<MSG_MS_L_DOWN|1<<MSG_CMD);
|
||||
if (msg_code) {
|
||||
f=0;
|
||||
Snd(0);
|
||||
Snd;
|
||||
psm.playing=FALSE;
|
||||
was_playing=TRUE;
|
||||
if (ip.pos_text.y-Fs->win_top>=18 &&
|
||||
msg_code==MSG_IP_L_DOWN)
|
||||
if (ms.pos_text.y-Fs->win_top>=18 &&
|
||||
msg_code==MSG_MS_L_DOWN)
|
||||
goto mo_start;
|
||||
else
|
||||
goto mo_got_msg;
|
||||
@@ -685,16 +662,7 @@ mo_got_msg:
|
||||
psm.scrn_x+=tmpn->x-0.33*GR_WIDTH;
|
||||
if (PsmHasWords(tmpn->word))
|
||||
"%s",tmpn->word;
|
||||
note=tmpn->note;
|
||||
octave=tmpn->octave;
|
||||
if (note!=NOTE_REST)
|
||||
f=Note2Freq(note,octave);
|
||||
else
|
||||
f=-1; //rest
|
||||
if (f>0)
|
||||
Snd(f);
|
||||
else
|
||||
Snd(0);
|
||||
Snd(tmpn->ona);
|
||||
|
||||
music.tempo=4.4*tempo_state.tempo/TEMPO_RANGE+0.5;
|
||||
music.stacatto_factor=
|
||||
@@ -709,7 +677,7 @@ mo_got_msg:
|
||||
d*(1.0-music.stacatto_factor);
|
||||
}
|
||||
SleepUntil(timeout_val);
|
||||
Snd(0);
|
||||
Snd;
|
||||
SleepUntil(timeout_val2);
|
||||
}
|
||||
tmpn=tmpn->next;
|
||||
@@ -719,8 +687,7 @@ mo_got_msg:
|
||||
psm.playing=FALSE;
|
||||
PsmMenu(psm_octave);
|
||||
col=0;
|
||||
f=0;
|
||||
Snd(0);
|
||||
Snd;
|
||||
break;
|
||||
case CH_BACKSPACE:
|
||||
tmpn=psm.cur_note->last;
|
||||
@@ -739,7 +706,7 @@ mo_got_msg:
|
||||
else {
|
||||
psm.record_entry->checked=TRUE;
|
||||
psm_duration=1.0;
|
||||
psm_octave=3;
|
||||
psm_octave=4;
|
||||
psm.scrn_x=0;
|
||||
}
|
||||
PsmMenu(psm_octave);
|
||||
@@ -756,57 +723,55 @@ mo_got_msg:
|
||||
break;
|
||||
case MSG_KEY_UP:
|
||||
evt_time=tS;
|
||||
f=0;
|
||||
break;
|
||||
case MSG_IP_MOVE:
|
||||
if (a2>18*FONT_HEIGHT)
|
||||
case MSG_MS_MOVE:
|
||||
if (arg2>18*FONT_HEIGHT)
|
||||
Fs->win_inhibit=WIG_USER_TASK_DFT;
|
||||
else
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER
|
||||
-WIF_FOCUS_TASK_MENU-WIF_SELF_CTRLS;
|
||||
break;
|
||||
case MSG_IP_L_DOWN:
|
||||
PsmDownKey(a1,a2);
|
||||
PsmLeftClick(a1,a2);
|
||||
case MSG_MS_L_DOWN:
|
||||
PsmDownKey(arg1,arg2);
|
||||
PsmLeftClick(arg1,arg2);
|
||||
break;
|
||||
case MSG_IP_L_UP:
|
||||
PsmUpKey(a1,a2);
|
||||
case MSG_MS_L_UP:
|
||||
PsmUpKey(arg1,arg2);
|
||||
break;
|
||||
default:
|
||||
PsmRightClick(a1,a2);
|
||||
PsmRightClick(arg1,arg2);
|
||||
}
|
||||
if (f!=last_f) {
|
||||
if (f>0) {
|
||||
st=LstSub(note,psm_note_lst);
|
||||
Snd(f);
|
||||
} else {
|
||||
if (f<0)
|
||||
st="R";
|
||||
else
|
||||
if (is_null)
|
||||
ona=ONA_REST;
|
||||
if (ona!=last_ona || is_null!=was_null) {
|
||||
if (ona==ONA_REST) {
|
||||
if (is_null)
|
||||
st="";
|
||||
Snd(0);
|
||||
}
|
||||
else
|
||||
st="R";
|
||||
} else
|
||||
st=LstSub(Ona2Note(ona),psm_note_lst);
|
||||
Snd(ona);
|
||||
if (psm.record_entry->checked) {
|
||||
if (last_f) {
|
||||
if (!was_null) {
|
||||
music.tempo=4.4*tempo_state.tempo/TEMPO_RANGE+0.5;
|
||||
music.stacatto_factor=0.88*tempo_state.stacatto/TEMPO_RANGE+0.12;
|
||||
|
||||
tmpn->duration=PsmCvtDuration(
|
||||
music.tempo*(evt_time-note_down_time));
|
||||
PsmSetWidth(tmpn);
|
||||
QueIns(tmpn,psm.cur_note->last);
|
||||
}
|
||||
if (f) {
|
||||
if (!is_null) {
|
||||
note_down_time=tS;
|
||||
tmpn=CAlloc(sizeof(PsmNote));
|
||||
tmpn->type=PSMT_NOTE;
|
||||
tmpn->note=note;
|
||||
tmpn->octave=octave;
|
||||
tmpn->ona=ona;
|
||||
if (st[1]=='#')
|
||||
Bts(&tmpn->flags,PSMf_SHARP);
|
||||
}
|
||||
}
|
||||
last_f=f;
|
||||
last_ona=ona;
|
||||
was_null=is_null;
|
||||
"%s",st;
|
||||
col+=StrLen(st);
|
||||
if (col>=Fs->win_width-1) {
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ I32 pen_width;
|
||||
|
||||
CMathODE *ode=NULL;
|
||||
|
||||
CCtrlButtonState run_button,mode_button;
|
||||
CCtrlBttnState run_bttn,mode_bttn;
|
||||
|
||||
CColorROPU32 run_colors[2]={RED,GREEN};
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
}
|
||||
|
||||
if (cursor_mass) {
|
||||
p2.x=ip.pos.x-task->pix_left-task->scroll_x;
|
||||
p2.y=ip.pos.y-task->pix_top-task->scroll_y;
|
||||
p2.x=ms.pos.x-task->pix_left-task->scroll_x;
|
||||
p2.y=ms.pos.y-task->pix_top-task->scroll_y;
|
||||
p2.z=0;
|
||||
D3Sub(&p,&p2,&cursor_mass->state->x);
|
||||
d=10.0*D3NormSqr(&p);
|
||||
|
||||
+53
-53
@@ -1,6 +1,6 @@
|
||||
F64 SpanTime()
|
||||
{
|
||||
if (run_button.state)
|
||||
if (run_bttn.state)
|
||||
return a.elapsed_t+tS-a.start_wall_t;
|
||||
else
|
||||
return a.elapsed_t;
|
||||
@@ -43,8 +43,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
if (cursor_mass) {
|
||||
dc->color=RED;
|
||||
dc->pen_width=2;
|
||||
GrLine3(dc,ip.pos.x-task->pix_left-task->scroll_x,
|
||||
ip.pos.y-task->pix_top-task->scroll_y,0,
|
||||
GrLine3(dc,ms.pos.x-task->pix_left-task->scroll_x,
|
||||
ms.pos.y-task->pix_top-task->scroll_y,0,
|
||||
cursor_mass->x,cursor_mass->y,0);
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ U0 DelMass(MyMass *tmpm)
|
||||
|
||||
U0 DrawSpring(CDC *dc,MyMass *tmpm,I64 x,I64 y)
|
||||
{
|
||||
switch (mode_button.state) {
|
||||
switch (mode_bttn.state) {
|
||||
case MD_CONCRETE:
|
||||
dc->color=LTGRAY;
|
||||
dc->pen_width=2;
|
||||
@@ -156,7 +156,7 @@ U0 PlaceSpring(MyMass *tmpm1,MyMass *tmpm2)
|
||||
MySpring *tmps=CAlloc(sizeof(MySpring));
|
||||
tmps->end1=tmpm1;
|
||||
tmps->end2=tmpm2;
|
||||
switch (mode_button.state) {
|
||||
switch (mode_bttn.state) {
|
||||
case MD_CONCRETE:
|
||||
tmps->base_const = 3.00*SPRING_SCALE;
|
||||
tmps->base_compression_strength=10.00*STRENGTH_SCALE;
|
||||
@@ -208,8 +208,8 @@ U0 AnimateTask(SpanAnimateStruct *a)
|
||||
}
|
||||
AdjustLoads(ode);
|
||||
Refresh; //CMathODE updated once per refresh.
|
||||
if (old_run!=run_button.state) {
|
||||
if (run_button.state) {
|
||||
if (old_run!=run_bttn.state) {
|
||||
if (run_bttn.state) {
|
||||
if (!a->elapsed_t || !a->saved_ode) {
|
||||
Free(a->saved_ode);
|
||||
a->saved_ode=SpanSave(ode);
|
||||
@@ -220,7 +220,7 @@ U0 AnimateTask(SpanAnimateStruct *a)
|
||||
ode->flags|=ODEF_PAUSED;
|
||||
a->elapsed_t+=tS-a->start_wall_t;
|
||||
}
|
||||
old_run=run_button.state;
|
||||
old_run=run_bttn.state;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ U0 Init(SpanAnimateStruct *a)
|
||||
SpanDel(ode);
|
||||
ode=SpanNew;
|
||||
|
||||
run_button.state=0;
|
||||
run_bttn.state=0;
|
||||
Refresh(2); //Allow stop to reg in animate task.
|
||||
|
||||
if (a->saved_ode)
|
||||
@@ -248,16 +248,16 @@ U0 SongTask(I64)
|
||||
music.tempo= 3.636;
|
||||
music.stacatto_factor= 0.902;
|
||||
while (TRUE) {
|
||||
Play("3q.EeDqED2G3DhE");
|
||||
Play("q.EeDqED2G3DhE");
|
||||
Play("q.FeEFEqF2G3EhF");
|
||||
Play("q.FeEFEqF2G3EhF");
|
||||
Play("5q.EeDqED4G5DhE");
|
||||
Play("5q.EeDqED4G5DhE");
|
||||
Play("5q.FeEFEqF4G5EhF");
|
||||
Play("5q.FeEFEqF4G5EhF");
|
||||
}
|
||||
}
|
||||
|
||||
U0 Span()
|
||||
{
|
||||
I64 msg_code,a1,a2;
|
||||
I64 msg_code,arg1,arg2;
|
||||
MyMass *tmpm1=NULL,*tmpm2=NULL;
|
||||
MySpring *tmps;
|
||||
CCtrl *bt_run,*bt_mode;
|
||||
@@ -272,10 +272,10 @@ U0 Span()
|
||||
DocCursor;
|
||||
Fs->song_task=Spawn(&SongTask,NULL,"Song",,Fs);
|
||||
|
||||
bt_run =CtrlButtonNew(0,0, 80,,
|
||||
2,"Stopped\0Running\0",run_colors,&run_button);
|
||||
bt_mode=CtrlButtonNew(0,3.0*FONT_HEIGHT,80,,
|
||||
MD_NUM_MODES,Define("ST_SPAN_MODES"),mode_colors,&mode_button);
|
||||
bt_run =CtrlBttnNew(0,0, 80,,
|
||||
2,"Stopped\0Running\0",run_colors,&run_bttn);
|
||||
bt_mode=CtrlBttnNew(0,3.0*FONT_HEIGHT,80,,
|
||||
MD_NUM_MODES,Define("ST_SPAN_MODES"),mode_colors,&mode_bttn);
|
||||
a.saved_ode=NULL;
|
||||
|
||||
Fs->win_inhibit|=WIG_DBL_CLICK;
|
||||
@@ -323,30 +323,30 @@ U0 Span()
|
||||
|
||||
try {
|
||||
while (TRUE) {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_DOWN|1<<MSG_IP_R_DOWN|
|
||||
1<<MSG_IP_L_UP|1<<MSG_KEY_DOWN|1<<MSG_IP_MOVE);
|
||||
msg_code=GetMsg(&arg1,&arg2,1<<MSG_MS_L_DOWN|1<<MSG_MS_R_DOWN|
|
||||
1<<MSG_MS_L_UP|1<<MSG_KEY_DOWN|1<<MSG_MS_MOVE);
|
||||
DCFill(dc);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_L_DOWN:
|
||||
case MSG_MS_L_DOWN:
|
||||
cursor_mass=tmpm1=tmpm2=NULL;
|
||||
switch (mode_button.state) {
|
||||
switch (mode_bttn.state) {
|
||||
case MD_MASS:
|
||||
PlaceMass(a1,a2);
|
||||
PlaceMass(arg1,arg2);
|
||||
break;
|
||||
case MD_CONCRETE:
|
||||
case MD_STEEL:
|
||||
case MD_WIRE:
|
||||
tmpm1=MassFind(ode,a1,a2);
|
||||
tmpm1=MassFind(ode,arg1,arg2);
|
||||
break;
|
||||
case MD_MOVE:
|
||||
if (run_button.state)
|
||||
cursor_mass=MassFind(ode,a1,a2);
|
||||
if (run_bttn.state)
|
||||
cursor_mass=MassFind(ode,arg1,arg2);
|
||||
else
|
||||
if (tmpm1=MassFind(ode,a1,a2))
|
||||
MoveMass(tmpm1,a1,a2);
|
||||
if (tmpm1=MassFind(ode,arg1,arg2))
|
||||
MoveMass(tmpm1,arg1,arg2);
|
||||
break;
|
||||
case MD_DELETE:
|
||||
MassOrSpringFind(ode,&tmpm1,&tmps,a1,a2);
|
||||
MassOrSpringFind(ode,&tmpm1,&tmps,arg1,arg2);
|
||||
if (tmpm1)
|
||||
DelMass(tmpm1);
|
||||
if (tmps)
|
||||
@@ -354,44 +354,44 @@ U0 Span()
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_L_UP:
|
||||
switch (mode_button.state) {
|
||||
case MSG_MS_L_UP:
|
||||
switch (mode_bttn.state) {
|
||||
case MD_CONCRETE:
|
||||
case MD_STEEL:
|
||||
case MD_WIRE:
|
||||
if (tmpm1 && (tmpm2=MassFind(ode,a1,a2)) && tmpm1!=tmpm2)
|
||||
if (tmpm1 && (tmpm2=MassFind(ode,arg1,arg2)) && tmpm1!=tmpm2)
|
||||
PlaceSpring(tmpm1,tmpm2);
|
||||
break;
|
||||
case MD_MOVE:
|
||||
if (!run_button.state && tmpm1)
|
||||
MoveMass(tmpm1,a1,a2);
|
||||
if (!run_bttn.state && tmpm1)
|
||||
MoveMass(tmpm1,arg1,arg2);
|
||||
break;
|
||||
}
|
||||
cursor_mass=tmpm1=tmpm2=NULL;
|
||||
break;
|
||||
case MSG_IP_MOVE:
|
||||
switch (mode_button.state) {
|
||||
case MSG_MS_MOVE:
|
||||
switch (mode_bttn.state) {
|
||||
case MD_MOVE:
|
||||
if (!run_button.state && tmpm1)
|
||||
MoveMass(tmpm1,a1,a2);
|
||||
if (!run_bttn.state && tmpm1)
|
||||
MoveMass(tmpm1,arg1,arg2);
|
||||
break;
|
||||
case MD_CONCRETE:
|
||||
case MD_STEEL:
|
||||
case MD_WIRE:
|
||||
if (tmpm1) {
|
||||
DrawSpring(dc,tmpm1,a1,a2);
|
||||
DrawSpring(dc,tmpm1,arg1,arg2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_R_DOWN:
|
||||
mode_button.state++;
|
||||
if (mode_button.state>=MD_NUM_MODES)
|
||||
mode_button.state=0;
|
||||
case MSG_MS_R_DOWN:
|
||||
mode_bttn.state++;
|
||||
if (mode_bttn.state>=MD_NUM_MODES)
|
||||
mode_bttn.state=0;
|
||||
cursor_mass=tmpm1=tmpm2=NULL;
|
||||
break;
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
case '\n':
|
||||
if (!SpanTime || !a.saved_ode) {
|
||||
Free(a.saved_ode);
|
||||
@@ -420,25 +420,25 @@ U0 Span()
|
||||
SpanWrite(ode);
|
||||
break;
|
||||
case CH_SPACE:
|
||||
run_button.state=!run_button.state;
|
||||
run_bttn.state=!run_bttn.state;
|
||||
break;
|
||||
case 'c':
|
||||
mode_button.state=MD_CONCRETE;
|
||||
mode_bttn.state=MD_CONCRETE;
|
||||
break;
|
||||
case 's':
|
||||
mode_button.state=MD_STEEL;
|
||||
mode_bttn.state=MD_STEEL;
|
||||
break;
|
||||
case 'w':
|
||||
mode_button.state=MD_WIRE;
|
||||
mode_bttn.state=MD_WIRE;
|
||||
break;
|
||||
case 'm':
|
||||
mode_button.state=MD_MASS;
|
||||
mode_bttn.state=MD_MASS;
|
||||
break;
|
||||
case 'v':
|
||||
mode_button.state=MD_MOVE;
|
||||
mode_bttn.state=MD_MOVE;
|
||||
break;
|
||||
case 'd':
|
||||
mode_button.state=MD_DELETE;
|
||||
mode_bttn.state=MD_DELETE;
|
||||
break;
|
||||
case CH_ESC:
|
||||
if (!SpanTime || !a.saved_ode) {
|
||||
@@ -459,8 +459,8 @@ span_done: //Don't goto out of try
|
||||
PutExcept;
|
||||
DocClear;
|
||||
SettingsPop;
|
||||
CtrlButtonDel(bt_run);
|
||||
CtrlButtonDel(bt_mode);
|
||||
CtrlBttnDel(bt_run);
|
||||
CtrlBttnDel(bt_mode);
|
||||
SpanDel(ode);
|
||||
DCFill(dc);
|
||||
DCDel(dc);
|
||||
|
||||
+57
-56
@@ -28,7 +28,7 @@ class MySpring:CSpring
|
||||
#define MMD_NUM_MODES 2
|
||||
CColorROPU32 main_mode_colors[MMD_NUM_MODES]={LTRED,LTGREEN};
|
||||
DefineLstLoad("ST_MAIN_MODES","Edit\0Play\0");
|
||||
CCtrlButtonState main_mode_button;
|
||||
CCtrlBttnState main_mode_bttn;
|
||||
|
||||
//Edit Modes
|
||||
#define EMD_MASS 0
|
||||
@@ -39,7 +39,7 @@ CCtrlButtonState main_mode_button;
|
||||
#define EMD_NUM_MODES 5
|
||||
CColorROPU32 edit_mode_colors[EMD_NUM_MODES]={LTGRAY,LTCYAN,CYAN,YELLOW,LTBLUE};
|
||||
DefineLstLoad("ST_EDIT_MODES","Mass\0Spring\0Connector\0Thruster\0Move\0");
|
||||
CCtrlButtonState edit_mode_button;
|
||||
CCtrlBttnState edit_mode_bttn;
|
||||
|
||||
CTask *task;
|
||||
F64 zoom;
|
||||
@@ -64,14 +64,14 @@ U0 W2S(F64 wx,F64 wy,F64 *_sx,F64 *_sy)
|
||||
U0 Zoom(F64 d)
|
||||
{
|
||||
F64 sx,sy,wx,wy;
|
||||
I64 i,x=ip.pos.x,y=ip.pos.y;
|
||||
I64 i,x=ms.pos.x,y=ms.pos.y;
|
||||
d=Exp(Ln(d)/ZOOM_STEPS);
|
||||
for (i=0;i<ZOOM_STEPS;i++) {
|
||||
S2W(x,y,&wx,&wy);
|
||||
zoom=Clamp(zoom*d,0.02,50);
|
||||
W2S(wx,wy,&sx,&sy);
|
||||
task->scroll_x=ip.pos.x-sx-task->pix_left;
|
||||
task->scroll_y=ip.pos.y-sy-task->pix_top;
|
||||
task->scroll_x=ms.pos.x-sx-task->pix_left;
|
||||
task->scroll_y=ms.pos.y-sy-task->pix_top;
|
||||
Sleep(10);
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ U0 DrawIt(CTask *,CDC *dc)
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
Mat4x4Scale(dc->r,zoom);
|
||||
|
||||
switch (main_mode_button.state) {
|
||||
switch (main_mode_bttn.state) {
|
||||
case MMD_EDIT:
|
||||
task->text_attr=DKGRAY<<4+WHITE;
|
||||
dc->color=BLACK;
|
||||
@@ -105,12 +105,12 @@ U0 DrawIt(CTask *,CDC *dc)
|
||||
break;
|
||||
}
|
||||
|
||||
if (main_mode_button.state==MMD_EDIT) {
|
||||
if (edit_mode_button.state==EMD_CONNECTOR) {
|
||||
if (main_mode_bttn.state==MMD_EDIT) {
|
||||
if (edit_mode_bttn.state==EMD_CONNECTOR) {
|
||||
dc->color=CYAN;
|
||||
S2W(FONT_WIDTH*11,FONT_HEIGHT*7,&x1,&y1);
|
||||
GrPutChar3(dc,x1,y1,0,next_action_key);
|
||||
} else if (edit_mode_button.state==EMD_THRUSTER) {
|
||||
} else if (edit_mode_bttn.state==EMD_THRUSTER) {
|
||||
dc->color=YELLOW;
|
||||
S2W(FONT_WIDTH*11,FONT_HEIGHT*7,&x1,&y1);
|
||||
GrPutChar3(dc,x1,y1,0,next_action_key);
|
||||
@@ -164,7 +164,7 @@ U0 DrawIt(CTask *,CDC *dc)
|
||||
}
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
}
|
||||
SpriteZ3B(dc,x1,y1,0,$IB,"<3>",BI=3$,é);
|
||||
Sprite3ZB(dc,x1,y1,0,$IB,"<3>",BI=3$,é);
|
||||
if (zoom>0.5) {
|
||||
dc->color=YELLOW;
|
||||
GrPutChar3(dc,(x1*7+x2)/8,(y1*7+y2)/8,0,tmps->action_key);
|
||||
@@ -210,7 +210,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
|
||||
tmps=ode->next_spring;
|
||||
while (tmps!=&ode->next_spring) {
|
||||
if (main_mode_button.state==MMD_PLAY && tmps->type==EMD_THRUSTER &&
|
||||
if (main_mode_bttn.state==MMD_PLAY && tmps->type==EMD_THRUSTER &&
|
||||
Bt(kbd.down_bitmap,action_scan_codes[tmps->action_key-'0'])) {
|
||||
D3Sub(&p,&tmps->end2->state->x,&tmps->end1->state->x);
|
||||
D3Unit(&p);
|
||||
@@ -320,7 +320,7 @@ U0 CleanUp()
|
||||
|
||||
U0 PlayShip()
|
||||
{
|
||||
I64 a1,a2;
|
||||
I64 arg1,arg2;
|
||||
F64 last_noise=0;
|
||||
Bool okay;
|
||||
ode->flags&=~ODEF_PAUSED;
|
||||
@@ -353,14 +353,14 @@ U0 PlayShip()
|
||||
);
|
||||
DocClear;
|
||||
try {
|
||||
while (main_mode_button.state==MMD_PLAY) {
|
||||
while (main_mode_bttn.state==MMD_PLAY) {
|
||||
BreakConnectors;
|
||||
switch (ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP)) {
|
||||
switch (ScanMsg(&arg1,&arg2,1<<MSG_KEY_DOWN|1<<MSG_KEY_UP)) {
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
case '0'...'9':
|
||||
if (tS>last_noise+0.25) {
|
||||
Noise(250,40,200);
|
||||
Noise(250,18,46);
|
||||
last_noise=tS;
|
||||
}
|
||||
break;
|
||||
@@ -378,8 +378,8 @@ U0 PlayShip()
|
||||
ode->drag_v3=0.0001;
|
||||
break;
|
||||
case CH_SPACE:
|
||||
if (++main_mode_button.state==MMD_NUM_MODES)
|
||||
main_mode_button.state=0;
|
||||
if (++main_mode_bttn.state==MMD_NUM_MODES)
|
||||
main_mode_bttn.state=0;
|
||||
GetMsg(,,1<<MSG_KEY_UP);
|
||||
goto ps_done;
|
||||
case CH_SHIFT_ESC:
|
||||
@@ -388,7 +388,7 @@ U0 PlayShip()
|
||||
}
|
||||
break;
|
||||
case MSG_KEY_UP:
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
case 'd':
|
||||
ode->drag_v2=0.000002;
|
||||
ode->drag_v3=0.0000001;
|
||||
@@ -411,12 +411,12 @@ ps_done: //Don't goto out of try
|
||||
|
||||
U0 EditShip()
|
||||
{
|
||||
I64 a1,a2;
|
||||
I64 arg1,arg2;
|
||||
F64 wx,wy;
|
||||
Bool okay;
|
||||
MyMass *tmpm1=NULL,*tmpm2=NULL;
|
||||
CCtrl *bt_edit_mode=CtrlButtonNew(0,5*FONT_HEIGHT+4,80,,EMD_NUM_MODES,
|
||||
Define("ST_EDIT_MODES"),edit_mode_colors,&edit_mode_button);
|
||||
CCtrl *bt_edit_mode=CtrlBttnNew(0,5*FONT_HEIGHT+4,80,,EMD_NUM_MODES,
|
||||
Define("ST_EDIT_MODES"),edit_mode_colors,&edit_mode_bttn);
|
||||
ode->flags|=ODEF_PAUSED;
|
||||
MenuPush(
|
||||
"File {"
|
||||
@@ -453,13 +453,14 @@ U0 EditShip()
|
||||
);
|
||||
DocClear;
|
||||
try {
|
||||
while (main_mode_button.state==MMD_EDIT) {
|
||||
switch (ScanMsg(&a1,&a2,1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|1<<MSG_IP_R_DOWN|
|
||||
1<<MSG_IP_MOVE|1<<MSG_KEY_DOWN|1<<MSG_KEY_UP)) {
|
||||
case MSG_IP_L_DOWN:
|
||||
switch (edit_mode_button.state) {
|
||||
while (main_mode_bttn.state==MMD_EDIT) {
|
||||
switch (ScanMsg(&arg1,&arg2,
|
||||
1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|1<<MSG_MS_R_DOWN|
|
||||
1<<MSG_MS_MOVE|1<<MSG_KEY_DOWN|1<<MSG_KEY_UP)) {
|
||||
case MSG_MS_L_DOWN:
|
||||
switch (edit_mode_bttn.state) {
|
||||
case EMD_MASS:
|
||||
S2W(ip.pos.x,ip.pos.y,&wx,&wy);
|
||||
S2W(ms.pos.x,ms.pos.y,&wx,&wy);
|
||||
tmpm1=PlaceMass(wx,wy);
|
||||
if (ode->next_mass==tmpm1)
|
||||
tmpm1->img=$IB,"<1>",BI=1$;
|
||||
@@ -471,26 +472,26 @@ U0 EditShip()
|
||||
case EMD_CONNECTOR:
|
||||
case EMD_THRUSTER:
|
||||
case EMD_MOVE:
|
||||
S2W(ip.pos.x,ip.pos.y,&wx,&wy);
|
||||
S2W(ms.pos.x,ms.pos.y,&wx,&wy);
|
||||
tmpm1=MassFind(ode,wx,wy);
|
||||
tmpm2=NULL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_L_UP:
|
||||
switch (edit_mode_button.state) {
|
||||
case MSG_MS_L_UP:
|
||||
switch (edit_mode_bttn.state) {
|
||||
case EMD_MASS:
|
||||
break;
|
||||
case EMD_SPRING:
|
||||
case EMD_CONNECTOR:
|
||||
case EMD_THRUSTER:
|
||||
S2W(ip.pos.x,ip.pos.y,&wx,&wy);
|
||||
S2W(ms.pos.x,ms.pos.y,&wx,&wy);
|
||||
if (tmpm1 && (tmpm2=MassFind(ode,wx,wy)) && tmpm1!=tmpm2)
|
||||
PlaceSpring(tmpm1,tmpm2,edit_mode_button.state);
|
||||
PlaceSpring(tmpm1,tmpm2,edit_mode_bttn.state);
|
||||
tmpm1=tmpm2=NULL;
|
||||
break;
|
||||
case EMD_MOVE:
|
||||
S2W(ip.pos.x,ip.pos.y,&wx,&wy);
|
||||
S2W(ms.pos.x,ms.pos.y,&wx,&wy);
|
||||
if (tmpm1) {
|
||||
tmpm1->x=wx;
|
||||
tmpm1->y=wy;
|
||||
@@ -501,10 +502,10 @@ U0 EditShip()
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_MOVE:
|
||||
switch (edit_mode_button.state) {
|
||||
case MSG_MS_MOVE:
|
||||
switch (edit_mode_bttn.state) {
|
||||
case EMD_MOVE:
|
||||
S2W(ip.pos.x,ip.pos.y,&wx,&wy);
|
||||
S2W(ms.pos.x,ms.pos.y,&wx,&wy);
|
||||
if (tmpm1) {
|
||||
tmpm1->x=wx;
|
||||
tmpm1->y=wy;
|
||||
@@ -514,20 +515,20 @@ U0 EditShip()
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_R_DOWN:
|
||||
if (++edit_mode_button.state==EMD_NUM_MODES)
|
||||
edit_mode_button.state=0;
|
||||
case MSG_MS_R_DOWN:
|
||||
if (++edit_mode_bttn.state==EMD_NUM_MODES)
|
||||
edit_mode_bttn.state=0;
|
||||
break;
|
||||
case MSG_IP_R_UP:
|
||||
case MSG_MS_R_UP:
|
||||
break;
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
case '\n':
|
||||
CleanUp;
|
||||
Init;
|
||||
break;
|
||||
case '0'...'9':
|
||||
next_action_key=a1;
|
||||
next_action_key=arg1;
|
||||
break;
|
||||
case 'c':
|
||||
CenterMasses;
|
||||
@@ -538,19 +539,19 @@ U0 EditShip()
|
||||
ode->drag_v3=0.0001;
|
||||
break;
|
||||
case 'v':
|
||||
edit_mode_button.state=EMD_MOVE;
|
||||
edit_mode_bttn.state=EMD_MOVE;
|
||||
break;
|
||||
case 'm':
|
||||
edit_mode_button.state=EMD_MASS;
|
||||
edit_mode_bttn.state=EMD_MASS;
|
||||
break;
|
||||
case 'n':
|
||||
edit_mode_button.state=EMD_CONNECTOR;
|
||||
edit_mode_bttn.state=EMD_CONNECTOR;
|
||||
break;
|
||||
case 's':
|
||||
edit_mode_button.state=EMD_SPRING;
|
||||
edit_mode_bttn.state=EMD_SPRING;
|
||||
break;
|
||||
case 't':
|
||||
edit_mode_button.state=EMD_THRUSTER;
|
||||
edit_mode_bttn.state=EMD_THRUSTER;
|
||||
break;
|
||||
case 'z':
|
||||
Spawn(&Zoom,2.0(I64));
|
||||
@@ -559,8 +560,8 @@ U0 EditShip()
|
||||
Spawn(&Zoom,0.5(I64));
|
||||
break;
|
||||
case CH_SPACE:
|
||||
if (++main_mode_button.state==MMD_NUM_MODES)
|
||||
main_mode_button.state=0;
|
||||
if (++main_mode_bttn.state==MMD_NUM_MODES)
|
||||
main_mode_bttn.state=0;
|
||||
GetMsg(,,1<<MSG_KEY_UP);
|
||||
goto es_done;
|
||||
case CH_SHIFT_ESC:
|
||||
@@ -569,7 +570,7 @@ U0 EditShip()
|
||||
}
|
||||
break;
|
||||
case MSG_KEY_UP:
|
||||
switch (a1) {
|
||||
switch (arg1) {
|
||||
case 'd':
|
||||
ode->flags|=ODEF_PAUSED;
|
||||
ode->drag_v2=0.000002;
|
||||
@@ -587,7 +588,7 @@ es_done: //Don't goto out of try
|
||||
okay=FALSE;
|
||||
}
|
||||
MenuPop;
|
||||
CtrlButtonDel(bt_edit_mode);
|
||||
CtrlBttnDel(bt_edit_mode);
|
||||
if (!okay)
|
||||
throw;
|
||||
}
|
||||
@@ -596,7 +597,7 @@ U0 Strut()
|
||||
{
|
||||
CCtrl *bt_main_mode;
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->win_inhibit|=WIF_SELF_IP_L|WIF_SELF_IP_R|WIG_DBL_CLICK;
|
||||
Fs->win_inhibit|=WIF_SELF_MS_L|WIF_SELF_MS_R|WIG_DBL_CLICK;
|
||||
AutoComplete;
|
||||
WinBorder;
|
||||
WinMax;
|
||||
@@ -613,9 +614,9 @@ U0 Strut()
|
||||
"Press $$GREEN$$<z>$$FG$$ or $$GREEN$$<SHIFT-Z>$$FG$$ to zoom in/out.\n\n";
|
||||
|
||||
PressAKey;
|
||||
bt_main_mode=CtrlButtonNew(
|
||||
bt_main_mode=CtrlBttnNew(
|
||||
(GR_WIDTH-4*FONT_WIDTH-16)>>1,1*FONT_HEIGHT+4,80,,MMD_NUM_MODES,
|
||||
Define("ST_MAIN_MODES"),main_mode_colors,&main_mode_button);
|
||||
Define("ST_MAIN_MODES"),main_mode_colors,&main_mode_bttn);
|
||||
DocClear;
|
||||
Init;
|
||||
Fs->draw_it=&DrawIt;
|
||||
@@ -629,6 +630,6 @@ U0 Strut()
|
||||
Fs->catch_except=TRUE;
|
||||
}
|
||||
SettingsPop;
|
||||
CtrlButtonDel(bt_main_mode);
|
||||
CtrlBttnDel(bt_main_mode);
|
||||
}
|
||||
| ||||