• R/O
  • SSH
  • HTTPS

oricsdk: Commit


Commit MetaInfo

Revision994 (tree)
Time2013-12-06 00:35:42
Authorbarnsey123

Log Message

v0.089 much reduced memory footprint (36411)
The Possible Moves section much reduced as now only inversing squares instead of printing a "compass" - this also reduces the graphics files

Change Summary

Incremental Difference

--- users/barnsey123/HNEFATAFL/draw.s (revision 993)
+++ users/barnsey123/HNEFATAFL/draw.s (revision 994)
@@ -323,7 +323,7 @@
323323 ; sta tmp1+1
324324 ; ldx #0
325325 ;loop
326-; lda _pausetime,x
326+; lda _someint,x ; where someint represents say $9AD0 (for the char Z)
327327 ; ldy #0
328328 ; sta (tmp1),y
329329 ; jsr _Add40
--- users/barnsey123/HNEFATAFL/main.c (revision 993)
+++ users/barnsey123/HNEFATAFL/main.c (revision 994)
@@ -105,7 +105,7 @@
105105 #define SAGA 0
106106 #define THOR 1
107107 #define ODIN 2
108-#define TROPHY 12
108+#define TROPHY 10
109109 #define FIRSTBLOOD 1
110110 #define BLOODEAGLE 2
111111 #define BERZERKER 3
@@ -179,6 +179,7 @@
179179 unsigned char cantakepiece(); // returns 0=no, 1 yes
180180 unsigned char checkroute(); // sets counter to be number of pieces on a given route
181181 void blinkcursor(); // blinks the cursor to attract attention
182+void blinkcursorB(); // subroutine of blinkcursor()
182183 void calccantake(); // can take be made (how many)
183184 void calchightarget(); // updates value of hightarget (the highest target so far)
184185 //void calctakeweight(); // calculate the weight of "takeweight"
@@ -221,7 +222,8 @@
221222 void inctarget(); // inc target[xns][xew]
222223 void inverse(); // inverse the color in the square
223224 void movecursor2(); // move cursor routine
224-void movepiece(); // move a piece
225+void movepiece(); // move a piece
226+void movepieceB(); // subroutine of movepiece()
225227 void pacman2(); // update target positions around king (need to develop further)
226228 void pacman2b(); // subroutine of pacman2
227229 void pacman3();
@@ -279,9 +281,11 @@
279281 void DrawPictureTiles(); // called from lots of places so gets own function
280282 //void cleartarget(); // set all targets to 1 (before adding redflag point values
281283 void SubMoveCursor2(); // subroutine of movecursor2() to save memory
284+void SubMoveCursor2b(); // subroutine of movecursor2() to save memory
282285 void CheckerBoard(); // Checkerboard screen wipe
283286 void subCheckerBoard(); // subroutine of checkerboard
284287 void subCheckerBoard2(); // subroutine 2 of checkerboard
288+void SheldonGambit(); // called from subpacmanx (block left or right?)
285289 /****************** GLOBAL VARIABLES *******************************/
286290 /* Populate array with tile types
287291 Tile types:
@@ -350,7 +354,7 @@
350354 //char xloop=0; // general purpose loop variable
351355 unsigned char xns=0; // copy of ns (arrows or blanks, and subarrows)
352356 unsigned char xew=0; // copy of ew (arrows or blanks, and subarrows)
353-unsigned char arrow=1; // used in arrowsorblanks(and subarrows)
357+unsigned char arrow=1; // used in arrowsorblanks(and subarrows)
354358 unsigned char flag=0;
355359 unsigned char cantake; // can I take? (for computer turn)
356360 unsigned char route;
@@ -454,7 +458,6 @@
454458 //playertype=0; // 1=attacker, 2=defender (set at zero as incremented within loop)
455459 firstblood=1;
456460 ClearTrophies(); // initialize trophy array
457- //PrintTrophyScreen();
458461 drawboard(); // draw the board
459462 while (gamestyle==3){
460463 message="PLAYERS:1-2"; // number of players
@@ -486,11 +489,10 @@
486489 cy=ns; // cursor y screen position
487490 playertype++; // playertype inited as 0 so ++ will make it 1 at start of game
488491 if ( playertype == 3 ) {
489- playertype = 1; turncount++; // was defender, set to attacker player, inc turncount
492+ playertype = ATTACKER; turncount++; // was defender, set to attacker player, inc turncount
490493 if ( turncount > turnlimit ) gamestyle = 9; // signify end of game
491494 }
492- //if (( gamestyle == 0 )||((gamestyle==1)&&(playertype==2))||((gamestyle==2)&&(playertype==1)))
493- if ( gamestyle != 9 ){ // if turns not exceeded
495+ if ( gamestyle != 9 ){ // if turns not exceeded
494496 if (( gamestyle == 0 )||((gamestyle==1)&&(playertype==2))){
495497 playerturn(); // player input
496498 }else{
@@ -506,7 +508,7 @@
506508 */
507509 message=" ATTACKER WINS!"; // default (game=-2)
508510 // king escapes or all attackers killed
509- if ( game == 0 ) message=" KING WINS";
511+ if ( game == 0 ) message=" KING WINS";
510512 // computer can't move
511513 if ( game == -1 ) message="STALEMATE - OR TURN LIMIT EXCEEDED";
512514 // Award RAIDO AND URUZ Trophies (RAIDO = win on last turn, URUZ >=5 turns remaining)
@@ -578,10 +580,13 @@
578580 for (ctns=0;ctns<11;ctns++){
579581 for (ctew=0;ctew<11;ctew++){
580582 ns=ctns;ew=ctew;
581- if (( fb == 4 )&&(( players[ctns][ctew] == DEFENDER )||(players[ctns][ctew] == KING))) printdestinations();
582- if (((fb == 5)||(fb == 7))&&( players[ctns][ctew] == ATTACKER)) printdestinations();
583+ //if (( fb == 4 )&&(( players[ctns][ctew] == DEFENDER )||(players[ctns][ctew] == KING))) printdestinations();
584+ //if (((fb == 5)||(fb == 7))&&( players[ctns][ctew] == ATTACKER)) printdestinations();
585+ //if (( fb == 8)&&( players[ctns][ctew] == KING )) printdestinations();
586+
587+ if ((( fb == 4 )&&(( players[ctns][ctew] == DEFENDER )||(players[ctns][ctew] == KING))) || (((fb == 5)||(fb == 7))&&( players[ctns][ctew] == ATTACKER)) || (( fb == 8)&&( players[ctns][ctew] == KING ))) printdestinations();
583588 if (( fb == 6)&&( computer[ctns][ctew] )) updatetarget();
584- if (( fb == 8)&&( players[ctns][ctew] == KING )) printdestinations();
589+
585590 }
586591 }
587592 }
@@ -597,9 +602,8 @@
597602 if (( cantake == 0 )&&( surrounded < 3 )&&( redflagX == NO )) canbetaken(); // if cannot take can I be taken?
598603 if (compass[origorient] == 0) foundpiece=1;
599604 // check NORTH and SOUTH
600- //if ((foundpiece == 1)&&(redflag[origorient] == NO)){ // can't be taken so we've found a candidate
601- if (foundpiece == 1){ // can't be taken so we've found a candidate
602- if (a != targetns) {// target is not on same row as candidate
605+ if ((foundpiece == 1)&&(a != targetns)){ // can't be taken so we've found a candidate && target is not on same row as candidate
606+ //if (a != targetns) {// target is not on same row as candidate
603607 if ((targetns == kingns)&&((a < 2)||(a > 8))){
604608 startrow=a;destrow=a;startcol=0;destcol=10;
605609 //see if by moving a piece we leave the way open for the king to escape
@@ -610,12 +614,11 @@
610614 if (a == kingns){ // if candidate is on same row as king (don't move away if only one piece E/W)
611615 if (((b > kingew)&&(kingpieces[EAST]==1)) || ((b < kingew)&&(kingpieces[WEST]==1))) setfoundpiece10();
612616 }
613- }
617+ //}
614618 }
615619 // CHECK EAST AND WEST
616- //if ((foundpiece == 1)&&(redflag[origorient] == NO)){ // can't be taken so we've found a candidate
617- if (foundpiece == 1){ // can't be taken so we've found a candidate
618- if ( b != targetew){// target is not on same column as candidate
620+ if ((foundpiece == 1)&&( b != targetew)){ // can't be taken so we've found a candidate && target is not on same column as candidate
621+ //if ( b != targetew){// target is not on same column as candidate
619622 if ((targetew == kingew)&&((b < 2)||(b > 8))){
620623 startrow=0;destrow=10;startcol=b;destcol=b;
621624 checkroute(); // returns z
@@ -624,7 +627,7 @@
624627 if (b == kingew){ // if candidate is on same col as king (don't move away if only one piece N/S)
625628 if (((a < kingns)&&(kingpieces[NORTH]==1)) || ((a > kingns)&&(kingpieces[SOUTH]==1))) setfoundpiece10();
626629 }
627- }
630+ //}
628631 }
629632 if (foundpiece == 1){
630633 if (origorient < EAST){
@@ -635,7 +638,6 @@
635638 }
636639 }
637640 if ((players[a][b] == DEFENDER)||(players[a][b] == KING)) foundpiece=9;
638- //if ((players[a][b] == CASTLE)&&(a!=5)) foundpiece=9;
639641 }
640642 }
641643 /*
@@ -770,7 +772,6 @@
770772 cy=ons; // piece y screen position
771773 blinkcursor(); // draw cursor in foreground color at piece to move position cx,cy
772774 fb=0;
773- //drawcursor(); // blank cursor
774775 cx=targetew; // target x screen position
775776 cy=targetns; // target y screen position
776777 blinkcursor(); // draw cursor in foreground color at target position cx,cy
@@ -781,20 +782,6 @@
781782 void subpacmanx(){
782783 setpoints(); // Set points to 10
783784 surroundpoints(); // add 10 * surrounded
784- /*
785- if (kingpieces[orientation] == 0){
786- incpoints();
787- if ((orientation<EAST)&&((kingew<2)||(kingew>8))) pointsplusten();
788- if ((orientation>SOUTH)&&((kingns<2)||(kingns>8))) pointsplusten();
789- }
790- */
791- // TRIGGERHIGH/TRIGGERLOW = Weight to be added depending on kings closeness to border
792- /*
793- if (( orientation == NORTH )&&(kingns <= TRIGGERLOW)) pointsplusten();
794- if (( orientation == SOUTH )&&(kingns >= TRIGGERHIGH)) pointsplusten();
795- if (( orientation == EAST ) &&(kingew >= TRIGGERHIGH)) pointsplusten();
796- if (( orientation == WEST ) &&(kingew <= TRIGGERLOW)) pointsplusten();
797- */
798785 points+=brokenarrow[orientation]*10;
799786 //message="NOT SET";
800787 /*
@@ -816,11 +803,12 @@
816803 }
817804 */
818805 // "The Sheldon Gambit"
819- for (x=0;x<8;x+=2){
820- a=sheldon[orientation][x];
821- b=sheldon[orientation][x+1];
822- if ( enemy[a][b] ) pointsplusten();
823- }
806+ //for (x=0;x<8;x+=2){
807+ x=0; SheldonGambit();
808+ x=2; SheldonGambit();
809+ x=4; SheldonGambit();
810+ x=6; SheldonGambit();
811+ //}
824812 // REDFLAG detection
825813 if (( kingpieces[orientation] == 0 )&&(kingtargets[orientation])){ // if no pieces in orientation from KING but there ARE targets
826814 if (((orientation < EAST)&&((kingew<2)||(kingew>8))) || ((orientation > SOUTH)&&((kingns<2)||(kingns>8)))) { // NORTH/SOUTH OR EAST/WEST
@@ -832,7 +820,12 @@
832820 }
833821 subpacmany(); // apply the points
834822 }
823+void SheldonGambit(){ //called from subpacmanx
824+ a=sheldon[orientation][x];
825+ b=sheldon[orientation][x+1];
826+ if ( enemy[a][b] ) pointsplusten();
835827
828+}
836829 void subpacmany(){ // apply the points generated in pacman2-6
837830 // SET UNCOUNTER
838831 pacman5(); // ensure correct paclevels are set
@@ -874,7 +867,6 @@
874867 // kingtargets[orientation]= count of targets from king to edge
875868 // kingpieces[]= count of pieces from king in a given orientation
876869 unsigned char test=0;
877- //unsigned char testreturn=0;
878870 setcheckmode1(); c=checkroute(); // how many pieces on the route?
879871 checkroutemode=6; d=checkroute();// can king get to a T-row 0-1
880872 if (( c == 0 ) && ( d )) {
@@ -1002,6 +994,9 @@
1002994 // count of pieces across the "T"
1003995 // PARTIAL LEVEL 1 "LEFT"
1004996 //points=50; // for level 1
997+ // *** IMPORTANT ***
998+ // It may look like you can save a few bytes by removing "redundant" statements
999+ // here, but you can't as these values are altered later in this routine
10051000 a=0;b=kingew;startrow=0;destrow=0;startcol=0;destcol=kingew; // NORTH
10061001 if ( orientation ){
10071002 a=10;b=kingew;startrow=10;destrow=10;startcol=0;destcol=kingew; // SOUTH
@@ -1053,10 +1048,9 @@
10531048 lower=1;
10541049 upper=9;
10551050 }
1056- if ((( orientation == NORTH )||( orientation == WEST ))&&(paclevel2 > lower)) checkbrokenarrow();
1057- if ((( orientation == SOUTH )||( orientation == EAST ))&&(paclevel2 < upper)) checkbrokenarrow();
1058- //if ((paclevel1 > 0 )&&(paclevel1 < 10)) test++;
1059- //if ( test==2 ) checkbrokenarrow();
1051+ //if ((( orientation == NORTH )||( orientation == WEST ))&&(paclevel2 > lower)) checkbrokenarrow();
1052+ //if ((( orientation == SOUTH )||( orientation == EAST ))&&(paclevel2 < upper)) checkbrokenarrow();
1053+ if (((( orientation == NORTH )||( orientation == WEST ))&&(paclevel2 > lower)) || ((( orientation == SOUTH )||( orientation == EAST ))&&(paclevel2 < upper))) checkbrokenarrow();
10601054 }
10611055 void pacman4(){
10621056 // Cross the "T", see if a FULL broken arrow condition could exist (LEVEL 2)
@@ -1096,13 +1090,13 @@
10961090 game=-2 Attacker wins.
10971091 */
10981092 // ns and ew contains new board co-ords of last piece moved
1099- if ((( players[ns][ew] == 3 ) && ( tiles[ns][ew] == 4 ))||( deadattackers > 23)) game=0; // king has escaped
1093+ if ((( players[ns][ew] == KING ) && ( tiles[ns][ew] == 4 ))||( deadattackers > 23)) game=0; // king has escaped
11001094 // check to see if king is surrounded by attackers (first find king)
1101- if ( players[ns][ew] == 1 ){ // if attacker was last to move
1102- if ((ns )&&(players[ns-1][ew] == 3 )) surroundcount();
1103- if ((ns < 10 )&&(players[ns+1][ew] == 3 )) surroundcount();
1104- if ((ew < 10 )&&(players[ns][ew+1] == 3 )) surroundcount();
1105- if ((ew )&&(players[ns][ew-1] == 3 )) surroundcount();
1095+ if ( players[ns][ew] == ATTACKER ){ // if attacker was last to move
1096+ if ((ns )&&(players[ns-1][ew] == KING )) surroundcount();
1097+ if ((ns < 10 )&&(players[ns+1][ew] == KING )) surroundcount();
1098+ if ((ew < 10 )&&(players[ns][ew+1] == KING )) surroundcount();
1099+ if ((ew )&&(players[ns][ew-1] == KING )) surroundcount();
11061100 if ( surrounded == 4 ) game=-2; // king is surrounded on all sides by attackers or king squares
11071101 }
11081102 if ( gamestyle == 9 ) game=-1; // turnlimit exceeded: stalemate
@@ -1127,34 +1121,37 @@
11271121 canmovecursor=0;
11281122 piecetype=players[ons][oew]; // determines the piece type that is currently selected (used in mode 1)
11291123 if ((mkey == 8 )&&( ew )){ // west
1130- cursormodezero();
1124+ //cursormodezero();
11311125 xptrew--; // decrement copyew
11321126 skipew-=2;
1133- incmodeone();
1127+ SubMoveCursor2b();
1128+ //incmodeone();
11341129 }
11351130 if ((mkey == 9 )&&( ew < 10)) { // east
1136- cursormodezero();
1131+ //cursormodezero();
11371132 xptrew++;
11381133 skipew+=2;
1139- incmodeone();
1134+ SubMoveCursor2b();
1135+
1136+ //incmodeone();
11401137 }
11411138 if ((mkey == 10)&&( ns < 10)){ // south
1142- cursormodezero();
1139+ //cursormodezero();
11431140 xptrns++;
11441141 skipns+=2;
1145- incmodeone();
1142+ SubMoveCursor2b();
1143+
1144+ //incmodeone();
11461145 }
11471146 if ((mkey == 11)&&( ns )){ // north
1148- cursormodezero();
1147+ //cursormodezero();
11491148 xptrns--;
11501149 skipns-=2;
1151- incmodeone();
1150+ SubMoveCursor2b();
1151+ //incmodeone();
11521152 }
11531153 if (( cursormode ) && ( modeonevalid )){ // if not at edge of board
1154- //if ( players[xptrns][xptrew] == 0 ) canmovecursor=1; // ok if square vacant
1155- if ( tiles[xptrns][xptrew] == 4 ) canmovecursor=0; // !ok if corner
1156- //if (( piecetype == 3 )&&( tiles[xptrns][xptrew] > 2 )) canmovecursor=1; // ok if KING and corner/central
1157- //if (( xptrns == ons )&&( xptrew == oew )) canmovecursor=1; // ok if back to self
1154+ if ( tiles[xptrns][xptrew] == 4 ) canmovecursor=0; // !ok if corner
11581155 if (( players[xptrns][xptrew] == 0 )||(( piecetype == KING )&&( tiles[xptrns][xptrew] > 2 ))||(( xptrns == ons )&&( xptrew == oew ))) canmovecursor=1;
11591156
11601157 // need to check that for non-king pieces wether the central square is vacant and can be skipped
@@ -1187,8 +1184,11 @@
11871184 if ( mkey == 10 )b+=multiple; // down
11881185 if ( mkey == 11 )b-=multiple; // up
11891186 }
1190-
1191-// kicks off functions that print appropriate arrows at all possible
1187+void SubMoveCursor2b(){
1188+ cursormodezero();
1189+ incmodeone();
1190+}
1191+// kicks off functions that highlights squares at all possible
11921192 // destinations and blanks them out afterwards
11931193 void printpossiblemoves(){
11941194 char k; // key entered
@@ -1238,18 +1238,20 @@
12381238 row=xns;
12391239 col=xew;
12401240 if ( arrow == 1 ){ // don't draw the arrow or update any array if arrow=2
1241- if (fb == 1) drawarrow(); // draw arrow
1241+ if (fb < 2) drawarrow(); // draw arrow (if fb = 0 or 1)
12421242 if (fb == 4) subarrows2(); // enemy can get here, update enemy array (direction specific)
12431243 if (fb == 5) computer[xns][xew]++;// computer can get here, increment computer array and set default target value
1244- if (fb == 0) drawarrow(); // if MODE is "blank an arrow"
1244+ //if (fb == 0) drawarrow(); // if MODE is "blank an arrow"
12451245 if (fb == 8) kingtracker[xns][xew]=1; // king can get here...
12461246 }
12471247 }
12481248 // have we reached the end of the board?
1249- if (( orientation == NORTH ) && ( xns == 0 )) zeroarrow(); // check north
1250- if (( orientation == SOUTH ) && ( xns == 10 )) zeroarrow(); // check south
1251- if (( orientation == EAST ) && ( xew == 10 )) zeroarrow(); // check east
1252- if (( orientation == WEST ) && ( xew == 0 )) zeroarrow(); // check west
1249+ //if (( orientation == NORTH ) && ( xns == 0 )) zeroarrow(); // check north
1250+ //if (( orientation == SOUTH ) && ( xns == 10 )) zeroarrow(); // check south
1251+ //if (( orientation == EAST ) && ( xew == 10 )) zeroarrow(); // check east
1252+ //if (( orientation == WEST ) && ( xew == 0 )) zeroarrow(); // check west
1253+
1254+ if ((( orientation == NORTH ) && ( xns == 0 )) || (( orientation == SOUTH ) && ( xns == 10 )) || (( orientation == EAST ) && ( xew == 10 )) || (( orientation == WEST ) && ( xew == 0 ))) zeroarrow();
12531255 }
12541256 if ((fb == 7)&&(xplayers > ATTACKER)){ // check to see if an attacker can be caught if he stays where he is
12551257 if ((players[takerow][takecol] == 0)&&(enemy[takerow][takecol] )) {
@@ -1262,7 +1264,7 @@
12621264 else{ // if heading east or west
12631265 b=xew;
12641266 if ( xns < 10 ) {a=xns+1;sidestep();}
1265- if ( xns ) {a=xns-1;sidestep();}
1267+ if ( xns ) {a=xns-1;sidestep();}
12661268 }
12671269 }
12681270 }
@@ -1397,19 +1399,18 @@
13971399
13981400 // blinks the cursor a number of times to attract attention
13991401 void blinkcursor() {
1400- //inversex=cx;
1401- //inversey=cy;
1402- for (counter=0;counter<5;inccounter()){ // flash the cursor to draw attention to it
1403- fb=0;
1404- //drawcursor(); // draw cursor in background color at cx,cy
1402+ //for (counter=0;counter<5;inccounter()){ // flash the cursor to draw attention to it
1403+ blinkcursorB(); blinkcursorB(); blinkcursorB(); blinkcursorB(); blinkcursorB();
1404+ //}
1405+ if ((cx==5)&&(cy==5)) inverse();
1406+}
1407+void blinkcursorB(){
1408+ fb=0;
14051409 inverse();
14061410 pausetime=500;pause();
14071411 inverse();
14081412 fb=1;
1409- //drawcursor(); // draw cursor in foreground color at cx,cy
1410- pausetime=1000;pause();
1411- }
1412- if ((cx==5)&&(cy==5)) inverse();
1413+ pausetime=1000;pause();
14131414 }
14141415 // flashes the screen in the selected ink color
14151416 void flashscreen() {
@@ -1458,14 +1459,13 @@
14581459 /*******************************************************/
14591460 if (( xkey == 88) || ( xkey == 80)){ // if 'X' or 'P' is selected (88=X, 80=P)
14601461 canselect=0; // set piece to NOT SELECTABLE
1461- if ((( playertype == ATTACKER )&&(players[ns][ew] == ATTACKER ))||(( playertype == DEFENDER )&&((players[ns][ew] == DEFENDER )||(players[ns][ew] == KING)))) canselect=1; // piece is selectable
1462- //if (( playertype == 2 )&&((players[ns][ew] == 2 )||(players[ns][ew] == 3))) canselect=1;// piece is selectable
1463- if ( canselect ){
1462+ if ((( playertype == ATTACKER )&&(players[ns][ew] == ATTACKER ))||(( playertype == DEFENDER )&&((players[ns][ew] == DEFENDER )||(players[ns][ew] == KING)))) { // piece is selectable
1463+ canselect=1; // set piece is selectable
14641464 canpiecemove();
14651465 if (route ) {
1466- flashcolor=GREEN;flashscreen(); // flash 2=green, 3=yellow
1467- if ( xkey == 80 ){ // if P is pressed
1468- printpossiblemoves(); // Print possible moves
1466+ flashcolor=GREEN;flashscreen();
1467+ if ( xkey == 80 ){ // if P is pressed
1468+ printpossiblemoves(); // Print possible moves
14691469 printturnprompt();
14701470 printturnline();
14711471 }
@@ -1499,14 +1499,7 @@
14991499 if ( ons == ns ) cursormovetype=1;
15001500 if ( oew == ew ) cursormovetype=2;
15011501 }
1502- //if (( ons == ns )&&( cursormovetype < 0)) cursormovetype=1; // cursor allowed north-south
1503- //if (( oew == ew )&&( cursormovetype < 0)) cursormovetype=2; // cursor allowed east-west
1504- if (( ons == ns )&& (oew == ew )) cursormovetype=0; // cursor can move
1505-
1506- //if (( cursormovetype == 2) && (( mkey == 8) ||(mkey == 9))) cursormovetype=-1; //!move
1507- //if (( cursormovetype == 1) && (( mkey == 10)||(mkey == 11)))cursormovetype=-1; //!move
1508- //if (( cursormovetype == 0) && (( mkey == 8) ||(mkey == 9))) cursormovetype=1; //move
1509- //if (( cursormovetype == 0) && (( mkey == 10)||(mkey == 11)))cursormovetype=2; //move
1502+ if (( ons == ns )&& (oew == ew )) cursormovetype=0; // cursor can move
15101503 if (( mkey >= 8 ) && ( mkey <= 11)){
15111504 if ( cursormovetype > 0 ){
15121505 if ((( cursormovetype == 2 )&&( mkey < 10 ))||((cursormovetype == 1)&&(mkey>9))) cursormovetype=-1;
@@ -1525,34 +1518,23 @@
15251518 }
15261519 if ( mkey == 82 ){ // R has been selected, Reset cursor to original positions
15271520 fb=0;
1528- //drawcursor(); // blank out cursor at current position
1529- //inversex=cx;
1530- //inversey=cy;
15311521 inverse();
1532- cx=ocx; // reset coords and board values to original positions
1522+ cx=ocx; // reset coords and board values to original positions
15331523 cy=ocy;
15341524 ns=ons;
15351525 ew=oew;
1536- //inversex=cx;
1537- //inversey=cy;
15381526 fb=1;
1539- //drawcursor(); // draw cursor at original selected position
1540- inverse2();
1541- inverse(); // inverse square
1527+ inverse2(); inverse();
15421528 }
15431529 if ( mkey == 88 ){ // if X selected
1544- //inversex=ocx;
1545- //inversey=ocy;
15461530 inverse(); // inverse original position
15471531 // X is in original position so return to cursor movement
1548-
15491532 if (( ons == ns )&&( oew == ew)){
1550- inverse2();
1551- inverse();
1533+ inverse2(); inverse();
15521534 mkey=0; // piece de-selected
15531535 }
15541536 else{
1555- movepiece(); // move selected piece
1537+ movepiece();// move selected piece
15561538 turn=0; // player has ended turn
15571539 }
15581540
@@ -1594,7 +1576,7 @@
15941576 }
15951577 }
15961578 // having moved piece we now need to check for, and implement any TAKES
1597- if (piecetype > ATTACKER ){ // if defender
1579+ if (piecetype > ATTACKER ){ // if defender/king
15981580 p1=DEFENDER;
15991581 p2=KING;
16001582 }
@@ -1601,21 +1583,21 @@
16011583 tpew=ew;
16021584 takecounter=0; // set the take counter to zero (incremented in takepiece)
16031585 if ( ns > 1 ){// check north
1604- orientation=NORTH;
1605- if ( cantakepiece() ) { tpns=ns-1; takepiece(); }
1586+ orientation=NORTH; tpns=ns-1; movepieceB();
1587+ //if ( cantakepiece() ) { tpns=ns-1; takepiece(); }
16061588 }
16071589 if ( ns < 9 ){ // check south
1608- orientation=SOUTH;
1609- if ( cantakepiece() ) { tpns=ns+1; takepiece(); }
1590+ orientation=SOUTH; tpns=ns+1; movepieceB();
1591+ //if ( cantakepiece() ) { tpns=ns+1; takepiece(); }
16101592 }
16111593 tpns=ns;
16121594 if ( ew < 9 ){ // check east
1613- orientation=EAST;
1614- if ( cantakepiece() ) { tpew=ew+1; takepiece(); }
1595+ orientation=EAST; tpew=ew+1; movepieceB();
1596+ //if ( cantakepiece() ) { tpew=ew+1; takepiece(); }
16151597 }
16161598 if ( ew > 1 ){ // check west
1617- orientation=WEST;
1618- if ( cantakepiece() ) { tpew=ew-1; takepiece(); }
1599+ orientation=WEST; tpew=ew-1; movepieceB();
1600+ //if ( cantakepiece() ) { tpew=ew-1; takepiece(); }
16191601 }
16201602
16211603 // update count of attackers around king
@@ -1631,8 +1613,10 @@
16311613 kingpieces[SOUTH]=0;
16321614 kingpieces[EAST]=0;
16331615 kingpieces[WEST]=0;
1616+
1617+ // perform NORTH/SOUTH checks
1618+ cy=kingew;
16341619 orientation=NORTH;
1635- cy=kingew;
16361620 for (counter=0;counter<kingns;inccounter()){
16371621 cx=counter;incdefatt();
16381622 }
@@ -1640,18 +1624,24 @@
16401624 for (counter=kingns+1;counter<11;inccounter()){
16411625 cx=counter; incdefatt();
16421626 }
1627+ // perform EASt/WEST check
1628+ cx=kingns;
16431629 orientation=EAST; // EAST
1644- cx=kingns;
16451630 for (counter=kingew+1;counter<11;inccounter()){
16461631 cy=counter; incdefatt();
16471632 }
1633+
16481634 orientation=WEST; // WEST
16491635 for (counter=0;counter<kingew;inccounter()){
16501636 cy=counter; incdefatt();
16511637 }
1638+
16521639 if (takecounter > 1) takemessage(); // display a firstblood/multiple takes message
16531640 }
16541641
1642+void movepieceB(){
1643+ if ( cantakepiece() ) takepiece();
1644+}
16551645 void incdefatt(){
16561646 if (players[cx][cy] == ATTACKER) inckingattacker();
16571647 if (players[cx][cy] == DEFENDER) inckingdefender();
@@ -1838,7 +1828,12 @@
18381828 DrawPictureTiles();
18391829 }
18401830
1841-void drawarrow(){
1831+void drawarrow(){ // not really an arrow any more...
1832+ a=cx;b=cy; // save contents of cx/cy to a/b
1833+ cx=col;cy=row; // copy row/col to cx/cy for inverse function
1834+ inverse(); // inverse the color at square cx/cy
1835+ cx=a;cy=b; // restore contents of cx/cy from a/b
1836+ /*
18421837 if ( fb == 1 ){
18431838 tiletodraw=10;
18441839 if ( tiles[row][col] ) tiletodraw++; // add another 1 for arrow with background
@@ -1846,7 +1841,7 @@
18461841 else{
18471842 tiletodraw=tiles[row][col]; // draw original tile (includes blank)
18481843 }
1849- DrawPictureTiles();
1844+ DrawPictureTiles();*/
18501845 }
18511846
18521847 void surroundcount(){
--- users/barnsey123/HNEFATAFL/osdk_makedata.bat (revision 993)
+++ users/barnsey123/HNEFATAFL/osdk_makedata.bat (revision 994)
@@ -1,6 +1,6 @@
11 @ECHO OFF
22
3-%OSDK%\bin\pictconv -m0 -f0 -o4_PictureTiles pics\tiles.png pictiles.s
3+%OSDK%\bin\pictconv -m0 -f0 -o4_PictureTiles pics\tiles6.png pictiles.s
44 %OSDK%\bin\pictconv -m0 -f0 -o4_ExplodeTiles pics\explode.png explode.s
55 %OSDK%\bin\pictconv -m0 -f0 -o4_BorderTiles2 pics\bordertiles2.png border.s
66 %OSDK%\bin\pictconv -m0 -f0 -o4_TitleTiles pics\defence-force2.png defence.s
--- users/barnsey123/HNEFATAFL/pictiles.s (revision 993)
+++ users/barnsey123/HNEFATAFL/pictiles.s (revision 994)
@@ -33,14 +33,8 @@
3333 .byt $5f,$42,$69,$7f,$72,$6b,$60,$7a,$63,$71,$78,$66,$71,$6c,$66,$40
3434 .byt $4c,$66,$40,$4c,$66,$40,$4c,$66,$71,$6c,$63,$71,$78,$6b,$60,$7a
3535 .byt $69,$7f,$72,$68,$5f,$42,$6f,$40,$5e,$60,$40,$40,$7f,$7f,$7f,$60
36- .byt $40,$40,$60,$40,$40,$60,$40,$40,$60,$40,$40,$60,$44,$40,$60,$44
37- .byt $40,$60,$4e,$40,$60,$55,$40,$61,$7f,$70,$60,$55,$40,$60,$4e,$40
38- .byt $60,$44,$40,$60,$44,$40,$60,$40,$40,$60,$40,$40,$60,$40,$40,$60
39- .byt $40,$40,$7f,$7f,$7f,$60,$40,$40,$6f,$40,$5e,$68,$40,$42,$68,$40
40- .byt $42,$68,$44,$42,$60,$44,$40,$60,$4e,$40,$60,$55,$40,$61,$7f,$70
41- .byt $60,$55,$40,$60,$4e,$40,$60,$44,$40,$68,$44,$42,$68,$40,$42,$68
42- .byt $40,$42,$6f,$40,$5e,$60,$40,$40,$7f,$7f,$7f,$60,$40,$40,$63,$7f
43- .byt $78,$61,$7f,$70,$61,$71,$70,$61,$6a,$70,$61,$60,$70,$61,$6a,$70
44- .byt $61,$71,$70,$60,$7f,$60,$60,$5f,$40,$60,$4e,$40,$60,$4e,$40,$60
45- .byt $4e,$40,$60,$4e,$40,$60,$4e,$40,$60,$7f,$60,$60,$40,$40
36+ .byt $40,$40,$63,$7f,$78,$61,$7f,$70,$61,$71,$70,$61,$6a,$70,$61,$60
37+ .byt $70,$61,$6a,$70,$61,$71,$70,$60,$7f,$60,$60,$5f,$40,$60,$4e,$40
38+ .byt $60,$4e,$40,$60,$4e,$40,$60,$4e,$40,$60,$4e,$40,$60,$7f,$60,$60
39+ .byt $40,$40
4640
Show on old repository browser