mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
9.4d
This commit is contained in:
parent
51f2ff9d4a
commit
b7450edef5
@ -5,6 +5,7 @@
|
||||
#define MOBPAR_FORMAL int
|
||||
#define MOBPAR_ACTUAL 0
|
||||
#define FAKEMOBILE
|
||||
#define ANDROIDSHARE
|
||||
#define MIX_MAX_VOLUME 128
|
||||
|
||||
const char *scorefile = "fakemobile_score.txt";
|
||||
@ -90,6 +91,10 @@ void viewAchievements() { printf("view Achievements\n"); }
|
||||
void viewLeaderboard(string id) { printf("view Leaderboard :: %s\n", id.c_str()); }
|
||||
void switchGoogleConnection() { printf("sgc\n"); }
|
||||
|
||||
void shareScore(int) {
|
||||
printf("share\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
initAll();
|
||||
|
17
game.cpp
17
game.cpp
@ -5282,6 +5282,8 @@ void activateSafety(eLand l) {
|
||||
restartGraph();
|
||||
}
|
||||
|
||||
bool legalmoves[8];
|
||||
|
||||
bool hasSafeOrb(cell *c) {
|
||||
return
|
||||
c->item == itOrbSafety ||
|
||||
@ -5299,15 +5301,20 @@ void checkmove() {
|
||||
// do not activate orbs!
|
||||
for(int i=0; i<ittypes; i++) orbusedbak[i] = orbused[i];
|
||||
|
||||
for(int i=0; i<8; i++) legalmoves[i] = false;
|
||||
|
||||
canmove = false;
|
||||
items[itWarning]+=2;
|
||||
if(movepcto(-1, 0, true)) canmove = true;
|
||||
if(!canmove)
|
||||
if(movepcto(-1, 0, true)) canmove = legalmoves[7] = true;
|
||||
|
||||
if(ISMOBILE || !canmove)
|
||||
for(int i=0; i<cwt.c->type; i++)
|
||||
if(movepcto(1, -1, true)) canmove = true;
|
||||
if(!canmove)
|
||||
if(movepcto(1, -1, true))
|
||||
canmove = legalmoves[cwt.spin] = true;
|
||||
if(ISMOBILE || !canmove)
|
||||
for(int i=0; i<cwt.c->type; i++)
|
||||
if(movepcto(1, 1, true)) canmove = true;
|
||||
if(movepcto(1, 1, true))
|
||||
canmove = legalmoves[cwt.spin] = true;
|
||||
if(kills[moPlayer]) canmove = false;
|
||||
if(!canmove)
|
||||
achievement_final(true);
|
||||
|
22
graph.cpp
22
graph.cpp
@ -1886,7 +1886,7 @@ bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, int col, dou
|
||||
return false;
|
||||
}
|
||||
|
||||
else if(m == moGolem) {
|
||||
else if(m == moGolem || m == moGolemMoved) {
|
||||
ShadowV(V, shPBody);
|
||||
otherbodyparts(V, darkena(col, 1, 0XC0), m, footphase);
|
||||
queuepoly(VBODY, shPBody, darkena(col, 0, 0XC0));
|
||||
@ -1947,7 +1947,7 @@ bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, int col, dou
|
||||
}
|
||||
}
|
||||
|
||||
else if(m == moWolf || m == moRedFox) {
|
||||
else if(m == moWolf || m == moRedFox || m == moWolfMoved) {
|
||||
ShadowV(V, shWolfBody);
|
||||
if(mmspatial || footphase)
|
||||
animallegs(VALEGS, moWolf, darkena(col, 0, 0xFF), footphase);
|
||||
@ -2033,7 +2033,7 @@ bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, int col, dou
|
||||
else if(m == moShark || m == moGreaterShark || m == moCShark)
|
||||
queuepoly(VFISH, shShark, darkena(col, 0, 0xFF));
|
||||
else if(m == moEagle || m == moParrot || m == moBomberbird || m == moAlbatross ||
|
||||
m == moTameBomberbird || m == moWindCrow) {
|
||||
m == moTameBomberbird || m == moWindCrow || m == moTameBomberbirdMoved) {
|
||||
ShadowV(V, shEagle);
|
||||
queuepoly(VBIRD, shEagle, darkena(col, 0, 0xFF));
|
||||
}
|
||||
@ -3052,9 +3052,14 @@ void drawMobileArrow(cell *c, transmatrix V) {
|
||||
// int col = getcs().uicolor;
|
||||
// col -= (col & 0xFF) >> 1;
|
||||
|
||||
int dir = neighborId(cwt.c, c);
|
||||
bool invalid = !legalmoves[dir];
|
||||
|
||||
int col = cellcolor(c);
|
||||
if(col == OUTLINE_NONE) col = 0xC0C0C0FF;
|
||||
col -= (col & 0xFF) >> 1;
|
||||
if(invalid) col -= (col & 0xFF) >> 1;
|
||||
if(invalid) col -= (col & 0xFF) >> 1;
|
||||
|
||||
poly_outline = OUTLINE_NONE;
|
||||
transmatrix m2 = Id;
|
||||
@ -5237,7 +5242,9 @@ void drawMarkers() {
|
||||
using namespace shmupballs;
|
||||
calc();
|
||||
queuecircle(xmove, yb, rad, 0xFF0000FF);
|
||||
queuecircle(xmove, yb, rad*SKIPFAC, 0xFF0000FF);
|
||||
queuecircle(xmove, yb, rad*SKIPFAC,
|
||||
legalmoves[7] ? 0xFF0000FF : 0xFF000080
|
||||
);
|
||||
forCellAll(c2, cwt.c) IG(c2) drawMobileArrow(c2, Gm(c2));
|
||||
}
|
||||
#endif
|
||||
@ -5394,7 +5401,7 @@ string buildHelpText() {
|
||||
h += XLAT("(You can also use right Shift)\n\n");
|
||||
#endif
|
||||
h += XLAT("See more on the website: ")
|
||||
+ "http//roguetemple.com/z/hyper.php\n\n";
|
||||
+ "http//roguetemple.com/z/hyper/\n\n";
|
||||
|
||||
|
||||
h += XLAT("Still confused? Read the FAQ on the HyperRogue website!\n\n");
|
||||
@ -6224,6 +6231,9 @@ void drawthemap() {
|
||||
modist = 1e20; mouseover = NULL;
|
||||
modist2 = 1e20; mouseover2 = NULL;
|
||||
mouseovers = XLAT("Press F1 or right click for help");
|
||||
#ifdef ROGUEVIZ
|
||||
if(rogueviz::on) mouseovers = " ";
|
||||
#endif
|
||||
centdist = 1e20; centerover = NULL;
|
||||
|
||||
for(int i=0; i<multi::players; i++) {
|
||||
@ -6741,7 +6751,7 @@ void showGameover() {
|
||||
#ifndef MOBILE
|
||||
dialog::addItem(quitsaves() ? "save" : "quit", SDLK_F10);
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
#ifdef ANDROIDSHARE
|
||||
dialog::addItem("SHARE", 's'-96);
|
||||
#endif
|
||||
|
||||
|
@ -249,7 +249,7 @@ public class HyperRogue extends Activity {
|
||||
void openWebsite() {
|
||||
Runnable r = new Runnable() {
|
||||
public void run() {
|
||||
String url = "http://roguetemple.com/z/hyper.php";
|
||||
String url = "http://roguetemple.com/z/hyper/";
|
||||
Intent i = new Intent(Intent.ACTION_VIEW);
|
||||
i.setData(Uri.parse(url));
|
||||
startActivity(i);
|
||||
|
@ -25,6 +25,8 @@
|
||||
#define ANDROID
|
||||
#endif
|
||||
|
||||
#define ANDROIDSHARE
|
||||
|
||||
#define MOBPAR_FORMAL JNIEnv *env, jobject thiz
|
||||
#define MOBPAR_ACTUAL env, thiz
|
||||
|
||||
|
18
init.cpp
18
init.cpp
@ -1,6 +1,6 @@
|
||||
#define VER "9.4c"
|
||||
#define VERNUM 9403
|
||||
#define VERNUM_HEX 0x9403
|
||||
#define VER "9.4d"
|
||||
#define VERNUM 9404
|
||||
#define VERNUM_HEX 0x9404
|
||||
|
||||
#define GEN_M 0
|
||||
#define GEN_F 1
|
||||
@ -224,7 +224,7 @@ string buildScoreDescription() {
|
||||
char buf2[128];
|
||||
|
||||
s += XLAT("HyperRogue for Android");
|
||||
s += " ("VER"), http://www.roguetemple.com/z/hyper.php\n";
|
||||
s += " ("VER"), http://www.roguetemple.com/z/hyper/\n";
|
||||
s += XLAT("Date: %1 time: %2 s ", buf, its(savetime + time(NULL) - timerstart));
|
||||
s += XLAT("distance: %1\n", its(celldist(cwt.c)));
|
||||
// s += buf2;
|
||||
@ -294,7 +294,7 @@ void handleclick(MOBPAR_FORMAL) {
|
||||
|
||||
if(buttonclicked || outofmap(mouseh)) {
|
||||
|
||||
if(andmode == 0 && getcstat == 'g' && !shmup::on) {
|
||||
if(andmode == 0 && getcstat == 'g' && !shmup::on && (cmode == emNormal || cmode == emQuit)) {
|
||||
movepcto(MD_DROP);
|
||||
getcstat = 0;
|
||||
}
|
||||
@ -363,6 +363,10 @@ int touchedAt;
|
||||
|
||||
int getticks();
|
||||
|
||||
#ifdef ANDROIDSHARE
|
||||
void shareScore(MOBPAR_FORMAL);
|
||||
#endif
|
||||
|
||||
void mobile_draw(MOBPAR_FORMAL) {
|
||||
|
||||
optimizeview();
|
||||
@ -454,8 +458,8 @@ void mobile_draw(MOBPAR_FORMAL) {
|
||||
|
||||
if(inslider) keyreact = true;
|
||||
|
||||
#ifdef ANDROID
|
||||
if(getcstat == 's'-96) {
|
||||
#ifdef ANDROIDSHARE
|
||||
if(getcstat == 's'-96 && keyreact) {
|
||||
cmode = canmove ? emQuit : emNormal;
|
||||
shareScore(MOBPAR_ACTUAL);
|
||||
cmode = emNormal;
|
||||
|
@ -1796,6 +1796,21 @@ namespace mapeditor {
|
||||
}
|
||||
return (0x808080 + col[0] + (col[1] << 8) + (col[2] << 16)) >> (err?2:0);
|
||||
}
|
||||
if(whichCanvas == 'd') {
|
||||
int col[4];
|
||||
bool err = false;
|
||||
for(int j=0; j<4; j++) {
|
||||
col[j] = getCdata(c, j);
|
||||
col[j] *= 3;
|
||||
col[j] %= 240;
|
||||
if(col[j] > 120) col[j] = 240 - col[j];
|
||||
if(col[j] < -120) col[j] = -240 - col[j];
|
||||
}
|
||||
col[0] /= 8;
|
||||
col[1] /= 8;
|
||||
col[2] /= 8;
|
||||
return (0x101010 + col[0] + (col[1] << 8) + (col[2] << 16)) >> (err?2:0);
|
||||
}
|
||||
return canvasback;
|
||||
}
|
||||
}
|
||||
|
@ -220,10 +220,12 @@ void showMainMenu() {
|
||||
#endif
|
||||
|
||||
#ifdef MOBILE
|
||||
#ifdef HAVE_ACHIEVEMENTS
|
||||
dialog::addItem(XLAT("leaderboards/achievements"), '3');
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef ANDROIDSHARE
|
||||
dialog::addItem("SHARE", 's'-96);
|
||||
#endif
|
||||
|
||||
@ -279,11 +281,13 @@ void handleMenuKey(int sym, int uni) {
|
||||
achievement_final(false);
|
||||
}
|
||||
#ifdef MOBILE
|
||||
#ifdef HAVE_ACHIEVEMENTS
|
||||
else if(sym == '3') {
|
||||
achievement_final(false);
|
||||
cmode = emLeader;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ROGUEVIZ
|
||||
else if(uni == 'g') cmode = emRogueviz;
|
||||
#endif
|
||||
|
172
rogueviz.cpp
172
rogueviz.cpp
@ -30,7 +30,7 @@ bool specialmark = false;
|
||||
const char *fname;
|
||||
const char *cfname;
|
||||
|
||||
enum eVizkind { kNONE, kAnyGraph, kTree, kSpiral, kSAG };
|
||||
enum eVizkind { kNONE, kAnyGraph, kTree, kSpiral, kSAG, kCollatz };
|
||||
eVizkind kind;
|
||||
|
||||
bool on;
|
||||
@ -58,6 +58,58 @@ colorpair parse(const string& s) {
|
||||
return cp;
|
||||
}
|
||||
|
||||
int nh = 0;
|
||||
int hues[256*6];
|
||||
|
||||
void buildhue() {
|
||||
unsigned mh = 193;
|
||||
for(unsigned y=0; y<=mh; y++)
|
||||
hues[nh++] = (int) (0xFF + 0x1000000*mh + (unsigned) 0x10000 * y);
|
||||
for(unsigned y=0; y<=mh; y++)
|
||||
hues[nh++] = (int) (0xFF + 0x1010000*mh - 0x1000000 * y);
|
||||
for(unsigned y=0; y<=mh; y++)
|
||||
hues[nh++] = (int) (0xFF + 0x0010000*mh + 0x100 * y);
|
||||
for(unsigned y=0; y<=mh; y++)
|
||||
hues[nh++] = (int) (0xFF + 0x0010100*mh - 0x10000 * y);
|
||||
for(unsigned y=0; y<=mh; y++)
|
||||
hues[nh++] = (int) (0xFF + 0x0000100*mh + 0x1000000 * y);
|
||||
for(unsigned y=0; y<=mh; y++)
|
||||
hues[nh++] = (int) (0xFF + 0x1000100*mh - 0x100 * y);
|
||||
}
|
||||
|
||||
int perturb(int c) {
|
||||
if(nh == 0) buildhue();
|
||||
int hueid = 0;
|
||||
for(int t=0; t<nh; t++) if(hues[t] == c) hueid = t;
|
||||
hueid += rand() % 50;
|
||||
hueid -= rand() % 50;
|
||||
if(hueid<0) hueid += nh;
|
||||
hueid %= nh;
|
||||
return hues[hueid];
|
||||
/*
|
||||
int part[4];
|
||||
for(int u=0; u<=3; u++) {
|
||||
part[u] = (c >> (8*u)) & 0xFF;
|
||||
}
|
||||
int
|
||||
if(part[1] == 255 && part[2] == 0)
|
||||
int k =
|
||||
k += rand() % 16;
|
||||
k -= rand() % 16;
|
||||
if(k<0) k=-k;
|
||||
if(k>255) k = 255-(k-255);
|
||||
c &=~ (0xFF << (8*u));
|
||||
c |= k << (8*u);
|
||||
} */
|
||||
return c;
|
||||
}
|
||||
|
||||
colorpair perturb(colorpair cp) {
|
||||
cp.color1 = perturb(cp.color1);
|
||||
cp.color2 = perturb(cp.color2);
|
||||
return cp;
|
||||
}
|
||||
|
||||
struct vertexdata {
|
||||
vector<pair<int, edgeinfo*> > edges;
|
||||
string name;
|
||||
@ -187,6 +239,24 @@ namespace spiral {
|
||||
}
|
||||
}
|
||||
|
||||
namespace collatz {
|
||||
|
||||
double s2, s3, p2, p3;
|
||||
|
||||
void start() {
|
||||
init(); kind = kCollatz;
|
||||
vdata.resize(1);
|
||||
vertexdata& vd = vdata[0];
|
||||
createViz(0, cwt.c, Id);
|
||||
virtualRebase(vd.m, true);
|
||||
vd.cp = dftcolor;
|
||||
vd.data = 0;
|
||||
addedge(0, 0, 0, false);
|
||||
vd.name = "1";
|
||||
storeall();
|
||||
}
|
||||
}
|
||||
|
||||
int readLabel(FILE *f) {
|
||||
char xlabel[10000];
|
||||
if(fscanf(f, "%9500s", xlabel) <= 0) return -1;
|
||||
@ -310,11 +380,12 @@ namespace tree {
|
||||
}
|
||||
readnode(f, -1);
|
||||
fclose(f);
|
||||
int N = size(vdata);
|
||||
printf("N = %d\n", N);
|
||||
printf("Assigning spos/epos...\n");
|
||||
spos(0, 0);
|
||||
printf("Creating vertices...\n");
|
||||
xpos *= 6;
|
||||
int N = size(vdata);
|
||||
printf("Creating vertices...\n");
|
||||
for(int i=0; i<N; i++) {
|
||||
treevertex& lv = tol[i];
|
||||
vertexdata& vd = vdata[i];
|
||||
@ -882,7 +953,7 @@ void drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
|
||||
if(!gmatrix.count(m->base)) printf("base not in gmatrix\n");
|
||||
|
||||
int lid = shmup::lmousetarget ? shmup::lmousetarget->pid : -2;
|
||||
|
||||
|
||||
if(!leftclick) for(int j=0; j<size(vd.edges); j++) {
|
||||
edgeinfo *ei = vd.edges[j].second;
|
||||
if(!ei->visible) continue;
|
||||
@ -929,15 +1000,25 @@ void drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
|
||||
display(shmup::calc_gmatrix(vd2.m->base));
|
||||
} */
|
||||
|
||||
if(ei->orig && ei->orig->cpdist >= 3) ei->orig = NULL;
|
||||
if(!ei->orig) {
|
||||
ei->orig = cwt.c;
|
||||
ei->prec.clear();
|
||||
transmatrix T = inverse(shmup::ggmatrix(ei->orig));
|
||||
storeline(ei->prec, T*h1, T*h2);
|
||||
int col =
|
||||
((hilite ? 0xFF0000 : backcolor ? 0x808080 : 0xFFFFFF) << 8) + xlalpha;
|
||||
|
||||
if(pmodel) {
|
||||
queueline(h1, h2, col, 2);
|
||||
lastptd().prio = PPR_STRUCT0;
|
||||
}
|
||||
else {
|
||||
|
||||
if(ei->orig && ei->orig->cpdist >= 3) ei->orig = NULL;
|
||||
if(!ei->orig) {
|
||||
ei->orig = cwt.c;
|
||||
ei->prec.clear();
|
||||
transmatrix T = inverse(shmup::ggmatrix(ei->orig));
|
||||
storeline(ei->prec, T*h1, T*h2);
|
||||
}
|
||||
queuetable(shmup::ggmatrix(ei->orig), &ei->prec[0], size(ei->prec)/3, col, 0,
|
||||
PPR_STRUCT0);
|
||||
}
|
||||
queuetable(shmup::ggmatrix(ei->orig), &ei->prec[0], size(ei->prec)/3, ((hilite ? 0xFF0000 : backcolor ? 0x808080 : 0xFFFFFF) << 8) + xlalpha, 0,
|
||||
PPR_STRUCT0);
|
||||
}
|
||||
/*
|
||||
*/
|
||||
@ -962,6 +1043,66 @@ void drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
|
||||
if(doshow) queuestr(V2, (svg::in ? .28 : .2) * crossf / hcrossf, vd.name, backcolor ? 0x000000 : 0xFFFF00, svg::in ? 0 : 1);
|
||||
lastptd().info = vd.info;
|
||||
}
|
||||
|
||||
if(kind == kCollatz) {
|
||||
if(vd.data == 2) {
|
||||
// doubler vertex
|
||||
string s = vd.name;
|
||||
colorpair cp = vd.cp;
|
||||
vd.data = 20;
|
||||
int i0 = size(vdata);
|
||||
vdata.resize(i0+1);
|
||||
vertexdata& vdn = vdata[i0];
|
||||
createViz(i0, m->base, m->at * spin(collatz::s2) * xpush(collatz::p2));
|
||||
virtualRebase(vdn.m, true);
|
||||
vdn.cp = perturb(cp);
|
||||
vdn.data = 0;
|
||||
addedge(i, i0, 0, false);
|
||||
vdn.m->store();
|
||||
int carry = 0;
|
||||
string s2 = s;
|
||||
for(int i=size(s2)-1; i>=0; i--) {
|
||||
int x = 2*(s2[i] - '0') + carry;
|
||||
carry = x>=10;
|
||||
if(carry) x-=10;
|
||||
s2[i] = '0'+x;
|
||||
}
|
||||
if(carry) s2 = "1" + s2;
|
||||
vdn.name = s2;
|
||||
|
||||
int m3 = 0;
|
||||
for(int i=0; i<size(s); i++) m3 += s[i] - '0';
|
||||
|
||||
if(m3 % 3 == 2 && s != "2" && s != "1") {
|
||||
vdata.resize(i0+2);
|
||||
vertexdata& vdn = vdata[i0+1];
|
||||
createViz(i0+1, m->base, m->at * spin(collatz::s3) * xpush(collatz::p3));
|
||||
virtualRebase(vdn.m, true);
|
||||
vdn.cp = perturb(cp);
|
||||
vdn.data = 0;
|
||||
addedge(i, i0+1, 0, false);
|
||||
vdn.m->store();
|
||||
int carry = -1;
|
||||
string s2 = s;
|
||||
for(int i=size(s2)-1; i>=0; i--) {
|
||||
carry += 2 * (s2[i] - '0');
|
||||
int ncarry = 0;
|
||||
while(carry % 3) carry += 10, ncarry--;
|
||||
if(carry >= 30) carry -= 30, ncarry += 3;
|
||||
s2[i] = '0'+carry/3;
|
||||
carry = ncarry;
|
||||
}
|
||||
if(s2[0] == '0') s2 = s2.substr(1);
|
||||
vdn.name = s2;
|
||||
vdn.cp = perturb(vdn.cp);
|
||||
}
|
||||
}
|
||||
else if(vd.data < 2) {
|
||||
vd.data++;
|
||||
fixmatrix(vd.m->at);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool virt(shmup::monster *m) {
|
||||
@ -1166,6 +1307,13 @@ int readArgs() {
|
||||
// example commandline:
|
||||
// -spiral 2,10000 -spiraledge 0,2 -spiraledge 1,1 -lab -spiralcolor 2 FF4040FF
|
||||
|
||||
else if(argis("-collatz")) {
|
||||
PHASE(3);
|
||||
using namespace collatz;
|
||||
shift(); sscanf(args(), "%lf,%lf,%lf,%lf", &s2, &p2, &s3, &p3);
|
||||
start();
|
||||
}
|
||||
|
||||
else if(argis("-spiral")) {
|
||||
PHASE(3);
|
||||
ld mul = 2;
|
||||
|
Loading…
Reference in New Issue
Block a user