more jacksonmj suggestions: save edgeMode in saves, BVBR absorption fix, life saving fix, DEUT graphics change, PROT fix, SOAP graphics fix

This commit is contained in:
jacob1 2014-11-21 15:39:01 -05:00
parent e20f6b101b
commit 16ce3a68c0
10 changed files with 30 additions and 23 deletions

View File

@ -22,6 +22,7 @@ paused(save.paused),
gravityMode(save.gravityMode),
aheatEnable(save.aheatEnable),
airMode(save.airMode),
edgeMode(save.edgeMode),
signs(save.signs),
expanded(save.expanded),
hasOriginalData(save.hasOriginalData),
@ -179,6 +180,7 @@ void GameSave::Expand()
paused = false;
gravityMode = 0;
airMode = 0;
edgeMode = 0;
expanded = true;
read(&originalData[0], originalData.size());
}
@ -681,6 +683,17 @@ void GameSave::readOPS(char * data, int dataLength)
fprintf(stderr, "Wrong type for %s\n", bson_iterator_key(&iter));
}
}
else if (!strcmp(bson_iterator_key(&iter), "edgeMode"))
{
if(bson_iterator_type(&iter)==BSON_INT)
{
edgeMode = bson_iterator_int(&iter);
}
else
{
fprintf(stderr, "Wrong type for %s\n", bson_iterator_key(&iter));
}
}
else if(strcmp(bson_iterator_key(&iter), "palette")==0)
{
palette.clear();
@ -1914,7 +1927,7 @@ char * GameSave::serialiseOPS(int & dataLength)
life = 0;
fieldDesc |= 1 << 1;
partsData[partsDataLen++] = life;
if(particles[i].life & 0xFF00)
if (life & 0xFF00)
{
fieldDesc |= 1 << 2;
partsData[partsDataLen++] = life >> 8;
@ -2082,6 +2095,7 @@ char * GameSave::serialiseOPS(int & dataLength)
bson_append_bool(&b, "paused", paused);
bson_append_int(&b, "gravityMode", gravityMode);
bson_append_int(&b, "airMode", airMode);
bson_append_int(&b, "edgeMode", edgeMode);
//bson_append_int(&b, "leftSelectedElement", sl);
//bson_append_int(&b, "rightSelectedElement", sr);

View File

@ -46,6 +46,7 @@ public:
bool paused;
int gravityMode;
int airMode;
int edgeMode;
//Signs
std::vector<sign> signs;

View File

@ -1365,7 +1365,7 @@ void Renderer::render_parts()
{
if (t==PT_SOAP)
{
if ((parts[i].ctype&7) == 7 && parts[i].tmp >= 0 && parts[i].tmp < NPART && parts[i].tmp2 >= 0 && parts[i].tmp2 < NPART)
if ((parts[i].ctype&3) == 3 && parts[i].tmp >= 0 && parts[i].tmp < NPART)
draw_line(nx, ny, (int)(parts[parts[i].tmp].x+0.5f), (int)(parts[parts[i].tmp].y+0.5f), colr, colg, colb, cola);
}
}

View File

@ -1073,6 +1073,7 @@ void GameController::OpenLocalSaveWindow(bool asCurrent)
gameSave->paused = gameModel->GetPaused();
gameSave->gravityMode = sim->gravityMode;
gameSave->airMode = sim->air->airMode;
gameSave->edgeMode = sim->edgeMode;
gameSave->legacyEnable = sim->legacy_enable;
gameSave->waterEEnabled = sim->water_equal_test;
gameSave->gravityEnable = sim->grav->ngrav_enable;
@ -1281,6 +1282,7 @@ void GameController::OpenSaveWindow()
gameSave->paused = gameModel->GetPaused();
gameSave->gravityMode = sim->gravityMode;
gameSave->airMode = sim->air->airMode;
gameSave->edgeMode = sim->edgeMode;
gameSave->legacyEnable = sim->legacy_enable;
gameSave->waterEEnabled = sim->water_equal_test;
gameSave->gravityEnable = sim->grav->ngrav_enable;
@ -1333,6 +1335,7 @@ void GameController::SaveAsCurrent()
gameSave->paused = gameModel->GetPaused();
gameSave->gravityMode = sim->gravityMode;
gameSave->airMode = sim->air->airMode;
gameSave->edgeMode = sim->edgeMode;
gameSave->legacyEnable = sim->legacy_enable;
gameSave->waterEEnabled = sim->water_equal_test;
gameSave->gravityEnable = sim->grav->ngrav_enable;

View File

@ -587,6 +587,7 @@ void GameModel::SetSave(SaveInfo * newSave)
SetPaused(saveData->paused | GetPaused());
sim->gravityMode = saveData->gravityMode;
sim->air->airMode = saveData->airMode;
sim->edgeMode = saveData->edgeMode;
sim->legacy_enable = saveData->legacyEnable;
sim->water_equal_test = saveData->waterEEnabled;
sim->aheat_enable = saveData->aheatEnable;
@ -629,6 +630,7 @@ void GameModel::SetSaveFile(SaveFile * newSave)
SetPaused(saveData->paused | GetPaused());
sim->gravityMode = saveData->gravityMode;
sim->air->airMode = saveData->airMode;
sim->edgeMode = saveData->edgeMode;
sim->legacy_enable = saveData->legacyEnable;
sim->water_equal_test = saveData->waterEEnabled;
sim->aheat_enable = saveData->aheatEnable;

View File

@ -2062,7 +2062,7 @@ void Simulation::init_can_move()
|| destinationType == PT_ISOZ || destinationType == PT_ISZS || destinationType == PT_QRTZ || destinationType == PT_PQRT
|| destinationType == PT_H2)
can_move[PT_PHOT][destinationType] = 2;
if (destinationType != PT_DMND && destinationType != PT_INSL && destinationType != PT_VOID && destinationType != PT_PVOD && destinationType != PT_VIBR && destinationType != PT_PRTI && destinationType != PT_PRTO)
if (destinationType != PT_DMND && destinationType != PT_INSL && destinationType != PT_VOID && destinationType != PT_PVOD && destinationType != PT_VIBR && destinationType != PT_BVBR && destinationType != PT_PRTI && destinationType != PT_PRTO)
{
can_move[PT_PROT][destinationType] = 2;
can_move[PT_GRVT][destinationType] = 2;

View File

@ -129,12 +129,12 @@ int Element_DEUT::update(UPDATE_FUNC_ARGS)
int Element_DEUT::graphics(GRAPHICS_FUNC_ARGS)
{
if(cpart->life>=700)
if(cpart->life>=240)
{
*firea = 60;
*firer = *colr += 255;
*fireg = *colg += 255;
*fireb = *colb += 255;
*firer = *colr += cpart->life*1;
*fireg = *colg += cpart->life*2;
*fireb = *colb += cpart->life*3;
*pixel_mode |= PMODE_GLOW | FIRE_ADD;
}
else if(cpart->life>0)

View File

@ -46,7 +46,7 @@ Element_LIFE::Element_LIFE()
HighTemperature = ITH;
HighTemperatureTransition = NT;
Update = NULL;//&Element_LIFE::update;
Update = NULL;
Graphics = &Element_LIFE::graphics;
if(!Element_GOL_colourInit)
@ -63,14 +63,6 @@ Element_LIFE::Element_LIFE()
}
}
//#TPT-Directive ElementHeader Element_LIFE static int update(UPDATE_FUNC_ARGS)
int Element_LIFE::update(UPDATE_FUNC_ARGS)
{
if (parts[i].tmp <= 0 && parts[i].tmp > NGOL)
sim->kill_part(i);
return 0;
}
//#TPT-Directive ElementHeader Element_LIFE static int graphics(GRAPHICS_FUNC_ARGS)
int Element_LIFE::graphics(GRAPHICS_FUNC_ARGS)

View File

@ -133,7 +133,8 @@ int Element_PROT::update(UPDATE_FUNC_ARGS)
else
element = PT_NBLE;
newID = sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, element);
parts[newID].temp = restrict_flt(100.0f*parts[i].tmp, MIN_TEMP, MAX_TEMP);
if (newID >= 0)
parts[newID].temp = restrict_flt(100.0f*parts[i].tmp, MIN_TEMP, MAX_TEMP);
sim->kill_part(i);
return 1;
}

View File

@ -176,12 +176,6 @@ int Element_VIBR::update(UPDATE_FUNC_ARGS) {
{
sim->create_part(i, x, y, PT_EXOT);
}
//Absorbs energy particles
else if ((sim->elements[r&0xFF].Properties & TYPE_ENERGY))
{
parts[i].tmp += 20;
sim->kill_part(r>>8);
}
}
//VIBR+ANAR=BVBR
if (parts[i].type != PT_BVBR && (r&0xFF) == PT_ANAR)