~ubuntu-branches/ubuntu/saucy/sgt-puzzles/saucy

« back to all changes in this revision

Viewing changes to inertia.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings
  • Date: 2008-04-13 17:39:38 UTC
  • mto: (1.1.6 upstream) (3.1.2 lenny)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20080413173938-nnrvlls98m6ky6eq
ImportĀ upstreamĀ versionĀ 7983

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
    game_params *ret = snew(game_params);
89
89
 
90
90
    ret->w = 10;
 
91
#ifdef PORTRAIT_SCREEN
 
92
    ret->h = 10;
 
93
#else
91
94
    ret->h = 8;
92
 
 
 
95
#endif
93
96
    return ret;
94
97
}
95
98
 
106
109
}
107
110
 
108
111
static const struct game_params inertia_presets[] = {
 
112
#ifdef PORTRAIT_SCREEN
 
113
    { 10, 10 },
 
114
    { 12, 12 },
 
115
    { 16, 16 },
 
116
#else
109
117
    { 10, 8 },
110
118
    { 15, 12 },
111
119
    { 20, 16 },
 
120
#endif
112
121
};
113
122
 
114
123
static int game_fetch_preset(int i, char **name, game_params **params)
1511
1520
 
1512
1521
#define PREFERRED_TILESIZE 32
1513
1522
#define TILESIZE (ds->tilesize)
 
1523
#ifdef SMALL_SCREEN
 
1524
#define BORDER    (TILESIZE / 4)
 
1525
#else
1514
1526
#define BORDER    (TILESIZE)
 
1527
#endif
1515
1528
#define HIGHLIGHT_WIDTH (TILESIZE / 10)
1516
1529
#define COORD(x)  ( (x) * TILESIZE + BORDER )
1517
1530
#define FROMCOORD(x)  ( ((x) - BORDER + TILESIZE) / TILESIZE - 1 )
1613
1626
            sol->list[i] = move[i] - '0';
1614
1627
        ret = dup_game(state);
1615
1628
        ret->cheated = TRUE;
 
1629
        if (ret->soln && --ret->soln->refcount == 0) {
 
1630
            sfree(ret->soln->list);
 
1631
            sfree(ret->soln);
 
1632
        }
1616
1633
        ret->soln = sol;
1617
1634
        ret->solnpos = 0;
1618
1635
        sol->refcount = 1;
1911
1928
        int coords[8];
1912
1929
 
1913
1930
        coords[0] = tx+TILESIZE/2;
1914
 
        coords[1] = ty+TILESIZE*1/7;
1915
 
        coords[2] = tx+TILESIZE*1/7;
 
1931
        coords[1] = ty+TILESIZE/2-TILESIZE*5/14;
 
1932
        coords[2] = tx+TILESIZE/2-TILESIZE*5/14;
1916
1933
        coords[3] = ty+TILESIZE/2;
1917
1934
        coords[4] = tx+TILESIZE/2;
1918
 
        coords[5] = ty+TILESIZE-TILESIZE*1/7;
1919
 
        coords[6] = tx+TILESIZE-TILESIZE*1/7;
 
1935
        coords[5] = ty+TILESIZE/2+TILESIZE*5/14;
 
1936
        coords[6] = tx+TILESIZE/2+TILESIZE*5/14;
1920
1937
        coords[7] = ty+TILESIZE/2;
1921
1938
 
1922
1939
        draw_polygon(dr, coords, 4, COL_GEM, COL_OUTLINE);
2152
2169
#endif
2153
2170
 
2154
2171
const struct game thegame = {
2155
 
    "Inertia", "games.inertia",
 
2172
    "Inertia", "games.inertia", "inertia",
2156
2173
    default_params,
2157
2174
    game_fetch_preset,
2158
2175
    decode_params,