- Fixed bug with damaging terrain – it would print all messages instead of the one specific to the requested damage type.

- The trim and walkway are partially functional. That is, it correctly detects when to round off walls and walkways. It draws them incorrectly though.

git-svn-id: http://openexile.googlecode.com/svn/trunk@61 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
2009-05-20 13:50:19 +00:00
parent bf1487114a
commit 70c7895480
5 changed files with 68 additions and 49 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 MiB

After

Width:  |  Height:  |  Size: 6.4 MiB

View File

@@ -2185,35 +2185,35 @@ void place_trim(short q,short r,location where,unsigned short ter_type)
unsigned short to_right = coord_to_ter(where.x + 1,where.y);
unsigned short below = coord_to_ter(where.x,where.y + 1);
if (is_wall(to_left) && is_wall(above) && is_ground(to_right) && is_ground(below))
draw_trim(q,r,11,ter_type);
draw_trim(q,r,11,to_right);
if (is_wall(to_left) && is_wall(below) && is_ground(to_right) && is_ground(above))
draw_trim(q,r,9,ter_type);
draw_trim(q,r,9,to_right);
if (is_wall(to_right) && is_wall(above) && is_ground(to_left) && is_ground(below))
draw_trim(q,r,10,ter_type);
draw_trim(q,r,10,to_left);
if (is_wall(to_right) && is_wall(below) && is_ground(to_left) && is_ground(above))
draw_trim(q,r,8,ter_type);
draw_trim(q,r,8,to_left);
if (is_ground(to_left) && is_ground(above) && is_ground(to_right) && is_wall(below)) {
draw_trim(q,r,8,ter_type);
draw_trim(q,r,9,ter_type);
draw_trim(q,r,8,to_right);
draw_trim(q,r,9,to_right);
}
if (is_wall(to_left) && is_ground(below) && is_ground(to_right) && is_ground(above)) {
draw_trim(q,r,9,ter_type);
draw_trim(q,r,11,ter_type);
draw_trim(q,r,9,to_right);
draw_trim(q,r,11,to_right);
}
if (is_ground(to_right) && is_wall(above) && is_ground(to_left) && is_ground(below)) {
draw_trim(q,r,10,ter_type);
draw_trim(q,r,11,ter_type);
draw_trim(q,r,10,to_left);
draw_trim(q,r,11,to_left);
}
if (is_wall(to_right) && is_ground(below) && is_ground(to_left) && is_ground(above)) {
draw_trim(q,r,8,ter_type);
draw_trim(q,r,10,ter_type);
draw_trim(q,r,8,to_left);
draw_trim(q,r,10,to_left);
}
// }
}
@@ -2258,18 +2258,17 @@ void draw_trim(short q,short r,short which_trim,unsigned short ground_ter)
OffsetRect(&trim_rects[11],98,18);
int i;
for(i = 0; i < 12; i++) OffsetRect(&trim_rects[i],112,36);
for(i = 0; i < 8 ; i++) OffsetRect(&walkway_rects[i],i*28,(i/4)*36);
for(i = 0; i < 8 ; i++) OffsetRect(&walkway_rects[i],(i%4)*28,(i/4)*36);
OffsetRect(&walkway_rects[8],196,0);
}
PixMapHandle store1,store2,store3;
RGBColor test_color = {0,0,0}, store_color;
if (frills_on == false)
return;
// if current ground is grass, forget trim
if ((current_ground == 2) && (which_trim < 3))
return;
// if ((current_ground == 2) && (which_trim < 3))
// return;
terrain_there[q][r] = -1;
GetBackColor(&store_color);
@@ -2285,7 +2284,7 @@ void draw_trim(short q,short r,short which_trim,unsigned short ground_ter)
unsigned short pic = scenario.ter_types[ground_ter].picture;
if(pic < 400){
from_gworld = terrain_gworld[pic / 50];
pic /= 50;
pic %= 50;
OffsetRect(&from_rect,28 * (pic % 10), 36 * (pic / 10));
}else if(pic < 1000){
from_gworld = anim_gworld;
@@ -2297,27 +2296,41 @@ void draw_trim(short q,short r,short which_trim,unsigned short ground_ter)
from_rect = get_custom_rect(pic);
}
if(which_trim < 50) mask_rect = trim_rects[which_trim];
else mask_rect = walkway_rects[which_trim];
else mask_rect = walkway_rects[which_trim - 50];
to_rect = coord_to_rect(q,r);
// to_rect.right = to_rect.left + trim_rects[which_mode].right;
// to_rect.left = to_rect.left + trim_rects[which_mode].left;
// to_rect.bottom = to_rect.top + trim_rects[which_mode].bottom;
// to_rect.top = to_rect.top + trim_rects[which_mode].top;
// OffsetRect(&to_rect,-61,-37);
// OffsetRect(&to_rect,-61,-37);
if(which_trim == 0 || which_trim == 4 || which_trim == 6 || which_trim == 8 || which_trim == 10){
from_rect.right -= 14;
to_rect.right -= 14;
}else if(which_trim == 1 || which_trim == 5 || which_trim == 7 || which_trim == 9 || which_trim == 11){
from_rect.left += 14;
to_rect.left += 14;
}
if(which_trim == 2 || which_trim == 4 || which_trim == 5 || which_trim == 8 || which_trim == 9){
from_rect.bottom -= 18;
to_rect.bottom -= 18;
}else if(which_trim == 3 || which_trim == 6 || which_trim == 7 || which_trim == 10 || which_trim == 11){
from_rect.top += 18;
to_rect.top += 18;
}
store1 = GetPortPixMap(from_gworld);
store2 = GetPortPixMap(roads_gworld);
store3 = GetPortPixMap(terrain_screen_gworld);
LockPixels(store3);
LockPixels(store2);
LockPixels(store1);
CopyMask ((BitMap*) *store1,
(BitMap*) *store2,
(BitMap*) *store3,
PixMapHandle from_bits = GetPortPixMap(from_gworld);
PixMapHandle mask_bits = GetPortPixMap(roads_gworld);
PixMapHandle to_bits = GetPortPixMap(terrain_screen_gworld);
LockPixels(to_bits);
LockPixels(mask_bits);
LockPixels(from_bits);
CopyMask ((BitMap*) *from_bits,
(BitMap*) *mask_bits,
(BitMap*) *to_bits,
&from_rect, &mask_rect, &to_rect);
UnlockPixels(store1);
UnlockPixels(store2);
UnlockPixels(store3);
UnlockPixels(from_bits);
UnlockPixels(mask_bits);
UnlockPixels(to_bits);
RGBBackColor(&store_color);
}

View File

@@ -863,8 +863,8 @@ bool is_ground(unsigned short ter_type)
return false;
if(scenario.ter_types[ter_type].block_horse)
return false;
if(scenario.ter_types[ter_type].trim_type == TRIM_WALKWAY)
return false;
// if(scenario.ter_types[ter_type].trim_type == TRIM_WALKWAY)
// return false;
return true;
// short pic;
//

View File

@@ -307,23 +307,29 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short
add_string_to_buf(" It doesn't affect you.");
goto LBL_NO_DAMAGE;
}
break;
case DAMAGE_COLD:
add_string_to_buf(" You feel cold!");
pic_type = 4;
break;
case DAMAGE_MAGIC:
case DAMAGE_UNBLOCKABLE:
add_string_to_buf(" Something shocks you!");
pic_type = 1;
break;
case DAMAGE_WEAPON:
add_string_to_buf(" You feel pain!");
pic_type = 3;
break;
case DAMAGE_POISON:
add_string_to_buf(" You suddenly feel very ill for a moment...");
pic_type = 2;
break;
case DAMAGE_UNDEAD:
case DAMAGE_DEMON:
add_string_to_buf(" A dark wind blows through you!");
pic_type = 1; // TODO: Verify that this is correct
break;
}
r1 = get_ran(ter_flag2,dam_type,ter_flag1);
if (mode < 2)

View File

@@ -96,6 +96,22 @@ cTerrain& cTerrain::operator = (legacy::terrain_type_type& old){
};
picture = old.picture;
blockage = old.blockage;
if(picture >= 260) combat_arena = 1;
else combat_arena = arenas[picture];
if(picture < 260){
ground_type = ground[picture];
trim_type = (eTrimType) trims[picture];
trim_ter = trim_ters[picture];
}else if(picture >= 400 && picture < 1000){
ground_type = ground[picture - 140];
trim_type = (eTrimType) trims[picture - 140];
trim_ter = trim_ters[picture - 140];
}else{ // TODO: Implement new-style road and walkway handling, and deprecate picture 216.
ground_type = 255;
trim_type = TRIM_NONE;
trim_ter = 0;
}
if(trim_ter == 99) trim_ter = 0;
flag1 = old.flag1;
flag2 = old.flag2;
switch(old.special){
@@ -238,22 +254,6 @@ cTerrain& cTerrain::operator = (legacy::terrain_type_type& old){
light_radius = old.light_radius;
step_sound = old.step_sound;
shortcut_key = old.shortcut_key;
if(picture >= 260) combat_arena = 1;
else combat_arena = arenas[picture];
if(picture < 260){
ground_type = ground[picture];
trim_type = (eTrimType) trims[picture];
trim_ter = trim_ters[picture];
}else if(picture >= 400 && picture < 1000){
ground_type = ground[picture - 140];
trim_type = (eTrimType) trims[picture - 140];
trim_ter = trim_ters[picture - 140];
}else{ // TODO: Implement new-style road and walkway handling, and deprecate picture 216.
ground_type = 255;
trim_type = TRIM_NONE;
trim_ter = 0;
}
if(trim_ter == 99) trim_ter = 0;
switch(picture){
// Rubbles, plus pentagram as a bonus
case 68: