1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Rename edentity to customentities

This fixes the fact that the name of the singular type is plural, but
the name of the plural array is singular. Which has always annoyed me,
too. Also this makes it more clear that custom entities don't have much
to do with the editor.
This commit is contained in:
Misa 2021-02-20 16:01:39 -08:00 committed by Misa Elizabeth Kai
parent 47d01277bf
commit 8bff287907
5 changed files with 211 additions and 211 deletions

View file

@ -290,7 +290,7 @@ void customlevelclass::reset(void)
levmusic=0;
edentity.clear();
customentities.clear();
levmusic=0;
for (int j = 0; j < maxheight; j++)
@ -850,10 +850,10 @@ void customlevelclass::findstartpoint(void)
//Ok! Scan the room for the closest checkpoint
int testeditor=-1;
//First up; is there a start point on this screen?
for(size_t i=0; i<edentity.size(); i++)
for(size_t i=0; i<customentities.size(); i++)
{
//if() on screen
if(edentity[i].t==16 && testeditor==-1)
if(customentities[i].t==16 && testeditor==-1)
{
testeditor=i;
}
@ -872,25 +872,25 @@ void customlevelclass::findstartpoint(void)
else
{
//Start point spawn
int tx=(edentity[testeditor].x-(edentity[testeditor].x%40))/40;
int ty=(edentity[testeditor].y-(edentity[testeditor].y%30))/30;
game.edsavex = ((edentity[testeditor].x%40)*8)-4;
game.edsavey = (edentity[testeditor].y%30)*8;
int tx=(customentities[testeditor].x-(customentities[testeditor].x%40))/40;
int ty=(customentities[testeditor].y-(customentities[testeditor].y%30))/30;
game.edsavex = ((customentities[testeditor].x%40)*8)-4;
game.edsavey = (customentities[testeditor].y%30)*8;
game.edsaverx = 100+tx;
game.edsavery = 100+ty;
game.edsavegc = 0;
game.edsavey++;
game.edsavedir=1-edentity[testeditor].p1;
game.edsavedir=1-customentities[testeditor].p1;
}
}
int customlevelclass::findtrinket(int t)
{
int ttrinket=0;
for(int i=0; i<(int)edentity.size(); i++)
for(int i=0; i<(int)customentities.size(); i++)
{
if(i==t) return ttrinket;
if(edentity[i].t==9) ttrinket++;
if(customentities[i].t==9) ttrinket++;
}
return 0;
}
@ -898,10 +898,10 @@ int customlevelclass::findtrinket(int t)
int customlevelclass::findcrewmate(int t)
{
int ttrinket=0;
for(int i=0; i<(int)edentity.size(); i++)
for(int i=0; i<(int)customentities.size(); i++)
{
if(i==t) return ttrinket;
if(edentity[i].t==15) ttrinket++;
if(customentities[i].t==15) ttrinket++;
}
return 0;
}
@ -909,10 +909,10 @@ int customlevelclass::findcrewmate(int t)
int customlevelclass::findwarptoken(int t)
{
int ttrinket=0;
for(int i=0; i<(int)edentity.size(); i++)
for(int i=0; i<(int)customentities.size(); i++)
{
if(i==t) return ttrinket;
if(edentity[i].t==13) ttrinket++;
if(customentities[i].t==13) ttrinket++;
}
return 0;
}
@ -1130,7 +1130,7 @@ bool customlevelclass::load(std::string& _path)
edEntityEl->QueryIntAttribute("p5", &entity.p5);
edEntityEl->QueryIntAttribute("p6", &entity.p6);
edentity.push_back(entity);
customentities.push_back(entity);
}
}
@ -1347,19 +1347,19 @@ bool customlevelclass::save(std::string& _path)
msg = xml::update_element_delete_contents(data, "edEntities");
for(size_t i = 0; i < edentity.size(); i++)
for(size_t i = 0; i < customentities.size(); i++)
{
tinyxml2::XMLElement *edentityElement = doc.NewElement( "edentity" );
edentityElement->SetAttribute( "x", edentity[i].x);
edentityElement->SetAttribute( "y", edentity[i].y);
edentityElement->SetAttribute( "t", edentity[i].t);
edentityElement->SetAttribute( "p1", edentity[i].p1);
edentityElement->SetAttribute( "p2", edentity[i].p2);
edentityElement->SetAttribute( "p3", edentity[i].p3);
edentityElement->SetAttribute( "p4", edentity[i].p4);
edentityElement->SetAttribute( "p5", edentity[i].p5);
edentityElement->SetAttribute( "p6", edentity[i].p6);
edentityElement->LinkEndChild( doc.NewText( edentity[i].scriptname.c_str() )) ;
edentityElement->SetAttribute( "x", customentities[i].x);
edentityElement->SetAttribute( "y", customentities[i].y);
edentityElement->SetAttribute( "t", customentities[i].t);
edentityElement->SetAttribute( "p1", customentities[i].p1);
edentityElement->SetAttribute( "p2", customentities[i].p2);
edentityElement->SetAttribute( "p3", customentities[i].p3);
edentityElement->SetAttribute( "p4", customentities[i].p4);
edentityElement->SetAttribute( "p5", customentities[i].p5);
edentityElement->SetAttribute( "p6", customentities[i].p6);
edentityElement->LinkEndChild( doc.NewText( customentities[i].scriptname.c_str() )) ;
msg->LinkEndChild( edentityElement );
}
@ -1747,9 +1747,9 @@ Uint32 customlevelclass::getonewaycol(void)
int customlevelclass::numtrinkets(void)
{
int temp = 0;
for (size_t i = 0; i < edentity.size(); i++)
for (size_t i = 0; i < customentities.size(); i++)
{
if (edentity[i].t == 9)
if (customentities[i].t == 9)
{
temp++;
}
@ -1760,9 +1760,9 @@ int customlevelclass::numtrinkets(void)
int customlevelclass::numcrewmates(void)
{
int temp = 0;
for (size_t i = 0; i < edentity.size(); i++)
for (size_t i = 0; i < customentities.size(); i++)
{
if (edentity[i].t == 15)
if (customentities[i].t == 15)
{
temp++;
}

View file

@ -61,7 +61,7 @@ struct LevelMetaData
};
extern std::vector<CustomEntity> edentity;
extern std::vector<CustomEntity> customentities;
class EditorData
{

View file

@ -258,19 +258,19 @@ static void addedentity( int xp, int yp, int tp, int p1 = 0, int p2 = 0, int p3
entity.p6=p6;
entity.scriptname="";
edentity.push_back(entity);
customentities.push_back(entity);
}
static void removeedentity( int t )
{
edentity.erase(edentity.begin() + t);
customentities.erase(customentities.begin() + t);
}
static int edentat( int xp, int yp )
{
for(size_t i=0; i<edentity.size(); i++)
for(size_t i=0; i<customentities.size(); i++)
{
if(edentity[i].x==xp && edentity[i].y==yp) return i;
if(customentities[i].x==xp && customentities[i].y==yp) return i;
}
return -1;
}
@ -587,35 +587,35 @@ void editorrender(void)
gray_ct.colour = 0xFFFFFFFF;
// Draw entities backward to remain accurate with ingame
for (int i = edentity.size() - 1; i >= 0; i--)
for (int i = customentities.size() - 1; i >= 0; i--)
{
point tpoint;
SDL_Rect drawRect;
//if() on screen
if(edentity[i].x / 40 == ed.levx && edentity[i].y / 30 == ed.levy)
if(customentities[i].x / 40 == ed.levx && customentities[i].y / 30 == ed.levy)
{
switch(edentity[i].t)
switch(customentities[i].t)
{
case 1: //Entities
if (custom_gray) {
graphics.setcol(18);
ed.entcolreal = graphics.ct.colour;
}
graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),ed.getenemyframe(room->enemytype),ed.entcolreal);
if(edentity[i].p1==0) graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+4,(edentity[i].y*8)- (ed.levy*30*8)+4, "V", 255, 255, 255 - help.glow, false);
if(edentity[i].p1==1) graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+4,(edentity[i].y*8)- (ed.levy*30*8)+4, "^", 255, 255, 255 - help.glow, false);
if(edentity[i].p1==2) graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+4,(edentity[i].y*8)- (ed.levy*30*8)+4, "<", 255, 255, 255 - help.glow, false);
if(edentity[i].p1==3) graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+4,(edentity[i].y*8)- (ed.levy*30*8)+4, ">", 255, 255, 255 - help.glow, false);
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),16,16,graphics.getBGR(255,164,255));
graphics.drawsprite((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),ed.getenemyframe(room->enemytype),ed.entcolreal);
if(customentities[i].p1==0) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+4,(customentities[i].y*8)- (ed.levy*30*8)+4, "V", 255, 255, 255 - help.glow, false);
if(customentities[i].p1==1) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+4,(customentities[i].y*8)- (ed.levy*30*8)+4, "^", 255, 255, 255 - help.glow, false);
if(customentities[i].p1==2) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+4,(customentities[i].y*8)- (ed.levy*30*8)+4, "<", 255, 255, 255 - help.glow, false);
if(customentities[i].p1==3) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+4,(customentities[i].y*8)- (ed.levy*30*8)+4, ">", 255, 255, 255 - help.glow, false);
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),16,16,graphics.getBGR(255,164,255));
break;
case 2: //Threadmills & platforms
if (!INBOUNDS_VEC(obj.customplatformtile, graphics.entcolours))
{
continue;
}
tpoint.x = (edentity[i].x*8)- (ed.levx*40*8);
tpoint.y = (edentity[i].y*8)- (ed.levy*30*8);
tpoint.x = (customentities[i].x*8)- (ed.levx*40*8);
tpoint.y = (customentities[i].y*8)- (ed.levy*30*8);
drawRect = graphics.tiles_rect;
drawRect.x += tpoint.x;
drawRect.y += tpoint.y;
@ -625,30 +625,30 @@ void editorrender(void)
drawRect.x += 8;
}
if(edentity[i].p1<=4)
if(customentities[i].p1<=4)
{
if(edentity[i].p1==0) graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+12,(edentity[i].y*8)- (ed.levy*30*8), "V", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
if(edentity[i].p1==1) graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+12,(edentity[i].y*8)- (ed.levy*30*8), "^", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
if(edentity[i].p1==2) graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+12,(edentity[i].y*8)- (ed.levy*30*8), "<", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
if(edentity[i].p1==3) graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+12,(edentity[i].y*8)- (ed.levy*30*8), ">", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),32,8,graphics.getBGR(255,255,255));
if(customentities[i].p1==0) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+12,(customentities[i].y*8)- (ed.levy*30*8), "V", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
if(customentities[i].p1==1) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+12,(customentities[i].y*8)- (ed.levy*30*8), "^", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
if(customentities[i].p1==2) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+12,(customentities[i].y*8)- (ed.levy*30*8), "<", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
if(customentities[i].p1==3) graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+12,(customentities[i].y*8)- (ed.levy*30*8), ">", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),32,8,graphics.getBGR(255,255,255));
}
if(edentity[i].p1==5)
if(customentities[i].p1==5)
{
graphics.Print((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8), ">>>>", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),32,8,graphics.getBGR(255,255,255));
graphics.Print((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8), ">>>>", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),32,8,graphics.getBGR(255,255,255));
}
else if(edentity[i].p1==6)
else if(customentities[i].p1==6)
{
graphics.Print((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8), "<<<<", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),32,8,graphics.getBGR(255,255,255));
graphics.Print((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8), "<<<<", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),32,8,graphics.getBGR(255,255,255));
}
if(edentity[i].p1>=7)
if(customentities[i].p1>=7)
{
tpoint.x = (edentity[i].x*8)- (ed.levx*40*8)+32;
tpoint.y = (edentity[i].y*8)- (ed.levy*30*8);
tpoint.x = (customentities[i].x*8)- (ed.levx*40*8)+32;
tpoint.y = (customentities[i].y*8)- (ed.levy*30*8);
drawRect = graphics.tiles_rect;
drawRect.x += tpoint.x;
drawRect.y += tpoint.y;
@ -659,15 +659,15 @@ void editorrender(void)
}
}
if(edentity[i].p1==7)
if(customentities[i].p1==7)
{
graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+4,(edentity[i].y*8)- (ed.levy*30*8), "> > > > ", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),64,8,graphics.getBGR(255,255,255));
graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+4,(customentities[i].y*8)- (ed.levy*30*8), "> > > > ", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),64,8,graphics.getBGR(255,255,255));
}
else if(edentity[i].p1==8)
else if(customentities[i].p1==8)
{
graphics.Print((edentity[i].x*8)- (ed.levx*40*8)+4,(edentity[i].y*8)- (ed.levy*30*8), "< < < < ", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),64,8,graphics.getBGR(255,255,255));
graphics.Print((customentities[i].x*8)- (ed.levx*40*8)+4,(customentities[i].y*8)- (ed.levy*30*8), "< < < < ", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),64,8,graphics.getBGR(255,255,255));
}
break;
case 3: //Disappearing Platform
@ -675,8 +675,8 @@ void editorrender(void)
{
continue;
}
tpoint.x = (edentity[i].x*8)- (ed.levx*40*8);
tpoint.y = (edentity[i].y*8)- (ed.levy*30*8);
tpoint.x = (customentities[i].x*8)- (ed.levx*40*8);
tpoint.y = (customentities[i].y*8)- (ed.levy*30*8);
drawRect = graphics.tiles_rect;
drawRect.x += tpoint.x;
drawRect.y += tpoint.y;
@ -686,87 +686,87 @@ void editorrender(void)
drawRect.x += 8;
}
graphics.Print((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8), "////", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),32,8,graphics.getBGR(255,255,255));
graphics.Print((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8), "////", 255 - help.glow, 255 - help.glow, 255 - help.glow, false);
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),32,8,graphics.getBGR(255,255,255));
break;
case 9: //Shiny Trinket
graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),22,196,196,196);
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),16,16,graphics.getRGB(164,164,255));
graphics.drawsprite((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),22,196,196,196);
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),16,16,graphics.getRGB(164,164,255));
break;
case 10: //Checkpoints
graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),20 + edentity[i].p1,196,196,196);
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),16,16,graphics.getRGB(164,164,255));
graphics.drawsprite((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),20 + customentities[i].p1,196,196,196);
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),16,16,graphics.getRGB(164,164,255));
break;
case 11: //Gravity lines
if(edentity[i].p1==0) //Horizontal
if(customentities[i].p1==0) //Horizontal
{
int tx = edentity[i].p2;
int tx2 = tx + edentity[i].p3/8;
int ty = edentity[i].y % 30;
int tx = customentities[i].p2;
int tx2 = tx + customentities[i].p3/8;
int ty = customentities[i].y % 30;
FillRect(graphics.backBuffer, (tx*8),(ty*8)+4, (tx2-tx)*8,1, graphics.getRGB(194,194,194));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(164,255,164));
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(164,255,164));
}
else //Vertical
{
int tx = edentity[i].x % 40;
int ty = edentity[i].p2;
int ty2 = ty + edentity[i].p3/8;
int tx = customentities[i].x % 40;
int ty = customentities[i].p2;
int ty2 = ty + customentities[i].p3/8;
FillRect(graphics.backBuffer, (tx*8)+3,(ty*8), 1,(ty2-ty)*8, graphics.getRGB(194,194,194));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(164,255,164));
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(164,255,164));
}
break;
case 13://Warp tokens
graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),18+(ed.entframe%2),196,196,196);
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),16,16,graphics.getRGB(164,164,255));
graphics.drawsprite((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),18+(ed.entframe%2),196,196,196);
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),16,16,graphics.getRGB(164,164,255));
if(temp2==i)
{
graphics.bprint((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8)-8,
"("+help.String(((edentity[i].p1-int(edentity[i].p1%40))/40)+1)+","+help.String(((edentity[i].p2-int(edentity[i].p2%30))/30)+1)+")",210,210,255);
graphics.bprint((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8)-8,
"("+help.String(((customentities[i].p1-int(customentities[i].p1%40))/40)+1)+","+help.String(((customentities[i].p2-int(customentities[i].p2%30))/30)+1)+")",210,210,255);
}
else
{
graphics.bprint((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8)-8,help.String(cl.findwarptoken(i)),210,210,255);
graphics.bprint((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8)-8,help.String(cl.findwarptoken(i)),210,210,255);
}
break;
case 15: //Crewmates
graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8)-4,(edentity[i].y*8)- (ed.levy*30*8),144,graphics.crewcolourreal(edentity[i].p1));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),16,24,graphics.getRGB(164,164,164));
graphics.drawsprite((customentities[i].x*8)- (ed.levx*40*8)-4,(customentities[i].y*8)- (ed.levy*30*8),144,graphics.crewcolourreal(customentities[i].p1));
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),16,24,graphics.getRGB(164,164,164));
break;
case 16: //Start
if(edentity[i].p1==0) //Left
if(customentities[i].p1==0) //Left
{
graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8)-4,(edentity[i].y*8)- (ed.levy*30*8),0,graphics.col_crewcyan);
graphics.drawsprite((customentities[i].x*8)- (ed.levx*40*8)-4,(customentities[i].y*8)- (ed.levy*30*8),0,graphics.col_crewcyan);
}
else if(edentity[i].p1==1)
else if(customentities[i].p1==1)
{
graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8)-4,(edentity[i].y*8)- (ed.levy*30*8),3,graphics.col_crewcyan);
graphics.drawsprite((customentities[i].x*8)- (ed.levx*40*8)-4,(customentities[i].y*8)- (ed.levy*30*8),3,graphics.col_crewcyan);
}
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),16,24,graphics.getRGB(164,255,255));
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),16,24,graphics.getRGB(164,255,255));
if(ed.entframe<2)
{
graphics.bprint((edentity[i].x*8)- (ed.levx*40*8)-12,(edentity[i].y*8)- (ed.levy*30*8)-8,"START",255,255,255);
graphics.bprint((customentities[i].x*8)- (ed.levx*40*8)-12,(customentities[i].y*8)- (ed.levy*30*8)-8,"START",255,255,255);
}
else
{
graphics.bprint((edentity[i].x*8)- (ed.levx*40*8)-12,(edentity[i].y*8)- (ed.levy*30*8)-8,"START",196,196,196);
graphics.bprint((customentities[i].x*8)- (ed.levx*40*8)-12,(customentities[i].y*8)- (ed.levy*30*8)-8,"START",196,196,196);
}
break;
case 17: //Roomtext
if(edentity[i].scriptname.length()<1)
if(customentities[i].scriptname.length()<1)
{
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(96,96,96));
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(96,96,96));
}
else
{
int length = utf8::unchecked::distance(edentity[i].scriptname.begin(), edentity[i].scriptname.end());
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),length*8,8,graphics.getRGB(96,96,96));
int length = utf8::unchecked::distance(customentities[i].scriptname.begin(), customentities[i].scriptname.end());
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),length*8,8,graphics.getRGB(96,96,96));
}
graphics.Print((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8), edentity[i].scriptname, 196, 196, 255 - help.glow);
graphics.Print((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8), customentities[i].scriptname, 196, 196, 255 - help.glow);
break;
case 18: //Terminals
{
int usethistile = edentity[i].p1;
int usethisy = (edentity[i].y % 30) * 8;
int usethistile = customentities[i].p1;
int usethisy = (customentities[i].y % 30) * 8;
// Not a boolean: just swapping 0 and 1, leaving the rest alone
if (usethistile == 0)
{
@ -777,88 +777,88 @@ void editorrender(void)
usethistile = 0; // Flipped;
usethisy -= 8;
}
graphics.drawsprite((edentity[i].x*8)- (ed.levx*40*8), usethisy + 8, usethistile + 16, 96,96,96);
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),16,24,graphics.getRGB(164,164,164));
graphics.drawsprite((customentities[i].x*8)- (ed.levx*40*8), usethisy + 8, usethistile + 16, 96,96,96);
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),16,24,graphics.getRGB(164,164,164));
if(temp2==i)
{
graphics.bprint((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8)-8,edentity[i].scriptname,210,210,255);
graphics.bprint((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8)-8,customentities[i].scriptname,210,210,255);
}
break;
}
case 19: //Script Triggers
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),edentity[i].p1*8,edentity[i].p2*8,graphics.getRGB(255,164,255));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(255,255,255));
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),customentities[i].p1*8,customentities[i].p2*8,graphics.getRGB(255,164,255));
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(255,255,255));
if(temp2==i)
{
graphics.bprint((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8)-8,edentity[i].scriptname,210,210,255);
graphics.bprint((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8)-8,customentities[i].scriptname,210,210,255);
}
break;
case 50: //Warp lines
if(edentity[i].p1>=2) //Horizontal
if(customentities[i].p1>=2) //Horizontal
{
int tx=edentity[i].x-(ed.levx*40);
int tx2=edentity[i].x-(ed.levx*40);
int ty=edentity[i].y-(ed.levy*30);
if (edentity[i].p4 != 1)
int tx=customentities[i].x-(ed.levx*40);
int tx2=customentities[i].x-(ed.levx*40);
int ty=customentities[i].y-(ed.levy*30);
if (customentities[i].p4 != 1)
{
// Unlocked
while(ed.free(tx,ty)==0) tx--;
while(ed.free(tx2,ty)==0) tx2++;
tx++;
edentity[i].p2=tx;
edentity[i].p3=(tx2-tx)*8;
customentities[i].p2=tx;
customentities[i].p3=(tx2-tx)*8;
}
else
{
// Locked
tx = edentity[i].p2;
tx2 = tx + edentity[i].p3/8;
tx = customentities[i].p2;
tx2 = tx + customentities[i].p3/8;
}
fillboxabs((tx*8),(ty*8)+1, (tx2-tx)*8,6, graphics.getRGB(255,255,194));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(255,255,164));
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(255,255,164));
}
else //Vertical
{
int tx=edentity[i].x-(ed.levx*40);
int ty=edentity[i].y-(ed.levy*30);
int ty2=edentity[i].y-(ed.levy*30);
if (edentity[i].p4 != 1)
int tx=customentities[i].x-(ed.levx*40);
int ty=customentities[i].y-(ed.levy*30);
int ty2=customentities[i].y-(ed.levy*30);
if (customentities[i].p4 != 1)
{
// Unlocked
while(ed.free(tx,ty)==0) ty--;
while(ed.free(tx,ty2)==0) ty2++;
ty++;
edentity[i].p2=ty;
edentity[i].p3=(ty2-ty)*8;
customentities[i].p2=ty;
customentities[i].p3=(ty2-ty)*8;
}
else
{
// Locked
ty = edentity[i].p2;
ty2 = ty + edentity[i].p3/8;
ty = customentities[i].p2;
ty2 = ty + customentities[i].p3/8;
}
fillboxabs((tx*8)+1,(ty*8), 6,(ty2-ty)*8, graphics.getRGB(255,255,194));
fillboxabs((edentity[i].x*8)- (ed.levx*40*8),(edentity[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(255,255,164));
fillboxabs((customentities[i].x*8)- (ed.levx*40*8),(customentities[i].y*8)- (ed.levy*30*8),8,8,graphics.getRGB(255,255,164));
}
break;
}
}
//Need to also check warp point destinations
if(edentity[i].t==13 && ed.warpent!=i)
if(customentities[i].t==13 && ed.warpent!=i)
{
if (edentity[i].p1 / 40 == ed.levx && edentity[i].p2 / 30 == ed.levy)
if (customentities[i].p1 / 40 == ed.levx && customentities[i].p2 / 30 == ed.levy)
{
graphics.drawsprite((edentity[i].p1*8)- (ed.levx*40*8),(edentity[i].p2*8)- (ed.levy*30*8),18+(ed.entframe%2),64,64,64);
fillboxabs((edentity[i].p1*8)- (ed.levx*40*8),(edentity[i].p2*8)- (ed.levy*30*8),16,16,graphics.getRGB(64,64,96));
if(ed.tilex+(ed.levx*40)==edentity[i].p1 && ed.tiley+(ed.levy*30)==edentity[i].p2)
graphics.drawsprite((customentities[i].p1*8)- (ed.levx*40*8),(customentities[i].p2*8)- (ed.levy*30*8),18+(ed.entframe%2),64,64,64);
fillboxabs((customentities[i].p1*8)- (ed.levx*40*8),(customentities[i].p2*8)- (ed.levy*30*8),16,16,graphics.getRGB(64,64,96));
if(ed.tilex+(ed.levx*40)==customentities[i].p1 && ed.tiley+(ed.levy*30)==customentities[i].p2)
{
graphics.bprint((edentity[i].p1*8)- (ed.levx*40*8),(edentity[i].p2*8)- (ed.levy*30*8)-8,
"("+help.String(((edentity[i].x-int(edentity[i].x%40))/40)+1)+","+help.String(((edentity[i].y-int(edentity[i].y%30))/30)+1)+")",190,190,225);
graphics.bprint((customentities[i].p1*8)- (ed.levx*40*8),(customentities[i].p2*8)- (ed.levy*30*8)-8,
"("+help.String(((customentities[i].x-int(customentities[i].x%40))/40)+1)+","+help.String(((customentities[i].y-int(customentities[i].y%30))/30)+1)+")",190,190,225);
}
else
{
graphics.bprint((edentity[i].p1*8)- (ed.levx*40*8),(edentity[i].p2*8)- (ed.levy*30*8)-8,help.String(cl.findwarptoken(i)),190,190,225);
graphics.bprint((customentities[i].p1*8)- (ed.levx*40*8),(customentities[i].p2*8)- (ed.levy*30*8)-8,help.String(cl.findwarptoken(i)),190,190,225);
}
}
}
@ -1603,23 +1603,23 @@ void editorrenderfixed(void)
}
/* Correct gravity lines */
for (size_t i = 0; i < edentity.size(); ++i)
for (size_t i = 0; i < customentities.size(); ++i)
{
if (edentity[i].x / 40 != ed.levx
|| edentity[i].y / 30 != ed.levy
|| edentity[i].t != 11
if (customentities[i].x / 40 != ed.levx
|| customentities[i].y / 30 != ed.levy
|| customentities[i].t != 11
/* Is the gravity line locked? */
|| edentity[i].p4 == 1)
|| customentities[i].p4 == 1)
{
continue;
}
if (edentity[i].p1 == 0)
if (customentities[i].p1 == 0)
{
/* Horizontal */
int tx = edentity[i].x % 40;
int tx = customentities[i].x % 40;
int tx2 = tx;
int ty = edentity[i].y % 30;
int ty = customentities[i].y % 30;
while (!ed.spikefree(tx, ty))
{
--tx;
@ -1629,14 +1629,14 @@ void editorrenderfixed(void)
++tx2;
}
++tx;
edentity[i].p2 = tx;
edentity[i].p3 = (tx2 - tx) * 8;
customentities[i].p2 = tx;
customentities[i].p3 = (tx2 - tx) * 8;
}
else
{
/* Vertical */
int tx = edentity[i].x % 40;
int ty = edentity[i].y % 30;
int tx = customentities[i].x % 40;
int ty = customentities[i].y % 30;
int ty2 = ty;
/* Unlocked */
while (!ed.spikefree(tx, ty))
@ -1648,8 +1648,8 @@ void editorrenderfixed(void)
++ty2;
}
++ty;
edentity[i].p2 = ty;
edentity[i].p3 = (ty2 - ty) * 8;
customentities[i].p2 = ty;
customentities[i].p3 = (ty2 - ty) * 8;
}
}
@ -2715,13 +2715,13 @@ void editorinput(void)
int testeditor=-1;
int startpoint=0;
//First up; is there a start point on this screen?
for(size_t i=0; i<edentity.size(); i++)
for(size_t i=0; i<customentities.size(); i++)
{
//if() on screen
if(edentity[i].t==16 && testeditor==-1)
if(customentities[i].t==16 && testeditor==-1)
{
int tx=(edentity[i].x-(edentity[i].x%40))/40;
int ty=(edentity[i].y-(edentity[i].y%30))/30;
int tx=(customentities[i].x-(customentities[i].x%40))/40;
int ty=(customentities[i].y-(customentities[i].y%30))/30;
if(tx==ed.levx && ty==ed.levy)
{
testeditor=i;
@ -2732,13 +2732,13 @@ void editorinput(void)
if(testeditor==-1)
{
//Ok, settle for a check point
for(size_t i=0; i<edentity.size(); i++)
for(size_t i=0; i<customentities.size(); i++)
{
//if() on screen
if(edentity[i].t==10 && testeditor==-1)
if(customentities[i].t==10 && testeditor==-1)
{
int tx=(edentity[i].x-(edentity[i].x%40))/40;
int ty=(edentity[i].y-(edentity[i].y%30))/30;
int tx=(customentities[i].x-(customentities[i].x%40))/40;
int ty=(customentities[i].y-(customentities[i].y%30))/30;
if(tx==ed.levx && ty==ed.levy)
{
testeditor=i;
@ -2758,13 +2758,13 @@ void editorinput(void)
if(startpoint==0)
{
//Checkpoint spawn
int tx=(edentity[testeditor].x-(edentity[testeditor].x%40))/40;
int ty=(edentity[testeditor].y-(edentity[testeditor].y%30))/30;
game.edsavex = (edentity[testeditor].x%40)*8 - 4;
game.edsavey = (edentity[testeditor].y%30)*8;
int tx=(customentities[testeditor].x-(customentities[testeditor].x%40))/40;
int ty=(customentities[testeditor].y-(customentities[testeditor].y%30))/30;
game.edsavex = (customentities[testeditor].x%40)*8 - 4;
game.edsavey = (customentities[testeditor].y%30)*8;
game.edsaverx = 100+tx;
game.edsavery = 100+ty;
if (edentity[testeditor].p1 == 0) // NOT a bool check!
if (customentities[testeditor].p1 == 0) // NOT a bool check!
{
game.edsavegc = 1;
game.edsavey -= 2;
@ -2779,15 +2779,15 @@ void editorinput(void)
else
{
//Start point spawn
int tx=(edentity[testeditor].x-(edentity[testeditor].x%40))/40;
int ty=(edentity[testeditor].y-(edentity[testeditor].y%30))/30;
game.edsavex = (edentity[testeditor].x%40)*8 - 4;
game.edsavey = (edentity[testeditor].y%30)*8;
int tx=(customentities[testeditor].x-(customentities[testeditor].x%40))/40;
int ty=(customentities[testeditor].y-(customentities[testeditor].y%30))/30;
game.edsavex = (customentities[testeditor].x%40)*8 - 4;
game.edsavey = (customentities[testeditor].y%30)*8;
game.edsaverx = 100+tx;
game.edsavery = 100+ty;
game.edsavegc = 0;
game.edsavey++;
game.edsavedir=1-edentity[testeditor].p1;
game.edsavedir=1-customentities[testeditor].p1;
}
music.haltdasmusik();
@ -2907,10 +2907,10 @@ void editorinput(void)
{
//Script trigger
ed.lclickdelay=1;
ed.textent=edentity.size();
ed.textent=customentities.size();
addedentity((ed.boundx1/8)+(ed.levx*40),(ed.boundy1/8)+ (ed.levy*30),19,
(ed.boundx2-ed.boundx1)/8, (ed.boundy2-ed.boundy1)/8);
ed.getlin(TEXT_SCRIPT, "Enter script name:", &(edentity[ed.textent].scriptname));
ed.getlin(TEXT_SCRIPT, "Enter script name:", &(customentities[ed.textent].scriptname));
ed.lclickdelay=1;
}
else if(ed.boundarytype==1)
@ -2956,8 +2956,8 @@ void editorinput(void)
{
if(ed.free(ed.tilex, ed.tiley)==0)
{
edentity[ed.warpent].p1=ed.tilex+(ed.levx*40);
edentity[ed.warpent].p2=ed.tiley+(ed.levy*30);
customentities[ed.warpent].p1=ed.tilex+(ed.levx*40);
customentities[ed.warpent].p2=ed.tiley+(ed.levy*30);
ed.warpmod=false;
ed.warpent=-1;
ed.lclickdelay=1;
@ -3185,9 +3185,9 @@ void editorinput(void)
if(ed.drawmode==10)
{
ed.lclickdelay=1;
ed.textent=edentity.size();
ed.textent=customentities.size();
addedentity(ed.tilex+ (ed.levx*40),ed.tiley+ (ed.levy*30),17);
ed.getlin(TEXT_ROOMTEXT, "Enter roomtext:", &(edentity[ed.textent].scriptname));
ed.getlin(TEXT_ROOMTEXT, "Enter roomtext:", &(customentities[ed.textent].scriptname));
}
else if(ed.drawmode==12) //Script Trigger
{
@ -3246,14 +3246,14 @@ void editorinput(void)
else if(ed.drawmode==11)
{
ed.lclickdelay=1;
ed.textent=edentity.size();
ed.textent=customentities.size();
addedentity(ed.tilex+(ed.levx*40),ed.tiley+ (ed.levy*30),18,0);
ed.getlin(TEXT_SCRIPT, "Enter script name:", &(edentity[ed.textent].scriptname));
ed.getlin(TEXT_SCRIPT, "Enter script name:", &(customentities[ed.textent].scriptname));
}
else if(ed.drawmode==13)
{
ed.warpmod=true;
ed.warpent=edentity.size();
ed.warpent=customentities.size();
addedentity(ed.tilex+ (ed.levx*40),ed.tiley+ (ed.levy*30),13);
ed.lclickdelay=1;
}
@ -3299,9 +3299,9 @@ void editorinput(void)
else if(ed.drawmode==16) //Start Point
{
//If there is another start point, destroy it
for(size_t i=0; i<edentity.size(); i++)
for(size_t i=0; i<customentities.size(); i++)
{
if(edentity[i].t==16)
if(customentities[i].t==16)
{
removeedentity(i);
i--;
@ -3315,64 +3315,64 @@ void editorinput(void)
{
//Important! Do nothing, or else Undefined Behavior will happen
}
else if(edentity[tmp].t==1)
else if(customentities[tmp].t==1)
{
edentity[tmp].p1=(edentity[tmp].p1+1)%4;
customentities[tmp].p1=(customentities[tmp].p1+1)%4;
ed.lclickdelay=1;
}
else if(edentity[tmp].t==2)
else if(customentities[tmp].t==2)
{
if(edentity[tmp].p1>=5)
if(customentities[tmp].p1>=5)
{
edentity[tmp].p1=(edentity[tmp].p1+1)%9;
if(edentity[tmp].p1<5) edentity[tmp].p1=5;
customentities[tmp].p1=(customentities[tmp].p1+1)%9;
if(customentities[tmp].p1<5) customentities[tmp].p1=5;
}
else
{
edentity[tmp].p1=(edentity[tmp].p1+1)%4;
customentities[tmp].p1=(customentities[tmp].p1+1)%4;
}
ed.lclickdelay=1;
}
else if(edentity[tmp].t==10)
else if(customentities[tmp].t==10)
{
// If it's not textured as a checkpoint, leave it alone
if (edentity[tmp].p1 == 0 || edentity[tmp].p1 == 1)
if (customentities[tmp].p1 == 0 || customentities[tmp].p1 == 1)
{
edentity[tmp].p1=(edentity[tmp].p1+1)%2;
customentities[tmp].p1=(customentities[tmp].p1+1)%2;
}
ed.lclickdelay=1;
}
else if(edentity[tmp].t==11)
else if(customentities[tmp].t==11)
{
edentity[tmp].p1=(edentity[tmp].p1+1)%2;
customentities[tmp].p1=(customentities[tmp].p1+1)%2;
ed.lclickdelay=1;
}
else if(edentity[tmp].t==15)
else if(customentities[tmp].t==15)
{
edentity[tmp].p1=(edentity[tmp].p1+1)%6;
customentities[tmp].p1=(customentities[tmp].p1+1)%6;
ed.lclickdelay=1;
}
else if(edentity[tmp].t==16)
else if(customentities[tmp].t==16)
{
edentity[tmp].p1=(edentity[tmp].p1+1)%2;
customentities[tmp].p1=(customentities[tmp].p1+1)%2;
ed.lclickdelay=1;
}
else if(edentity[tmp].t==17)
else if(customentities[tmp].t==17)
{
ed.getlin(TEXT_ROOMTEXT, "Enter roomtext:", &(edentity[tmp].scriptname));
ed.getlin(TEXT_ROOMTEXT, "Enter roomtext:", &(customentities[tmp].scriptname));
ed.textent=tmp;
ed.lclickdelay=1;
}
else if(edentity[tmp].t==18 || edentity[tmp].t==19)
else if(customentities[tmp].t==18 || customentities[tmp].t==19)
{
ed.lclickdelay=1;
ed.textent=tmp;
ed.getlin(TEXT_SCRIPT, "Enter script name:", &(edentity[ed.textent].scriptname));
if (edentity[tmp].t == 18
&& (edentity[tmp].p1 == 0 || edentity[tmp].p1 == 1))
ed.getlin(TEXT_SCRIPT, "Enter script name:", &(customentities[ed.textent].scriptname));
if (customentities[tmp].t == 18
&& (customentities[tmp].p1 == 0 || customentities[tmp].p1 == 1))
{
// Flip the terminal, but if it's not textured as a terminal leave it alone
edentity[tmp].p1 = (edentity[tmp].p1 + 1) % 2;
customentities[tmp].p1 = (customentities[tmp].p1 + 1) % 2;
}
}
}
@ -3449,9 +3449,9 @@ void editorinput(void)
{
ed.placetilelocal(ed.tilex, ed.tiley, 0);
}
for(size_t i=0; i<edentity.size(); i++)
for(size_t i=0; i<customentities.size(); i++)
{
if(edentity[i].x==ed.tilex + (ed.levx*40)&& edentity[i].y==ed.tiley+ (ed.levy*30))
if(customentities[i].x==ed.tilex + (ed.levx*40)&& customentities[i].y==ed.tiley+ (ed.levy*30))
{
removeedentity(i);
}

View file

@ -451,9 +451,9 @@ void mapclass::initcustommapdata(void)
shinytrinkets.clear();
#if !defined(NO_CUSTOM_LEVELS)
for (size_t i = 0; i < edentity.size(); i++)
for (size_t i = 0; i < customentities.size(); i++)
{
const CustomEntity& ent = edentity[i];
const CustomEntity& ent = customentities[i];
if (ent.t != 9)
{
continue;
@ -1634,10 +1634,10 @@ void mapclass::loadlevel(int rx, int ry)
// Entities have to be created HERE, akwardly
int tempcheckpoints = 0;
int tempscriptbox = 0;
for (size_t edi = 0; edi < edentity.size(); edi++)
for (size_t edi = 0; edi < customentities.size(); edi++)
{
// If entity is in this room, create it
const CustomEntity& ent = edentity[edi];
const CustomEntity& ent = customentities[edi];
const int tsx = ent.x / 40;
const int tsy = ent.y / 30;

View file

@ -32,7 +32,7 @@
scriptclass script;
#ifndef NO_CUSTOM_LEVELS
std::vector<CustomEntity> edentity;
std::vector<CustomEntity> customentities;
customlevelclass cl;
# ifndef NO_EDITOR
editorclass ed;