static PyObject* _gfx_zoomsize (PyObject *self, PyObject *args) { PyObject *obj = NULL; int w, h, dstw, dsth; double zoomx, zoomy; if (!PyArg_ParseTuple (args, "iidd:zoom_size", &w, &h, &zoomx, &zoomy)) { PyErr_Clear (); if (PyArg_ParseTuple (args, "Odd:zoom_size", &obj, &zoomx, &zoomy)) { if (PySDLSurface_Check (obj)) { w = ((PySDLSurface *)obj)->surface->w; h = ((PySDLSurface *)obj)->surface->w; } else { if (!SizeFromObj (obj, (pgint32*)&w, (pgint32*)&h)) return NULL; } } else return NULL; } zoomSurfaceSize (w, h, zoomx, zoomy, &dstw, &dsth); return Py_BuildValue ("(ii)", dstw, dsth); }
/** * Draw a single object on the map. * @param x X position of the object. * @param y Y position of the object. * @param k Layer. * @param player_height_offset Player's height offset. */ static void draw_map_object(int x, int y, int layer, int player_height_offset) { struct MapCell *map = &the_map.cells[x][y]; _Sprite *face_sprite; int ypos, xpos; int xl, yl, temp; int xml, xmpos, xtemp = 0; uint16 face; int mid, mnr; uint32 stretch = 0; _BLTFX bltfx; int bitmap_h, bitmap_w; bltfx.surface = NULL; xpos = MAP_START_XOFF + x * MAP_TILE_YOFF - y * MAP_TILE_YOFF; ypos = MAP_START_YOFF + x * MAP_TILE_XOFF + y * MAP_TILE_XOFF; face = map->faces[layer]; if (face <= 0 || face >= MAX_FACE_TILES) { return; } face_sprite = FaceList[face].sprite; if (!face_sprite) { return; } bitmap_h = face_sprite->bitmap->h; bitmap_w = face_sprite->bitmap->w; if (map->zoom[layer] && map->zoom[layer] != 100) { zoomSurfaceSize(bitmap_w, bitmap_h, map->zoom[layer] / 100.0, map->zoom[layer] / 100.0, &bitmap_w, &bitmap_h); } /* We have a set quick_pos = multi tile */ if (map->quick_pos[layer]) { mnr = map->quick_pos[layer]; mid = mnr >> 4; mnr &= 0x0f; xml = MultiArchs[mid].xlen; yl = ypos - MultiArchs[mid].part[mnr].yoff + MultiArchs[mid].ylen - bitmap_h; /* we allow overlapping x borders - we simply center then */ xl = 0; if (bitmap_w > MultiArchs[mid].xlen) { xl = (MultiArchs[mid].xlen - bitmap_w) >> 1; }