Tuesday, January 27, 2015

WARNING!

From benign phenomena and whimpy errors to deadly crashes, the pitfalls of Danmakufu make it far from the safest place in Gensokyo. Heed the messages of these signs to prevent yourself from being hurt.










Want to make your own? Use this image!

Sunday, January 25, 2015

WTF Danmakufu

Drag the image to your tab bar (who the heck is still using a browser without tabs?!) to see it full-size. Beware; my monitor is huge.

Needless to say, the fix was to move the event body into a separate task.

Saturday, January 24, 2015

Crash!

I was testing out Nightmare of Torrential Precipitation after some changes.

I got the title, screen, and tried to start a game. Danmakufu didn't even freeze; it just gave up. No error message, and nothing in the log.

I knew it wasn't forgetting to yield. It's something else, like mistakenly using index for a variable name. I opened up Git Bash, and grepped to try to search for such cases. Didn't see anything unusual about that.

It might be a buffer overflow since the scripts might be too long due to large files included. I created a test script that defined a long string of Yukari. Worked fine, even if I tried to print it in the log.

Okay. What might it be? I looked at the log file, and saw that Danmakufu did load the background and the digit graphic, but nothing after those two. I also noted that I changed the TPIV task to exit when the hidden mode was activated.

I put a WriteLog call both before and after the main part of the definition:


task TPIV {
 WriteLog("Zenki");
 if (isHidden) {return;}
 let objScore = ObjText_Create();
 ObjText_SetText(objScore, "SEeS");
 ObjText_SetFontSize(objScore, 20);
 ObjText_SetFontBold(objScore, true);
 ObjText_SetFontColorTop(objScore, 200, 200, 255);
 ObjText_SetFontColorBottom(objScore, 255, 255, 255);
 ObjText_SetFontBorderType(objScore, BORDER_FULL);
 ObjText_SetFontBorderColor(objScore, 0, 0, 0);
 ObjText_SetFontBorderWidth(objScore, 1);
 ObjText_SetFontType(objScore, typeface);
 Obj_SetRenderPriority(objScore, 0.01);
 ObjRender_SetX(objScore, 428);
 ObjRender_SetY(objScore, 254);
 let objNum = createNumberObject(496, 254);
 WriteLog("Goki");
 loop {
  ObjSpriteList2D_ClearVertexCount(objNum);
  updateNumber(objNum, getPIV, 8, 1);
  yield;
 }
}

And Zenki showed up. No Goki, though. I tried the same, just around the conditional return, and the same result. It must be with the isHidden function!

function isHidden {
 GetAreaCommonData("Replay", "Hidden", false);
}

Wait, no return? Let's change that:

function isHidden {
 return GetAreaCommonData("Replay", "Hidden", false);
}

And thus the script didn't crash.