Project

General

Profile

Revision 214

fixed part of the problem with the bullet

View differences:

proj/include/proj_macros.h
37 37
#define GRAPH_MODE      DIRECT_1024_768_888 /** @brief Graphic mode used */
38 38
#define MIN_SCALE       0.2                  /** @brief Minimum zoom */
39 39
#define DEFAULT_SCALE   0.5                  /** @brief Default zoom */
40
#define MAX_SCALE       2.0                 /** @brief Maximum zoom */
40
#define MAX_SCALE       10.0                 /** @brief Maximum zoom */
41 41

  
42 42
#endif /* end of include guard: PROJ_MACROS_H_INCLUDED */
proj/src/graph.c
359 359
        xmin = min(x, xmin); xmax = max(x, xmax); ymin = min(y, ymin); ymax = max(y, ymax);
360 360
        sprite_pic2src(p, w, h, &x, &y);
361 361
        xmin = min(x, xmin); xmax = max(x, xmax); ymin = min(y, ymin); ymax = max(y, ymax);
362
        xmin = max(xmin-2, 0); xmax = min(xmax+2, graph_get_XRes());
363
        ymin = max(ymin-2, 0); ymax = min(ymax+2, graph_get_YRes());
362
        xmin = max(xmin-(int16_t)p->scale-2, 0); xmax = min(xmax+(int16_t)p->scale+2, graph_get_XRes());
363
        ymin = max(ymin-(int16_t)p->scale-2, 0); ymax = min(ymax+(int16_t)p->scale+2, graph_get_YRes());
364 364
    }
365 365
    const uint8_t *map = basic_sprite_get_map(p->bsp);
366 366
    const uint16_t bytes_pixel = graph_get_bytes_pixel();
proj/src/proj.c
109 109
    #endif
110 110

  
111 111
    #ifdef TELMO
112
        ent_set_scale(1.0);
112
        ent_set_scale(10.0);
113 113

  
114 114
        gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol); if(shooter1 == NULL) printf("Failed to get shooter1\n");
115 115
        gunner_set_pos(shooter1, 0, 0);
116
        ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
117
                       gunner_get_y(shooter1)-ent_get_YLength()/2.0);
118 116

  
119 117
        gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_nothing);
120 118
        gunner_set_pos(shooter2, -50, -50);
......
122 120
        bullet_t *bullet = bullet_ctor(get_bullet());
123 121
        bullet_set_pos(bullet, 400, 400);
124 122

  
123
        ent_set_origin(bullet_get_x(bullet)-ent_get_XLength()/2.0,
124
                       bullet_get_y(bullet)-ent_get_YLength()/2.0);
125

  
125 126
        graph_clear_screen();
126 127
        gunner_draw(shooter1);
127 128
        sprite_draw(sp_crosshair);
......
161 162
                                if (no_interrupts % refresh_count_value == 0) {
162 163
                                    update_movement(shooter1);
163 164
                                    update_scale();
164
                                    ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0,
165
                                                   gunner_get_y(shooter1)-ent_get_YLength()/2.0);
166 165

  
166
                                    ent_set_origin(bullet_get_x(bullet)-ent_get_XLength()/2.0,
167
                                                   bullet_get_y(bullet)-ent_get_YLength()/2.0);
168

  
167 169
                                    sprite_set_pos(sp_crosshair, get_mouse_X(), get_mouse_Y());
168 170
                                    double angle = get_mouse_angle(shooter1);
169 171
                                    gunner_set_angle(shooter1, angle - M_PI_2);

Also available in: Unified diff