Skip to content

Commit

Permalink
More messing around with the level editor, changed windowmanager icon.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy Christensen committed Jun 8, 2012
1 parent c45835e commit 990a6e4
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 18 deletions.
Binary file modified data/wmicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 21 additions & 17 deletions leveleditor.c
Expand Up @@ -113,13 +113,13 @@ void editorRemoveBrickUnderCursor()
{ {
free(pf.board[cur.x][cur.y]); free(pf.board[cur.x][cur.y]);
pf.board[cur.x][cur.y]=0; pf.board[cur.x][cur.y]=0;
changed=1;
} }


//teleport? //teleport?
teleRemoveFromList(pf.levelInfo->teleList,cur.x,cur.y); teleRemoveFromList(pf.levelInfo->teleList,cur.x,cur.y);


boardSetWalls(&pf); boardSetWalls(&pf);
changed=1;
} }




Expand Down Expand Up @@ -196,19 +196,22 @@ int runEditor(SDL_Surface* screen)
selBrick=NUMTILES; selBrick=NUMTILES;
} }


if( (getButton(C_BTNX) || isPointerClicked() ) && selBrick != RESERVED ) if( (getButton(C_BTNX) || getInpPointerState()->isDown ) && selBrick != RESERVED )
{ {
resetBtn(C_BTNX); //resetBtn(C_BTNX);
resetMouseBtn(); //resetMouseBtn();


//If it's empty and we are not placing a teledestination, remove brick at cursor //We remove the brick under the cursor if it's not a teleport, or if it is and we are placing a teleport source.
if(pf.board[cur.x][cur.y] && !(selBrick==TELESRC && teleState!=0) ) if( (!telePresent(pf.levelInfo->teleList, cur.x, cur.y ) && selBrick!=TELESRC) || (selBrick==TELESRC && telePresent(pf.levelInfo->teleList, cur.x, cur.y ) && teleState==0 ) )
{ {
editorRemoveBrickUnderCursor(); editorRemoveBrickUnderCursor();
} }


if(selBrick==TELESRC) if(selBrick==TELESRC)
{ {
resetMouseBtn();
resetBtn(C_BTNX);

if(teleState==0) if(teleState==0)
{ {
//Save source pos //Save source pos
Expand All @@ -234,22 +237,23 @@ int runEditor(SDL_Surface* screen)


if( getButton(C_BTNY) ) if( getButton(C_BTNY) )
{ {
resetBtn(C_BTNY); //If we are trying to remove an empty teleport

if(telePresent(pf.levelInfo->teleList, cur.x, cur.y) && selBrick!=TELESRC)
if(selBrick!=RESERVED)
{ {
editorPickBrickUnderCursor(); resetBtn(C_BTNY);
selBrick=TELESRC;
} else {
if(selBrick!=RESERVED)
{
editorPickBrickUnderCursor();
}
editorRemoveBrickUnderCursor();
} }
editorRemoveBrickUnderCursor();
} }


if( isPointerClicked() ) if( getInpPointerState()->isDown && selBrick==RESERVED )
{ {
resetMouseBtn(); editorRemoveBrickUnderCursor();
if(selBrick==RESERVED)
{
editorRemoveBrickUnderCursor();
}
} }


if(getButton(C_BTNSELECT)) if(getButton(C_BTNSELECT))
Expand Down
1 change: 1 addition & 0 deletions pointer.h
Expand Up @@ -36,6 +36,7 @@ inline inpPointerState_t* getInpPointerState();


int_fast8_t isPointerClicked(); //This does not take into account if the pointer actually hit anything int_fast8_t isPointerClicked(); //This does not take into account if the pointer actually hit anything
int_fast8_t isAnyBoxHit(); //This will return true if any of the calls to isBoxClicked did this tick. int_fast8_t isAnyBoxHit(); //This will return true if any of the calls to isBoxClicked did this tick.
int_fast8_t isPointerInBox( SDL_Rect* r );
int_fast8_t isBoxClicked( SDL_Rect* r ); int_fast8_t isBoxClicked( SDL_Rect* r );


int_fast8_t isPointerEscapeClicked(); //Returns 1 if the "escbox" was hit and escEnable=1; int_fast8_t isPointerEscapeClicked(); //Returns 1 if the "escbox" was hit and escEnable=1;
Expand Down
15 changes: 15 additions & 0 deletions teleport.c
Expand Up @@ -107,3 +107,18 @@ char* teleMkStrings(listItem* l)


return(str); return(str);
} }

int_fast8_t telePresent( listItem* l, int sx,int sy)
{
listItem* it = l;
telePort_t* t;
while( (it=it->next) )
{
t = (telePort_t*)it->data;
if( t->sx==sx && t->sy==sy)
{
return(1);
}
}
return(0);
}
3 changes: 2 additions & 1 deletion teleport.h
Expand Up @@ -31,6 +31,7 @@ void teleFreeList( listItem* l );
void teleAddToList( listItem* l, int sx, int sy, int dx, int dy ); void teleAddToList( listItem* l, int sx, int sy, int dx, int dy );
void teleRemoveFromList( listItem* l, int sx, int sy ); void teleRemoveFromList( listItem* l, int sx, int sy );
void teleAddFromString(listItem* l, const char* str); //Expects a string in the format sx,sy:dx,dy void teleAddFromString(listItem* l, const char* str); //Expects a string in the format sx,sy:dx,dy
char* teleMkStrings(listItem* l); char* teleMkStrings(listItem* l);
int_fast8_t telePresent( listItem* l, int sx,int sy);


#endif // TELEPORT_H_INCLUDED #endif // TELEPORT_H_INCLUDED
Binary file removed tools/releaser/data/lin/prgicon.png
Binary file not shown.

0 comments on commit 990a6e4

Please sign in to comment.