Skip to content

Commit

Permalink
Merge branch 'master' into aegea
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceManiac committed Jan 21, 2025
2 parents fcaf7de + 340e79c commit 54d4656
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 30 deletions.
4 changes: 3 additions & 1 deletion docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ based on HamSandwich.

### HamSandwich (since last release)

Nothing!
* Fix SWC-only items appearing by mistake in some imported Dr. L worlds.
* Add page numbers and multi-filtering (right-click category) to Monster, Sound, and Item lists.
* Allow loading `.ogg` files as custom sounds.

### v9.4 (2024-08-10) - [Steam](https://store.steampowered.com/news/app/2547330/view/4370265995216804393)

Expand Down
1 change: 1 addition & 0 deletions source/supreme/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ TASK(byte) PlayWorld(MGLDraw *mgl,const char *fname)
InitPlayer(GetWorldProgress(fname)->levelOn,fname);
if(!LoadWorld(&curWorld,fullName))
CO_RETURN 1;
CalculateItemRenderExtents();

player.pendingLeaderboardUpload = false;
float oldPercentage = player.worldProg->percentage;
Expand Down
2 changes: 1 addition & 1 deletion source/supreme/guy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3590,7 +3590,7 @@ void Telefrag(Guy *g, bool sphinxException)
if(
!(
sphinxException &&
g->type == MONS_SPHINX &&
g->aiType == MONS_SPHINX &&
(guys[i].type == MONS_SPHXARM1 || guys[i].type == MONS_SPHXARM2)
) &&
g->CoconutBonk(xx,yy,&guys[i])
Expand Down
89 changes: 72 additions & 17 deletions source/supreme/itemedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,37 @@
#define ID_RARITY 607
#define ID_PICKSPR 608

static word flags[]={IF_SHADOW,IF_GLOW,IF_SOLID,IF_BULLETPROOF,IF_PICKUP,IF_LOONYCOLOR,IF_TILE,IF_USERJSP,IF_BUBBLES};
static dword themes[]={IT_PICKUP,IT_DECOR,IT_OBSTACLE,IT_BULLETPROOF,IT_DOOR,IT_TREE,IT_ROCK,
IT_CRATE,IT_SIGN,IT_WEAPON,IT_POWERUP,IT_KEY,IT_COLLECT,IT_FOOD,IT_ENTRANCE,
IT_CHAIR,IT_CUSTOM};
static word trigs[]={ITR_GET,ITR_SHOOT,ITR_PLAYERBUMP,ITR_ENEMYBUMP,ITR_FRIENDBUMP,ITR_CHOP,
static const dword themes[]={
IT_PICKUP,IT_DECOR,IT_OBSTACLE,IT_BULLETPROOF,IT_DOOR,IT_TREE,IT_ROCK,
IT_CRATE,IT_SIGN,IT_WEAPON,IT_POWERUP,IT_KEY,IT_COLLECT,IT_FOOD,IT_ENTRANCE,
IT_CHAIR,IT_CUSTOM};
static const char * const themeNames[] = {
"Pick-Ups",
"Decorations",
"Obstacles",
"Bulletproof",
"Doors",
"Vegetation",
"Rocks",
"Crates, Etc.",
"Signs",
"Weapons",
"Power-Ups",
"Keys",
"Collectibles",
"Food",
"Entrances",
"Chairs",
"Extras",
};
static constexpr int NUM_THEMES = std::min(std::size(themes), std::size(themeNames));

static const word flags[]={IF_SHADOW,IF_GLOW,IF_SOLID,IF_BULLETPROOF,IF_PICKUP,IF_LOONYCOLOR,IF_TILE,IF_USERJSP,IF_BUBBLES};
static const word trigs[]={ITR_GET,ITR_SHOOT,ITR_PLAYERBUMP,ITR_ENEMYBUMP,ITR_FRIENDBUMP,ITR_CHOP,
ITR_MINECART,ITR_ALWAYS};

static constexpr int ITEMS_PER_PAGE = 20;

#define IEBTN_NONE 0
#define IEBTN_NUM 1 // numerical
#define IEBTN_ITEM 2 // choose an item name
Expand Down Expand Up @@ -147,13 +171,15 @@ static const char directionName[4][16]={
static byte itemList[256];
static word itemsInList,itemStart=0,itemsShown;
static byte justPicking;
static byte mode,curTheme;
static byte mode;
static dword curTheme = IT_PICKUP;
static world_t *world;
static byte curItem;
static byte backColor;
static byte realClick;

static byte saveCurTheme=0,saveCurItem=1,rememberMode,helpRemember;
static dword saveCurTheme = IT_PICKUP;
static byte saveCurItem=1,rememberMode,helpRemember;
static word saveItemStart=0;

static byte canDrag=1;
Expand Down Expand Up @@ -272,7 +298,7 @@ static void NewClick(int id)
{
MakeNormalSound(SND_MENUSELECT);
curItem=i;
curTheme=16;
curTheme=IT_CUSTOM;
MakeItemList();
ItemSetFlags();
}
Expand All @@ -295,7 +321,7 @@ static void CopyClick(int id)
sprintf(s,"Copy of %s",GetItem(curItem)->name);
SDL_strlcpy(GetItem(i)->name, s, sizeof(GetItem(i)->name));
curItem=i;
curTheme=16;
curTheme=IT_CUSTOM;
MakeItemList();
ItemSetFlags();
}
Expand Down Expand Up @@ -367,7 +393,6 @@ static void MoreItemsClick(int id)
itemStart=0;

ClearButtons(ID_PICKITEM,ID_PICKITEM+50);
ClearButtons(ID_MOREITEMS,ID_MOREITEMS);

// now make buttons for the first N, which is however many fit on the screen
pos=100;
Expand All @@ -380,7 +405,11 @@ static void MoreItemsClick(int id)
if(pos>480-30)
break;
}
MakeButton(BTN_NORMAL,ID_MOREITEMS,0,2,pos,156,16,"More Items...",MoreItemsClick);

ClearButtons(ID_MOREITEMS, ID_MOREITEMS);
char buf[32];
ham_sprintf(buf, "More Items %d/%d", itemStart / ITEMS_PER_PAGE + 1, (itemsInList - 1) / ITEMS_PER_PAGE + 1);
MakeButton(BTN_NORMAL,ID_MOREITEMS,0,2,100 + 18 * ITEMS_PER_PAGE,156,16,buf,MoreItemsClick);
}

static void MakeItemList(void)
Expand All @@ -396,7 +425,7 @@ static void MakeItemList(void)
// get all items which match this theme
for(i=0;i<NumItems();i++)
{
if(GetItem(i)->theme&themes[curTheme])
if(GetItem(i)->theme && (GetItem(i)->theme & curTheme) == curTheme)
{
itemList[pos]=i;
itemsInList=pos+1;
Expand Down Expand Up @@ -435,15 +464,33 @@ static void MakeItemList(void)
break;
}
if(itemStart>0 || pos>480-30)
MakeButton(BTN_NORMAL,ID_MOREITEMS,0,2,pos,156,16,"More Items...",MoreItemsClick);
{
char buf[32];
ham_sprintf(buf, "More Items %d/%d", itemStart / ITEMS_PER_PAGE + 1, (itemsInList - 1) / ITEMS_PER_PAGE + 1);
MakeButton(BTN_NORMAL,ID_MOREITEMS,0,2,100+18*ITEMS_PER_PAGE,156,16,buf,MoreItemsClick);
}
}

static void SetThemeRadio()
{
for (int i = 0; i < NUM_THEMES; ++i)
SetButtonState(ID_PICKTHEME + i, (themes[i] == 0 ? curTheme == 0 : (curTheme & themes[i])) ? CHECK_ON : CHECK_OFF);
}

static void PickThemeClick(int id)
{
RadioOn(id,ID_PICKTHEME,ID_PICKTHEME+50);
curTheme=id-ID_PICKTHEME;
itemStart=0;
curTheme = themes[id-ID_PICKTHEME];
itemStart = 0;
MakeItemList();
SetThemeRadio();
}

static void PickThemeRightClick(int id)
{
curTheme ^= themes[id-ID_PICKTHEME];
itemStart = 0;
MakeItemList();
SetThemeRadio();
}

static void NameClick(int id)
Expand Down Expand Up @@ -530,7 +577,7 @@ static void ItemEditSetupButtons(void)
else
MakeButton(BTN_NORMAL,ID_EXIT,0,480,460,158,14,"Exit Item Editor",ExitClick);

RadioOn(ID_PICKTHEME+curTheme,ID_PICKTHEME,ID_PICKTHEME+50);
SetThemeRadio();
}

static void EffectClick(int id)
Expand Down Expand Up @@ -921,6 +968,9 @@ void ItemEdit_Update(int mouseX,int mouseY,MGLDraw *mgl)
CheckButtonCallback(mouseX,mouseY,ID_ITEMEFFMOD,EffModRightClick);
if(!(GetItem(curItem)->flags&IF_TILE))
CheckButtonCallback(mouseX,mouseY,ID_PICKSPR,SpriteRightClick);

for(i = 0; i < NUM_THEMES; ++i)
CheckButtonCallback(mouseX, mouseY, ID_PICKTHEME + i, PickThemeRightClick);
}

wasInRect=0;
Expand Down Expand Up @@ -968,7 +1018,12 @@ void ItemEdit_Update(int mouseX,int mouseY,MGLDraw *mgl)
}
CheckButton(mouseX,mouseY,ID_EXIT);
CheckButton(mouseX,mouseY,ID_MOREITEMS);
}

if (mgl->RMouseTap())
{
for(i = 0; i < NUM_THEMES; ++i)
CheckButtonCallback(mouseX, mouseY, ID_PICKTHEME + i, PickThemeRightClick);
}
break;
case IMODE_NAME:
Expand Down
8 changes: 8 additions & 0 deletions source/supreme/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ void MonsterDraw(

v=monsType[type].anim[seq][frm];

// Suckers and Blowers are visible in the editor.
if (type >= MONS_SUCKER1 && type <= MONS_BLOWER4 && editing && seq == ANIM_IDLE && frm == 0)
v = 0;

if(v==FRAME_INVIS || v==FRAME_END)
return; // don't draw this frame

Expand Down Expand Up @@ -358,6 +362,10 @@ void InstaRenderMonster(int x,int y,dword type,char bright,MGLDraw *mgl)
if(!(monsType[type].flags&MF_ONEFACE))
v+=2*monsType[type].framesPerDir;

// Suckers and Blowers are visible in the editor.
if (type >= MONS_SUCKER1 && type <= MONS_BLOWER4 && editing /* seq == ANIM_IDLE && frame == 0 are implied */)
v = 0;

curSpr=monsType[type].spr->GetSprite(v);
if(!curSpr)
return;
Expand Down
16 changes: 8 additions & 8 deletions source/supreme/monsterlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2412,7 +2412,7 @@ monsterType_t monsType[NUM_MONSTERS]=
18,2,30,300,"!66",0,MF_NOSHADOW|MF_ONEFACE|MF_NOMOVE|MF_NOHIT|MF_INVINCIBLE|MF_ENEMYWALK|MF_FREEWALK,
MT_EVIL|MT_TRAP,
{
{0,254,254,255}, // idle
{254,254,254,255}, // idle
{254,254,254,255}, // move
{254,254,254,255}, // attack
{254,255}, // die
Expand All @@ -2426,7 +2426,7 @@ monsterType_t monsType[NUM_MONSTERS]=
18,2,30,300,"!66",0,MF_NOSHADOW|MF_ONEFACE|MF_NOMOVE|MF_NOHIT|MF_INVINCIBLE|MF_ENEMYWALK|MF_FREEWALK,
MT_EVIL|MT_TRAP,
{
{0,254,254,255}, // idle
{254,254,254,255}, // idle
{254,254,254,255}, // move
{254,254,254,255}, // attack
{254,255}, // die
Expand All @@ -2440,7 +2440,7 @@ monsterType_t monsType[NUM_MONSTERS]=
18,2,30,300,"!66",0,MF_NOSHADOW|MF_ONEFACE|MF_NOMOVE|MF_NOHIT|MF_INVINCIBLE|MF_ENEMYWALK|MF_FREEWALK,
MT_EVIL|MT_TRAP,
{
{0,254,254,255}, // idle
{254,254,254,255}, // idle
{254,254,254,255}, // move
{254,254,254,255}, // attack
{254,255}, // die
Expand All @@ -2454,7 +2454,7 @@ monsterType_t monsType[NUM_MONSTERS]=
18,2,30,300,"!66",0,MF_NOSHADOW|MF_ONEFACE|MF_NOMOVE|MF_NOHIT|MF_INVINCIBLE|MF_ENEMYWALK|MF_FREEWALK,
MT_EVIL|MT_TRAP,
{
{0,254,254,255}, // idle
{254,254,254,255}, // idle
{254,254,254,255}, // move
{254,254,254,255}, // attack
{254,255}, // die
Expand All @@ -2468,7 +2468,7 @@ monsterType_t monsType[NUM_MONSTERS]=
18,2,30,300,"!66",0,MF_NOSHADOW|MF_ONEFACE|MF_NOMOVE|MF_NOHIT|MF_INVINCIBLE|MF_ENEMYWALK|MF_FREEWALK,
MT_EVIL|MT_TRAP,
{
{0,254,254,255}, // idle
{254,254,254,255}, // idle
{254,254,254,255}, // move
{254,254,254,255}, // attack
{254,255}, // die
Expand All @@ -2482,7 +2482,7 @@ monsterType_t monsType[NUM_MONSTERS]=
18,2,30,300,"!66",0,MF_NOSHADOW|MF_ONEFACE|MF_NOMOVE|MF_NOHIT|MF_INVINCIBLE|MF_ENEMYWALK|MF_FREEWALK,
MT_EVIL|MT_TRAP,
{
{0,254,254,255}, // idle
{254,254,254,255}, // idle
{254,254,254,255}, // move
{254,254,254,255}, // attack
{254,255}, // die
Expand All @@ -2496,7 +2496,7 @@ monsterType_t monsType[NUM_MONSTERS]=
18,2,30,300,"!66",0,MF_NOSHADOW|MF_ONEFACE|MF_NOMOVE|MF_NOHIT|MF_INVINCIBLE|MF_ENEMYWALK|MF_FREEWALK,
MT_EVIL|MT_TRAP,
{
{0,254,254,255}, // idle
{254,254,254,255}, // idle
{254,254,254,255}, // move
{254,254,254,255}, // attack
{254,255}, // die
Expand All @@ -2510,7 +2510,7 @@ monsterType_t monsType[NUM_MONSTERS]=
18,2,30,300,"!66",0,MF_NOSHADOW|MF_ONEFACE|MF_NOMOVE|MF_NOHIT|MF_INVINCIBLE|MF_ENEMYWALK|MF_FREEWALK,
MT_EVIL|MT_TRAP,
{
{0,254,254,255}, // idle
{254,254,254,255}, // idle
{254,254,254,255}, // move
{254,254,254,255}, // attack
{254,255}, // die
Expand Down
6 changes: 3 additions & 3 deletions source/supreme/soundedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static const dword themes[] = {
ST_VOCAL,
ST_CUSTOM,
};
static const char *themeNames[] = {
static const char * const themeNames[] = {
"All Sounds",
"Interface Sounds",
"Player Sounds",
Expand Down Expand Up @@ -160,7 +160,7 @@ static void MoreSoundsClick(int id)

ClearButtons(ID_MORESNDS,ID_MORESNDS);
char buf[32];
ham_sprintf(buf, "More Sounds (%d/%d)", sndStart / SOUNDS_PER_PAGE + 1, (sndsInList - 1) / SOUNDS_PER_PAGE + 1);
ham_sprintf(buf, "More Sounds %d/%d", sndStart / SOUNDS_PER_PAGE + 1, (sndsInList - 1) / SOUNDS_PER_PAGE + 1);
MakeButton(BTN_NORMAL,ID_MORESNDS,0,481,456,156,16,buf,MoreSoundsClick);
}

Expand Down Expand Up @@ -213,7 +213,7 @@ static void MakeSoundList(void)
if(x>640-160 && y>480-30)
{
char buf[32];
ham_sprintf(buf, "More Sounds (%d/%d)", sndStart / SOUNDS_PER_PAGE + 1, (sndsInList - 1) / SOUNDS_PER_PAGE + 1);
ham_sprintf(buf, "More Sounds %d/%d", sndStart / SOUNDS_PER_PAGE + 1, (sndsInList - 1) / SOUNDS_PER_PAGE + 1);
MakeButton(BTN_NORMAL,ID_MORESNDS,0,481,456,156,16,buf,MoreSoundsClick);
break;
}
Expand Down
1 change: 1 addition & 0 deletions tools/windows-cross/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set(CMAKE_C_COMPILER_TARGET i686-pc-windows-msvc)
set(CMAKE_CXX_COMPILER_TARGET ${CMAKE_C_COMPILER_TARGET})
set(CMAKE_C_FLAGS_INIT "-fms-compatibility /imsvc/xwin/crt/include /imsvc/xwin/sdk/include/ucrt /imsvc/xwin/sdk/include/um /imsvc/xwin/sdk/include/shared")
set(CMAKE_CXX_FLAGS_INIT ${CMAKE_C_FLAGS_INIT})
set(CMAKE_RC_FLAGS_INIT ${CMAKE_C_FLAGS_INIT})
set(CMAKE_LINKER lld-link)
set(CMAKE_MT llvm-mt) # CMake can find rc=llvm-rc all by itself, but needs to be told mt=llvm-mt
set(CMAKE_RC_FLAGS_INIT "-I/xwin/crt/include -I/xwin/sdk/include/ucrt -I/xwin/sdk/include/um -I/xwin/sdk/include/shared")
Expand Down

0 comments on commit 54d4656

Please sign in to comment.