Esempio n. 1
0
void interpolate(fixed alpha)
{
    static fixed prev_time = 0;
    static float prev_render_x;
    static fixed warning_time = 0;
    fixed current_time = get_time();
    float alphaf = 0.0f;

    if (fabs(current.x - previous.x) > 50.0f)
    {
        trace("Difference too great (%f, %f), not interpolating", current.x, previous.x);
        prev_time = current_time;
        prev_render_x = render_state.x;
        return;
    }

    if (prev_time == 0)
        prev_time = current_time;

    alphaf = fptof(alpha);
	render_state.x = current.x*alphaf + previous.x*(1.0f-alphaf);
	render_state.v = current.v*alphaf + previous.v*(1.0f-alphaf);

    // good
    trace("[%ld] Alpha: %3.2f actual: %3.2f render: %3.2f a/r diff: %3.2f", current_time - prev_time, alphaf, current.x - previous.x, render_state.x - prev_render_x, current.x - render_state.x);

    prev_time = current_time;
    prev_render_x = render_state.x;
}
Esempio n. 2
0
void write_news(  )
{
    FILE                   *fpout;
    NEWS_DATA              *news;

    if ( ( fpout = FileOpen( NEWS_FILE, "w" ) ) == NULL ) {
        bug( "Cannot open news.dat for writing." );
        perror( NEWS_FILE );
        return;
    }

    fptof( fpout, "#HTML\n" );
    fprintf( fpout, "%d\n\n", USE_HTML_NEWS == TRUE ? 1 : 0 );
    for ( news = first_news; news != NULL; news = news->next ) {
        fptof( fpout, "#News\n" );
        fprintf( fpout, "TimeStamp %ld\n", news->time_stamp > 0 ? news->time_stamp : -1 );
        fprintf( fpout, "NewsData  %s~\n", strip_cr( news->data ) );
        fptof( fpout, "End\n\n" );
    }
    fptof( fpout, "#End\n" );

    FileClose( fpout );
}
Esempio n. 3
0
void generate_html_news(  )
{
    FILE                   *fpout;
    NEWS_DATA              *news;

    if ( ( fpout = FileOpen( HTML_NEWS_FILE, "w" ) ) == NULL ) {
        bug( "Cannot open %s for writing.", HTML_NEWS_FILE );
        perror( HTML_NEWS_FILE );
        return;
    }
    fptof( fpout, "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//ES\"\n" );
    fptof( fpout, "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" );
    fptof( fpout, "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" );
    fptof( fpout, "  <head>\n" );
    fprintf( fpout, "    <title>Noticias de %s</title>\n", sysdata.mud_name );
//    fprintf( fpout, "<link rel="shortcut icon" href=\"http://6d.genesismuds.com/img/tab.ico" type="image/icon"> <link rel="icon" href=\"http://6d.genesismuds.com/img/tab.ico" type="image/icon">" );

    fptof( fpout,
           "<meta name=\"description\" content=\"¿Qué es 6Dragones? 6 Dragones es un MUd. Es un juego de rol en modo texto en el cual podrás crear un personaje e interactuar con otros jugadores en un mundo mediaval.\"/>\n" );
    fptof( fpout,
           "<meta name=\"keywords\" content=\"dragon, harry potter, medieval, wow, eq, mmorpg, free, game, mud, smaug\" />\n" );
    fptof( fpout,
           "<link rel=\"stylesheet\" type=\"text/css\" href=\"http://6dragones.genesismuds.com/style.css\" media=\"screen\"/>\n" );
    fptof( fpout, "<style type=\"text/css\">\n" );
    fptof( fpout, "/*<![CDATA[*/\n" );
    fptof( fpout, "div.c2 {text-align: center}\n" );
    fptof( fpout, "div.c1 {margin-left: 0%;text-align: left}\n" );
    fptof( fpout, "/*]]>*/\n" );
    fptof( fpout, "</style>\n" );
    fptof( fpout, "</head>\n" );
    fptof( fpout, "<body>\n" );
    fptof( fpout, "<div class=\"c2\" id=\"wrapper\">\n" );
    fptof( fpout, "<div id=\"container\">\n" );
    fptof( fpout, "<div class=\"header\"></div>\n" );
    fptof( fpout,
           "<div class=\"navigation\"><table cellspacing=\"0\" cellpadding=\"0%\"><tr><th><a href=\"http://6d.genesismuds.com/index.html\">Home</a></th> <th><a href=\"http://www.mudportal.com/play?host=6D.genesismuds.com&port=4100\">Play</a></th><th> <a href=\"http://6D.genesismuds.com/bin/vote.html\">Vote</a> </th><th><a href=\"http://6D.genesismuds.com/bin/staff.html\">Staff</a></th><th> <a href=\"http://6D.genesismuds.com/bin/races.html\">Races</a> </th><th><a href=\"http://6D.genesismuds.com/bin/classes.html\">Classes</a> </th><th> <a href=\"http://6D.genesismuds.com/bin/guide.html\">Guide</a> </th><th><a href=\"http://6D.genesismuds.com/news.html\">News</a></th><th> <a href=\"http://6D.genesismuds.com/bin/story.html\">Story</a></th><th><th><a href=\"http://6D.genesismuds.com/bin/wild.html\">Wilderness</a></th></tr></table>\n" );
    fptof( fpout, "</div>\n" );
    fptof( fpout, "\n<div class=\"c1\" id=\"wrapper\">\n" );
    fptof( fpout, "\n<p>\n\n\n\n" );

    fptof( fpout, "        <table width=\"90%\" border=\"0\" align=\"CENTER\">\n" );

    for ( news = first_news; news != NULL; news = news->next ) {
        /*
         * Day, Month, and Year in their raw form.
         */
        char                    day[MAX_NEWS_LENGTH];
        char                    month[MAX_NEWS_LENGTH];
        char                    year[MAX_NEWS_LENGTH];

        /*
         * Day, Month and Year after formatted for HTML.
         */
        char                    mon_buf[MAX_NEWS_LENGTH];
        char                    day_buf[MAX_NEWS_LENGTH];
        char                    year_buf[MAX_NEWS_LENGTH];

        /*
         * Date separator after formatted for HTML.
         */
        char                    sep_buf[MAX_NEWS_LENGTH];

        /*
         * Date and News after completely formatted and ready for HTML export.
         */
        char                    date_buf[MAX_NEWS_LENGTH];
        char                    news_data_buf[MAX_NEWS_LENGTH];

        sprintf( day, "%2.2d", news->day );
        sprintf( month, "%2.2d", news->month );
        sprintf( year, "%4.4d", news->year );
        sprintf( mon_buf, "%s", month );
        sprintf( day_buf, "%s", day );
        sprintf( year_buf, "%s", year );
        sprintf( sep_buf, "%s", "/" );

        sprintf( date_buf, "%s%s%s%s%s", mon_buf, sep_buf, day_buf, sep_buf, year_buf );
        sprintf( news_data_buf, "%s", news->data );
        fptof( fpout, "          <tr>\n" );

        fptof( fpout, "            <td width=\"20%\" valign=\"TOP\">\n" );
        fprintf( fpout, "%s\n", date_buf );
        fptof( fpout, "            </td>\n" );

        fptof( fpout, "            <td width=\"80%\" valign=\"TOP\">\n" );
        fprintf( fpout, "%s\n", news_data_buf );

        fptof( fpout, "            </td>\n" );

        fptof( fpout, "          </tr>\n\n" );
    }

    fptof( fpout, "        </table>\n" );

    fptof( fpout, "<br>\n<br>\n" );
    fptof( fpout, "<br>\n<br>\n" );
    fptof( fpout, "</p>\n\n" );
    fptof( fpout, "          <small>\n" );
    fprintf( fpout,
             "Chronicles News System<a href=\"mailto:[email protected]?subject=The Elder Chronicles News Snippet, %s\">Orion Elder</a>.<br>",
             sysdata.mud_name );
    fptof( fpout,
           "Download at<a href=\"http://www.geocities.com/knytehawk/smaug/index.html\" target=\"SSWRA\">The SSWRA</a>.<br>" );
    fptof( fpout, "          </small>\n" );

    fptof( fpout, "\n\n\n\n" );
    fptof( fpout, "</div>\n" );
    fptof( fpout, "</div>\n" );
    fptof( fpout, "</div>\n" );
    fptof( fpout, "</div>\n" );
    fptof( fpout, "  </body>\n" );
    fptof( fpout, "</html>\n" );

    FileClose( fpout );
}