Daunted by interests
I am daunted by the chores before me from my 3 interests:
Creating a complete SMB2J Disassembly (go to http://sm2.beneficii.net/ for more info), which I've been working on a lot, but it is repetitive. Thankfully, the SMB Disassembly by Doppelganger is very helpful in this disassembly.
Re-creating the SMB3 Map Editor with wxWidgets and make the code much easier to maintain and for someone to edit if they need to. Unfortunately, much of my knowledge has been lost and I have to reread my old code to figure it out.
Creating something that can allow me flexibility in drawing birds-eye view of roads, with all the changes in size (like addition/removal of a lane), with intersections, on and offramps, curving, etc., while maintaining a cross-section.
I am daunted by the amount of work it takes to engage in these activities.
I keep talking to myself negatively, like in my father's voice, about how purposeless these all are. Just hack Super Mario World and have fun with that! Lunar Magic works like perfectly with it.
The road task though now looms large in my mind.
EDIT: Made crucial adjustment.
My brain gets foggy and tired as I work late into the night on my road project. Here, I read SVG paths, with some limitations (z not supported, multiple m's not supported, and arcs not supported):
bool not_started_flag = true, last_cubic = false, last_quad = false;
for (std::size_t i = 0; i < path.Length; ++i) {
switch (static_cast<char>(path[i])) {
case 'M':
case 'm':
case 'V':
case 'v':
case 'H':
case 'h':
case 'L':
case 'l':
case 'q':
case 'Q':
case 't':
case 'T':
case 'c':
case 'C':
case 's':
case 'S':
case 'a':
case 'A':
path.insert(i + 1, " ");
}
}
wxStringTokenizer tkn(path, ", \t\r\n", wxTOKEN_STRTOK);
wxPoint2DDouble P0(0.0, 0.0);
wxPoint2DDouble P1(0.0, 0.0);
wxPoint2DDouble P2(0.0, 0.0);
wxPoint2DDouble P3(0.0, 0.0);
wxPoint2DDouble Q1(0.0, 0.0);
wxPoint2DDouble Q2(0.0, 0.0);
while (tkn.HasMoreTokens()) {
bool rel = false;
wxString get_tok = tkn.NextToken();
switch (static_cast<char>(get_tok[0])) {
case 'Z': //z not supported
case 'z':
return;
case 'M':
case 'm':
if (not_started_flag) {
not_started_flag = false;
tkn.NextToken().ToCDouble(&static_cast<double>(P0.m_x));
tkn.NextToken().ToCDouble(&static_cast<double>(P0.m_y));
}
else return; //multiple m's not supported
break;
case 'v':
rel = true;
case 'V':
P3.m_x = P0.m_x;
tkn.NextToken().ToCDouble(&static_cast<double>(P3.m_y));
if (rel) {
P3.m_y += P0.m_y;
}
P1 = P0;
P2 = P3;
fpaths.insert_line(P0, P3);
P0 = P3;
last_cubic = false;
last_quad = false;
break;
case 'h':
rel = true;
case 'H':
tkn.NextToken().ToCDouble(&static_cast<double>(P3.m_x));
P3.m_y = P0.m_y;
if (rel) {
P3.m_x += P0.m_x;
}
P1 = P0;
P2 = P3;
fpaths.insert_line(P0, P3);
P0 = P3;
last_cubic = false;
last_quad = false;
break;
case 'l':
rel = true;
case 'L':
tkn.NextToken().ToCDouble(&static_cast<double>(P3.m_x));
tkn.NextToken().ToCDouble(&static_cast<double>(P3.m_y));
if (rel) {
P3.m_x += P0.m_x;
P3.m_y += P0.m_y;
}
P1 = P0;
P2 = P3;
fpaths.insert_line(P0, P3);
P0 = P3;
last_cubic = false;
last_quad = false;
break;
case 'q':
rel = true;
case 'Q':
tkn.NextToken().ToCDouble(&static_cast<double>(Q1.m_x));
tkn.NextToken().ToCDouble(&static_cast<double>(Q1.m_y));
tkn.NextToken().ToCDouble(&static_cast<double>(Q2.m_x));
tkn.NextToken().ToCDouble(&static_cast<double>(Q2.m_y));
if (rel) {
Q1.m_x += P0.m_x;
Q1.m_y += P0.m_y;
Q2.m_x += P0.m_x;
Q2.m_y += P0.m_y;
}
//degree elevation here
P1.m_x = (P0.m_x + 2.0 * Q1.m_x) / 3.0;
P1.m_y = (P0.m_y + 2.0 * Q1.m_y) / 3.0;
P2.m_x = (2.0 * Q1.m_x + Q2.m_x) / 3.0;
P2.m_y = (2.0 * Q1.m_y + Q2.m_y) / 3.0;
P3.m_x = Q2.m_x;
P3.m_y = Q2.m_y;
fpaths.insert_path(P0, P1, P2, P3);
P0 = P3;
last_cubic = false;
last_quad = true;
break;
case 't':
rel = true;
case 'T':
if (!last_quad) return;
Q1.m_x = 2.0 * Q2.m_x - Q1.m_x;
Q1.m_y = 2.0 * Q2.m_x - Q1.m_x;
tkn.NextToken().ToCDouble(&static_cast<double>(Q2.m_x));
tkn.NextToken().ToCDouble(&static_cast<double>(Q2.m_y));
if (rel) {
Q2.m_x += P0.m_x;
Q2.m_y += P0.m_y;
}
//degree elevation here
P1.m_x = (P0.m_x + 2.0 * Q1.m_x) / 3.0;
P1.m_y = (P0.m_y + 2.0 * Q1.m_y) / 3.0;
P2.m_x = (2.0 * Q1.m_x + Q2.m_x) / 3.0;
P2.m_y = (2.0 * Q1.m_y + Q2.m_y) / 3.0;
P3.m_x = Q2.m_x;
P3.m_y = Q2.m_y;
fpaths.insert_path(P0, P1, P2, P3);
P0 = P3;
break;
case 'c':
rel = true;
case 'C':
tkn.NextToken().ToCDouble(&static_cast<double>(P1.m_x));
tkn.NextToken().ToCDouble(&static_cast<double>(P1.m_y));
tkn.NextToken().ToCDouble(&static_cast<double>(P2.m_x));
tkn.NextToken().ToCDouble(&static_cast<double>(P2.m_y));
tkn.NextToken().ToCDouble(&static_cast<double>(P3.m_x));
tkn.NextToken().ToCDouble(&static_cast<double>(P3.m_y));
if (rel) {
P1.m_x += P0.m_x;
P1.m_y += P0.m_y;
P2.m_x += P0.m_x;
P2.m_y += P0.m_y;
P3.m_x += P0.m_x;
P3.m_y += P0.m_y;
}
fpaths.insert_path(P0, P1, P2, P3);
P0 = P3;
last_cubic = true;
last_quad = false;
break;
case 's':
rel = true;
case 'S':
if (!last_cubic) return;
tkn.NextToken().ToCDouble(&static_cast<double>(P2.m_x));
tkn.NextToken().ToCDouble(&static_cast<double>(P2.m_y));
tkn.NextToken().ToCDouble(&static_cast<double>(P3.m_x));
tkn.NextToken().ToCDouble(&static_cast<double>(P3.m_y));
if (rel) {
P2.m_x += P0.m_x;
P2.m_y += P0.m_y;
P3.m_x += P0.m_x;
P3.m_y += P0.m_y;
}
fpaths.insert_path(P2, P3);
P0 = P3;
break;
default:
return; //arcs not supported
}
}
}
Whoo!
Last edited by beneficii on 07 Aug 2014, 3:27 am, edited 1 time in total.
This has cost me a lot of spoons and I'm nervous again.
Still looking at it and picking at it. This is how I get dehydrated.
My code is so error-laden, I don't even know if I can get it to work.
| Similar Topics | |
|---|---|
| Hi, new and a bit daunted |
02 Sep 2009, 1:52 pm |
| Daunted by purposelessness |
09 Aug 2014, 10:09 pm |
| Fighting your special interests (you vs. your interests) |
04 Mar 2013, 11:08 pm |
| Male interests vs female interests |
15 Aug 2015, 11:55 pm |
