From c958e5b01c2eff188044fbe814091d779322ae0a Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Tue, 2 Jun 2009 02:07:17 +0000 Subject: [PATCH] - Generalized the special queue which was formerly used only for town enter/leave specials, and made the see monster special also use it. - Redid the draw items and draw fields code to draw just on one space rather than the entire area. - Fixed bug where special spots were not masked properly. - Removed some large chunks of commented, obsolete code. - Found and fixed bug where the instant help system caused the game to believe you had stolen items when in fact you hadn't. - Added enum for special node context (ie the context in which a special node is being run); not really used yet though. - Added support and graphic for forcecage, and graphic for stone block; mechanics not yet implemented. git-svn-id: http://openexile.googlecode.com/svn/trunk@88 4ebdad44-0ea0-11de-aab3-ff745001d230 --- osx/Scenario Editor/Blades of Exile Graphics | Bin 6836311 -> 6966729 bytes osx/Scenario Editor/scen.graphics.cpp | 14 +- osx/Scenario Editor/scen.graphics.h | 1 + osx/boe.actions.cpp | 17 +- osx/boe.graphics.cpp | 329 ++++++-------- osx/boe.graphutil.cpp | 429 ++++++++----------- osx/boe.graphutil.h | 9 +- osx/boe.items.cpp | 2 +- osx/boe.town.cpp | 14 +- osx/classes/monster.cpp | 6 + osx/classes/monster.h | 1 + osx/classes/simpletypes.h | 22 + osx/classes/special.h | 7 + osx/classes/universe.cpp | 14 + osx/classes/universe.h | 2 + 15 files changed, 388 insertions(+), 479 deletions(-) diff --git a/osx/Scenario Editor/Blades of Exile Graphics b/osx/Scenario Editor/Blades of Exile Graphics index 5b0d7d8cd9cfd20096ba9f162874f9d00ef443c7..97f9d0c4518bf5815a144166ca6ae7e1a7faecb6 100644 GIT binary patch delta 6284 zcmeHLdr(x@89#R)EaD2Qusqj@1{EW&=z153B!D~?UBm?z#fXRk>l&qirV})=>mv!; zCKFOKexc4JF=?lhF`d{novWc5lNo2U;$zy(#L3u}40cG;rr={TPTRQszH=XYS%^)> z{@Kg?xW9YO-FtrLJHPXtbMGgwA2pso@|MxYn84WM#aG$mMOPWK-gs&1js1eqBXAh- zY($t4W<(6af`~;-Lc}2^Bdmxih&h?$64hzAi_h}noah`ESt#5}}9i1~;d!~%p9u@I4qScF)Na3PjRf*|@=OcuVW zW%AJr&0aAzgY~jOUhn{hA&xUF*@r>714moi9u|7xl2^=`g7;NoEkU>=ZG5%NVL1F& zW}&p9S_}%(VD3_f0eT*3h=-z&>f@zwjabG@GYwKpz1YZkwm}+h5F0qpF-Th*MIYz6 z2KZpAI|kai#A*0U6NJx+HkjXx|IVcQ<;!0#Z59Q$0-=qGX;r*Nsz+Ug1Sx{tmn_*gKZmuoh3I_--CIf8w)vKttfW3{8x?02{ z0bZZK?p7WBoB_bC)o0M}2N+BpbvocQ24pd6==**EA8brFxLn}# z_@5=UvC^%8_=o__bJmR*@%eD&y59~yN0kX)TjWmFSke?#ei)Ad5|IKMHn?LJ$r=Xw z0^_yl%G7#1a}9zEUb|aXi$Pn$hf{j;aj`%+{B>>5;r6+$TuJc(Z<@ec%8*Zq78)iD z3v}IdPS>~Ir?y0A1!{|09YsoMJq z2dL}Xq1b1&75J%gGVY*X~{;ucLbViA;l;k3(M zP0?x24g3gs9B$a<(!*wI<`q#y>*OhzeV`H-Kz%s9{sq7bD@e{8{QGssk@ z!n;)AA55x^fN_$~yuTDdp<58sP8HgQSUO7@tvgd266E1g*(1 zHNUzVjhf5fp`d{H%c>+?6{L1*Tt{f{sk~3|K&Tzjm(g>SYyFlvs&m;B zb!4J4Z7syL`Bc^(d2hVsE$YXfWpzW^(8OAlp@H1nE<5D|IalDOEG?jVMIAkgxLQU$ zO58*`zC#&|{MwZaiTTx481a0XhBoQe+hQ?a7v#;u3{pU0rbDklx#pXj41I+fLvAj7 zL!(W{{j3*hG4du7UOJWaW3CbKRXY{lIW1b@{8zYQEEsi8gOkU_f6{VxeW6})v}(Oj zeGe>Dfj^}8$@|&_8C(nox0RQGZ?2~vnybah(yiZ6V#8^9O@4)-c9howbyAXKwTyEL zI(kxxA=O4EFnPF-f%D&wrSa_xz1A+cN0L@|6Ol7nG#y?(m32tkEGaA3wH4HuDo8!6 z6N4O}iqR&W^1*>;65WJi{c!oZ{~^?7f|1Tj8zii7FM);2nhLR~Q5t?<^vmJUrh-jQ z_9^no0V^F<7APupcjC)+ueA9zeq@<&agDt1D@^&#^U~0V_>pF8Dva#VQlpx~p&6EU zA-I^w!NO3!P1=8!Hhx%hE?Q-VR-in`LAMP_xJvj!5<0Mie+4>gkg)jw|HnpvzLrSg z3+{#8FeubyKscu)!h@(pEJv(Bco9{Im56G@DufSFgQ!K+A*juI#A?JE zL<3?i;xWWJL?dE7q6x79(Tv!L*o0_7v?AIN0cp>tn~hs~>b)YujmVSgz4@yTiBVr@ z+3xkNLOyU`b|oX?<-SOO9C#CrX3U4W%*CC#Atz316(capIL zMP{GfhdkBjHXUQ@uErsE81u|OWQzx!$g|8(g~P1i(iP;{=BJStmd`<+W8RJY(f+5A z=bC?nyy)Fp|nJ%;9YzOkA*}Ya8D~UTG{aeZv}m){MN$@(;6>wf^A*a-U_yoX%Q5KaAXO88y#iZ6~RL2Fnd| z9&7vBfV|Oi%j{u+u5RSbmfPmlEYS034=RwY& vFw- z8XgLv3G84;5kaI_i--t1bjm}K5k+%R>N!l=MRTrD7h3}K+aDp(C`U@e5hI*5Qsh=TR70iq!WHbN|H zf;iX=R@egZkN}CW6_Q{ZB*S({fgO+vJ0T6yAp>^7ZrB5vuotpmAMA$%kR1|)9CyX& z&|D{UffgE?JLQ=iopt4b4f5e2*r5Ol;Sd~#B2d8rPAG;FD1|a`K{-^w5vYWta15%T z8fu^x>c9>4;DO`N04JakPC^qjgBMz$6@1VJ?cj%w(5$O-*`M>@|D*n9zhEPxc*R3v zb-B|`r^y-!_|8*|oZ+mmt)tkmR3k#w6U5@%p*^bZ5XACHqsO5qTaR4}!}>9)PWVXD z>S6SRB_Igoh&1LLdaYO%X9!L`GonUr!o7#mf|x>;5k?{AtaXWRZLKSZj436rqiAdqT?*N(kwN1 z8)}Ij8?^hEFqbCxt*lVtn^g2}xgT9r(}&KI2hggk7M&eECfy^oe;#d%9+#ewI`s%$ zVCj*bllmwgT_ky=57cnMi!PQPNMES&`(3olk}v%wZ&oY1Qu!>0Q>V6wu68M3WGi(J z+{D1Ge3jFwtIB*qgYr$zqpk@N-K6}G%Scmt(XGl)*+W{wJG5WJV(1Pz&FgZv-=jggJ!pJ(iLtO4+gofa}RMZa}S%{p2R)Et#M!Fp64Fr{>43J Rwm-ax2je^l<+$`=`5$= 0) { + if (special_queue[i].spec >= 0) { s3 = 0; - switch (i) { - case 0: - run_special(5,2,special_queue[0],univ.town.p_loc,&s1,&s2,&s3); - break; - case 1: - run_special(6,2,special_queue[1],univ.party.p_loc,&s1,&s2,&s3); - break; - } + run_special(special_queue[i].mode,special_queue[i].type,special_queue[i].spec, + special_queue[i].where,&s1,&s2,&s3); + special_queue[i].spec = -1; if (s3 > 0) draw_terrain(); } diff --git a/osx/boe.graphics.cpp b/osx/boe.graphics.cpp index 226aad05..893e9c10 100644 --- a/osx/boe.graphics.cpp +++ b/osx/boe.graphics.cpp @@ -1883,206 +1883,148 @@ void draw_terrain(short mode) } for (q = 0; q < 9; q++) { - for (r = 0; r < 9; r++) - { - where_draw = (is_out()) ? univ.party.p_loc : center; - where_draw.x += q - 4; - where_draw.y += r - 4; - off_terrain = false; + for (r = 0; r < 9; r++) { + where_draw = (is_out()) ? univ.party.p_loc : center; + where_draw.x += q - 4; + where_draw.y += r - 4; + off_terrain = false; + + draw_frills = true; + if (!(is_out()) && ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1) + || (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1))) { + draw_frills = false; + // Warning - this section changes where_draw + if (where_draw.x < 0) + where_draw.x = -1; + if (where_draw.x > univ.town->max_dim() - 1) + where_draw.x = univ.town->max_dim(); + if (where_draw.y < 0) + where_draw.y = -1; + if (where_draw.y > univ.town->max_dim() - 1) + where_draw.y = univ.town->max_dim(); + if (can_see(view_loc,where_draw,0) < 5) + can_draw = 1; + else can_draw = 0; + spec_terrain = 0; + } + else if (is_out()) { + if ((where_draw.x < 0) || (where_draw.x > 95) + || (where_draw.y < 0) || (where_draw.y > 95)) + can_draw = 0; + else { + spec_terrain = univ.out[where_draw.x][where_draw.y]; + can_draw = univ.out.out_e[where_draw.x][where_draw.y]; + } + } + else if (is_combat()) { + spec_terrain = combat_terrain[where_draw.x][where_draw.y]; + if (cartoon_happening == true) + can_draw = true; + else can_draw = (((is_explored(where_draw.x,where_draw.y)) || + (which_combat_type == 0) || (monsters_going == true) || (overall_mode != MODE_COMBAT)) + && (party_can_see(where_draw) < 6)) ? 1 : 0; + } + else { + spec_terrain = univ.town->terrain(where_draw.x,where_draw.y); + can_draw = is_explored(where_draw.x,where_draw.y); - draw_frills = true; - if (!(is_out()) && ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1) - || (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1))) { - draw_frills = false; - // Warning - this section changes where_draw - if (where_draw.x < 0) - where_draw.x = -1; - if (where_draw.x > univ.town->max_dim() - 1) - where_draw.x = univ.town->max_dim(); - if (where_draw.y < 0) - where_draw.y = -1; - if (where_draw.y > univ.town->max_dim() - 1) - where_draw.y = univ.town->max_dim(); - if (can_see(view_loc,where_draw,0) < 5) - can_draw = 1; - else can_draw = 0; - spec_terrain = 0; - } - else if (is_out()) { - if ((where_draw.x < 0) || (where_draw.x > 95) - || (where_draw.y < 0) || (where_draw.y > 95)) + if (can_draw > 0) { + if (pt_in_light(univ.town.p_loc,where_draw) == false) can_draw = 0; - else { - spec_terrain = univ.out[where_draw.x][where_draw.y]; - can_draw = univ.out.out_e[where_draw.x][where_draw.y]; - } - } - else if (is_combat()) { - spec_terrain = combat_terrain[where_draw.x][where_draw.y]; - if (cartoon_happening == true) - can_draw = true; - else can_draw = (((is_explored(where_draw.x,where_draw.y)) || - (which_combat_type == 0) || (monsters_going == true) || (overall_mode != MODE_COMBAT)) - && (party_can_see(where_draw) < 6)) ? 1 : 0; - } - else { - spec_terrain = univ.town->terrain(where_draw.x,where_draw.y); - can_draw = is_explored(where_draw.x,where_draw.y); - - if (can_draw > 0) { - if (pt_in_light(univ.town.p_loc,where_draw) == false) - can_draw = 0; - } - if ((overall_mode == MODE_LOOK_TOWN) && (can_draw == 0)) - can_draw = (party_can_see(where_draw) < 6) ? 1 : 0; - } - spot_seen[q][r] = can_draw; - - - if ((can_draw != 0) && (overall_mode != MODE_RESTING)) { // if can see, not a pit, and not resting - if ((is_combat()) && (cartoon_happening == false)) { - anim_ticks = 0; - } - - eTrimType trim = scenario.ter_types[spec_terrain].trim_type; - - // Finally, draw this terrain spot -// if(short_spec_terrain == 82) { // cave wway -// if (loc_off_act_area(where_draw) == false) { -// if ((is_nature(where_draw.x - 1,where_draw.y)) && -// (is_nature(where_draw.x,where_draw.y - 1) )) -// short_spec_terrain = 10219; -// if ((is_nature(where_draw.x + 1,where_draw.y) ) && -// (is_nature(where_draw.x,where_draw.y - 1) )) -// short_spec_terrain = 10220; -// if ((is_nature(where_draw.x + 1,where_draw.y) ) && -// (is_nature(where_draw.x,where_draw.y + 1) )) -// short_spec_terrain = 10221; -// if ((is_nature(where_draw.x - 1,where_draw.y) ) && -// (is_nature(where_draw.x,where_draw.y + 1) )) -// short_spec_terrain = 10218; -// } -// draw_one_terrain_spot(q,r,short_spec_terrain,0); -// }else if(short_spec_terrain == 83) { // ground wway -// if (loc_off_act_area(where_draw) == false) { -// if ((is_nature(where_draw.x - 1,where_draw.y)) && -// (is_nature(where_draw.x,where_draw.y - 1)) ) -// short_spec_terrain = 10223; -// if ((is_nature(where_draw.x + 1,where_draw.y) ) && -// (is_nature(where_draw.x,where_draw.y - 1) )) -// short_spec_terrain = 10224; -// if ((is_nature(where_draw.x + 1,where_draw.y) ) && -// (is_nature(where_draw.x,where_draw.y + 1) )) -// short_spec_terrain = 10225; -// if ((is_nature(where_draw.x - 1,where_draw.y) ) && -// (is_nature(where_draw.x,where_draw.y + 1) )) -// short_spec_terrain = 10222; -// } -// draw_one_terrain_spot(q,r,short_spec_terrain,0); - if(trim == TRIM_WALKWAY){ - int trim = -1; - unsigned char ground_t = scenario.ter_types[spec_terrain].trim_ter; - ter_num_t ground_ter = get_ter_from_ground(ground_t); - if (!loc_off_act_area(where_draw)) { - if(is_nature(where_draw.x - 1,where_draw.y,ground_t)){ // check left - if(is_nature(where_draw.x,where_draw.y - 1,ground_t)){ // check up - if(is_nature(where_draw.x + 1,where_draw.y,ground_t)){ // check right - if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down - trim = 8; - else trim = 4; - }else if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down - trim = 7; - else trim = 1; - }else if(is_nature(where_draw.x,where_draw.y + 1,ground_t)){ // check down - if(is_nature(where_draw.x + 1,where_draw.y,ground_t)) // check right - trim = 6; - else trim = 0; - } - }else if(is_nature(where_draw.x,where_draw.y - 1,ground_t)){ // check up + } + if ((overall_mode == MODE_LOOK_TOWN) && (can_draw == 0)) + can_draw = (party_can_see(where_draw) < 6) ? 1 : 0; + } + spot_seen[q][r] = can_draw; + + if ((can_draw != 0) && (overall_mode != MODE_RESTING)) { // if can see, not a pit, and not resting + if ((is_combat()) && (cartoon_happening == false)) { + anim_ticks = 0; + } + + eTrimType trim = scenario.ter_types[spec_terrain].trim_type; + + // Finally, draw this terrain spot + if(trim == TRIM_WALKWAY){ + int trim = -1; + unsigned char ground_t = scenario.ter_types[spec_terrain].trim_ter; + ter_num_t ground_ter = get_ter_from_ground(ground_t); + if (!loc_off_act_area(where_draw)) { + if(is_nature(where_draw.x - 1,where_draw.y,ground_t)){ // check left + if(is_nature(where_draw.x,where_draw.y - 1,ground_t)){ // check up if(is_nature(where_draw.x + 1,where_draw.y,ground_t)){ // check right if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down - trim = 5; - else trim = 2; - } - }else if(is_nature(where_draw.x + 1,where_draw.y,ground_t)){ // check right - if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down - trim = 3; + trim = 8; + else trim = 4; + }else if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down + trim = 7; + else trim = 1; + }else if(is_nature(where_draw.x,where_draw.y + 1,ground_t)){ // check down + if(is_nature(where_draw.x + 1,where_draw.y,ground_t)) // check right + trim = 6; + else trim = 0; } + }else if(is_nature(where_draw.x,where_draw.y - 1,ground_t)){ // check up + if(is_nature(where_draw.x + 1,where_draw.y,ground_t)){ // check right + if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down + trim = 5; + else trim = 2; + } + }else if(is_nature(where_draw.x + 1,where_draw.y,ground_t)){ // check right + if(is_nature(where_draw.x,where_draw.y + 1,ground_t)) // check down + trim = 3; } - draw_one_terrain_spot(q,r,trim < 0 ? spec_terrain : ground_ter,0); - if(trim >= 0) - draw_trim(q,r,trim + 50,spec_terrain); - }else if(trim == TRIM_ROAD || trim == TRIM_N || trim == TRIM_S || - trim == TRIM_W || trim == TRIM_E) { -// if ((short_spec_terrain == 81) -// && ((univ.out[where_draw.x][where_draw.y - 1] == 80) || (univ.out[where_draw.x][where_draw.y - 1] == 79))) -// short_spec_terrain = 42; -// if ((short_spec_terrain == 81) -// && ((univ.out[where_draw.x][where_draw.y + 1] == 80) || (univ.out[where_draw.x][where_draw.y + 1] == 79))) -// short_spec_terrain = 38; -// if ((short_spec_terrain == 81) -// && ((univ.out[where_draw.x - 1][where_draw.y] == 80) || (univ.out[where_draw.x - 1][where_draw.y] == 79))) -// short_spec_terrain = 44; -// if ((short_spec_terrain == 81) -// && ((univ.out[where_draw.x + 1][where_draw.y ] == 80) || (univ.out[where_draw.x + 1][where_draw.y] == 79))) -// short_spec_terrain = 40; - /*if ((short_spec_terrain == 81) - && ((univ.out[where_draw.x][where_draw.y - 1] != 234) && (univ.out[where_draw.x][where_draw.y - 1] != 81) && - ((univ.out[where_draw.x][where_draw.y - 1] < 36) || (univ.out[where_draw.x][where_draw.y - 1] > 49)))) - short_spec_terrain = 42; - if ((short_spec_terrain == 81) - && ((univ.out[where_draw.x][where_draw.y + 1] != 234) && (univ.out[where_draw.x][where_draw.y + 1] != 81) && - ((univ.out[where_draw.x][where_draw.y + 1] < 36) || (univ.out[where_draw.x][where_draw.y + 1] > 49)))) - short_spec_terrain = 38; - if ((short_spec_terrain == 81) - && ((univ.out[where_draw.x - 1][where_draw.y] != 234) &&(univ.out[where_draw.x - 1][where_draw.y] != 81) && - ((univ.out[where_draw.x - 1][where_draw.y] < 36) || (univ.out[where_draw.x - 1][where_draw.y] > 49)))) - short_spec_terrain = 44; - if ((short_spec_terrain == 81) - && ((univ.out[where_draw.x + 1][where_draw.y] != 234) && (univ.out[where_draw.x + 1][where_draw.y] != 81) && - ((univ.out[where_draw.x + 1][where_draw.y] < 36) || (univ.out[where_draw.x + 1][where_draw.y] > 49)))) - short_spec_terrain = 40;*/ - draw_one_terrain_spot(q,r,spec_terrain,0); - place_road(q,r,where_draw,trim == TRIM_ROAD); - }else if(spec_terrain == 65535) { - draw_one_terrain_spot(q,r,-1,0); - }else{ -// if (spec_terrain < 2) -// current_ground = 0; -// if ((spec_terrain == 2) || ( -// (spec_terrain >= 22) && (spec_terrain <= 49))) -// current_ground = 2; - current_ground = get_ground_from_ter(spec_terrain); - draw_one_terrain_spot(q,r,spec_terrain,0); - } + } + draw_one_terrain_spot(q,r,trim < 0 ? spec_terrain : ground_ter,0); + if(trim >= 0) + draw_trim(q,r,trim + 50,spec_terrain); + }else if(trim == TRIM_ROAD || trim == TRIM_N || trim == TRIM_S || + trim == TRIM_W || trim == TRIM_E) { + draw_one_terrain_spot(q,r,spec_terrain,0); + place_road(q,r,where_draw,trim == TRIM_ROAD); + }else if(spec_terrain == 65535) { + draw_one_terrain_spot(q,r,-1,0); + }else{ + current_ground = get_ground_from_ter(spec_terrain); + draw_one_terrain_spot(q,r,spec_terrain,0); } - else { // Can't see. Place darkness. - draw_one_terrain_spot(q,r,-1,0); - } - - if ((can_draw != 0) && (overall_mode != MODE_RESTING) && (frills_on == true) - && (draw_frills == true) && (cartoon_happening == false)) { // Place the trim TODO: Alter trim - place_trim((short) q,(short) r,where_draw,spec_terrain); - } - if((is_town() && univ.town.is_spot(where_draw.x,where_draw.y)) || - (is_out() && univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].special_spot[where_draw.x][where_draw.y])) - Draw_Some_Item(roads_gworld, calc_rect(6, 0), terrain_screen_gworld, loc(q,r), 1, 0); } + else { // Can't see. Place darkness. + draw_one_terrain_spot(q,r,-1,0); + } + + if ((can_draw != 0) && (overall_mode != MODE_RESTING) && (frills_on == true) + && (draw_frills == true) && (cartoon_happening == false)) { // Place the trim TODO: Alter trim + place_trim((short) q,(short) r,where_draw,spec_terrain); + } +// if((is_town() && univ.town.is_spot(where_draw.x,where_draw.y)) || +// (is_out() && univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].special_spot[where_draw.x][where_draw.y])) +// Draw_Some_Item(roads_gworld, calc_rect(6, 0), terrain_screen_gworld, loc(q,r), 1, 0); + // TODO: Move draw_sfx, draw_items, draw_fields, draw_spec_items, etc to here + + if (is_town() || is_combat()) { + draw_items(where_draw); + } + draw_fields(where_draw); + //draw_monsters(where_draw); + //draw_vehicles(where_draw); + //if(is_combat) draw_pcs(where_draw); else draw_party(where_draw); + } } - if ((overall_mode != MODE_RESTING) && (!is_out())) - draw_sfx(); - - // Now place items - if ((overall_mode > MODE_OUTDOORS) && (overall_mode != MODE_LOOK_OUTDOORS) && (overall_mode != MODE_RESTING)) - draw_items(); - - // Now place fields - if ((overall_mode != MODE_RESTING) && (!is_out())) { - draw_fields(); - draw_spec_items(); - } - +// if ((overall_mode != MODE_RESTING) && (!is_out())) +// draw_sfx(); +// +// // Now place items +// if ((overall_mode > MODE_OUTDOORS) && (overall_mode != MODE_LOOK_OUTDOORS) && (overall_mode != MODE_RESTING)) +// draw_items(); +// +// // Now place fields +// if ((overall_mode != MODE_RESTING) && (!is_out())) { +// draw_fields(); +// draw_spec_items(); +// } +// // Not camping. Place misc. stuff if (overall_mode != MODE_RESTING) { if (is_out()) @@ -2097,8 +2039,7 @@ void draw_terrain(short mode) draw_party_symbol(mode,center); else if (overall_mode != MODE_LOOK_TOWN) draw_pcs(center,0); - - + // Now do the light mask thing apply_light_mask(); apply_unseen_mask(); @@ -2107,12 +2048,12 @@ void draw_terrain(short mode) redraw_terrain(); if (cartoon_happening == false) { draw_text_bar(0); - if ((overall_mode >= MODE_COMBAT/*9*/) && (overall_mode != MODE_LOOK_OUTDOORS) && (overall_mode != MODE_LOOK_TOWN) && (overall_mode != MODE_RESTING)) + if ((overall_mode >= MODE_COMBAT) && (overall_mode != MODE_LOOK_OUTDOORS) && (overall_mode != MODE_LOOK_TOWN) && (overall_mode != MODE_RESTING)) draw_pcs(center,1); if (overall_mode == MODE_FANCY_TARGET) draw_targets(center); - } } + } SetPort(old_port); supressing_some_spaces = false; } diff --git a/osx/boe.graphutil.cpp b/osx/boe.graphutil.cpp index d71f69e2..af30cba2 100644 --- a/osx/boe.graphutil.cpp +++ b/osx/boe.graphutil.cpp @@ -45,13 +45,14 @@ extern DialogPtr modeless_dialogs[18]; //extern short monst_target[60]; // 0-5 target that pc 6 - no target 100 + x - target monster x extern short combat_posing_monster , current_working_monster ; // 0-5 PC 100 + x - monster x -//extern piles_of_stuff_dumping_type *data_store; +//extern piles_of_stuff_dumping_type *data_store; TODO: Abolish storage_gworld extern GWorldPtr storage_gworld,terrain_screen_gworld,party_template_gworld,items_gworld,tiny_obj_gworld; -extern GWorldPtr fields_gworld,mixed_gworld; +extern GWorldPtr fields_gworld,mixed_gworld,anim_gworld; extern short which_g_stored[STORED_GRAPHICS]; extern short wish_list[STORED_GRAPHICS]; extern short storage_status[STORED_GRAPHICS]; // 0 - empty 1 - in use 2 - there, not in use extern short terrain_there[9][9]; +extern pending_special_type special_queue[20]; extern Point ul; extern location pc_pos[6],center; @@ -248,7 +249,7 @@ void draw_monsters() //// {{9,0,27,14},{9,14,27,28},{0,0,0,0},{0,0,0,0}}, {{0,0,18,14},{0,14,18,28},{18,0,36,14},{18,14,36,28}} }; - + if (is_out()) for (i = 0; i < 10; i++) if (univ.party.out_c[i].exists == true) { @@ -261,111 +262,111 @@ void draw_monsters() //// j = 0; while ((univ.party.out_c[i].what_monst.monst[j] == 0) && (j < 7)) { j++; - } + } if (j == 7) univ.party.out_c[i].exists = false; // begin watch out - else { - picture_wanted = get_monst_picnum(univ.party.out_c[i].what_monst.monst[j]); - } // end watch out + else { + picture_wanted = get_monst_picnum(univ.party.out_c[i].what_monst.monst[j]); + } // end watch out if (univ.party.out_c[i].exists == true) { get_monst_dims(univ.party.out_c[i].what_monst.monst[j],&width,&height); if (picture_wanted >= 1000) { for (k = 0; k < width * height; k++) { source_rect = get_custom_rect(picture_wanted % 1000 + - ((univ.party.out_c[i].direction < 4) ? 0 : (width * height)) + k); + ((univ.party.out_c[i].direction < 4) ? 0 : (width * height)) + k); to_rect = monst_rects[(width - 1) * 2 + height - 1][k]; OffsetRect(&to_rect,13 + 28 * where_draw.x,13 + 36 * where_draw.y); rect_draw_some_item(spec_scen_g, source_rect, terrain_screen_gworld,to_rect, 1, 0); - } - } + } + } if (picture_wanted < 1000) { for (k = 0; k < width * height; k++) { source_rect = get_monster_template_rect(univ.party.out_c[i].what_monst.monst[j], - (univ.party.out_c[i].direction < 4) ? 0 : 1,k); + (univ.party.out_c[i].direction < 4) ? 0 : 1,k); to_rect = monst_rects[(width - 1) * 2 + height - 1][k]; OffsetRect(&to_rect,13 + 28 * where_draw.x,13 + 36 * where_draw.y); rect_draw_some_item(storage_gworld, source_rect, terrain_screen_gworld,to_rect, 1, 0); - } } + } } } } if (is_town()) for (i = 0; i < univ.town->max_monst(); i++) - if ((univ.town.monst[i].active != 0) && (univ.town.monst[i].spec_skill != 11)) - if (party_can_see_monst(i)) { - check_if_monst_seen(univ.town.monst[i].number); - where_draw.x = univ.town.monst[i].cur_loc.x - center.x + 4; - where_draw.y = univ.town.monst[i].cur_loc.y - center.y + 4; - get_monst_dims(univ.town.monst[i].number,&width,&height); - if (point_onscreen(center,univ.town.monst[i].cur_loc) == true) - play_see_monster_str(univ.town.monst[i].number); - - for (k = 0; k < width * height; k++) { - store_loc = where_draw; - store_loc.x += k % width; - store_loc.y += k / width; - // customize? - if (univ.town.monst[i].picture_num >= 1000) { - source_rect = get_custom_rect((univ.town.monst[i].picture_num % 1000) + - k + ((univ.town.monst[i].direction < 4) ? 0 : width * height) - + ((combat_posing_monster == i + 100) ? (2 * width * height) : 0)); - Draw_Some_Item(spec_scen_g, source_rect, terrain_screen_gworld, store_loc, 1, 0); + if ((univ.town.monst[i].active != 0) && (univ.town.monst[i].spec_skill != 11)) + if (party_can_see_monst(i)) { + check_if_monst_seen(univ.town.monst[i].number); + where_draw.x = univ.town.monst[i].cur_loc.x - center.x + 4; + where_draw.y = univ.town.monst[i].cur_loc.y - center.y + 4; + get_monst_dims(univ.town.monst[i].number,&width,&height); + if (point_onscreen(center,univ.town.monst[i].cur_loc) == true) + play_see_monster_str(univ.town.monst[i].number); + + for (k = 0; k < width * height; k++) { + store_loc = where_draw; + store_loc.x += k % width; + store_loc.y += k / width; + // customize? + if (univ.town.monst[i].picture_num >= 1000) { + source_rect = get_custom_rect((univ.town.monst[i].picture_num % 1000) + + k + ((univ.town.monst[i].direction < 4) ? 0 : width * height) + + ((combat_posing_monster == i + 100) ? (2 * width * height) : 0)); + Draw_Some_Item(spec_scen_g, source_rect, terrain_screen_gworld, store_loc, 1, 0); } - if (univ.town.monst[i].picture_num < 1000) { - source_rect = get_monster_template_rect(univ.town.monst[i].number, - ((univ.town.monst[i].direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0),k); - ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y); - // in bed? - if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && - (scenario.ter_types[ter].special == TER_SPEC_BED) && - ((univ.town.monst[i].m_type < 7) - && (univ.town.monst[i].m_type != 1) && (univ.town.monst[i].m_type != 2)) - && ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) && - (width == 1) && (height == 1)) //// - draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u,0); + if (univ.town.monst[i].picture_num < 1000) { + source_rect = get_monster_template_rect(univ.town.monst[i].number, + ((univ.town.monst[i].direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0),k); + ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y); + // in bed? + if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && + (scenario.ter_types[ter].special == TER_SPEC_BED) && + ((univ.town.monst[i].m_type < 7) + && (univ.town.monst[i].m_type != 1) && (univ.town.monst[i].m_type != 2)) + && ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) && + (width == 1) && (height == 1)) //// + draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u,0); else Draw_Some_Item(storage_gworld, source_rect, terrain_screen_gworld, store_loc, 1, 0); - } + } } } if (is_combat()) { - for (i = 0; i < univ.town->max_monst(); i++) - if ((univ.town.monst[i].active != 0) && (univ.town.monst[i].spec_skill != 11)) - if (((point_onscreen(center,univ.town.monst[i].cur_loc) == true) && (cartoon_happening == true)) - || (party_can_see_monst(i) == true)) { - check_if_monst_seen(univ.town.monst[i].number); - where_draw.x = univ.town.monst[i].cur_loc.x - center.x + 4; - where_draw.y = univ.town.monst[i].cur_loc.y - center.y + 4; - get_monst_dims(univ.town.monst[i].number,&width,&height); - - for (k = 0; k < width * height; k++) { - store_loc = where_draw; - store_loc.x += k % width; - store_loc.y += k / width; - // customize? - if (univ.town.monst[i].picture_num >= 1000) { - source_rect = get_custom_rect((univ.town.monst[i].picture_num % 1000) + - k + ((univ.town.monst[i].direction < 4) ? 0 : width * height) - + ((combat_posing_monster == i + 100) ? (2 * width * height) : 0)); - Draw_Some_Item(spec_scen_g, source_rect, terrain_screen_gworld, store_loc, 1, 0); - } - if (univ.town.monst[i].picture_num < 1000) { - source_rect = get_monster_template_rect(univ.town.monst[i].number, - ((univ.town.monst[i].direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0) - ,k); - ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y); - if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && - (scenario.ter_types[ter].special == TER_SPEC_BED) && - ((univ.town.monst[i].m_type < 7) - && (univ.town.monst[i].m_type != 1) && (univ.town.monst[i].m_type != 2)) - && ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) && - (width == 1) && (height == 1)) - draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u,0); //// - else Draw_Some_Item(storage_gworld, source_rect, terrain_screen_gworld, store_loc, 1, 0); - } - } + for (i = 0; i < univ.town->max_monst(); i++) + if ((univ.town.monst[i].active != 0) && (univ.town.monst[i].spec_skill != 11)) + if (((point_onscreen(center,univ.town.monst[i].cur_loc) == true) && (cartoon_happening == true)) + || (party_can_see_monst(i) == true)) { + check_if_monst_seen(univ.town.monst[i].number); + where_draw.x = univ.town.monst[i].cur_loc.x - center.x + 4; + where_draw.y = univ.town.monst[i].cur_loc.y - center.y + 4; + get_monst_dims(univ.town.monst[i].number,&width,&height); + + for (k = 0; k < width * height; k++) { + store_loc = where_draw; + store_loc.x += k % width; + store_loc.y += k / width; + // customize? + if (univ.town.monst[i].picture_num >= 1000) { + source_rect = get_custom_rect((univ.town.monst[i].picture_num % 1000) + + k + ((univ.town.monst[i].direction < 4) ? 0 : width * height) + + ((combat_posing_monster == i + 100) ? (2 * width * height) : 0)); + Draw_Some_Item(spec_scen_g, source_rect, terrain_screen_gworld, store_loc, 1, 0); } + if (univ.town.monst[i].picture_num < 1000) { + source_rect = get_monster_template_rect(univ.town.monst[i].number, + ((univ.town.monst[i].direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0) + ,k); + ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y); + if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && + (scenario.ter_types[ter].special == TER_SPEC_BED) && + ((univ.town.monst[i].m_type < 7) + && (univ.town.monst[i].m_type != 1) && (univ.town.monst[i].m_type != 2)) + && ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) && + (width == 1) && (height == 1)) + draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u,0); //// + else Draw_Some_Item(storage_gworld, source_rect, terrain_screen_gworld, store_loc, 1, 0); + } + } + } } } @@ -380,9 +381,17 @@ void play_see_monster_str(unsigned short m){ // First display strings, if any display_strings(str1 ? scenario.monst_strs[str1] : NULL, str2 ? scenario.monst_strs[str2] : NULL, "", snd, pic,type, 0); // Then run the special, if any - if(spec > -1) - run_special(18, 0, spec, loc(0,0), &s1, &s2, &s3); - // TODO: may need to check s3 to determine if redraw is needed + if(spec > -1){ + for(int i = 2; i < 20; i++){ + if(special_queue[i].spec == -1){ + special_queue[i].spec = spec; + special_queue[i].mode = SPEC_SEE_MONST; + special_queue[i].type = 0; + special_queue[i].where = loc(); // TODO: Maybe a different location should be passed? + break; + } + } + } } void draw_pcs(location center,short mode) @@ -440,53 +449,33 @@ void draw_pcs(location center,short mode) } } - -void draw_items() -{ - short i; - Rect source_rect,dest_rect; - location where_draw; - - - for (i = 0; i < NUM_TOWN_ITEMS; i++) { - if (univ.town.items[i].variety != 0) { - where_draw.x = univ.town.items[i].item_loc.x - center.x + 4; - where_draw.y = univ.town.items[i].item_loc.y - center.y + 4; - - if (supressing_some_spaces && (where_draw != ok_space[0]) && (where_draw != ok_space[1]) - && (where_draw != ok_space[2]) && (where_draw != ok_space[3])); - else if (point_onscreen(center, univ.town.items[i].item_loc) && !univ.town.items[i].is_contained() && - (cartoon_happening || (party_can_see(univ.town.items[i].item_loc) < 6))) { - // safety valve - //if ((univ.town.items[i].graphic_num < 0) || - // ((univ.townt_i.items[i].graphic_num >= NUM_ITEM_G) && (univ.town.items[i].graphic_num < 1000))) { - // univ.town.items[i].variety = 0; - // univ.town.items[i].graphic_num = 0; - // } - if (univ.town.items[i].graphic_num >= 150) { - source_rect = get_custom_rect(univ.town.items[i].graphic_num - 150); - dest_rect = coord_to_rect(where_draw.x,where_draw.y); - terrain_there[where_draw.x][where_draw.y] = -1; - - rect_draw_some_item(spec_scen_g, - source_rect, terrain_screen_gworld, dest_rect, 1, 0); - } - else { - source_rect = get_item_template_rect(univ.town.items[i].graphic_num); - dest_rect = coord_to_rect(where_draw.x,where_draw.y); - terrain_there[where_draw.x][where_draw.y] = -1; - if (univ.town.items[i].graphic_num >= 45) { - dest_rect.top += 9; - dest_rect.bottom -= 9; - dest_rect.left += 5; - dest_rect.right -= 5; - } - rect_draw_some_item((univ.town.items[i].graphic_num < 45) ? items_gworld : tiny_obj_gworld, - source_rect, terrain_screen_gworld, dest_rect, 1, 0); - } - } +void draw_items(location where){ + if(!point_onscreen(center,where)) return; + location where_draw(4 + where.x - center.x, 4 + where.y - center.y); + Rect from_rect, to_rect; + if(supressing_some_spaces && (where != ok_space[0]) && (where != ok_space[1]) && (where != ok_space[2]) && (where != ok_space[3])) + return; + for (int i = 0; i < NUM_TOWN_ITEMS; i++) { + if(univ.town.items[i].variety != ITEM_TYPE_NO_ITEM && univ.town.items[i].item_loc == where) { + if(univ.town.items[i].is_contained()) continue; + if(!cartoon_happening && party_can_see(where) >= 6) continue; + if(univ.town.items[i].graphic_num >= 1000){ + from_rect = get_custom_rect(univ.town.items[i].graphic_num - 1000); + to_rect = coord_to_rect(where.x,where.y); + terrain_there[where_draw.x][where_draw.y] = -1; + rect_draw_some_item(spec_scen_g,from_rect,terrain_screen_gworld,to_rect,1,0); + }else{ + from_rect = get_item_template_rect(univ.town.items[i].graphic_num); + to_rect = coord_to_rect(where_draw.x,where_draw.y); + terrain_there[where_draw.x][where_draw.y] = -1; + if(univ.town.items[i].graphic_num >= 45) { + InsetRect(&to_rect,5,9); + rect_draw_some_item(tiny_obj_gworld, from_rect, terrain_screen_gworld, to_rect, 1, 0); + }else + rect_draw_some_item(items_gworld, from_rect, terrain_screen_gworld, to_rect, 1, 0); } } + } } void draw_outd_boats(location center) @@ -552,140 +541,62 @@ void draw_town_boat(location center) } } -void draw_fields() -{ - if (crate == true) - draw_one_field(8,6,0); - if (barrel == true) - draw_one_field(16,7,0); - if (web == true) - draw_one_field(4,5,0); - if (quickfire == true) - draw_one_field(128,7,1); - if (fire_barrier == true) - draw_one_field(32,anim_ticks % 4,2); - if (force_barrier == true) - draw_one_field(64,anim_ticks % 4,2); -} - -void draw_spec_items() -{ - if (force_wall == true) - draw_one_spec_item(2,0,1); - if (fire_wall == true) - draw_one_spec_item(4,1,1); - if (antimagic == true) - draw_one_spec_item(8,2,1); - if (scloud == true) - draw_one_spec_item(16,3,1); - if (ice_wall == true) - draw_one_spec_item(32,4,1); - if (blade_wall == true) - draw_one_spec_item(64,5,1); - if (sleep_field == true) - draw_one_spec_item(128,6,1); -} - - -void draw_sfx() -{ - short q,r,i,flag; - location where_draw,loc; - Rect orig_rect = {0,0,36,28},source_rect; - - if (PSD[SDF_NO_FRILLS] > 0) +void draw_fields(location where){ + if(!point_onscreen(center,where)) return; + if(!cartoon_happening && party_can_see(where) >= 6) return; + location where_draw(4 + where.x - center.x, 4 + where.y - center.y); + if(is_out()){ + if(univ.out.outdoors[univ.party.i_w_c.x][univ.party.i_w_c.y].special_spot[where.x][where.y]) + Draw_Some_Item(fields_gworld,calc_rect(4,0),terrain_screen_gworld,where_draw,1,0); return; - - for (q = 0; q < 9; q++) - for (r = 0; r < 9; r++) - { - where_draw = center; - where_draw.x += q - 4; - where_draw.y += r - 4; - - if ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1) - || (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1)) - ; - else if (univ.town.sfx(where_draw.x,where_draw.y) != 0) { - for (i = 0; i < 8; i++) { - flag = s_pow(2,i); - if (univ.town.sfx(where_draw.x,where_draw.y) & flag) - if (spot_seen[q][r] > 0) { - loc.x = q; - loc.y = r; - source_rect = orig_rect; - OffsetRect(&source_rect,28 * i,36 * 3); - Draw_Some_Item(fields_gworld,source_rect,terrain_screen_gworld,loc, - 1,0); - } - } - } - } + } + if(univ.town.is_force_wall(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(0,1),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_fire_wall(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(1,1),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_antimagic(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(2,1),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_scloud(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(3,1),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_ice_wall(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(4,1),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_blade_wall(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(5,1),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_sleep_cloud(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(6,1),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_block(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(3,0),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_spot(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(4,0),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_web(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(5,0),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_crate(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(6,0),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_barrel(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(7,0),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_fire_barr(where.x,where.y) || univ.town.is_force_barr(where.x,where.y)) + Draw_Some_Item(anim_gworld,calc_rect(8 + (anim_ticks % 4),4),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_quickfire(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(7,1),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_sm_blood(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(0,3),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_med_blood(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(1,3),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_lg_blood(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(2,3),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_sm_slime(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(3,3),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_lg_slime(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(4,3),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_ash(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(5,3),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_bones(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(6,3),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_rubble(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(7,3),terrain_screen_gworld,where_draw,1,0); + if(univ.town.is_force_cage(where.x,where.y)) + Draw_Some_Item(fields_gworld,calc_rect(2,0),terrain_screen_gworld,where_draw,1,0); } - - -void draw_one_field(unsigned char flag,short source_x,short source_y) -{ - short q,r; - location where_draw,loc; - //Rect orig_rect = {0,0,36,28} - Rect source_rect; - - for (q = 0; q < 9; q++) - for (r = 0; r < 9; r++){ - where_draw = center; - where_draw.x += q - 4; - where_draw.y += r - 4; - - if ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1) - || (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1)) - ; - else { - if (univ.town.misc_i(where_draw.x,where_draw.y) & flag) - if (spot_seen[q][r] > 0) { - loc.x = q; loc.y = r; - //source_rect = orig_rect; - //OffsetRect(&source_rect,28 * source_x,36 * source_y); - source_rect = calc_rect(source_x,source_y); - Draw_Some_Item(fields_gworld,source_rect,terrain_screen_gworld,loc, - 1,0); - if ((is_town()) && ((flag == 32) || (flag == 64))) - anim_onscreen = true; - } - } - } -} - -void draw_one_spec_item(unsigned char flag,short source_x,short source_y) -{ - short q,r; - location where_draw,loc; - Rect orig_rect = {0,0,36,28},source_rect; - - for (q = 0; q < 9; q++) - for (r = 0; r < 9; r++) - { - where_draw = center; - where_draw.x += q - 4; - where_draw.y += r - 4; - - if ((where_draw.x < 0) || (where_draw.x > univ.town->max_dim() - 1) - || (where_draw.y < 0) || (where_draw.y > univ.town->max_dim() - 1)) - ; - else { - if (univ.town.explored(where_draw.x,where_draw.y) & flag) - if (spot_seen[q][r] > 0) { - loc.x = q; loc.y = r; - source_rect = orig_rect; - OffsetRect(&source_rect,28 * source_x,36 * source_y); - Draw_Some_Item(fields_gworld,source_rect,terrain_screen_gworld,loc, - 1,0); - } - } - } -} - - void draw_party_symbol(short mode,location center) // mode currently unused diff --git a/osx/boe.graphutil.h b/osx/boe.graphutil.h index 0f4c8d2e..af9dbd60 100644 --- a/osx/boe.graphutil.h +++ b/osx/boe.graphutil.h @@ -2,14 +2,8 @@ void draw_one_terrain_spot (short i,short j,short terrain_to_draw,short dest); void draw_monsters(); void play_see_monster_str(unsigned short m); void draw_pcs(location center,short mode); -void draw_items(); void draw_outd_boats(location center); void draw_town_boat(location center) ; -void draw_fields(); -void draw_spec_items(); -void draw_sfx(); -void draw_one_field(unsigned char flag,short source_x,short short_y); -void draw_one_spec_item(unsigned char flag,short source_x,short short_y); void draw_party_symbol(short mode,location center); Rect get_terrain_template_rect (ter_num_t type_wanted); Rect return_item_rect(short wanted); @@ -26,3 +20,6 @@ char get_fluid_trim(location where,ter_num_t ter_type); void check_if_monst_seen(unsigned short m_num); void adjust_monst_menu(); void play_ambient_sound(); + +void draw_items(location where); +void draw_fields(location where); diff --git a/osx/boe.items.cpp b/osx/boe.items.cpp index b0ddcc73..87898e16 100644 --- a/osx/boe.items.cpp +++ b/osx/boe.items.cpp @@ -1030,7 +1030,6 @@ short display_item(location from_loc,short pc_num,short mode, bool check_contain store_get_mode = mode; current_getting_pc = current_pc; store_pcnum = pc_num; - dialog_answer = 0; for (i = 0; i < 130; i++) item_array[i] = 200; @@ -1071,6 +1070,7 @@ short display_item(location from_loc,short pc_num,short mode, bool check_contain give_help(36,37,987); } + dialog_answer = 0; item_hit = cd_run_dialog(); cd_kill_dialog(987); diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index 036f9499..f80eb32a 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -47,7 +47,7 @@ extern short store_current_pc,current_ground; extern short dungeon_font_num,geneva_font_num; extern eGameMode store_pre_shop_mode,store_pre_talk_mode; //extern location monster_targs[60]; -extern short special_queue[20]; +extern pending_special_type special_queue[20]; extern bool modeless_exists[18],diff_depth_ok,belt_present; extern short modeless_key[18]; @@ -747,15 +747,21 @@ void handle_town_specials(short town_number, short entry_dir,location start_loc) // run_special(5,2,univ.town.town.spec_on_entry_if_dead,start_loc,&s1,&s2,&s3); // else run_special(5,2,univ.town.town.spec_on_entry,start_loc,&s1,&s2,&s3); if (entry_dir > 0) - special_queue[0] = univ.town->spec_on_entry_if_dead; - else special_queue[0] = univ.town->spec_on_entry; + special_queue[0].spec = univ.town->spec_on_entry_if_dead; + else special_queue[0].spec = univ.town->spec_on_entry; + special_queue[0].where = univ.town.p_loc; + special_queue[0].type = 2; + special_queue[0].mode = SPEC_ENTER_TOWN; } void handle_leave_town_specials(short town_number, short which_spec,location start_loc) { //run_special(6,2,which_spec,start_loc,&s1,&s2,&s3); - special_queue[1] = which_spec; + special_queue[1].spec = which_spec; + special_queue[1].where = univ.party.p_loc; + special_queue[1].type = 2; + special_queue[1].mode = SPEC_LEAVE_TOWN; } bool abil_exists(short abil) // use when univ.out.outdoors diff --git a/osx/classes/monster.cpp b/osx/classes/monster.cpp index eeff17aa..e5b87b9c 100644 --- a/osx/classes/monster.cpp +++ b/osx/classes/monster.cpp @@ -55,9 +55,15 @@ cMonster& cMonster::operator = (legacy::monster_record_type& old){ default_facial_pic = old.default_facial_pic; picture_num = old.picture_num; if(picture_num == 122) picture_num = 119; + see_spec = -1; return *this; } +cMonster::cMonster(){ + // TODO: Fill in + see_spec = -1; +} + cCreature::cCreature(){ // short personality; // short special_on_kill,facial_pic; diff --git a/osx/classes/monster.h b/osx/classes/monster.h index 07f2e066..f32d63eb 100644 --- a/osx/classes/monster.h +++ b/osx/classes/monster.h @@ -146,6 +146,7 @@ public: std::string getAbil2Name(); bool hasAbil(eMonstAbil what, unsigned char* x1 = NULL, unsigned char* x2 = NULL); cMonster& operator = (legacy::monster_record_type& old); + cMonster(); void writeTo(std::ostream& file, std::string prefix); }; diff --git a/osx/classes/simpletypes.h b/osx/classes/simpletypes.h index de478451..9af583ea 100644 --- a/osx/classes/simpletypes.h +++ b/osx/classes/simpletypes.h @@ -484,3 +484,25 @@ inline void operator += (eDamageType& cur, eDamageType othr){ // operator int() {return c;} // sbyte(signed char k) : c(k) {} //} + +enum eSpecContext { + SPEC_OUT_MOVE = 0, + SPEC_TOWN_MOVE = 1, + SPEC_COMBAT_MOVE = 2, + SPEC_OUT_LOOK = 3, + SPEC_TOWN_LOOK = 4, + SPEC_ENTER_TOWN = 5, + SPEC_LEAVE_TOWN = 6, + SPEC_TALK = 7, + SPEC_USE_SPEC_ITEM = 8, + SPEC_TOWN_TIMER = 9, + SPEC_SCEN_TIMER = 10, + SPEC_PARTY_TIMER = 11, + SPEC_KILL_MONST = 12, + SPEC_OUTDOOR_ENC = 13, + SPEC_WIN_ENCOUNTER = 14, + SPEC_FLEE_ENCOUNTER = 15, + SPEC_TARGET = 16, + SPEC_USE_SPACE = 17, + SPEC_SEE_MONST = 18, +}; diff --git a/osx/classes/special.h b/osx/classes/special.h index cf8e4043..2d26b43b 100644 --- a/osx/classes/special.h +++ b/osx/classes/special.h @@ -32,4 +32,11 @@ public: void writeTo(std::ostream& file); }; +struct pending_special_type { + spec_num_t spec; + eSpecContext mode; + unsigned char type; // 0 - scen, 1 - out, 2 - town + location where; +}; + #endif \ No newline at end of file diff --git a/osx/classes/universe.cpp b/osx/classes/universe.cpp index 66e9d4d2..7e7cc3fa 100644 --- a/osx/classes/universe.cpp +++ b/osx/classes/universe.cpp @@ -237,6 +237,11 @@ bool cCurTown::is_rubble(char x, char y) const{ return fields[x][y] & 8388608L; } +bool cCurTown::is_force_cage(char x, char y) const{ + if(x > record->max_dim() || y > record->max_dim()) return false; + return fields[x][y] & 16777216L; +} + //bool cCurTown::is_trim(char x, char y, char t){ // unsigned char bit = 1 << t; // return trim[x][y] & bit; @@ -612,6 +617,15 @@ bool cCurTown::set_rubble(char x, char y, bool b){ return true; } +bool cCurTown::set_force_cage(char x, char y, bool b){ + // TODO: Consider whether placing a forcecage should erase anything already present, or fail due to something already present + // TODO: Also consider checking for forcecage in some of the other placement functions. + if(x > record->max_dim() || y > record->max_dim()) return false; + if(b) fields[x][y] |= 16777216L; + else fields[x][y] &= ~16777216L; + return true; +} + //bool cCurTown::set_trim(char x, char y, char t, bool b){ // unsigned char bit = 1 << t; // if(b){ diff --git a/osx/classes/universe.h b/osx/classes/universe.h index 0b491861..8f2de157 100644 --- a/osx/classes/universe.h +++ b/osx/classes/universe.h @@ -80,6 +80,7 @@ public: bool is_ash(char x, char y) const; bool is_bones(char x, char y) const; bool is_rubble(char x, char y) const; + bool is_force_cage(char x, char y) const; // bool is_trim(char x, char y, char t) const; bool set_explored(char x, char y, bool b); bool set_force_wall(char x, char y, bool b); @@ -106,6 +107,7 @@ public: bool set_ash(char x, char y, bool b); bool set_bones(char x, char y, bool b); bool set_rubble(char x, char y, bool b); + bool set_force_cage(char x, char y, bool b); // bool set_trim(char x, char y, char t, bool b); void writeTo(std::ostream& file); void readFrom(std::istream& file);