示例#1
0
文件: dmdcc.c 项目: Dmilo/freewpc
void
gen_simple_message (const char *name, const char *message,
	dcc_time duration)
{
	init_effect (name);
	dcc_label *l = alloc_label (message);
	current_effect->duration = duration;
	finish_effect ();
}
示例#2
0
文件: dmdcc.c 项目: Dmilo/freewpc
void
gen_simple_blink (const char *name, const char *message,
	dcc_time duration, dcc_time blink_time)
{
	init_effect (name);
	dcc_label *l = alloc_label (message);
	l->blink_time = blink_time;
	current_effect->duration = duration;
	current_effect->frame_time = blink_time;
	finish_effect ();
}
示例#3
0
文件: dmdcc.c 项目: Dmilo/freewpc
void
gen_two_line (void)
{
	init_effect ("two_line");
	push_row_area ();
		add_row (16);
			alloc_label ("SPECIAL");
		add_row (16);
			alloc_label ("WHEN LIT");
	pop_area ();
	current_effect->duration = 2000;
	finish_effect ();
}
示例#4
0
void aq_setup(void)
{
    int ch;

    /* Initialize Bps, bucket_size, device_qsize, and bucket_time */

    if(play_mode->encoding & PE_MONO)
	ch = 1;
    else
	ch = 2;
    if(play_mode->encoding & PE_16BIT)
	Bps = 2 * ch;
    else
	Bps = ch;

    if(play_mode->acntl(PM_REQ_GETFRAGSIZ, &bucket_size) == -1)
	bucket_size = audio_buffer_size * Bps;
    bucket_time = (double)bucket_size / Bps / play_mode->rate;

    if(IS_STREAM_TRACE)
    {
	if(play_mode->acntl(PM_REQ_GETQSIZ, &device_qsize) == -1)
	    device_qsize = estimate_queue_size();
	if(bucket_size * 2 > device_qsize) {
	  ctl->cmsg(CMSG_WARNING, VERB_VERBOSE,
		    "Warning: Audio buffer is too small.");
	  device_qsize = 0;
	} else {
	  device_qsize -= device_qsize % Bps; /* Round Bps */
	  ctl->cmsg(CMSG_INFO, VERB_DEBUG,
		    "Audio device queue size: %d bytes", device_qsize);
	  ctl->cmsg(CMSG_INFO, VERB_DEBUG,
		    "Write bucket size: %d bytes (%d msec)",
		    bucket_size, (int)(bucket_time * 1000 + 0.5));
	}
    }
    else
    {
	device_qsize = 0;
	if(base_buckets)
	{
	    free(base_buckets[0].data);
	    free(base_buckets);
	    base_buckets = NULL;
	}
	nbuckets = 0;
    }

    init_effect();
    aq_add_count = 0;
}
示例#5
0
t_wid			*init_surface(t_wid *wid)
{
  GtkWidget		*box[3];

  wid->surface = xmalloc(sizeof(t_surface));
  wid->surface->open = 0;
  wid->in_gen = 0;
  box[1] = gtk_hbox_new(TRUE, 0);
  box[0] = gtk_vbox_new(FALSE, 2);
  box[2] = gtk_vbox_new(FALSE, 2);
  gtk_box_pack_start(GTK_BOX(box[0]),
		     init_prev_next(wid), TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(box[0]),
		     init_pos(wid), FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(box[1]),
		     init_change(wid), FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(box[2]),
		     init_effect(wid), FALSE, FALSE, 0);
  wid->surface->box = gtk_frame_new("Object");
  gtk_container_add(GTK_CONTAINER(wid->surface->box),
		    GTK_WIDGET(unit_vbox(box, 3, FALSE, 0)));
  wid->data.obj_id = 0;
  return (wid);
}
示例#6
0
void
draw_scene(void)
{
  if (point_general->changement) {
    recalc_perspective();
    if (point_general->effect > EFFECT_NUMBER - 1) {
      point_general->effect = 0;
      if (gen_gl_texture(knotbg))
        upload_gl_texture(background_image);
      use_gl_texture(knotbg);
    }
    if (point_general->effect == 4) {
      if (gen_gl_texture(tunnel))
        upload_gl_texture(tunnel_image);
      use_gl_texture(tunnel);
    }
    if (point_general->effect == 5) {
      if (gen_gl_texture(tentacle))
        upload_gl_texture(tentacle_image);
      use_gl_texture(tentacle);
    }
    if (point_general->effect == 6) {
      if (gen_gl_texture(twist))
        upload_gl_texture(twist_image);
      if (gen_gl_texture(twistbg))
		upload_gl_texture(background_image);
      use_gl_texture(twist);
    }
    if (point_general->effect == 7) {
      if (gen_gl_texture(texchild))
        upload_gl_texture(child_image);
      if (gen_gl_texture(childbg))
        upload_gl_texture(energy_image);
      use_gl_texture(texchild);
    }
    if (point_general->effect == 8) {
      if (gen_gl_texture(energy))
        upload_gl_texture(energy_image);
      use_gl_texture(energy);
    }
    point_general->changement = FALSE;
  }
  switch (point_general->effect) {
    case 0:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_knot();
      break;
    case 1:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_spectrum();
      break;
    case 2:
      if (!point_general->init)
        init_effect();
      glEnable(GL_LIGHTING);
      draw_face();
      break;
    case 3:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_glthreads();
      break;
    case 4:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_tunnel();
      break;
    case 5:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_tentacles();
      break;
    case 6:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_twist();
      break;
    case 7:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_child();
      break;
    case 8:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_energy();
      break;
    default:
      break;
  }
}
示例#7
0
文件: aq.c 项目: Kinglions/modizer
int aq_flush(int discard)
{
    int rc;
    int more_trace;

    /* to avoid infinite loop */
    double t, timeout_expect;

    aq_add_count = 0;
    init_effect();

    if(discard)
    {
	trace_flush();
	if(play_mode->acntl(PM_REQ_DISCARD, NULL) != -1)
	{
	    flush_buckets();
	    return RC_NONE;
	}
	ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
		  "ERROR: Can't discard audio buffer");
    }

    if(!IS_STREAM_TRACE)
    {
	play_mode->acntl(PM_REQ_FLUSH, NULL);
	play_counter = play_offset_counter = 0;
	return RC_NONE;
    }

    rc = aq_soft_flush();
    if(RC_IS_SKIP_FILE(rc))
	return rc;

    more_trace = 1;
    t = get_current_calender_time();
    timeout_expect = t + (double)aq_filled() / play_mode->rate;

    while(more_trace || aq_filled() > 0)
    {
	rc = check_apply_control();
	if(RC_IS_SKIP_FILE(rc))
	{
	    play_mode->acntl(PM_REQ_DISCARD, NULL);
	    flush_buckets();
	    return rc;
	}
	more_trace = trace_loop();

	t = get_current_calender_time();
	if(t >= timeout_expect - 0.1)
	  break;

	if(!more_trace)
	  usleep((unsigned long)((timeout_expect - t) * 1000000));
	else
	  aq_wait_ticks();
    }

    trace_flush();
    play_mode->acntl(PM_REQ_FLUSH, NULL);
    flush_buckets();
    return RC_NONE;
}
示例#8
0
int main(int argc,char *args[])
{
	int n,c;
	unsigned long long prof,start,end;

	end_of_data_ptr=sbrk(0);

	time_now=time(NULL);

	printf("\n");
	printf("   ********************************************\n");
        printf("   *     Astonia 3 - The Conflict Server      *\n");
	printf("   *             Version %d.%02d.%02d              *\n",VERSION>>16,(VERSION>>8)&255,VERSION&255);
	printf("   ********************************************\n");
        printf("   * Copyright (C) 2001-2008 Intent Software  *\n");
	printf("   * Copyright (C) 1997-2001 Daniel Brockhaus *\n");
	printf("   ********************************************\n");
	printf("\n");

        if (argc>1) {
		while (1) {
			c=getopt(argc,args,"a:m:i:dhc");
			if (c==-1) break;

			switch (c) {
				case 'a': 	if (optarg) areaID=atoi(optarg); break;
				case 'm': 	if (optarg) areaM=atoi(optarg); break;
				case 'd': 	demon=1; break;
				case 'h':	fprintf(stderr,"Usage: %s [-a <areaID>] [-m <mirror>] [-n <use this class A net>] [-d] [-c]\n\n-d Demonize\n-c Disable concurrent database access\n\n",args[0]); exit(0);
				case 'c':	multi=0; break;
				//case 'n':	if (optarg) server_net=atoi(optarg); break;
				case 'i':	if (optarg) serverID=atoi(optarg); break;
			}
		}
	}

	if (!areaID) {
		printf("No areaID given, assuming areaID=1\n");
		areaID=1;
	}
	if (!areaM) {
		printf("No mirror given, assuming areaM=1\n");
		areaM=1;
	}
	if (!serverID) {
		printf("No serverID given, assuming serverID=1\n");
		serverID=1;
	}

#ifdef STAFF
	while (!check_staff_start()) sleep(1);
#endif


        // set character number limit depending on area
	switch(areaID) {
		case 1:		maxchars=512; break;
		case 2:		maxchars=896; break;
		case 3:		maxchars=384; break;
		case 4:		maxchars=2048; break;
		case 5:		maxchars=768; break;
		case 6:		maxchars=384; break;
		case 7:		maxchars=1280; break;
		case 8:		maxchars=384; break;
		case 9:		maxchars=1280; break;
		case 10:	maxchars=512; break;
		case 11:	maxchars=384; break;
		case 12:	maxitem=1024*48; maxchars=384; break;
		case 13:	maxchars=9*50+200; break;
		case 14:	maxchars=16*50+200; break;
		case 15:	maxchars=384; break;
		case 16:	maxchars=384; break;
		case 17:	maxchars=512; break;
		case 18:	maxchars=768; break;
		case 19:	maxchars=384; break;
		case 20:	maxchars=768; break;
		case 21:	maxchars=768; break;
		case 22:	maxchars=512; break;
		case 23:	maxchars=512; break;
		case 24:	maxchars=384; break;
		case 25:	maxchars=384+8*25*2; break;
		case 26:	maxchars=256; break;
		case 27:	maxchars=2048; break;
		case 28:	maxchars=384; break;
		case 29:	maxchars=512; break;
		case 30:	maxchars=384; break;
		case 31:	maxitem=1024*40; maxchars=512; break;
		case 32:	maxchars=1280; break;
		case 33:	maxchars=1600; break;
		case 34:	maxchars=1280; break;
		case 35:	maxchars=768; break;
		case 36:	maxchars=768; break;
		case 37:	maxchars=1024; break;

		default:	maxchars=768; break;
	}
	
	// set item and effect limit
	if (!maxitem) maxitem=max(maxchars*12+10240,20480);
	if (!maxeffect) maxeffect=max(maxchars*2,1024);

	printf("serverID=%d, areaID=%d, areaM=%d, maxchars=%d, maxitem=%d, maxeffect=%d\n\n",
	       serverID,areaID,areaM,maxchars,maxitem,maxeffect);

	if (demon) {
		printf("Demonizing...\n\n");
		
		if (fork()) exit(0);
		for (n=0; n<256; n++) close(n);
		setsid();
#ifndef STAFF
		nologin=1;
#endif
	}

        // ignore the silly pipe errors:
        signal(SIGPIPE,SIG_IGN);

	// ignore sighup - just to be safe
        signal(SIGHUP,SIG_IGN);

	/*signal(SIGSEGV,sig_crash);
	signal(SIGFPE,sig_crash);
	signal(SIGBUS,sig_crash);
	signal(SIGSTKFLT,sig_crash);*/

        // shutdown gracefully if possible:
        signal(SIGQUIT,sig_leave);
        signal(SIGINT,sig_leave);
        signal(SIGTERM,sig_leave);

	// show profile info on CTRL-Z
	signal(SIGTSTP,sig_showprof);

	// init random number generator
        srand(time_now);

	if (!init_smalloc()) exit(1);
	if (!init_mem()) exit(1);
        if (!init_prof()) exit(1);
	if (!init_log()) exit(1);	
        if (!init_database()) exit(1);
	if (!init_lookup())  exit(1);
        if (!init_sector())  exit(1);
        if (!init_los()) exit(1);
	if (!init_timer()) exit(1);
        if (!init_notify()) exit(1);
	if (!init_create()) exit(1);
        if (!init_lib()) exit(1);
	if (!init_io()) exit(1);
        if (!init_path()) exit(1);	
	if (!init_effect()) exit(1);
	if (!init_container()) exit(1);
	if (!init_store()) exit(1);
	if (!init_chat()) exit(1);

	init_sound_sector();

	xlog("AreaID=%d, AreaM=%d, entering game loop...",areaID,areaM);

	dlog(0,0,"Server started");
	prof_reset();

        while (!quit) {
		sprintf(args[0],"./server -a %d -m %d -i %d # %d on %d%% load (busy)",areaID,areaM,serverID,online,(10000-server_idle)/100);
		start=rdtsc();
		lock_server();

		time_now=time(NULL);
		prof=prof_start(26); tick_date(); prof_stop(26,prof);
		prof=prof_start(22); tick_timer(); prof_stop(22,prof);
                prof=prof_start(4); tick_char(); prof_stop(4,prof);
                prof=prof_start(24); tick_effect(); prof_stop(24,prof);
		prof=prof_start(36); tick_clan(); prof_stop(36,prof);
		prof=prof_start(39); tick_club(); prof_stop(39,prof);
		prof=prof_start(5); tick_player(); prof_stop(5,prof);
		prof=prof_start(34); tick_login(); prof_stop(34,prof);
                prof=prof_start(6); pflush(); prof_stop(6,prof);
		prof=prof_start(7); io_loop(); prof_stop(7,prof);
                prof=prof_start(3); tick_chat(); prof_stop(3,prof);

		if (showprof) {
			show_prof();
			showprof=0;
		}
		
		prof=prof_start(8); prof_update(); prof_stop(8,prof);

		end=rdtsc();
		cycles=end-start;

		if ((ticker&2047)==0) {
			prof=prof_start(27); area_alive(0); prof_stop(27,prof);
			prof=prof_start(28); backup_players(); prof_stop(28,prof);
			call_stat_update();
			read_motd();			
			reinit_log();
		}

		if ((ticker&255)==0) {
			call_check_task();
			call_area_load();
			shutdown_warn();
#ifdef STAFF
			check_staff_stop();
#endif
		}

		if ((ticker&255)==168) {
			prof=prof_start(38);
			consistency_check_items();
			consistency_check_map();
			consistency_check_chars();
			consistency_check_containers();
			prof_stop(38,prof);
		}

                unlock_server();

		sprintf(args[0],"./server -a %d -m %d -i %d # %d on %d%% load (idle)",areaID,areaM,serverID,online,(10000-server_idle)/100);

		prof=prof_start(1); tick_sleep(0); prof_stop(1,prof);
		
		ticker++;
	}

        xlog("Left game loop");
	respawn_check();

	for (n=1; n<MAXCHARS; n++) {
		if (ch[n].flags&CF_PLAYER) {
			exit_char(n);
		}
	}
	area_alive(1);

        show_prof();

	dlog(0,0,"Server stopped");

	xlog("map check");
	check_map();

        exit_lib();
	exit_database();

	xlog("Clean shutdown");
	showmem();
	exit_log();
	exit_io();

        return 0;
}
示例#9
0
/* static knot data. each effect is listed and knot data is hard coded. 
   Knots are linerally interpolated to yield float values, depending on
   knot width.  knot format is [time, data, data, data...].
   Data can be alpha, zvalue, etc. */
static void init_effects(effect_t *e, int effectnum)
{
	/* effect 1: wall tunnel. percent closed */
	float e1d[6][2] = 
		{{0.0, 0.055}, 
		 {2.77, 0.055}, 
		 {3.07,1.0}, 
		 {8.08, 1.0},
		 {8.08, 0.0}, 
		 {10.0, 0.0}};
	/* effect 2: tardis. distance and alpha */
	float e2d[8][3] = 
	{	{0.0, 0.0 , 0.0}, 
		{3.44, 0.0 , 0.0},
		{3.36, 5.4 , 0.0},
		{4.24, 3.66, 1.0},
		{6.51, 2.4,  0.94},
		{8.08, 0.75 , 0.0}, 
		{8.08, 0.0 , 0.0},
		{10.0, 0.0, 0.0}};
	/* effect 3: cylinder. alpha  */
	float e3d[5][2] = 
		{{0.0, 0.0}, 
		 {6.41, 0.00},
		 {8.08, 1.0}, 
		 {14.81, 1.0},
		 {15.65, 0.0}};

	/* effect 4: fog. color, density,  start, end  */
	float e4d[9][5] = 
		{{0.0 , 1.0, 0.45, 3.0, 15.0},
		 {6.40, 1.0, 0.45, 3.0, 14.0},
		 {8.08, 1.0, 0.95, 1.0, 14.0},
		 {15.17, 1.0, 0.95, 1.0, 6.0},
		 {15.51, 1.0, 0.95, 3.0, 8.0},
		 {23.35, 1.0, 0.95, 3.0, 8.0},
		 {24.02, 0.0, 0.95, 2.3, 5.0},
		 {26.02, 0.0, 0.95, 2.3, 5.0},
		 {27.72, 0.0, 1.00, 0.3, 0.9}
		 };

	/* effect 5: logo. dist, alpha  */
	float e5d[7][3] = 
		{{0.0, 0.0, 0.0}, 
		{16.52, 0.00, 0.0}, 
		{16.52, 0.80, 0.01}, 
		{17.18, 1.15, 1.0}, 
		{22.36, 5.3, 1.0}, 
		{22.69, 5.7, 0.0},
		{22.69, 0.0, 0.0}
		};
	/* effect 6: diamond tunnel. alpha */
	float e6d[3][2] = 
		{{0.0, 0.00}, 
		{15.17, 0.00},
		{15.51,1.0}};

	/* effect 7: tardis cap draw . positive draws cap*/
	float e7d[3][2] = 
		{{0.0, -1.00}, 
		{4.24, -1.00},
		{4.24, 1.00}};

	/* effect 8: star/asterisk: alpha */
	float e8d[5][2] = 
		{{0.0,    .00}, 
		{10.77,   .00},
		{11.48,  1.00},
		{15.35,  1.00},
		{16.12,  0.00}};

	/* effect 9: whohead 1  alpha */
	float e9d[5][2] = 
		{{0.0,    .00}, 
		{13.35,   .00},
		{14.48,  1.00},
		{15.17,  1.00},
		{15.97,  0.00}};
		/* {14.87,  1.00},
		{15.17,  0.00}}; */

	/* effect 10: whohead-brite  alpha */
	float e10d[5][2] = 
		{{0.0,    .00}, 
		{11.34,   .00},
		{12.34,   .20},
		{13.35,  0.60},
		{14.48,  0.00}}; 
		/* {13.95,  0.00}}; */

	/* effect 11: whohead-psy  alpha */
	float e11d[5][2] = 
		{{0.0,    .00}, 
		{14.87,   .00},
		{15.17,  1.00},
		{15.91,  0.00},
		{16.12,  0.00}};

	/* effect 12: whohead-silhouette pos-z,  alpha */
	float e12d[6][3] = 
		{{0.0,   1.0,  .00}, 
		{15.07,  1.0, 0.00},
		{15.07,  1.0, 1.00},
		{16.01,  1.0, 1.00},
		{16.78,  0.5, 1.00},
		{16.78,  0.1, 0.00} };

	/* effect 1: wall tunnel */
	if (effectnum == 1)
		init_effect(e, 6, 2,  -0.2, (float *) e1d);

	/* effect 2: tardisl */
	if (effectnum == 2)
		init_effect(e, 8, 3, 1.0,  (float *) e2d);

	/* effect 3: cylinder tunnel  */
	if (effectnum == 3)
		init_effect(e, 5, 2, 0.889  ,  (float *) e3d);

	/* effect 4: fog color */
	if (effectnum == 4)
		init_effect(e, 9, 5, 1.0,  (float *) e4d);
	/* effect 5: logo distance, alpha*/
	if (effectnum == 5)
		init_effect(e, 7, 3, 1.0,  (float *) e5d);
	/* effect 6: diamond tunnel, alpha*/
	if (effectnum == 6)
		init_effect(e, 3, 2, 0.24 ,  (float *) e6d);

	/* effect 7: cap wall tunnel*/
	if (effectnum == 7)
		init_effect(e, 3, 2, 1.0,  (float *) e7d);

	/* effect 8: asterisk */
	if (effectnum == 8)
		init_effect(e, 5, 2, 1.0,  (float *) e8d);

	/* effect 9, 10, 11, 12: whoheads */
	if (effectnum == 9 )
		init_effect(e, 5, 2, 1.0,  (float *) e9d);
	if (effectnum == 10 )
		init_effect(e, 5, 2, 1.0,  (float *) e10d);
	if (effectnum == 11 )
		init_effect(e, 5, 2, 1.0,  (float *) e11d);
	if (effectnum == 12 )
		init_effect(e, 6, 3, 1.0,  (float *) e12d);
}