Skip to content

Commit 8c439e2

Browse files
authored
Bug fix: triggers
1 parent f6bec6b commit 8c439e2

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

ColorizingDMD.cpp

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3418,6 +3418,7 @@ bool Load_cRom(char* name)
34183418
fseek(pfile, MycRom.nFrames, SEEK_CUR); // we skip the active frame content
34193419
memset(MycRom.ColorRotations, 255, 3 * MAX_COLOR_ROTATION * MycRom.nFrames);
34203420
memset(MycRom.SpriteDetAreas, 255, sizeof(UINT16) * 4 * MAX_SPRITE_DETECT_AREAS * MycRom.nSprites);
3421+
memset(MycRom.TriggerID, 0xff, sizeof(UINT32) * MycRom.nFrames);
34213422
if (lengthheader >= 9 * sizeof(UINT))
34223423
{
34233424
fread(MycRom.ColorRotations, 1, 3 * MAX_COLOR_ROTATION * MycRom.nFrames, pfile);
@@ -3430,7 +3431,7 @@ bool Load_cRom(char* name)
34303431
{
34313432
fread(MycRom.TriggerID, sizeof(UINT32), MycRom.nFrames, pfile);
34323433
}
3433-
else memset(MycRom.TriggerID, 0xff, sizeof(UINT32) * MycRom.nFrames);
3434+
memset(MycRom.TriggerID, 0xff, sizeof(UINT32) * MycRom.nFrames);
34343435
}
34353436
}
34363437
fclose(pfile);
@@ -6456,6 +6457,7 @@ INT_PTR CALLBACK Toolbar_Proc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
64566457
{
64576458
char tbuf[256];
64586459
GetWindowTextA((HWND)lParam, tbuf, 256);
6460+
if (strcmp(tbuf, "- None -") == 0) return TRUE;
64596461
int tID = atoi(tbuf);
64606462
if (tID < 0)
64616463
{
@@ -7386,27 +7388,35 @@ void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
73867388
return;
73877389
}
73887390
else
7389-
{ // we select all the pixels with the same color as the one clicked!
7391+
{
73907392
if (MycRom.DynaMasks[acFrame * MycRom.fWidth * MycRom.fHeight + ygrid * MycRom.fWidth + xgrid] != 255)
73917393
{
73927394
MessageBoxA(hWnd, "The pixel you clicked is dynamically colored, this function works only for static content.", "Improper use", MB_OK);
73937395
return;
73947396
}
7395-
SaveAction(true, SA_COPYMASK);
7396-
if (mods & GLFW_MOD_SHIFT) isDel_Mode = true;
7397-
Mouse_Mode = 7;
7398-
UINT8 col_to_find = MycRom.cFrames[acFrame * MycRom.fWidth * MycRom.fHeight + ygrid * MycRom.fWidth + xgrid];
7399-
for (UINT ti = 0; ti < MycRom.fWidth * MycRom.fHeight; ti++)
7397+
if (mods & GLFW_MOD_CONTROL)
74007398
{
7401-
if (MycRom.cFrames[acFrame * MycRom.fWidth * MycRom.fHeight + ti] == col_to_find)
7399+
// we select all the pixels with the same color as the one clicked!
7400+
SaveAction(true, SA_COPYMASK);
7401+
if (mods & GLFW_MOD_SHIFT) isDel_Mode = true;
7402+
Mouse_Mode = 7;
7403+
UINT8 col_to_find = MycRom.cFrames[acFrame * MycRom.fWidth * MycRom.fHeight + ygrid * MycRom.fWidth + xgrid];
7404+
for (UINT ti = 0; ti < MycRom.fWidth * MycRom.fHeight; ti++)
74027405
{
7403-
if (MycRom.DynaMasks[acFrame * MycRom.fWidth * MycRom.fHeight + ti] != 255) continue;
7404-
if (!isDel_Mode) Copy_Mask[ti] = 1;
7405-
else Copy_Mask[ti] = 0;
7406-
Copy_Col[ti] = MycRom.cFrames[acFrame * MycRom.fWidth * MycRom.fHeight + ti];
7407-
Copy_Colo[ti] = MycRP.oFrames[acFrame * MycRom.fWidth * MycRom.fHeight + ti];
7408-
Copy_Dyna[ti] = MycRom.DynaMasks[acFrame * MycRom.fWidth * MycRom.fHeight + ti];
7406+
if (MycRom.cFrames[acFrame * MycRom.fWidth * MycRom.fHeight + ti] == col_to_find)
7407+
{
7408+
if (MycRom.DynaMasks[acFrame * MycRom.fWidth * MycRom.fHeight + ti] != 255) continue;
7409+
if (!isDel_Mode) Copy_Mask[ti] = 1;
7410+
else Copy_Mask[ti] = 0;
7411+
Copy_Col[ti] = MycRom.cFrames[acFrame * MycRom.fWidth * MycRom.fHeight + ti];
7412+
Copy_Colo[ti] = MycRP.oFrames[acFrame * MycRom.fWidth * MycRom.fHeight + ti];
7413+
Copy_Dyna[ti] = MycRom.DynaMasks[acFrame * MycRom.fWidth * MycRom.fHeight + ti];
7414+
}
74097415
}
7416+
}
7417+
else
7418+
{
7419+
74107420
}
74117421
return;
74127422
}

0 commit comments

Comments
 (0)