Fix Y offset with SceneTarget actions, add test scene with door open/close

master
Alec Murphy 6 years ago
parent e4668ae1c5
commit f22d91844f

@ -9,7 +9,7 @@ U0 FreeChars()
DCDel(th_Dianna);
DCDel(s_Terry);
DCDel(s_Targets);
DCDel(s_Objects);
DCDel(s_Objects);
}
U0 SceneObjBlot(CDC *dc, I64 dc_x, I64 dc_y, I64 gr48_x, I64 gr48_y)
@ -21,7 +21,7 @@ U0 SceneObjBlot(CDC *dc, I64 dc_x, I64 dc_y, I64 gr48_x, I64 gr48_y)
DCDel(GR48);
}
U0 GR96Blot(CDC *dc, I64 dc_x, I64 dc_y,
U0 GR96Blot(CDC *dc, I64 dc_x, I64 dc_y,
CDC *GR, I64 gr96_x, I64 gr96_y, Bool r)
{
CDC *GR96=DCNew(96,96);

@ -24,6 +24,8 @@
#define INV_DROP -10
#define INV_USE -11
#define ST_Y_OFS -48
#define WALK_SPEED 2
class GameState {
@ -66,6 +68,7 @@ class Scene {
// for now. :/
CDC *to_01=GRRead("Chars/GarageOpen.TGT.GR");
CDC *to_02=GRRead("Chars/KtchDoorOpen.TGT.GR");
#include "InitSceneObjs"
#include "InitSceneTgts"
@ -632,7 +635,7 @@ U0 Run(I64 sfx_cpu=0,Bool load_state=FALSE)
use_obj=TRUE;
use_tid=-1;
if (gs->player_y+st_height[gs->s_tgt_uid[so_ctr]]<gs->s_tgt_y[so_ctr] || gs->player_y+st_height[gs->s_tgt_uid[so_ctr]]>(gs->s_tgt_y[so_ctr]+st_height[gs->s_tgt_uid[so_ctr]]))
if (gs->player_y+st_height[gs->s_tgt_uid[so_ctr]]<gs->s_tgt_y[so_ctr] || ST_Y_OFS+gs->player_y+st_height[gs->s_tgt_uid[so_ctr]]>(gs->s_tgt_y[so_ctr]+st_height[gs->s_tgt_uid[so_ctr]]))
{
use_obj=FALSE;
};
@ -669,7 +672,7 @@ U0 Run(I64 sfx_cpu=0,Bool load_state=FALSE)
SceneScript(gs->st_scr_id[gs->s_tgt_uid[so_ctr]],gs,so_ctr);
success=TRUE;
};
};
};
if (!success)
{
pop_up=PopUpOk("You can't do that here.");
@ -1074,7 +1077,7 @@ U0 Run(I64 sfx_cpu=0,Bool load_state=FALSE)
}
else
{
if (left_action==ACT_PICK_UP && get_oid!=-1)
if (left_action==ACT_PICK_UP && get_oid!=-1)
{
get_obj=TRUE;
if (gs->player_y+48<gs->s_obj_y[get_oid] || gs->player_y+48>(gs->s_obj_y[get_oid]+48))
@ -1149,6 +1152,7 @@ U0 Run(I64 sfx_cpu=0,Bool load_state=FALSE)
Free(gs);
// ugly, get rid of this
DCDel(to_02);
DCDel(to_01);
Free(st_scr_msg);

@ -7,7 +7,7 @@ U0 AddSceneObject(GameState *gs, I64 uid, I64 sid, I64 x, I64 y)
{
I64 ctr=0;
while (ctr<S_MAX_OBJ)
{
 {
if (gs->s_obj_uid[ctr]==0)
{
break;
@ -23,7 +23,7 @@ U0 AddSceneObject(GameState *gs, I64 uid, I64 sid, I64 x, I64 y)
U0 InitSceneObjs(GameState *gs)
{
AddSceneObject(gs,SO_GOLD_KEY,0,311,412);
AddSceneObject(gs,SO_SHASTA,1,640,310);
AddSceneObject(gs,SO_SHASTA,1,640,310);
AddSceneObject(gs,SO_BOYARDEE,2,902,370);
AddSceneObject(gs,SO_NUGGIES,2,1032,210);
}

@ -1,11 +1,12 @@
#define ST_GRG_DOOR 1
#define ST_KTC_DOOR 3
U0 AddSceneTarget(GameState *gs, I64 uid, I64 sid, I64 x, I64 y)
{
I64 ctr=0;
while (ctr<S_MAX_OBJ)
{
if (gs->s_obj_uid[ctr]==0)
if (gs->s_tgt_uid[ctr]==0)
{
break;
};
@ -20,5 +21,5 @@ U0 AddSceneTarget(GameState *gs, I64 uid, I64 sid, I64 x, I64 y)
U0 InitSceneTgts(GameState *gs)
{
AddSceneTarget(gs,ST_GRG_DOOR,0,454,294);
AddSceneTarget(gs,ST_KTC_DOOR,3,544,80);
}


@ -14,10 +14,13 @@ U0 TargetOverlay(Bool bg_layer, CDC *dc, CDC *s_mask, I64 bgs_x, I64 uid)
{
switch (uid)
{
case 0x02:
// individual device contexts for now, but ugly,
// need to merge into one, blah.
// test adding destination mask, teleport to store
case 0x02:
// garage door opened
s_mask->color=6;
GrRect(s_mask,454,284,154,80);
if (bg_layer)
@ -29,6 +32,21 @@ U0 TargetOverlay(Bool bg_layer, CDC *dc, CDC *s_mask, I64 bgs_x, I64 uid)
GrRect(dc,bgs_x+454,284,154,80);
};
break;
case 0x04:
// kitchen door opened
s_mask->color=6;
GrRect(s_mask,544,80,to_02->width,to_02->height);
if (bg_layer)
{
GrBlot(dc,bgs_x+544,80,to_02);
}
else {
 s_mask->color=6;
GrRect(dc,bgs_x+544,80,to_02->width,to_02->height);
};
break;
default:
break;
};
@ -40,27 +58,21 @@ U0 SceneScript(I64 script, GameState *gs, I64 target)
{
case ACT_OPEN:
if (gs->s_tgt_uid[target]==1)
{
gs->s_tgt_uid[target]=2;
gs->st_so_uid[2]=ACT_CLOSE;
gs->st_scr_id[2]=ACT_CLOSE;
};
gs->s_tgt_uid[target]++;
gs->st_so_uid[gs->s_tgt_uid[target]]=ACT_CLOSE;
gs->st_scr_id[gs->s_tgt_uid[target]]=ACT_CLOSE;
break;
case ACT_CLOSE:
if (gs->s_tgt_uid[target]==2)
{
gs->s_tgt_uid[target]=1;
gs->st_so_uid[1]=ACT_OPEN;
gs->st_scr_id[1]=ACT_OPEN;
};
gs->s_tgt_uid[target]--;
gs->st_so_uid[gs->s_tgt_uid[target]]=ACT_OPEN;
gs->st_scr_id[gs->s_tgt_uid[target]]=ACT_OPEN;
break;
case 0x10:
// Unlock Garage Door /w Gold Key
gs->st_so_uid[gs->s_tgt_uid[target]]=ACT_OPEN;
gs->st_scr_id[gs->s_tgt_uid[target]]=ACT_OPEN;
gs->st_scr_id[gs->s_tgt_uid[target]]=ACT_OPEN;
break;
default:

@ -2,30 +2,45 @@
// placeholder: use SceneObject with SceneTarget
// open/close target: uid=-2/-3?
#define ST_OPEN -2
#define ST_CLOSE -3
st_width[1]=142; st_height[1]=58;
st_charx[1]=0; st_chary[1]=0;
if (gs->st_so_uid[1]==0)
{
gs->st_so_uid[1]=4; gs->st_scr_id[1]=0x10;
};
// garage door locked
// garage door closed
StrCpy(st_desc+(1*SO_MAX_DESC), "Garage Door");
StrCpy(st_scr_msg+(1*SO_MAX_SMSG),"You use the Gold Key on the\nGarage Door, and it unlocks.");

st_width[2]=142; st_height[2]=58;
st_charx[2]=0; st_chary[2]=0;
if (gs->st_so_uid[2]==0)
{
gs->st_so_uid[2]=0; gs->st_scr_id[2]=0;
};
// garage door unlocked
// garage door opened
StrCpy(st_desc+(2*SO_MAX_DESC), "Garage Door");
StrCpy(st_scr_msg+(2*SO_MAX_SMSG),"");
st_width[3]=90; st_height[3]=182;
st_charx[3]=0; st_chary[3]=0;
if (gs->st_so_uid[3]==0)
{
gs->st_so_uid[3]=ACT_OPEN; gs->st_scr_id[3]=ACT_OPEN;
};
// kitchen door closed
StrCpy(st_desc+(3*SO_MAX_DESC), "Kitchen Door");
StrCpy(st_scr_msg+(3*SO_MAX_SMSG),"");
st_width[4]=90; st_height[4]=182;
st_charx[4]=0; st_chary[4]=0;
if (gs->st_so_uid[4]==0)
{
gs->st_so_uid[4]=ACT_CLOSE; gs->st_scr_id[4]=ACT_CLOSE;
};
// kitchen door open
StrCpy(st_desc+(4*SO_MAX_DESC), "Kitchen Door");
StrCpy(st_scr_msg+(4*SO_MAX_SMSG),"");


@ -118,13 +118,31 @@ GrFloodFill(m_ptr->path,522,332,TRUE);
m_ptr->path->color=2;
GrRect(m_ptr->path,0,446,960,96);
m_ptr->st_id[2]=0;
m_ptr->st_bx[2]=-200;
m_ptr->st_nx[2]=320;
m_ptr->st_ny[2]=240;
// test for open kitchen door
m_ptr->st_id[6]=4;
//m_ptr->st_bx[2]=-544;
m_ptr->st_bx[6]=0;
m_ptr->st_nx[6]=320;
m_ptr->st_ny[6]=300;
// 04
m_ptr=SceneAdd(0,0, 300, "Terry's Giant Kitchen", "Scenes/07.SCENE.GR", scenes);
//StrCpy(m_ptr->song, "2qGeEEs1B2E1B2EetCCRq1B2FCet1BAB2qGeEEs1B2E1B2EetCCRq1B2FCet1BAB2sDFDF1BBBBe2F1G2EDqE1AB2E2sDFDF1BBBBe2F1G2EDqE1AB2E");
m_ptr->path->color=1;
GrRect(m_ptr->path,0,430,960,96);
m_ptr->path->color=2;
GrRect(m_ptr->path,0,446,960,96);
m_ptr->st_id[2]=3;
m_ptr->st_bx[2]=-220;
m_ptr->st_nx[2]=346;
m_ptr->st_ny[2]=146;
s_ptr=*scenes;

Loading…
Cancel
Save