'n' to toggle Newtonian Gravity, quickoption tooltips show which keys you need to press to toggle them
This commit is contained in:
parent
0214fcb5ae
commit
8d5fe459fe
@ -434,7 +434,7 @@ void GameSave::readOPS(char * data, int dataLength)
|
|||||||
unsigned char * inputData = (unsigned char*)data, *bsonData = NULL, *partsData = NULL, *partsPosData = NULL, *fanData = NULL, *wallData = NULL, *soapLinkData = NULL;
|
unsigned char * inputData = (unsigned char*)data, *bsonData = NULL, *partsData = NULL, *partsPosData = NULL, *fanData = NULL, *wallData = NULL, *soapLinkData = NULL;
|
||||||
unsigned int inputDataLen = dataLength, bsonDataLen = 0, partsDataLen, partsPosDataLen, fanDataLen, wallDataLen, soapLinkDataLen;
|
unsigned int inputDataLen = dataLength, bsonDataLen = 0, partsDataLen, partsPosDataLen, fanDataLen, wallDataLen, soapLinkDataLen;
|
||||||
unsigned partsCount = 0, *partsSimIndex = NULL;
|
unsigned partsCount = 0, *partsSimIndex = NULL;
|
||||||
int i, freeIndicesCount, x, y, j;
|
int i, x, y, j;
|
||||||
int *freeIndices = NULL;
|
int *freeIndices = NULL;
|
||||||
int blockX, blockY, blockW, blockH, fullX, fullY, fullW, fullH;
|
int blockX, blockY, blockW, blockH, fullX, fullY, fullW, fullH;
|
||||||
int savedVersion = inputData[4];
|
int savedVersion = inputData[4];
|
||||||
|
@ -573,7 +573,19 @@ int Graphics::textwidth(const char *s)
|
|||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for (; *s; s++)
|
for (; *s; s++)
|
||||||
|
{
|
||||||
|
if(((char)*s)=='\b')
|
||||||
|
{
|
||||||
|
if(!s[1]) break;
|
||||||
|
s++;
|
||||||
|
continue;
|
||||||
|
} else if(*s == '\x0F') {
|
||||||
|
if(!s[1] || !s[2] || !s[3]) break;
|
||||||
|
s+=3;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
x += font_data[font_ptrs[(int)(*(unsigned char *)s)]];
|
x += font_data[font_ptrs[(int)(*(unsigned char *)s)]];
|
||||||
|
}
|
||||||
return x-1;
|
return x-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -823,6 +823,15 @@ void GameController::ToggleAHeat()
|
|||||||
gameModel->SetAHeatEnable(!gameModel->GetAHeatEnable());
|
gameModel->SetAHeatEnable(!gameModel->GetAHeatEnable());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameController::ToggleNewtonianGravity()
|
||||||
|
{
|
||||||
|
if (gameModel->GetSimulation()->grav->ngrav_enable)
|
||||||
|
gameModel->GetSimulation()->grav->stop_grav_async();
|
||||||
|
else
|
||||||
|
gameModel->GetSimulation()->grav->start_grav_async();
|
||||||
|
gameModel->UpdateQuickOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GameController::LoadRenderPreset(int presetNum)
|
void GameController::LoadRenderPreset(int presetNum)
|
||||||
{
|
{
|
||||||
|
@ -143,6 +143,7 @@ public:
|
|||||||
void SwitchGravity();
|
void SwitchGravity();
|
||||||
void SwitchAir();
|
void SwitchAir();
|
||||||
void ToggleAHeat();
|
void ToggleAHeat();
|
||||||
|
void ToggleNewtonianGravity();
|
||||||
|
|
||||||
void LoadClipboard();
|
void LoadClipboard();
|
||||||
void LoadStamp();
|
void LoadStamp();
|
||||||
|
@ -1395,6 +1395,8 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
case 'u':
|
case 'u':
|
||||||
c->ToggleAHeat();
|
c->ToggleAHeat();
|
||||||
break;
|
break;
|
||||||
|
case 'n':
|
||||||
|
c->ToggleNewtonianGravity();
|
||||||
case '=':
|
case '=':
|
||||||
if(ctrl)
|
if(ctrl)
|
||||||
c->ResetSpark();
|
c->ResetSpark();
|
||||||
@ -2021,7 +2023,11 @@ void GameView::OnDraw()
|
|||||||
else if(showHud)
|
else if(showHud)
|
||||||
{
|
{
|
||||||
//Draw info about simulation under cursor
|
//Draw info about simulation under cursor
|
||||||
int wavelengthGfx = 0;
|
int wavelengthGfx = 0, alpha = 255;
|
||||||
|
if (toolTipPosition.Y < 120)
|
||||||
|
alpha = 255-toolTipPresence*3;
|
||||||
|
if (alpha < 50)
|
||||||
|
alpha = 50;
|
||||||
std::stringstream sampleInfo;
|
std::stringstream sampleInfo;
|
||||||
sampleInfo.precision(2);
|
sampleInfo.precision(2);
|
||||||
if(sample.particle.type)
|
if(sample.particle.type)
|
||||||
@ -2081,8 +2087,8 @@ void GameView::OnDraw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int textWidth = Graphics::textwidth((char*)sampleInfo.str().c_str());
|
int textWidth = Graphics::textwidth((char*)sampleInfo.str().c_str());
|
||||||
g->fillrect(XRES-20-textWidth, 12, textWidth+8, 15, 0, 0, 0, 255*0.5);
|
g->fillrect(XRES-20-textWidth, 12, textWidth+8, 15, 0, 0, 0, alpha*0.5f);
|
||||||
g->drawtext(XRES-16-textWidth, 16, (const char*)sampleInfo.str().c_str(), 255, 255, 255, 255*0.75);
|
g->drawtext(XRES-16-textWidth, 16, (const char*)sampleInfo.str().c_str(), 255, 255, 255, alpha*0.75f);
|
||||||
|
|
||||||
#ifndef OGLI
|
#ifndef OGLI
|
||||||
if(wavelengthGfx)
|
if(wavelengthGfx)
|
||||||
@ -2134,8 +2140,8 @@ void GameView::OnDraw()
|
|||||||
sampleInfo << " GX: " << sample.GravityVelocityX << " GY: " << sample.GravityVelocityY;
|
sampleInfo << " GX: " << sample.GravityVelocityX << " GY: " << sample.GravityVelocityY;
|
||||||
|
|
||||||
textWidth = Graphics::textwidth((char*)sampleInfo.str().c_str());
|
textWidth = Graphics::textwidth((char*)sampleInfo.str().c_str());
|
||||||
g->fillrect(XRES-20-textWidth, 26, textWidth+8, 15, 0, 0, 0, 255*0.5);
|
g->fillrect(XRES-20-textWidth, 26, textWidth+8, 15, 0, 0, 0, alpha*0.5f);
|
||||||
g->drawtext(XRES-16-textWidth, 30, (const char*)sampleInfo.str().c_str(), 255, 255, 255, 255*0.75);
|
g->drawtext(XRES-16-textWidth, 30, (const char*)sampleInfo.str().c_str(), 255, 255, 255, alpha*0.75f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class DrawGravOption: public QuickOption
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DrawGravOption(GameModel * m):
|
DrawGravOption(GameModel * m):
|
||||||
QuickOption("G", "Draw gravity field", m, Toggle)
|
QuickOption("G", "Draw gravity field \bg(g)", m, Toggle)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -41,7 +41,7 @@ class DecorationsOption: public QuickOption
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DecorationsOption(GameModel * m):
|
DecorationsOption(GameModel * m):
|
||||||
QuickOption("D", "Draw decorations", m, Toggle)
|
QuickOption("D", "Draw decorations \bg(ctrl+b)", m, Toggle)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ class NGravityOption: public QuickOption
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NGravityOption(GameModel * m):
|
NGravityOption(GameModel * m):
|
||||||
QuickOption("N", "Newtonian Gravity", m, Toggle)
|
QuickOption("N", "Newtonian Gravity \bg(n)", m, Toggle)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ class AHeatOption: public QuickOption
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AHeatOption(GameModel * m):
|
AHeatOption(GameModel * m):
|
||||||
QuickOption("A", "Ambient heat", m, Toggle)
|
QuickOption("A", "Ambient heat \bg(u)", m, Toggle)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ class ConsoleShowOption: public QuickOption
|
|||||||
GameController * c;
|
GameController * c;
|
||||||
public:
|
public:
|
||||||
ConsoleShowOption(GameModel * m, GameController * c_):
|
ConsoleShowOption(GameModel * m, GameController * c_):
|
||||||
QuickOption("C", "Show Console", m, Toggle)
|
QuickOption("C", "Show Console \bg(~)", m, Toggle)
|
||||||
{
|
{
|
||||||
c = c_;
|
c = c_;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,6 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
|||||||
rby = 1.0f;
|
rby = 1.0f;
|
||||||
tmp = 1.0f;
|
tmp = 1.0f;
|
||||||
}
|
}
|
||||||
float rbx1 = rbx/tmp, rby1 = rby/tmp;// scale so that the largest is 1.0
|
|
||||||
tmp = 1.0f/sqrtf(rbx*rbx+rby*rby);
|
tmp = 1.0f/sqrtf(rbx*rbx+rby*rby);
|
||||||
rbx *= tmp;// scale to a unit vector
|
rbx *= tmp;// scale to a unit vector
|
||||||
rby *= tmp;
|
rby *= tmp;
|
||||||
|
Loading…
Reference in New Issue
Block a user