Permalink
Browse files

WINTERMUTE: Fixed code formatting - spaces, braces, etc

  • Loading branch information...
lolbot-iichan committed Aug 28, 2018
1 parent 395de38 commit b95615604b0f4b296036b93fb043da97748aa07e
@@ -917,7 +917,7 @@ void AdActor::getNextStep() {

//////////////////////////////////////////////////////////////////////////
void AdActor::initLine(const BasePoint &startPt, const BasePoint &endPt) {
_pFCount = MAX((abs(endPt.x - startPt.x)) , (abs(endPt.y - startPt.y)));
_pFCount = MAX((abs(endPt.x - startPt.x)), (abs(endPt.y - startPt.y)));

_pFStepX = (double)(endPt.x - startPt.x) / _pFCount;
_pFStepY = (double)(endPt.y - startPt.y) / _pFCount;
@@ -1049,12 +1049,12 @@ bool AdActor::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack,
else if (strcmp(name, "SetSpeedWalkAnim") == 0) {
stack->correctParams(1);
int speedWalk = stack->pop()->getInt();
for(uint32 dir = 0; dir < NUM_DIRECTIONS; dir++) {
for (uint32 dir = 0; dir < NUM_DIRECTIONS; dir++) {
AdSpriteSet *anim = getAnimByName(_walkAnimName);
if (anim != nullptr) {
BaseSprite *item = anim->getSprite((TDirection)dir);
if (item != nullptr) {
for(uint32 i = 0; i < item->_frames.size(); i++) {
for (uint32 i = 0; i < item->_frames.size(); i++) {
BaseFrame *frame = item->_frames[i];
if (frame != nullptr) {
frame->_delay = speedWalk;
@@ -1367,31 +1367,31 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
else if (strcmp(name, "GetSaveSlotDescriptionTimestamp") == 0) {
stack->correctParams(1);
int slot = stack->pop()->getInt();

char desc[512];
desc[0] = '\0';
SaveLoad::getSaveSlotDescription(slot, desc);
stack->pushString(desc);

TimeDate time;
SaveLoad::getSaveSlotTimestamp(slot, &time);
stack->pushInt(time.tm_sec);
stack->pushInt(time.tm_min);
stack->pushInt(time.tm_hour);
stack->pushInt(time.tm_mday);
stack->pushInt(time.tm_mon+1);
stack->pushInt(time.tm_year+1900);
stack->pushInt(time.tm_mon + 1);
stack->pushInt(time.tm_year + 1900);
stack->pushInt(6);
BaseScriptable* date = makeSXDate(_gameRef, stack);
BaseScriptable *date = makeSXDate(_gameRef, stack);
stack->pushNative(date, false);

stack->pushInt(0);
BaseScriptable* obj = makeSXObject(_gameRef, stack);
BaseScriptable *obj = makeSXObject(_gameRef, stack);
obj->scSetProperty("Timestamp", stack->pop());
obj->scSetProperty("Description", stack->pop());

stack->pushNative(obj, false);

return STATUS_OK;
}
#endif
@@ -2003,10 +2003,10 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
//////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "GetDesktopDisplayMode") == 0) {
stack->correctParams(0);
stack->pushInt(2*240+1);
stack->pushInt(2*320+1);
stack->pushInt(2 * 240 + 1);
stack->pushInt(2 * 320 + 1);
stack->pushInt(0);
BaseScriptable* obj = makeSXObject(_gameRef, stack);
BaseScriptable *obj = makeSXObject(_gameRef, stack);
obj->scSetProperty("w", stack->pop());
obj->scSetProperty("h", stack->pop());
stack->pushNative(obj, false);
@@ -2442,18 +2442,18 @@ ScValue *BaseGame::scGetProperty(const Common::String &name) {
//////////////////////////////////////////////////////////////////////////
else if (name == "SystemLanguage") {
switch (Common::parseLanguage(ConfMan.get("language"))) {
case Common::DE_DEU:
_scValue->setString("german");
break;
case Common::RU_RUS:
_scValue->setString("russian");
break;
case Common::UA_UKR:
_scValue->setString("ukrainian");
break;
default:
_scValue->setString("english");
break;
case Common::DE_DEU:
_scValue->setString("german");
break;
case Common::RU_RUS:
_scValue->setString("russian");
break;
case Common::UA_UKR:
_scValue->setString("ukrainian");
break;
default:
_scValue->setString("english");
break;
}
return _scValue;
}
@@ -3161,20 +3161,18 @@ bool BaseGame::externalCall(ScScript *script, ScStack *stack, ScStack *thisStack
// There is no way to makeSXArray() with exactly 1 given element
// That's why we are creating empty Array and SXArray::push() later
stack->pushInt(0);
BaseScriptable* arr = makeSXArray(_gameRef, stack);
BaseScriptable *arr = makeSXArray(_gameRef, stack);

// Iterating string copy, replacing delimeter with '\0' and pushing matches
char * copy = new char[size];
strcpy(copy,str);
char * begin = copy;
for(char * it = copy; it < copy + size ; it++)
{
if(*it == sep || *it == '\0')
{
char *copy = new char[size];
strcpy(copy, str);
char *begin = copy;
for (char *it = copy; it < copy + size; it++) {
if (*it == sep || *it == '\0') {
*it = '\0';
stack->pushString(begin);
((SXArray*)arr)->push(stack->pop());
begin = it+1;
((SXArray *)arr)->push(stack->pop());
begin = it + 1;
}
}

@@ -473,7 +473,7 @@ bool BaseSubFrame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisS
int y = stack->pop()->getInt();
byte r, g, b, a;
if (_surface && _surface->getPixel(x, y, &r, &g, &b, &a)) {
uint32 pixel = BYTETORGBA(r,g,b,a);
uint32 pixel = BYTETORGBA(r, g, b, a);
stack->pushInt(pixel);
} else {
stack->pushNULL();
@@ -274,8 +274,7 @@ uint32 BaseSurfaceOSystem::getPixelAt(Graphics::Surface *surface, int x, int y)
}

//////////////////////////////////////////////////////////////////////////
bool BaseSurfaceOSystem::getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a)
{
bool BaseSurfaceOSystem::getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a) {
uint32 pixel = getPixelAt(_surface, x, y);
*r = (pixel >> 24) & 255;
*g = (pixel >> 16) & 255;
@@ -200,7 +200,7 @@ bool SaveLoad::getSaveSlotTimestamp(int slot, TimeDate *time) {
return false;
}

const TimeDate* timestamp = &(pm->_savedTimestamp);
const TimeDate *timestamp = &(pm->_savedTimestamp);
memcpy(time, timestamp, sizeof(TimeDate));
delete pm;

@@ -621,7 +621,7 @@ bool ScScript::executeInstruction() {
}
}
#ifdef ENABLE_FOXTAIL
else if (BaseEngine::instance().getGameId() == "foxtail" && !strcmp(methodName,"LoadItems")) {
else if (BaseEngine::instance().getGameId() == "foxtail" && !strcmp(methodName, "LoadItems")) {
// somehow FoxTail works just fine without LoadItems method
// let's just suppress error for now...
}
@@ -128,17 +128,16 @@ bool SXArray::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack,
int shiftPoint = stack->pop()->getInt(0);
char paramNameFrom[20];
char paramNameTo[20];

for (int i = shiftPoint; i < _length-1 ; i++ )
{
sprintf(paramNameFrom, "%d", i+1);

for (int i = shiftPoint; i < _length - 1 ; i++) {
sprintf(paramNameFrom, "%d", i + 1);
sprintf(paramNameTo, "%d", i);
_values->setProp(paramNameTo, _values->getProp(paramNameFrom), false);
}
_values->deleteProp(paramNameFrom);
_length--;
stack->pushNULL();

return STATUS_OK;
}
#endif

0 comments on commit b956156

Please sign in to comment.