|
Atrinik Client 2.5
|
#include <global.h>Go to the source code of this file.
Data Structures | |
| struct | line_and_slope |
Typedefs | |
| typedef struct line_and_slope | line_and_slope |
Functions | |
| static void | determine_line (line_and_slope *dest, int sx, int sy, int ex, int ey) |
| int | add_color_to_surface (SDL_Surface *dest, Uint8 red, Uint8 green, Uint8 blue) |
| int | copy_pixel_to_pixel (SDL_Surface *src, SDL_Surface *dest, int x, int y, int x2, int y2, float brightness) |
| int | copy_vertical_line (SDL_Surface *src, SDL_Surface *dest, int src_x, int src_sy, int src_ey, int dest_x, int dest_sy, int dest_ey, float brightness, int extra) |
| SDL_Surface * | tile_stretch (SDL_Surface *src, int n, int e, int s, int w) |
Variables | |
| static int | std_tile_half_len [] |
Tile stretching routines.
Tile stretching stretches all floor tiles and modifies y position of all other layer objects, for example, floor tile with "z 4" would be stretched, and all objects above it would have z increased by 4. Layer 2 objects are also stretched.
align_tile_stretch() calculates how much to stretch each tile in all 4 directions based on the surrounding tiles.
Support for negative z (so surrounding tiles can have "z 0", and the middle one "z 4" to make it look like a hole, for example).
Most fmasks (grass, for example) are not properly stretched.
Definition in file tilestretcher.c.
| typedef struct line_and_slope line_and_slope |
Line information structure.
| int add_color_to_surface | ( | SDL_Surface * | dest, |
| Uint8 | red, | ||
| Uint8 | green, | ||
| Uint8 | blue | ||
| ) |
Adds a colour to the palette in a bitmap ("surface").
Definition at line 157 of file tilestretcher.c.
| int copy_pixel_to_pixel | ( | SDL_Surface * | src, |
| SDL_Surface * | dest, | ||
| int | x, | ||
| int | y, | ||
| int | x2, | ||
| int | y2, | ||
| float | brightness | ||
| ) |
Copy a pixel from a source pixel map's co-ordinates to a target pixel map's co-ordinates, adjusting the pixel's brightness.
Pseudo-code:
PIXEL(dest, x2, y2) = AdjustPixelBrightness(PIXEL(src, x1, y1), brightness)
Definition at line 193 of file tilestretcher.c.
| int copy_vertical_line | ( | SDL_Surface * | src, |
| SDL_Surface * | dest, | ||
| int | src_x, | ||
| int | src_sy, | ||
| int | src_ey, | ||
| int | dest_x, | ||
| int | dest_sy, | ||
| int | dest_ey, | ||
| float | brightness, | ||
| int | extra | ||
| ) |
Copy a vertical line from a source pixel map's co-ordinates to a target pixel map's co-ordinates, adjusting all the pixels' brightness.
This also applies a transmutation, "stretching" or "shrinking the line as appropriate:
If the target is twice the length it will receive pairs of pixels from the source, and if half the length every other pixel.
brightness applies to all pixels: above 1.0 is (apparently) allowed but brightness < 0 is not tested and could cause problems.
Set extra non-zero to duplicate the top pixel if the target line height is shorter than the source.
Definition at line 277 of file tilestretcher.c.
| static void determine_line | ( | line_and_slope * | dest, |
| int | sx, | ||
| int | sy, | ||
| int | ex, | ||
| int | ey | ||
| ) | [static] |
Calculate line information given its start and end co-ordinates.
This populates a line_and_slope structure.
| dest | What line information structure to populate. |
| sx | Starting X. |
| sy | Starting Y. |
| ex | Ending X. |
| ey | Ending Y. * |
Definition at line 117 of file tilestretcher.c.
| SDL_Surface* tile_stretch | ( | SDL_Surface * | src, |
| int | n, | ||
| int | e, | ||
| int | s, | ||
| int | w | ||
| ) |
Generates the bitmap ("surface") for displaying a tile after stretching.
Stretching takes place from the horizontal centre, so from a "standard" viewpoint (i.e. some distance away from the viewed object), horizontal stretching should be done with either e or w <= 0 and the other > 0 (the part of the object appearing the original size centres on the zero).
Their absolute difference controls the brightness of the edges, so at the moment a horizontal line of horizontally stretched objects will appear to have vertical "bars" - especially as the underlying pixel stretching only occurs vertically (i.e. the measured "width" doesn't change).
Recommended limit is that neither e nor w exceed n+9. Major problems may occur if the total horizontal stretching (i.e. ABS(e - w)) exceeds 25.
Parameter documentation repeated in the body:
Definition at line 387 of file tilestretcher.c.
int std_tile_half_len[] [static] |
{
0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
10, 10, 11, 11, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5,
5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0
}
Pixel y-co-ordinate (offset) of the edge of a standard (i.e. un-stretched) tile for each x co-ordinate pixel. In our isometric view the displayed "depth" is half the width. The tile pixels then form a rhombus on the VDU:
//\\
^ // \\
| // \\
y // \\
W // \\ N
// \\
// \\
// \\
// \\
// \\
// \\
// \\
\\ //
\\ //
\\ //
\\ //
\\ //
\\ //
\\ //
S \\ // E
\\ //
\\ //
| \\ //
+ - \\// x - >
Definition at line 79 of file tilestretcher.c.
1.7.4