projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3dbea1a
)
code cleanup (MM engine)
author
Holger Schemel
<info@artsoft.org>
Tue, 21 Feb 2017 06:57:39 +0000
(07:57 +0100)
committer
Holger Schemel
<info@artsoft.org>
Fri, 23 Mar 2018 22:21:08 +0000
(23:21 +0100)
src/game_mm/mm_game.c
patch
|
blob
|
history
diff --git
a/src/game_mm/mm_game.c
b/src/game_mm/mm_game.c
index 7310c0e1bde0fcedbd45e81f67c5cdc64c559702..4f4af5f87c9aac8c71acb7a51ab4ffd0803cf6e6 100644
(file)
--- a/
src/game_mm/mm_game.c
+++ b/
src/game_mm/mm_game.c
@@
-507,36
+507,34
@@
int ScanPixel()
for (i=0; i<4; i++)
{
for (i=0; i<4; i++)
{
+ int px = LX + (i % 2) * 2;
+ int py = LY + (i / 2) * 2;
+ int dx = px % TILEX;
+ int dy = py % TILEY;
+ int lx = (px + TILEX) / TILEX - 1; /* ...+TILEX...-1 to get correct */
+ int ly = (py + TILEY) / TILEY - 1; /* negative values! */
Pixel pixel;
Pixel pixel;
- int px, py, lx, ly;
-
- px = SX + LX + (i % 2) * 2;
- py = SY + LY + (i / 2) * 2;
- lx = (px - SX + TILEX) / TILEX - 1; /* ...+TILEX...-1 to get correct */
- ly = (py - SY + TILEY) / TILEY - 1; /* negative values! */
if (IN_LEV_FIELD(lx, ly))
{
int element = Feld[lx][ly];
if (element == EL_EMPTY || element == EL_EXPLODING_TRANSP)
if (IN_LEV_FIELD(lx, ly))
{
int element = Feld[lx][ly];
if (element == EL_EMPTY || element == EL_EXPLODING_TRANSP)
+ {
pixel = 0;
pixel = 0;
+ }
else if (IS_WALL(element) || IS_WALL_CHANGING(element))
{
else if (IS_WALL(element) || IS_WALL_CHANGING(element))
{
- int pos =
- ((py - SY - ly * TILEY) / MINI_TILEX) * 2 +
- (px - SX - lx * TILEX) / MINI_TILEY;
+ int pos = dy / MINI_TILEY * 2 + dx / MINI_TILEX;
pixel = ((element & (1 << pos)) ? 1 : 0);
}
else
{
int graphic_mask = getMaskFromElement(element);
pixel = ((element & (1 << pos)) ? 1 : 0);
}
else
{
int graphic_mask = getMaskFromElement(element);
- int mask_x, mask_y;
- int dx = px - SX - lx * TILEX;
- int dy = py - SY - ly * TILEY;
Bitmap *bitmap;
int src_x, src_y;
Bitmap *bitmap;
int src_x, src_y;
+ int mask_x, mask_y;
getGraphicSource(graphic_mask, 0, &bitmap, &src_x, &src_y);
getGraphicSource(graphic_mask, 0, &bitmap, &src_x, &src_y);
@@
-548,11
+546,8
@@
int ScanPixel()
}
else
{
}
else
{
- if (px < REAL_SX || px >= REAL_SX + FULL_SXSIZE ||
- py < REAL_SY || py >= REAL_SY + FULL_SYSIZE)
- pixel = 1;
- else
- pixel = 0;
+ pixel = (SX + px < REAL_SX || SX + px >= REAL_SX + FULL_SXSIZE ||
+ SY + py < REAL_SY || SY + py >= REAL_SY + FULL_SYSIZE);
}
if ((Sign[laser.current_angle] & (1 << i)) && pixel)
}
if ((Sign[laser.current_angle] & (1 << i)) && pixel)