TempleOSCDV4.12.ISO
This commit is contained in:
1 parent
93ca216483
commit
b84bbff6db
381 files changed
+18356
-18798
No files matched your search
@@ -1,158 +1,164 @@
|
||||
U0 TanksPlot()
|
||||
U0 PlayerIndirect()
|
||||
{
|
||||
Unit *tempu=NULL;
|
||||
I64 msg_code,a1,a2;
|
||||
Unit *tmpu=NULL;
|
||||
I64 i,remaining=0,msg_code,a1,a2;
|
||||
F64 target_x,target_y;
|
||||
SetViewPlayer(cur_player);
|
||||
while (TRUE) {
|
||||
ViewPlayerSet(cur_player);
|
||||
for (i=0;i<MAX_UNITS;i++) {
|
||||
tmpu=&units[cur_player][i];
|
||||
if (tmpu->life>0 && tmpu->indirect_fire)
|
||||
remaining++;
|
||||
}
|
||||
while (remaining) {
|
||||
if (!alive_cnt[0] || !alive_cnt[1])
|
||||
throw('GameOver',TRUE);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|
|
||||
1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|
|
||||
1<<MSG_IP_R_UP);
|
||||
switch (msg_code) {
|
||||
case MSG_KEY_DOWN:
|
||||
HandleChar(a1);
|
||||
CharDo(a1);
|
||||
break;
|
||||
case MSG_IP_L_DOWN:
|
||||
if (CursorInWindow(Fs,a1,a2)) {
|
||||
UpdateCursor(Fs,a1,a2);
|
||||
if (tempu=FindUnit(cursor_row,cursor_col)) {
|
||||
if (tempu->player==enemy_player || tempu->fired ||
|
||||
!tempu->indirect_fire)
|
||||
tempu=NULL;
|
||||
if (CursorInWin(Fs,a1,a2)) {
|
||||
a1-=x0; a2-=y0;
|
||||
CursorUpdate(Fs,a1,a2);
|
||||
if (tmpu=UnitFind(cursor_row,cursor_col)) {
|
||||
if (tmpu->player==enemy_player || tmpu->fired ||
|
||||
!tmpu->indirect_fire)
|
||||
tmpu=NULL;
|
||||
else {
|
||||
RowCol2XY(&fire_radius_x,&fire_radius_y,tempu->row,tempu->col);
|
||||
fire_radius=tempu->range*2*HEX_RADIUS;
|
||||
RowCol2XY(&fire_radius_x,&fire_radius_y,tmpu->row,tmpu->col);
|
||||
fire_radius=tmpu->range*2*HEX_RADIUS;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MSG_IP_L_UP:
|
||||
if (CursorInWindow(Fs,a1,a2)) {
|
||||
UpdateCursor(Fs,a1,a2);
|
||||
if (CursorInWin(Fs,a1,a2)) {
|
||||
a1-=x0; a2-=y0;
|
||||
CursorUpdate(Fs,a1,a2);
|
||||
RowCol2XY(&target_x,&target_y,cursor_row,cursor_col);
|
||||
if (!tempu)
|
||||
if (!tmpu)
|
||||
Beep;
|
||||
else {
|
||||
if (Sqrt(Sqr(fire_radius_x-target_x)+Sqr(fire_radius_y-target_y))>
|
||||
fire_radius)
|
||||
Beep;
|
||||
else
|
||||
PlotShot(tempu,cursor_row,cursor_col);
|
||||
else {
|
||||
IndirectAdd(tmpu,cursor_row,cursor_col);
|
||||
remaining--;
|
||||
}
|
||||
}
|
||||
}
|
||||
tempu=NULL;
|
||||
tmpu=NULL;
|
||||
fire_radius=0;
|
||||
break;
|
||||
case MSG_IP_R_UP:
|
||||
if (CursorInWindow(Fs,a1,a2))
|
||||
if (CursorInWin(Fs,a1,a2))
|
||||
throw('PhaseOvr',TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
throw('PhaseOvr',TRUE);
|
||||
}
|
||||
|
||||
U0 TanksMove()
|
||||
U0 PlayerMove()
|
||||
{
|
||||
Unit *tempu=NULL,*target;
|
||||
Unit *tmpu=NULL;
|
||||
I64 msg_code,a1,a2;
|
||||
SetViewPlayer(cur_player);
|
||||
ViewPlayerSet(cur_player);
|
||||
while (TRUE) {
|
||||
if (!alive_cnt[0] || !alive_cnt[1])
|
||||
throw('GameOver',TRUE);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|
|
||||
1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|
|
||||
1<<MSG_IP_R_UP);
|
||||
switch (msg_code) {
|
||||
case MSG_KEY_DOWN:
|
||||
HandleChar(a1);
|
||||
CharDo(a1);
|
||||
break;
|
||||
case MSG_IP_L_DOWN:
|
||||
if (CursorInWindow(Fs,a1,a2)) {
|
||||
UpdateCursor(Fs,a1,a2);
|
||||
if (tempu=FindUnit(cursor_row,cursor_col)) {
|
||||
if (tempu->player==enemy_player || !tempu->remaining_movement)
|
||||
tempu=NULL;
|
||||
if (CursorInWin(Fs,a1,a2)) {
|
||||
a1-=x0; a2-=y0;
|
||||
CursorUpdate(Fs,a1,a2);
|
||||
if (tmpu=UnitFind(cursor_row,cursor_col)) {
|
||||
if (tmpu->player==enemy_player || !tmpu->remaining_movement)
|
||||
tmpu=NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MSG_IP_L_UP:
|
||||
if (CursorInWindow(Fs,a1,a2)) {
|
||||
UpdateCursor(Fs,a1,a2);
|
||||
target=FindUnit(cursor_row,cursor_col);
|
||||
if (!tempu)
|
||||
if (CursorInWin(Fs,a1,a2)) {
|
||||
a1-=x0; a2-=y0;
|
||||
CursorUpdate(Fs,a1,a2);
|
||||
if (!tmpu)
|
||||
Beep;
|
||||
else {
|
||||
if (target)
|
||||
Beep;
|
||||
else
|
||||
MoveUnit(tempu,a1+Fs->horz_scroll.pos,
|
||||
a2+Fs->vert_scroll.pos);
|
||||
UnitMove(tmpu,a1,a2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
tempu=NULL;
|
||||
tmpu=NULL;
|
||||
break;
|
||||
case MSG_IP_R_UP:
|
||||
if (CursorInWindow(Fs,a1,a2))
|
||||
if (CursorInWin(Fs,a1,a2))
|
||||
throw('PhaseOvr',TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U0 TanksFire()
|
||||
U0 PlayerDirect()
|
||||
{
|
||||
Unit *tempu=NULL,*target;
|
||||
Unit *tmpu=NULL,*target;
|
||||
I64 msg_code,a1,a2;
|
||||
SetViewPlayer(cur_player);
|
||||
ViewPlayerSet(cur_player);
|
||||
while (TRUE) {
|
||||
if (!alive_cnt[0] || !alive_cnt[1])
|
||||
throw('GameOver',TRUE);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|
|
||||
1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|
|
||||
1<<MSG_IP_R_UP);
|
||||
switch (msg_code) {
|
||||
case MSG_KEY_DOWN:
|
||||
HandleChar(a1);
|
||||
CharDo(a1);
|
||||
break;
|
||||
case MSG_IP_L_DOWN:
|
||||
if (CursorInWindow(Fs,a1,a2)) {
|
||||
UpdateCursor(Fs,a1,a2);
|
||||
if (tempu=FindUnit(cursor_row,cursor_col)) {
|
||||
if (tempu->player==enemy_player || tempu->fired ||
|
||||
tempu->indirect_fire)
|
||||
tempu=NULL;
|
||||
if (CursorInWin(Fs,a1,a2)) {
|
||||
a1-=x0; a2-=y0;
|
||||
CursorUpdate(Fs,a1,a2);
|
||||
if (tmpu=UnitFind(cursor_row,cursor_col)) {
|
||||
if (tmpu->player==enemy_player || tmpu->fired ||
|
||||
tmpu->indirect_fire)
|
||||
tmpu=NULL;
|
||||
else {
|
||||
RVSetUp(cur_player);
|
||||
RowCol2XY(&fire_radius_x,&fire_radius_y,tempu->row,tempu->col);
|
||||
fire_radius=tempu->range*2*HEX_RADIUS;
|
||||
RecalcVisible(RV_ONE_FRIENDLY_UNIT,tempu);
|
||||
VRSetUp(cur_player);
|
||||
RowCol2XY(&fire_radius_x,&fire_radius_y,tmpu->row,tmpu->col);
|
||||
fire_radius=tmpu->range*2*HEX_RADIUS;
|
||||
VisRecalc(VR_ONE_FRIENDLY_UNIT,tmpu);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MSG_IP_L_UP:
|
||||
if (CursorInWindow(Fs,a1,a2)) {
|
||||
UpdateCursor(Fs,a1,a2);
|
||||
target=FindUnit(cursor_row,cursor_col);
|
||||
if (!tempu)
|
||||
if (CursorInWin(Fs,a1,a2)) {
|
||||
a1-=x0; a2-=y0;
|
||||
CursorUpdate(Fs,a1,a2);
|
||||
target=UnitFind(cursor_row,cursor_col);
|
||||
if (!tmpu)
|
||||
Beep;
|
||||
else {
|
||||
if (!target || target->player!=enemy_player ||
|
||||
!Bt(&target->visible,0))
|
||||
!Bt(&target->vis,0))
|
||||
Beep;
|
||||
else
|
||||
FireShot(tempu,target);
|
||||
RecalcVisible(RV_UPDATE_FRIENDLY_UNIT,tempu);
|
||||
UnitDirectFire(tmpu,target);
|
||||
VisRecalc(VR_UPDATE_FRIENDLY_UNIT,tmpu);
|
||||
}
|
||||
}
|
||||
tempu=NULL;
|
||||
tmpu=NULL;
|
||||
fire_radius=0;
|
||||
break;
|
||||
case MSG_IP_R_UP:
|
||||
if (CursorInWindow(Fs,a1,a2))
|
||||
if (CursorInWin(Fs,a1,a2))
|
||||
throw('PhaseOvr',TRUE);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Unit *FindNearestUnit(I64 row,I64 col,I64 player,Bool in_LOS,F64 range=-1)
|
||||
Unit *UnitNearestFind(I64 row,I64 col,I64 player,Bool in_LOS,F64 range=-1)
|
||||
{
|
||||
I64 i;
|
||||
F64 dd,best_dd=MAX_F64,x1,y1,x2,y2;
|
||||
@@ -23,36 +23,36 @@ Unit *FindNearestUnit(I64 row,I64 col,I64 player,Bool in_LOS,F64 range=-1)
|
||||
return best;
|
||||
}
|
||||
|
||||
U0 TanksPlot()
|
||||
U0 PlayerIndirect()
|
||||
{
|
||||
Unit *target,*tempu;
|
||||
Unit *target,*tmpu;
|
||||
I64 i;
|
||||
for (i=0;i<MAX_UNITS;i++) {
|
||||
CheckUser;
|
||||
tempu=&units[cur_player][i];
|
||||
if (tempu->life>0 && tempu->indirect_fire &&
|
||||
(target=FindNearestUnit(tempu->row,tempu->col,enemy_player,TRUE,
|
||||
tempu->range*2*HEX_RADIUS)))
|
||||
PlotShot(tempu,target->row,target->col);
|
||||
UserChk;
|
||||
tmpu=&units[cur_player][i];
|
||||
if (tmpu->life>0 && tmpu->indirect_fire &&
|
||||
(target=UnitNearestFind(tmpu->row,tmpu->col,enemy_player,TRUE,
|
||||
tmpu->range*2*HEX_RADIUS)))
|
||||
IndirectAdd(tmpu,target->row,target->col);
|
||||
}
|
||||
throw('PhaseOvr',TRUE);
|
||||
}
|
||||
|
||||
U0 TanksMove()
|
||||
U0 PlayerMove()
|
||||
{
|
||||
Unit *target,*tempu;
|
||||
Unit *target,*tmpu;
|
||||
I64 i;
|
||||
F64 x,y;
|
||||
for (i=0;i<MAX_UNITS;i++) {
|
||||
CheckUser;
|
||||
tempu=&units[cur_player][i];
|
||||
if (tempu->life>0) {
|
||||
UserChk;
|
||||
tmpu=&units[cur_player][i];
|
||||
if (tmpu->life>0) {
|
||||
//Cheats because it violates Line-of-Sight
|
||||
if (target=FindNearestUnit(tempu->row,tempu->col,enemy_player,FALSE)) {
|
||||
if (target=UnitNearestFind(tmpu->row,tmpu->col,enemy_player,FALSE)) {
|
||||
RowCol2XY(&x,&y,target->row,target->col);
|
||||
if (!MoveUnit(tempu,x,y)) {
|
||||
RowCol2XY(&x,&y,tempu->row,tempu->col);
|
||||
MoveUnit(tempu,x+RandI16,y+RandI16);
|
||||
if (!UnitMove(tmpu,x,y)) {
|
||||
RowCol2XY(&x,&y,tmpu->row,tmpu->col);
|
||||
UnitMove(tmpu,x+RandI16,y+RandI16);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,18 +60,18 @@ U0 TanksMove()
|
||||
throw('PhaseOvr',TRUE);
|
||||
}
|
||||
|
||||
U0 TanksFire()
|
||||
U0 PlayerDirect()
|
||||
{
|
||||
Unit *target,*tempu;
|
||||
Unit *target,*tmpu;
|
||||
I64 i;
|
||||
for (i=0;i<MAX_UNITS;i++) {
|
||||
CheckUser;
|
||||
tempu=&units[cur_player][i];
|
||||
if (tempu->life>0 && !tempu->indirect_fire &&
|
||||
(target=FindNearestUnit(tempu->row,tempu->col,enemy_player,TRUE,
|
||||
tempu->range*2*HEX_RADIUS))) {
|
||||
FireShot(tempu,target);
|
||||
Sleep(250*ANIMATION_DELAY);
|
||||
UserChk;
|
||||
tmpu=&units[cur_player][i];
|
||||
if (tmpu->life>0 && !tmpu->indirect_fire &&
|
||||
(target=UnitNearestFind(tmpu->row,tmpu->col,enemy_player,TRUE,
|
||||
tmpu->range*2*HEX_RADIUS))) {
|
||||
UnitDirectFire(tmpu,target);
|
||||
Sleep(250*animation_delay);
|
||||
}
|
||||
}
|
||||
throw('PhaseOvr',TRUE);
|
||||
|
||||
Reference in new issue
Block a user