From 3654f6fb51386c84ddff1c7907a5af48a660880d Mon Sep 17 00:00:00 2001 From: Wouter van der Wal Date: Fri, 5 Jul 2019 19:20:04 +0200 Subject: [PATCH] New version 1.3 --- 2048 (cg-10)(cg-20).g3a | Bin 51724 -> 51628 bytes 2048 (cg-50).g3a | Bin 51724 -> 51628 bytes README.md | 9 ++++- src/main.c | 79 +++++++++++++++++----------------------- 4 files changed, 41 insertions(+), 47 deletions(-) diff --git a/2048 (cg-10)(cg-20).g3a b/2048 (cg-10)(cg-20).g3a index e92867d452a44e09c399e2735580cc17614a1a56..2637ea2aed5bf82134336d360039bfcc6840537d 100644 GIT binary patch delta 569 zcmeB~!n|fOv(c(Gd)H6snALmv|34rU`uG38S@3KIB#@+}#K?%?N3NLIt2Q}-k&Wr( znu!Td*i7{dEe%aK2QDe%-MoiydLrk91}26A27|~2n_~*}85sp8_Z0qTO<*wKn6P<5 zQ97e8Cy=SY!0_xBkOrz_oB_ml7!3H=0BH#ZhB^Kqr9k~TK)PYFN=Y_U^OO>1MphjL zg9w+&b4u6O*Dx4x3jmcYaA*KJ&VY--odM`d1MUTmK*Ko%7zFg&5}fs?yf99`r(W3rGrqDx{1#a?!3LL#09gMwP9ZbDE9nAfL<_QaUo-wBf zKVw+H_3A&6W?sPdiZR_7$Y*-}Ki&8>qj^HFcuHch;hGd!yWRZZ6KreeS<3-6NVn~`JkwsK8Q2VjVl0P%#)FUmz2 zH&yyE3h_R$|Ns9#g8|P0PzV46CT4O%)jvMo2M%B^&jGMdPIVm{h{>Zc`9pOb6Yqn` z1vT>-b2baq&S%mM00tmXC+i#_Z2*je1q=pEdw_fn1_Krq1_SmFz<>m*VFShmd(Y-O K^?F`RN=g6*4zZX3 delta 667 zcmYk3Ur19?7{I@C?{(hgHcoS3Z~Nn#r06})tYAcU6J|u^?8$}?b5TBA5uLV)4!5V6 zu(8>din!nfBO(TiU5FlTFFo`SJ|smD_^>2I!ocNQgtv1`sB<`cf6njw!}nEXwz$Ry zpI2YkDuu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nu2yAVCxUV88$d`OBQ@L`P*2?LjJ5xbpRLY>3m`*VKZAHJ_7v-x$_ z|DyD!yqbGb_+T{Xtuzc{@F)QPomjXXp?~%`zgFm!qsYR%v#mwHS_b<1&yjwuzL~IV zy5rHL^)Smo9LP9m6LA5dX*oY@H0eP218p@ig?b%SO#|%xq;eYwdQ9Ig5NxCJG=MT< zqCjrZKYmyC%}d9@>+>vX$^#jDDl7NO85+_;%UD6o(&osC=rGVOi4B5o03HJt?pHbC z;XWrk6J7~h2OxYB_C~xrqnX3cqj#KY(#80$6mfK@`}s;(iuJrMvNO)knksrifokzm zK<})0Lh3~+mO~~L-ORBoeknmYX2z-dGF>%_bqDmWis!9*MoQ!u6N}W{{EAERA7dvw zOsXxQcbJq@^5@thj?`%?yX5^_(pyuTJrzoE0o_X}$vdcD$BSqdCvghT;bJL)M~@=) zAa=DD+T!RgJH;k{-43!TF2>FolWYRHP>>Jv!~75*;`^2J$^~UW@hjh;T>Q>Oek>Rw zE^sd93s;45)z$jGbq9+ro||%Css~|tJayKp&~bmH?@-I9P9cuY6Et<<268&Y%Z6b9 zvAeUTlZ@#P78?$SDE_hRZqp;%mX 2048 (cg-10)(cg-20).g3a +Casio fx-cg 50 -> 2048 (cg-50).g3a + +If there are no graphics showing up try using the other file. +This programm is under the GNU V3 license diff --git a/src/main.c b/src/main.c index 6487ae0..f913d97 100644 --- a/src/main.c +++ b/src/main.c @@ -102,7 +102,7 @@ const color_t logo[9280] = { // Custom function void fillArea(unsigned x,unsigned y,unsigned w,unsigned h,unsigned short col){ - unsigned short*s=(unsigned short*)0xA8000000; + unsigned short*s=(unsigned short*)0xAC000000; s+=(y*384)+x; while(h--){ unsigned w2=w; @@ -184,7 +184,7 @@ void drawBackground() { fillArea(247, 106, 1, 40, 0x9c4f); fillArea(332, 105, 1, 40, 0x9c4f); - int xa = 270; + int xa = 265; int ya = 82; PrintMini(&xa, &ya, "score", 0x02, 0xffffffff, 0, 0, 0xe6fa, 0x9c4f, 1, 0); @@ -293,61 +293,50 @@ int createRandomTile() { void slideTile(int p) { int times = 0; + + // Movement vars + int a = 0; + int b = 0; + int c = 0; + int d = 0; + while (times != 4) { int xTile = 0; int yTile = 0; while (xTile != 4) { while (yTile != 4) { + // Set correct move vars if (p == 0) { - // Go up - if (yTile != 0) { // top row is skiped - if (board[yTile-1][xTile] == 0) { - board[yTile-1][xTile] = board[yTile][xTile]; - board[yTile][xTile] = 0; - } else if (board[yTile-1][xTile] == board[yTile][xTile]) { - board[yTile-1][xTile] = board[yTile][xTile]*2; - board[yTile][xTile] = 0; - score = score + board[yTile-1][xTile]; - } - } + a = -1; + c = yTile; + d = 0; } else if (p == 1) { - // Go down - if (yTile != 3) { // top row is skiped - if (board[yTile+1][xTile] == 0) { - board[yTile+1][xTile] = board[yTile][xTile]; - board[yTile][xTile] = 0; - } else if (board[yTile+1][xTile] == board[yTile][xTile]) { - board[yTile+1][xTile] = board[yTile][xTile]*2; - board[yTile][xTile] = 0; - score = score + board[yTile+1][xTile]; - } - } + a = 1; + c = yTile; + d = 3; } else if (p == 2) { - // Go left - if (xTile != 0) { - if (board[yTile][xTile-1] == 0) { - board[yTile][xTile-1] = board[yTile][xTile]; - board[yTile][xTile] = 0; - } else if (board[yTile][xTile-1] == board[yTile][xTile]) { - board[yTile][xTile-1] = board[yTile][xTile]*2; - board[yTile][xTile] = 0; - score = score + board[yTile][xTile-1]; - } - } + b = -1; + c = xTile; + d = 0; } else if (p == 3) { - // Go right - if (xTile != 3) { - if (board[yTile][xTile+1] == 0) { - board[yTile][xTile+1] = board[yTile][xTile]; - board[yTile][xTile] = 0; - } else if (board[yTile][xTile+1] == board[yTile][xTile]) { - board[yTile][xTile+1] = board[yTile][xTile]*2; - board[yTile][xTile] = 0; - score = score + board[yTile][xTile+1]; - } + b = 1; + c = xTile; + d = 3; + } + + // Move + if (c != d) { + if (board[yTile+a][xTile+b] == 0) { + board[yTile+a][xTile+b] = board[yTile][xTile]; + board[yTile][xTile] = 0; + } else if (board[yTile+a][xTile+b] == board[yTile][xTile]) { + board[yTile+a][xTile+b] = board[yTile][xTile]*2; + board[yTile][xTile] = 0; + score = score + board[yTile+a][xTile+b]; } } + yTile = yTile + 1; } yTile = 0;